1 /* Generated by Cython 0.29.21 */
2 
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6     #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8     #error Cython requires Python 2.6+ or Python 3.3+.
9 #else
10 #define CYTHON_ABI "0_29_21"
11 #define CYTHON_HEX_VERSION 0x001D15F0
12 #define CYTHON_FUTURE_DIVISION 1
13 #include <stddef.h>
14 #ifndef offsetof
15   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
16 #endif
17 #if !defined(WIN32) && !defined(MS_WINDOWS)
18   #ifndef __stdcall
19     #define __stdcall
20   #endif
21   #ifndef __cdecl
22     #define __cdecl
23   #endif
24   #ifndef __fastcall
25     #define __fastcall
26   #endif
27 #endif
28 #ifndef DL_IMPORT
29   #define DL_IMPORT(t) t
30 #endif
31 #ifndef DL_EXPORT
32   #define DL_EXPORT(t) t
33 #endif
34 #define __PYX_COMMA ,
35 #ifndef HAVE_LONG_LONG
36   #if PY_VERSION_HEX >= 0x02070000
37     #define HAVE_LONG_LONG
38   #endif
39 #endif
40 #ifndef PY_LONG_LONG
41   #define PY_LONG_LONG LONG_LONG
42 #endif
43 #ifndef Py_HUGE_VAL
44   #define Py_HUGE_VAL HUGE_VAL
45 #endif
46 #ifdef PYPY_VERSION
47   #define CYTHON_COMPILING_IN_PYPY 1
48   #define CYTHON_COMPILING_IN_PYSTON 0
49   #define CYTHON_COMPILING_IN_CPYTHON 0
50   #undef CYTHON_USE_TYPE_SLOTS
51   #define CYTHON_USE_TYPE_SLOTS 0
52   #undef CYTHON_USE_PYTYPE_LOOKUP
53   #define CYTHON_USE_PYTYPE_LOOKUP 0
54   #if PY_VERSION_HEX < 0x03050000
55     #undef CYTHON_USE_ASYNC_SLOTS
56     #define CYTHON_USE_ASYNC_SLOTS 0
57   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
58     #define CYTHON_USE_ASYNC_SLOTS 1
59   #endif
60   #undef CYTHON_USE_PYLIST_INTERNALS
61   #define CYTHON_USE_PYLIST_INTERNALS 0
62   #undef CYTHON_USE_UNICODE_INTERNALS
63   #define CYTHON_USE_UNICODE_INTERNALS 0
64   #undef CYTHON_USE_UNICODE_WRITER
65   #define CYTHON_USE_UNICODE_WRITER 0
66   #undef CYTHON_USE_PYLONG_INTERNALS
67   #define CYTHON_USE_PYLONG_INTERNALS 0
68   #undef CYTHON_AVOID_BORROWED_REFS
69   #define CYTHON_AVOID_BORROWED_REFS 1
70   #undef CYTHON_ASSUME_SAFE_MACROS
71   #define CYTHON_ASSUME_SAFE_MACROS 0
72   #undef CYTHON_UNPACK_METHODS
73   #define CYTHON_UNPACK_METHODS 0
74   #undef CYTHON_FAST_THREAD_STATE
75   #define CYTHON_FAST_THREAD_STATE 0
76   #undef CYTHON_FAST_PYCALL
77   #define CYTHON_FAST_PYCALL 0
78   #undef CYTHON_PEP489_MULTI_PHASE_INIT
79   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
80   #undef CYTHON_USE_TP_FINALIZE
81   #define CYTHON_USE_TP_FINALIZE 0
82   #undef CYTHON_USE_DICT_VERSIONS
83   #define CYTHON_USE_DICT_VERSIONS 0
84   #undef CYTHON_USE_EXC_INFO_STACK
85   #define CYTHON_USE_EXC_INFO_STACK 0
86 #elif defined(PYSTON_VERSION)
87   #define CYTHON_COMPILING_IN_PYPY 0
88   #define CYTHON_COMPILING_IN_PYSTON 1
89   #define CYTHON_COMPILING_IN_CPYTHON 0
90   #ifndef CYTHON_USE_TYPE_SLOTS
91     #define CYTHON_USE_TYPE_SLOTS 1
92   #endif
93   #undef CYTHON_USE_PYTYPE_LOOKUP
94   #define CYTHON_USE_PYTYPE_LOOKUP 0
95   #undef CYTHON_USE_ASYNC_SLOTS
96   #define CYTHON_USE_ASYNC_SLOTS 0
97   #undef CYTHON_USE_PYLIST_INTERNALS
98   #define CYTHON_USE_PYLIST_INTERNALS 0
99   #ifndef CYTHON_USE_UNICODE_INTERNALS
100     #define CYTHON_USE_UNICODE_INTERNALS 1
101   #endif
102   #undef CYTHON_USE_UNICODE_WRITER
103   #define CYTHON_USE_UNICODE_WRITER 0
104   #undef CYTHON_USE_PYLONG_INTERNALS
105   #define CYTHON_USE_PYLONG_INTERNALS 0
106   #ifndef CYTHON_AVOID_BORROWED_REFS
107     #define CYTHON_AVOID_BORROWED_REFS 0
108   #endif
109   #ifndef CYTHON_ASSUME_SAFE_MACROS
110     #define CYTHON_ASSUME_SAFE_MACROS 1
111   #endif
112   #ifndef CYTHON_UNPACK_METHODS
113     #define CYTHON_UNPACK_METHODS 1
114   #endif
115   #undef CYTHON_FAST_THREAD_STATE
116   #define CYTHON_FAST_THREAD_STATE 0
117   #undef CYTHON_FAST_PYCALL
118   #define CYTHON_FAST_PYCALL 0
119   #undef CYTHON_PEP489_MULTI_PHASE_INIT
120   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
121   #undef CYTHON_USE_TP_FINALIZE
122   #define CYTHON_USE_TP_FINALIZE 0
123   #undef CYTHON_USE_DICT_VERSIONS
124   #define CYTHON_USE_DICT_VERSIONS 0
125   #undef CYTHON_USE_EXC_INFO_STACK
126   #define CYTHON_USE_EXC_INFO_STACK 0
127 #else
128   #define CYTHON_COMPILING_IN_PYPY 0
129   #define CYTHON_COMPILING_IN_PYSTON 0
130   #define CYTHON_COMPILING_IN_CPYTHON 1
131   #ifndef CYTHON_USE_TYPE_SLOTS
132     #define CYTHON_USE_TYPE_SLOTS 1
133   #endif
134   #if PY_VERSION_HEX < 0x02070000
135     #undef CYTHON_USE_PYTYPE_LOOKUP
136     #define CYTHON_USE_PYTYPE_LOOKUP 0
137   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
138     #define CYTHON_USE_PYTYPE_LOOKUP 1
139   #endif
140   #if PY_MAJOR_VERSION < 3
141     #undef CYTHON_USE_ASYNC_SLOTS
142     #define CYTHON_USE_ASYNC_SLOTS 0
143   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
144     #define CYTHON_USE_ASYNC_SLOTS 1
145   #endif
146   #if PY_VERSION_HEX < 0x02070000
147     #undef CYTHON_USE_PYLONG_INTERNALS
148     #define CYTHON_USE_PYLONG_INTERNALS 0
149   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
150     #define CYTHON_USE_PYLONG_INTERNALS 1
151   #endif
152   #ifndef CYTHON_USE_PYLIST_INTERNALS
153     #define CYTHON_USE_PYLIST_INTERNALS 1
154   #endif
155   #ifndef CYTHON_USE_UNICODE_INTERNALS
156     #define CYTHON_USE_UNICODE_INTERNALS 1
157   #endif
158   #if PY_VERSION_HEX < 0x030300F0
159     #undef CYTHON_USE_UNICODE_WRITER
160     #define CYTHON_USE_UNICODE_WRITER 0
161   #elif !defined(CYTHON_USE_UNICODE_WRITER)
162     #define CYTHON_USE_UNICODE_WRITER 1
163   #endif
164   #ifndef CYTHON_AVOID_BORROWED_REFS
165     #define CYTHON_AVOID_BORROWED_REFS 0
166   #endif
167   #ifndef CYTHON_ASSUME_SAFE_MACROS
168     #define CYTHON_ASSUME_SAFE_MACROS 1
169   #endif
170   #ifndef CYTHON_UNPACK_METHODS
171     #define CYTHON_UNPACK_METHODS 1
172   #endif
173   #ifndef CYTHON_FAST_THREAD_STATE
174     #define CYTHON_FAST_THREAD_STATE 1
175   #endif
176   #ifndef CYTHON_FAST_PYCALL
177     #define CYTHON_FAST_PYCALL 1
178   #endif
179   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
180     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
181   #endif
182   #ifndef CYTHON_USE_TP_FINALIZE
183     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
184   #endif
185   #ifndef CYTHON_USE_DICT_VERSIONS
186     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
187   #endif
188   #ifndef CYTHON_USE_EXC_INFO_STACK
189     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
190   #endif
191 #endif
192 #if !defined(CYTHON_FAST_PYCCALL)
193 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
194 #endif
195 #if CYTHON_USE_PYLONG_INTERNALS
196   #include "longintrepr.h"
197   #undef SHIFT
198   #undef BASE
199   #undef MASK
200   #ifdef SIZEOF_VOID_P
201     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
202   #endif
203 #endif
204 #ifndef __has_attribute
205   #define __has_attribute(x) 0
206 #endif
207 #ifndef __has_cpp_attribute
208   #define __has_cpp_attribute(x) 0
209 #endif
210 #ifndef CYTHON_RESTRICT
211   #if defined(__GNUC__)
212     #define CYTHON_RESTRICT __restrict__
213   #elif defined(_MSC_VER) && _MSC_VER >= 1400
214     #define CYTHON_RESTRICT __restrict
215   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
216     #define CYTHON_RESTRICT restrict
217   #else
218     #define CYTHON_RESTRICT
219   #endif
220 #endif
221 #ifndef CYTHON_UNUSED
222 # if defined(__GNUC__)
223 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
224 #     define CYTHON_UNUSED __attribute__ ((__unused__))
225 #   else
226 #     define CYTHON_UNUSED
227 #   endif
228 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
229 #   define CYTHON_UNUSED __attribute__ ((__unused__))
230 # else
231 #   define CYTHON_UNUSED
232 # endif
233 #endif
234 #ifndef CYTHON_MAYBE_UNUSED_VAR
235 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)236      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
237 #  else
238 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
239 #  endif
240 #endif
241 #ifndef CYTHON_NCP_UNUSED
242 # if CYTHON_COMPILING_IN_CPYTHON
243 #  define CYTHON_NCP_UNUSED
244 # else
245 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
246 # endif
247 #endif
248 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
249 #ifdef _MSC_VER
250     #ifndef _MSC_STDINT_H_
251         #if _MSC_VER < 1300
252            typedef unsigned char     uint8_t;
253            typedef unsigned int      uint32_t;
254         #else
255            typedef unsigned __int8   uint8_t;
256            typedef unsigned __int32  uint32_t;
257         #endif
258     #endif
259 #else
260    #include <stdint.h>
261 #endif
262 #ifndef CYTHON_FALLTHROUGH
263   #if defined(__cplusplus) && __cplusplus >= 201103L
264     #if __has_cpp_attribute(fallthrough)
265       #define CYTHON_FALLTHROUGH [[fallthrough]]
266     #elif __has_cpp_attribute(clang::fallthrough)
267       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
268     #elif __has_cpp_attribute(gnu::fallthrough)
269       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
270     #endif
271   #endif
272   #ifndef CYTHON_FALLTHROUGH
273     #if __has_attribute(fallthrough)
274       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
275     #else
276       #define CYTHON_FALLTHROUGH
277     #endif
278   #endif
279   #if defined(__clang__ ) && defined(__apple_build_version__)
280     #if __apple_build_version__ < 7000000
281       #undef  CYTHON_FALLTHROUGH
282       #define CYTHON_FALLTHROUGH
283     #endif
284   #endif
285 #endif
286 
287 #ifndef CYTHON_INLINE
288   #if defined(__clang__)
289     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
290   #elif defined(__GNUC__)
291     #define CYTHON_INLINE __inline__
292   #elif defined(_MSC_VER)
293     #define CYTHON_INLINE __inline
294   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
295     #define CYTHON_INLINE inline
296   #else
297     #define CYTHON_INLINE
298   #endif
299 #endif
300 
301 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
302   #define Py_OptimizeFlag 0
303 #endif
304 #define __PYX_BUILD_PY_SSIZE_T "n"
305 #define CYTHON_FORMAT_SSIZE_T "z"
306 #if PY_MAJOR_VERSION < 3
307   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
308   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
309           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
310   #define __Pyx_DefaultClassType PyClass_Type
311 #else
312   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
313 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
314   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
315           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
316 #else
317   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
318           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
319 #endif
320   #define __Pyx_DefaultClassType PyType_Type
321 #endif
322 #ifndef Py_TPFLAGS_CHECKTYPES
323   #define Py_TPFLAGS_CHECKTYPES 0
324 #endif
325 #ifndef Py_TPFLAGS_HAVE_INDEX
326   #define Py_TPFLAGS_HAVE_INDEX 0
327 #endif
328 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
329   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
330 #endif
331 #ifndef Py_TPFLAGS_HAVE_FINALIZE
332   #define Py_TPFLAGS_HAVE_FINALIZE 0
333 #endif
334 #ifndef METH_STACKLESS
335   #define METH_STACKLESS 0
336 #endif
337 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
338   #ifndef METH_FASTCALL
339      #define METH_FASTCALL 0x80
340   #endif
341   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
342   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
343                                                           Py_ssize_t nargs, PyObject *kwnames);
344 #else
345   #define __Pyx_PyCFunctionFast _PyCFunctionFast
346   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
347 #endif
348 #if CYTHON_FAST_PYCCALL
349 #define __Pyx_PyFastCFunction_Check(func)\
350     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
351 #else
352 #define __Pyx_PyFastCFunction_Check(func) 0
353 #endif
354 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
355   #define PyObject_Malloc(s)   PyMem_Malloc(s)
356   #define PyObject_Free(p)     PyMem_Free(p)
357   #define PyObject_Realloc(p)  PyMem_Realloc(p)
358 #endif
359 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
360   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
361   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
362   #define PyMem_RawFree(p)             PyMem_Free(p)
363 #endif
364 #if CYTHON_COMPILING_IN_PYSTON
365   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
366   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
367 #else
368   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
369   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
370 #endif
371 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
372   #define __Pyx_PyThreadState_Current PyThreadState_GET()
373 #elif PY_VERSION_HEX >= 0x03060000
374   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
375 #elif PY_VERSION_HEX >= 0x03000000
376   #define __Pyx_PyThreadState_Current PyThreadState_GET()
377 #else
378   #define __Pyx_PyThreadState_Current _PyThreadState_Current
379 #endif
380 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
381 #include "pythread.h"
382 #define Py_tss_NEEDS_INIT 0
383 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)384 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
385   *key = PyThread_create_key();
386   return 0;
387 }
PyThread_tss_alloc(void)388 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
389   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
390   *key = Py_tss_NEEDS_INIT;
391   return key;
392 }
PyThread_tss_free(Py_tss_t * key)393 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
394   PyObject_Free(key);
395 }
PyThread_tss_is_created(Py_tss_t * key)396 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
397   return *key != Py_tss_NEEDS_INIT;
398 }
PyThread_tss_delete(Py_tss_t * key)399 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
400   PyThread_delete_key(*key);
401   *key = Py_tss_NEEDS_INIT;
402 }
PyThread_tss_set(Py_tss_t * key,void * value)403 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
404   return PyThread_set_key_value(*key, value);
405 }
PyThread_tss_get(Py_tss_t * key)406 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
407   return PyThread_get_key_value(*key);
408 }
409 #endif
410 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
411 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
412 #else
413 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
414 #endif
415 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
416   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
417   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
418 #else
419   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
420   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
421 #endif
422 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
423 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
424 #else
425 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
426 #endif
427 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
428   #define CYTHON_PEP393_ENABLED 1
429   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
430                                               0 : _PyUnicode_Ready((PyObject *)(op)))
431   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
432   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
433   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
434   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
435   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
436   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
437   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
438   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
439   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
440   #else
441   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
442   #endif
443 #else
444   #define CYTHON_PEP393_ENABLED 0
445   #define PyUnicode_1BYTE_KIND  1
446   #define PyUnicode_2BYTE_KIND  2
447   #define PyUnicode_4BYTE_KIND  4
448   #define __Pyx_PyUnicode_READY(op)       (0)
449   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
450   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
451   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
452   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
453   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
454   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
455   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
456   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
457 #endif
458 #if CYTHON_COMPILING_IN_PYPY
459   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
460   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
461 #else
462   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
463   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
464       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
465 #endif
466 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
467   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
468 #endif
469 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
470   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
471 #endif
472 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
473   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
474 #endif
475 #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))
476 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
477 #if PY_MAJOR_VERSION >= 3
478   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
479 #else
480   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
481 #endif
482 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
483   #define PyObject_ASCII(o)            PyObject_Repr(o)
484 #endif
485 #if PY_MAJOR_VERSION >= 3
486   #define PyBaseString_Type            PyUnicode_Type
487   #define PyStringObject               PyUnicodeObject
488   #define PyString_Type                PyUnicode_Type
489   #define PyString_Check               PyUnicode_Check
490   #define PyString_CheckExact          PyUnicode_CheckExact
491 #ifndef PyObject_Unicode
492   #define PyObject_Unicode             PyObject_Str
493 #endif
494 #endif
495 #if PY_MAJOR_VERSION >= 3
496   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
497   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
498 #else
499   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
500   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
501 #endif
502 #ifndef PySet_CheckExact
503   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
504 #endif
505 #if PY_VERSION_HEX >= 0x030900A4
506   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
507   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
508 #else
509   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
510   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
511 #endif
512 #if CYTHON_ASSUME_SAFE_MACROS
513   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
514 #else
515   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
516 #endif
517 #if PY_MAJOR_VERSION >= 3
518   #define PyIntObject                  PyLongObject
519   #define PyInt_Type                   PyLong_Type
520   #define PyInt_Check(op)              PyLong_Check(op)
521   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
522   #define PyInt_FromString             PyLong_FromString
523   #define PyInt_FromUnicode            PyLong_FromUnicode
524   #define PyInt_FromLong               PyLong_FromLong
525   #define PyInt_FromSize_t             PyLong_FromSize_t
526   #define PyInt_FromSsize_t            PyLong_FromSsize_t
527   #define PyInt_AsLong                 PyLong_AsLong
528   #define PyInt_AS_LONG                PyLong_AS_LONG
529   #define PyInt_AsSsize_t              PyLong_AsSsize_t
530   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
531   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
532   #define PyNumber_Int                 PyNumber_Long
533 #endif
534 #if PY_MAJOR_VERSION >= 3
535   #define PyBoolObject                 PyLongObject
536 #endif
537 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
538   #ifndef PyUnicode_InternFromString
539     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
540   #endif
541 #endif
542 #if PY_VERSION_HEX < 0x030200A4
543   typedef long Py_hash_t;
544   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
545   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
546 #else
547   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
548   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
549 #endif
550 #if PY_MAJOR_VERSION >= 3
551   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
552 #else
553   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
554 #endif
555 #if CYTHON_USE_ASYNC_SLOTS
556   #if PY_VERSION_HEX >= 0x030500B1
557     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
558     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
559   #else
560     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
561   #endif
562 #else
563   #define __Pyx_PyType_AsAsync(obj) NULL
564 #endif
565 #ifndef __Pyx_PyAsyncMethodsStruct
566     typedef struct {
567         unaryfunc am_await;
568         unaryfunc am_aiter;
569         unaryfunc am_anext;
570     } __Pyx_PyAsyncMethodsStruct;
571 #endif
572 
573 #if defined(WIN32) || defined(MS_WINDOWS)
574   #define _USE_MATH_DEFINES
575 #endif
576 #include <math.h>
577 #ifdef NAN
578 #define __PYX_NAN() ((float) NAN)
579 #else
__PYX_NAN()580 static CYTHON_INLINE float __PYX_NAN() {
581   float value;
582   memset(&value, 0xFF, sizeof(value));
583   return value;
584 }
585 #endif
586 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
587 #define __Pyx_truncl trunc
588 #else
589 #define __Pyx_truncl truncl
590 #endif
591 
592 #define __PYX_MARK_ERR_POS(f_index, lineno) \
593     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
594 #define __PYX_ERR(f_index, lineno, Ln_error) \
595     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
596 
597 #ifndef __PYX_EXTERN_C
598   #ifdef __cplusplus
599     #define __PYX_EXTERN_C extern "C"
600   #else
601     #define __PYX_EXTERN_C extern
602   #endif
603 #endif
604 
605 #define __PYX_HAVE__pymatgen__optimization__linear_assignment
606 #define __PYX_HAVE_API__pymatgen__optimization__linear_assignment
607 /* Early includes */
608 #include <string.h>
609 #include <stdio.h>
610 #include "numpy/arrayobject.h"
611 #include "numpy/ufuncobject.h"
612 
613     /* NumPy API declarations from "numpy/__init__.pxd" */
614 
615 #include <math.h>
616 #include <stdlib.h>
617 #include "pythread.h"
618 #include "pystate.h"
619 #ifdef _OPENMP
620 #include <omp.h>
621 #endif /* _OPENMP */
622 
623 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
624 #define CYTHON_WITHOUT_ASSERTIONS
625 #endif
626 
627 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
628                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
629 
630 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
631 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
632 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
633 #define __PYX_DEFAULT_STRING_ENCODING ""
634 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
635 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
636 #define __Pyx_uchar_cast(c) ((unsigned char)c)
637 #define __Pyx_long_cast(x) ((long)x)
638 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
639     (sizeof(type) < sizeof(Py_ssize_t))  ||\
640     (sizeof(type) > sizeof(Py_ssize_t) &&\
641           likely(v < (type)PY_SSIZE_T_MAX ||\
642                  v == (type)PY_SSIZE_T_MAX)  &&\
643           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
644                                 v == (type)PY_SSIZE_T_MIN)))  ||\
645     (sizeof(type) == sizeof(Py_ssize_t) &&\
646           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
647                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)648 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
649     return (size_t) i < (size_t) limit;
650 }
651 #if defined (__cplusplus) && __cplusplus >= 201103L
652     #include <cstdlib>
653     #define __Pyx_sst_abs(value) std::abs(value)
654 #elif SIZEOF_INT >= SIZEOF_SIZE_T
655     #define __Pyx_sst_abs(value) abs(value)
656 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
657     #define __Pyx_sst_abs(value) labs(value)
658 #elif defined (_MSC_VER)
659     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
660 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
661     #define __Pyx_sst_abs(value) llabs(value)
662 #elif defined (__GNUC__)
663     #define __Pyx_sst_abs(value) __builtin_llabs(value)
664 #else
665     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
666 #endif
667 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
668 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
669 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
670 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
671 #define __Pyx_PyBytes_FromString        PyBytes_FromString
672 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
673 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
674 #if PY_MAJOR_VERSION < 3
675     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
676     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
677 #else
678     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
679     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
680 #endif
681 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
682 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
683 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
684 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
685 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
688 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
689 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
690 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
691 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
693 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
694 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
695 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
696 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)697 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
698     const Py_UNICODE *u_end = u;
699     while (*u_end++) ;
700     return (size_t)(u_end - u - 1);
701 }
702 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
703 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
704 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
705 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
706 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
707 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
708 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
709 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
710 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
711 #define __Pyx_PySequence_Tuple(obj)\
712     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
713 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
714 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
715 #if CYTHON_ASSUME_SAFE_MACROS
716 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
717 #else
718 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
719 #endif
720 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
721 #if PY_MAJOR_VERSION >= 3
722 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
723 #else
724 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
725 #endif
726 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
727 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
728 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)729 static int __Pyx_init_sys_getdefaultencoding_params(void) {
730     PyObject* sys;
731     PyObject* default_encoding = NULL;
732     PyObject* ascii_chars_u = NULL;
733     PyObject* ascii_chars_b = NULL;
734     const char* default_encoding_c;
735     sys = PyImport_ImportModule("sys");
736     if (!sys) goto bad;
737     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
738     Py_DECREF(sys);
739     if (!default_encoding) goto bad;
740     default_encoding_c = PyBytes_AsString(default_encoding);
741     if (!default_encoding_c) goto bad;
742     if (strcmp(default_encoding_c, "ascii") == 0) {
743         __Pyx_sys_getdefaultencoding_not_ascii = 0;
744     } else {
745         char ascii_chars[128];
746         int c;
747         for (c = 0; c < 128; c++) {
748             ascii_chars[c] = c;
749         }
750         __Pyx_sys_getdefaultencoding_not_ascii = 1;
751         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
752         if (!ascii_chars_u) goto bad;
753         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
754         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
755             PyErr_Format(
756                 PyExc_ValueError,
757                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
758                 default_encoding_c);
759             goto bad;
760         }
761         Py_DECREF(ascii_chars_u);
762         Py_DECREF(ascii_chars_b);
763     }
764     Py_DECREF(default_encoding);
765     return 0;
766 bad:
767     Py_XDECREF(default_encoding);
768     Py_XDECREF(ascii_chars_u);
769     Py_XDECREF(ascii_chars_b);
770     return -1;
771 }
772 #endif
773 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
774 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
775 #else
776 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
777 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
778 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)779 static int __Pyx_init_sys_getdefaultencoding_params(void) {
780     PyObject* sys;
781     PyObject* default_encoding = NULL;
782     char* default_encoding_c;
783     sys = PyImport_ImportModule("sys");
784     if (!sys) goto bad;
785     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
786     Py_DECREF(sys);
787     if (!default_encoding) goto bad;
788     default_encoding_c = PyBytes_AsString(default_encoding);
789     if (!default_encoding_c) goto bad;
790     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
791     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
792     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
793     Py_DECREF(default_encoding);
794     return 0;
795 bad:
796     Py_XDECREF(default_encoding);
797     return -1;
798 }
799 #endif
800 #endif
801 
802 
803 /* Test for GCC > 2.95 */
804 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
805   #define likely(x)   __builtin_expect(!!(x), 1)
806   #define unlikely(x) __builtin_expect(!!(x), 0)
807 #else /* !__GNUC__ or GCC < 2.95 */
808   #define likely(x)   (x)
809   #define unlikely(x) (x)
810 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)811 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
812 
813 static PyObject *__pyx_m = NULL;
814 static PyObject *__pyx_d;
815 static PyObject *__pyx_b;
816 static PyObject *__pyx_cython_runtime = NULL;
817 static PyObject *__pyx_empty_tuple;
818 static PyObject *__pyx_empty_bytes;
819 static PyObject *__pyx_empty_unicode;
820 static int __pyx_lineno;
821 static int __pyx_clineno = 0;
822 static const char * __pyx_cfilenm= __FILE__;
823 static const char *__pyx_filename;
824 
825 /* Header.proto */
826 #if !defined(CYTHON_CCOMPLEX)
827   #if defined(__cplusplus)
828     #define CYTHON_CCOMPLEX 1
829   #elif defined(_Complex_I)
830     #define CYTHON_CCOMPLEX 1
831   #else
832     #define CYTHON_CCOMPLEX 0
833   #endif
834 #endif
835 #if CYTHON_CCOMPLEX
836   #ifdef __cplusplus
837     #include <complex>
838   #else
839     #include <complex.h>
840   #endif
841 #endif
842 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
843   #undef _Complex_I
844   #define _Complex_I 1.0fj
845 #endif
846 
847 
848 static const char *__pyx_f[] = {
849   "linear_assignment.pyx",
850   "__init__.pxd",
851   "stringsource",
852   "type.pxd",
853 };
854 /* MemviewSliceStruct.proto */
855 struct __pyx_memoryview_obj;
856 typedef struct {
857   struct __pyx_memoryview_obj *memview;
858   char *data;
859   Py_ssize_t shape[8];
860   Py_ssize_t strides[8];
861   Py_ssize_t suboffsets[8];
862 } __Pyx_memviewslice;
863 #define __Pyx_MemoryView_Len(m)  (m.shape[0])
864 
865 /* Atomics.proto */
866 #include <pythread.h>
867 #ifndef CYTHON_ATOMICS
868     #define CYTHON_ATOMICS 1
869 #endif
870 #define __pyx_atomic_int_type int
871 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
872                     (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
873                     !defined(__i386__)
874     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
875     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
876     #ifdef __PYX_DEBUG_ATOMICS
877         #warning "Using GNU atomics"
878     #endif
879 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
880     #include <Windows.h>
881     #undef __pyx_atomic_int_type
882     #define __pyx_atomic_int_type LONG
883     #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
884     #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
885     #ifdef __PYX_DEBUG_ATOMICS
886         #pragma message ("Using MSVC atomics")
887     #endif
888 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
889     #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
890     #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
891     #ifdef __PYX_DEBUG_ATOMICS
892         #warning "Using Intel atomics"
893     #endif
894 #else
895     #undef CYTHON_ATOMICS
896     #define CYTHON_ATOMICS 0
897     #ifdef __PYX_DEBUG_ATOMICS
898         #warning "Not using atomics"
899     #endif
900 #endif
901 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
902 #if CYTHON_ATOMICS
903     #define __pyx_add_acquisition_count(memview)\
904              __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
905     #define __pyx_sub_acquisition_count(memview)\
906             __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
907 #else
908     #define __pyx_add_acquisition_count(memview)\
909             __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
910     #define __pyx_sub_acquisition_count(memview)\
911             __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
912 #endif
913 
914 /* ForceInitThreads.proto */
915 #ifndef __PYX_FORCE_INIT_THREADS
916   #define __PYX_FORCE_INIT_THREADS 0
917 #endif
918 
919 /* NoFastGil.proto */
920 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
921 #define __Pyx_PyGILState_Release PyGILState_Release
922 #define __Pyx_FastGIL_Remember()
923 #define __Pyx_FastGIL_Forget()
924 #define __Pyx_FastGilFuncInit()
925 
926 /* BufferFormatStructs.proto */
927 #define IS_UNSIGNED(type) (((type) -1) > 0)
928 struct __Pyx_StructField_;
929 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
930 typedef struct {
931   const char* name;
932   struct __Pyx_StructField_* fields;
933   size_t size;
934   size_t arraysize[8];
935   int ndim;
936   char typegroup;
937   char is_unsigned;
938   int flags;
939 } __Pyx_TypeInfo;
940 typedef struct __Pyx_StructField_ {
941   __Pyx_TypeInfo* type;
942   const char* name;
943   size_t offset;
944 } __Pyx_StructField;
945 typedef struct {
946   __Pyx_StructField* field;
947   size_t parent_offset;
948 } __Pyx_BufFmt_StackElem;
949 typedef struct {
950   __Pyx_StructField root;
951   __Pyx_BufFmt_StackElem* head;
952   size_t fmt_offset;
953   size_t new_count, enc_count;
954   size_t struct_alignment;
955   int is_complex;
956   char enc_type;
957   char new_packmode;
958   char enc_packmode;
959   char is_valid_array;
960 } __Pyx_BufFmt_Context;
961 
962 
963 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":689
964  * # in Cython to enable them only on the right systems.
965  *
966  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
967  * ctypedef npy_int16      int16_t
968  * ctypedef npy_int32      int32_t
969  */
970 typedef npy_int8 __pyx_t_5numpy_int8_t;
971 
972 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":690
973  *
974  * ctypedef npy_int8       int8_t
975  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
976  * ctypedef npy_int32      int32_t
977  * ctypedef npy_int64      int64_t
978  */
979 typedef npy_int16 __pyx_t_5numpy_int16_t;
980 
981 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":691
982  * ctypedef npy_int8       int8_t
983  * ctypedef npy_int16      int16_t
984  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
985  * ctypedef npy_int64      int64_t
986  * #ctypedef npy_int96      int96_t
987  */
988 typedef npy_int32 __pyx_t_5numpy_int32_t;
989 
990 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":692
991  * ctypedef npy_int16      int16_t
992  * ctypedef npy_int32      int32_t
993  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
994  * #ctypedef npy_int96      int96_t
995  * #ctypedef npy_int128     int128_t
996  */
997 typedef npy_int64 __pyx_t_5numpy_int64_t;
998 
999 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":696
1000  * #ctypedef npy_int128     int128_t
1001  *
1002  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
1003  * ctypedef npy_uint16     uint16_t
1004  * ctypedef npy_uint32     uint32_t
1005  */
1006 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1007 
1008 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":697
1009  *
1010  * ctypedef npy_uint8      uint8_t
1011  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
1012  * ctypedef npy_uint32     uint32_t
1013  * ctypedef npy_uint64     uint64_t
1014  */
1015 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1016 
1017 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":698
1018  * ctypedef npy_uint8      uint8_t
1019  * ctypedef npy_uint16     uint16_t
1020  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
1021  * ctypedef npy_uint64     uint64_t
1022  * #ctypedef npy_uint96     uint96_t
1023  */
1024 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1025 
1026 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":699
1027  * ctypedef npy_uint16     uint16_t
1028  * ctypedef npy_uint32     uint32_t
1029  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
1030  * #ctypedef npy_uint96     uint96_t
1031  * #ctypedef npy_uint128    uint128_t
1032  */
1033 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1034 
1035 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":703
1036  * #ctypedef npy_uint128    uint128_t
1037  *
1038  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
1039  * ctypedef npy_float64    float64_t
1040  * #ctypedef npy_float80    float80_t
1041  */
1042 typedef npy_float32 __pyx_t_5numpy_float32_t;
1043 
1044 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":704
1045  *
1046  * ctypedef npy_float32    float32_t
1047  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
1048  * #ctypedef npy_float80    float80_t
1049  * #ctypedef npy_float128   float128_t
1050  */
1051 typedef npy_float64 __pyx_t_5numpy_float64_t;
1052 
1053 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":713
1054  * # The int types are mapped a bit surprising --
1055  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1056  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
1057  * ctypedef npy_longlong   long_t
1058  * ctypedef npy_longlong   longlong_t
1059  */
1060 typedef npy_long __pyx_t_5numpy_int_t;
1061 
1062 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":714
1063  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1064  * ctypedef npy_long       int_t
1065  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
1066  * ctypedef npy_longlong   longlong_t
1067  *
1068  */
1069 typedef npy_longlong __pyx_t_5numpy_long_t;
1070 
1071 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":715
1072  * ctypedef npy_long       int_t
1073  * ctypedef npy_longlong   long_t
1074  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
1075  *
1076  * ctypedef npy_ulong      uint_t
1077  */
1078 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1079 
1080 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":717
1081  * ctypedef npy_longlong   longlong_t
1082  *
1083  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
1084  * ctypedef npy_ulonglong  ulong_t
1085  * ctypedef npy_ulonglong  ulonglong_t
1086  */
1087 typedef npy_ulong __pyx_t_5numpy_uint_t;
1088 
1089 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":718
1090  *
1091  * ctypedef npy_ulong      uint_t
1092  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
1093  * ctypedef npy_ulonglong  ulonglong_t
1094  *
1095  */
1096 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1097 
1098 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":719
1099  * ctypedef npy_ulong      uint_t
1100  * ctypedef npy_ulonglong  ulong_t
1101  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
1102  *
1103  * ctypedef npy_intp       intp_t
1104  */
1105 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1106 
1107 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":721
1108  * ctypedef npy_ulonglong  ulonglong_t
1109  *
1110  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
1111  * ctypedef npy_uintp      uintp_t
1112  *
1113  */
1114 typedef npy_intp __pyx_t_5numpy_intp_t;
1115 
1116 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":722
1117  *
1118  * ctypedef npy_intp       intp_t
1119  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
1120  *
1121  * ctypedef npy_double     float_t
1122  */
1123 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1124 
1125 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":724
1126  * ctypedef npy_uintp      uintp_t
1127  *
1128  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
1129  * ctypedef npy_double     double_t
1130  * ctypedef npy_longdouble longdouble_t
1131  */
1132 typedef npy_double __pyx_t_5numpy_float_t;
1133 
1134 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":725
1135  *
1136  * ctypedef npy_double     float_t
1137  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
1138  * ctypedef npy_longdouble longdouble_t
1139  *
1140  */
1141 typedef npy_double __pyx_t_5numpy_double_t;
1142 
1143 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":726
1144  * ctypedef npy_double     float_t
1145  * ctypedef npy_double     double_t
1146  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
1147  *
1148  * ctypedef npy_cfloat      cfloat_t
1149  */
1150 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1151 /* Declarations.proto */
1152 #if CYTHON_CCOMPLEX
1153   #ifdef __cplusplus
1154     typedef ::std::complex< float > __pyx_t_float_complex;
1155   #else
1156     typedef float _Complex __pyx_t_float_complex;
1157   #endif
1158 #else
1159     typedef struct { float real, imag; } __pyx_t_float_complex;
1160 #endif
1161 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1162 
1163 /* Declarations.proto */
1164 #if CYTHON_CCOMPLEX
1165   #ifdef __cplusplus
1166     typedef ::std::complex< double > __pyx_t_double_complex;
1167   #else
1168     typedef double _Complex __pyx_t_double_complex;
1169   #endif
1170 #else
1171     typedef struct { double real, imag; } __pyx_t_double_complex;
1172 #endif
1173 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1174 
1175 
1176 /*--- Type declarations ---*/
1177 struct __pyx_array_obj;
1178 struct __pyx_MemviewEnum_obj;
1179 struct __pyx_memoryview_obj;
1180 struct __pyx_memoryviewslice_obj;
1181 
1182 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":728
1183  * ctypedef npy_longdouble longdouble_t
1184  *
1185  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
1186  * ctypedef npy_cdouble     cdouble_t
1187  * ctypedef npy_clongdouble clongdouble_t
1188  */
1189 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1190 
1191 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":729
1192  *
1193  * ctypedef npy_cfloat      cfloat_t
1194  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
1195  * ctypedef npy_clongdouble clongdouble_t
1196  *
1197  */
1198 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1199 
1200 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":730
1201  * ctypedef npy_cfloat      cfloat_t
1202  * ctypedef npy_cdouble     cdouble_t
1203  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
1204  *
1205  * ctypedef npy_cdouble     complex_t
1206  */
1207 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1208 
1209 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":732
1210  * ctypedef npy_clongdouble clongdouble_t
1211  *
1212  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
1213  *
1214  * cdef inline object PyArray_MultiIterNew1(a):
1215  */
1216 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1217 
1218 /* "View.MemoryView":105
1219  *
1220  * @cname("__pyx_array")
1221  * cdef class array:             # <<<<<<<<<<<<<<
1222  *
1223  *     cdef:
1224  */
1225 struct __pyx_array_obj {
1226   PyObject_HEAD
1227   struct __pyx_vtabstruct_array *__pyx_vtab;
1228   char *data;
1229   Py_ssize_t len;
1230   char *format;
1231   int ndim;
1232   Py_ssize_t *_shape;
1233   Py_ssize_t *_strides;
1234   Py_ssize_t itemsize;
1235   PyObject *mode;
1236   PyObject *_format;
1237   void (*callback_free_data)(void *);
1238   int free_data;
1239   int dtype_is_object;
1240 };
1241 
1242 
1243 /* "View.MemoryView":279
1244  *
1245  * @cname('__pyx_MemviewEnum')
1246  * cdef class Enum(object):             # <<<<<<<<<<<<<<
1247  *     cdef object name
1248  *     def __init__(self, name):
1249  */
1250 struct __pyx_MemviewEnum_obj {
1251   PyObject_HEAD
1252   PyObject *name;
1253 };
1254 
1255 
1256 /* "View.MemoryView":330
1257  *
1258  * @cname('__pyx_memoryview')
1259  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1260  *
1261  *     cdef object obj
1262  */
1263 struct __pyx_memoryview_obj {
1264   PyObject_HEAD
1265   struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1266   PyObject *obj;
1267   PyObject *_size;
1268   PyObject *_array_interface;
1269   PyThread_type_lock lock;
1270   __pyx_atomic_int acquisition_count[2];
1271   __pyx_atomic_int *acquisition_count_aligned_p;
1272   Py_buffer view;
1273   int flags;
1274   int dtype_is_object;
1275   __Pyx_TypeInfo *typeinfo;
1276 };
1277 
1278 
1279 /* "View.MemoryView":965
1280  *
1281  * @cname('__pyx_memoryviewslice')
1282  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1283  *     "Internal class for passing memoryview slices to Python"
1284  *
1285  */
1286 struct __pyx_memoryviewslice_obj {
1287   struct __pyx_memoryview_obj __pyx_base;
1288   __Pyx_memviewslice from_slice;
1289   PyObject *from_object;
1290   PyObject *(*to_object_func)(char *);
1291   int (*to_dtype_func)(char *, PyObject *);
1292 };
1293 
1294 
1295 
1296 /* "View.MemoryView":105
1297  *
1298  * @cname("__pyx_array")
1299  * cdef class array:             # <<<<<<<<<<<<<<
1300  *
1301  *     cdef:
1302  */
1303 
1304 struct __pyx_vtabstruct_array {
1305   PyObject *(*get_memview)(struct __pyx_array_obj *);
1306 };
1307 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1308 
1309 
1310 /* "View.MemoryView":330
1311  *
1312  * @cname('__pyx_memoryview')
1313  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1314  *
1315  *     cdef object obj
1316  */
1317 
1318 struct __pyx_vtabstruct_memoryview {
1319   char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1320   PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1321   PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1322   PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1323   PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1324   PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1325   PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1326 };
1327 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1328 
1329 
1330 /* "View.MemoryView":965
1331  *
1332  * @cname('__pyx_memoryviewslice')
1333  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1334  *     "Internal class for passing memoryview slices to Python"
1335  *
1336  */
1337 
1338 struct __pyx_vtabstruct__memoryviewslice {
1339   struct __pyx_vtabstruct_memoryview __pyx_base;
1340 };
1341 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1342 
1343 /* --- Runtime support code (head) --- */
1344 /* Refnanny.proto */
1345 #ifndef CYTHON_REFNANNY
1346   #define CYTHON_REFNANNY 0
1347 #endif
1348 #if CYTHON_REFNANNY
1349   typedef struct {
1350     void (*INCREF)(void*, PyObject*, int);
1351     void (*DECREF)(void*, PyObject*, int);
1352     void (*GOTREF)(void*, PyObject*, int);
1353     void (*GIVEREF)(void*, PyObject*, int);
1354     void* (*SetupContext)(const char*, int, const char*);
1355     void (*FinishContext)(void**);
1356   } __Pyx_RefNannyAPIStruct;
1357   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1358   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1359   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1360 #ifdef WITH_THREAD
1361   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1362           if (acquire_gil) {\
1363               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1364               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1365               PyGILState_Release(__pyx_gilstate_save);\
1366           } else {\
1367               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1368           }
1369 #else
1370   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1371           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1372 #endif
1373   #define __Pyx_RefNannyFinishContext()\
1374           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1375   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1376   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1377   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1378   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1379   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1380   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1381   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1382   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1383 #else
1384   #define __Pyx_RefNannyDeclarations
1385   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1386   #define __Pyx_RefNannyFinishContext()
1387   #define __Pyx_INCREF(r) Py_INCREF(r)
1388   #define __Pyx_DECREF(r) Py_DECREF(r)
1389   #define __Pyx_GOTREF(r)
1390   #define __Pyx_GIVEREF(r)
1391   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1392   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1393   #define __Pyx_XGOTREF(r)
1394   #define __Pyx_XGIVEREF(r)
1395 #endif
1396 #define __Pyx_XDECREF_SET(r, v) do {\
1397         PyObject *tmp = (PyObject *) r;\
1398         r = v; __Pyx_XDECREF(tmp);\
1399     } while (0)
1400 #define __Pyx_DECREF_SET(r, v) do {\
1401         PyObject *tmp = (PyObject *) r;\
1402         r = v; __Pyx_DECREF(tmp);\
1403     } while (0)
1404 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1405 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1406 
1407 /* PyObjectGetAttrStr.proto */
1408 #if CYTHON_USE_TYPE_SLOTS
1409 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1410 #else
1411 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1412 #endif
1413 
1414 /* GetBuiltinName.proto */
1415 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1416 
1417 /* RaiseArgTupleInvalid.proto */
1418 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1419     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1420 
1421 /* RaiseDoubleKeywords.proto */
1422 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1423 
1424 /* ParseKeywords.proto */
1425 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1426     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1427     const char* function_name);
1428 
1429 /* PyDictVersioning.proto */
1430 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1431 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1432 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1433 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1434     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1435     (cache_var) = (value);
1436 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1437     static PY_UINT64_T __pyx_dict_version = 0;\
1438     static PyObject *__pyx_dict_cached_value = NULL;\
1439     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1440         (VAR) = __pyx_dict_cached_value;\
1441     } else {\
1442         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1443         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1444     }\
1445 }
1446 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1447 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1448 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1449 #else
1450 #define __PYX_GET_DICT_VERSION(dict)  (0)
1451 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1452 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1453 #endif
1454 
1455 /* GetModuleGlobalName.proto */
1456 #if CYTHON_USE_DICT_VERSIONS
1457 #define __Pyx_GetModuleGlobalName(var, name)  {\
1458     static PY_UINT64_T __pyx_dict_version = 0;\
1459     static PyObject *__pyx_dict_cached_value = NULL;\
1460     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1461         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1462         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1463 }
1464 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1465     PY_UINT64_T __pyx_dict_version;\
1466     PyObject *__pyx_dict_cached_value;\
1467     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1468 }
1469 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1470 #else
1471 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1472 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1473 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1474 #endif
1475 
1476 /* PyObjectCall.proto */
1477 #if CYTHON_COMPILING_IN_CPYTHON
1478 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1479 #else
1480 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1481 #endif
1482 
1483 /* PyObjectSetAttrStr.proto */
1484 #if CYTHON_USE_TYPE_SLOTS
1485 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1486 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1487 #else
1488 #define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
1489 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1490 #endif
1491 
1492 /* RaiseTooManyValuesToUnpack.proto */
1493 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1494 
1495 /* RaiseNeedMoreValuesToUnpack.proto */
1496 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1497 
1498 /* IterFinish.proto */
1499 static CYTHON_INLINE int __Pyx_IterFinish(void);
1500 
1501 /* UnpackItemEndCheck.proto */
1502 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1503 
1504 /* PyThreadStateGet.proto */
1505 #if CYTHON_FAST_THREAD_STATE
1506 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1507 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1508 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1509 #else
1510 #define __Pyx_PyThreadState_declare
1511 #define __Pyx_PyThreadState_assign
1512 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1513 #endif
1514 
1515 /* PyErrFetchRestore.proto */
1516 #if CYTHON_FAST_THREAD_STATE
1517 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1518 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1519 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1520 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1521 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1522 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1523 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1524 #if CYTHON_COMPILING_IN_CPYTHON
1525 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1526 #else
1527 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1528 #endif
1529 #else
1530 #define __Pyx_PyErr_Clear() PyErr_Clear()
1531 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1532 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1533 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1534 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1535 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1536 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1537 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1538 #endif
1539 
1540 /* RaiseException.proto */
1541 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1542 
1543 /* SliceObject.proto */
1544 #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
1545     __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
1546 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
1547         PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
1548         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1549         int has_cstart, int has_cstop, int wraparound);
1550 
1551 /* MemviewSliceInit.proto */
1552 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1553 #define __Pyx_MEMVIEW_DIRECT   1
1554 #define __Pyx_MEMVIEW_PTR      2
1555 #define __Pyx_MEMVIEW_FULL     4
1556 #define __Pyx_MEMVIEW_CONTIG   8
1557 #define __Pyx_MEMVIEW_STRIDED  16
1558 #define __Pyx_MEMVIEW_FOLLOW   32
1559 #define __Pyx_IS_C_CONTIG 1
1560 #define __Pyx_IS_F_CONTIG 2
1561 static int __Pyx_init_memviewslice(
1562                 struct __pyx_memoryview_obj *memview,
1563                 int ndim,
1564                 __Pyx_memviewslice *memviewslice,
1565                 int memview_is_new_reference);
1566 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1567     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1568 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1569     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1570 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1571 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1572 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1573 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1574 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1575 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1576 
1577 /* SliceObject.proto */
1578 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1579         PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1580         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1581         int has_cstart, int has_cstop, int wraparound);
1582 
1583 /* GetTopmostException.proto */
1584 #if CYTHON_USE_EXC_INFO_STACK
1585 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1586 #endif
1587 
1588 /* SaveResetException.proto */
1589 #if CYTHON_FAST_THREAD_STATE
1590 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1591 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1592 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1593 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1594 #else
1595 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1596 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1597 #endif
1598 
1599 /* PyErrExceptionMatches.proto */
1600 #if CYTHON_FAST_THREAD_STATE
1601 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1602 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1603 #else
1604 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1605 #endif
1606 
1607 /* GetException.proto */
1608 #if CYTHON_FAST_THREAD_STATE
1609 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1610 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1611 #else
1612 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1613 #endif
1614 
1615 /* ArgTypeTest.proto */
1616 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1617     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1618         __Pyx__ArgTypeTest(obj, type, name, exact))
1619 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1620 
1621 /* PyCFunctionFastCall.proto */
1622 #if CYTHON_FAST_PYCCALL
1623 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1624 #else
1625 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1626 #endif
1627 
1628 /* PyFunctionFastCall.proto */
1629 #if CYTHON_FAST_PYCALL
1630 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1631     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1632 #if 1 || PY_VERSION_HEX < 0x030600B1
1633 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1634 #else
1635 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1636 #endif
1637 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1638     (sizeof(char [1 - 2*!(cond)]) - 1)
1639 #ifndef Py_MEMBER_SIZE
1640 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1641 #endif
1642   static size_t __pyx_pyframe_localsplus_offset = 0;
1643   #include "frameobject.h"
1644   #define __Pxy_PyFrame_Initialize_Offsets()\
1645     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1646      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1647   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1648     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1649 #endif
1650 
1651 /* PyObjectCall2Args.proto */
1652 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1653 
1654 /* PyObjectCallMethO.proto */
1655 #if CYTHON_COMPILING_IN_CPYTHON
1656 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1657 #endif
1658 
1659 /* PyObjectCallOneArg.proto */
1660 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1661 
1662 /* IncludeStringH.proto */
1663 #include <string.h>
1664 
1665 /* BytesEquals.proto */
1666 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1667 
1668 /* UnicodeEquals.proto */
1669 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1670 
1671 /* StrEquals.proto */
1672 #if PY_MAJOR_VERSION >= 3
1673 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1674 #else
1675 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1676 #endif
1677 
1678 /* None.proto */
1679 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1680 
1681 /* UnaryNegOverflows.proto */
1682 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1683         (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1684 
1685 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1686 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1687 /* GetAttr.proto */
1688 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1689 
1690 /* GetItemInt.proto */
1691 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1692     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1693     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1694     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1695                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1696 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1697     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1698     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1699     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1700 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1701                                                               int wraparound, int boundscheck);
1702 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1703     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1704     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1705     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1706 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1707                                                               int wraparound, int boundscheck);
1708 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1709 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1710                                                      int is_list, int wraparound, int boundscheck);
1711 
1712 /* ObjectGetItem.proto */
1713 #if CYTHON_USE_TYPE_SLOTS
1714 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1715 #else
1716 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1717 #endif
1718 
1719 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1720 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1721     int byteorder = 0;
1722     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1723 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1724 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1725     int byteorder = -1;
1726     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1727 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)1728 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1729     int byteorder = 1;
1730     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1731 }
1732 
1733 /* decode_c_string.proto */
1734 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1735          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1736          const char* encoding, const char* errors,
1737          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1738 
1739 /* GetAttr3.proto */
1740 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1741 
1742 /* RaiseNoneIterError.proto */
1743 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1744 
1745 /* ExtTypeTest.proto */
1746 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1747 
1748 /* SwapException.proto */
1749 #if CYTHON_FAST_THREAD_STATE
1750 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1751 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1752 #else
1753 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1754 #endif
1755 
1756 /* Import.proto */
1757 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1758 
1759 /* FastTypeChecks.proto */
1760 #if CYTHON_COMPILING_IN_CPYTHON
1761 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1762 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1763 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1764 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1765 #else
1766 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1767 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1768 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1769 #endif
1770 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1771 
1772 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1773 /* ListCompAppend.proto */
1774 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)1775 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1776     PyListObject* L = (PyListObject*) list;
1777     Py_ssize_t len = Py_SIZE(list);
1778     if (likely(L->allocated > len)) {
1779         Py_INCREF(x);
1780         PyList_SET_ITEM(list, len, x);
1781         __Pyx_SET_SIZE(list, len + 1);
1782         return 0;
1783     }
1784     return PyList_Append(list, x);
1785 }
1786 #else
1787 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1788 #endif
1789 
1790 /* PyIntBinop.proto */
1791 #if !CYTHON_COMPILING_IN_PYPY
1792 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1793 #else
1794 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1795     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1796 #endif
1797 
1798 /* ListExtend.proto */
__Pyx_PyList_Extend(PyObject * L,PyObject * v)1799 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1800 #if CYTHON_COMPILING_IN_CPYTHON
1801     PyObject* none = _PyList_Extend((PyListObject*)L, v);
1802     if (unlikely(!none))
1803         return -1;
1804     Py_DECREF(none);
1805     return 0;
1806 #else
1807     return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1808 #endif
1809 }
1810 
1811 /* ListAppend.proto */
1812 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1813 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1814     PyListObject* L = (PyListObject*) list;
1815     Py_ssize_t len = Py_SIZE(list);
1816     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1817         Py_INCREF(x);
1818         PyList_SET_ITEM(list, len, x);
1819         __Pyx_SET_SIZE(list, len + 1);
1820         return 0;
1821     }
1822     return PyList_Append(list, x);
1823 }
1824 #else
1825 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1826 #endif
1827 
1828 /* None.proto */
1829 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1830 
1831 /* None.proto */
1832 static CYTHON_INLINE long __Pyx_div_long(long, long);
1833 
1834 /* ImportFrom.proto */
1835 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1836 
1837 /* HasAttr.proto */
1838 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1839 
1840 /* PyObject_GenericGetAttrNoDict.proto */
1841 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1842 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1843 #else
1844 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1845 #endif
1846 
1847 /* PyObject_GenericGetAttr.proto */
1848 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1849 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1850 #else
1851 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1852 #endif
1853 
1854 /* SetVTable.proto */
1855 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1856 
1857 /* PyObjectGetAttrStrNoError.proto */
1858 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1859 
1860 /* SetupReduce.proto */
1861 static int __Pyx_setup_reduce(PyObject* type_obj);
1862 
1863 /* TypeImport.proto */
1864 #ifndef __PYX_HAVE_RT_ImportType_proto
1865 #define __PYX_HAVE_RT_ImportType_proto
1866 enum __Pyx_ImportType_CheckSize {
1867    __Pyx_ImportType_CheckSize_Error = 0,
1868    __Pyx_ImportType_CheckSize_Warn = 1,
1869    __Pyx_ImportType_CheckSize_Ignore = 2
1870 };
1871 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1872 #endif
1873 
1874 /* FetchCommonType.proto */
1875 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1876 
1877 /* CythonFunctionShared.proto */
1878 #define __Pyx_CyFunction_USED 1
1879 #define __Pyx_CYFUNCTION_STATICMETHOD  0x01
1880 #define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
1881 #define __Pyx_CYFUNCTION_CCLASS        0x04
1882 #define __Pyx_CyFunction_GetClosure(f)\
1883     (((__pyx_CyFunctionObject *) (f))->func_closure)
1884 #define __Pyx_CyFunction_GetClassObj(f)\
1885     (((__pyx_CyFunctionObject *) (f))->func_classobj)
1886 #define __Pyx_CyFunction_Defaults(type, f)\
1887     ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1888 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1889     ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1890 typedef struct {
1891     PyCFunctionObject func;
1892 #if PY_VERSION_HEX < 0x030500A0
1893     PyObject *func_weakreflist;
1894 #endif
1895     PyObject *func_dict;
1896     PyObject *func_name;
1897     PyObject *func_qualname;
1898     PyObject *func_doc;
1899     PyObject *func_globals;
1900     PyObject *func_code;
1901     PyObject *func_closure;
1902     PyObject *func_classobj;
1903     void *defaults;
1904     int defaults_pyobjects;
1905     size_t defaults_size;  // used by FusedFunction for copying defaults
1906     int flags;
1907     PyObject *defaults_tuple;
1908     PyObject *defaults_kwdict;
1909     PyObject *(*defaults_getter)(PyObject *);
1910     PyObject *func_annotations;
1911 } __pyx_CyFunctionObject;
1912 static PyTypeObject *__pyx_CyFunctionType = 0;
1913 #define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1914 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1915                                       int flags, PyObject* qualname,
1916                                       PyObject *self,
1917                                       PyObject *module, PyObject *globals,
1918                                       PyObject* code);
1919 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1920                                                          size_t size,
1921                                                          int pyobjects);
1922 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1923                                                             PyObject *tuple);
1924 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1925                                                              PyObject *dict);
1926 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1927                                                               PyObject *dict);
1928 static int __pyx_CyFunction_init(void);
1929 
1930 /* CythonFunction.proto */
1931 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1932                                       int flags, PyObject* qualname,
1933                                       PyObject *closure,
1934                                       PyObject *module, PyObject *globals,
1935                                       PyObject* code);
1936 
1937 /* SetNameInClass.proto */
1938 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1939 #define __Pyx_SetNameInClass(ns, name, value)\
1940     (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1941 #elif CYTHON_COMPILING_IN_CPYTHON
1942 #define __Pyx_SetNameInClass(ns, name, value)\
1943     (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1944 #else
1945 #define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
1946 #endif
1947 
1948 /* CalculateMetaclass.proto */
1949 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1950 
1951 /* Py3ClassCreate.proto */
1952 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1953                                            PyObject *mkw, PyObject *modname, PyObject *doc);
1954 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1955                                       PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1956 
1957 /* CLineInTraceback.proto */
1958 #ifdef CYTHON_CLINE_IN_TRACEBACK
1959 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1960 #else
1961 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1962 #endif
1963 
1964 /* CodeObjectCache.proto */
1965 typedef struct {
1966     PyCodeObject* code_object;
1967     int code_line;
1968 } __Pyx_CodeObjectCacheEntry;
1969 struct __Pyx_CodeObjectCache {
1970     int count;
1971     int max_count;
1972     __Pyx_CodeObjectCacheEntry* entries;
1973 };
1974 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1975 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1976 static PyCodeObject *__pyx_find_code_object(int code_line);
1977 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1978 
1979 /* AddTraceback.proto */
1980 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1981                                int py_line, const char *filename);
1982 
1983 #if PY_MAJOR_VERSION < 3
1984     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1985     static void __Pyx_ReleaseBuffer(Py_buffer *view);
1986 #else
1987     #define __Pyx_GetBuffer PyObject_GetBuffer
1988     #define __Pyx_ReleaseBuffer PyBuffer_Release
1989 #endif
1990 
1991 
1992 /* BufferStructDeclare.proto */
1993 typedef struct {
1994   Py_ssize_t shape, strides, suboffsets;
1995 } __Pyx_Buf_DimInfo;
1996 typedef struct {
1997   size_t refcount;
1998   Py_buffer pybuffer;
1999 } __Pyx_Buffer;
2000 typedef struct {
2001   __Pyx_Buffer *rcbuffer;
2002   char *data;
2003   __Pyx_Buf_DimInfo diminfo[8];
2004 } __Pyx_LocalBuf_ND;
2005 
2006 /* MemviewSliceIsContig.proto */
2007 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
2008 
2009 /* OverlappingSlices.proto */
2010 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2011                                 __Pyx_memviewslice *slice2,
2012                                 int ndim, size_t itemsize);
2013 
2014 /* Capsule.proto */
2015 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2016 
2017 /* CIntToPy.proto */
2018 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2019 
2020 /* CIntToPy.proto */
2021 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2022 
2023 /* RealImag.proto */
2024 #if CYTHON_CCOMPLEX
2025   #ifdef __cplusplus
2026     #define __Pyx_CREAL(z) ((z).real())
2027     #define __Pyx_CIMAG(z) ((z).imag())
2028   #else
2029     #define __Pyx_CREAL(z) (__real__(z))
2030     #define __Pyx_CIMAG(z) (__imag__(z))
2031   #endif
2032 #else
2033     #define __Pyx_CREAL(z) ((z).real)
2034     #define __Pyx_CIMAG(z) ((z).imag)
2035 #endif
2036 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2037         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2038     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2039     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2040 #else
2041     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2042     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2043 #endif
2044 
2045 /* Arithmetic.proto */
2046 #if CYTHON_CCOMPLEX
2047     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
2048     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
2049     #define __Pyx_c_diff_float(a, b) ((a)-(b))
2050     #define __Pyx_c_prod_float(a, b) ((a)*(b))
2051     #define __Pyx_c_quot_float(a, b) ((a)/(b))
2052     #define __Pyx_c_neg_float(a)     (-(a))
2053   #ifdef __cplusplus
2054     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2055     #define __Pyx_c_conj_float(z)    (::std::conj(z))
2056     #if 1
2057         #define __Pyx_c_abs_float(z)     (::std::abs(z))
2058         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
2059     #endif
2060   #else
2061     #define __Pyx_c_is_zero_float(z) ((z)==0)
2062     #define __Pyx_c_conj_float(z)    (conjf(z))
2063     #if 1
2064         #define __Pyx_c_abs_float(z)     (cabsf(z))
2065         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
2066     #endif
2067  #endif
2068 #else
2069     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2070     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2071     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2072     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2073     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2074     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2075     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2076     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2077     #if 1
2078         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2079         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2080     #endif
2081 #endif
2082 
2083 /* Arithmetic.proto */
2084 #if CYTHON_CCOMPLEX
2085     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
2086     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
2087     #define __Pyx_c_diff_double(a, b) ((a)-(b))
2088     #define __Pyx_c_prod_double(a, b) ((a)*(b))
2089     #define __Pyx_c_quot_double(a, b) ((a)/(b))
2090     #define __Pyx_c_neg_double(a)     (-(a))
2091   #ifdef __cplusplus
2092     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2093     #define __Pyx_c_conj_double(z)    (::std::conj(z))
2094     #if 1
2095         #define __Pyx_c_abs_double(z)     (::std::abs(z))
2096         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
2097     #endif
2098   #else
2099     #define __Pyx_c_is_zero_double(z) ((z)==0)
2100     #define __Pyx_c_conj_double(z)    (conj(z))
2101     #if 1
2102         #define __Pyx_c_abs_double(z)     (cabs(z))
2103         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
2104     #endif
2105  #endif
2106 #else
2107     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2108     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2109     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2110     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2111     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2112     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2113     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2114     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2115     #if 1
2116         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2117         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2118     #endif
2119 #endif
2120 
2121 /* MemviewSliceCopyTemplate.proto */
2122 static __Pyx_memviewslice
2123 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2124                                  const char *mode, int ndim,
2125                                  size_t sizeof_dtype, int contig_flag,
2126                                  int dtype_is_object);
2127 
2128 /* CIntFromPy.proto */
2129 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2130 
2131 /* CIntFromPy.proto */
2132 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2133 
2134 /* CIntFromPy.proto */
2135 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2136 
2137 /* IsLittleEndian.proto */
2138 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
2139 
2140 /* BufferFormatCheck.proto */
2141 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
2142 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2143                               __Pyx_BufFmt_StackElem* stack,
2144                               __Pyx_TypeInfo* type);
2145 
2146 /* TypeInfoCompare.proto */
2147 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2148 
2149 /* MemviewSliceValidateAndInit.proto */
2150 static int __Pyx_ValidateAndInit_memviewslice(
2151                 int *axes_specs,
2152                 int c_or_f_flag,
2153                 int buf_flags,
2154                 int ndim,
2155                 __Pyx_TypeInfo *dtype,
2156                 __Pyx_BufFmt_StackElem stack[],
2157                 __Pyx_memviewslice *memviewslice,
2158                 PyObject *original_obj);
2159 
2160 /* ObjectToMemviewSlice.proto */
2161 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float_t(PyObject *, int writable_flag);
2162 
2163 /* ObjectToMemviewSlice.proto */
2164 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int_t(PyObject *, int writable_flag);
2165 
2166 /* CheckBinaryVersion.proto */
2167 static int __Pyx_check_binary_version(void);
2168 
2169 /* InitStrings.proto */
2170 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2171 
2172 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2173 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2174 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2175 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2176 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*/
2177 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2178 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2179 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2180 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2181 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2182 
2183 /* Module declarations from 'cython.view' */
2184 
2185 /* Module declarations from 'cython' */
2186 
2187 /* Module declarations from 'cpython.buffer' */
2188 
2189 /* Module declarations from 'libc.string' */
2190 
2191 /* Module declarations from 'libc.stdio' */
2192 
2193 /* Module declarations from '__builtin__' */
2194 
2195 /* Module declarations from 'cpython.type' */
2196 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2197 
2198 /* Module declarations from 'cpython' */
2199 
2200 /* Module declarations from 'cpython.object' */
2201 
2202 /* Module declarations from 'cpython.ref' */
2203 
2204 /* Module declarations from 'cpython.mem' */
2205 
2206 /* Module declarations from 'numpy' */
2207 
2208 /* Module declarations from 'numpy' */
2209 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2210 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2211 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2212 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2213 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2214 
2215 /* Module declarations from 'libc.math' */
2216 
2217 /* Module declarations from 'libc.stdlib' */
2218 
2219 /* Module declarations from 'pymatgen.optimization.linear_assignment' */
2220 static PyTypeObject *__pyx_array_type = 0;
2221 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2222 static PyTypeObject *__pyx_memoryview_type = 0;
2223 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2224 static PyObject *generic = 0;
2225 static PyObject *strided = 0;
2226 static PyObject *indirect = 0;
2227 static PyObject *contiguous = 0;
2228 static PyObject *indirect_contiguous = 0;
2229 static int __pyx_memoryview_thread_locks_used;
2230 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2231 static __pyx_t_5numpy_float_t __pyx_f_8pymatgen_12optimization_17linear_assignment_compute(int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_5numpy_float_t); /*proto*/
2232 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2233 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2234 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2235 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2236 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2237 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2238 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2239 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*/
2240 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2241 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2242 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2243 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2244 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2245 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2246 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2247 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2248 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2249 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2250 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2251 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2252 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2253 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2254 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2255 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2256 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2257 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2258 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2259 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2260 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2261 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2262 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2263 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2264 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2265 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float_t = { "float_t", NULL, sizeof(__pyx_t_5numpy_float_t), { 0 }, 0, 'R', 0, 0 };
2266 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int_t = { "int_t", NULL, sizeof(__pyx_t_5numpy_int_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int_t), 0 };
2267 #define __Pyx_MODULE_NAME "pymatgen.optimization.linear_assignment"
2268 extern int __pyx_module_is_main_pymatgen__optimization__linear_assignment;
2269 int __pyx_module_is_main_pymatgen__optimization__linear_assignment = 0;
2270 
2271 /* Implementation of 'pymatgen.optimization.linear_assignment' */
2272 static PyObject *__pyx_builtin_ValueError;
2273 static PyObject *__pyx_builtin_range;
2274 static PyObject *__pyx_builtin_ImportError;
2275 static PyObject *__pyx_builtin_MemoryError;
2276 static PyObject *__pyx_builtin_enumerate;
2277 static PyObject *__pyx_builtin_TypeError;
2278 static PyObject *__pyx_builtin_Ellipsis;
2279 static PyObject *__pyx_builtin_id;
2280 static PyObject *__pyx_builtin_IndexError;
2281 static const char __pyx_k_C[] = "C";
2282 static const char __pyx_k_O[] = "O";
2283 static const char __pyx_k_c[] = "c";
2284 static const char __pyx_k_n[] = "n";
2285 static const char __pyx_k_x[] = "_x";
2286 static const char __pyx_k_y[] = "_y";
2287 static const char __pyx_k_id[] = "id";
2288 static const char __pyx_k_np[] = "np";
2289 static const char __pyx_k_nx[] = "nx";
2290 static const char __pyx_k_ny[] = "ny";
2291 static const char __pyx_k_1_0[] = "1.0";
2292 static const char __pyx_k_doc[] = "__doc__";
2293 static const char __pyx_k_int[] = "int";
2294 static const char __pyx_k_new[] = "__new__";
2295 static const char __pyx_k_obj[] = "obj";
2296 static const char __pyx_k_base[] = "base";
2297 static const char __pyx_k_copy[] = "copy";
2298 static const char __pyx_k_date[] = "__date__";
2299 static const char __pyx_k_dict[] = "__dict__";
2300 static const char __pyx_k_init[] = "__init__";
2301 static const char __pyx_k_main[] = "__main__";
2302 static const char __pyx_k_mode[] = "mode";
2303 static const char __pyx_k_name[] = "name";
2304 static const char __pyx_k_ndim[] = "ndim";
2305 static const char __pyx_k_pack[] = "pack";
2306 static const char __pyx_k_self[] = "self";
2307 static const char __pyx_k_size[] = "size";
2308 static const char __pyx_k_step[] = "step";
2309 static const char __pyx_k_stop[] = "stop";
2310 static const char __pyx_k_test[] = "__test__";
2311 static const char __pyx_k_ASCII[] = "ASCII";
2312 static const char __pyx_k_array[] = "array";
2313 static const char __pyx_k_class[] = "__class__";
2314 static const char __pyx_k_costs[] = "costs";
2315 static const char __pyx_k_dtype[] = "dtype";
2316 static const char __pyx_k_email[] = "__email__";
2317 static const char __pyx_k_empty[] = "empty";
2318 static const char __pyx_k_error[] = "error";
2319 static const char __pyx_k_flags[] = "flags";
2320 static const char __pyx_k_float[] = "float_";
2321 static const char __pyx_k_numpy[] = "numpy";
2322 static const char __pyx_k_order[] = "order";
2323 static const char __pyx_k_range[] = "range";
2324 static const char __pyx_k_shape[] = "shape";
2325 static const char __pyx_k_start[] = "start";
2326 static const char __pyx_k_zeros[] = "zeros";
2327 static const char __pyx_k_author[] = "__author__";
2328 static const char __pyx_k_encode[] = "encode";
2329 static const char __pyx_k_format[] = "format";
2330 static const char __pyx_k_import[] = "__import__";
2331 static const char __pyx_k_module[] = "__module__";
2332 static const char __pyx_k_name_2[] = "__name__";
2333 static const char __pyx_k_orig_c[] = "orig_c";
2334 static const char __pyx_k_pickle[] = "pickle";
2335 static const char __pyx_k_reduce[] = "__reduce__";
2336 static const char __pyx_k_struct[] = "struct";
2337 static const char __pyx_k_unpack[] = "unpack";
2338 static const char __pyx_k_update[] = "update";
2339 static const char __pyx_k_epsilon[] = "epsilon";
2340 static const char __pyx_k_fortran[] = "fortran";
2341 static const char __pyx_k_memview[] = "memview";
2342 static const char __pyx_k_prepare[] = "__prepare__";
2343 static const char __pyx_k_version[] = "__version__";
2344 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2345 static const char __pyx_k_getstate[] = "__getstate__";
2346 static const char __pyx_k_itemsize[] = "itemsize";
2347 static const char __pyx_k_min_cost[] = "min_cost";
2348 static const char __pyx_k_pyx_type[] = "__pyx_type";
2349 static const char __pyx_k_qualname[] = "__qualname__";
2350 static const char __pyx_k_setstate[] = "__setstate__";
2351 static const char __pyx_k_solution[] = "solution";
2352 static const char __pyx_k_TypeError[] = "TypeError";
2353 static const char __pyx_k_copyright[] = "__copyright__";
2354 static const char __pyx_k_enumerate[] = "enumerate";
2355 static const char __pyx_k_metaclass[] = "__metaclass__";
2356 static const char __pyx_k_pyx_state[] = "__pyx_state";
2357 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2358 static const char __pyx_k_IndexError[] = "IndexError";
2359 static const char __pyx_k_ValueError[] = "ValueError";
2360 static const char __pyx_k_maintainer[] = "__maintainer__";
2361 static const char __pyx_k_pyx_result[] = "__pyx_result";
2362 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2363 static const char __pyx_k_ImportError[] = "ImportError";
2364 static const char __pyx_k_Jan_28_2013[] = "Jan 28, 2013";
2365 static const char __pyx_k_MemoryError[] = "MemoryError";
2366 static const char __pyx_k_PickleError[] = "PickleError";
2367 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2368 static const char __pyx_k_stringsource[] = "stringsource";
2369 static const char __pyx_k_Will_Richards[] = "Will Richards";
2370 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2371 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2372 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2373 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2374 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2375 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2376 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2377 static const char __pyx_k_LinearAssignment[] = "LinearAssignment";
2378 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2379 static const char __pyx_k_wrichards_mit_edu[] = "wrichards@mit.edu";
2380 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2381 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2382 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2383 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2384 static const char __pyx_k_linear_assignment_pyx[] = "linear_assignment.pyx";
2385 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2386 static const char __pyx_k_LinearAssignment___init[] = "LinearAssignment.__init__";
2387 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2388 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2389 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2390 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2391 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2392 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2393 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2394 static const char __pyx_k_This_class_finds_the_solution_t[] = "\n    This class finds the solution to the Linear Assignment Problem.\n    It finds a minimum cost matching between two sets, given a cost\n    matrix.\n\n    This class is an implementation of the LAPJV algorithm described in:\n    R. Jonker, A. Volgenant. A Shortest Augmenting Path Algorithm for\n    Dense and Sparse Linear Assignment Problems. Computing 38, 325-340\n    (1987)\n\n    Args:\n        costs: The cost matrix of the problem. cost[i,j] should be the\n            cost of matching x[i] to y[j]. The cost matrix may be\n            rectangular\n        epsilon: Tolerance for determining if solution vector is < 0\n\n    .. attribute: min_cost:\n\n        The minimum cost of the matching\n\n    .. attribute: solution:\n\n        The matching of the rows to columns. i.e solution = [1, 2, 0]\n        would match row 0 to column 1, row 1 to column 2 and row 2\n        to column 0. Total cost would be c[0, 1] + c[1, 2] + c[2, 0]\n    ";
2395 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2396 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2397 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2398 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2399 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2400 static const char __pyx_k_Copyright_2011_The_Materials_Pro[] = "Copyright 2011, The Materials Project";
2401 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2402 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2403 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2404 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2405 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2406 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2407 static const char __pyx_k_cost_matrix_must_have_at_least_a[] = "cost matrix must have at least as many columns as rows";
2408 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2409 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2410 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2411 static const char __pyx_k_pymatgen_optimization_linear_ass[] = "pymatgen.optimization.linear_assignment";
2412 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2413 static PyObject *__pyx_kp_u_1_0;
2414 static PyObject *__pyx_n_s_ASCII;
2415 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2416 static PyObject *__pyx_n_u_C;
2417 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2418 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2419 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2420 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2421 static PyObject *__pyx_kp_u_Copyright_2011_The_Materials_Pro;
2422 static PyObject *__pyx_n_s_Ellipsis;
2423 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2424 static PyObject *__pyx_n_s_ImportError;
2425 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2426 static PyObject *__pyx_n_s_IndexError;
2427 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2428 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2429 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2430 static PyObject *__pyx_kp_u_Jan_28_2013;
2431 static PyObject *__pyx_n_s_LinearAssignment;
2432 static PyObject *__pyx_n_s_LinearAssignment___init;
2433 static PyObject *__pyx_n_s_MemoryError;
2434 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2435 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2436 static PyObject *__pyx_n_b_O;
2437 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2438 static PyObject *__pyx_n_s_PickleError;
2439 static PyObject *__pyx_kp_s_This_class_finds_the_solution_t;
2440 static PyObject *__pyx_n_s_TypeError;
2441 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2442 static PyObject *__pyx_n_s_ValueError;
2443 static PyObject *__pyx_n_s_View_MemoryView;
2444 static PyObject *__pyx_kp_u_Will_Richards;
2445 static PyObject *__pyx_n_s_allocate_buffer;
2446 static PyObject *__pyx_n_s_array;
2447 static PyObject *__pyx_n_s_author;
2448 static PyObject *__pyx_n_s_base;
2449 static PyObject *__pyx_n_s_c;
2450 static PyObject *__pyx_n_u_c;
2451 static PyObject *__pyx_n_s_class;
2452 static PyObject *__pyx_n_s_cline_in_traceback;
2453 static PyObject *__pyx_kp_s_contiguous_and_direct;
2454 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2455 static PyObject *__pyx_n_s_copy;
2456 static PyObject *__pyx_n_s_copyright;
2457 static PyObject *__pyx_kp_u_cost_matrix_must_have_at_least_a;
2458 static PyObject *__pyx_n_s_costs;
2459 static PyObject *__pyx_n_s_date;
2460 static PyObject *__pyx_n_s_dict;
2461 static PyObject *__pyx_n_s_doc;
2462 static PyObject *__pyx_n_s_dtype;
2463 static PyObject *__pyx_n_s_dtype_is_object;
2464 static PyObject *__pyx_n_s_email;
2465 static PyObject *__pyx_n_s_empty;
2466 static PyObject *__pyx_n_s_encode;
2467 static PyObject *__pyx_n_s_enumerate;
2468 static PyObject *__pyx_n_s_epsilon;
2469 static PyObject *__pyx_n_s_error;
2470 static PyObject *__pyx_n_s_flags;
2471 static PyObject *__pyx_n_s_float;
2472 static PyObject *__pyx_n_s_format;
2473 static PyObject *__pyx_n_s_fortran;
2474 static PyObject *__pyx_n_u_fortran;
2475 static PyObject *__pyx_n_s_getstate;
2476 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2477 static PyObject *__pyx_n_s_id;
2478 static PyObject *__pyx_n_s_import;
2479 static PyObject *__pyx_n_s_init;
2480 static PyObject *__pyx_n_s_int;
2481 static PyObject *__pyx_n_s_itemsize;
2482 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2483 static PyObject *__pyx_kp_s_linear_assignment_pyx;
2484 static PyObject *__pyx_n_s_main;
2485 static PyObject *__pyx_n_s_maintainer;
2486 static PyObject *__pyx_n_s_memview;
2487 static PyObject *__pyx_n_s_metaclass;
2488 static PyObject *__pyx_n_s_min_cost;
2489 static PyObject *__pyx_n_s_mode;
2490 static PyObject *__pyx_n_s_module;
2491 static PyObject *__pyx_n_s_n;
2492 static PyObject *__pyx_n_s_name;
2493 static PyObject *__pyx_n_s_name_2;
2494 static PyObject *__pyx_n_s_ndim;
2495 static PyObject *__pyx_n_s_new;
2496 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2497 static PyObject *__pyx_n_s_np;
2498 static PyObject *__pyx_n_s_numpy;
2499 static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
2500 static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
2501 static PyObject *__pyx_n_s_nx;
2502 static PyObject *__pyx_n_s_ny;
2503 static PyObject *__pyx_n_s_obj;
2504 static PyObject *__pyx_n_s_order;
2505 static PyObject *__pyx_n_s_orig_c;
2506 static PyObject *__pyx_n_s_pack;
2507 static PyObject *__pyx_n_s_pickle;
2508 static PyObject *__pyx_n_s_prepare;
2509 static PyObject *__pyx_n_s_pymatgen_optimization_linear_ass;
2510 static PyObject *__pyx_n_s_pyx_PickleError;
2511 static PyObject *__pyx_n_s_pyx_checksum;
2512 static PyObject *__pyx_n_s_pyx_getbuffer;
2513 static PyObject *__pyx_n_s_pyx_result;
2514 static PyObject *__pyx_n_s_pyx_state;
2515 static PyObject *__pyx_n_s_pyx_type;
2516 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2517 static PyObject *__pyx_n_s_pyx_vtable;
2518 static PyObject *__pyx_n_s_qualname;
2519 static PyObject *__pyx_n_s_range;
2520 static PyObject *__pyx_n_s_reduce;
2521 static PyObject *__pyx_n_s_reduce_cython;
2522 static PyObject *__pyx_n_s_reduce_ex;
2523 static PyObject *__pyx_n_s_self;
2524 static PyObject *__pyx_n_s_setstate;
2525 static PyObject *__pyx_n_s_setstate_cython;
2526 static PyObject *__pyx_n_s_shape;
2527 static PyObject *__pyx_n_s_size;
2528 static PyObject *__pyx_n_s_solution;
2529 static PyObject *__pyx_n_s_start;
2530 static PyObject *__pyx_n_s_step;
2531 static PyObject *__pyx_n_s_stop;
2532 static PyObject *__pyx_kp_s_strided_and_direct;
2533 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2534 static PyObject *__pyx_kp_s_strided_and_indirect;
2535 static PyObject *__pyx_kp_s_stringsource;
2536 static PyObject *__pyx_n_s_struct;
2537 static PyObject *__pyx_n_s_test;
2538 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2539 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2540 static PyObject *__pyx_n_s_unpack;
2541 static PyObject *__pyx_n_s_update;
2542 static PyObject *__pyx_n_s_version;
2543 static PyObject *__pyx_kp_u_wrichards_mit_edu;
2544 static PyObject *__pyx_n_s_x;
2545 static PyObject *__pyx_n_s_y;
2546 static PyObject *__pyx_n_s_zeros;
2547 static PyObject *__pyx_pf_8pymatgen_12optimization_17linear_assignment_16LinearAssignment___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_costs, PyObject *__pyx_v_epsilon); /* proto */
2548 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 */
2549 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 */
2550 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2551 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2552 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2553 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
2554 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2555 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 */
2556 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
2557 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 */
2558 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2559 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2560 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2561 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2562 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 */
2563 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2564 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
2565 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 */
2566 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 */
2567 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2568 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2569 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2570 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2571 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2572 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2573 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2574 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2575 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2576 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2577 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2578 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2579 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2580 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2581 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2582 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2583 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2584 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 */
2585 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2586 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2587 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2588 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 */
2589 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 */
2590 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2591 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2592 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2593 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2594 static PyObject *__pyx_float_1eneg_13;
2595 static PyObject *__pyx_int_0;
2596 static PyObject *__pyx_int_1;
2597 static PyObject *__pyx_int_184977713;
2598 static PyObject *__pyx_int_neg_1;
2599 static PyObject *__pyx_tuple_;
2600 static PyObject *__pyx_tuple__2;
2601 static PyObject *__pyx_tuple__3;
2602 static PyObject *__pyx_tuple__4;
2603 static PyObject *__pyx_tuple__5;
2604 static PyObject *__pyx_tuple__6;
2605 static PyObject *__pyx_tuple__7;
2606 static PyObject *__pyx_tuple__8;
2607 static PyObject *__pyx_tuple__9;
2608 static PyObject *__pyx_slice__18;
2609 static PyObject *__pyx_tuple__10;
2610 static PyObject *__pyx_tuple__11;
2611 static PyObject *__pyx_tuple__12;
2612 static PyObject *__pyx_tuple__13;
2613 static PyObject *__pyx_tuple__14;
2614 static PyObject *__pyx_tuple__15;
2615 static PyObject *__pyx_tuple__16;
2616 static PyObject *__pyx_tuple__17;
2617 static PyObject *__pyx_tuple__19;
2618 static PyObject *__pyx_tuple__20;
2619 static PyObject *__pyx_tuple__21;
2620 static PyObject *__pyx_tuple__22;
2621 static PyObject *__pyx_tuple__24;
2622 static PyObject *__pyx_tuple__25;
2623 static PyObject *__pyx_tuple__26;
2624 static PyObject *__pyx_tuple__27;
2625 static PyObject *__pyx_tuple__28;
2626 static PyObject *__pyx_tuple__29;
2627 static PyObject *__pyx_tuple__30;
2628 static PyObject *__pyx_codeobj__23;
2629 static PyObject *__pyx_codeobj__31;
2630 /* Late includes */
2631 
2632 /* "pymatgen/optimization/linear_assignment.pyx":54
2633  *     """
2634  *
2635  *     def __init__(self, costs, epsilon=1e-13):             # <<<<<<<<<<<<<<
2636  *         self.orig_c = np.array(costs, dtype=np.float_, copy=False, order='C')
2637  *         self.nx, self.ny = self.orig_c.shape
2638  */
2639 
2640 /* Python wrapper */
2641 static PyObject *__pyx_pw_8pymatgen_12optimization_17linear_assignment_16LinearAssignment_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2642 static PyMethodDef __pyx_mdef_8pymatgen_12optimization_17linear_assignment_16LinearAssignment_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pymatgen_12optimization_17linear_assignment_16LinearAssignment_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_8pymatgen_12optimization_17linear_assignment_16LinearAssignment_1__init__(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2643 static PyObject *__pyx_pw_8pymatgen_12optimization_17linear_assignment_16LinearAssignment_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2644   PyObject *__pyx_v_self = 0;
2645   PyObject *__pyx_v_costs = 0;
2646   PyObject *__pyx_v_epsilon = 0;
2647   int __pyx_lineno = 0;
2648   const char *__pyx_filename = NULL;
2649   int __pyx_clineno = 0;
2650   PyObject *__pyx_r = 0;
2651   __Pyx_RefNannyDeclarations
2652   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2653   {
2654     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_costs,&__pyx_n_s_epsilon,0};
2655     PyObject* values[3] = {0,0,0};
2656     values[2] = ((PyObject *)((PyObject*)__pyx_float_1eneg_13));
2657     if (unlikely(__pyx_kwds)) {
2658       Py_ssize_t kw_args;
2659       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2660       switch (pos_args) {
2661         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2662         CYTHON_FALLTHROUGH;
2663         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2664         CYTHON_FALLTHROUGH;
2665         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2666         CYTHON_FALLTHROUGH;
2667         case  0: break;
2668         default: goto __pyx_L5_argtuple_error;
2669       }
2670       kw_args = PyDict_Size(__pyx_kwds);
2671       switch (pos_args) {
2672         case  0:
2673         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2674         else goto __pyx_L5_argtuple_error;
2675         CYTHON_FALLTHROUGH;
2676         case  1:
2677         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_costs)) != 0)) kw_args--;
2678         else {
2679           __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); __PYX_ERR(0, 54, __pyx_L3_error)
2680         }
2681         CYTHON_FALLTHROUGH;
2682         case  2:
2683         if (kw_args > 0) {
2684           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_epsilon);
2685           if (value) { values[2] = value; kw_args--; }
2686         }
2687       }
2688       if (unlikely(kw_args > 0)) {
2689         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 54, __pyx_L3_error)
2690       }
2691     } else {
2692       switch (PyTuple_GET_SIZE(__pyx_args)) {
2693         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2694         CYTHON_FALLTHROUGH;
2695         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2696         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2697         break;
2698         default: goto __pyx_L5_argtuple_error;
2699       }
2700     }
2701     __pyx_v_self = values[0];
2702     __pyx_v_costs = values[1];
2703     __pyx_v_epsilon = values[2];
2704   }
2705   goto __pyx_L4_argument_unpacking_done;
2706   __pyx_L5_argtuple_error:;
2707   __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 54, __pyx_L3_error)
2708   __pyx_L3_error:;
2709   __Pyx_AddTraceback("pymatgen.optimization.linear_assignment.LinearAssignment.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2710   __Pyx_RefNannyFinishContext();
2711   return NULL;
2712   __pyx_L4_argument_unpacking_done:;
2713   __pyx_r = __pyx_pf_8pymatgen_12optimization_17linear_assignment_16LinearAssignment___init__(__pyx_self, __pyx_v_self, __pyx_v_costs, __pyx_v_epsilon);
2714 
2715   /* function exit code */
2716   __Pyx_RefNannyFinishContext();
2717   return __pyx_r;
2718 }
2719 
__pyx_pf_8pymatgen_12optimization_17linear_assignment_16LinearAssignment___init__(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_self,PyObject * __pyx_v_costs,PyObject * __pyx_v_epsilon)2720 static PyObject *__pyx_pf_8pymatgen_12optimization_17linear_assignment_16LinearAssignment___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_costs, PyObject *__pyx_v_epsilon) {
2721   PyObject *__pyx_r = NULL;
2722   __Pyx_RefNannyDeclarations
2723   PyObject *__pyx_t_1 = NULL;
2724   PyObject *__pyx_t_2 = NULL;
2725   PyObject *__pyx_t_3 = NULL;
2726   PyObject *__pyx_t_4 = NULL;
2727   PyObject *__pyx_t_5 = NULL;
2728   PyObject *(*__pyx_t_6)(PyObject *);
2729   double __pyx_t_7;
2730   int __pyx_t_8;
2731   int __pyx_t_9;
2732   __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
2733   __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
2734   __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
2735   __pyx_t_5numpy_float_t __pyx_t_13;
2736   int __pyx_lineno = 0;
2737   const char *__pyx_filename = NULL;
2738   int __pyx_clineno = 0;
2739   __Pyx_RefNannySetupContext("__init__", 0);
2740 
2741   /* "pymatgen/optimization/linear_assignment.pyx":55
2742  *
2743  *     def __init__(self, costs, epsilon=1e-13):
2744  *         self.orig_c = np.array(costs, dtype=np.float_, copy=False, order='C')             # <<<<<<<<<<<<<<
2745  *         self.nx, self.ny = self.orig_c.shape
2746  *         self.n = self.ny
2747  */
2748   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
2749   __Pyx_GOTREF(__pyx_t_1);
2750   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error)
2751   __Pyx_GOTREF(__pyx_t_2);
2752   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2753   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
2754   __Pyx_GOTREF(__pyx_t_1);
2755   __Pyx_INCREF(__pyx_v_costs);
2756   __Pyx_GIVEREF(__pyx_v_costs);
2757   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_costs);
2758   __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
2759   __Pyx_GOTREF(__pyx_t_3);
2760   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error)
2761   __Pyx_GOTREF(__pyx_t_4);
2762   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error)
2763   __Pyx_GOTREF(__pyx_t_5);
2764   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2765   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 55, __pyx_L1_error)
2766   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2767   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_copy, Py_False) < 0) __PYX_ERR(0, 55, __pyx_L1_error)
2768   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_order, __pyx_n_u_C) < 0) __PYX_ERR(0, 55, __pyx_L1_error)
2769   __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error)
2770   __Pyx_GOTREF(__pyx_t_5);
2771   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2772   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2773   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2774   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_orig_c, __pyx_t_5) < 0) __PYX_ERR(0, 55, __pyx_L1_error)
2775   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2776 
2777   /* "pymatgen/optimization/linear_assignment.pyx":56
2778  *     def __init__(self, costs, epsilon=1e-13):
2779  *         self.orig_c = np.array(costs, dtype=np.float_, copy=False, order='C')
2780  *         self.nx, self.ny = self.orig_c.shape             # <<<<<<<<<<<<<<
2781  *         self.n = self.ny
2782  *
2783  */
2784   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_orig_c); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
2785   __Pyx_GOTREF(__pyx_t_5);
2786   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
2787   __Pyx_GOTREF(__pyx_t_3);
2788   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2789   if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
2790     PyObject* sequence = __pyx_t_3;
2791     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
2792     if (unlikely(size != 2)) {
2793       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
2794       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
2795       __PYX_ERR(0, 56, __pyx_L1_error)
2796     }
2797     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2798     if (likely(PyTuple_CheckExact(sequence))) {
2799       __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
2800       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
2801     } else {
2802       __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
2803       __pyx_t_1 = PyList_GET_ITEM(sequence, 1);
2804     }
2805     __Pyx_INCREF(__pyx_t_5);
2806     __Pyx_INCREF(__pyx_t_1);
2807     #else
2808     __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
2809     __Pyx_GOTREF(__pyx_t_5);
2810     __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
2811     __Pyx_GOTREF(__pyx_t_1);
2812     #endif
2813     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2814   } else {
2815     Py_ssize_t index = -1;
2816     __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
2817     __Pyx_GOTREF(__pyx_t_2);
2818     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2819     __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
2820     index = 0; __pyx_t_5 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
2821     __Pyx_GOTREF(__pyx_t_5);
2822     index = 1; __pyx_t_1 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
2823     __Pyx_GOTREF(__pyx_t_1);
2824     if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_2), 2) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
2825     __pyx_t_6 = NULL;
2826     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2827     goto __pyx_L4_unpacking_done;
2828     __pyx_L3_unpacking_failed:;
2829     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2830     __pyx_t_6 = NULL;
2831     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
2832     __PYX_ERR(0, 56, __pyx_L1_error)
2833     __pyx_L4_unpacking_done:;
2834   }
2835   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nx, __pyx_t_5) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
2836   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2837   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ny, __pyx_t_1) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
2838   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2839 
2840   /* "pymatgen/optimization/linear_assignment.pyx":57
2841  *         self.orig_c = np.array(costs, dtype=np.float_, copy=False, order='C')
2842  *         self.nx, self.ny = self.orig_c.shape
2843  *         self.n = self.ny             # <<<<<<<<<<<<<<
2844  *
2845  *         self.epsilon = fabs(epsilon)
2846  */
2847   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ny); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
2848   __Pyx_GOTREF(__pyx_t_3);
2849   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n, __pyx_t_3) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
2850   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2851 
2852   /* "pymatgen/optimization/linear_assignment.pyx":59
2853  *         self.n = self.ny
2854  *
2855  *         self.epsilon = fabs(epsilon)             # <<<<<<<<<<<<<<
2856  *
2857  *         #check that cost matrix is square
2858  */
2859   __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_epsilon); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L1_error)
2860   __pyx_t_3 = PyFloat_FromDouble(fabs(__pyx_t_7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
2861   __Pyx_GOTREF(__pyx_t_3);
2862   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_epsilon, __pyx_t_3) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
2863   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2864 
2865   /* "pymatgen/optimization/linear_assignment.pyx":62
2866  *
2867  *         #check that cost matrix is square
2868  *         if self.nx > self.ny:             # <<<<<<<<<<<<<<
2869  *             raise ValueError("cost matrix must have at least as many columns as rows")
2870  *
2871  */
2872   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
2873   __Pyx_GOTREF(__pyx_t_3);
2874   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ny); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
2875   __Pyx_GOTREF(__pyx_t_1);
2876   __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error)
2877   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2878   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2879   __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 62, __pyx_L1_error)
2880   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2881   if (unlikely(__pyx_t_8)) {
2882 
2883     /* "pymatgen/optimization/linear_assignment.pyx":63
2884  *         #check that cost matrix is square
2885  *         if self.nx > self.ny:
2886  *             raise ValueError("cost matrix must have at least as many columns as rows")             # <<<<<<<<<<<<<<
2887  *
2888  *         if self.nx == self.ny:
2889  */
2890     __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 63, __pyx_L1_error)
2891     __Pyx_GOTREF(__pyx_t_5);
2892     __Pyx_Raise(__pyx_t_5, 0, 0, 0);
2893     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2894     __PYX_ERR(0, 63, __pyx_L1_error)
2895 
2896     /* "pymatgen/optimization/linear_assignment.pyx":62
2897  *
2898  *         #check that cost matrix is square
2899  *         if self.nx > self.ny:             # <<<<<<<<<<<<<<
2900  *             raise ValueError("cost matrix must have at least as many columns as rows")
2901  *
2902  */
2903   }
2904 
2905   /* "pymatgen/optimization/linear_assignment.pyx":65
2906  *             raise ValueError("cost matrix must have at least as many columns as rows")
2907  *
2908  *         if self.nx == self.ny:             # <<<<<<<<<<<<<<
2909  *             self.c = self.orig_c
2910  *         else:
2911  */
2912   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error)
2913   __Pyx_GOTREF(__pyx_t_5);
2914   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ny); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
2915   __Pyx_GOTREF(__pyx_t_1);
2916   __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)
2917   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2918   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2919   __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 65, __pyx_L1_error)
2920   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2921   if (__pyx_t_8) {
2922 
2923     /* "pymatgen/optimization/linear_assignment.pyx":66
2924  *
2925  *         if self.nx == self.ny:
2926  *             self.c = self.orig_c             # <<<<<<<<<<<<<<
2927  *         else:
2928  *             self.c = np.zeros((self.n, self.n), dtype=np.float_)
2929  */
2930     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_orig_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
2931     __Pyx_GOTREF(__pyx_t_3);
2932     if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c, __pyx_t_3) < 0) __PYX_ERR(0, 66, __pyx_L1_error)
2933     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2934 
2935     /* "pymatgen/optimization/linear_assignment.pyx":65
2936  *             raise ValueError("cost matrix must have at least as many columns as rows")
2937  *
2938  *         if self.nx == self.ny:             # <<<<<<<<<<<<<<
2939  *             self.c = self.orig_c
2940  *         else:
2941  */
2942     goto __pyx_L6;
2943   }
2944 
2945   /* "pymatgen/optimization/linear_assignment.pyx":68
2946  *             self.c = self.orig_c
2947  *         else:
2948  *             self.c = np.zeros((self.n, self.n), dtype=np.float_)             # <<<<<<<<<<<<<<
2949  *             self.c[:self.nx] = self.orig_c
2950  *
2951  */
2952   /*else*/ {
2953     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
2954     __Pyx_GOTREF(__pyx_t_3);
2955     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
2956     __Pyx_GOTREF(__pyx_t_1);
2957     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2958     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
2959     __Pyx_GOTREF(__pyx_t_3);
2960     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error)
2961     __Pyx_GOTREF(__pyx_t_5);
2962     __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
2963     __Pyx_GOTREF(__pyx_t_2);
2964     __Pyx_GIVEREF(__pyx_t_3);
2965     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
2966     __Pyx_GIVEREF(__pyx_t_5);
2967     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
2968     __pyx_t_3 = 0;
2969     __pyx_t_5 = 0;
2970     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error)
2971     __Pyx_GOTREF(__pyx_t_5);
2972     __Pyx_GIVEREF(__pyx_t_2);
2973     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
2974     __pyx_t_2 = 0;
2975     __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
2976     __Pyx_GOTREF(__pyx_t_2);
2977     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
2978     __Pyx_GOTREF(__pyx_t_3);
2979     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error)
2980     __Pyx_GOTREF(__pyx_t_4);
2981     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2982     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 68, __pyx_L1_error)
2983     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2984     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error)
2985     __Pyx_GOTREF(__pyx_t_4);
2986     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2987     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2988     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2989     if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c, __pyx_t_4) < 0) __PYX_ERR(0, 68, __pyx_L1_error)
2990     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2991 
2992     /* "pymatgen/optimization/linear_assignment.pyx":69
2993  *         else:
2994  *             self.c = np.zeros((self.n, self.n), dtype=np.float_)
2995  *             self.c[:self.nx] = self.orig_c             # <<<<<<<<<<<<<<
2996  *
2997  *         #initialize solution vectors
2998  */
2999     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_orig_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error)
3000     __Pyx_GOTREF(__pyx_t_4);
3001     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error)
3002     __Pyx_GOTREF(__pyx_t_2);
3003     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error)
3004     __Pyx_GOTREF(__pyx_t_5);
3005     if (__Pyx_PyObject_SetSlice(__pyx_t_2, __pyx_t_4, 0, 0, NULL, &__pyx_t_5, NULL, 0, 0, 1) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
3006     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3007     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3008     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3009   }
3010   __pyx_L6:;
3011 
3012   /* "pymatgen/optimization/linear_assignment.pyx":72
3013  *
3014  *         #initialize solution vectors
3015  *         self._x = np.empty(self.n, dtype=np.int)             # <<<<<<<<<<<<<<
3016  *         self._y = np.empty(self.n, dtype=np.int)
3017  *
3018  */
3019   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
3020   __Pyx_GOTREF(__pyx_t_4);
3021   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 72, __pyx_L1_error)
3022   __Pyx_GOTREF(__pyx_t_5);
3023   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3024   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
3025   __Pyx_GOTREF(__pyx_t_4);
3026   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
3027   __Pyx_GOTREF(__pyx_t_2);
3028   __Pyx_GIVEREF(__pyx_t_4);
3029   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
3030   __pyx_t_4 = 0;
3031   __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
3032   __Pyx_GOTREF(__pyx_t_4);
3033   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
3034   __Pyx_GOTREF(__pyx_t_1);
3035   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
3036   __Pyx_GOTREF(__pyx_t_3);
3037   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3038   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
3039   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3040   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
3041   __Pyx_GOTREF(__pyx_t_3);
3042   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3043   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3044   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3045   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_x, __pyx_t_3) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
3046   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3047 
3048   /* "pymatgen/optimization/linear_assignment.pyx":73
3049  *         #initialize solution vectors
3050  *         self._x = np.empty(self.n, dtype=np.int)
3051  *         self._y = np.empty(self.n, dtype=np.int)             # <<<<<<<<<<<<<<
3052  *
3053  *         self.min_cost = compute(self.n, self.c, self._x, self._y, self.epsilon)
3054  */
3055   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
3056   __Pyx_GOTREF(__pyx_t_3);
3057   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error)
3058   __Pyx_GOTREF(__pyx_t_4);
3059   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3060   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
3061   __Pyx_GOTREF(__pyx_t_3);
3062   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error)
3063   __Pyx_GOTREF(__pyx_t_2);
3064   __Pyx_GIVEREF(__pyx_t_3);
3065   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
3066   __pyx_t_3 = 0;
3067   __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
3068   __Pyx_GOTREF(__pyx_t_3);
3069   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L1_error)
3070   __Pyx_GOTREF(__pyx_t_5);
3071   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
3072   __Pyx_GOTREF(__pyx_t_1);
3073   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3074   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
3075   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3076   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
3077   __Pyx_GOTREF(__pyx_t_1);
3078   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3079   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3080   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3081   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_y, __pyx_t_1) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
3082   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3083 
3084   /* "pymatgen/optimization/linear_assignment.pyx":75
3085  *         self._y = np.empty(self.n, dtype=np.int)
3086  *
3087  *         self.min_cost = compute(self.n, self.c, self._x, self._y, self.epsilon)             # <<<<<<<<<<<<<<
3088  *         self.solution = self._x[:self.nx]
3089  *
3090  */
3091   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
3092   __Pyx_GOTREF(__pyx_t_1);
3093   __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L1_error)
3094   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3095   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
3096   __Pyx_GOTREF(__pyx_t_1);
3097   __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 75, __pyx_L1_error)
3098   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3099   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
3100   __Pyx_GOTREF(__pyx_t_1);
3101   __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 75, __pyx_L1_error)
3102   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3103   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
3104   __Pyx_GOTREF(__pyx_t_1);
3105   __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 75, __pyx_L1_error)
3106   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3107   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_epsilon); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
3108   __Pyx_GOTREF(__pyx_t_1);
3109   __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_13 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L1_error)
3110   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3111   __pyx_t_1 = PyFloat_FromDouble(__pyx_f_8pymatgen_12optimization_17linear_assignment_compute(__pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
3112   __Pyx_GOTREF(__pyx_t_1);
3113   __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
3114   __pyx_t_10.memview = NULL;
3115   __pyx_t_10.data = NULL;
3116   __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
3117   __pyx_t_11.memview = NULL;
3118   __pyx_t_11.data = NULL;
3119   __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
3120   __pyx_t_12.memview = NULL;
3121   __pyx_t_12.data = NULL;
3122   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_min_cost, __pyx_t_1) < 0) __PYX_ERR(0, 75, __pyx_L1_error)
3123   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3124 
3125   /* "pymatgen/optimization/linear_assignment.pyx":76
3126  *
3127  *         self.min_cost = compute(self.n, self.c, self._x, self._y, self.epsilon)
3128  *         self.solution = self._x[:self.nx]             # <<<<<<<<<<<<<<
3129  *
3130  *
3131  */
3132   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
3133   __Pyx_GOTREF(__pyx_t_1);
3134   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
3135   __Pyx_GOTREF(__pyx_t_3);
3136   __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, NULL, &__pyx_t_3, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
3137   __Pyx_GOTREF(__pyx_t_2);
3138   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3139   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3140   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_solution, __pyx_t_2) < 0) __PYX_ERR(0, 76, __pyx_L1_error)
3141   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3142 
3143   /* "pymatgen/optimization/linear_assignment.pyx":54
3144  *     """
3145  *
3146  *     def __init__(self, costs, epsilon=1e-13):             # <<<<<<<<<<<<<<
3147  *         self.orig_c = np.array(costs, dtype=np.float_, copy=False, order='C')
3148  *         self.nx, self.ny = self.orig_c.shape
3149  */
3150 
3151   /* function exit code */
3152   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3153   goto __pyx_L0;
3154   __pyx_L1_error:;
3155   __Pyx_XDECREF(__pyx_t_1);
3156   __Pyx_XDECREF(__pyx_t_2);
3157   __Pyx_XDECREF(__pyx_t_3);
3158   __Pyx_XDECREF(__pyx_t_4);
3159   __Pyx_XDECREF(__pyx_t_5);
3160   __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
3161   __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
3162   __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
3163   __Pyx_AddTraceback("pymatgen.optimization.linear_assignment.LinearAssignment.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3164   __pyx_r = NULL;
3165   __pyx_L0:;
3166   __Pyx_XGIVEREF(__pyx_r);
3167   __Pyx_RefNannyFinishContext();
3168   return __pyx_r;
3169 }
3170 
3171 /* "pymatgen/optimization/linear_assignment.pyx":81
3172  * @cython.boundscheck(False)
3173  * @cython.wraparound(False)
3174  * cdef np.float_t compute(int size, np.float_t[:, :] c, np.int_t[:] x, np.int_t[:] y, np.float_t eps) nogil:             # <<<<<<<<<<<<<<
3175  *
3176  *     # augment
3177  */
3178 
__pyx_f_8pymatgen_12optimization_17linear_assignment_compute(int __pyx_v_size,__Pyx_memviewslice __pyx_v_c,__Pyx_memviewslice __pyx_v_x,__Pyx_memviewslice __pyx_v_y,__pyx_t_5numpy_float_t __pyx_v_eps)3179 static __pyx_t_5numpy_float_t __pyx_f_8pymatgen_12optimization_17linear_assignment_compute(int __pyx_v_size, __Pyx_memviewslice __pyx_v_c, __Pyx_memviewslice __pyx_v_x, __Pyx_memviewslice __pyx_v_y, __pyx_t_5numpy_float_t __pyx_v_eps) {
3180   int __pyx_v_i;
3181   int __pyx_v_j;
3182   int __pyx_v_k;
3183   int __pyx_v_i1;
3184   int __pyx_v_j1;
3185   int __pyx_v_f;
3186   int __pyx_v_f0;
3187   CYTHON_UNUSED int __pyx_v_cnt;
3188   int __pyx_v_low;
3189   int __pyx_v_up;
3190   int __pyx_v_z;
3191   int __pyx_v_last;
3192   int __pyx_v_nrr;
3193   int __pyx_v_n;
3194   int __pyx_v_b;
3195   __pyx_t_5numpy_int_t *__pyx_v_col;
3196   __pyx_t_5numpy_int_t *__pyx_v_fre;
3197   __pyx_t_5numpy_int_t *__pyx_v_pred;
3198   __pyx_t_5numpy_float_t *__pyx_v_v;
3199   __pyx_t_5numpy_float_t *__pyx_v_d;
3200   __pyx_t_5numpy_float_t __pyx_v_h;
3201   __pyx_t_5numpy_float_t __pyx_v_m;
3202   __pyx_t_5numpy_float_t __pyx_v_u1;
3203   __pyx_t_5numpy_float_t __pyx_v_u2;
3204   __pyx_t_5numpy_float_t __pyx_v_cost;
3205   int __pyx_v_j2;
3206   __pyx_t_5numpy_float_t __pyx_r;
3207   int __pyx_t_1;
3208   int __pyx_t_2;
3209   int __pyx_t_3;
3210   Py_ssize_t __pyx_t_4;
3211   Py_ssize_t __pyx_t_5;
3212   int __pyx_t_6;
3213   int __pyx_t_7;
3214   int __pyx_t_8;
3215   int __pyx_t_9;
3216   int __pyx_t_10;
3217   long __pyx_t_11;
3218   long __pyx_t_12;
3219   long __pyx_t_13;
3220   long __pyx_t_14;
3221   Py_ssize_t __pyx_t_15;
3222 
3223   /* "pymatgen/optimization/linear_assignment.pyx":85
3224  *     # augment
3225  *     cdef int i, j, k, i1, j1, f, f0, cnt, low, up, z, last, nrr
3226  *     cdef int n = size             # <<<<<<<<<<<<<<
3227  *     cdef bint b
3228  *     cdef np.int_t * col = <np.int_t *> malloc(n * sizeof(np.int_t))
3229  */
3230   __pyx_v_n = __pyx_v_size;
3231 
3232   /* "pymatgen/optimization/linear_assignment.pyx":87
3233  *     cdef int n = size
3234  *     cdef bint b
3235  *     cdef np.int_t * col = <np.int_t *> malloc(n * sizeof(np.int_t))             # <<<<<<<<<<<<<<
3236  *     cdef np.int_t * fre = <np.int_t *> malloc(n * sizeof(np.int_t))
3237  *     cdef np.int_t * pred = <np.int_t *> malloc(n * sizeof(np.int_t))
3238  */
3239   __pyx_v_col = ((__pyx_t_5numpy_int_t *)malloc((__pyx_v_n * (sizeof(__pyx_t_5numpy_int_t)))));
3240 
3241   /* "pymatgen/optimization/linear_assignment.pyx":88
3242  *     cdef bint b
3243  *     cdef np.int_t * col = <np.int_t *> malloc(n * sizeof(np.int_t))
3244  *     cdef np.int_t * fre = <np.int_t *> malloc(n * sizeof(np.int_t))             # <<<<<<<<<<<<<<
3245  *     cdef np.int_t * pred = <np.int_t *> malloc(n * sizeof(np.int_t))
3246  *     cdef np.float_t * v = <np.float_t *> malloc(n * sizeof(np.float_t))
3247  */
3248   __pyx_v_fre = ((__pyx_t_5numpy_int_t *)malloc((__pyx_v_n * (sizeof(__pyx_t_5numpy_int_t)))));
3249 
3250   /* "pymatgen/optimization/linear_assignment.pyx":89
3251  *     cdef np.int_t * col = <np.int_t *> malloc(n * sizeof(np.int_t))
3252  *     cdef np.int_t * fre = <np.int_t *> malloc(n * sizeof(np.int_t))
3253  *     cdef np.int_t * pred = <np.int_t *> malloc(n * sizeof(np.int_t))             # <<<<<<<<<<<<<<
3254  *     cdef np.float_t * v = <np.float_t *> malloc(n * sizeof(np.float_t))
3255  *     cdef np.float_t * d = <np.float_t *> malloc(n * sizeof(np.float_t))
3256  */
3257   __pyx_v_pred = ((__pyx_t_5numpy_int_t *)malloc((__pyx_v_n * (sizeof(__pyx_t_5numpy_int_t)))));
3258 
3259   /* "pymatgen/optimization/linear_assignment.pyx":90
3260  *     cdef np.int_t * fre = <np.int_t *> malloc(n * sizeof(np.int_t))
3261  *     cdef np.int_t * pred = <np.int_t *> malloc(n * sizeof(np.int_t))
3262  *     cdef np.float_t * v = <np.float_t *> malloc(n * sizeof(np.float_t))             # <<<<<<<<<<<<<<
3263  *     cdef np.float_t * d = <np.float_t *> malloc(n * sizeof(np.float_t))
3264  *     cdef np.float_t h, m, u1, u2, cost
3265  */
3266   __pyx_v_v = ((__pyx_t_5numpy_float_t *)malloc((__pyx_v_n * (sizeof(__pyx_t_5numpy_float_t)))));
3267 
3268   /* "pymatgen/optimization/linear_assignment.pyx":91
3269  *     cdef np.int_t * pred = <np.int_t *> malloc(n * sizeof(np.int_t))
3270  *     cdef np.float_t * v = <np.float_t *> malloc(n * sizeof(np.float_t))
3271  *     cdef np.float_t * d = <np.float_t *> malloc(n * sizeof(np.float_t))             # <<<<<<<<<<<<<<
3272  *     cdef np.float_t h, m, u1, u2, cost
3273  *
3274  */
3275   __pyx_v_d = ((__pyx_t_5numpy_float_t *)malloc((__pyx_v_n * (sizeof(__pyx_t_5numpy_float_t)))));
3276 
3277   /* "pymatgen/optimization/linear_assignment.pyx":94
3278  *     cdef np.float_t h, m, u1, u2, cost
3279  *
3280  *     for i in range(n):             # <<<<<<<<<<<<<<
3281  *         x[i] = -1
3282  *
3283  */
3284   __pyx_t_1 = __pyx_v_n;
3285   __pyx_t_2 = __pyx_t_1;
3286   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3287     __pyx_v_i = __pyx_t_3;
3288 
3289     /* "pymatgen/optimization/linear_assignment.pyx":95
3290  *
3291  *     for i in range(n):
3292  *         x[i] = -1             # <<<<<<<<<<<<<<
3293  *
3294  *     # column reduction
3295  */
3296     __pyx_t_4 = __pyx_v_i;
3297     *((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_4 * __pyx_v_x.strides[0]) )) = -1L;
3298   }
3299 
3300   /* "pymatgen/optimization/linear_assignment.pyx":98
3301  *
3302  *     # column reduction
3303  *     for j from n > j >= 0:             # <<<<<<<<<<<<<<
3304  *         col[j] = j
3305  *         h = c[0, j]
3306  */
3307   for (__pyx_v_j = __pyx_v_n-1; __pyx_v_j >= 0; __pyx_v_j--) {
3308 
3309     /* "pymatgen/optimization/linear_assignment.pyx":99
3310  *     # column reduction
3311  *     for j from n > j >= 0:
3312  *         col[j] = j             # <<<<<<<<<<<<<<
3313  *         h = c[0, j]
3314  *         i1 = 0
3315  */
3316     (__pyx_v_col[__pyx_v_j]) = __pyx_v_j;
3317 
3318     /* "pymatgen/optimization/linear_assignment.pyx":100
3319  *     for j from n > j >= 0:
3320  *         col[j] = j
3321  *         h = c[0, j]             # <<<<<<<<<<<<<<
3322  *         i1 = 0
3323  *         for i in range(1, n):
3324  */
3325     __pyx_t_4 = 0;
3326     __pyx_t_5 = __pyx_v_j;
3327     __pyx_v_h = (*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_c.data + __pyx_t_4 * __pyx_v_c.strides[0]) ) + __pyx_t_5 * __pyx_v_c.strides[1]) )));
3328 
3329     /* "pymatgen/optimization/linear_assignment.pyx":101
3330  *         col[j] = j
3331  *         h = c[0, j]
3332  *         i1 = 0             # <<<<<<<<<<<<<<
3333  *         for i in range(1, n):
3334  *             if c[i, j] < h:
3335  */
3336     __pyx_v_i1 = 0;
3337 
3338     /* "pymatgen/optimization/linear_assignment.pyx":102
3339  *         h = c[0, j]
3340  *         i1 = 0
3341  *         for i in range(1, n):             # <<<<<<<<<<<<<<
3342  *             if c[i, j] < h:
3343  *                 h = c[i, j]
3344  */
3345     __pyx_t_1 = __pyx_v_n;
3346     __pyx_t_2 = __pyx_t_1;
3347     for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3348       __pyx_v_i = __pyx_t_3;
3349 
3350       /* "pymatgen/optimization/linear_assignment.pyx":103
3351  *         i1 = 0
3352  *         for i in range(1, n):
3353  *             if c[i, j] < h:             # <<<<<<<<<<<<<<
3354  *                 h = c[i, j]
3355  *                 i1 = i
3356  */
3357       __pyx_t_5 = __pyx_v_i;
3358       __pyx_t_4 = __pyx_v_j;
3359       __pyx_t_6 = (((*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_c.data + __pyx_t_5 * __pyx_v_c.strides[0]) ) + __pyx_t_4 * __pyx_v_c.strides[1]) ))) < __pyx_v_h) != 0);
3360       if (__pyx_t_6) {
3361 
3362         /* "pymatgen/optimization/linear_assignment.pyx":104
3363  *         for i in range(1, n):
3364  *             if c[i, j] < h:
3365  *                 h = c[i, j]             # <<<<<<<<<<<<<<
3366  *                 i1 = i
3367  *         v[j] = h
3368  */
3369         __pyx_t_4 = __pyx_v_i;
3370         __pyx_t_5 = __pyx_v_j;
3371         __pyx_v_h = (*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_c.data + __pyx_t_4 * __pyx_v_c.strides[0]) ) + __pyx_t_5 * __pyx_v_c.strides[1]) )));
3372 
3373         /* "pymatgen/optimization/linear_assignment.pyx":105
3374  *             if c[i, j] < h:
3375  *                 h = c[i, j]
3376  *                 i1 = i             # <<<<<<<<<<<<<<
3377  *         v[j] = h
3378  *         if x[i1] == -1:
3379  */
3380         __pyx_v_i1 = __pyx_v_i;
3381 
3382         /* "pymatgen/optimization/linear_assignment.pyx":103
3383  *         i1 = 0
3384  *         for i in range(1, n):
3385  *             if c[i, j] < h:             # <<<<<<<<<<<<<<
3386  *                 h = c[i, j]
3387  *                 i1 = i
3388  */
3389       }
3390     }
3391 
3392     /* "pymatgen/optimization/linear_assignment.pyx":106
3393  *                 h = c[i, j]
3394  *                 i1 = i
3395  *         v[j] = h             # <<<<<<<<<<<<<<
3396  *         if x[i1] == -1:
3397  *             x[i1] = j
3398  */
3399     (__pyx_v_v[__pyx_v_j]) = __pyx_v_h;
3400 
3401     /* "pymatgen/optimization/linear_assignment.pyx":107
3402  *                 i1 = i
3403  *         v[j] = h
3404  *         if x[i1] == -1:             # <<<<<<<<<<<<<<
3405  *             x[i1] = j
3406  *             y[j] = i1
3407  */
3408     __pyx_t_5 = __pyx_v_i1;
3409     __pyx_t_6 = (((*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_5 * __pyx_v_x.strides[0]) ))) == -1L) != 0);
3410     if (__pyx_t_6) {
3411 
3412       /* "pymatgen/optimization/linear_assignment.pyx":108
3413  *         v[j] = h
3414  *         if x[i1] == -1:
3415  *             x[i1] = j             # <<<<<<<<<<<<<<
3416  *             y[j] = i1
3417  *         else:
3418  */
3419       __pyx_t_5 = __pyx_v_i1;
3420       *((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_5 * __pyx_v_x.strides[0]) )) = __pyx_v_j;
3421 
3422       /* "pymatgen/optimization/linear_assignment.pyx":109
3423  *         if x[i1] == -1:
3424  *             x[i1] = j
3425  *             y[j] = i1             # <<<<<<<<<<<<<<
3426  *         else:
3427  *             # in the paper its x[i], but likely a typo
3428  */
3429       __pyx_t_5 = __pyx_v_j;
3430       *((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_y.data + __pyx_t_5 * __pyx_v_y.strides[0]) )) = __pyx_v_i1;
3431 
3432       /* "pymatgen/optimization/linear_assignment.pyx":107
3433  *                 i1 = i
3434  *         v[j] = h
3435  *         if x[i1] == -1:             # <<<<<<<<<<<<<<
3436  *             x[i1] = j
3437  *             y[j] = i1
3438  */
3439       goto __pyx_L10;
3440     }
3441 
3442     /* "pymatgen/optimization/linear_assignment.pyx":112
3443  *         else:
3444  *             # in the paper its x[i], but likely a typo
3445  *             if x[i1] > -1:             # <<<<<<<<<<<<<<
3446  *                 x[i1] = -2 - x[i1]
3447  *             y[j] = -1
3448  */
3449     /*else*/ {
3450       __pyx_t_5 = __pyx_v_i1;
3451       __pyx_t_6 = (((*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_5 * __pyx_v_x.strides[0]) ))) > -1L) != 0);
3452       if (__pyx_t_6) {
3453 
3454         /* "pymatgen/optimization/linear_assignment.pyx":113
3455  *             # in the paper its x[i], but likely a typo
3456  *             if x[i1] > -1:
3457  *                 x[i1] = -2 - x[i1]             # <<<<<<<<<<<<<<
3458  *             y[j] = -1
3459  *
3460  */
3461         __pyx_t_5 = __pyx_v_i1;
3462         __pyx_t_4 = __pyx_v_i1;
3463         *((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_4 * __pyx_v_x.strides[0]) )) = (-2L - (*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_5 * __pyx_v_x.strides[0]) ))));
3464 
3465         /* "pymatgen/optimization/linear_assignment.pyx":112
3466  *         else:
3467  *             # in the paper its x[i], but likely a typo
3468  *             if x[i1] > -1:             # <<<<<<<<<<<<<<
3469  *                 x[i1] = -2 - x[i1]
3470  *             y[j] = -1
3471  */
3472       }
3473 
3474       /* "pymatgen/optimization/linear_assignment.pyx":114
3475  *             if x[i1] > -1:
3476  *                 x[i1] = -2 - x[i1]
3477  *             y[j] = -1             # <<<<<<<<<<<<<<
3478  *
3479  *     # reduction transfer
3480  */
3481       __pyx_t_5 = __pyx_v_j;
3482       *((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_y.data + __pyx_t_5 * __pyx_v_y.strides[0]) )) = -1L;
3483     }
3484     __pyx_L10:;
3485   }
3486 
3487   /* "pymatgen/optimization/linear_assignment.pyx":117
3488  *
3489  *     # reduction transfer
3490  *     f = -1             # <<<<<<<<<<<<<<
3491  *     for i in range(n):
3492  *         if x[i] == -1:
3493  */
3494   __pyx_v_f = -1;
3495 
3496   /* "pymatgen/optimization/linear_assignment.pyx":118
3497  *     # reduction transfer
3498  *     f = -1
3499  *     for i in range(n):             # <<<<<<<<<<<<<<
3500  *         if x[i] == -1:
3501  *             f += 1
3502  */
3503   __pyx_t_1 = __pyx_v_n;
3504   __pyx_t_2 = __pyx_t_1;
3505   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3506     __pyx_v_i = __pyx_t_3;
3507 
3508     /* "pymatgen/optimization/linear_assignment.pyx":119
3509  *     f = -1
3510  *     for i in range(n):
3511  *         if x[i] == -1:             # <<<<<<<<<<<<<<
3512  *             f += 1
3513  *             fre[f] = i
3514  */
3515     __pyx_t_5 = __pyx_v_i;
3516     __pyx_t_6 = (((*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_5 * __pyx_v_x.strides[0]) ))) == -1L) != 0);
3517     if (__pyx_t_6) {
3518 
3519       /* "pymatgen/optimization/linear_assignment.pyx":120
3520  *     for i in range(n):
3521  *         if x[i] == -1:
3522  *             f += 1             # <<<<<<<<<<<<<<
3523  *             fre[f] = i
3524  *         elif x[i] < -1:
3525  */
3526       __pyx_v_f = (__pyx_v_f + 1);
3527 
3528       /* "pymatgen/optimization/linear_assignment.pyx":121
3529  *         if x[i] == -1:
3530  *             f += 1
3531  *             fre[f] = i             # <<<<<<<<<<<<<<
3532  *         elif x[i] < -1:
3533  *             x[i] = -2 - x[i]
3534  */
3535       (__pyx_v_fre[__pyx_v_f]) = __pyx_v_i;
3536 
3537       /* "pymatgen/optimization/linear_assignment.pyx":119
3538  *     f = -1
3539  *     for i in range(n):
3540  *         if x[i] == -1:             # <<<<<<<<<<<<<<
3541  *             f += 1
3542  *             fre[f] = i
3543  */
3544       goto __pyx_L14;
3545     }
3546 
3547     /* "pymatgen/optimization/linear_assignment.pyx":122
3548  *             f += 1
3549  *             fre[f] = i
3550  *         elif x[i] < -1:             # <<<<<<<<<<<<<<
3551  *             x[i] = -2 - x[i]
3552  *         else:
3553  */
3554     __pyx_t_5 = __pyx_v_i;
3555     __pyx_t_6 = (((*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_5 * __pyx_v_x.strides[0]) ))) < -1L) != 0);
3556     if (__pyx_t_6) {
3557 
3558       /* "pymatgen/optimization/linear_assignment.pyx":123
3559  *             fre[f] = i
3560  *         elif x[i] < -1:
3561  *             x[i] = -2 - x[i]             # <<<<<<<<<<<<<<
3562  *         else:
3563  *             j1 = x[i]
3564  */
3565       __pyx_t_5 = __pyx_v_i;
3566       __pyx_t_4 = __pyx_v_i;
3567       *((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_4 * __pyx_v_x.strides[0]) )) = (-2L - (*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_5 * __pyx_v_x.strides[0]) ))));
3568 
3569       /* "pymatgen/optimization/linear_assignment.pyx":122
3570  *             f += 1
3571  *             fre[f] = i
3572  *         elif x[i] < -1:             # <<<<<<<<<<<<<<
3573  *             x[i] = -2 - x[i]
3574  *         else:
3575  */
3576       goto __pyx_L14;
3577     }
3578 
3579     /* "pymatgen/optimization/linear_assignment.pyx":125
3580  *             x[i] = -2 - x[i]
3581  *         else:
3582  *             j1 = x[i]             # <<<<<<<<<<<<<<
3583  *             m = 1e300
3584  *             for j in range(n):
3585  */
3586     /*else*/ {
3587       __pyx_t_5 = __pyx_v_i;
3588       __pyx_v_j1 = (*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_5 * __pyx_v_x.strides[0]) )));
3589 
3590       /* "pymatgen/optimization/linear_assignment.pyx":126
3591  *         else:
3592  *             j1 = x[i]
3593  *             m = 1e300             # <<<<<<<<<<<<<<
3594  *             for j in range(n):
3595  *                 if j != j1:
3596  */
3597       __pyx_v_m = 1e300;
3598 
3599       /* "pymatgen/optimization/linear_assignment.pyx":127
3600  *             j1 = x[i]
3601  *             m = 1e300
3602  *             for j in range(n):             # <<<<<<<<<<<<<<
3603  *                 if j != j1:
3604  *                     if c[i, j] - v[j] < m:
3605  */
3606       __pyx_t_7 = __pyx_v_n;
3607       __pyx_t_8 = __pyx_t_7;
3608       for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
3609         __pyx_v_j = __pyx_t_9;
3610 
3611         /* "pymatgen/optimization/linear_assignment.pyx":128
3612  *             m = 1e300
3613  *             for j in range(n):
3614  *                 if j != j1:             # <<<<<<<<<<<<<<
3615  *                     if c[i, j] - v[j] < m:
3616  *                         m = c[i, j] - v[j]
3617  */
3618         __pyx_t_6 = ((__pyx_v_j != __pyx_v_j1) != 0);
3619         if (__pyx_t_6) {
3620 
3621           /* "pymatgen/optimization/linear_assignment.pyx":129
3622  *             for j in range(n):
3623  *                 if j != j1:
3624  *                     if c[i, j] - v[j] < m:             # <<<<<<<<<<<<<<
3625  *                         m = c[i, j] - v[j]
3626  *             v[j1] = v[j1] - m
3627  */
3628           __pyx_t_5 = __pyx_v_i;
3629           __pyx_t_4 = __pyx_v_j;
3630           __pyx_t_6 = ((((*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_c.data + __pyx_t_5 * __pyx_v_c.strides[0]) ) + __pyx_t_4 * __pyx_v_c.strides[1]) ))) - (__pyx_v_v[__pyx_v_j])) < __pyx_v_m) != 0);
3631           if (__pyx_t_6) {
3632 
3633             /* "pymatgen/optimization/linear_assignment.pyx":130
3634  *                 if j != j1:
3635  *                     if c[i, j] - v[j] < m:
3636  *                         m = c[i, j] - v[j]             # <<<<<<<<<<<<<<
3637  *             v[j1] = v[j1] - m
3638  *
3639  */
3640             __pyx_t_4 = __pyx_v_i;
3641             __pyx_t_5 = __pyx_v_j;
3642             __pyx_v_m = ((*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_c.data + __pyx_t_4 * __pyx_v_c.strides[0]) ) + __pyx_t_5 * __pyx_v_c.strides[1]) ))) - (__pyx_v_v[__pyx_v_j]));
3643 
3644             /* "pymatgen/optimization/linear_assignment.pyx":129
3645  *             for j in range(n):
3646  *                 if j != j1:
3647  *                     if c[i, j] - v[j] < m:             # <<<<<<<<<<<<<<
3648  *                         m = c[i, j] - v[j]
3649  *             v[j1] = v[j1] - m
3650  */
3651           }
3652 
3653           /* "pymatgen/optimization/linear_assignment.pyx":128
3654  *             m = 1e300
3655  *             for j in range(n):
3656  *                 if j != j1:             # <<<<<<<<<<<<<<
3657  *                     if c[i, j] - v[j] < m:
3658  *                         m = c[i, j] - v[j]
3659  */
3660         }
3661       }
3662 
3663       /* "pymatgen/optimization/linear_assignment.pyx":131
3664  *                     if c[i, j] - v[j] < m:
3665  *                         m = c[i, j] - v[j]
3666  *             v[j1] = v[j1] - m             # <<<<<<<<<<<<<<
3667  *
3668  *     # augmenting row reduction
3669  */
3670       (__pyx_v_v[__pyx_v_j1]) = ((__pyx_v_v[__pyx_v_j1]) - __pyx_v_m);
3671     }
3672     __pyx_L14:;
3673   }
3674 
3675   /* "pymatgen/optimization/linear_assignment.pyx":134
3676  *
3677  *     # augmenting row reduction
3678  *     for cnt in range(2):             # <<<<<<<<<<<<<<
3679  *         k = 0
3680  *         f0 = f
3681  */
3682   for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) {
3683     __pyx_v_cnt = __pyx_t_1;
3684 
3685     /* "pymatgen/optimization/linear_assignment.pyx":135
3686  *     # augmenting row reduction
3687  *     for cnt in range(2):
3688  *         k = 0             # <<<<<<<<<<<<<<
3689  *         f0 = f
3690  *         f = -1
3691  */
3692     __pyx_v_k = 0;
3693 
3694     /* "pymatgen/optimization/linear_assignment.pyx":136
3695  *     for cnt in range(2):
3696  *         k = 0
3697  *         f0 = f             # <<<<<<<<<<<<<<
3698  *         f = -1
3699  *         # this step isn't strictly necessary, and
3700  */
3701     __pyx_v_f0 = __pyx_v_f;
3702 
3703     /* "pymatgen/optimization/linear_assignment.pyx":137
3704  *         k = 0
3705  *         f0 = f
3706  *         f = -1             # <<<<<<<<<<<<<<
3707  *         # this step isn't strictly necessary, and
3708  *         # time is proportional to 1/eps in the worst case,
3709  */
3710     __pyx_v_f = -1;
3711 
3712     /* "pymatgen/optimization/linear_assignment.pyx":141
3713  *         # time is proportional to 1/eps in the worst case,
3714  *         # so break early by keeping track of nrr
3715  *         nrr = 0             # <<<<<<<<<<<<<<
3716  *         while k <= f0:
3717  *             nrr += 1
3718  */
3719     __pyx_v_nrr = 0;
3720 
3721     /* "pymatgen/optimization/linear_assignment.pyx":142
3722  *         # so break early by keeping track of nrr
3723  *         nrr = 0
3724  *         while k <= f0:             # <<<<<<<<<<<<<<
3725  *             nrr += 1
3726  *             i = fre[k]
3727  */
3728     while (1) {
3729       __pyx_t_6 = ((__pyx_v_k <= __pyx_v_f0) != 0);
3730       if (!__pyx_t_6) break;
3731 
3732       /* "pymatgen/optimization/linear_assignment.pyx":143
3733  *         nrr = 0
3734  *         while k <= f0:
3735  *             nrr += 1             # <<<<<<<<<<<<<<
3736  *             i = fre[k]
3737  *             k += 1
3738  */
3739       __pyx_v_nrr = (__pyx_v_nrr + 1);
3740 
3741       /* "pymatgen/optimization/linear_assignment.pyx":144
3742  *         while k <= f0:
3743  *             nrr += 1
3744  *             i = fre[k]             # <<<<<<<<<<<<<<
3745  *             k += 1
3746  *             u1 = c[i, 0] - v[0]
3747  */
3748       __pyx_v_i = (__pyx_v_fre[__pyx_v_k]);
3749 
3750       /* "pymatgen/optimization/linear_assignment.pyx":145
3751  *             nrr += 1
3752  *             i = fre[k]
3753  *             k += 1             # <<<<<<<<<<<<<<
3754  *             u1 = c[i, 0] - v[0]
3755  *             j1 = 0
3756  */
3757       __pyx_v_k = (__pyx_v_k + 1);
3758 
3759       /* "pymatgen/optimization/linear_assignment.pyx":146
3760  *             i = fre[k]
3761  *             k += 1
3762  *             u1 = c[i, 0] - v[0]             # <<<<<<<<<<<<<<
3763  *             j1 = 0
3764  *             u2 = 1e300
3765  */
3766       __pyx_t_5 = __pyx_v_i;
3767       __pyx_t_4 = 0;
3768       __pyx_v_u1 = ((*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_c.data + __pyx_t_5 * __pyx_v_c.strides[0]) ) + __pyx_t_4 * __pyx_v_c.strides[1]) ))) - (__pyx_v_v[0]));
3769 
3770       /* "pymatgen/optimization/linear_assignment.pyx":147
3771  *             k += 1
3772  *             u1 = c[i, 0] - v[0]
3773  *             j1 = 0             # <<<<<<<<<<<<<<
3774  *             u2 = 1e300
3775  *             for j in range(1, n):
3776  */
3777       __pyx_v_j1 = 0;
3778 
3779       /* "pymatgen/optimization/linear_assignment.pyx":148
3780  *             u1 = c[i, 0] - v[0]
3781  *             j1 = 0
3782  *             u2 = 1e300             # <<<<<<<<<<<<<<
3783  *             for j in range(1, n):
3784  *                 h = c[i, j] - v[j]
3785  */
3786       __pyx_v_u2 = 1e300;
3787 
3788       /* "pymatgen/optimization/linear_assignment.pyx":149
3789  *             j1 = 0
3790  *             u2 = 1e300
3791  *             for j in range(1, n):             # <<<<<<<<<<<<<<
3792  *                 h = c[i, j] - v[j]
3793  *                 if h < u2:
3794  */
3795       __pyx_t_2 = __pyx_v_n;
3796       __pyx_t_3 = __pyx_t_2;
3797       for (__pyx_t_7 = 1; __pyx_t_7 < __pyx_t_3; __pyx_t_7+=1) {
3798         __pyx_v_j = __pyx_t_7;
3799 
3800         /* "pymatgen/optimization/linear_assignment.pyx":150
3801  *             u2 = 1e300
3802  *             for j in range(1, n):
3803  *                 h = c[i, j] - v[j]             # <<<<<<<<<<<<<<
3804  *                 if h < u2:
3805  *                     if h >= u1:
3806  */
3807         __pyx_t_4 = __pyx_v_i;
3808         __pyx_t_5 = __pyx_v_j;
3809         __pyx_v_h = ((*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_c.data + __pyx_t_4 * __pyx_v_c.strides[0]) ) + __pyx_t_5 * __pyx_v_c.strides[1]) ))) - (__pyx_v_v[__pyx_v_j]));
3810 
3811         /* "pymatgen/optimization/linear_assignment.pyx":151
3812  *             for j in range(1, n):
3813  *                 h = c[i, j] - v[j]
3814  *                 if h < u2:             # <<<<<<<<<<<<<<
3815  *                     if h >= u1:
3816  *                         u2 = h
3817  */
3818         __pyx_t_6 = ((__pyx_v_h < __pyx_v_u2) != 0);
3819         if (__pyx_t_6) {
3820 
3821           /* "pymatgen/optimization/linear_assignment.pyx":152
3822  *                 h = c[i, j] - v[j]
3823  *                 if h < u2:
3824  *                     if h >= u1:             # <<<<<<<<<<<<<<
3825  *                         u2 = h
3826  *                         j2 = j
3827  */
3828           __pyx_t_6 = ((__pyx_v_h >= __pyx_v_u1) != 0);
3829           if (__pyx_t_6) {
3830 
3831             /* "pymatgen/optimization/linear_assignment.pyx":153
3832  *                 if h < u2:
3833  *                     if h >= u1:
3834  *                         u2 = h             # <<<<<<<<<<<<<<
3835  *                         j2 = j
3836  *                     else:
3837  */
3838             __pyx_v_u2 = __pyx_v_h;
3839 
3840             /* "pymatgen/optimization/linear_assignment.pyx":154
3841  *                     if h >= u1:
3842  *                         u2 = h
3843  *                         j2 = j             # <<<<<<<<<<<<<<
3844  *                     else:
3845  *                         u2 = u1
3846  */
3847             __pyx_v_j2 = __pyx_v_j;
3848 
3849             /* "pymatgen/optimization/linear_assignment.pyx":152
3850  *                 h = c[i, j] - v[j]
3851  *                 if h < u2:
3852  *                     if h >= u1:             # <<<<<<<<<<<<<<
3853  *                         u2 = h
3854  *                         j2 = j
3855  */
3856             goto __pyx_L26;
3857           }
3858 
3859           /* "pymatgen/optimization/linear_assignment.pyx":156
3860  *                         j2 = j
3861  *                     else:
3862  *                         u2 = u1             # <<<<<<<<<<<<<<
3863  *                         u1 = h
3864  *                         j2 = j1
3865  */
3866           /*else*/ {
3867             __pyx_v_u2 = __pyx_v_u1;
3868 
3869             /* "pymatgen/optimization/linear_assignment.pyx":157
3870  *                     else:
3871  *                         u2 = u1
3872  *                         u1 = h             # <<<<<<<<<<<<<<
3873  *                         j2 = j1
3874  *                         j1 = j
3875  */
3876             __pyx_v_u1 = __pyx_v_h;
3877 
3878             /* "pymatgen/optimization/linear_assignment.pyx":158
3879  *                         u2 = u1
3880  *                         u1 = h
3881  *                         j2 = j1             # <<<<<<<<<<<<<<
3882  *                         j1 = j
3883  *             i1 = y[j1]
3884  */
3885             __pyx_v_j2 = __pyx_v_j1;
3886 
3887             /* "pymatgen/optimization/linear_assignment.pyx":159
3888  *                         u1 = h
3889  *                         j2 = j1
3890  *                         j1 = j             # <<<<<<<<<<<<<<
3891  *             i1 = y[j1]
3892  *             if u1 + eps < u2 and nrr < n * k:
3893  */
3894             __pyx_v_j1 = __pyx_v_j;
3895           }
3896           __pyx_L26:;
3897 
3898           /* "pymatgen/optimization/linear_assignment.pyx":151
3899  *             for j in range(1, n):
3900  *                 h = c[i, j] - v[j]
3901  *                 if h < u2:             # <<<<<<<<<<<<<<
3902  *                     if h >= u1:
3903  *                         u2 = h
3904  */
3905         }
3906       }
3907 
3908       /* "pymatgen/optimization/linear_assignment.pyx":160
3909  *                         j2 = j1
3910  *                         j1 = j
3911  *             i1 = y[j1]             # <<<<<<<<<<<<<<
3912  *             if u1 + eps < u2 and nrr < n * k:
3913  *                 v[j1] = v[j1] - u2 + u1
3914  */
3915       __pyx_t_5 = __pyx_v_j1;
3916       __pyx_v_i1 = (*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_y.data + __pyx_t_5 * __pyx_v_y.strides[0]) )));
3917 
3918       /* "pymatgen/optimization/linear_assignment.pyx":161
3919  *                         j1 = j
3920  *             i1 = y[j1]
3921  *             if u1 + eps < u2 and nrr < n * k:             # <<<<<<<<<<<<<<
3922  *                 v[j1] = v[j1] - u2 + u1
3923  *             elif i1 > -1 and nrr < n * k:
3924  */
3925       __pyx_t_10 = (((__pyx_v_u1 + __pyx_v_eps) < __pyx_v_u2) != 0);
3926       if (__pyx_t_10) {
3927       } else {
3928         __pyx_t_6 = __pyx_t_10;
3929         goto __pyx_L28_bool_binop_done;
3930       }
3931       __pyx_t_10 = ((__pyx_v_nrr < (__pyx_v_n * __pyx_v_k)) != 0);
3932       __pyx_t_6 = __pyx_t_10;
3933       __pyx_L28_bool_binop_done:;
3934       if (__pyx_t_6) {
3935 
3936         /* "pymatgen/optimization/linear_assignment.pyx":162
3937  *             i1 = y[j1]
3938  *             if u1 + eps < u2 and nrr < n * k:
3939  *                 v[j1] = v[j1] - u2 + u1             # <<<<<<<<<<<<<<
3940  *             elif i1 > -1 and nrr < n * k:
3941  *                 j1 = j2
3942  */
3943         (__pyx_v_v[__pyx_v_j1]) = (((__pyx_v_v[__pyx_v_j1]) - __pyx_v_u2) + __pyx_v_u1);
3944 
3945         /* "pymatgen/optimization/linear_assignment.pyx":161
3946  *                         j1 = j
3947  *             i1 = y[j1]
3948  *             if u1 + eps < u2 and nrr < n * k:             # <<<<<<<<<<<<<<
3949  *                 v[j1] = v[j1] - u2 + u1
3950  *             elif i1 > -1 and nrr < n * k:
3951  */
3952         goto __pyx_L27;
3953       }
3954 
3955       /* "pymatgen/optimization/linear_assignment.pyx":163
3956  *             if u1 + eps < u2 and nrr < n * k:
3957  *                 v[j1] = v[j1] - u2 + u1
3958  *             elif i1 > -1 and nrr < n * k:             # <<<<<<<<<<<<<<
3959  *                 j1 = j2
3960  *                 i1 = y[j1]
3961  */
3962       __pyx_t_10 = ((__pyx_v_i1 > -1L) != 0);
3963       if (__pyx_t_10) {
3964       } else {
3965         __pyx_t_6 = __pyx_t_10;
3966         goto __pyx_L30_bool_binop_done;
3967       }
3968       __pyx_t_10 = ((__pyx_v_nrr < (__pyx_v_n * __pyx_v_k)) != 0);
3969       __pyx_t_6 = __pyx_t_10;
3970       __pyx_L30_bool_binop_done:;
3971       if (__pyx_t_6) {
3972 
3973         /* "pymatgen/optimization/linear_assignment.pyx":164
3974  *                 v[j1] = v[j1] - u2 + u1
3975  *             elif i1 > -1 and nrr < n * k:
3976  *                 j1 = j2             # <<<<<<<<<<<<<<
3977  *                 i1 = y[j1]
3978  *             if i1 > -1:
3979  */
3980         __pyx_v_j1 = __pyx_v_j2;
3981 
3982         /* "pymatgen/optimization/linear_assignment.pyx":165
3983  *             elif i1 > -1 and nrr < n * k:
3984  *                 j1 = j2
3985  *                 i1 = y[j1]             # <<<<<<<<<<<<<<
3986  *             if i1 > -1:
3987  *                 if u1 + eps < u2 and nrr < n * k:
3988  */
3989         __pyx_t_5 = __pyx_v_j1;
3990         __pyx_v_i1 = (*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_y.data + __pyx_t_5 * __pyx_v_y.strides[0]) )));
3991 
3992         /* "pymatgen/optimization/linear_assignment.pyx":163
3993  *             if u1 + eps < u2 and nrr < n * k:
3994  *                 v[j1] = v[j1] - u2 + u1
3995  *             elif i1 > -1 and nrr < n * k:             # <<<<<<<<<<<<<<
3996  *                 j1 = j2
3997  *                 i1 = y[j1]
3998  */
3999       }
4000       __pyx_L27:;
4001 
4002       /* "pymatgen/optimization/linear_assignment.pyx":166
4003  *                 j1 = j2
4004  *                 i1 = y[j1]
4005  *             if i1 > -1:             # <<<<<<<<<<<<<<
4006  *                 if u1 + eps < u2 and nrr < n * k:
4007  *                     k -= 1
4008  */
4009       __pyx_t_6 = ((__pyx_v_i1 > -1L) != 0);
4010       if (__pyx_t_6) {
4011 
4012         /* "pymatgen/optimization/linear_assignment.pyx":167
4013  *                 i1 = y[j1]
4014  *             if i1 > -1:
4015  *                 if u1 + eps < u2 and nrr < n * k:             # <<<<<<<<<<<<<<
4016  *                     k -= 1
4017  *                     fre[k] = i1
4018  */
4019         __pyx_t_10 = (((__pyx_v_u1 + __pyx_v_eps) < __pyx_v_u2) != 0);
4020         if (__pyx_t_10) {
4021         } else {
4022           __pyx_t_6 = __pyx_t_10;
4023           goto __pyx_L34_bool_binop_done;
4024         }
4025         __pyx_t_10 = ((__pyx_v_nrr < (__pyx_v_n * __pyx_v_k)) != 0);
4026         __pyx_t_6 = __pyx_t_10;
4027         __pyx_L34_bool_binop_done:;
4028         if (__pyx_t_6) {
4029 
4030           /* "pymatgen/optimization/linear_assignment.pyx":168
4031  *             if i1 > -1:
4032  *                 if u1 + eps < u2 and nrr < n * k:
4033  *                     k -= 1             # <<<<<<<<<<<<<<
4034  *                     fre[k] = i1
4035  *                 else:
4036  */
4037           __pyx_v_k = (__pyx_v_k - 1);
4038 
4039           /* "pymatgen/optimization/linear_assignment.pyx":169
4040  *                 if u1 + eps < u2 and nrr < n * k:
4041  *                     k -= 1
4042  *                     fre[k] = i1             # <<<<<<<<<<<<<<
4043  *                 else:
4044  *                     f += 1
4045  */
4046           (__pyx_v_fre[__pyx_v_k]) = __pyx_v_i1;
4047 
4048           /* "pymatgen/optimization/linear_assignment.pyx":167
4049  *                 i1 = y[j1]
4050  *             if i1 > -1:
4051  *                 if u1 + eps < u2 and nrr < n * k:             # <<<<<<<<<<<<<<
4052  *                     k -= 1
4053  *                     fre[k] = i1
4054  */
4055           goto __pyx_L33;
4056         }
4057 
4058         /* "pymatgen/optimization/linear_assignment.pyx":171
4059  *                     fre[k] = i1
4060  *                 else:
4061  *                     f += 1             # <<<<<<<<<<<<<<
4062  *                     fre[f] = i1
4063  *             x[i] = j1
4064  */
4065         /*else*/ {
4066           __pyx_v_f = (__pyx_v_f + 1);
4067 
4068           /* "pymatgen/optimization/linear_assignment.pyx":172
4069  *                 else:
4070  *                     f += 1
4071  *                     fre[f] = i1             # <<<<<<<<<<<<<<
4072  *             x[i] = j1
4073  *             y[j1] = i
4074  */
4075           (__pyx_v_fre[__pyx_v_f]) = __pyx_v_i1;
4076         }
4077         __pyx_L33:;
4078 
4079         /* "pymatgen/optimization/linear_assignment.pyx":166
4080  *                 j1 = j2
4081  *                 i1 = y[j1]
4082  *             if i1 > -1:             # <<<<<<<<<<<<<<
4083  *                 if u1 + eps < u2 and nrr < n * k:
4084  *                     k -= 1
4085  */
4086       }
4087 
4088       /* "pymatgen/optimization/linear_assignment.pyx":173
4089  *                     f += 1
4090  *                     fre[f] = i1
4091  *             x[i] = j1             # <<<<<<<<<<<<<<
4092  *             y[j1] = i
4093  *
4094  */
4095       __pyx_t_5 = __pyx_v_i;
4096       *((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_5 * __pyx_v_x.strides[0]) )) = __pyx_v_j1;
4097 
4098       /* "pymatgen/optimization/linear_assignment.pyx":174
4099  *                     fre[f] = i1
4100  *             x[i] = j1
4101  *             y[j1] = i             # <<<<<<<<<<<<<<
4102  *
4103  *     # augmentation
4104  */
4105       __pyx_t_5 = __pyx_v_j1;
4106       *((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_y.data + __pyx_t_5 * __pyx_v_y.strides[0]) )) = __pyx_v_i;
4107     }
4108   }
4109 
4110   /* "pymatgen/optimization/linear_assignment.pyx":177
4111  *
4112  *     # augmentation
4113  *     f0 = f             # <<<<<<<<<<<<<<
4114  *     for f in range(f0 + 1):
4115  *         i1 = fre[f]
4116  */
4117   __pyx_v_f0 = __pyx_v_f;
4118 
4119   /* "pymatgen/optimization/linear_assignment.pyx":178
4120  *     # augmentation
4121  *     f0 = f
4122  *     for f in range(f0 + 1):             # <<<<<<<<<<<<<<
4123  *         i1 = fre[f]
4124  *         low = 0
4125  */
4126   __pyx_t_11 = (__pyx_v_f0 + 1);
4127   __pyx_t_12 = __pyx_t_11;
4128   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_12; __pyx_t_1+=1) {
4129     __pyx_v_f = __pyx_t_1;
4130 
4131     /* "pymatgen/optimization/linear_assignment.pyx":179
4132  *     f0 = f
4133  *     for f in range(f0 + 1):
4134  *         i1 = fre[f]             # <<<<<<<<<<<<<<
4135  *         low = 0
4136  *         up = 0
4137  */
4138     __pyx_v_i1 = (__pyx_v_fre[__pyx_v_f]);
4139 
4140     /* "pymatgen/optimization/linear_assignment.pyx":180
4141  *     for f in range(f0 + 1):
4142  *         i1 = fre[f]
4143  *         low = 0             # <<<<<<<<<<<<<<
4144  *         up = 0
4145  *         for j in range(n):
4146  */
4147     __pyx_v_low = 0;
4148 
4149     /* "pymatgen/optimization/linear_assignment.pyx":181
4150  *         i1 = fre[f]
4151  *         low = 0
4152  *         up = 0             # <<<<<<<<<<<<<<
4153  *         for j in range(n):
4154  *             d[j] = c[i1, j] - v[j]
4155  */
4156     __pyx_v_up = 0;
4157 
4158     /* "pymatgen/optimization/linear_assignment.pyx":182
4159  *         low = 0
4160  *         up = 0
4161  *         for j in range(n):             # <<<<<<<<<<<<<<
4162  *             d[j] = c[i1, j] - v[j]
4163  *             pred[j] = i1
4164  */
4165     __pyx_t_2 = __pyx_v_n;
4166     __pyx_t_3 = __pyx_t_2;
4167     for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7+=1) {
4168       __pyx_v_j = __pyx_t_7;
4169 
4170       /* "pymatgen/optimization/linear_assignment.pyx":183
4171  *         up = 0
4172  *         for j in range(n):
4173  *             d[j] = c[i1, j] - v[j]             # <<<<<<<<<<<<<<
4174  *             pred[j] = i1
4175  *         while True:
4176  */
4177       __pyx_t_5 = __pyx_v_i1;
4178       __pyx_t_4 = __pyx_v_j;
4179       (__pyx_v_d[__pyx_v_j]) = ((*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_c.data + __pyx_t_5 * __pyx_v_c.strides[0]) ) + __pyx_t_4 * __pyx_v_c.strides[1]) ))) - (__pyx_v_v[__pyx_v_j]));
4180 
4181       /* "pymatgen/optimization/linear_assignment.pyx":184
4182  *         for j in range(n):
4183  *             d[j] = c[i1, j] - v[j]
4184  *             pred[j] = i1             # <<<<<<<<<<<<<<
4185  *         while True:
4186  *             # the pascal code ends when a single augmentation is found
4187  */
4188       (__pyx_v_pred[__pyx_v_j]) = __pyx_v_i1;
4189     }
4190 
4191     /* "pymatgen/optimization/linear_assignment.pyx":185
4192  *             d[j] = c[i1, j] - v[j]
4193  *             pred[j] = i1
4194  *         while True:             # <<<<<<<<<<<<<<
4195  *             # the pascal code ends when a single augmentation is found
4196  *             # really we need to get back to the for f in range(f0+1) loop
4197  */
4198     while (1) {
4199 
4200       /* "pymatgen/optimization/linear_assignment.pyx":188
4201  *             # the pascal code ends when a single augmentation is found
4202  *             # really we need to get back to the for f in range(f0+1) loop
4203  *             b = False             # <<<<<<<<<<<<<<
4204  *             if up == low:
4205  *                 last = low-1
4206  */
4207       __pyx_v_b = 0;
4208 
4209       /* "pymatgen/optimization/linear_assignment.pyx":189
4210  *             # really we need to get back to the for f in range(f0+1) loop
4211  *             b = False
4212  *             if up == low:             # <<<<<<<<<<<<<<
4213  *                 last = low-1
4214  *                 m = d[col[up]]
4215  */
4216       __pyx_t_6 = ((__pyx_v_up == __pyx_v_low) != 0);
4217       if (__pyx_t_6) {
4218 
4219         /* "pymatgen/optimization/linear_assignment.pyx":190
4220  *             b = False
4221  *             if up == low:
4222  *                 last = low-1             # <<<<<<<<<<<<<<
4223  *                 m = d[col[up]]
4224  *                 up = up + 1
4225  */
4226         __pyx_v_last = (__pyx_v_low - 1);
4227 
4228         /* "pymatgen/optimization/linear_assignment.pyx":191
4229  *             if up == low:
4230  *                 last = low-1
4231  *                 m = d[col[up]]             # <<<<<<<<<<<<<<
4232  *                 up = up + 1
4233  *                 for k in range(up, n):
4234  */
4235         __pyx_v_m = (__pyx_v_d[(__pyx_v_col[__pyx_v_up])]);
4236 
4237         /* "pymatgen/optimization/linear_assignment.pyx":192
4238  *                 last = low-1
4239  *                 m = d[col[up]]
4240  *                 up = up + 1             # <<<<<<<<<<<<<<
4241  *                 for k in range(up, n):
4242  *                     j = col[k]
4243  */
4244         __pyx_v_up = (__pyx_v_up + 1);
4245 
4246         /* "pymatgen/optimization/linear_assignment.pyx":193
4247  *                 m = d[col[up]]
4248  *                 up = up + 1
4249  *                 for k in range(up, n):             # <<<<<<<<<<<<<<
4250  *                     j = col[k]
4251  *                     h = d[j]
4252  */
4253         __pyx_t_2 = __pyx_v_n;
4254         __pyx_t_3 = __pyx_t_2;
4255         for (__pyx_t_7 = __pyx_v_up; __pyx_t_7 < __pyx_t_3; __pyx_t_7+=1) {
4256           __pyx_v_k = __pyx_t_7;
4257 
4258           /* "pymatgen/optimization/linear_assignment.pyx":194
4259  *                 up = up + 1
4260  *                 for k in range(up, n):
4261  *                     j = col[k]             # <<<<<<<<<<<<<<
4262  *                     h = d[j]
4263  *                     if h <= m + eps:
4264  */
4265           __pyx_v_j = (__pyx_v_col[__pyx_v_k]);
4266 
4267           /* "pymatgen/optimization/linear_assignment.pyx":195
4268  *                 for k in range(up, n):
4269  *                     j = col[k]
4270  *                     h = d[j]             # <<<<<<<<<<<<<<
4271  *                     if h <= m + eps:
4272  *                         if h + eps < m:
4273  */
4274           __pyx_v_h = (__pyx_v_d[__pyx_v_j]);
4275 
4276           /* "pymatgen/optimization/linear_assignment.pyx":196
4277  *                     j = col[k]
4278  *                     h = d[j]
4279  *                     if h <= m + eps:             # <<<<<<<<<<<<<<
4280  *                         if h + eps < m:
4281  *                             up = low
4282  */
4283           __pyx_t_6 = ((__pyx_v_h <= (__pyx_v_m + __pyx_v_eps)) != 0);
4284           if (__pyx_t_6) {
4285 
4286             /* "pymatgen/optimization/linear_assignment.pyx":197
4287  *                     h = d[j]
4288  *                     if h <= m + eps:
4289  *                         if h + eps < m:             # <<<<<<<<<<<<<<
4290  *                             up = low
4291  *                             m = h
4292  */
4293             __pyx_t_6 = (((__pyx_v_h + __pyx_v_eps) < __pyx_v_m) != 0);
4294             if (__pyx_t_6) {
4295 
4296               /* "pymatgen/optimization/linear_assignment.pyx":198
4297  *                     if h <= m + eps:
4298  *                         if h + eps < m:
4299  *                             up = low             # <<<<<<<<<<<<<<
4300  *                             m = h
4301  *                         col[k] = col[up]
4302  */
4303               __pyx_v_up = __pyx_v_low;
4304 
4305               /* "pymatgen/optimization/linear_assignment.pyx":199
4306  *                         if h + eps < m:
4307  *                             up = low
4308  *                             m = h             # <<<<<<<<<<<<<<
4309  *                         col[k] = col[up]
4310  *                         col[up] = j
4311  */
4312               __pyx_v_m = __pyx_v_h;
4313 
4314               /* "pymatgen/optimization/linear_assignment.pyx":197
4315  *                     h = d[j]
4316  *                     if h <= m + eps:
4317  *                         if h + eps < m:             # <<<<<<<<<<<<<<
4318  *                             up = low
4319  *                             m = h
4320  */
4321             }
4322 
4323             /* "pymatgen/optimization/linear_assignment.pyx":200
4324  *                             up = low
4325  *                             m = h
4326  *                         col[k] = col[up]             # <<<<<<<<<<<<<<
4327  *                         col[up] = j
4328  *                         up = up + 1
4329  */
4330             (__pyx_v_col[__pyx_v_k]) = (__pyx_v_col[__pyx_v_up]);
4331 
4332             /* "pymatgen/optimization/linear_assignment.pyx":201
4333  *                             m = h
4334  *                         col[k] = col[up]
4335  *                         col[up] = j             # <<<<<<<<<<<<<<
4336  *                         up = up + 1
4337  *
4338  */
4339             (__pyx_v_col[__pyx_v_up]) = __pyx_v_j;
4340 
4341             /* "pymatgen/optimization/linear_assignment.pyx":202
4342  *                         col[k] = col[up]
4343  *                         col[up] = j
4344  *                         up = up + 1             # <<<<<<<<<<<<<<
4345  *
4346  *                 for z in range(low, up):
4347  */
4348             __pyx_v_up = (__pyx_v_up + 1);
4349 
4350             /* "pymatgen/optimization/linear_assignment.pyx":196
4351  *                     j = col[k]
4352  *                     h = d[j]
4353  *                     if h <= m + eps:             # <<<<<<<<<<<<<<
4354  *                         if h + eps < m:
4355  *                             up = low
4356  */
4357           }
4358         }
4359 
4360         /* "pymatgen/optimization/linear_assignment.pyx":204
4361  *                         up = up + 1
4362  *
4363  *                 for z in range(low, up):             # <<<<<<<<<<<<<<
4364  *                     j = col[z]
4365  *                     if y[j] == -1:
4366  */
4367         __pyx_t_2 = __pyx_v_up;
4368         __pyx_t_3 = __pyx_t_2;
4369         for (__pyx_t_7 = __pyx_v_low; __pyx_t_7 < __pyx_t_3; __pyx_t_7+=1) {
4370           __pyx_v_z = __pyx_t_7;
4371 
4372           /* "pymatgen/optimization/linear_assignment.pyx":205
4373  *
4374  *                 for z in range(low, up):
4375  *                     j = col[z]             # <<<<<<<<<<<<<<
4376  *                     if y[j] == -1:
4377  *                         # augment
4378  */
4379           __pyx_v_j = (__pyx_v_col[__pyx_v_z]);
4380 
4381           /* "pymatgen/optimization/linear_assignment.pyx":206
4382  *                 for z in range(low, up):
4383  *                     j = col[z]
4384  *                     if y[j] == -1:             # <<<<<<<<<<<<<<
4385  *                         # augment
4386  *                         for k in range(last+1):
4387  */
4388           __pyx_t_4 = __pyx_v_j;
4389           __pyx_t_6 = (((*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_y.data + __pyx_t_4 * __pyx_v_y.strides[0]) ))) == -1L) != 0);
4390           if (__pyx_t_6) {
4391 
4392             /* "pymatgen/optimization/linear_assignment.pyx":208
4393  *                     if y[j] == -1:
4394  *                         # augment
4395  *                         for k in range(last+1):             # <<<<<<<<<<<<<<
4396  *                             j1 = col[k]
4397  *                             v[j1] = v[j1] + d[j1] - m
4398  */
4399             __pyx_t_13 = (__pyx_v_last + 1);
4400             __pyx_t_14 = __pyx_t_13;
4401             for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_14; __pyx_t_8+=1) {
4402               __pyx_v_k = __pyx_t_8;
4403 
4404               /* "pymatgen/optimization/linear_assignment.pyx":209
4405  *                         # augment
4406  *                         for k in range(last+1):
4407  *                             j1 = col[k]             # <<<<<<<<<<<<<<
4408  *                             v[j1] = v[j1] + d[j1] - m
4409  *                         while True:
4410  */
4411               __pyx_v_j1 = (__pyx_v_col[__pyx_v_k]);
4412 
4413               /* "pymatgen/optimization/linear_assignment.pyx":210
4414  *                         for k in range(last+1):
4415  *                             j1 = col[k]
4416  *                             v[j1] = v[j1] + d[j1] - m             # <<<<<<<<<<<<<<
4417  *                         while True:
4418  *                             i = pred[j]
4419  */
4420               (__pyx_v_v[__pyx_v_j1]) = (((__pyx_v_v[__pyx_v_j1]) + (__pyx_v_d[__pyx_v_j1])) - __pyx_v_m);
4421             }
4422 
4423             /* "pymatgen/optimization/linear_assignment.pyx":211
4424  *                             j1 = col[k]
4425  *                             v[j1] = v[j1] + d[j1] - m
4426  *                         while True:             # <<<<<<<<<<<<<<
4427  *                             i = pred[j]
4428  *                             y[j] = i
4429  */
4430             while (1) {
4431 
4432               /* "pymatgen/optimization/linear_assignment.pyx":212
4433  *                             v[j1] = v[j1] + d[j1] - m
4434  *                         while True:
4435  *                             i = pred[j]             # <<<<<<<<<<<<<<
4436  *                             y[j] = i
4437  *                             k = j
4438  */
4439               __pyx_v_i = (__pyx_v_pred[__pyx_v_j]);
4440 
4441               /* "pymatgen/optimization/linear_assignment.pyx":213
4442  *                         while True:
4443  *                             i = pred[j]
4444  *                             y[j] = i             # <<<<<<<<<<<<<<
4445  *                             k = j
4446  *                             j = x[i]
4447  */
4448               __pyx_t_4 = __pyx_v_j;
4449               *((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_y.data + __pyx_t_4 * __pyx_v_y.strides[0]) )) = __pyx_v_i;
4450 
4451               /* "pymatgen/optimization/linear_assignment.pyx":214
4452  *                             i = pred[j]
4453  *                             y[j] = i
4454  *                             k = j             # <<<<<<<<<<<<<<
4455  *                             j = x[i]
4456  *                             x[i] = k
4457  */
4458               __pyx_v_k = __pyx_v_j;
4459 
4460               /* "pymatgen/optimization/linear_assignment.pyx":215
4461  *                             y[j] = i
4462  *                             k = j
4463  *                             j = x[i]             # <<<<<<<<<<<<<<
4464  *                             x[i] = k
4465  *                             if i == i1:
4466  */
4467               __pyx_t_4 = __pyx_v_i;
4468               __pyx_v_j = (*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_4 * __pyx_v_x.strides[0]) )));
4469 
4470               /* "pymatgen/optimization/linear_assignment.pyx":216
4471  *                             k = j
4472  *                             j = x[i]
4473  *                             x[i] = k             # <<<<<<<<<<<<<<
4474  *                             if i == i1:
4475  *                                 b = True
4476  */
4477               __pyx_t_4 = __pyx_v_i;
4478               *((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_4 * __pyx_v_x.strides[0]) )) = __pyx_v_k;
4479 
4480               /* "pymatgen/optimization/linear_assignment.pyx":217
4481  *                             j = x[i]
4482  *                             x[i] = k
4483  *                             if i == i1:             # <<<<<<<<<<<<<<
4484  *                                 b = True
4485  *                                 break
4486  */
4487               __pyx_t_6 = ((__pyx_v_i == __pyx_v_i1) != 0);
4488               if (__pyx_t_6) {
4489 
4490                 /* "pymatgen/optimization/linear_assignment.pyx":218
4491  *                             x[i] = k
4492  *                             if i == i1:
4493  *                                 b = True             # <<<<<<<<<<<<<<
4494  *                                 break
4495  *                         break
4496  */
4497                 __pyx_v_b = 1;
4498 
4499                 /* "pymatgen/optimization/linear_assignment.pyx":219
4500  *                             if i == i1:
4501  *                                 b = True
4502  *                                 break             # <<<<<<<<<<<<<<
4503  *                         break
4504  *             if b:
4505  */
4506                 goto __pyx_L53_break;
4507 
4508                 /* "pymatgen/optimization/linear_assignment.pyx":217
4509  *                             j = x[i]
4510  *                             x[i] = k
4511  *                             if i == i1:             # <<<<<<<<<<<<<<
4512  *                                 b = True
4513  *                                 break
4514  */
4515               }
4516             }
4517             __pyx_L53_break:;
4518 
4519             /* "pymatgen/optimization/linear_assignment.pyx":220
4520  *                                 b = True
4521  *                                 break
4522  *                         break             # <<<<<<<<<<<<<<
4523  *             if b:
4524  *                 break
4525  */
4526             goto __pyx_L48_break;
4527 
4528             /* "pymatgen/optimization/linear_assignment.pyx":206
4529  *                 for z in range(low, up):
4530  *                     j = col[z]
4531  *                     if y[j] == -1:             # <<<<<<<<<<<<<<
4532  *                         # augment
4533  *                         for k in range(last+1):
4534  */
4535           }
4536         }
4537         __pyx_L48_break:;
4538 
4539         /* "pymatgen/optimization/linear_assignment.pyx":189
4540  *             # really we need to get back to the for f in range(f0+1) loop
4541  *             b = False
4542  *             if up == low:             # <<<<<<<<<<<<<<
4543  *                 last = low-1
4544  *                 m = d[col[up]]
4545  */
4546       }
4547 
4548       /* "pymatgen/optimization/linear_assignment.pyx":221
4549  *                                 break
4550  *                         break
4551  *             if b:             # <<<<<<<<<<<<<<
4552  *                 break
4553  *             j1 = col[low]
4554  */
4555       __pyx_t_6 = (__pyx_v_b != 0);
4556       if (__pyx_t_6) {
4557 
4558         /* "pymatgen/optimization/linear_assignment.pyx":222
4559  *                         break
4560  *             if b:
4561  *                 break             # <<<<<<<<<<<<<<
4562  *             j1 = col[low]
4563  *             low = low + 1
4564  */
4565         goto __pyx_L41_break;
4566 
4567         /* "pymatgen/optimization/linear_assignment.pyx":221
4568  *                                 break
4569  *                         break
4570  *             if b:             # <<<<<<<<<<<<<<
4571  *                 break
4572  *             j1 = col[low]
4573  */
4574       }
4575 
4576       /* "pymatgen/optimization/linear_assignment.pyx":223
4577  *             if b:
4578  *                 break
4579  *             j1 = col[low]             # <<<<<<<<<<<<<<
4580  *             low = low + 1
4581  *             i = y[j1]
4582  */
4583       __pyx_v_j1 = (__pyx_v_col[__pyx_v_low]);
4584 
4585       /* "pymatgen/optimization/linear_assignment.pyx":224
4586  *                 break
4587  *             j1 = col[low]
4588  *             low = low + 1             # <<<<<<<<<<<<<<
4589  *             i = y[j1]
4590  *             u1 = c[i, j1] - v[j1] - m
4591  */
4592       __pyx_v_low = (__pyx_v_low + 1);
4593 
4594       /* "pymatgen/optimization/linear_assignment.pyx":225
4595  *             j1 = col[low]
4596  *             low = low + 1
4597  *             i = y[j1]             # <<<<<<<<<<<<<<
4598  *             u1 = c[i, j1] - v[j1] - m
4599  *             for k in range(up, n):
4600  */
4601       __pyx_t_4 = __pyx_v_j1;
4602       __pyx_v_i = (*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_y.data + __pyx_t_4 * __pyx_v_y.strides[0]) )));
4603 
4604       /* "pymatgen/optimization/linear_assignment.pyx":226
4605  *             low = low + 1
4606  *             i = y[j1]
4607  *             u1 = c[i, j1] - v[j1] - m             # <<<<<<<<<<<<<<
4608  *             for k in range(up, n):
4609  *                 j = col[k]
4610  */
4611       __pyx_t_4 = __pyx_v_i;
4612       __pyx_t_5 = __pyx_v_j1;
4613       __pyx_v_u1 = (((*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_c.data + __pyx_t_4 * __pyx_v_c.strides[0]) ) + __pyx_t_5 * __pyx_v_c.strides[1]) ))) - (__pyx_v_v[__pyx_v_j1])) - __pyx_v_m);
4614 
4615       /* "pymatgen/optimization/linear_assignment.pyx":227
4616  *             i = y[j1]
4617  *             u1 = c[i, j1] - v[j1] - m
4618  *             for k in range(up, n):             # <<<<<<<<<<<<<<
4619  *                 j = col[k]
4620  *                 h = c[i, j] - v[j] - u1
4621  */
4622       __pyx_t_2 = __pyx_v_n;
4623       __pyx_t_3 = __pyx_t_2;
4624       for (__pyx_t_7 = __pyx_v_up; __pyx_t_7 < __pyx_t_3; __pyx_t_7+=1) {
4625         __pyx_v_k = __pyx_t_7;
4626 
4627         /* "pymatgen/optimization/linear_assignment.pyx":228
4628  *             u1 = c[i, j1] - v[j1] - m
4629  *             for k in range(up, n):
4630  *                 j = col[k]             # <<<<<<<<<<<<<<
4631  *                 h = c[i, j] - v[j] - u1
4632  *                 if h + eps < d[j]:
4633  */
4634         __pyx_v_j = (__pyx_v_col[__pyx_v_k]);
4635 
4636         /* "pymatgen/optimization/linear_assignment.pyx":229
4637  *             for k in range(up, n):
4638  *                 j = col[k]
4639  *                 h = c[i, j] - v[j] - u1             # <<<<<<<<<<<<<<
4640  *                 if h + eps < d[j]:
4641  *                     d[j] = h
4642  */
4643         __pyx_t_5 = __pyx_v_i;
4644         __pyx_t_4 = __pyx_v_j;
4645         __pyx_v_h = (((*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_c.data + __pyx_t_5 * __pyx_v_c.strides[0]) ) + __pyx_t_4 * __pyx_v_c.strides[1]) ))) - (__pyx_v_v[__pyx_v_j])) - __pyx_v_u1);
4646 
4647         /* "pymatgen/optimization/linear_assignment.pyx":230
4648  *                 j = col[k]
4649  *                 h = c[i, j] - v[j] - u1
4650  *                 if h + eps < d[j]:             # <<<<<<<<<<<<<<
4651  *                     d[j] = h
4652  *                     pred[j] = i
4653  */
4654         __pyx_t_6 = (((__pyx_v_h + __pyx_v_eps) < (__pyx_v_d[__pyx_v_j])) != 0);
4655         if (__pyx_t_6) {
4656 
4657           /* "pymatgen/optimization/linear_assignment.pyx":231
4658  *                 h = c[i, j] - v[j] - u1
4659  *                 if h + eps < d[j]:
4660  *                     d[j] = h             # <<<<<<<<<<<<<<
4661  *                     pred[j] = i
4662  *                     if fabs(h - m) < eps:
4663  */
4664           (__pyx_v_d[__pyx_v_j]) = __pyx_v_h;
4665 
4666           /* "pymatgen/optimization/linear_assignment.pyx":232
4667  *                 if h + eps < d[j]:
4668  *                     d[j] = h
4669  *                     pred[j] = i             # <<<<<<<<<<<<<<
4670  *                     if fabs(h - m) < eps:
4671  *                         if y[j] == -1:
4672  */
4673           (__pyx_v_pred[__pyx_v_j]) = __pyx_v_i;
4674 
4675           /* "pymatgen/optimization/linear_assignment.pyx":233
4676  *                     d[j] = h
4677  *                     pred[j] = i
4678  *                     if fabs(h - m) < eps:             # <<<<<<<<<<<<<<
4679  *                         if y[j] == -1:
4680  *                             # augment
4681  */
4682           __pyx_t_6 = ((fabs((__pyx_v_h - __pyx_v_m)) < __pyx_v_eps) != 0);
4683           if (__pyx_t_6) {
4684 
4685             /* "pymatgen/optimization/linear_assignment.pyx":234
4686  *                     pred[j] = i
4687  *                     if fabs(h - m) < eps:
4688  *                         if y[j] == -1:             # <<<<<<<<<<<<<<
4689  *                             # augment
4690  *                             for k in range(last+1):
4691  */
4692             __pyx_t_4 = __pyx_v_j;
4693             __pyx_t_6 = (((*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_y.data + __pyx_t_4 * __pyx_v_y.strides[0]) ))) == -1L) != 0);
4694             if (__pyx_t_6) {
4695 
4696               /* "pymatgen/optimization/linear_assignment.pyx":236
4697  *                         if y[j] == -1:
4698  *                             # augment
4699  *                             for k in range(last+1):             # <<<<<<<<<<<<<<
4700  *                                 j1 = col[k]
4701  *                                 v[j1] = v[j1] + d[j1] - m
4702  */
4703               __pyx_t_13 = (__pyx_v_last + 1);
4704               __pyx_t_14 = __pyx_t_13;
4705               for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_14; __pyx_t_8+=1) {
4706                 __pyx_v_k = __pyx_t_8;
4707 
4708                 /* "pymatgen/optimization/linear_assignment.pyx":237
4709  *                             # augment
4710  *                             for k in range(last+1):
4711  *                                 j1 = col[k]             # <<<<<<<<<<<<<<
4712  *                                 v[j1] = v[j1] + d[j1] - m
4713  *                             while True:
4714  */
4715                 __pyx_v_j1 = (__pyx_v_col[__pyx_v_k]);
4716 
4717                 /* "pymatgen/optimization/linear_assignment.pyx":238
4718  *                             for k in range(last+1):
4719  *                                 j1 = col[k]
4720  *                                 v[j1] = v[j1] + d[j1] - m             # <<<<<<<<<<<<<<
4721  *                             while True:
4722  *                                 i = pred[j]
4723  */
4724                 (__pyx_v_v[__pyx_v_j1]) = (((__pyx_v_v[__pyx_v_j1]) + (__pyx_v_d[__pyx_v_j1])) - __pyx_v_m);
4725               }
4726 
4727               /* "pymatgen/optimization/linear_assignment.pyx":239
4728  *                                 j1 = col[k]
4729  *                                 v[j1] = v[j1] + d[j1] - m
4730  *                             while True:             # <<<<<<<<<<<<<<
4731  *                                 i = pred[j]
4732  *                                 y[j] = i
4733  */
4734               while (1) {
4735 
4736                 /* "pymatgen/optimization/linear_assignment.pyx":240
4737  *                                 v[j1] = v[j1] + d[j1] - m
4738  *                             while True:
4739  *                                 i = pred[j]             # <<<<<<<<<<<<<<
4740  *                                 y[j] = i
4741  *                                 k = j
4742  */
4743                 __pyx_v_i = (__pyx_v_pred[__pyx_v_j]);
4744 
4745                 /* "pymatgen/optimization/linear_assignment.pyx":241
4746  *                             while True:
4747  *                                 i = pred[j]
4748  *                                 y[j] = i             # <<<<<<<<<<<<<<
4749  *                                 k = j
4750  *                                 j = x[i]
4751  */
4752                 __pyx_t_4 = __pyx_v_j;
4753                 *((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_y.data + __pyx_t_4 * __pyx_v_y.strides[0]) )) = __pyx_v_i;
4754 
4755                 /* "pymatgen/optimization/linear_assignment.pyx":242
4756  *                                 i = pred[j]
4757  *                                 y[j] = i
4758  *                                 k = j             # <<<<<<<<<<<<<<
4759  *                                 j = x[i]
4760  *                                 x[i] = k
4761  */
4762                 __pyx_v_k = __pyx_v_j;
4763 
4764                 /* "pymatgen/optimization/linear_assignment.pyx":243
4765  *                                 y[j] = i
4766  *                                 k = j
4767  *                                 j = x[i]             # <<<<<<<<<<<<<<
4768  *                                 x[i] = k
4769  *                                 if i == i1:
4770  */
4771                 __pyx_t_4 = __pyx_v_i;
4772                 __pyx_v_j = (*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_4 * __pyx_v_x.strides[0]) )));
4773 
4774                 /* "pymatgen/optimization/linear_assignment.pyx":244
4775  *                                 k = j
4776  *                                 j = x[i]
4777  *                                 x[i] = k             # <<<<<<<<<<<<<<
4778  *                                 if i == i1:
4779  *                                     b = True
4780  */
4781                 __pyx_t_4 = __pyx_v_i;
4782                 *((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_4 * __pyx_v_x.strides[0]) )) = __pyx_v_k;
4783 
4784                 /* "pymatgen/optimization/linear_assignment.pyx":245
4785  *                                 j = x[i]
4786  *                                 x[i] = k
4787  *                                 if i == i1:             # <<<<<<<<<<<<<<
4788  *                                     b = True
4789  *                                     break
4790  */
4791                 __pyx_t_6 = ((__pyx_v_i == __pyx_v_i1) != 0);
4792                 if (__pyx_t_6) {
4793 
4794                   /* "pymatgen/optimization/linear_assignment.pyx":246
4795  *                                 x[i] = k
4796  *                                 if i == i1:
4797  *                                     b = True             # <<<<<<<<<<<<<<
4798  *                                     break
4799  *                             break
4800  */
4801                   __pyx_v_b = 1;
4802 
4803                   /* "pymatgen/optimization/linear_assignment.pyx":247
4804  *                                 if i == i1:
4805  *                                     b = True
4806  *                                     break             # <<<<<<<<<<<<<<
4807  *                             break
4808  *                         else:
4809  */
4810                   goto __pyx_L64_break;
4811 
4812                   /* "pymatgen/optimization/linear_assignment.pyx":245
4813  *                                 j = x[i]
4814  *                                 x[i] = k
4815  *                                 if i == i1:             # <<<<<<<<<<<<<<
4816  *                                     b = True
4817  *                                     break
4818  */
4819                 }
4820               }
4821               __pyx_L64_break:;
4822 
4823               /* "pymatgen/optimization/linear_assignment.pyx":248
4824  *                                     b = True
4825  *                                     break
4826  *                             break             # <<<<<<<<<<<<<<
4827  *                         else:
4828  *                             col[k] = col[up]
4829  */
4830               goto __pyx_L57_break;
4831 
4832               /* "pymatgen/optimization/linear_assignment.pyx":234
4833  *                     pred[j] = i
4834  *                     if fabs(h - m) < eps:
4835  *                         if y[j] == -1:             # <<<<<<<<<<<<<<
4836  *                             # augment
4837  *                             for k in range(last+1):
4838  */
4839             }
4840 
4841             /* "pymatgen/optimization/linear_assignment.pyx":250
4842  *                             break
4843  *                         else:
4844  *                             col[k] = col[up]             # <<<<<<<<<<<<<<
4845  *                             col[up] = j
4846  *                             up = up + 1
4847  */
4848             /*else*/ {
4849               (__pyx_v_col[__pyx_v_k]) = (__pyx_v_col[__pyx_v_up]);
4850 
4851               /* "pymatgen/optimization/linear_assignment.pyx":251
4852  *                         else:
4853  *                             col[k] = col[up]
4854  *                             col[up] = j             # <<<<<<<<<<<<<<
4855  *                             up = up + 1
4856  *             if b:
4857  */
4858               (__pyx_v_col[__pyx_v_up]) = __pyx_v_j;
4859 
4860               /* "pymatgen/optimization/linear_assignment.pyx":252
4861  *                             col[k] = col[up]
4862  *                             col[up] = j
4863  *                             up = up + 1             # <<<<<<<<<<<<<<
4864  *             if b:
4865  *                 break
4866  */
4867               __pyx_v_up = (__pyx_v_up + 1);
4868             }
4869 
4870             /* "pymatgen/optimization/linear_assignment.pyx":233
4871  *                     d[j] = h
4872  *                     pred[j] = i
4873  *                     if fabs(h - m) < eps:             # <<<<<<<<<<<<<<
4874  *                         if y[j] == -1:
4875  *                             # augment
4876  */
4877           }
4878 
4879           /* "pymatgen/optimization/linear_assignment.pyx":230
4880  *                 j = col[k]
4881  *                 h = c[i, j] - v[j] - u1
4882  *                 if h + eps < d[j]:             # <<<<<<<<<<<<<<
4883  *                     d[j] = h
4884  *                     pred[j] = i
4885  */
4886         }
4887       }
4888       __pyx_L57_break:;
4889 
4890       /* "pymatgen/optimization/linear_assignment.pyx":253
4891  *                             col[up] = j
4892  *                             up = up + 1
4893  *             if b:             # <<<<<<<<<<<<<<
4894  *                 break
4895  *     cost = 0
4896  */
4897       __pyx_t_6 = (__pyx_v_b != 0);
4898       if (__pyx_t_6) {
4899 
4900         /* "pymatgen/optimization/linear_assignment.pyx":254
4901  *                             up = up + 1
4902  *             if b:
4903  *                 break             # <<<<<<<<<<<<<<
4904  *     cost = 0
4905  *     for i in range(n):
4906  */
4907         goto __pyx_L41_break;
4908 
4909         /* "pymatgen/optimization/linear_assignment.pyx":253
4910  *                             col[up] = j
4911  *                             up = up + 1
4912  *             if b:             # <<<<<<<<<<<<<<
4913  *                 break
4914  *     cost = 0
4915  */
4916       }
4917     }
4918     __pyx_L41_break:;
4919   }
4920 
4921   /* "pymatgen/optimization/linear_assignment.pyx":255
4922  *             if b:
4923  *                 break
4924  *     cost = 0             # <<<<<<<<<<<<<<
4925  *     for i in range(n):
4926  *         cost += c[i, x[i]]
4927  */
4928   __pyx_v_cost = 0.0;
4929 
4930   /* "pymatgen/optimization/linear_assignment.pyx":256
4931  *                 break
4932  *     cost = 0
4933  *     for i in range(n):             # <<<<<<<<<<<<<<
4934  *         cost += c[i, x[i]]
4935  *
4936  */
4937   __pyx_t_1 = __pyx_v_n;
4938   __pyx_t_2 = __pyx_t_1;
4939   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4940     __pyx_v_i = __pyx_t_3;
4941 
4942     /* "pymatgen/optimization/linear_assignment.pyx":257
4943  *     cost = 0
4944  *     for i in range(n):
4945  *         cost += c[i, x[i]]             # <<<<<<<<<<<<<<
4946  *
4947  *     free(<void *>col)
4948  */
4949     __pyx_t_4 = __pyx_v_i;
4950     __pyx_t_5 = __pyx_v_i;
4951     __pyx_t_15 = (*((__pyx_t_5numpy_int_t *) ( /* dim=0 */ (__pyx_v_x.data + __pyx_t_4 * __pyx_v_x.strides[0]) )));
4952     __pyx_v_cost = (__pyx_v_cost + (*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_c.data + __pyx_t_5 * __pyx_v_c.strides[0]) ) + __pyx_t_15 * __pyx_v_c.strides[1]) ))));
4953   }
4954 
4955   /* "pymatgen/optimization/linear_assignment.pyx":259
4956  *         cost += c[i, x[i]]
4957  *
4958  *     free(<void *>col)             # <<<<<<<<<<<<<<
4959  *     free(<void *>fre)
4960  *     free(<void *>pred)
4961  */
4962   free(((void *)__pyx_v_col));
4963 
4964   /* "pymatgen/optimization/linear_assignment.pyx":260
4965  *
4966  *     free(<void *>col)
4967  *     free(<void *>fre)             # <<<<<<<<<<<<<<
4968  *     free(<void *>pred)
4969  *     free(<void *>v)
4970  */
4971   free(((void *)__pyx_v_fre));
4972 
4973   /* "pymatgen/optimization/linear_assignment.pyx":261
4974  *     free(<void *>col)
4975  *     free(<void *>fre)
4976  *     free(<void *>pred)             # <<<<<<<<<<<<<<
4977  *     free(<void *>v)
4978  *     free(<void *>d)
4979  */
4980   free(((void *)__pyx_v_pred));
4981 
4982   /* "pymatgen/optimization/linear_assignment.pyx":262
4983  *     free(<void *>fre)
4984  *     free(<void *>pred)
4985  *     free(<void *>v)             # <<<<<<<<<<<<<<
4986  *     free(<void *>d)
4987  *
4988  */
4989   free(((void *)__pyx_v_v));
4990 
4991   /* "pymatgen/optimization/linear_assignment.pyx":263
4992  *     free(<void *>pred)
4993  *     free(<void *>v)
4994  *     free(<void *>d)             # <<<<<<<<<<<<<<
4995  *
4996  *     return cost
4997  */
4998   free(((void *)__pyx_v_d));
4999 
5000   /* "pymatgen/optimization/linear_assignment.pyx":265
5001  *     free(<void *>d)
5002  *
5003  *     return cost             # <<<<<<<<<<<<<<
5004  */
5005   __pyx_r = __pyx_v_cost;
5006   goto __pyx_L0;
5007 
5008   /* "pymatgen/optimization/linear_assignment.pyx":81
5009  * @cython.boundscheck(False)
5010  * @cython.wraparound(False)
5011  * cdef np.float_t compute(int size, np.float_t[:, :] c, np.int_t[:] x, np.int_t[:] y, np.float_t eps) nogil:             # <<<<<<<<<<<<<<
5012  *
5013  *     # augment
5014  */
5015 
5016   /* function exit code */
5017   __pyx_L0:;
5018   return __pyx_r;
5019 }
5020 
5021 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":734
5022  * ctypedef npy_cdouble     complex_t
5023  *
5024  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
5025  *     return PyArray_MultiIterNew(1, <void*>a)
5026  *
5027  */
5028 
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)5029 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
5030   PyObject *__pyx_r = NULL;
5031   __Pyx_RefNannyDeclarations
5032   PyObject *__pyx_t_1 = NULL;
5033   int __pyx_lineno = 0;
5034   const char *__pyx_filename = NULL;
5035   int __pyx_clineno = 0;
5036   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
5037 
5038   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":735
5039  *
5040  * cdef inline object PyArray_MultiIterNew1(a):
5041  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
5042  *
5043  * cdef inline object PyArray_MultiIterNew2(a, b):
5044  */
5045   __Pyx_XDECREF(__pyx_r);
5046   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 735, __pyx_L1_error)
5047   __Pyx_GOTREF(__pyx_t_1);
5048   __pyx_r = __pyx_t_1;
5049   __pyx_t_1 = 0;
5050   goto __pyx_L0;
5051 
5052   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":734
5053  * ctypedef npy_cdouble     complex_t
5054  *
5055  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
5056  *     return PyArray_MultiIterNew(1, <void*>a)
5057  *
5058  */
5059 
5060   /* function exit code */
5061   __pyx_L1_error:;
5062   __Pyx_XDECREF(__pyx_t_1);
5063   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
5064   __pyx_r = 0;
5065   __pyx_L0:;
5066   __Pyx_XGIVEREF(__pyx_r);
5067   __Pyx_RefNannyFinishContext();
5068   return __pyx_r;
5069 }
5070 
5071 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":737
5072  *     return PyArray_MultiIterNew(1, <void*>a)
5073  *
5074  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
5075  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
5076  *
5077  */
5078 
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)5079 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
5080   PyObject *__pyx_r = NULL;
5081   __Pyx_RefNannyDeclarations
5082   PyObject *__pyx_t_1 = NULL;
5083   int __pyx_lineno = 0;
5084   const char *__pyx_filename = NULL;
5085   int __pyx_clineno = 0;
5086   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
5087 
5088   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":738
5089  *
5090  * cdef inline object PyArray_MultiIterNew2(a, b):
5091  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
5092  *
5093  * cdef inline object PyArray_MultiIterNew3(a, b, c):
5094  */
5095   __Pyx_XDECREF(__pyx_r);
5096   __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
5097   __Pyx_GOTREF(__pyx_t_1);
5098   __pyx_r = __pyx_t_1;
5099   __pyx_t_1 = 0;
5100   goto __pyx_L0;
5101 
5102   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":737
5103  *     return PyArray_MultiIterNew(1, <void*>a)
5104  *
5105  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
5106  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
5107  *
5108  */
5109 
5110   /* function exit code */
5111   __pyx_L1_error:;
5112   __Pyx_XDECREF(__pyx_t_1);
5113   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
5114   __pyx_r = 0;
5115   __pyx_L0:;
5116   __Pyx_XGIVEREF(__pyx_r);
5117   __Pyx_RefNannyFinishContext();
5118   return __pyx_r;
5119 }
5120 
5121 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":740
5122  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
5123  *
5124  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
5125  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
5126  *
5127  */
5128 
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)5129 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
5130   PyObject *__pyx_r = NULL;
5131   __Pyx_RefNannyDeclarations
5132   PyObject *__pyx_t_1 = NULL;
5133   int __pyx_lineno = 0;
5134   const char *__pyx_filename = NULL;
5135   int __pyx_clineno = 0;
5136   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
5137 
5138   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":741
5139  *
5140  * cdef inline object PyArray_MultiIterNew3(a, b, c):
5141  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
5142  *
5143  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
5144  */
5145   __Pyx_XDECREF(__pyx_r);
5146   __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 741, __pyx_L1_error)
5147   __Pyx_GOTREF(__pyx_t_1);
5148   __pyx_r = __pyx_t_1;
5149   __pyx_t_1 = 0;
5150   goto __pyx_L0;
5151 
5152   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":740
5153  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
5154  *
5155  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
5156  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
5157  *
5158  */
5159 
5160   /* function exit code */
5161   __pyx_L1_error:;
5162   __Pyx_XDECREF(__pyx_t_1);
5163   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
5164   __pyx_r = 0;
5165   __pyx_L0:;
5166   __Pyx_XGIVEREF(__pyx_r);
5167   __Pyx_RefNannyFinishContext();
5168   return __pyx_r;
5169 }
5170 
5171 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":743
5172  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
5173  *
5174  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
5175  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
5176  *
5177  */
5178 
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)5179 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) {
5180   PyObject *__pyx_r = NULL;
5181   __Pyx_RefNannyDeclarations
5182   PyObject *__pyx_t_1 = NULL;
5183   int __pyx_lineno = 0;
5184   const char *__pyx_filename = NULL;
5185   int __pyx_clineno = 0;
5186   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
5187 
5188   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":744
5189  *
5190  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
5191  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
5192  *
5193  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
5194  */
5195   __Pyx_XDECREF(__pyx_r);
5196   __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 744, __pyx_L1_error)
5197   __Pyx_GOTREF(__pyx_t_1);
5198   __pyx_r = __pyx_t_1;
5199   __pyx_t_1 = 0;
5200   goto __pyx_L0;
5201 
5202   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":743
5203  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
5204  *
5205  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
5206  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
5207  *
5208  */
5209 
5210   /* function exit code */
5211   __pyx_L1_error:;
5212   __Pyx_XDECREF(__pyx_t_1);
5213   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
5214   __pyx_r = 0;
5215   __pyx_L0:;
5216   __Pyx_XGIVEREF(__pyx_r);
5217   __Pyx_RefNannyFinishContext();
5218   return __pyx_r;
5219 }
5220 
5221 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":746
5222  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
5223  *
5224  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
5225  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
5226  *
5227  */
5228 
__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)5229 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) {
5230   PyObject *__pyx_r = NULL;
5231   __Pyx_RefNannyDeclarations
5232   PyObject *__pyx_t_1 = NULL;
5233   int __pyx_lineno = 0;
5234   const char *__pyx_filename = NULL;
5235   int __pyx_clineno = 0;
5236   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
5237 
5238   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":747
5239  *
5240  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
5241  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
5242  *
5243  * cdef inline tuple PyDataType_SHAPE(dtype d):
5244  */
5245   __Pyx_XDECREF(__pyx_r);
5246   __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 747, __pyx_L1_error)
5247   __Pyx_GOTREF(__pyx_t_1);
5248   __pyx_r = __pyx_t_1;
5249   __pyx_t_1 = 0;
5250   goto __pyx_L0;
5251 
5252   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":746
5253  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
5254  *
5255  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
5256  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
5257  *
5258  */
5259 
5260   /* function exit code */
5261   __pyx_L1_error:;
5262   __Pyx_XDECREF(__pyx_t_1);
5263   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
5264   __pyx_r = 0;
5265   __pyx_L0:;
5266   __Pyx_XGIVEREF(__pyx_r);
5267   __Pyx_RefNannyFinishContext();
5268   return __pyx_r;
5269 }
5270 
5271 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":749
5272  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
5273  *
5274  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
5275  *     if PyDataType_HASSUBARRAY(d):
5276  *         return <tuple>d.subarray.shape
5277  */
5278 
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)5279 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
5280   PyObject *__pyx_r = NULL;
5281   __Pyx_RefNannyDeclarations
5282   int __pyx_t_1;
5283   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
5284 
5285   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":750
5286  *
5287  * cdef inline tuple PyDataType_SHAPE(dtype d):
5288  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
5289  *         return <tuple>d.subarray.shape
5290  *     else:
5291  */
5292   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
5293   if (__pyx_t_1) {
5294 
5295     /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":751
5296  * cdef inline tuple PyDataType_SHAPE(dtype d):
5297  *     if PyDataType_HASSUBARRAY(d):
5298  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
5299  *     else:
5300  *         return ()
5301  */
5302     __Pyx_XDECREF(__pyx_r);
5303     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
5304     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
5305     goto __pyx_L0;
5306 
5307     /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":750
5308  *
5309  * cdef inline tuple PyDataType_SHAPE(dtype d):
5310  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
5311  *         return <tuple>d.subarray.shape
5312  *     else:
5313  */
5314   }
5315 
5316   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":753
5317  *         return <tuple>d.subarray.shape
5318  *     else:
5319  *         return ()             # <<<<<<<<<<<<<<
5320  *
5321  *
5322  */
5323   /*else*/ {
5324     __Pyx_XDECREF(__pyx_r);
5325     __Pyx_INCREF(__pyx_empty_tuple);
5326     __pyx_r = __pyx_empty_tuple;
5327     goto __pyx_L0;
5328   }
5329 
5330   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":749
5331  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
5332  *
5333  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
5334  *     if PyDataType_HASSUBARRAY(d):
5335  *         return <tuple>d.subarray.shape
5336  */
5337 
5338   /* function exit code */
5339   __pyx_L0:;
5340   __Pyx_XGIVEREF(__pyx_r);
5341   __Pyx_RefNannyFinishContext();
5342   return __pyx_r;
5343 }
5344 
5345 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":868
5346  *     int _import_umath() except -1
5347  *
5348  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
5349  *     Py_INCREF(base) # important to do this before stealing the reference below!
5350  *     PyArray_SetBaseObject(arr, base)
5351  */
5352 
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)5353 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
5354   __Pyx_RefNannyDeclarations
5355   __Pyx_RefNannySetupContext("set_array_base", 0);
5356 
5357   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":869
5358  *
5359  * cdef inline void set_array_base(ndarray arr, object base):
5360  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
5361  *     PyArray_SetBaseObject(arr, base)
5362  *
5363  */
5364   Py_INCREF(__pyx_v_base);
5365 
5366   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":870
5367  * cdef inline void set_array_base(ndarray arr, object base):
5368  *     Py_INCREF(base) # important to do this before stealing the reference below!
5369  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
5370  *
5371  * cdef inline object get_array_base(ndarray arr):
5372  */
5373   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
5374 
5375   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":868
5376  *     int _import_umath() except -1
5377  *
5378  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
5379  *     Py_INCREF(base) # important to do this before stealing the reference below!
5380  *     PyArray_SetBaseObject(arr, base)
5381  */
5382 
5383   /* function exit code */
5384   __Pyx_RefNannyFinishContext();
5385 }
5386 
5387 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":872
5388  *     PyArray_SetBaseObject(arr, base)
5389  *
5390  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
5391  *     base = PyArray_BASE(arr)
5392  *     if base is NULL:
5393  */
5394 
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)5395 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
5396   PyObject *__pyx_v_base;
5397   PyObject *__pyx_r = NULL;
5398   __Pyx_RefNannyDeclarations
5399   int __pyx_t_1;
5400   __Pyx_RefNannySetupContext("get_array_base", 0);
5401 
5402   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":873
5403  *
5404  * cdef inline object get_array_base(ndarray arr):
5405  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
5406  *     if base is NULL:
5407  *         return None
5408  */
5409   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
5410 
5411   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":874
5412  * cdef inline object get_array_base(ndarray arr):
5413  *     base = PyArray_BASE(arr)
5414  *     if base is NULL:             # <<<<<<<<<<<<<<
5415  *         return None
5416  *     return <object>base
5417  */
5418   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
5419   if (__pyx_t_1) {
5420 
5421     /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":875
5422  *     base = PyArray_BASE(arr)
5423  *     if base is NULL:
5424  *         return None             # <<<<<<<<<<<<<<
5425  *     return <object>base
5426  *
5427  */
5428     __Pyx_XDECREF(__pyx_r);
5429     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5430     goto __pyx_L0;
5431 
5432     /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":874
5433  * cdef inline object get_array_base(ndarray arr):
5434  *     base = PyArray_BASE(arr)
5435  *     if base is NULL:             # <<<<<<<<<<<<<<
5436  *         return None
5437  *     return <object>base
5438  */
5439   }
5440 
5441   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":876
5442  *     if base is NULL:
5443  *         return None
5444  *     return <object>base             # <<<<<<<<<<<<<<
5445  *
5446  * # Versions of the import_* functions which are more suitable for
5447  */
5448   __Pyx_XDECREF(__pyx_r);
5449   __Pyx_INCREF(((PyObject *)__pyx_v_base));
5450   __pyx_r = ((PyObject *)__pyx_v_base);
5451   goto __pyx_L0;
5452 
5453   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":872
5454  *     PyArray_SetBaseObject(arr, base)
5455  *
5456  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
5457  *     base = PyArray_BASE(arr)
5458  *     if base is NULL:
5459  */
5460 
5461   /* function exit code */
5462   __pyx_L0:;
5463   __Pyx_XGIVEREF(__pyx_r);
5464   __Pyx_RefNannyFinishContext();
5465   return __pyx_r;
5466 }
5467 
5468 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":880
5469  * # Versions of the import_* functions which are more suitable for
5470  * # Cython code.
5471  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
5472  *     try:
5473  *         __pyx_import_array()
5474  */
5475 
__pyx_f_5numpy_import_array(void)5476 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
5477   int __pyx_r;
5478   __Pyx_RefNannyDeclarations
5479   PyObject *__pyx_t_1 = NULL;
5480   PyObject *__pyx_t_2 = NULL;
5481   PyObject *__pyx_t_3 = NULL;
5482   int __pyx_t_4;
5483   PyObject *__pyx_t_5 = NULL;
5484   PyObject *__pyx_t_6 = NULL;
5485   PyObject *__pyx_t_7 = NULL;
5486   PyObject *__pyx_t_8 = NULL;
5487   int __pyx_lineno = 0;
5488   const char *__pyx_filename = NULL;
5489   int __pyx_clineno = 0;
5490   __Pyx_RefNannySetupContext("import_array", 0);
5491 
5492   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":881
5493  * # Cython code.
5494  * cdef inline int import_array() except -1:
5495  *     try:             # <<<<<<<<<<<<<<
5496  *         __pyx_import_array()
5497  *     except Exception:
5498  */
5499   {
5500     __Pyx_PyThreadState_declare
5501     __Pyx_PyThreadState_assign
5502     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
5503     __Pyx_XGOTREF(__pyx_t_1);
5504     __Pyx_XGOTREF(__pyx_t_2);
5505     __Pyx_XGOTREF(__pyx_t_3);
5506     /*try:*/ {
5507 
5508       /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":882
5509  * cdef inline int import_array() except -1:
5510  *     try:
5511  *         __pyx_import_array()             # <<<<<<<<<<<<<<
5512  *     except Exception:
5513  *         raise ImportError("numpy.core.multiarray failed to import")
5514  */
5515       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 882, __pyx_L3_error)
5516 
5517       /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":881
5518  * # Cython code.
5519  * cdef inline int import_array() except -1:
5520  *     try:             # <<<<<<<<<<<<<<
5521  *         __pyx_import_array()
5522  *     except Exception:
5523  */
5524     }
5525     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5526     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5527     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5528     goto __pyx_L8_try_end;
5529     __pyx_L3_error:;
5530 
5531     /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":883
5532  *     try:
5533  *         __pyx_import_array()
5534  *     except Exception:             # <<<<<<<<<<<<<<
5535  *         raise ImportError("numpy.core.multiarray failed to import")
5536  *
5537  */
5538     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
5539     if (__pyx_t_4) {
5540       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
5541       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 883, __pyx_L5_except_error)
5542       __Pyx_GOTREF(__pyx_t_5);
5543       __Pyx_GOTREF(__pyx_t_6);
5544       __Pyx_GOTREF(__pyx_t_7);
5545 
5546       /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":884
5547  *         __pyx_import_array()
5548  *     except Exception:
5549  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
5550  *
5551  * cdef inline int import_umath() except -1:
5552  */
5553       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 884, __pyx_L5_except_error)
5554       __Pyx_GOTREF(__pyx_t_8);
5555       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
5556       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5557       __PYX_ERR(1, 884, __pyx_L5_except_error)
5558     }
5559     goto __pyx_L5_except_error;
5560     __pyx_L5_except_error:;
5561 
5562     /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":881
5563  * # Cython code.
5564  * cdef inline int import_array() except -1:
5565  *     try:             # <<<<<<<<<<<<<<
5566  *         __pyx_import_array()
5567  *     except Exception:
5568  */
5569     __Pyx_XGIVEREF(__pyx_t_1);
5570     __Pyx_XGIVEREF(__pyx_t_2);
5571     __Pyx_XGIVEREF(__pyx_t_3);
5572     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5573     goto __pyx_L1_error;
5574     __pyx_L8_try_end:;
5575   }
5576 
5577   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":880
5578  * # Versions of the import_* functions which are more suitable for
5579  * # Cython code.
5580  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
5581  *     try:
5582  *         __pyx_import_array()
5583  */
5584 
5585   /* function exit code */
5586   __pyx_r = 0;
5587   goto __pyx_L0;
5588   __pyx_L1_error:;
5589   __Pyx_XDECREF(__pyx_t_5);
5590   __Pyx_XDECREF(__pyx_t_6);
5591   __Pyx_XDECREF(__pyx_t_7);
5592   __Pyx_XDECREF(__pyx_t_8);
5593   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
5594   __pyx_r = -1;
5595   __pyx_L0:;
5596   __Pyx_RefNannyFinishContext();
5597   return __pyx_r;
5598 }
5599 
5600 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":886
5601  *         raise ImportError("numpy.core.multiarray failed to import")
5602  *
5603  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
5604  *     try:
5605  *         _import_umath()
5606  */
5607 
__pyx_f_5numpy_import_umath(void)5608 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
5609   int __pyx_r;
5610   __Pyx_RefNannyDeclarations
5611   PyObject *__pyx_t_1 = NULL;
5612   PyObject *__pyx_t_2 = NULL;
5613   PyObject *__pyx_t_3 = NULL;
5614   int __pyx_t_4;
5615   PyObject *__pyx_t_5 = NULL;
5616   PyObject *__pyx_t_6 = NULL;
5617   PyObject *__pyx_t_7 = NULL;
5618   PyObject *__pyx_t_8 = NULL;
5619   int __pyx_lineno = 0;
5620   const char *__pyx_filename = NULL;
5621   int __pyx_clineno = 0;
5622   __Pyx_RefNannySetupContext("import_umath", 0);
5623 
5624   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":887
5625  *
5626  * cdef inline int import_umath() except -1:
5627  *     try:             # <<<<<<<<<<<<<<
5628  *         _import_umath()
5629  *     except Exception:
5630  */
5631   {
5632     __Pyx_PyThreadState_declare
5633     __Pyx_PyThreadState_assign
5634     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
5635     __Pyx_XGOTREF(__pyx_t_1);
5636     __Pyx_XGOTREF(__pyx_t_2);
5637     __Pyx_XGOTREF(__pyx_t_3);
5638     /*try:*/ {
5639 
5640       /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":888
5641  * cdef inline int import_umath() except -1:
5642  *     try:
5643  *         _import_umath()             # <<<<<<<<<<<<<<
5644  *     except Exception:
5645  *         raise ImportError("numpy.core.umath failed to import")
5646  */
5647       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 888, __pyx_L3_error)
5648 
5649       /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":887
5650  *
5651  * cdef inline int import_umath() except -1:
5652  *     try:             # <<<<<<<<<<<<<<
5653  *         _import_umath()
5654  *     except Exception:
5655  */
5656     }
5657     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5658     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5659     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5660     goto __pyx_L8_try_end;
5661     __pyx_L3_error:;
5662 
5663     /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":889
5664  *     try:
5665  *         _import_umath()
5666  *     except Exception:             # <<<<<<<<<<<<<<
5667  *         raise ImportError("numpy.core.umath failed to import")
5668  *
5669  */
5670     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
5671     if (__pyx_t_4) {
5672       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
5673       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 889, __pyx_L5_except_error)
5674       __Pyx_GOTREF(__pyx_t_5);
5675       __Pyx_GOTREF(__pyx_t_6);
5676       __Pyx_GOTREF(__pyx_t_7);
5677 
5678       /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":890
5679  *         _import_umath()
5680  *     except Exception:
5681  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
5682  *
5683  * cdef inline int import_ufunc() except -1:
5684  */
5685       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 890, __pyx_L5_except_error)
5686       __Pyx_GOTREF(__pyx_t_8);
5687       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
5688       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5689       __PYX_ERR(1, 890, __pyx_L5_except_error)
5690     }
5691     goto __pyx_L5_except_error;
5692     __pyx_L5_except_error:;
5693 
5694     /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":887
5695  *
5696  * cdef inline int import_umath() except -1:
5697  *     try:             # <<<<<<<<<<<<<<
5698  *         _import_umath()
5699  *     except Exception:
5700  */
5701     __Pyx_XGIVEREF(__pyx_t_1);
5702     __Pyx_XGIVEREF(__pyx_t_2);
5703     __Pyx_XGIVEREF(__pyx_t_3);
5704     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5705     goto __pyx_L1_error;
5706     __pyx_L8_try_end:;
5707   }
5708 
5709   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":886
5710  *         raise ImportError("numpy.core.multiarray failed to import")
5711  *
5712  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
5713  *     try:
5714  *         _import_umath()
5715  */
5716 
5717   /* function exit code */
5718   __pyx_r = 0;
5719   goto __pyx_L0;
5720   __pyx_L1_error:;
5721   __Pyx_XDECREF(__pyx_t_5);
5722   __Pyx_XDECREF(__pyx_t_6);
5723   __Pyx_XDECREF(__pyx_t_7);
5724   __Pyx_XDECREF(__pyx_t_8);
5725   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
5726   __pyx_r = -1;
5727   __pyx_L0:;
5728   __Pyx_RefNannyFinishContext();
5729   return __pyx_r;
5730 }
5731 
5732 /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":892
5733  *         raise ImportError("numpy.core.umath failed to import")
5734  *
5735  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
5736  *     try:
5737  *         _import_umath()
5738  */
5739 
__pyx_f_5numpy_import_ufunc(void)5740 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
5741   int __pyx_r;
5742   __Pyx_RefNannyDeclarations
5743   PyObject *__pyx_t_1 = NULL;
5744   PyObject *__pyx_t_2 = NULL;
5745   PyObject *__pyx_t_3 = NULL;
5746   int __pyx_t_4;
5747   PyObject *__pyx_t_5 = NULL;
5748   PyObject *__pyx_t_6 = NULL;
5749   PyObject *__pyx_t_7 = NULL;
5750   PyObject *__pyx_t_8 = NULL;
5751   int __pyx_lineno = 0;
5752   const char *__pyx_filename = NULL;
5753   int __pyx_clineno = 0;
5754   __Pyx_RefNannySetupContext("import_ufunc", 0);
5755 
5756   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":893
5757  *
5758  * cdef inline int import_ufunc() except -1:
5759  *     try:             # <<<<<<<<<<<<<<
5760  *         _import_umath()
5761  *     except Exception:
5762  */
5763   {
5764     __Pyx_PyThreadState_declare
5765     __Pyx_PyThreadState_assign
5766     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
5767     __Pyx_XGOTREF(__pyx_t_1);
5768     __Pyx_XGOTREF(__pyx_t_2);
5769     __Pyx_XGOTREF(__pyx_t_3);
5770     /*try:*/ {
5771 
5772       /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":894
5773  * cdef inline int import_ufunc() except -1:
5774  *     try:
5775  *         _import_umath()             # <<<<<<<<<<<<<<
5776  *     except Exception:
5777  *         raise ImportError("numpy.core.umath failed to import")
5778  */
5779       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 894, __pyx_L3_error)
5780 
5781       /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":893
5782  *
5783  * cdef inline int import_ufunc() except -1:
5784  *     try:             # <<<<<<<<<<<<<<
5785  *         _import_umath()
5786  *     except Exception:
5787  */
5788     }
5789     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5790     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5791     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5792     goto __pyx_L8_try_end;
5793     __pyx_L3_error:;
5794 
5795     /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":895
5796  *     try:
5797  *         _import_umath()
5798  *     except Exception:             # <<<<<<<<<<<<<<
5799  *         raise ImportError("numpy.core.umath failed to import")
5800  *
5801  */
5802     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
5803     if (__pyx_t_4) {
5804       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5805       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 895, __pyx_L5_except_error)
5806       __Pyx_GOTREF(__pyx_t_5);
5807       __Pyx_GOTREF(__pyx_t_6);
5808       __Pyx_GOTREF(__pyx_t_7);
5809 
5810       /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":896
5811  *         _import_umath()
5812  *     except Exception:
5813  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
5814  *
5815  * cdef extern from *:
5816  */
5817       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 896, __pyx_L5_except_error)
5818       __Pyx_GOTREF(__pyx_t_8);
5819       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
5820       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5821       __PYX_ERR(1, 896, __pyx_L5_except_error)
5822     }
5823     goto __pyx_L5_except_error;
5824     __pyx_L5_except_error:;
5825 
5826     /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":893
5827  *
5828  * cdef inline int import_ufunc() except -1:
5829  *     try:             # <<<<<<<<<<<<<<
5830  *         _import_umath()
5831  *     except Exception:
5832  */
5833     __Pyx_XGIVEREF(__pyx_t_1);
5834     __Pyx_XGIVEREF(__pyx_t_2);
5835     __Pyx_XGIVEREF(__pyx_t_3);
5836     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5837     goto __pyx_L1_error;
5838     __pyx_L8_try_end:;
5839   }
5840 
5841   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":892
5842  *         raise ImportError("numpy.core.umath failed to import")
5843  *
5844  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
5845  *     try:
5846  *         _import_umath()
5847  */
5848 
5849   /* function exit code */
5850   __pyx_r = 0;
5851   goto __pyx_L0;
5852   __pyx_L1_error:;
5853   __Pyx_XDECREF(__pyx_t_5);
5854   __Pyx_XDECREF(__pyx_t_6);
5855   __Pyx_XDECREF(__pyx_t_7);
5856   __Pyx_XDECREF(__pyx_t_8);
5857   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5858   __pyx_r = -1;
5859   __pyx_L0:;
5860   __Pyx_RefNannyFinishContext();
5861   return __pyx_r;
5862 }
5863 
5864 /* "View.MemoryView":122
5865  *         cdef bint dtype_is_object
5866  *
5867  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
5868  *                   mode="c", bint allocate_buffer=True):
5869  *
5870  */
5871 
5872 /* Python wrapper */
5873 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)5874 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5875   PyObject *__pyx_v_shape = 0;
5876   Py_ssize_t __pyx_v_itemsize;
5877   PyObject *__pyx_v_format = 0;
5878   PyObject *__pyx_v_mode = 0;
5879   int __pyx_v_allocate_buffer;
5880   int __pyx_lineno = 0;
5881   const char *__pyx_filename = NULL;
5882   int __pyx_clineno = 0;
5883   int __pyx_r;
5884   __Pyx_RefNannyDeclarations
5885   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
5886   {
5887     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};
5888     PyObject* values[5] = {0,0,0,0,0};
5889     values[3] = ((PyObject *)__pyx_n_s_c);
5890     if (unlikely(__pyx_kwds)) {
5891       Py_ssize_t kw_args;
5892       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5893       switch (pos_args) {
5894         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5895         CYTHON_FALLTHROUGH;
5896         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5897         CYTHON_FALLTHROUGH;
5898         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5899         CYTHON_FALLTHROUGH;
5900         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5901         CYTHON_FALLTHROUGH;
5902         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5903         CYTHON_FALLTHROUGH;
5904         case  0: break;
5905         default: goto __pyx_L5_argtuple_error;
5906       }
5907       kw_args = PyDict_Size(__pyx_kwds);
5908       switch (pos_args) {
5909         case  0:
5910         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
5911         else goto __pyx_L5_argtuple_error;
5912         CYTHON_FALLTHROUGH;
5913         case  1:
5914         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
5915         else {
5916           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
5917         }
5918         CYTHON_FALLTHROUGH;
5919         case  2:
5920         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
5921         else {
5922           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
5923         }
5924         CYTHON_FALLTHROUGH;
5925         case  3:
5926         if (kw_args > 0) {
5927           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
5928           if (value) { values[3] = value; kw_args--; }
5929         }
5930         CYTHON_FALLTHROUGH;
5931         case  4:
5932         if (kw_args > 0) {
5933           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
5934           if (value) { values[4] = value; kw_args--; }
5935         }
5936       }
5937       if (unlikely(kw_args > 0)) {
5938         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error)
5939       }
5940     } else {
5941       switch (PyTuple_GET_SIZE(__pyx_args)) {
5942         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5943         CYTHON_FALLTHROUGH;
5944         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5945         CYTHON_FALLTHROUGH;
5946         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5947         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5948         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5949         break;
5950         default: goto __pyx_L5_argtuple_error;
5951       }
5952     }
5953     __pyx_v_shape = ((PyObject*)values[0]);
5954     __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __pyx_L3_error)
5955     __pyx_v_format = values[2];
5956     __pyx_v_mode = values[3];
5957     if (values[4]) {
5958       __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error)
5959     } else {
5960 
5961       /* "View.MemoryView":123
5962  *
5963  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
5964  *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
5965  *
5966  *         cdef int idx
5967  */
5968       __pyx_v_allocate_buffer = ((int)1);
5969     }
5970   }
5971   goto __pyx_L4_argument_unpacking_done;
5972   __pyx_L5_argtuple_error:;
5973   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error)
5974   __pyx_L3_error:;
5975   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5976   __Pyx_RefNannyFinishContext();
5977   return -1;
5978   __pyx_L4_argument_unpacking_done:;
5979   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error)
5980   if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
5981     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error)
5982   }
5983   __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);
5984 
5985   /* "View.MemoryView":122
5986  *         cdef bint dtype_is_object
5987  *
5988  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
5989  *                   mode="c", bint allocate_buffer=True):
5990  *
5991  */
5992 
5993   /* function exit code */
5994   goto __pyx_L0;
5995   __pyx_L1_error:;
5996   __pyx_r = -1;
5997   __pyx_L0:;
5998   __Pyx_RefNannyFinishContext();
5999   return __pyx_r;
6000 }
6001 
__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)6002 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) {
6003   int __pyx_v_idx;
6004   Py_ssize_t __pyx_v_i;
6005   Py_ssize_t __pyx_v_dim;
6006   PyObject **__pyx_v_p;
6007   char __pyx_v_order;
6008   int __pyx_r;
6009   __Pyx_RefNannyDeclarations
6010   Py_ssize_t __pyx_t_1;
6011   int __pyx_t_2;
6012   PyObject *__pyx_t_3 = NULL;
6013   int __pyx_t_4;
6014   PyObject *__pyx_t_5 = NULL;
6015   PyObject *__pyx_t_6 = NULL;
6016   char *__pyx_t_7;
6017   int __pyx_t_8;
6018   Py_ssize_t __pyx_t_9;
6019   PyObject *__pyx_t_10 = NULL;
6020   Py_ssize_t __pyx_t_11;
6021   int __pyx_lineno = 0;
6022   const char *__pyx_filename = NULL;
6023   int __pyx_clineno = 0;
6024   __Pyx_RefNannySetupContext("__cinit__", 0);
6025   __Pyx_INCREF(__pyx_v_format);
6026 
6027   /* "View.MemoryView":129
6028  *         cdef PyObject **p
6029  *
6030  *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
6031  *         self.itemsize = itemsize
6032  *
6033  */
6034   if (unlikely(__pyx_v_shape == Py_None)) {
6035     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
6036     __PYX_ERR(2, 129, __pyx_L1_error)
6037   }
6038   __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 129, __pyx_L1_error)
6039   __pyx_v_self->ndim = ((int)__pyx_t_1);
6040 
6041   /* "View.MemoryView":130
6042  *
6043  *         self.ndim = <int> len(shape)
6044  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
6045  *
6046  *         if not self.ndim:
6047  */
6048   __pyx_v_self->itemsize = __pyx_v_itemsize;
6049 
6050   /* "View.MemoryView":132
6051  *         self.itemsize = itemsize
6052  *
6053  *         if not self.ndim:             # <<<<<<<<<<<<<<
6054  *             raise ValueError("Empty shape tuple for cython.array")
6055  *
6056  */
6057   __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
6058   if (unlikely(__pyx_t_2)) {
6059 
6060     /* "View.MemoryView":133
6061  *
6062  *         if not self.ndim:
6063  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
6064  *
6065  *         if itemsize <= 0:
6066  */
6067     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error)
6068     __Pyx_GOTREF(__pyx_t_3);
6069     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6070     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6071     __PYX_ERR(2, 133, __pyx_L1_error)
6072 
6073     /* "View.MemoryView":132
6074  *         self.itemsize = itemsize
6075  *
6076  *         if not self.ndim:             # <<<<<<<<<<<<<<
6077  *             raise ValueError("Empty shape tuple for cython.array")
6078  *
6079  */
6080   }
6081 
6082   /* "View.MemoryView":135
6083  *             raise ValueError("Empty shape tuple for cython.array")
6084  *
6085  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
6086  *             raise ValueError("itemsize <= 0 for cython.array")
6087  *
6088  */
6089   __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
6090   if (unlikely(__pyx_t_2)) {
6091 
6092     /* "View.MemoryView":136
6093  *
6094  *         if itemsize <= 0:
6095  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
6096  *
6097  *         if not isinstance(format, bytes):
6098  */
6099     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error)
6100     __Pyx_GOTREF(__pyx_t_3);
6101     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6102     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6103     __PYX_ERR(2, 136, __pyx_L1_error)
6104 
6105     /* "View.MemoryView":135
6106  *             raise ValueError("Empty shape tuple for cython.array")
6107  *
6108  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
6109  *             raise ValueError("itemsize <= 0 for cython.array")
6110  *
6111  */
6112   }
6113 
6114   /* "View.MemoryView":138
6115  *             raise ValueError("itemsize <= 0 for cython.array")
6116  *
6117  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
6118  *             format = format.encode('ASCII')
6119  *         self._format = format  # keep a reference to the byte string
6120  */
6121   __pyx_t_2 = PyBytes_Check(__pyx_v_format);
6122   __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
6123   if (__pyx_t_4) {
6124 
6125     /* "View.MemoryView":139
6126  *
6127  *         if not isinstance(format, bytes):
6128  *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
6129  *         self._format = format  # keep a reference to the byte string
6130  *         self.format = self._format
6131  */
6132     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 139, __pyx_L1_error)
6133     __Pyx_GOTREF(__pyx_t_5);
6134     __pyx_t_6 = NULL;
6135     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6136       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
6137       if (likely(__pyx_t_6)) {
6138         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6139         __Pyx_INCREF(__pyx_t_6);
6140         __Pyx_INCREF(function);
6141         __Pyx_DECREF_SET(__pyx_t_5, function);
6142       }
6143     }
6144     __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);
6145     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6146     if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error)
6147     __Pyx_GOTREF(__pyx_t_3);
6148     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6149     __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
6150     __pyx_t_3 = 0;
6151 
6152     /* "View.MemoryView":138
6153  *             raise ValueError("itemsize <= 0 for cython.array")
6154  *
6155  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
6156  *             format = format.encode('ASCII')
6157  *         self._format = format  # keep a reference to the byte string
6158  */
6159   }
6160 
6161   /* "View.MemoryView":140
6162  *         if not isinstance(format, bytes):
6163  *             format = format.encode('ASCII')
6164  *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
6165  *         self.format = self._format
6166  *
6167  */
6168   if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 140, __pyx_L1_error)
6169   __pyx_t_3 = __pyx_v_format;
6170   __Pyx_INCREF(__pyx_t_3);
6171   __Pyx_GIVEREF(__pyx_t_3);
6172   __Pyx_GOTREF(__pyx_v_self->_format);
6173   __Pyx_DECREF(__pyx_v_self->_format);
6174   __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
6175   __pyx_t_3 = 0;
6176 
6177   /* "View.MemoryView":141
6178  *             format = format.encode('ASCII')
6179  *         self._format = format  # keep a reference to the byte string
6180  *         self.format = self._format             # <<<<<<<<<<<<<<
6181  *
6182  *
6183  */
6184   if (unlikely(__pyx_v_self->_format == Py_None)) {
6185     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
6186     __PYX_ERR(2, 141, __pyx_L1_error)
6187   }
6188   __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error)
6189   __pyx_v_self->format = __pyx_t_7;
6190 
6191   /* "View.MemoryView":144
6192  *
6193  *
6194  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
6195  *         self._strides = self._shape + self.ndim
6196  *
6197  */
6198   __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
6199 
6200   /* "View.MemoryView":145
6201  *
6202  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
6203  *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
6204  *
6205  *         if not self._shape:
6206  */
6207   __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
6208 
6209   /* "View.MemoryView":147
6210  *         self._strides = self._shape + self.ndim
6211  *
6212  *         if not self._shape:             # <<<<<<<<<<<<<<
6213  *             raise MemoryError("unable to allocate shape and strides.")
6214  *
6215  */
6216   __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
6217   if (unlikely(__pyx_t_4)) {
6218 
6219     /* "View.MemoryView":148
6220  *
6221  *         if not self._shape:
6222  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
6223  *
6224  *
6225  */
6226     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
6227     __Pyx_GOTREF(__pyx_t_3);
6228     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6229     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6230     __PYX_ERR(2, 148, __pyx_L1_error)
6231 
6232     /* "View.MemoryView":147
6233  *         self._strides = self._shape + self.ndim
6234  *
6235  *         if not self._shape:             # <<<<<<<<<<<<<<
6236  *             raise MemoryError("unable to allocate shape and strides.")
6237  *
6238  */
6239   }
6240 
6241   /* "View.MemoryView":151
6242  *
6243  *
6244  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
6245  *             if dim <= 0:
6246  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
6247  */
6248   __pyx_t_8 = 0;
6249   __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
6250   for (;;) {
6251     if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
6252     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6253     __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 151, __pyx_L1_error)
6254     #else
6255     __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 151, __pyx_L1_error)
6256     __Pyx_GOTREF(__pyx_t_5);
6257     #endif
6258     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 151, __pyx_L1_error)
6259     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6260     __pyx_v_dim = __pyx_t_9;
6261     __pyx_v_idx = __pyx_t_8;
6262     __pyx_t_8 = (__pyx_t_8 + 1);
6263 
6264     /* "View.MemoryView":152
6265  *
6266  *         for idx, dim in enumerate(shape):
6267  *             if dim <= 0:             # <<<<<<<<<<<<<<
6268  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
6269  *             self._shape[idx] = dim
6270  */
6271     __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
6272     if (unlikely(__pyx_t_4)) {
6273 
6274       /* "View.MemoryView":153
6275  *         for idx, dim in enumerate(shape):
6276  *             if dim <= 0:
6277  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
6278  *             self._shape[idx] = dim
6279  *
6280  */
6281       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error)
6282       __Pyx_GOTREF(__pyx_t_5);
6283       __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
6284       __Pyx_GOTREF(__pyx_t_6);
6285       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
6286       __Pyx_GOTREF(__pyx_t_10);
6287       __Pyx_GIVEREF(__pyx_t_5);
6288       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
6289       __Pyx_GIVEREF(__pyx_t_6);
6290       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
6291       __pyx_t_5 = 0;
6292       __pyx_t_6 = 0;
6293       __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
6294       __Pyx_GOTREF(__pyx_t_6);
6295       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6296       __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
6297       __Pyx_GOTREF(__pyx_t_10);
6298       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6299       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
6300       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6301       __PYX_ERR(2, 153, __pyx_L1_error)
6302 
6303       /* "View.MemoryView":152
6304  *
6305  *         for idx, dim in enumerate(shape):
6306  *             if dim <= 0:             # <<<<<<<<<<<<<<
6307  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
6308  *             self._shape[idx] = dim
6309  */
6310     }
6311 
6312     /* "View.MemoryView":154
6313  *             if dim <= 0:
6314  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
6315  *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
6316  *
6317  *         cdef char order
6318  */
6319     (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
6320 
6321     /* "View.MemoryView":151
6322  *
6323  *
6324  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
6325  *             if dim <= 0:
6326  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
6327  */
6328   }
6329   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6330 
6331   /* "View.MemoryView":157
6332  *
6333  *         cdef char order
6334  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
6335  *             order = b'F'
6336  *             self.mode = u'fortran'
6337  */
6338   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 157, __pyx_L1_error)
6339   if (__pyx_t_4) {
6340 
6341     /* "View.MemoryView":158
6342  *         cdef char order
6343  *         if mode == 'fortran':
6344  *             order = b'F'             # <<<<<<<<<<<<<<
6345  *             self.mode = u'fortran'
6346  *         elif mode == 'c':
6347  */
6348     __pyx_v_order = 'F';
6349 
6350     /* "View.MemoryView":159
6351  *         if mode == 'fortran':
6352  *             order = b'F'
6353  *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
6354  *         elif mode == 'c':
6355  *             order = b'C'
6356  */
6357     __Pyx_INCREF(__pyx_n_u_fortran);
6358     __Pyx_GIVEREF(__pyx_n_u_fortran);
6359     __Pyx_GOTREF(__pyx_v_self->mode);
6360     __Pyx_DECREF(__pyx_v_self->mode);
6361     __pyx_v_self->mode = __pyx_n_u_fortran;
6362 
6363     /* "View.MemoryView":157
6364  *
6365  *         cdef char order
6366  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
6367  *             order = b'F'
6368  *             self.mode = u'fortran'
6369  */
6370     goto __pyx_L10;
6371   }
6372 
6373   /* "View.MemoryView":160
6374  *             order = b'F'
6375  *             self.mode = u'fortran'
6376  *         elif mode == 'c':             # <<<<<<<<<<<<<<
6377  *             order = b'C'
6378  *             self.mode = u'c'
6379  */
6380   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 160, __pyx_L1_error)
6381   if (likely(__pyx_t_4)) {
6382 
6383     /* "View.MemoryView":161
6384  *             self.mode = u'fortran'
6385  *         elif mode == 'c':
6386  *             order = b'C'             # <<<<<<<<<<<<<<
6387  *             self.mode = u'c'
6388  *         else:
6389  */
6390     __pyx_v_order = 'C';
6391 
6392     /* "View.MemoryView":162
6393  *         elif mode == 'c':
6394  *             order = b'C'
6395  *             self.mode = u'c'             # <<<<<<<<<<<<<<
6396  *         else:
6397  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
6398  */
6399     __Pyx_INCREF(__pyx_n_u_c);
6400     __Pyx_GIVEREF(__pyx_n_u_c);
6401     __Pyx_GOTREF(__pyx_v_self->mode);
6402     __Pyx_DECREF(__pyx_v_self->mode);
6403     __pyx_v_self->mode = __pyx_n_u_c;
6404 
6405     /* "View.MemoryView":160
6406  *             order = b'F'
6407  *             self.mode = u'fortran'
6408  *         elif mode == 'c':             # <<<<<<<<<<<<<<
6409  *             order = b'C'
6410  *             self.mode = u'c'
6411  */
6412     goto __pyx_L10;
6413   }
6414 
6415   /* "View.MemoryView":164
6416  *             self.mode = u'c'
6417  *         else:
6418  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
6419  *
6420  *         self.len = fill_contig_strides_array(self._shape, self._strides,
6421  */
6422   /*else*/ {
6423     __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 164, __pyx_L1_error)
6424     __Pyx_GOTREF(__pyx_t_3);
6425     __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error)
6426     __Pyx_GOTREF(__pyx_t_10);
6427     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6428     __Pyx_Raise(__pyx_t_10, 0, 0, 0);
6429     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6430     __PYX_ERR(2, 164, __pyx_L1_error)
6431   }
6432   __pyx_L10:;
6433 
6434   /* "View.MemoryView":166
6435  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
6436  *
6437  *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
6438  *                                              itemsize, self.ndim, order)
6439  *
6440  */
6441   __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);
6442 
6443   /* "View.MemoryView":169
6444  *                                              itemsize, self.ndim, order)
6445  *
6446  *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
6447  *         self.dtype_is_object = format == b'O'
6448  *         if allocate_buffer:
6449  */
6450   __pyx_v_self->free_data = __pyx_v_allocate_buffer;
6451 
6452   /* "View.MemoryView":170
6453  *
6454  *         self.free_data = allocate_buffer
6455  *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
6456  *         if allocate_buffer:
6457  *
6458  */
6459   __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 170, __pyx_L1_error)
6460   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 170, __pyx_L1_error)
6461   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6462   __pyx_v_self->dtype_is_object = __pyx_t_4;
6463 
6464   /* "View.MemoryView":171
6465  *         self.free_data = allocate_buffer
6466  *         self.dtype_is_object = format == b'O'
6467  *         if allocate_buffer:             # <<<<<<<<<<<<<<
6468  *
6469  *
6470  */
6471   __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
6472   if (__pyx_t_4) {
6473 
6474     /* "View.MemoryView":174
6475  *
6476  *
6477  *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
6478  *             if not self.data:
6479  *                 raise MemoryError("unable to allocate array data.")
6480  */
6481     __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
6482 
6483     /* "View.MemoryView":175
6484  *
6485  *             self.data = <char *>malloc(self.len)
6486  *             if not self.data:             # <<<<<<<<<<<<<<
6487  *                 raise MemoryError("unable to allocate array data.")
6488  *
6489  */
6490     __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
6491     if (unlikely(__pyx_t_4)) {
6492 
6493       /* "View.MemoryView":176
6494  *             self.data = <char *>malloc(self.len)
6495  *             if not self.data:
6496  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
6497  *
6498  *             if self.dtype_is_object:
6499  */
6500       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error)
6501       __Pyx_GOTREF(__pyx_t_10);
6502       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
6503       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6504       __PYX_ERR(2, 176, __pyx_L1_error)
6505 
6506       /* "View.MemoryView":175
6507  *
6508  *             self.data = <char *>malloc(self.len)
6509  *             if not self.data:             # <<<<<<<<<<<<<<
6510  *                 raise MemoryError("unable to allocate array data.")
6511  *
6512  */
6513     }
6514 
6515     /* "View.MemoryView":178
6516  *                 raise MemoryError("unable to allocate array data.")
6517  *
6518  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
6519  *                 p = <PyObject **> self.data
6520  *                 for i in range(self.len / itemsize):
6521  */
6522     __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
6523     if (__pyx_t_4) {
6524 
6525       /* "View.MemoryView":179
6526  *
6527  *             if self.dtype_is_object:
6528  *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
6529  *                 for i in range(self.len / itemsize):
6530  *                     p[i] = Py_None
6531  */
6532       __pyx_v_p = ((PyObject **)__pyx_v_self->data);
6533 
6534       /* "View.MemoryView":180
6535  *             if self.dtype_is_object:
6536  *                 p = <PyObject **> self.data
6537  *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
6538  *                     p[i] = Py_None
6539  *                     Py_INCREF(Py_None)
6540  */
6541       if (unlikely(__pyx_v_itemsize == 0)) {
6542         PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
6543         __PYX_ERR(2, 180, __pyx_L1_error)
6544       }
6545       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))) {
6546         PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
6547         __PYX_ERR(2, 180, __pyx_L1_error)
6548       }
6549       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
6550       __pyx_t_9 = __pyx_t_1;
6551       for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
6552         __pyx_v_i = __pyx_t_11;
6553 
6554         /* "View.MemoryView":181
6555  *                 p = <PyObject **> self.data
6556  *                 for i in range(self.len / itemsize):
6557  *                     p[i] = Py_None             # <<<<<<<<<<<<<<
6558  *                     Py_INCREF(Py_None)
6559  *
6560  */
6561         (__pyx_v_p[__pyx_v_i]) = Py_None;
6562 
6563         /* "View.MemoryView":182
6564  *                 for i in range(self.len / itemsize):
6565  *                     p[i] = Py_None
6566  *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
6567  *
6568  *     @cname('getbuffer')
6569  */
6570         Py_INCREF(Py_None);
6571       }
6572 
6573       /* "View.MemoryView":178
6574  *                 raise MemoryError("unable to allocate array data.")
6575  *
6576  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
6577  *                 p = <PyObject **> self.data
6578  *                 for i in range(self.len / itemsize):
6579  */
6580     }
6581 
6582     /* "View.MemoryView":171
6583  *         self.free_data = allocate_buffer
6584  *         self.dtype_is_object = format == b'O'
6585  *         if allocate_buffer:             # <<<<<<<<<<<<<<
6586  *
6587  *
6588  */
6589   }
6590 
6591   /* "View.MemoryView":122
6592  *         cdef bint dtype_is_object
6593  *
6594  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
6595  *                   mode="c", bint allocate_buffer=True):
6596  *
6597  */
6598 
6599   /* function exit code */
6600   __pyx_r = 0;
6601   goto __pyx_L0;
6602   __pyx_L1_error:;
6603   __Pyx_XDECREF(__pyx_t_3);
6604   __Pyx_XDECREF(__pyx_t_5);
6605   __Pyx_XDECREF(__pyx_t_6);
6606   __Pyx_XDECREF(__pyx_t_10);
6607   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6608   __pyx_r = -1;
6609   __pyx_L0:;
6610   __Pyx_XDECREF(__pyx_v_format);
6611   __Pyx_RefNannyFinishContext();
6612   return __pyx_r;
6613 }
6614 
6615 /* "View.MemoryView":185
6616  *
6617  *     @cname('getbuffer')
6618  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
6619  *         cdef int bufmode = -1
6620  *         if self.mode == u"c":
6621  */
6622 
6623 /* Python wrapper */
6624 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)6625 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
6626   int __pyx_r;
6627   __Pyx_RefNannyDeclarations
6628   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
6629   __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));
6630 
6631   /* function exit code */
6632   __Pyx_RefNannyFinishContext();
6633   return __pyx_r;
6634 }
6635 
__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)6636 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) {
6637   int __pyx_v_bufmode;
6638   int __pyx_r;
6639   __Pyx_RefNannyDeclarations
6640   int __pyx_t_1;
6641   int __pyx_t_2;
6642   PyObject *__pyx_t_3 = NULL;
6643   char *__pyx_t_4;
6644   Py_ssize_t __pyx_t_5;
6645   int __pyx_t_6;
6646   Py_ssize_t *__pyx_t_7;
6647   int __pyx_lineno = 0;
6648   const char *__pyx_filename = NULL;
6649   int __pyx_clineno = 0;
6650   if (__pyx_v_info == NULL) {
6651     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
6652     return -1;
6653   }
6654   __Pyx_RefNannySetupContext("__getbuffer__", 0);
6655   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
6656   __Pyx_GIVEREF(__pyx_v_info->obj);
6657 
6658   /* "View.MemoryView":186
6659  *     @cname('getbuffer')
6660  *     def __getbuffer__(self, Py_buffer *info, int flags):
6661  *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
6662  *         if self.mode == u"c":
6663  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6664  */
6665   __pyx_v_bufmode = -1;
6666 
6667   /* "View.MemoryView":187
6668  *     def __getbuffer__(self, Py_buffer *info, int flags):
6669  *         cdef int bufmode = -1
6670  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
6671  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6672  *         elif self.mode == u"fortran":
6673  */
6674   __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 187, __pyx_L1_error)
6675   __pyx_t_2 = (__pyx_t_1 != 0);
6676   if (__pyx_t_2) {
6677 
6678     /* "View.MemoryView":188
6679  *         cdef int bufmode = -1
6680  *         if self.mode == u"c":
6681  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
6682  *         elif self.mode == u"fortran":
6683  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6684  */
6685     __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
6686 
6687     /* "View.MemoryView":187
6688  *     def __getbuffer__(self, Py_buffer *info, int flags):
6689  *         cdef int bufmode = -1
6690  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
6691  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6692  *         elif self.mode == u"fortran":
6693  */
6694     goto __pyx_L3;
6695   }
6696 
6697   /* "View.MemoryView":189
6698  *         if self.mode == u"c":
6699  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6700  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
6701  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6702  *         if not (flags & bufmode):
6703  */
6704   __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 189, __pyx_L1_error)
6705   __pyx_t_1 = (__pyx_t_2 != 0);
6706   if (__pyx_t_1) {
6707 
6708     /* "View.MemoryView":190
6709  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6710  *         elif self.mode == u"fortran":
6711  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
6712  *         if not (flags & bufmode):
6713  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
6714  */
6715     __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
6716 
6717     /* "View.MemoryView":189
6718  *         if self.mode == u"c":
6719  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6720  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
6721  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6722  *         if not (flags & bufmode):
6723  */
6724   }
6725   __pyx_L3:;
6726 
6727   /* "View.MemoryView":191
6728  *         elif self.mode == u"fortran":
6729  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6730  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
6731  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
6732  *         info.buf = self.data
6733  */
6734   __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
6735   if (unlikely(__pyx_t_1)) {
6736 
6737     /* "View.MemoryView":192
6738  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6739  *         if not (flags & bufmode):
6740  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
6741  *         info.buf = self.data
6742  *         info.len = self.len
6743  */
6744     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error)
6745     __Pyx_GOTREF(__pyx_t_3);
6746     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6747     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6748     __PYX_ERR(2, 192, __pyx_L1_error)
6749 
6750     /* "View.MemoryView":191
6751  *         elif self.mode == u"fortran":
6752  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6753  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
6754  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
6755  *         info.buf = self.data
6756  */
6757   }
6758 
6759   /* "View.MemoryView":193
6760  *         if not (flags & bufmode):
6761  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
6762  *         info.buf = self.data             # <<<<<<<<<<<<<<
6763  *         info.len = self.len
6764  *         info.ndim = self.ndim
6765  */
6766   __pyx_t_4 = __pyx_v_self->data;
6767   __pyx_v_info->buf = __pyx_t_4;
6768 
6769   /* "View.MemoryView":194
6770  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
6771  *         info.buf = self.data
6772  *         info.len = self.len             # <<<<<<<<<<<<<<
6773  *         info.ndim = self.ndim
6774  *         info.shape = self._shape
6775  */
6776   __pyx_t_5 = __pyx_v_self->len;
6777   __pyx_v_info->len = __pyx_t_5;
6778 
6779   /* "View.MemoryView":195
6780  *         info.buf = self.data
6781  *         info.len = self.len
6782  *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
6783  *         info.shape = self._shape
6784  *         info.strides = self._strides
6785  */
6786   __pyx_t_6 = __pyx_v_self->ndim;
6787   __pyx_v_info->ndim = __pyx_t_6;
6788 
6789   /* "View.MemoryView":196
6790  *         info.len = self.len
6791  *         info.ndim = self.ndim
6792  *         info.shape = self._shape             # <<<<<<<<<<<<<<
6793  *         info.strides = self._strides
6794  *         info.suboffsets = NULL
6795  */
6796   __pyx_t_7 = __pyx_v_self->_shape;
6797   __pyx_v_info->shape = __pyx_t_7;
6798 
6799   /* "View.MemoryView":197
6800  *         info.ndim = self.ndim
6801  *         info.shape = self._shape
6802  *         info.strides = self._strides             # <<<<<<<<<<<<<<
6803  *         info.suboffsets = NULL
6804  *         info.itemsize = self.itemsize
6805  */
6806   __pyx_t_7 = __pyx_v_self->_strides;
6807   __pyx_v_info->strides = __pyx_t_7;
6808 
6809   /* "View.MemoryView":198
6810  *         info.shape = self._shape
6811  *         info.strides = self._strides
6812  *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
6813  *         info.itemsize = self.itemsize
6814  *         info.readonly = 0
6815  */
6816   __pyx_v_info->suboffsets = NULL;
6817 
6818   /* "View.MemoryView":199
6819  *         info.strides = self._strides
6820  *         info.suboffsets = NULL
6821  *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
6822  *         info.readonly = 0
6823  *
6824  */
6825   __pyx_t_5 = __pyx_v_self->itemsize;
6826   __pyx_v_info->itemsize = __pyx_t_5;
6827 
6828   /* "View.MemoryView":200
6829  *         info.suboffsets = NULL
6830  *         info.itemsize = self.itemsize
6831  *         info.readonly = 0             # <<<<<<<<<<<<<<
6832  *
6833  *         if flags & PyBUF_FORMAT:
6834  */
6835   __pyx_v_info->readonly = 0;
6836 
6837   /* "View.MemoryView":202
6838  *         info.readonly = 0
6839  *
6840  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
6841  *             info.format = self.format
6842  *         else:
6843  */
6844   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
6845   if (__pyx_t_1) {
6846 
6847     /* "View.MemoryView":203
6848  *
6849  *         if flags & PyBUF_FORMAT:
6850  *             info.format = self.format             # <<<<<<<<<<<<<<
6851  *         else:
6852  *             info.format = NULL
6853  */
6854     __pyx_t_4 = __pyx_v_self->format;
6855     __pyx_v_info->format = __pyx_t_4;
6856 
6857     /* "View.MemoryView":202
6858  *         info.readonly = 0
6859  *
6860  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
6861  *             info.format = self.format
6862  *         else:
6863  */
6864     goto __pyx_L5;
6865   }
6866 
6867   /* "View.MemoryView":205
6868  *             info.format = self.format
6869  *         else:
6870  *             info.format = NULL             # <<<<<<<<<<<<<<
6871  *
6872  *         info.obj = self
6873  */
6874   /*else*/ {
6875     __pyx_v_info->format = NULL;
6876   }
6877   __pyx_L5:;
6878 
6879   /* "View.MemoryView":207
6880  *             info.format = NULL
6881  *
6882  *         info.obj = self             # <<<<<<<<<<<<<<
6883  *
6884  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
6885  */
6886   __Pyx_INCREF(((PyObject *)__pyx_v_self));
6887   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
6888   __Pyx_GOTREF(__pyx_v_info->obj);
6889   __Pyx_DECREF(__pyx_v_info->obj);
6890   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
6891 
6892   /* "View.MemoryView":185
6893  *
6894  *     @cname('getbuffer')
6895  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
6896  *         cdef int bufmode = -1
6897  *         if self.mode == u"c":
6898  */
6899 
6900   /* function exit code */
6901   __pyx_r = 0;
6902   goto __pyx_L0;
6903   __pyx_L1_error:;
6904   __Pyx_XDECREF(__pyx_t_3);
6905   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6906   __pyx_r = -1;
6907   if (__pyx_v_info->obj != NULL) {
6908     __Pyx_GOTREF(__pyx_v_info->obj);
6909     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
6910   }
6911   goto __pyx_L2;
6912   __pyx_L0:;
6913   if (__pyx_v_info->obj == Py_None) {
6914     __Pyx_GOTREF(__pyx_v_info->obj);
6915     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
6916   }
6917   __pyx_L2:;
6918   __Pyx_RefNannyFinishContext();
6919   return __pyx_r;
6920 }
6921 
6922 /* "View.MemoryView":211
6923  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
6924  *
6925  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
6926  *         if self.callback_free_data != NULL:
6927  *             self.callback_free_data(self.data)
6928  */
6929 
6930 /* Python wrapper */
6931 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___dealloc__(PyObject * __pyx_v_self)6932 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
6933   __Pyx_RefNannyDeclarations
6934   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
6935   __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
6936 
6937   /* function exit code */
6938   __Pyx_RefNannyFinishContext();
6939 }
6940 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj * __pyx_v_self)6941 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
6942   __Pyx_RefNannyDeclarations
6943   int __pyx_t_1;
6944   __Pyx_RefNannySetupContext("__dealloc__", 0);
6945 
6946   /* "View.MemoryView":212
6947  *
6948  *     def __dealloc__(array self):
6949  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
6950  *             self.callback_free_data(self.data)
6951  *         elif self.free_data:
6952  */
6953   __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
6954   if (__pyx_t_1) {
6955 
6956     /* "View.MemoryView":213
6957  *     def __dealloc__(array self):
6958  *         if self.callback_free_data != NULL:
6959  *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
6960  *         elif self.free_data:
6961  *             if self.dtype_is_object:
6962  */
6963     __pyx_v_self->callback_free_data(__pyx_v_self->data);
6964 
6965     /* "View.MemoryView":212
6966  *
6967  *     def __dealloc__(array self):
6968  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
6969  *             self.callback_free_data(self.data)
6970  *         elif self.free_data:
6971  */
6972     goto __pyx_L3;
6973   }
6974 
6975   /* "View.MemoryView":214
6976  *         if self.callback_free_data != NULL:
6977  *             self.callback_free_data(self.data)
6978  *         elif self.free_data:             # <<<<<<<<<<<<<<
6979  *             if self.dtype_is_object:
6980  *                 refcount_objects_in_slice(self.data, self._shape,
6981  */
6982   __pyx_t_1 = (__pyx_v_self->free_data != 0);
6983   if (__pyx_t_1) {
6984 
6985     /* "View.MemoryView":215
6986  *             self.callback_free_data(self.data)
6987  *         elif self.free_data:
6988  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
6989  *                 refcount_objects_in_slice(self.data, self._shape,
6990  *                                           self._strides, self.ndim, False)
6991  */
6992     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
6993     if (__pyx_t_1) {
6994 
6995       /* "View.MemoryView":216
6996  *         elif self.free_data:
6997  *             if self.dtype_is_object:
6998  *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
6999  *                                           self._strides, self.ndim, False)
7000  *             free(self.data)
7001  */
7002       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
7003 
7004       /* "View.MemoryView":215
7005  *             self.callback_free_data(self.data)
7006  *         elif self.free_data:
7007  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
7008  *                 refcount_objects_in_slice(self.data, self._shape,
7009  *                                           self._strides, self.ndim, False)
7010  */
7011     }
7012 
7013     /* "View.MemoryView":218
7014  *                 refcount_objects_in_slice(self.data, self._shape,
7015  *                                           self._strides, self.ndim, False)
7016  *             free(self.data)             # <<<<<<<<<<<<<<
7017  *         PyObject_Free(self._shape)
7018  *
7019  */
7020     free(__pyx_v_self->data);
7021 
7022     /* "View.MemoryView":214
7023  *         if self.callback_free_data != NULL:
7024  *             self.callback_free_data(self.data)
7025  *         elif self.free_data:             # <<<<<<<<<<<<<<
7026  *             if self.dtype_is_object:
7027  *                 refcount_objects_in_slice(self.data, self._shape,
7028  */
7029   }
7030   __pyx_L3:;
7031 
7032   /* "View.MemoryView":219
7033  *                                           self._strides, self.ndim, False)
7034  *             free(self.data)
7035  *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
7036  *
7037  *     @property
7038  */
7039   PyObject_Free(__pyx_v_self->_shape);
7040 
7041   /* "View.MemoryView":211
7042  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
7043  *
7044  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
7045  *         if self.callback_free_data != NULL:
7046  *             self.callback_free_data(self.data)
7047  */
7048 
7049   /* function exit code */
7050   __Pyx_RefNannyFinishContext();
7051 }
7052 
7053 /* "View.MemoryView":222
7054  *
7055  *     @property
7056  *     def memview(self):             # <<<<<<<<<<<<<<
7057  *         return self.get_memview()
7058  *
7059  */
7060 
7061 /* Python wrapper */
7062 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)7063 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
7064   PyObject *__pyx_r = 0;
7065   __Pyx_RefNannyDeclarations
7066   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
7067   __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
7068 
7069   /* function exit code */
7070   __Pyx_RefNannyFinishContext();
7071   return __pyx_r;
7072 }
7073 
__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj * __pyx_v_self)7074 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
7075   PyObject *__pyx_r = NULL;
7076   __Pyx_RefNannyDeclarations
7077   PyObject *__pyx_t_1 = NULL;
7078   int __pyx_lineno = 0;
7079   const char *__pyx_filename = NULL;
7080   int __pyx_clineno = 0;
7081   __Pyx_RefNannySetupContext("__get__", 0);
7082 
7083   /* "View.MemoryView":223
7084  *     @property
7085  *     def memview(self):
7086  *         return self.get_memview()             # <<<<<<<<<<<<<<
7087  *
7088  *     @cname('get_memview')
7089  */
7090   __Pyx_XDECREF(__pyx_r);
7091   __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 223, __pyx_L1_error)
7092   __Pyx_GOTREF(__pyx_t_1);
7093   __pyx_r = __pyx_t_1;
7094   __pyx_t_1 = 0;
7095   goto __pyx_L0;
7096 
7097   /* "View.MemoryView":222
7098  *
7099  *     @property
7100  *     def memview(self):             # <<<<<<<<<<<<<<
7101  *         return self.get_memview()
7102  *
7103  */
7104 
7105   /* function exit code */
7106   __pyx_L1_error:;
7107   __Pyx_XDECREF(__pyx_t_1);
7108   __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7109   __pyx_r = NULL;
7110   __pyx_L0:;
7111   __Pyx_XGIVEREF(__pyx_r);
7112   __Pyx_RefNannyFinishContext();
7113   return __pyx_r;
7114 }
7115 
7116 /* "View.MemoryView":226
7117  *
7118  *     @cname('get_memview')
7119  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
7120  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
7121  *         return  memoryview(self, flags, self.dtype_is_object)
7122  */
7123 
__pyx_array_get_memview(struct __pyx_array_obj * __pyx_v_self)7124 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
7125   int __pyx_v_flags;
7126   PyObject *__pyx_r = NULL;
7127   __Pyx_RefNannyDeclarations
7128   PyObject *__pyx_t_1 = NULL;
7129   PyObject *__pyx_t_2 = NULL;
7130   PyObject *__pyx_t_3 = NULL;
7131   int __pyx_lineno = 0;
7132   const char *__pyx_filename = NULL;
7133   int __pyx_clineno = 0;
7134   __Pyx_RefNannySetupContext("get_memview", 0);
7135 
7136   /* "View.MemoryView":227
7137  *     @cname('get_memview')
7138  *     cdef get_memview(self):
7139  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
7140  *         return  memoryview(self, flags, self.dtype_is_object)
7141  *
7142  */
7143   __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
7144 
7145   /* "View.MemoryView":228
7146  *     cdef get_memview(self):
7147  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
7148  *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
7149  *
7150  *     def __len__(self):
7151  */
7152   __Pyx_XDECREF(__pyx_r);
7153   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error)
7154   __Pyx_GOTREF(__pyx_t_1);
7155   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
7156   __Pyx_GOTREF(__pyx_t_2);
7157   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error)
7158   __Pyx_GOTREF(__pyx_t_3);
7159   __Pyx_INCREF(((PyObject *)__pyx_v_self));
7160   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
7161   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
7162   __Pyx_GIVEREF(__pyx_t_1);
7163   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
7164   __Pyx_GIVEREF(__pyx_t_2);
7165   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
7166   __pyx_t_1 = 0;
7167   __pyx_t_2 = 0;
7168   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
7169   __Pyx_GOTREF(__pyx_t_2);
7170   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7171   __pyx_r = __pyx_t_2;
7172   __pyx_t_2 = 0;
7173   goto __pyx_L0;
7174 
7175   /* "View.MemoryView":226
7176  *
7177  *     @cname('get_memview')
7178  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
7179  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
7180  *         return  memoryview(self, flags, self.dtype_is_object)
7181  */
7182 
7183   /* function exit code */
7184   __pyx_L1_error:;
7185   __Pyx_XDECREF(__pyx_t_1);
7186   __Pyx_XDECREF(__pyx_t_2);
7187   __Pyx_XDECREF(__pyx_t_3);
7188   __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
7189   __pyx_r = 0;
7190   __pyx_L0:;
7191   __Pyx_XGIVEREF(__pyx_r);
7192   __Pyx_RefNannyFinishContext();
7193   return __pyx_r;
7194 }
7195 
7196 /* "View.MemoryView":230
7197  *         return  memoryview(self, flags, self.dtype_is_object)
7198  *
7199  *     def __len__(self):             # <<<<<<<<<<<<<<
7200  *         return self._shape[0]
7201  *
7202  */
7203 
7204 /* Python wrapper */
7205 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___len__(PyObject * __pyx_v_self)7206 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
7207   Py_ssize_t __pyx_r;
7208   __Pyx_RefNannyDeclarations
7209   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
7210   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
7211 
7212   /* function exit code */
7213   __Pyx_RefNannyFinishContext();
7214   return __pyx_r;
7215 }
7216 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj * __pyx_v_self)7217 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
7218   Py_ssize_t __pyx_r;
7219   __Pyx_RefNannyDeclarations
7220   __Pyx_RefNannySetupContext("__len__", 0);
7221 
7222   /* "View.MemoryView":231
7223  *
7224  *     def __len__(self):
7225  *         return self._shape[0]             # <<<<<<<<<<<<<<
7226  *
7227  *     def __getattr__(self, attr):
7228  */
7229   __pyx_r = (__pyx_v_self->_shape[0]);
7230   goto __pyx_L0;
7231 
7232   /* "View.MemoryView":230
7233  *         return  memoryview(self, flags, self.dtype_is_object)
7234  *
7235  *     def __len__(self):             # <<<<<<<<<<<<<<
7236  *         return self._shape[0]
7237  *
7238  */
7239 
7240   /* function exit code */
7241   __pyx_L0:;
7242   __Pyx_RefNannyFinishContext();
7243   return __pyx_r;
7244 }
7245 
7246 /* "View.MemoryView":233
7247  *         return self._shape[0]
7248  *
7249  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
7250  *         return getattr(self.memview, attr)
7251  *
7252  */
7253 
7254 /* Python wrapper */
7255 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)7256 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
7257   PyObject *__pyx_r = 0;
7258   __Pyx_RefNannyDeclarations
7259   __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
7260   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
7261 
7262   /* function exit code */
7263   __Pyx_RefNannyFinishContext();
7264   return __pyx_r;
7265 }
7266 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_attr)7267 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
7268   PyObject *__pyx_r = NULL;
7269   __Pyx_RefNannyDeclarations
7270   PyObject *__pyx_t_1 = NULL;
7271   PyObject *__pyx_t_2 = NULL;
7272   int __pyx_lineno = 0;
7273   const char *__pyx_filename = NULL;
7274   int __pyx_clineno = 0;
7275   __Pyx_RefNannySetupContext("__getattr__", 0);
7276 
7277   /* "View.MemoryView":234
7278  *
7279  *     def __getattr__(self, attr):
7280  *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
7281  *
7282  *     def __getitem__(self, item):
7283  */
7284   __Pyx_XDECREF(__pyx_r);
7285   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 234, __pyx_L1_error)
7286   __Pyx_GOTREF(__pyx_t_1);
7287   __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error)
7288   __Pyx_GOTREF(__pyx_t_2);
7289   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7290   __pyx_r = __pyx_t_2;
7291   __pyx_t_2 = 0;
7292   goto __pyx_L0;
7293 
7294   /* "View.MemoryView":233
7295  *         return self._shape[0]
7296  *
7297  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
7298  *         return getattr(self.memview, attr)
7299  *
7300  */
7301 
7302   /* function exit code */
7303   __pyx_L1_error:;
7304   __Pyx_XDECREF(__pyx_t_1);
7305   __Pyx_XDECREF(__pyx_t_2);
7306   __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7307   __pyx_r = NULL;
7308   __pyx_L0:;
7309   __Pyx_XGIVEREF(__pyx_r);
7310   __Pyx_RefNannyFinishContext();
7311   return __pyx_r;
7312 }
7313 
7314 /* "View.MemoryView":236
7315  *         return getattr(self.memview, attr)
7316  *
7317  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
7318  *         return self.memview[item]
7319  *
7320  */
7321 
7322 /* Python wrapper */
7323 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)7324 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
7325   PyObject *__pyx_r = 0;
7326   __Pyx_RefNannyDeclarations
7327   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
7328   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
7329 
7330   /* function exit code */
7331   __Pyx_RefNannyFinishContext();
7332   return __pyx_r;
7333 }
7334 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item)7335 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
7336   PyObject *__pyx_r = NULL;
7337   __Pyx_RefNannyDeclarations
7338   PyObject *__pyx_t_1 = NULL;
7339   PyObject *__pyx_t_2 = NULL;
7340   int __pyx_lineno = 0;
7341   const char *__pyx_filename = NULL;
7342   int __pyx_clineno = 0;
7343   __Pyx_RefNannySetupContext("__getitem__", 0);
7344 
7345   /* "View.MemoryView":237
7346  *
7347  *     def __getitem__(self, item):
7348  *         return self.memview[item]             # <<<<<<<<<<<<<<
7349  *
7350  *     def __setitem__(self, item, value):
7351  */
7352   __Pyx_XDECREF(__pyx_r);
7353   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error)
7354   __Pyx_GOTREF(__pyx_t_1);
7355   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error)
7356   __Pyx_GOTREF(__pyx_t_2);
7357   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7358   __pyx_r = __pyx_t_2;
7359   __pyx_t_2 = 0;
7360   goto __pyx_L0;
7361 
7362   /* "View.MemoryView":236
7363  *         return getattr(self.memview, attr)
7364  *
7365  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
7366  *         return self.memview[item]
7367  *
7368  */
7369 
7370   /* function exit code */
7371   __pyx_L1_error:;
7372   __Pyx_XDECREF(__pyx_t_1);
7373   __Pyx_XDECREF(__pyx_t_2);
7374   __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7375   __pyx_r = NULL;
7376   __pyx_L0:;
7377   __Pyx_XGIVEREF(__pyx_r);
7378   __Pyx_RefNannyFinishContext();
7379   return __pyx_r;
7380 }
7381 
7382 /* "View.MemoryView":239
7383  *         return self.memview[item]
7384  *
7385  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
7386  *         self.memview[item] = value
7387  *
7388  */
7389 
7390 /* Python wrapper */
7391 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)7392 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
7393   int __pyx_r;
7394   __Pyx_RefNannyDeclarations
7395   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
7396   __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));
7397 
7398   /* function exit code */
7399   __Pyx_RefNannyFinishContext();
7400   return __pyx_r;
7401 }
7402 
__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)7403 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) {
7404   int __pyx_r;
7405   __Pyx_RefNannyDeclarations
7406   PyObject *__pyx_t_1 = NULL;
7407   int __pyx_lineno = 0;
7408   const char *__pyx_filename = NULL;
7409   int __pyx_clineno = 0;
7410   __Pyx_RefNannySetupContext("__setitem__", 0);
7411 
7412   /* "View.MemoryView":240
7413  *
7414  *     def __setitem__(self, item, value):
7415  *         self.memview[item] = value             # <<<<<<<<<<<<<<
7416  *
7417  *
7418  */
7419   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 240, __pyx_L1_error)
7420   __Pyx_GOTREF(__pyx_t_1);
7421   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error)
7422   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7423 
7424   /* "View.MemoryView":239
7425  *         return self.memview[item]
7426  *
7427  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
7428  *         self.memview[item] = value
7429  *
7430  */
7431 
7432   /* function exit code */
7433   __pyx_r = 0;
7434   goto __pyx_L0;
7435   __pyx_L1_error:;
7436   __Pyx_XDECREF(__pyx_t_1);
7437   __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7438   __pyx_r = -1;
7439   __pyx_L0:;
7440   __Pyx_RefNannyFinishContext();
7441   return __pyx_r;
7442 }
7443 
7444 /* "(tree fragment)":1
7445  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
7446  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7447  * def __setstate_cython__(self, __pyx_state):
7448  */
7449 
7450 /* Python wrapper */
7451 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)7452 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7453   PyObject *__pyx_r = 0;
7454   __Pyx_RefNannyDeclarations
7455   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
7456   __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
7457 
7458   /* function exit code */
7459   __Pyx_RefNannyFinishContext();
7460   return __pyx_r;
7461 }
7462 
__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self)7463 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
7464   PyObject *__pyx_r = NULL;
7465   __Pyx_RefNannyDeclarations
7466   PyObject *__pyx_t_1 = NULL;
7467   int __pyx_lineno = 0;
7468   const char *__pyx_filename = NULL;
7469   int __pyx_clineno = 0;
7470   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
7471 
7472   /* "(tree fragment)":2
7473  * def __reduce_cython__(self):
7474  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
7475  * def __setstate_cython__(self, __pyx_state):
7476  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7477  */
7478   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
7479   __Pyx_GOTREF(__pyx_t_1);
7480   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7481   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7482   __PYX_ERR(2, 2, __pyx_L1_error)
7483 
7484   /* "(tree fragment)":1
7485  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
7486  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7487  * def __setstate_cython__(self, __pyx_state):
7488  */
7489 
7490   /* function exit code */
7491   __pyx_L1_error:;
7492   __Pyx_XDECREF(__pyx_t_1);
7493   __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7494   __pyx_r = NULL;
7495   __Pyx_XGIVEREF(__pyx_r);
7496   __Pyx_RefNannyFinishContext();
7497   return __pyx_r;
7498 }
7499 
7500 /* "(tree fragment)":3
7501  * def __reduce_cython__(self):
7502  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7503  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
7504  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7505  */
7506 
7507 /* Python wrapper */
7508 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)7509 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
7510   PyObject *__pyx_r = 0;
7511   __Pyx_RefNannyDeclarations
7512   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
7513   __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
7514 
7515   /* function exit code */
7516   __Pyx_RefNannyFinishContext();
7517   return __pyx_r;
7518 }
7519 
__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)7520 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) {
7521   PyObject *__pyx_r = NULL;
7522   __Pyx_RefNannyDeclarations
7523   PyObject *__pyx_t_1 = NULL;
7524   int __pyx_lineno = 0;
7525   const char *__pyx_filename = NULL;
7526   int __pyx_clineno = 0;
7527   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
7528 
7529   /* "(tree fragment)":4
7530  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7531  * def __setstate_cython__(self, __pyx_state):
7532  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
7533  */
7534   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
7535   __Pyx_GOTREF(__pyx_t_1);
7536   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7537   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7538   __PYX_ERR(2, 4, __pyx_L1_error)
7539 
7540   /* "(tree fragment)":3
7541  * def __reduce_cython__(self):
7542  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7543  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
7544  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7545  */
7546 
7547   /* function exit code */
7548   __pyx_L1_error:;
7549   __Pyx_XDECREF(__pyx_t_1);
7550   __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7551   __pyx_r = NULL;
7552   __Pyx_XGIVEREF(__pyx_r);
7553   __Pyx_RefNannyFinishContext();
7554   return __pyx_r;
7555 }
7556 
7557 /* "View.MemoryView":244
7558  *
7559  * @cname("__pyx_array_new")
7560  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
7561  *                           char *mode, char *buf):
7562  *     cdef array result
7563  */
7564 
__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)7565 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) {
7566   struct __pyx_array_obj *__pyx_v_result = 0;
7567   struct __pyx_array_obj *__pyx_r = NULL;
7568   __Pyx_RefNannyDeclarations
7569   int __pyx_t_1;
7570   PyObject *__pyx_t_2 = NULL;
7571   PyObject *__pyx_t_3 = NULL;
7572   PyObject *__pyx_t_4 = NULL;
7573   PyObject *__pyx_t_5 = NULL;
7574   int __pyx_lineno = 0;
7575   const char *__pyx_filename = NULL;
7576   int __pyx_clineno = 0;
7577   __Pyx_RefNannySetupContext("array_cwrapper", 0);
7578 
7579   /* "View.MemoryView":248
7580  *     cdef array result
7581  *
7582  *     if buf == NULL:             # <<<<<<<<<<<<<<
7583  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
7584  *     else:
7585  */
7586   __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
7587   if (__pyx_t_1) {
7588 
7589     /* "View.MemoryView":249
7590  *
7591  *     if buf == NULL:
7592  *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
7593  *     else:
7594  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
7595  */
7596     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
7597     __Pyx_GOTREF(__pyx_t_2);
7598     __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error)
7599     __Pyx_GOTREF(__pyx_t_3);
7600     __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
7601     __Pyx_GOTREF(__pyx_t_4);
7602     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
7603     __Pyx_GOTREF(__pyx_t_5);
7604     __Pyx_INCREF(__pyx_v_shape);
7605     __Pyx_GIVEREF(__pyx_v_shape);
7606     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
7607     __Pyx_GIVEREF(__pyx_t_2);
7608     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
7609     __Pyx_GIVEREF(__pyx_t_3);
7610     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
7611     __Pyx_GIVEREF(__pyx_t_4);
7612     PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
7613     __pyx_t_2 = 0;
7614     __pyx_t_3 = 0;
7615     __pyx_t_4 = 0;
7616     __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
7617     __Pyx_GOTREF(__pyx_t_4);
7618     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7619     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
7620     __pyx_t_4 = 0;
7621 
7622     /* "View.MemoryView":248
7623  *     cdef array result
7624  *
7625  *     if buf == NULL:             # <<<<<<<<<<<<<<
7626  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
7627  *     else:
7628  */
7629     goto __pyx_L3;
7630   }
7631 
7632   /* "View.MemoryView":251
7633  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
7634  *     else:
7635  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
7636  *                        allocate_buffer=False)
7637  *         result.data = buf
7638  */
7639   /*else*/ {
7640     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error)
7641     __Pyx_GOTREF(__pyx_t_4);
7642     __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
7643     __Pyx_GOTREF(__pyx_t_5);
7644     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 251, __pyx_L1_error)
7645     __Pyx_GOTREF(__pyx_t_3);
7646     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error)
7647     __Pyx_GOTREF(__pyx_t_2);
7648     __Pyx_INCREF(__pyx_v_shape);
7649     __Pyx_GIVEREF(__pyx_v_shape);
7650     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
7651     __Pyx_GIVEREF(__pyx_t_4);
7652     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
7653     __Pyx_GIVEREF(__pyx_t_5);
7654     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
7655     __Pyx_GIVEREF(__pyx_t_3);
7656     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
7657     __pyx_t_4 = 0;
7658     __pyx_t_5 = 0;
7659     __pyx_t_3 = 0;
7660 
7661     /* "View.MemoryView":252
7662  *     else:
7663  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
7664  *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
7665  *         result.data = buf
7666  *
7667  */
7668     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
7669     __Pyx_GOTREF(__pyx_t_3);
7670     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error)
7671 
7672     /* "View.MemoryView":251
7673  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
7674  *     else:
7675  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
7676  *                        allocate_buffer=False)
7677  *         result.data = buf
7678  */
7679     __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
7680     __Pyx_GOTREF(__pyx_t_5);
7681     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7682     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7683     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
7684     __pyx_t_5 = 0;
7685 
7686     /* "View.MemoryView":253
7687  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
7688  *                        allocate_buffer=False)
7689  *         result.data = buf             # <<<<<<<<<<<<<<
7690  *
7691  *     return result
7692  */
7693     __pyx_v_result->data = __pyx_v_buf;
7694   }
7695   __pyx_L3:;
7696 
7697   /* "View.MemoryView":255
7698  *         result.data = buf
7699  *
7700  *     return result             # <<<<<<<<<<<<<<
7701  *
7702  *
7703  */
7704   __Pyx_XDECREF(((PyObject *)__pyx_r));
7705   __Pyx_INCREF(((PyObject *)__pyx_v_result));
7706   __pyx_r = __pyx_v_result;
7707   goto __pyx_L0;
7708 
7709   /* "View.MemoryView":244
7710  *
7711  * @cname("__pyx_array_new")
7712  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
7713  *                           char *mode, char *buf):
7714  *     cdef array result
7715  */
7716 
7717   /* function exit code */
7718   __pyx_L1_error:;
7719   __Pyx_XDECREF(__pyx_t_2);
7720   __Pyx_XDECREF(__pyx_t_3);
7721   __Pyx_XDECREF(__pyx_t_4);
7722   __Pyx_XDECREF(__pyx_t_5);
7723   __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
7724   __pyx_r = 0;
7725   __pyx_L0:;
7726   __Pyx_XDECREF((PyObject *)__pyx_v_result);
7727   __Pyx_XGIVEREF((PyObject *)__pyx_r);
7728   __Pyx_RefNannyFinishContext();
7729   return __pyx_r;
7730 }
7731 
7732 /* "View.MemoryView":281
7733  * cdef class Enum(object):
7734  *     cdef object name
7735  *     def __init__(self, name):             # <<<<<<<<<<<<<<
7736  *         self.name = name
7737  *     def __repr__(self):
7738  */
7739 
7740 /* Python wrapper */
7741 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)7742 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7743   PyObject *__pyx_v_name = 0;
7744   int __pyx_lineno = 0;
7745   const char *__pyx_filename = NULL;
7746   int __pyx_clineno = 0;
7747   int __pyx_r;
7748   __Pyx_RefNannyDeclarations
7749   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
7750   {
7751     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
7752     PyObject* values[1] = {0};
7753     if (unlikely(__pyx_kwds)) {
7754       Py_ssize_t kw_args;
7755       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7756       switch (pos_args) {
7757         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7758         CYTHON_FALLTHROUGH;
7759         case  0: break;
7760         default: goto __pyx_L5_argtuple_error;
7761       }
7762       kw_args = PyDict_Size(__pyx_kwds);
7763       switch (pos_args) {
7764         case  0:
7765         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
7766         else goto __pyx_L5_argtuple_error;
7767       }
7768       if (unlikely(kw_args > 0)) {
7769         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error)
7770       }
7771     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
7772       goto __pyx_L5_argtuple_error;
7773     } else {
7774       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7775     }
7776     __pyx_v_name = values[0];
7777   }
7778   goto __pyx_L4_argument_unpacking_done;
7779   __pyx_L5_argtuple_error:;
7780   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error)
7781   __pyx_L3_error:;
7782   __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7783   __Pyx_RefNannyFinishContext();
7784   return -1;
7785   __pyx_L4_argument_unpacking_done:;
7786   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
7787 
7788   /* function exit code */
7789   __Pyx_RefNannyFinishContext();
7790   return __pyx_r;
7791 }
7792 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v_name)7793 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
7794   int __pyx_r;
7795   __Pyx_RefNannyDeclarations
7796   __Pyx_RefNannySetupContext("__init__", 0);
7797 
7798   /* "View.MemoryView":282
7799  *     cdef object name
7800  *     def __init__(self, name):
7801  *         self.name = name             # <<<<<<<<<<<<<<
7802  *     def __repr__(self):
7803  *         return self.name
7804  */
7805   __Pyx_INCREF(__pyx_v_name);
7806   __Pyx_GIVEREF(__pyx_v_name);
7807   __Pyx_GOTREF(__pyx_v_self->name);
7808   __Pyx_DECREF(__pyx_v_self->name);
7809   __pyx_v_self->name = __pyx_v_name;
7810 
7811   /* "View.MemoryView":281
7812  * cdef class Enum(object):
7813  *     cdef object name
7814  *     def __init__(self, name):             # <<<<<<<<<<<<<<
7815  *         self.name = name
7816  *     def __repr__(self):
7817  */
7818 
7819   /* function exit code */
7820   __pyx_r = 0;
7821   __Pyx_RefNannyFinishContext();
7822   return __pyx_r;
7823 }
7824 
7825 /* "View.MemoryView":283
7826  *     def __init__(self, name):
7827  *         self.name = name
7828  *     def __repr__(self):             # <<<<<<<<<<<<<<
7829  *         return self.name
7830  *
7831  */
7832 
7833 /* Python wrapper */
7834 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_MemviewEnum___repr__(PyObject * __pyx_v_self)7835 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
7836   PyObject *__pyx_r = 0;
7837   __Pyx_RefNannyDeclarations
7838   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
7839   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
7840 
7841   /* function exit code */
7842   __Pyx_RefNannyFinishContext();
7843   return __pyx_r;
7844 }
7845 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj * __pyx_v_self)7846 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
7847   PyObject *__pyx_r = NULL;
7848   __Pyx_RefNannyDeclarations
7849   __Pyx_RefNannySetupContext("__repr__", 0);
7850 
7851   /* "View.MemoryView":284
7852  *         self.name = name
7853  *     def __repr__(self):
7854  *         return self.name             # <<<<<<<<<<<<<<
7855  *
7856  * cdef generic = Enum("<strided and direct or indirect>")
7857  */
7858   __Pyx_XDECREF(__pyx_r);
7859   __Pyx_INCREF(__pyx_v_self->name);
7860   __pyx_r = __pyx_v_self->name;
7861   goto __pyx_L0;
7862 
7863   /* "View.MemoryView":283
7864  *     def __init__(self, name):
7865  *         self.name = name
7866  *     def __repr__(self):             # <<<<<<<<<<<<<<
7867  *         return self.name
7868  *
7869  */
7870 
7871   /* function exit code */
7872   __pyx_L0:;
7873   __Pyx_XGIVEREF(__pyx_r);
7874   __Pyx_RefNannyFinishContext();
7875   return __pyx_r;
7876 }
7877 
7878 /* "(tree fragment)":1
7879  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
7880  *     cdef tuple state
7881  *     cdef object _dict
7882  */
7883 
7884 /* Python wrapper */
7885 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)7886 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7887   PyObject *__pyx_r = 0;
7888   __Pyx_RefNannyDeclarations
7889   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
7890   __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
7891 
7892   /* function exit code */
7893   __Pyx_RefNannyFinishContext();
7894   return __pyx_r;
7895 }
7896 
__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self)7897 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
7898   PyObject *__pyx_v_state = 0;
7899   PyObject *__pyx_v__dict = 0;
7900   int __pyx_v_use_setstate;
7901   PyObject *__pyx_r = NULL;
7902   __Pyx_RefNannyDeclarations
7903   PyObject *__pyx_t_1 = NULL;
7904   int __pyx_t_2;
7905   int __pyx_t_3;
7906   PyObject *__pyx_t_4 = NULL;
7907   PyObject *__pyx_t_5 = NULL;
7908   int __pyx_lineno = 0;
7909   const char *__pyx_filename = NULL;
7910   int __pyx_clineno = 0;
7911   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
7912 
7913   /* "(tree fragment)":5
7914  *     cdef object _dict
7915  *     cdef bint use_setstate
7916  *     state = (self.name,)             # <<<<<<<<<<<<<<
7917  *     _dict = getattr(self, '__dict__', None)
7918  *     if _dict is not None:
7919  */
7920   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
7921   __Pyx_GOTREF(__pyx_t_1);
7922   __Pyx_INCREF(__pyx_v_self->name);
7923   __Pyx_GIVEREF(__pyx_v_self->name);
7924   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
7925   __pyx_v_state = ((PyObject*)__pyx_t_1);
7926   __pyx_t_1 = 0;
7927 
7928   /* "(tree fragment)":6
7929  *     cdef bint use_setstate
7930  *     state = (self.name,)
7931  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
7932  *     if _dict is not None:
7933  *         state += (_dict,)
7934  */
7935   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
7936   __Pyx_GOTREF(__pyx_t_1);
7937   __pyx_v__dict = __pyx_t_1;
7938   __pyx_t_1 = 0;
7939 
7940   /* "(tree fragment)":7
7941  *     state = (self.name,)
7942  *     _dict = getattr(self, '__dict__', None)
7943  *     if _dict is not None:             # <<<<<<<<<<<<<<
7944  *         state += (_dict,)
7945  *         use_setstate = True
7946  */
7947   __pyx_t_2 = (__pyx_v__dict != Py_None);
7948   __pyx_t_3 = (__pyx_t_2 != 0);
7949   if (__pyx_t_3) {
7950 
7951     /* "(tree fragment)":8
7952  *     _dict = getattr(self, '__dict__', None)
7953  *     if _dict is not None:
7954  *         state += (_dict,)             # <<<<<<<<<<<<<<
7955  *         use_setstate = True
7956  *     else:
7957  */
7958     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
7959     __Pyx_GOTREF(__pyx_t_1);
7960     __Pyx_INCREF(__pyx_v__dict);
7961     __Pyx_GIVEREF(__pyx_v__dict);
7962     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
7963     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
7964     __Pyx_GOTREF(__pyx_t_4);
7965     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7966     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
7967     __pyx_t_4 = 0;
7968 
7969     /* "(tree fragment)":9
7970  *     if _dict is not None:
7971  *         state += (_dict,)
7972  *         use_setstate = True             # <<<<<<<<<<<<<<
7973  *     else:
7974  *         use_setstate = self.name is not None
7975  */
7976     __pyx_v_use_setstate = 1;
7977 
7978     /* "(tree fragment)":7
7979  *     state = (self.name,)
7980  *     _dict = getattr(self, '__dict__', None)
7981  *     if _dict is not None:             # <<<<<<<<<<<<<<
7982  *         state += (_dict,)
7983  *         use_setstate = True
7984  */
7985     goto __pyx_L3;
7986   }
7987 
7988   /* "(tree fragment)":11
7989  *         use_setstate = True
7990  *     else:
7991  *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
7992  *     if use_setstate:
7993  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
7994  */
7995   /*else*/ {
7996     __pyx_t_3 = (__pyx_v_self->name != Py_None);
7997     __pyx_v_use_setstate = __pyx_t_3;
7998   }
7999   __pyx_L3:;
8000 
8001   /* "(tree fragment)":12
8002  *     else:
8003  *         use_setstate = self.name is not None
8004  *     if use_setstate:             # <<<<<<<<<<<<<<
8005  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
8006  *     else:
8007  */
8008   __pyx_t_3 = (__pyx_v_use_setstate != 0);
8009   if (__pyx_t_3) {
8010 
8011     /* "(tree fragment)":13
8012  *         use_setstate = self.name is not None
8013  *     if use_setstate:
8014  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
8015  *     else:
8016  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
8017  */
8018     __Pyx_XDECREF(__pyx_r);
8019     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
8020     __Pyx_GOTREF(__pyx_t_4);
8021     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
8022     __Pyx_GOTREF(__pyx_t_1);
8023     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8024     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8025     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8026     __Pyx_INCREF(__pyx_int_184977713);
8027     __Pyx_GIVEREF(__pyx_int_184977713);
8028     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
8029     __Pyx_INCREF(Py_None);
8030     __Pyx_GIVEREF(Py_None);
8031     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
8032     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
8033     __Pyx_GOTREF(__pyx_t_5);
8034     __Pyx_GIVEREF(__pyx_t_4);
8035     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
8036     __Pyx_GIVEREF(__pyx_t_1);
8037     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
8038     __Pyx_INCREF(__pyx_v_state);
8039     __Pyx_GIVEREF(__pyx_v_state);
8040     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
8041     __pyx_t_4 = 0;
8042     __pyx_t_1 = 0;
8043     __pyx_r = __pyx_t_5;
8044     __pyx_t_5 = 0;
8045     goto __pyx_L0;
8046 
8047     /* "(tree fragment)":12
8048  *     else:
8049  *         use_setstate = self.name is not None
8050  *     if use_setstate:             # <<<<<<<<<<<<<<
8051  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
8052  *     else:
8053  */
8054   }
8055 
8056   /* "(tree fragment)":15
8057  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
8058  *     else:
8059  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
8060  * def __setstate_cython__(self, __pyx_state):
8061  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
8062  */
8063   /*else*/ {
8064     __Pyx_XDECREF(__pyx_r);
8065     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
8066     __Pyx_GOTREF(__pyx_t_5);
8067     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
8068     __Pyx_GOTREF(__pyx_t_1);
8069     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8070     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8071     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8072     __Pyx_INCREF(__pyx_int_184977713);
8073     __Pyx_GIVEREF(__pyx_int_184977713);
8074     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
8075     __Pyx_INCREF(__pyx_v_state);
8076     __Pyx_GIVEREF(__pyx_v_state);
8077     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
8078     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
8079     __Pyx_GOTREF(__pyx_t_4);
8080     __Pyx_GIVEREF(__pyx_t_5);
8081     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
8082     __Pyx_GIVEREF(__pyx_t_1);
8083     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
8084     __pyx_t_5 = 0;
8085     __pyx_t_1 = 0;
8086     __pyx_r = __pyx_t_4;
8087     __pyx_t_4 = 0;
8088     goto __pyx_L0;
8089   }
8090 
8091   /* "(tree fragment)":1
8092  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8093  *     cdef tuple state
8094  *     cdef object _dict
8095  */
8096 
8097   /* function exit code */
8098   __pyx_L1_error:;
8099   __Pyx_XDECREF(__pyx_t_1);
8100   __Pyx_XDECREF(__pyx_t_4);
8101   __Pyx_XDECREF(__pyx_t_5);
8102   __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8103   __pyx_r = NULL;
8104   __pyx_L0:;
8105   __Pyx_XDECREF(__pyx_v_state);
8106   __Pyx_XDECREF(__pyx_v__dict);
8107   __Pyx_XGIVEREF(__pyx_r);
8108   __Pyx_RefNannyFinishContext();
8109   return __pyx_r;
8110 }
8111 
8112 /* "(tree fragment)":16
8113  *     else:
8114  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
8115  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8116  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
8117  */
8118 
8119 /* Python wrapper */
8120 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)8121 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8122   PyObject *__pyx_r = 0;
8123   __Pyx_RefNannyDeclarations
8124   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8125   __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8126 
8127   /* function exit code */
8128   __Pyx_RefNannyFinishContext();
8129   return __pyx_r;
8130 }
8131 
__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v___pyx_state)8132 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8133   PyObject *__pyx_r = NULL;
8134   __Pyx_RefNannyDeclarations
8135   PyObject *__pyx_t_1 = NULL;
8136   int __pyx_lineno = 0;
8137   const char *__pyx_filename = NULL;
8138   int __pyx_clineno = 0;
8139   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8140 
8141   /* "(tree fragment)":17
8142  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
8143  * def __setstate_cython__(self, __pyx_state):
8144  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
8145  */
8146   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error)
8147   __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
8148   __Pyx_GOTREF(__pyx_t_1);
8149   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8150 
8151   /* "(tree fragment)":16
8152  *     else:
8153  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
8154  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8155  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
8156  */
8157 
8158   /* function exit code */
8159   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8160   goto __pyx_L0;
8161   __pyx_L1_error:;
8162   __Pyx_XDECREF(__pyx_t_1);
8163   __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8164   __pyx_r = NULL;
8165   __pyx_L0:;
8166   __Pyx_XGIVEREF(__pyx_r);
8167   __Pyx_RefNannyFinishContext();
8168   return __pyx_r;
8169 }
8170 
8171 /* "View.MemoryView":298
8172  *
8173  * @cname('__pyx_align_pointer')
8174  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
8175  *     "Align pointer memory on a given boundary"
8176  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
8177  */
8178 
__pyx_align_pointer(void * __pyx_v_memory,size_t __pyx_v_alignment)8179 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
8180   Py_intptr_t __pyx_v_aligned_p;
8181   size_t __pyx_v_offset;
8182   void *__pyx_r;
8183   int __pyx_t_1;
8184 
8185   /* "View.MemoryView":300
8186  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
8187  *     "Align pointer memory on a given boundary"
8188  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
8189  *     cdef size_t offset
8190  *
8191  */
8192   __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
8193 
8194   /* "View.MemoryView":304
8195  *
8196  *     with cython.cdivision(True):
8197  *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
8198  *
8199  *     if offset > 0:
8200  */
8201   __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
8202 
8203   /* "View.MemoryView":306
8204  *         offset = aligned_p % alignment
8205  *
8206  *     if offset > 0:             # <<<<<<<<<<<<<<
8207  *         aligned_p += alignment - offset
8208  *
8209  */
8210   __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
8211   if (__pyx_t_1) {
8212 
8213     /* "View.MemoryView":307
8214  *
8215  *     if offset > 0:
8216  *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
8217  *
8218  *     return <void *> aligned_p
8219  */
8220     __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
8221 
8222     /* "View.MemoryView":306
8223  *         offset = aligned_p % alignment
8224  *
8225  *     if offset > 0:             # <<<<<<<<<<<<<<
8226  *         aligned_p += alignment - offset
8227  *
8228  */
8229   }
8230 
8231   /* "View.MemoryView":309
8232  *         aligned_p += alignment - offset
8233  *
8234  *     return <void *> aligned_p             # <<<<<<<<<<<<<<
8235  *
8236  *
8237  */
8238   __pyx_r = ((void *)__pyx_v_aligned_p);
8239   goto __pyx_L0;
8240 
8241   /* "View.MemoryView":298
8242  *
8243  * @cname('__pyx_align_pointer')
8244  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
8245  *     "Align pointer memory on a given boundary"
8246  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
8247  */
8248 
8249   /* function exit code */
8250   __pyx_L0:;
8251   return __pyx_r;
8252 }
8253 
8254 /* "View.MemoryView":345
8255  *     cdef __Pyx_TypeInfo *typeinfo
8256  *
8257  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
8258  *         self.obj = obj
8259  *         self.flags = flags
8260  */
8261 
8262 /* Python wrapper */
8263 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)8264 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8265   PyObject *__pyx_v_obj = 0;
8266   int __pyx_v_flags;
8267   int __pyx_v_dtype_is_object;
8268   int __pyx_lineno = 0;
8269   const char *__pyx_filename = NULL;
8270   int __pyx_clineno = 0;
8271   int __pyx_r;
8272   __Pyx_RefNannyDeclarations
8273   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
8274   {
8275     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
8276     PyObject* values[3] = {0,0,0};
8277     if (unlikely(__pyx_kwds)) {
8278       Py_ssize_t kw_args;
8279       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8280       switch (pos_args) {
8281         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8282         CYTHON_FALLTHROUGH;
8283         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8284         CYTHON_FALLTHROUGH;
8285         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8286         CYTHON_FALLTHROUGH;
8287         case  0: break;
8288         default: goto __pyx_L5_argtuple_error;
8289       }
8290       kw_args = PyDict_Size(__pyx_kwds);
8291       switch (pos_args) {
8292         case  0:
8293         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
8294         else goto __pyx_L5_argtuple_error;
8295         CYTHON_FALLTHROUGH;
8296         case  1:
8297         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
8298         else {
8299           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
8300         }
8301         CYTHON_FALLTHROUGH;
8302         case  2:
8303         if (kw_args > 0) {
8304           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
8305           if (value) { values[2] = value; kw_args--; }
8306         }
8307       }
8308       if (unlikely(kw_args > 0)) {
8309         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error)
8310       }
8311     } else {
8312       switch (PyTuple_GET_SIZE(__pyx_args)) {
8313         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8314         CYTHON_FALLTHROUGH;
8315         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8316         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8317         break;
8318         default: goto __pyx_L5_argtuple_error;
8319       }
8320     }
8321     __pyx_v_obj = values[0];
8322     __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
8323     if (values[2]) {
8324       __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
8325     } else {
8326       __pyx_v_dtype_is_object = ((int)0);
8327     }
8328   }
8329   goto __pyx_L4_argument_unpacking_done;
8330   __pyx_L5_argtuple_error:;
8331   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error)
8332   __pyx_L3_error:;
8333   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8334   __Pyx_RefNannyFinishContext();
8335   return -1;
8336   __pyx_L4_argument_unpacking_done:;
8337   __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);
8338 
8339   /* function exit code */
8340   __Pyx_RefNannyFinishContext();
8341   return __pyx_r;
8342 }
8343 
__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)8344 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) {
8345   int __pyx_r;
8346   __Pyx_RefNannyDeclarations
8347   int __pyx_t_1;
8348   int __pyx_t_2;
8349   int __pyx_t_3;
8350   int __pyx_t_4;
8351   int __pyx_lineno = 0;
8352   const char *__pyx_filename = NULL;
8353   int __pyx_clineno = 0;
8354   __Pyx_RefNannySetupContext("__cinit__", 0);
8355 
8356   /* "View.MemoryView":346
8357  *
8358  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
8359  *         self.obj = obj             # <<<<<<<<<<<<<<
8360  *         self.flags = flags
8361  *         if type(self) is memoryview or obj is not None:
8362  */
8363   __Pyx_INCREF(__pyx_v_obj);
8364   __Pyx_GIVEREF(__pyx_v_obj);
8365   __Pyx_GOTREF(__pyx_v_self->obj);
8366   __Pyx_DECREF(__pyx_v_self->obj);
8367   __pyx_v_self->obj = __pyx_v_obj;
8368 
8369   /* "View.MemoryView":347
8370  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
8371  *         self.obj = obj
8372  *         self.flags = flags             # <<<<<<<<<<<<<<
8373  *         if type(self) is memoryview or obj is not None:
8374  *             __Pyx_GetBuffer(obj, &self.view, flags)
8375  */
8376   __pyx_v_self->flags = __pyx_v_flags;
8377 
8378   /* "View.MemoryView":348
8379  *         self.obj = obj
8380  *         self.flags = flags
8381  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
8382  *             __Pyx_GetBuffer(obj, &self.view, flags)
8383  *             if <PyObject *> self.view.obj == NULL:
8384  */
8385   __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
8386   __pyx_t_3 = (__pyx_t_2 != 0);
8387   if (!__pyx_t_3) {
8388   } else {
8389     __pyx_t_1 = __pyx_t_3;
8390     goto __pyx_L4_bool_binop_done;
8391   }
8392   __pyx_t_3 = (__pyx_v_obj != Py_None);
8393   __pyx_t_2 = (__pyx_t_3 != 0);
8394   __pyx_t_1 = __pyx_t_2;
8395   __pyx_L4_bool_binop_done:;
8396   if (__pyx_t_1) {
8397 
8398     /* "View.MemoryView":349
8399  *         self.flags = flags
8400  *         if type(self) is memoryview or obj is not None:
8401  *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
8402  *             if <PyObject *> self.view.obj == NULL:
8403  *                 (<__pyx_buffer *> &self.view).obj = Py_None
8404  */
8405     __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 349, __pyx_L1_error)
8406 
8407     /* "View.MemoryView":350
8408  *         if type(self) is memoryview or obj is not None:
8409  *             __Pyx_GetBuffer(obj, &self.view, flags)
8410  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
8411  *                 (<__pyx_buffer *> &self.view).obj = Py_None
8412  *                 Py_INCREF(Py_None)
8413  */
8414     __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
8415     if (__pyx_t_1) {
8416 
8417       /* "View.MemoryView":351
8418  *             __Pyx_GetBuffer(obj, &self.view, flags)
8419  *             if <PyObject *> self.view.obj == NULL:
8420  *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
8421  *                 Py_INCREF(Py_None)
8422  *
8423  */
8424       ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
8425 
8426       /* "View.MemoryView":352
8427  *             if <PyObject *> self.view.obj == NULL:
8428  *                 (<__pyx_buffer *> &self.view).obj = Py_None
8429  *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
8430  *
8431  *         global __pyx_memoryview_thread_locks_used
8432  */
8433       Py_INCREF(Py_None);
8434 
8435       /* "View.MemoryView":350
8436  *         if type(self) is memoryview or obj is not None:
8437  *             __Pyx_GetBuffer(obj, &self.view, flags)
8438  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
8439  *                 (<__pyx_buffer *> &self.view).obj = Py_None
8440  *                 Py_INCREF(Py_None)
8441  */
8442     }
8443 
8444     /* "View.MemoryView":348
8445  *         self.obj = obj
8446  *         self.flags = flags
8447  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
8448  *             __Pyx_GetBuffer(obj, &self.view, flags)
8449  *             if <PyObject *> self.view.obj == NULL:
8450  */
8451   }
8452 
8453   /* "View.MemoryView":355
8454  *
8455  *         global __pyx_memoryview_thread_locks_used
8456  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
8457  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
8458  *             __pyx_memoryview_thread_locks_used += 1
8459  */
8460   __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
8461   if (__pyx_t_1) {
8462 
8463     /* "View.MemoryView":356
8464  *         global __pyx_memoryview_thread_locks_used
8465  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
8466  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
8467  *             __pyx_memoryview_thread_locks_used += 1
8468  *         if self.lock is NULL:
8469  */
8470     __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
8471 
8472     /* "View.MemoryView":357
8473  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
8474  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
8475  *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
8476  *         if self.lock is NULL:
8477  *             self.lock = PyThread_allocate_lock()
8478  */
8479     __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
8480 
8481     /* "View.MemoryView":355
8482  *
8483  *         global __pyx_memoryview_thread_locks_used
8484  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
8485  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
8486  *             __pyx_memoryview_thread_locks_used += 1
8487  */
8488   }
8489 
8490   /* "View.MemoryView":358
8491  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
8492  *             __pyx_memoryview_thread_locks_used += 1
8493  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
8494  *             self.lock = PyThread_allocate_lock()
8495  *             if self.lock is NULL:
8496  */
8497   __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
8498   if (__pyx_t_1) {
8499 
8500     /* "View.MemoryView":359
8501  *             __pyx_memoryview_thread_locks_used += 1
8502  *         if self.lock is NULL:
8503  *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
8504  *             if self.lock is NULL:
8505  *                 raise MemoryError
8506  */
8507     __pyx_v_self->lock = PyThread_allocate_lock();
8508 
8509     /* "View.MemoryView":360
8510  *         if self.lock is NULL:
8511  *             self.lock = PyThread_allocate_lock()
8512  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
8513  *                 raise MemoryError
8514  *
8515  */
8516     __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
8517     if (unlikely(__pyx_t_1)) {
8518 
8519       /* "View.MemoryView":361
8520  *             self.lock = PyThread_allocate_lock()
8521  *             if self.lock is NULL:
8522  *                 raise MemoryError             # <<<<<<<<<<<<<<
8523  *
8524  *         if flags & PyBUF_FORMAT:
8525  */
8526       PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
8527 
8528       /* "View.MemoryView":360
8529  *         if self.lock is NULL:
8530  *             self.lock = PyThread_allocate_lock()
8531  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
8532  *                 raise MemoryError
8533  *
8534  */
8535     }
8536 
8537     /* "View.MemoryView":358
8538  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
8539  *             __pyx_memoryview_thread_locks_used += 1
8540  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
8541  *             self.lock = PyThread_allocate_lock()
8542  *             if self.lock is NULL:
8543  */
8544   }
8545 
8546   /* "View.MemoryView":363
8547  *                 raise MemoryError
8548  *
8549  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
8550  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
8551  *         else:
8552  */
8553   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
8554   if (__pyx_t_1) {
8555 
8556     /* "View.MemoryView":364
8557  *
8558  *         if flags & PyBUF_FORMAT:
8559  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
8560  *         else:
8561  *             self.dtype_is_object = dtype_is_object
8562  */
8563     __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
8564     if (__pyx_t_2) {
8565     } else {
8566       __pyx_t_1 = __pyx_t_2;
8567       goto __pyx_L11_bool_binop_done;
8568     }
8569     __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
8570     __pyx_t_1 = __pyx_t_2;
8571     __pyx_L11_bool_binop_done:;
8572     __pyx_v_self->dtype_is_object = __pyx_t_1;
8573 
8574     /* "View.MemoryView":363
8575  *                 raise MemoryError
8576  *
8577  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
8578  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
8579  *         else:
8580  */
8581     goto __pyx_L10;
8582   }
8583 
8584   /* "View.MemoryView":366
8585  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
8586  *         else:
8587  *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
8588  *
8589  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
8590  */
8591   /*else*/ {
8592     __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
8593   }
8594   __pyx_L10:;
8595 
8596   /* "View.MemoryView":368
8597  *             self.dtype_is_object = dtype_is_object
8598  *
8599  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
8600  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
8601  *         self.typeinfo = NULL
8602  */
8603   __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
8604 
8605   /* "View.MemoryView":370
8606  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
8607  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
8608  *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
8609  *
8610  *     def __dealloc__(memoryview self):
8611  */
8612   __pyx_v_self->typeinfo = NULL;
8613 
8614   /* "View.MemoryView":345
8615  *     cdef __Pyx_TypeInfo *typeinfo
8616  *
8617  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
8618  *         self.obj = obj
8619  *         self.flags = flags
8620  */
8621 
8622   /* function exit code */
8623   __pyx_r = 0;
8624   goto __pyx_L0;
8625   __pyx_L1_error:;
8626   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8627   __pyx_r = -1;
8628   __pyx_L0:;
8629   __Pyx_RefNannyFinishContext();
8630   return __pyx_r;
8631 }
8632 
8633 /* "View.MemoryView":372
8634  *         self.typeinfo = NULL
8635  *
8636  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
8637  *         if self.obj is not None:
8638  *             __Pyx_ReleaseBuffer(&self.view)
8639  */
8640 
8641 /* Python wrapper */
8642 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___dealloc__(PyObject * __pyx_v_self)8643 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
8644   __Pyx_RefNannyDeclarations
8645   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
8646   __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
8647 
8648   /* function exit code */
8649   __Pyx_RefNannyFinishContext();
8650 }
8651 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj * __pyx_v_self)8652 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
8653   int __pyx_v_i;
8654   __Pyx_RefNannyDeclarations
8655   int __pyx_t_1;
8656   int __pyx_t_2;
8657   int __pyx_t_3;
8658   int __pyx_t_4;
8659   int __pyx_t_5;
8660   PyThread_type_lock __pyx_t_6;
8661   PyThread_type_lock __pyx_t_7;
8662   __Pyx_RefNannySetupContext("__dealloc__", 0);
8663 
8664   /* "View.MemoryView":373
8665  *
8666  *     def __dealloc__(memoryview self):
8667  *         if self.obj is not None:             # <<<<<<<<<<<<<<
8668  *             __Pyx_ReleaseBuffer(&self.view)
8669  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
8670  */
8671   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
8672   __pyx_t_2 = (__pyx_t_1 != 0);
8673   if (__pyx_t_2) {
8674 
8675     /* "View.MemoryView":374
8676  *     def __dealloc__(memoryview self):
8677  *         if self.obj is not None:
8678  *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
8679  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
8680  *
8681  */
8682     __Pyx_ReleaseBuffer((&__pyx_v_self->view));
8683 
8684     /* "View.MemoryView":373
8685  *
8686  *     def __dealloc__(memoryview self):
8687  *         if self.obj is not None:             # <<<<<<<<<<<<<<
8688  *             __Pyx_ReleaseBuffer(&self.view)
8689  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
8690  */
8691     goto __pyx_L3;
8692   }
8693 
8694   /* "View.MemoryView":375
8695  *         if self.obj is not None:
8696  *             __Pyx_ReleaseBuffer(&self.view)
8697  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
8698  *
8699  *             (<__pyx_buffer *> &self.view).obj = NULL
8700  */
8701   __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
8702   if (__pyx_t_2) {
8703 
8704     /* "View.MemoryView":377
8705  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
8706  *
8707  *             (<__pyx_buffer *> &self.view).obj = NULL             # <<<<<<<<<<<<<<
8708  *             Py_DECREF(Py_None)
8709  *
8710  */
8711     ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
8712 
8713     /* "View.MemoryView":378
8714  *
8715  *             (<__pyx_buffer *> &self.view).obj = NULL
8716  *             Py_DECREF(Py_None)             # <<<<<<<<<<<<<<
8717  *
8718  *         cdef int i
8719  */
8720     Py_DECREF(Py_None);
8721 
8722     /* "View.MemoryView":375
8723  *         if self.obj is not None:
8724  *             __Pyx_ReleaseBuffer(&self.view)
8725  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
8726  *
8727  *             (<__pyx_buffer *> &self.view).obj = NULL
8728  */
8729   }
8730   __pyx_L3:;
8731 
8732   /* "View.MemoryView":382
8733  *         cdef int i
8734  *         global __pyx_memoryview_thread_locks_used
8735  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
8736  *             for i in range(__pyx_memoryview_thread_locks_used):
8737  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
8738  */
8739   __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
8740   if (__pyx_t_2) {
8741 
8742     /* "View.MemoryView":383
8743  *         global __pyx_memoryview_thread_locks_used
8744  *         if self.lock != NULL:
8745  *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
8746  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
8747  *                     __pyx_memoryview_thread_locks_used -= 1
8748  */
8749     __pyx_t_3 = __pyx_memoryview_thread_locks_used;
8750     __pyx_t_4 = __pyx_t_3;
8751     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
8752       __pyx_v_i = __pyx_t_5;
8753 
8754       /* "View.MemoryView":384
8755  *         if self.lock != NULL:
8756  *             for i in range(__pyx_memoryview_thread_locks_used):
8757  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
8758  *                     __pyx_memoryview_thread_locks_used -= 1
8759  *                     if i != __pyx_memoryview_thread_locks_used:
8760  */
8761       __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
8762       if (__pyx_t_2) {
8763 
8764         /* "View.MemoryView":385
8765  *             for i in range(__pyx_memoryview_thread_locks_used):
8766  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
8767  *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
8768  *                     if i != __pyx_memoryview_thread_locks_used:
8769  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8770  */
8771         __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
8772 
8773         /* "View.MemoryView":386
8774  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
8775  *                     __pyx_memoryview_thread_locks_used -= 1
8776  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
8777  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8778  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
8779  */
8780         __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
8781         if (__pyx_t_2) {
8782 
8783           /* "View.MemoryView":388
8784  *                     if i != __pyx_memoryview_thread_locks_used:
8785  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8786  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
8787  *                     break
8788  *             else:
8789  */
8790           __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
8791           __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
8792 
8793           /* "View.MemoryView":387
8794  *                     __pyx_memoryview_thread_locks_used -= 1
8795  *                     if i != __pyx_memoryview_thread_locks_used:
8796  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
8797  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
8798  *                     break
8799  */
8800           (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
8801           (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
8802 
8803           /* "View.MemoryView":386
8804  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
8805  *                     __pyx_memoryview_thread_locks_used -= 1
8806  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
8807  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8808  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
8809  */
8810         }
8811 
8812         /* "View.MemoryView":389
8813  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8814  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
8815  *                     break             # <<<<<<<<<<<<<<
8816  *             else:
8817  *                 PyThread_free_lock(self.lock)
8818  */
8819         goto __pyx_L6_break;
8820 
8821         /* "View.MemoryView":384
8822  *         if self.lock != NULL:
8823  *             for i in range(__pyx_memoryview_thread_locks_used):
8824  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
8825  *                     __pyx_memoryview_thread_locks_used -= 1
8826  *                     if i != __pyx_memoryview_thread_locks_used:
8827  */
8828       }
8829     }
8830     /*else*/ {
8831 
8832       /* "View.MemoryView":391
8833  *                     break
8834  *             else:
8835  *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
8836  *
8837  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
8838  */
8839       PyThread_free_lock(__pyx_v_self->lock);
8840     }
8841     __pyx_L6_break:;
8842 
8843     /* "View.MemoryView":382
8844  *         cdef int i
8845  *         global __pyx_memoryview_thread_locks_used
8846  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
8847  *             for i in range(__pyx_memoryview_thread_locks_used):
8848  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
8849  */
8850   }
8851 
8852   /* "View.MemoryView":372
8853  *         self.typeinfo = NULL
8854  *
8855  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
8856  *         if self.obj is not None:
8857  *             __Pyx_ReleaseBuffer(&self.view)
8858  */
8859 
8860   /* function exit code */
8861   __Pyx_RefNannyFinishContext();
8862 }
8863 
8864 /* "View.MemoryView":393
8865  *                 PyThread_free_lock(self.lock)
8866  *
8867  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
8868  *         cdef Py_ssize_t dim
8869  *         cdef char *itemp = <char *> self.view.buf
8870  */
8871 
__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)8872 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
8873   Py_ssize_t __pyx_v_dim;
8874   char *__pyx_v_itemp;
8875   PyObject *__pyx_v_idx = NULL;
8876   char *__pyx_r;
8877   __Pyx_RefNannyDeclarations
8878   Py_ssize_t __pyx_t_1;
8879   PyObject *__pyx_t_2 = NULL;
8880   Py_ssize_t __pyx_t_3;
8881   PyObject *(*__pyx_t_4)(PyObject *);
8882   PyObject *__pyx_t_5 = NULL;
8883   Py_ssize_t __pyx_t_6;
8884   char *__pyx_t_7;
8885   int __pyx_lineno = 0;
8886   const char *__pyx_filename = NULL;
8887   int __pyx_clineno = 0;
8888   __Pyx_RefNannySetupContext("get_item_pointer", 0);
8889 
8890   /* "View.MemoryView":395
8891  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
8892  *         cdef Py_ssize_t dim
8893  *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
8894  *
8895  *         for dim, idx in enumerate(index):
8896  */
8897   __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
8898 
8899   /* "View.MemoryView":397
8900  *         cdef char *itemp = <char *> self.view.buf
8901  *
8902  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
8903  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
8904  *
8905  */
8906   __pyx_t_1 = 0;
8907   if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
8908     __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
8909     __pyx_t_4 = NULL;
8910   } else {
8911     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error)
8912     __Pyx_GOTREF(__pyx_t_2);
8913     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error)
8914   }
8915   for (;;) {
8916     if (likely(!__pyx_t_4)) {
8917       if (likely(PyList_CheckExact(__pyx_t_2))) {
8918         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
8919         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8920         __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
8921         #else
8922         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
8923         __Pyx_GOTREF(__pyx_t_5);
8924         #endif
8925       } else {
8926         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
8927         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8928         __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
8929         #else
8930         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
8931         __Pyx_GOTREF(__pyx_t_5);
8932         #endif
8933       }
8934     } else {
8935       __pyx_t_5 = __pyx_t_4(__pyx_t_2);
8936       if (unlikely(!__pyx_t_5)) {
8937         PyObject* exc_type = PyErr_Occurred();
8938         if (exc_type) {
8939           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8940           else __PYX_ERR(2, 397, __pyx_L1_error)
8941         }
8942         break;
8943       }
8944       __Pyx_GOTREF(__pyx_t_5);
8945     }
8946     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
8947     __pyx_t_5 = 0;
8948     __pyx_v_dim = __pyx_t_1;
8949     __pyx_t_1 = (__pyx_t_1 + 1);
8950 
8951     /* "View.MemoryView":398
8952  *
8953  *         for dim, idx in enumerate(index):
8954  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
8955  *
8956  *         return itemp
8957  */
8958     __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 398, __pyx_L1_error)
8959     __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 398, __pyx_L1_error)
8960     __pyx_v_itemp = __pyx_t_7;
8961 
8962     /* "View.MemoryView":397
8963  *         cdef char *itemp = <char *> self.view.buf
8964  *
8965  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
8966  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
8967  *
8968  */
8969   }
8970   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8971 
8972   /* "View.MemoryView":400
8973  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
8974  *
8975  *         return itemp             # <<<<<<<<<<<<<<
8976  *
8977  *
8978  */
8979   __pyx_r = __pyx_v_itemp;
8980   goto __pyx_L0;
8981 
8982   /* "View.MemoryView":393
8983  *                 PyThread_free_lock(self.lock)
8984  *
8985  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
8986  *         cdef Py_ssize_t dim
8987  *         cdef char *itemp = <char *> self.view.buf
8988  */
8989 
8990   /* function exit code */
8991   __pyx_L1_error:;
8992   __Pyx_XDECREF(__pyx_t_2);
8993   __Pyx_XDECREF(__pyx_t_5);
8994   __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8995   __pyx_r = NULL;
8996   __pyx_L0:;
8997   __Pyx_XDECREF(__pyx_v_idx);
8998   __Pyx_RefNannyFinishContext();
8999   return __pyx_r;
9000 }
9001 
9002 /* "View.MemoryView":403
9003  *
9004  *
9005  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
9006  *         if index is Ellipsis:
9007  *             return self
9008  */
9009 
9010 /* Python wrapper */
9011 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)9012 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
9013   PyObject *__pyx_r = 0;
9014   __Pyx_RefNannyDeclarations
9015   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
9016   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
9017 
9018   /* function exit code */
9019   __Pyx_RefNannyFinishContext();
9020   return __pyx_r;
9021 }
9022 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)9023 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
9024   PyObject *__pyx_v_have_slices = NULL;
9025   PyObject *__pyx_v_indices = NULL;
9026   char *__pyx_v_itemp;
9027   PyObject *__pyx_r = NULL;
9028   __Pyx_RefNannyDeclarations
9029   int __pyx_t_1;
9030   int __pyx_t_2;
9031   PyObject *__pyx_t_3 = NULL;
9032   PyObject *__pyx_t_4 = NULL;
9033   PyObject *__pyx_t_5 = NULL;
9034   char *__pyx_t_6;
9035   int __pyx_lineno = 0;
9036   const char *__pyx_filename = NULL;
9037   int __pyx_clineno = 0;
9038   __Pyx_RefNannySetupContext("__getitem__", 0);
9039 
9040   /* "View.MemoryView":404
9041  *
9042  *     def __getitem__(memoryview self, object index):
9043  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
9044  *             return self
9045  *
9046  */
9047   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
9048   __pyx_t_2 = (__pyx_t_1 != 0);
9049   if (__pyx_t_2) {
9050 
9051     /* "View.MemoryView":405
9052  *     def __getitem__(memoryview self, object index):
9053  *         if index is Ellipsis:
9054  *             return self             # <<<<<<<<<<<<<<
9055  *
9056  *         have_slices, indices = _unellipsify(index, self.view.ndim)
9057  */
9058     __Pyx_XDECREF(__pyx_r);
9059     __Pyx_INCREF(((PyObject *)__pyx_v_self));
9060     __pyx_r = ((PyObject *)__pyx_v_self);
9061     goto __pyx_L0;
9062 
9063     /* "View.MemoryView":404
9064  *
9065  *     def __getitem__(memoryview self, object index):
9066  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
9067  *             return self
9068  *
9069  */
9070   }
9071 
9072   /* "View.MemoryView":407
9073  *             return self
9074  *
9075  *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
9076  *
9077  *         cdef char *itemp
9078  */
9079   __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error)
9080   __Pyx_GOTREF(__pyx_t_3);
9081   if (likely(__pyx_t_3 != Py_None)) {
9082     PyObject* sequence = __pyx_t_3;
9083     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
9084     if (unlikely(size != 2)) {
9085       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
9086       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
9087       __PYX_ERR(2, 407, __pyx_L1_error)
9088     }
9089     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9090     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
9091     __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
9092     __Pyx_INCREF(__pyx_t_4);
9093     __Pyx_INCREF(__pyx_t_5);
9094     #else
9095     __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error)
9096     __Pyx_GOTREF(__pyx_t_4);
9097     __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error)
9098     __Pyx_GOTREF(__pyx_t_5);
9099     #endif
9100     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9101   } else {
9102     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error)
9103   }
9104   __pyx_v_have_slices = __pyx_t_4;
9105   __pyx_t_4 = 0;
9106   __pyx_v_indices = __pyx_t_5;
9107   __pyx_t_5 = 0;
9108 
9109   /* "View.MemoryView":410
9110  *
9111  *         cdef char *itemp
9112  *         if have_slices:             # <<<<<<<<<<<<<<
9113  *             return memview_slice(self, indices)
9114  *         else:
9115  */
9116   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error)
9117   if (__pyx_t_2) {
9118 
9119     /* "View.MemoryView":411
9120  *         cdef char *itemp
9121  *         if have_slices:
9122  *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
9123  *         else:
9124  *             itemp = self.get_item_pointer(indices)
9125  */
9126     __Pyx_XDECREF(__pyx_r);
9127     __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 411, __pyx_L1_error)
9128     __Pyx_GOTREF(__pyx_t_3);
9129     __pyx_r = __pyx_t_3;
9130     __pyx_t_3 = 0;
9131     goto __pyx_L0;
9132 
9133     /* "View.MemoryView":410
9134  *
9135  *         cdef char *itemp
9136  *         if have_slices:             # <<<<<<<<<<<<<<
9137  *             return memview_slice(self, indices)
9138  *         else:
9139  */
9140   }
9141 
9142   /* "View.MemoryView":413
9143  *             return memview_slice(self, indices)
9144  *         else:
9145  *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
9146  *             return self.convert_item_to_object(itemp)
9147  *
9148  */
9149   /*else*/ {
9150     __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 413, __pyx_L1_error)
9151     __pyx_v_itemp = __pyx_t_6;
9152 
9153     /* "View.MemoryView":414
9154  *         else:
9155  *             itemp = self.get_item_pointer(indices)
9156  *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
9157  *
9158  *     def __setitem__(memoryview self, object index, object value):
9159  */
9160     __Pyx_XDECREF(__pyx_r);
9161     __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 414, __pyx_L1_error)
9162     __Pyx_GOTREF(__pyx_t_3);
9163     __pyx_r = __pyx_t_3;
9164     __pyx_t_3 = 0;
9165     goto __pyx_L0;
9166   }
9167 
9168   /* "View.MemoryView":403
9169  *
9170  *
9171  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
9172  *         if index is Ellipsis:
9173  *             return self
9174  */
9175 
9176   /* function exit code */
9177   __pyx_L1_error:;
9178   __Pyx_XDECREF(__pyx_t_3);
9179   __Pyx_XDECREF(__pyx_t_4);
9180   __Pyx_XDECREF(__pyx_t_5);
9181   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9182   __pyx_r = NULL;
9183   __pyx_L0:;
9184   __Pyx_XDECREF(__pyx_v_have_slices);
9185   __Pyx_XDECREF(__pyx_v_indices);
9186   __Pyx_XGIVEREF(__pyx_r);
9187   __Pyx_RefNannyFinishContext();
9188   return __pyx_r;
9189 }
9190 
9191 /* "View.MemoryView":416
9192  *             return self.convert_item_to_object(itemp)
9193  *
9194  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
9195  *         if self.view.readonly:
9196  *             raise TypeError("Cannot assign to read-only memoryview")
9197  */
9198 
9199 /* Python wrapper */
9200 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)9201 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
9202   int __pyx_r;
9203   __Pyx_RefNannyDeclarations
9204   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
9205   __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));
9206 
9207   /* function exit code */
9208   __Pyx_RefNannyFinishContext();
9209   return __pyx_r;
9210 }
9211 
__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)9212 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) {
9213   PyObject *__pyx_v_have_slices = NULL;
9214   PyObject *__pyx_v_obj = NULL;
9215   int __pyx_r;
9216   __Pyx_RefNannyDeclarations
9217   int __pyx_t_1;
9218   PyObject *__pyx_t_2 = NULL;
9219   PyObject *__pyx_t_3 = NULL;
9220   PyObject *__pyx_t_4 = NULL;
9221   int __pyx_lineno = 0;
9222   const char *__pyx_filename = NULL;
9223   int __pyx_clineno = 0;
9224   __Pyx_RefNannySetupContext("__setitem__", 0);
9225   __Pyx_INCREF(__pyx_v_index);
9226 
9227   /* "View.MemoryView":417
9228  *
9229  *     def __setitem__(memoryview self, object index, object value):
9230  *         if self.view.readonly:             # <<<<<<<<<<<<<<
9231  *             raise TypeError("Cannot assign to read-only memoryview")
9232  *
9233  */
9234   __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
9235   if (unlikely(__pyx_t_1)) {
9236 
9237     /* "View.MemoryView":418
9238  *     def __setitem__(memoryview self, object index, object value):
9239  *         if self.view.readonly:
9240  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
9241  *
9242  *         have_slices, index = _unellipsify(index, self.view.ndim)
9243  */
9244     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error)
9245     __Pyx_GOTREF(__pyx_t_2);
9246     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9247     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9248     __PYX_ERR(2, 418, __pyx_L1_error)
9249 
9250     /* "View.MemoryView":417
9251  *
9252  *     def __setitem__(memoryview self, object index, object value):
9253  *         if self.view.readonly:             # <<<<<<<<<<<<<<
9254  *             raise TypeError("Cannot assign to read-only memoryview")
9255  *
9256  */
9257   }
9258 
9259   /* "View.MemoryView":420
9260  *             raise TypeError("Cannot assign to read-only memoryview")
9261  *
9262  *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
9263  *
9264  *         if have_slices:
9265  */
9266   __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
9267   __Pyx_GOTREF(__pyx_t_2);
9268   if (likely(__pyx_t_2 != Py_None)) {
9269     PyObject* sequence = __pyx_t_2;
9270     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
9271     if (unlikely(size != 2)) {
9272       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
9273       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
9274       __PYX_ERR(2, 420, __pyx_L1_error)
9275     }
9276     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9277     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
9278     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
9279     __Pyx_INCREF(__pyx_t_3);
9280     __Pyx_INCREF(__pyx_t_4);
9281     #else
9282     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error)
9283     __Pyx_GOTREF(__pyx_t_3);
9284     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error)
9285     __Pyx_GOTREF(__pyx_t_4);
9286     #endif
9287     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9288   } else {
9289     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error)
9290   }
9291   __pyx_v_have_slices = __pyx_t_3;
9292   __pyx_t_3 = 0;
9293   __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
9294   __pyx_t_4 = 0;
9295 
9296   /* "View.MemoryView":422
9297  *         have_slices, index = _unellipsify(index, self.view.ndim)
9298  *
9299  *         if have_slices:             # <<<<<<<<<<<<<<
9300  *             obj = self.is_slice(value)
9301  *             if obj:
9302  */
9303   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error)
9304   if (__pyx_t_1) {
9305 
9306     /* "View.MemoryView":423
9307  *
9308  *         if have_slices:
9309  *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
9310  *             if obj:
9311  *                 self.setitem_slice_assignment(self[index], obj)
9312  */
9313     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 423, __pyx_L1_error)
9314     __Pyx_GOTREF(__pyx_t_2);
9315     __pyx_v_obj = __pyx_t_2;
9316     __pyx_t_2 = 0;
9317 
9318     /* "View.MemoryView":424
9319  *         if have_slices:
9320  *             obj = self.is_slice(value)
9321  *             if obj:             # <<<<<<<<<<<<<<
9322  *                 self.setitem_slice_assignment(self[index], obj)
9323  *             else:
9324  */
9325     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
9326     if (__pyx_t_1) {
9327 
9328       /* "View.MemoryView":425
9329  *             obj = self.is_slice(value)
9330  *             if obj:
9331  *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
9332  *             else:
9333  *                 self.setitem_slice_assign_scalar(self[index], value)
9334  */
9335       __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error)
9336       __Pyx_GOTREF(__pyx_t_2);
9337       __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 425, __pyx_L1_error)
9338       __Pyx_GOTREF(__pyx_t_4);
9339       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9340       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9341 
9342       /* "View.MemoryView":424
9343  *         if have_slices:
9344  *             obj = self.is_slice(value)
9345  *             if obj:             # <<<<<<<<<<<<<<
9346  *                 self.setitem_slice_assignment(self[index], obj)
9347  *             else:
9348  */
9349       goto __pyx_L5;
9350     }
9351 
9352     /* "View.MemoryView":427
9353  *                 self.setitem_slice_assignment(self[index], obj)
9354  *             else:
9355  *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
9356  *         else:
9357  *             self.setitem_indexed(index, value)
9358  */
9359     /*else*/ {
9360       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error)
9361       __Pyx_GOTREF(__pyx_t_4);
9362       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error)
9363       __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error)
9364       __Pyx_GOTREF(__pyx_t_2);
9365       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9366       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9367     }
9368     __pyx_L5:;
9369 
9370     /* "View.MemoryView":422
9371  *         have_slices, index = _unellipsify(index, self.view.ndim)
9372  *
9373  *         if have_slices:             # <<<<<<<<<<<<<<
9374  *             obj = self.is_slice(value)
9375  *             if obj:
9376  */
9377     goto __pyx_L4;
9378   }
9379 
9380   /* "View.MemoryView":429
9381  *                 self.setitem_slice_assign_scalar(self[index], value)
9382  *         else:
9383  *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
9384  *
9385  *     cdef is_slice(self, obj):
9386  */
9387   /*else*/ {
9388     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error)
9389     __Pyx_GOTREF(__pyx_t_2);
9390     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9391   }
9392   __pyx_L4:;
9393 
9394   /* "View.MemoryView":416
9395  *             return self.convert_item_to_object(itemp)
9396  *
9397  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
9398  *         if self.view.readonly:
9399  *             raise TypeError("Cannot assign to read-only memoryview")
9400  */
9401 
9402   /* function exit code */
9403   __pyx_r = 0;
9404   goto __pyx_L0;
9405   __pyx_L1_error:;
9406   __Pyx_XDECREF(__pyx_t_2);
9407   __Pyx_XDECREF(__pyx_t_3);
9408   __Pyx_XDECREF(__pyx_t_4);
9409   __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9410   __pyx_r = -1;
9411   __pyx_L0:;
9412   __Pyx_XDECREF(__pyx_v_have_slices);
9413   __Pyx_XDECREF(__pyx_v_obj);
9414   __Pyx_XDECREF(__pyx_v_index);
9415   __Pyx_RefNannyFinishContext();
9416   return __pyx_r;
9417 }
9418 
9419 /* "View.MemoryView":431
9420  *             self.setitem_indexed(index, value)
9421  *
9422  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
9423  *         if not isinstance(obj, memoryview):
9424  *             try:
9425  */
9426 
__pyx_memoryview_is_slice(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj)9427 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
9428   PyObject *__pyx_r = NULL;
9429   __Pyx_RefNannyDeclarations
9430   int __pyx_t_1;
9431   int __pyx_t_2;
9432   PyObject *__pyx_t_3 = NULL;
9433   PyObject *__pyx_t_4 = NULL;
9434   PyObject *__pyx_t_5 = NULL;
9435   PyObject *__pyx_t_6 = NULL;
9436   PyObject *__pyx_t_7 = NULL;
9437   PyObject *__pyx_t_8 = NULL;
9438   int __pyx_t_9;
9439   int __pyx_lineno = 0;
9440   const char *__pyx_filename = NULL;
9441   int __pyx_clineno = 0;
9442   __Pyx_RefNannySetupContext("is_slice", 0);
9443   __Pyx_INCREF(__pyx_v_obj);
9444 
9445   /* "View.MemoryView":432
9446  *
9447  *     cdef is_slice(self, obj):
9448  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
9449  *             try:
9450  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
9451  */
9452   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
9453   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
9454   if (__pyx_t_2) {
9455 
9456     /* "View.MemoryView":433
9457  *     cdef is_slice(self, obj):
9458  *         if not isinstance(obj, memoryview):
9459  *             try:             # <<<<<<<<<<<<<<
9460  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
9461  *                                  self.dtype_is_object)
9462  */
9463     {
9464       __Pyx_PyThreadState_declare
9465       __Pyx_PyThreadState_assign
9466       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
9467       __Pyx_XGOTREF(__pyx_t_3);
9468       __Pyx_XGOTREF(__pyx_t_4);
9469       __Pyx_XGOTREF(__pyx_t_5);
9470       /*try:*/ {
9471 
9472         /* "View.MemoryView":434
9473  *         if not isinstance(obj, memoryview):
9474  *             try:
9475  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
9476  *                                  self.dtype_is_object)
9477  *             except TypeError:
9478  */
9479         __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 434, __pyx_L4_error)
9480         __Pyx_GOTREF(__pyx_t_6);
9481 
9482         /* "View.MemoryView":435
9483  *             try:
9484  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
9485  *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
9486  *             except TypeError:
9487  *                 return None
9488  */
9489         __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error)
9490         __Pyx_GOTREF(__pyx_t_7);
9491 
9492         /* "View.MemoryView":434
9493  *         if not isinstance(obj, memoryview):
9494  *             try:
9495  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
9496  *                                  self.dtype_is_object)
9497  *             except TypeError:
9498  */
9499         __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error)
9500         __Pyx_GOTREF(__pyx_t_8);
9501         __Pyx_INCREF(__pyx_v_obj);
9502         __Pyx_GIVEREF(__pyx_v_obj);
9503         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
9504         __Pyx_GIVEREF(__pyx_t_6);
9505         PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
9506         __Pyx_GIVEREF(__pyx_t_7);
9507         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
9508         __pyx_t_6 = 0;
9509         __pyx_t_7 = 0;
9510         __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 434, __pyx_L4_error)
9511         __Pyx_GOTREF(__pyx_t_7);
9512         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9513         __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
9514         __pyx_t_7 = 0;
9515 
9516         /* "View.MemoryView":433
9517  *     cdef is_slice(self, obj):
9518  *         if not isinstance(obj, memoryview):
9519  *             try:             # <<<<<<<<<<<<<<
9520  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
9521  *                                  self.dtype_is_object)
9522  */
9523       }
9524       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9525       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9526       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9527       goto __pyx_L9_try_end;
9528       __pyx_L4_error:;
9529       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9530       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9531       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9532 
9533       /* "View.MemoryView":436
9534  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
9535  *                                  self.dtype_is_object)
9536  *             except TypeError:             # <<<<<<<<<<<<<<
9537  *                 return None
9538  *
9539  */
9540       __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
9541       if (__pyx_t_9) {
9542         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
9543         if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error)
9544         __Pyx_GOTREF(__pyx_t_7);
9545         __Pyx_GOTREF(__pyx_t_8);
9546         __Pyx_GOTREF(__pyx_t_6);
9547 
9548         /* "View.MemoryView":437
9549  *                                  self.dtype_is_object)
9550  *             except TypeError:
9551  *                 return None             # <<<<<<<<<<<<<<
9552  *
9553  *         return obj
9554  */
9555         __Pyx_XDECREF(__pyx_r);
9556         __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9557         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9558         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9559         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9560         goto __pyx_L7_except_return;
9561       }
9562       goto __pyx_L6_except_error;
9563       __pyx_L6_except_error:;
9564 
9565       /* "View.MemoryView":433
9566  *     cdef is_slice(self, obj):
9567  *         if not isinstance(obj, memoryview):
9568  *             try:             # <<<<<<<<<<<<<<
9569  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
9570  *                                  self.dtype_is_object)
9571  */
9572       __Pyx_XGIVEREF(__pyx_t_3);
9573       __Pyx_XGIVEREF(__pyx_t_4);
9574       __Pyx_XGIVEREF(__pyx_t_5);
9575       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
9576       goto __pyx_L1_error;
9577       __pyx_L7_except_return:;
9578       __Pyx_XGIVEREF(__pyx_t_3);
9579       __Pyx_XGIVEREF(__pyx_t_4);
9580       __Pyx_XGIVEREF(__pyx_t_5);
9581       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
9582       goto __pyx_L0;
9583       __pyx_L9_try_end:;
9584     }
9585 
9586     /* "View.MemoryView":432
9587  *
9588  *     cdef is_slice(self, obj):
9589  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
9590  *             try:
9591  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
9592  */
9593   }
9594 
9595   /* "View.MemoryView":439
9596  *                 return None
9597  *
9598  *         return obj             # <<<<<<<<<<<<<<
9599  *
9600  *     cdef setitem_slice_assignment(self, dst, src):
9601  */
9602   __Pyx_XDECREF(__pyx_r);
9603   __Pyx_INCREF(__pyx_v_obj);
9604   __pyx_r = __pyx_v_obj;
9605   goto __pyx_L0;
9606 
9607   /* "View.MemoryView":431
9608  *             self.setitem_indexed(index, value)
9609  *
9610  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
9611  *         if not isinstance(obj, memoryview):
9612  *             try:
9613  */
9614 
9615   /* function exit code */
9616   __pyx_L1_error:;
9617   __Pyx_XDECREF(__pyx_t_6);
9618   __Pyx_XDECREF(__pyx_t_7);
9619   __Pyx_XDECREF(__pyx_t_8);
9620   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
9621   __pyx_r = 0;
9622   __pyx_L0:;
9623   __Pyx_XDECREF(__pyx_v_obj);
9624   __Pyx_XGIVEREF(__pyx_r);
9625   __Pyx_RefNannyFinishContext();
9626   return __pyx_r;
9627 }
9628 
9629 /* "View.MemoryView":441
9630  *         return obj
9631  *
9632  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
9633  *         cdef __Pyx_memviewslice dst_slice
9634  *         cdef __Pyx_memviewslice src_slice
9635  */
9636 
__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_dst,PyObject * __pyx_v_src)9637 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
9638   __Pyx_memviewslice __pyx_v_dst_slice;
9639   __Pyx_memviewslice __pyx_v_src_slice;
9640   PyObject *__pyx_r = NULL;
9641   __Pyx_RefNannyDeclarations
9642   __Pyx_memviewslice *__pyx_t_1;
9643   __Pyx_memviewslice *__pyx_t_2;
9644   PyObject *__pyx_t_3 = NULL;
9645   int __pyx_t_4;
9646   int __pyx_t_5;
9647   int __pyx_t_6;
9648   int __pyx_lineno = 0;
9649   const char *__pyx_filename = NULL;
9650   int __pyx_clineno = 0;
9651   __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
9652 
9653   /* "View.MemoryView":445
9654  *         cdef __Pyx_memviewslice src_slice
9655  *
9656  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
9657  *                                  get_slice_from_memview(dst, &dst_slice)[0],
9658  *                                  src.ndim, dst.ndim, self.dtype_is_object)
9659  */
9660   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error)
9661   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 445, __pyx_L1_error)
9662 
9663   /* "View.MemoryView":446
9664  *
9665  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
9666  *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
9667  *                                  src.ndim, dst.ndim, self.dtype_is_object)
9668  *
9669  */
9670   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error)
9671   __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 446, __pyx_L1_error)
9672 
9673   /* "View.MemoryView":447
9674  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
9675  *                                  get_slice_from_memview(dst, &dst_slice)[0],
9676  *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
9677  *
9678  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
9679  */
9680   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
9681   __Pyx_GOTREF(__pyx_t_3);
9682   __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
9683   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9684   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
9685   __Pyx_GOTREF(__pyx_t_3);
9686   __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
9687   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9688 
9689   /* "View.MemoryView":445
9690  *         cdef __Pyx_memviewslice src_slice
9691  *
9692  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
9693  *                                  get_slice_from_memview(dst, &dst_slice)[0],
9694  *                                  src.ndim, dst.ndim, self.dtype_is_object)
9695  */
9696   __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 445, __pyx_L1_error)
9697 
9698   /* "View.MemoryView":441
9699  *         return obj
9700  *
9701  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
9702  *         cdef __Pyx_memviewslice dst_slice
9703  *         cdef __Pyx_memviewslice src_slice
9704  */
9705 
9706   /* function exit code */
9707   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9708   goto __pyx_L0;
9709   __pyx_L1_error:;
9710   __Pyx_XDECREF(__pyx_t_3);
9711   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
9712   __pyx_r = 0;
9713   __pyx_L0:;
9714   __Pyx_XGIVEREF(__pyx_r);
9715   __Pyx_RefNannyFinishContext();
9716   return __pyx_r;
9717 }
9718 
9719 /* "View.MemoryView":449
9720  *                                  src.ndim, dst.ndim, self.dtype_is_object)
9721  *
9722  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
9723  *         cdef int array[128]
9724  *         cdef void *tmp = NULL
9725  */
9726 
__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj * __pyx_v_self,struct __pyx_memoryview_obj * __pyx_v_dst,PyObject * __pyx_v_value)9727 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) {
9728   int __pyx_v_array[0x80];
9729   void *__pyx_v_tmp;
9730   void *__pyx_v_item;
9731   __Pyx_memviewslice *__pyx_v_dst_slice;
9732   __Pyx_memviewslice __pyx_v_tmp_slice;
9733   PyObject *__pyx_r = NULL;
9734   __Pyx_RefNannyDeclarations
9735   __Pyx_memviewslice *__pyx_t_1;
9736   int __pyx_t_2;
9737   PyObject *__pyx_t_3 = NULL;
9738   int __pyx_t_4;
9739   int __pyx_t_5;
9740   char const *__pyx_t_6;
9741   PyObject *__pyx_t_7 = NULL;
9742   PyObject *__pyx_t_8 = NULL;
9743   PyObject *__pyx_t_9 = NULL;
9744   PyObject *__pyx_t_10 = NULL;
9745   PyObject *__pyx_t_11 = NULL;
9746   PyObject *__pyx_t_12 = NULL;
9747   int __pyx_lineno = 0;
9748   const char *__pyx_filename = NULL;
9749   int __pyx_clineno = 0;
9750   __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
9751 
9752   /* "View.MemoryView":451
9753  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
9754  *         cdef int array[128]
9755  *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
9756  *         cdef void *item
9757  *
9758  */
9759   __pyx_v_tmp = NULL;
9760 
9761   /* "View.MemoryView":456
9762  *         cdef __Pyx_memviewslice *dst_slice
9763  *         cdef __Pyx_memviewslice tmp_slice
9764  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
9765  *
9766  *         if <size_t>self.view.itemsize > sizeof(array):
9767  */
9768   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 456, __pyx_L1_error)
9769   __pyx_v_dst_slice = __pyx_t_1;
9770 
9771   /* "View.MemoryView":458
9772  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
9773  *
9774  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
9775  *             tmp = PyMem_Malloc(self.view.itemsize)
9776  *             if tmp == NULL:
9777  */
9778   __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
9779   if (__pyx_t_2) {
9780 
9781     /* "View.MemoryView":459
9782  *
9783  *         if <size_t>self.view.itemsize > sizeof(array):
9784  *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
9785  *             if tmp == NULL:
9786  *                 raise MemoryError
9787  */
9788     __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
9789 
9790     /* "View.MemoryView":460
9791  *         if <size_t>self.view.itemsize > sizeof(array):
9792  *             tmp = PyMem_Malloc(self.view.itemsize)
9793  *             if tmp == NULL:             # <<<<<<<<<<<<<<
9794  *                 raise MemoryError
9795  *             item = tmp
9796  */
9797     __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
9798     if (unlikely(__pyx_t_2)) {
9799 
9800       /* "View.MemoryView":461
9801  *             tmp = PyMem_Malloc(self.view.itemsize)
9802  *             if tmp == NULL:
9803  *                 raise MemoryError             # <<<<<<<<<<<<<<
9804  *             item = tmp
9805  *         else:
9806  */
9807       PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error)
9808 
9809       /* "View.MemoryView":460
9810  *         if <size_t>self.view.itemsize > sizeof(array):
9811  *             tmp = PyMem_Malloc(self.view.itemsize)
9812  *             if tmp == NULL:             # <<<<<<<<<<<<<<
9813  *                 raise MemoryError
9814  *             item = tmp
9815  */
9816     }
9817 
9818     /* "View.MemoryView":462
9819  *             if tmp == NULL:
9820  *                 raise MemoryError
9821  *             item = tmp             # <<<<<<<<<<<<<<
9822  *         else:
9823  *             item = <void *> array
9824  */
9825     __pyx_v_item = __pyx_v_tmp;
9826 
9827     /* "View.MemoryView":458
9828  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
9829  *
9830  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
9831  *             tmp = PyMem_Malloc(self.view.itemsize)
9832  *             if tmp == NULL:
9833  */
9834     goto __pyx_L3;
9835   }
9836 
9837   /* "View.MemoryView":464
9838  *             item = tmp
9839  *         else:
9840  *             item = <void *> array             # <<<<<<<<<<<<<<
9841  *
9842  *         try:
9843  */
9844   /*else*/ {
9845     __pyx_v_item = ((void *)__pyx_v_array);
9846   }
9847   __pyx_L3:;
9848 
9849   /* "View.MemoryView":466
9850  *             item = <void *> array
9851  *
9852  *         try:             # <<<<<<<<<<<<<<
9853  *             if self.dtype_is_object:
9854  *                 (<PyObject **> item)[0] = <PyObject *> value
9855  */
9856   /*try:*/ {
9857 
9858     /* "View.MemoryView":467
9859  *
9860  *         try:
9861  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
9862  *                 (<PyObject **> item)[0] = <PyObject *> value
9863  *             else:
9864  */
9865     __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
9866     if (__pyx_t_2) {
9867 
9868       /* "View.MemoryView":468
9869  *         try:
9870  *             if self.dtype_is_object:
9871  *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
9872  *             else:
9873  *                 self.assign_item_from_object(<char *> item, value)
9874  */
9875       (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
9876 
9877       /* "View.MemoryView":467
9878  *
9879  *         try:
9880  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
9881  *                 (<PyObject **> item)[0] = <PyObject *> value
9882  *             else:
9883  */
9884       goto __pyx_L8;
9885     }
9886 
9887     /* "View.MemoryView":470
9888  *                 (<PyObject **> item)[0] = <PyObject *> value
9889  *             else:
9890  *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
9891  *
9892  *
9893  */
9894     /*else*/ {
9895       __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 470, __pyx_L6_error)
9896       __Pyx_GOTREF(__pyx_t_3);
9897       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9898     }
9899     __pyx_L8:;
9900 
9901     /* "View.MemoryView":474
9902  *
9903  *
9904  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
9905  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
9906  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
9907  */
9908     __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
9909     if (__pyx_t_2) {
9910 
9911       /* "View.MemoryView":475
9912  *
9913  *             if self.view.suboffsets != NULL:
9914  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
9915  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
9916  *                                 item, self.dtype_is_object)
9917  */
9918       __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 475, __pyx_L6_error)
9919       __Pyx_GOTREF(__pyx_t_3);
9920       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9921 
9922       /* "View.MemoryView":474
9923  *
9924  *
9925  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
9926  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
9927  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
9928  */
9929     }
9930 
9931     /* "View.MemoryView":476
9932  *             if self.view.suboffsets != NULL:
9933  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
9934  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
9935  *                                 item, self.dtype_is_object)
9936  *         finally:
9937  */
9938     __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);
9939   }
9940 
9941   /* "View.MemoryView":479
9942  *                                 item, self.dtype_is_object)
9943  *         finally:
9944  *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
9945  *
9946  *     cdef setitem_indexed(self, index, value):
9947  */
9948   /*finally:*/ {
9949     /*normal exit:*/{
9950       PyMem_Free(__pyx_v_tmp);
9951       goto __pyx_L7;
9952     }
9953     __pyx_L6_error:;
9954     /*exception exit:*/{
9955       __Pyx_PyThreadState_declare
9956       __Pyx_PyThreadState_assign
9957       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
9958       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9959       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
9960       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);
9961       __Pyx_XGOTREF(__pyx_t_7);
9962       __Pyx_XGOTREF(__pyx_t_8);
9963       __Pyx_XGOTREF(__pyx_t_9);
9964       __Pyx_XGOTREF(__pyx_t_10);
9965       __Pyx_XGOTREF(__pyx_t_11);
9966       __Pyx_XGOTREF(__pyx_t_12);
9967       __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
9968       {
9969         PyMem_Free(__pyx_v_tmp);
9970       }
9971       if (PY_MAJOR_VERSION >= 3) {
9972         __Pyx_XGIVEREF(__pyx_t_10);
9973         __Pyx_XGIVEREF(__pyx_t_11);
9974         __Pyx_XGIVEREF(__pyx_t_12);
9975         __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
9976       }
9977       __Pyx_XGIVEREF(__pyx_t_7);
9978       __Pyx_XGIVEREF(__pyx_t_8);
9979       __Pyx_XGIVEREF(__pyx_t_9);
9980       __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
9981       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
9982       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
9983       goto __pyx_L1_error;
9984     }
9985     __pyx_L7:;
9986   }
9987 
9988   /* "View.MemoryView":449
9989  *                                  src.ndim, dst.ndim, self.dtype_is_object)
9990  *
9991  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
9992  *         cdef int array[128]
9993  *         cdef void *tmp = NULL
9994  */
9995 
9996   /* function exit code */
9997   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9998   goto __pyx_L0;
9999   __pyx_L1_error:;
10000   __Pyx_XDECREF(__pyx_t_3);
10001   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
10002   __pyx_r = 0;
10003   __pyx_L0:;
10004   __Pyx_XGIVEREF(__pyx_r);
10005   __Pyx_RefNannyFinishContext();
10006   return __pyx_r;
10007 }
10008 
10009 /* "View.MemoryView":481
10010  *             PyMem_Free(tmp)
10011  *
10012  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
10013  *         cdef char *itemp = self.get_item_pointer(index)
10014  *         self.assign_item_from_object(itemp, value)
10015  */
10016 
__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)10017 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10018   char *__pyx_v_itemp;
10019   PyObject *__pyx_r = NULL;
10020   __Pyx_RefNannyDeclarations
10021   char *__pyx_t_1;
10022   PyObject *__pyx_t_2 = NULL;
10023   int __pyx_lineno = 0;
10024   const char *__pyx_filename = NULL;
10025   int __pyx_clineno = 0;
10026   __Pyx_RefNannySetupContext("setitem_indexed", 0);
10027 
10028   /* "View.MemoryView":482
10029  *
10030  *     cdef setitem_indexed(self, index, value):
10031  *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
10032  *         self.assign_item_from_object(itemp, value)
10033  *
10034  */
10035   __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 482, __pyx_L1_error)
10036   __pyx_v_itemp = __pyx_t_1;
10037 
10038   /* "View.MemoryView":483
10039  *     cdef setitem_indexed(self, index, value):
10040  *         cdef char *itemp = self.get_item_pointer(index)
10041  *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
10042  *
10043  *     cdef convert_item_to_object(self, char *itemp):
10044  */
10045   __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 483, __pyx_L1_error)
10046   __Pyx_GOTREF(__pyx_t_2);
10047   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10048 
10049   /* "View.MemoryView":481
10050  *             PyMem_Free(tmp)
10051  *
10052  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
10053  *         cdef char *itemp = self.get_item_pointer(index)
10054  *         self.assign_item_from_object(itemp, value)
10055  */
10056 
10057   /* function exit code */
10058   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10059   goto __pyx_L0;
10060   __pyx_L1_error:;
10061   __Pyx_XDECREF(__pyx_t_2);
10062   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
10063   __pyx_r = 0;
10064   __pyx_L0:;
10065   __Pyx_XGIVEREF(__pyx_r);
10066   __Pyx_RefNannyFinishContext();
10067   return __pyx_r;
10068 }
10069 
10070 /* "View.MemoryView":485
10071  *         self.assign_item_from_object(itemp, value)
10072  *
10073  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
10074  *         """Only used if instantiated manually by the user, or if Cython doesn't
10075  *         know how to convert the type"""
10076  */
10077 
__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp)10078 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
10079   PyObject *__pyx_v_struct = NULL;
10080   PyObject *__pyx_v_bytesitem = 0;
10081   PyObject *__pyx_v_result = NULL;
10082   PyObject *__pyx_r = NULL;
10083   __Pyx_RefNannyDeclarations
10084   PyObject *__pyx_t_1 = NULL;
10085   PyObject *__pyx_t_2 = NULL;
10086   PyObject *__pyx_t_3 = NULL;
10087   PyObject *__pyx_t_4 = NULL;
10088   PyObject *__pyx_t_5 = NULL;
10089   PyObject *__pyx_t_6 = NULL;
10090   PyObject *__pyx_t_7 = NULL;
10091   int __pyx_t_8;
10092   PyObject *__pyx_t_9 = NULL;
10093   size_t __pyx_t_10;
10094   int __pyx_t_11;
10095   int __pyx_lineno = 0;
10096   const char *__pyx_filename = NULL;
10097   int __pyx_clineno = 0;
10098   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
10099 
10100   /* "View.MemoryView":488
10101  *         """Only used if instantiated manually by the user, or if Cython doesn't
10102  *         know how to convert the type"""
10103  *         import struct             # <<<<<<<<<<<<<<
10104  *         cdef bytes bytesitem
10105  *
10106  */
10107   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error)
10108   __Pyx_GOTREF(__pyx_t_1);
10109   __pyx_v_struct = __pyx_t_1;
10110   __pyx_t_1 = 0;
10111 
10112   /* "View.MemoryView":491
10113  *         cdef bytes bytesitem
10114  *
10115  *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
10116  *         try:
10117  *             result = struct.unpack(self.view.format, bytesitem)
10118  */
10119   __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 491, __pyx_L1_error)
10120   __Pyx_GOTREF(__pyx_t_1);
10121   __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
10122   __pyx_t_1 = 0;
10123 
10124   /* "View.MemoryView":492
10125  *
10126  *         bytesitem = itemp[:self.view.itemsize]
10127  *         try:             # <<<<<<<<<<<<<<
10128  *             result = struct.unpack(self.view.format, bytesitem)
10129  *         except struct.error:
10130  */
10131   {
10132     __Pyx_PyThreadState_declare
10133     __Pyx_PyThreadState_assign
10134     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
10135     __Pyx_XGOTREF(__pyx_t_2);
10136     __Pyx_XGOTREF(__pyx_t_3);
10137     __Pyx_XGOTREF(__pyx_t_4);
10138     /*try:*/ {
10139 
10140       /* "View.MemoryView":493
10141  *         bytesitem = itemp[:self.view.itemsize]
10142  *         try:
10143  *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
10144  *         except struct.error:
10145  *             raise ValueError("Unable to convert item to object")
10146  */
10147       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 493, __pyx_L3_error)
10148       __Pyx_GOTREF(__pyx_t_5);
10149       __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error)
10150       __Pyx_GOTREF(__pyx_t_6);
10151       __pyx_t_7 = NULL;
10152       __pyx_t_8 = 0;
10153       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
10154         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
10155         if (likely(__pyx_t_7)) {
10156           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
10157           __Pyx_INCREF(__pyx_t_7);
10158           __Pyx_INCREF(function);
10159           __Pyx_DECREF_SET(__pyx_t_5, function);
10160           __pyx_t_8 = 1;
10161         }
10162       }
10163       #if CYTHON_FAST_PYCALL
10164       if (PyFunction_Check(__pyx_t_5)) {
10165         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
10166         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
10167         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10168         __Pyx_GOTREF(__pyx_t_1);
10169         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10170       } else
10171       #endif
10172       #if CYTHON_FAST_PYCCALL
10173       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
10174         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
10175         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
10176         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10177         __Pyx_GOTREF(__pyx_t_1);
10178         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10179       } else
10180       #endif
10181       {
10182         __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error)
10183         __Pyx_GOTREF(__pyx_t_9);
10184         if (__pyx_t_7) {
10185           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
10186         }
10187         __Pyx_GIVEREF(__pyx_t_6);
10188         PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
10189         __Pyx_INCREF(__pyx_v_bytesitem);
10190         __Pyx_GIVEREF(__pyx_v_bytesitem);
10191         PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
10192         __pyx_t_6 = 0;
10193         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
10194         __Pyx_GOTREF(__pyx_t_1);
10195         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
10196       }
10197       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10198       __pyx_v_result = __pyx_t_1;
10199       __pyx_t_1 = 0;
10200 
10201       /* "View.MemoryView":492
10202  *
10203  *         bytesitem = itemp[:self.view.itemsize]
10204  *         try:             # <<<<<<<<<<<<<<
10205  *             result = struct.unpack(self.view.format, bytesitem)
10206  *         except struct.error:
10207  */
10208     }
10209 
10210     /* "View.MemoryView":497
10211  *             raise ValueError("Unable to convert item to object")
10212  *         else:
10213  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
10214  *                 return result[0]
10215  *             return result
10216  */
10217     /*else:*/ {
10218       __pyx_t_10 = strlen(__pyx_v_self->view.format);
10219       __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
10220       if (__pyx_t_11) {
10221 
10222         /* "View.MemoryView":498
10223  *         else:
10224  *             if len(self.view.format) == 1:
10225  *                 return result[0]             # <<<<<<<<<<<<<<
10226  *             return result
10227  *
10228  */
10229         __Pyx_XDECREF(__pyx_r);
10230         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 498, __pyx_L5_except_error)
10231         __Pyx_GOTREF(__pyx_t_1);
10232         __pyx_r = __pyx_t_1;
10233         __pyx_t_1 = 0;
10234         goto __pyx_L6_except_return;
10235 
10236         /* "View.MemoryView":497
10237  *             raise ValueError("Unable to convert item to object")
10238  *         else:
10239  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
10240  *                 return result[0]
10241  *             return result
10242  */
10243       }
10244 
10245       /* "View.MemoryView":499
10246  *             if len(self.view.format) == 1:
10247  *                 return result[0]
10248  *             return result             # <<<<<<<<<<<<<<
10249  *
10250  *     cdef assign_item_from_object(self, char *itemp, object value):
10251  */
10252       __Pyx_XDECREF(__pyx_r);
10253       __Pyx_INCREF(__pyx_v_result);
10254       __pyx_r = __pyx_v_result;
10255       goto __pyx_L6_except_return;
10256     }
10257     __pyx_L3_error:;
10258     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10259     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10260     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10261     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10262     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
10263 
10264     /* "View.MemoryView":494
10265  *         try:
10266  *             result = struct.unpack(self.view.format, bytesitem)
10267  *         except struct.error:             # <<<<<<<<<<<<<<
10268  *             raise ValueError("Unable to convert item to object")
10269  *         else:
10270  */
10271     __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
10272     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 494, __pyx_L5_except_error)
10273     __Pyx_GOTREF(__pyx_t_6);
10274     __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
10275     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10276     __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
10277     __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
10278     if (__pyx_t_8) {
10279       __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
10280       if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error)
10281       __Pyx_GOTREF(__pyx_t_9);
10282       __Pyx_GOTREF(__pyx_t_5);
10283       __Pyx_GOTREF(__pyx_t_1);
10284 
10285       /* "View.MemoryView":495
10286  *             result = struct.unpack(self.view.format, bytesitem)
10287  *         except struct.error:
10288  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
10289  *         else:
10290  *             if len(self.view.format) == 1:
10291  */
10292       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L5_except_error)
10293       __Pyx_GOTREF(__pyx_t_6);
10294       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
10295       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10296       __PYX_ERR(2, 495, __pyx_L5_except_error)
10297     }
10298     goto __pyx_L5_except_error;
10299     __pyx_L5_except_error:;
10300 
10301     /* "View.MemoryView":492
10302  *
10303  *         bytesitem = itemp[:self.view.itemsize]
10304  *         try:             # <<<<<<<<<<<<<<
10305  *             result = struct.unpack(self.view.format, bytesitem)
10306  *         except struct.error:
10307  */
10308     __Pyx_XGIVEREF(__pyx_t_2);
10309     __Pyx_XGIVEREF(__pyx_t_3);
10310     __Pyx_XGIVEREF(__pyx_t_4);
10311     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
10312     goto __pyx_L1_error;
10313     __pyx_L6_except_return:;
10314     __Pyx_XGIVEREF(__pyx_t_2);
10315     __Pyx_XGIVEREF(__pyx_t_3);
10316     __Pyx_XGIVEREF(__pyx_t_4);
10317     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
10318     goto __pyx_L0;
10319   }
10320 
10321   /* "View.MemoryView":485
10322  *         self.assign_item_from_object(itemp, value)
10323  *
10324  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
10325  *         """Only used if instantiated manually by the user, or if Cython doesn't
10326  *         know how to convert the type"""
10327  */
10328 
10329   /* function exit code */
10330   __pyx_L1_error:;
10331   __Pyx_XDECREF(__pyx_t_1);
10332   __Pyx_XDECREF(__pyx_t_5);
10333   __Pyx_XDECREF(__pyx_t_6);
10334   __Pyx_XDECREF(__pyx_t_7);
10335   __Pyx_XDECREF(__pyx_t_9);
10336   __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
10337   __pyx_r = 0;
10338   __pyx_L0:;
10339   __Pyx_XDECREF(__pyx_v_struct);
10340   __Pyx_XDECREF(__pyx_v_bytesitem);
10341   __Pyx_XDECREF(__pyx_v_result);
10342   __Pyx_XGIVEREF(__pyx_r);
10343   __Pyx_RefNannyFinishContext();
10344   return __pyx_r;
10345 }
10346 
10347 /* "View.MemoryView":501
10348  *             return result
10349  *
10350  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
10351  *         """Only used if instantiated manually by the user, or if Cython doesn't
10352  *         know how to convert the type"""
10353  */
10354 
__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)10355 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
10356   PyObject *__pyx_v_struct = NULL;
10357   char __pyx_v_c;
10358   PyObject *__pyx_v_bytesvalue = 0;
10359   Py_ssize_t __pyx_v_i;
10360   PyObject *__pyx_r = NULL;
10361   __Pyx_RefNannyDeclarations
10362   PyObject *__pyx_t_1 = NULL;
10363   int __pyx_t_2;
10364   int __pyx_t_3;
10365   PyObject *__pyx_t_4 = NULL;
10366   PyObject *__pyx_t_5 = NULL;
10367   PyObject *__pyx_t_6 = NULL;
10368   int __pyx_t_7;
10369   PyObject *__pyx_t_8 = NULL;
10370   Py_ssize_t __pyx_t_9;
10371   PyObject *__pyx_t_10 = NULL;
10372   char *__pyx_t_11;
10373   char *__pyx_t_12;
10374   char *__pyx_t_13;
10375   char *__pyx_t_14;
10376   int __pyx_lineno = 0;
10377   const char *__pyx_filename = NULL;
10378   int __pyx_clineno = 0;
10379   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
10380 
10381   /* "View.MemoryView":504
10382  *         """Only used if instantiated manually by the user, or if Cython doesn't
10383  *         know how to convert the type"""
10384  *         import struct             # <<<<<<<<<<<<<<
10385  *         cdef char c
10386  *         cdef bytes bytesvalue
10387  */
10388   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error)
10389   __Pyx_GOTREF(__pyx_t_1);
10390   __pyx_v_struct = __pyx_t_1;
10391   __pyx_t_1 = 0;
10392 
10393   /* "View.MemoryView":509
10394  *         cdef Py_ssize_t i
10395  *
10396  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
10397  *             bytesvalue = struct.pack(self.view.format, *value)
10398  *         else:
10399  */
10400   __pyx_t_2 = PyTuple_Check(__pyx_v_value);
10401   __pyx_t_3 = (__pyx_t_2 != 0);
10402   if (__pyx_t_3) {
10403 
10404     /* "View.MemoryView":510
10405  *
10406  *         if isinstance(value, tuple):
10407  *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
10408  *         else:
10409  *             bytesvalue = struct.pack(self.view.format, value)
10410  */
10411     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 510, __pyx_L1_error)
10412     __Pyx_GOTREF(__pyx_t_1);
10413     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
10414     __Pyx_GOTREF(__pyx_t_4);
10415     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error)
10416     __Pyx_GOTREF(__pyx_t_5);
10417     __Pyx_GIVEREF(__pyx_t_4);
10418     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
10419     __pyx_t_4 = 0;
10420     __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
10421     __Pyx_GOTREF(__pyx_t_4);
10422     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __pyx_L1_error)
10423     __Pyx_GOTREF(__pyx_t_6);
10424     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10425     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10426     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
10427     __Pyx_GOTREF(__pyx_t_4);
10428     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10429     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10430     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 510, __pyx_L1_error)
10431     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
10432     __pyx_t_4 = 0;
10433 
10434     /* "View.MemoryView":509
10435  *         cdef Py_ssize_t i
10436  *
10437  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
10438  *             bytesvalue = struct.pack(self.view.format, *value)
10439  *         else:
10440  */
10441     goto __pyx_L3;
10442   }
10443 
10444   /* "View.MemoryView":512
10445  *             bytesvalue = struct.pack(self.view.format, *value)
10446  *         else:
10447  *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
10448  *
10449  *         for i, c in enumerate(bytesvalue):
10450  */
10451   /*else*/ {
10452     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error)
10453     __Pyx_GOTREF(__pyx_t_6);
10454     __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
10455     __Pyx_GOTREF(__pyx_t_1);
10456     __pyx_t_5 = NULL;
10457     __pyx_t_7 = 0;
10458     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
10459       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
10460       if (likely(__pyx_t_5)) {
10461         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
10462         __Pyx_INCREF(__pyx_t_5);
10463         __Pyx_INCREF(function);
10464         __Pyx_DECREF_SET(__pyx_t_6, function);
10465         __pyx_t_7 = 1;
10466       }
10467     }
10468     #if CYTHON_FAST_PYCALL
10469     if (PyFunction_Check(__pyx_t_6)) {
10470       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
10471       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
10472       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10473       __Pyx_GOTREF(__pyx_t_4);
10474       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10475     } else
10476     #endif
10477     #if CYTHON_FAST_PYCCALL
10478     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
10479       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
10480       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
10481       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10482       __Pyx_GOTREF(__pyx_t_4);
10483       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10484     } else
10485     #endif
10486     {
10487       __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error)
10488       __Pyx_GOTREF(__pyx_t_8);
10489       if (__pyx_t_5) {
10490         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
10491       }
10492       __Pyx_GIVEREF(__pyx_t_1);
10493       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
10494       __Pyx_INCREF(__pyx_v_value);
10495       __Pyx_GIVEREF(__pyx_v_value);
10496       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
10497       __pyx_t_1 = 0;
10498       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
10499       __Pyx_GOTREF(__pyx_t_4);
10500       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10501     }
10502     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10503     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error)
10504     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
10505     __pyx_t_4 = 0;
10506   }
10507   __pyx_L3:;
10508 
10509   /* "View.MemoryView":514
10510  *             bytesvalue = struct.pack(self.view.format, value)
10511  *
10512  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
10513  *             itemp[i] = c
10514  *
10515  */
10516   __pyx_t_9 = 0;
10517   if (unlikely(__pyx_v_bytesvalue == Py_None)) {
10518     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
10519     __PYX_ERR(2, 514, __pyx_L1_error)
10520   }
10521   __Pyx_INCREF(__pyx_v_bytesvalue);
10522   __pyx_t_10 = __pyx_v_bytesvalue;
10523   __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
10524   __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
10525   for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
10526     __pyx_t_11 = __pyx_t_14;
10527     __pyx_v_c = (__pyx_t_11[0]);
10528 
10529     /* "View.MemoryView":515
10530  *
10531  *         for i, c in enumerate(bytesvalue):
10532  *             itemp[i] = c             # <<<<<<<<<<<<<<
10533  *
10534  *     @cname('getbuffer')
10535  */
10536     __pyx_v_i = __pyx_t_9;
10537 
10538     /* "View.MemoryView":514
10539  *             bytesvalue = struct.pack(self.view.format, value)
10540  *
10541  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
10542  *             itemp[i] = c
10543  *
10544  */
10545     __pyx_t_9 = (__pyx_t_9 + 1);
10546 
10547     /* "View.MemoryView":515
10548  *
10549  *         for i, c in enumerate(bytesvalue):
10550  *             itemp[i] = c             # <<<<<<<<<<<<<<
10551  *
10552  *     @cname('getbuffer')
10553  */
10554     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
10555   }
10556   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10557 
10558   /* "View.MemoryView":501
10559  *             return result
10560  *
10561  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
10562  *         """Only used if instantiated manually by the user, or if Cython doesn't
10563  *         know how to convert the type"""
10564  */
10565 
10566   /* function exit code */
10567   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10568   goto __pyx_L0;
10569   __pyx_L1_error:;
10570   __Pyx_XDECREF(__pyx_t_1);
10571   __Pyx_XDECREF(__pyx_t_4);
10572   __Pyx_XDECREF(__pyx_t_5);
10573   __Pyx_XDECREF(__pyx_t_6);
10574   __Pyx_XDECREF(__pyx_t_8);
10575   __Pyx_XDECREF(__pyx_t_10);
10576   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
10577   __pyx_r = 0;
10578   __pyx_L0:;
10579   __Pyx_XDECREF(__pyx_v_struct);
10580   __Pyx_XDECREF(__pyx_v_bytesvalue);
10581   __Pyx_XGIVEREF(__pyx_r);
10582   __Pyx_RefNannyFinishContext();
10583   return __pyx_r;
10584 }
10585 
10586 /* "View.MemoryView":518
10587  *
10588  *     @cname('getbuffer')
10589  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
10590  *         if flags & PyBUF_WRITABLE and self.view.readonly:
10591  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
10592  */
10593 
10594 /* Python wrapper */
10595 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)10596 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
10597   int __pyx_r;
10598   __Pyx_RefNannyDeclarations
10599   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
10600   __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));
10601 
10602   /* function exit code */
10603   __Pyx_RefNannyFinishContext();
10604   return __pyx_r;
10605 }
10606 
__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)10607 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) {
10608   int __pyx_r;
10609   __Pyx_RefNannyDeclarations
10610   int __pyx_t_1;
10611   int __pyx_t_2;
10612   PyObject *__pyx_t_3 = NULL;
10613   Py_ssize_t *__pyx_t_4;
10614   char *__pyx_t_5;
10615   void *__pyx_t_6;
10616   int __pyx_t_7;
10617   Py_ssize_t __pyx_t_8;
10618   int __pyx_lineno = 0;
10619   const char *__pyx_filename = NULL;
10620   int __pyx_clineno = 0;
10621   if (__pyx_v_info == NULL) {
10622     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
10623     return -1;
10624   }
10625   __Pyx_RefNannySetupContext("__getbuffer__", 0);
10626   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
10627   __Pyx_GIVEREF(__pyx_v_info->obj);
10628 
10629   /* "View.MemoryView":519
10630  *     @cname('getbuffer')
10631  *     def __getbuffer__(self, Py_buffer *info, int flags):
10632  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
10633  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
10634  *
10635  */
10636   __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
10637   if (__pyx_t_2) {
10638   } else {
10639     __pyx_t_1 = __pyx_t_2;
10640     goto __pyx_L4_bool_binop_done;
10641   }
10642   __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
10643   __pyx_t_1 = __pyx_t_2;
10644   __pyx_L4_bool_binop_done:;
10645   if (unlikely(__pyx_t_1)) {
10646 
10647     /* "View.MemoryView":520
10648  *     def __getbuffer__(self, Py_buffer *info, int flags):
10649  *         if flags & PyBUF_WRITABLE and self.view.readonly:
10650  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
10651  *
10652  *         if flags & PyBUF_ND:
10653  */
10654     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 520, __pyx_L1_error)
10655     __Pyx_GOTREF(__pyx_t_3);
10656     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10657     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10658     __PYX_ERR(2, 520, __pyx_L1_error)
10659 
10660     /* "View.MemoryView":519
10661  *     @cname('getbuffer')
10662  *     def __getbuffer__(self, Py_buffer *info, int flags):
10663  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
10664  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
10665  *
10666  */
10667   }
10668 
10669   /* "View.MemoryView":522
10670  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
10671  *
10672  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
10673  *             info.shape = self.view.shape
10674  *         else:
10675  */
10676   __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
10677   if (__pyx_t_1) {
10678 
10679     /* "View.MemoryView":523
10680  *
10681  *         if flags & PyBUF_ND:
10682  *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
10683  *         else:
10684  *             info.shape = NULL
10685  */
10686     __pyx_t_4 = __pyx_v_self->view.shape;
10687     __pyx_v_info->shape = __pyx_t_4;
10688 
10689     /* "View.MemoryView":522
10690  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
10691  *
10692  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
10693  *             info.shape = self.view.shape
10694  *         else:
10695  */
10696     goto __pyx_L6;
10697   }
10698 
10699   /* "View.MemoryView":525
10700  *             info.shape = self.view.shape
10701  *         else:
10702  *             info.shape = NULL             # <<<<<<<<<<<<<<
10703  *
10704  *         if flags & PyBUF_STRIDES:
10705  */
10706   /*else*/ {
10707     __pyx_v_info->shape = NULL;
10708   }
10709   __pyx_L6:;
10710 
10711   /* "View.MemoryView":527
10712  *             info.shape = NULL
10713  *
10714  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
10715  *             info.strides = self.view.strides
10716  *         else:
10717  */
10718   __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
10719   if (__pyx_t_1) {
10720 
10721     /* "View.MemoryView":528
10722  *
10723  *         if flags & PyBUF_STRIDES:
10724  *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
10725  *         else:
10726  *             info.strides = NULL
10727  */
10728     __pyx_t_4 = __pyx_v_self->view.strides;
10729     __pyx_v_info->strides = __pyx_t_4;
10730 
10731     /* "View.MemoryView":527
10732  *             info.shape = NULL
10733  *
10734  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
10735  *             info.strides = self.view.strides
10736  *         else:
10737  */
10738     goto __pyx_L7;
10739   }
10740 
10741   /* "View.MemoryView":530
10742  *             info.strides = self.view.strides
10743  *         else:
10744  *             info.strides = NULL             # <<<<<<<<<<<<<<
10745  *
10746  *         if flags & PyBUF_INDIRECT:
10747  */
10748   /*else*/ {
10749     __pyx_v_info->strides = NULL;
10750   }
10751   __pyx_L7:;
10752 
10753   /* "View.MemoryView":532
10754  *             info.strides = NULL
10755  *
10756  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
10757  *             info.suboffsets = self.view.suboffsets
10758  *         else:
10759  */
10760   __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
10761   if (__pyx_t_1) {
10762 
10763     /* "View.MemoryView":533
10764  *
10765  *         if flags & PyBUF_INDIRECT:
10766  *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
10767  *         else:
10768  *             info.suboffsets = NULL
10769  */
10770     __pyx_t_4 = __pyx_v_self->view.suboffsets;
10771     __pyx_v_info->suboffsets = __pyx_t_4;
10772 
10773     /* "View.MemoryView":532
10774  *             info.strides = NULL
10775  *
10776  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
10777  *             info.suboffsets = self.view.suboffsets
10778  *         else:
10779  */
10780     goto __pyx_L8;
10781   }
10782 
10783   /* "View.MemoryView":535
10784  *             info.suboffsets = self.view.suboffsets
10785  *         else:
10786  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
10787  *
10788  *         if flags & PyBUF_FORMAT:
10789  */
10790   /*else*/ {
10791     __pyx_v_info->suboffsets = NULL;
10792   }
10793   __pyx_L8:;
10794 
10795   /* "View.MemoryView":537
10796  *             info.suboffsets = NULL
10797  *
10798  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
10799  *             info.format = self.view.format
10800  *         else:
10801  */
10802   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
10803   if (__pyx_t_1) {
10804 
10805     /* "View.MemoryView":538
10806  *
10807  *         if flags & PyBUF_FORMAT:
10808  *             info.format = self.view.format             # <<<<<<<<<<<<<<
10809  *         else:
10810  *             info.format = NULL
10811  */
10812     __pyx_t_5 = __pyx_v_self->view.format;
10813     __pyx_v_info->format = __pyx_t_5;
10814 
10815     /* "View.MemoryView":537
10816  *             info.suboffsets = NULL
10817  *
10818  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
10819  *             info.format = self.view.format
10820  *         else:
10821  */
10822     goto __pyx_L9;
10823   }
10824 
10825   /* "View.MemoryView":540
10826  *             info.format = self.view.format
10827  *         else:
10828  *             info.format = NULL             # <<<<<<<<<<<<<<
10829  *
10830  *         info.buf = self.view.buf
10831  */
10832   /*else*/ {
10833     __pyx_v_info->format = NULL;
10834   }
10835   __pyx_L9:;
10836 
10837   /* "View.MemoryView":542
10838  *             info.format = NULL
10839  *
10840  *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
10841  *         info.ndim = self.view.ndim
10842  *         info.itemsize = self.view.itemsize
10843  */
10844   __pyx_t_6 = __pyx_v_self->view.buf;
10845   __pyx_v_info->buf = __pyx_t_6;
10846 
10847   /* "View.MemoryView":543
10848  *
10849  *         info.buf = self.view.buf
10850  *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
10851  *         info.itemsize = self.view.itemsize
10852  *         info.len = self.view.len
10853  */
10854   __pyx_t_7 = __pyx_v_self->view.ndim;
10855   __pyx_v_info->ndim = __pyx_t_7;
10856 
10857   /* "View.MemoryView":544
10858  *         info.buf = self.view.buf
10859  *         info.ndim = self.view.ndim
10860  *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
10861  *         info.len = self.view.len
10862  *         info.readonly = self.view.readonly
10863  */
10864   __pyx_t_8 = __pyx_v_self->view.itemsize;
10865   __pyx_v_info->itemsize = __pyx_t_8;
10866 
10867   /* "View.MemoryView":545
10868  *         info.ndim = self.view.ndim
10869  *         info.itemsize = self.view.itemsize
10870  *         info.len = self.view.len             # <<<<<<<<<<<<<<
10871  *         info.readonly = self.view.readonly
10872  *         info.obj = self
10873  */
10874   __pyx_t_8 = __pyx_v_self->view.len;
10875   __pyx_v_info->len = __pyx_t_8;
10876 
10877   /* "View.MemoryView":546
10878  *         info.itemsize = self.view.itemsize
10879  *         info.len = self.view.len
10880  *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
10881  *         info.obj = self
10882  *
10883  */
10884   __pyx_t_1 = __pyx_v_self->view.readonly;
10885   __pyx_v_info->readonly = __pyx_t_1;
10886 
10887   /* "View.MemoryView":547
10888  *         info.len = self.view.len
10889  *         info.readonly = self.view.readonly
10890  *         info.obj = self             # <<<<<<<<<<<<<<
10891  *
10892  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
10893  */
10894   __Pyx_INCREF(((PyObject *)__pyx_v_self));
10895   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
10896   __Pyx_GOTREF(__pyx_v_info->obj);
10897   __Pyx_DECREF(__pyx_v_info->obj);
10898   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
10899 
10900   /* "View.MemoryView":518
10901  *
10902  *     @cname('getbuffer')
10903  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
10904  *         if flags & PyBUF_WRITABLE and self.view.readonly:
10905  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
10906  */
10907 
10908   /* function exit code */
10909   __pyx_r = 0;
10910   goto __pyx_L0;
10911   __pyx_L1_error:;
10912   __Pyx_XDECREF(__pyx_t_3);
10913   __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10914   __pyx_r = -1;
10915   if (__pyx_v_info->obj != NULL) {
10916     __Pyx_GOTREF(__pyx_v_info->obj);
10917     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
10918   }
10919   goto __pyx_L2;
10920   __pyx_L0:;
10921   if (__pyx_v_info->obj == Py_None) {
10922     __Pyx_GOTREF(__pyx_v_info->obj);
10923     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
10924   }
10925   __pyx_L2:;
10926   __Pyx_RefNannyFinishContext();
10927   return __pyx_r;
10928 }
10929 
10930 /* "View.MemoryView":553
10931  *
10932  *     @property
10933  *     def T(self):             # <<<<<<<<<<<<<<
10934  *         cdef _memoryviewslice result = memoryview_copy(self)
10935  *         transpose_memslice(&result.from_slice)
10936  */
10937 
10938 /* Python wrapper */
10939 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)10940 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
10941   PyObject *__pyx_r = 0;
10942   __Pyx_RefNannyDeclarations
10943   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10944   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
10945 
10946   /* function exit code */
10947   __Pyx_RefNannyFinishContext();
10948   return __pyx_r;
10949 }
10950 
__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj * __pyx_v_self)10951 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
10952   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
10953   PyObject *__pyx_r = NULL;
10954   __Pyx_RefNannyDeclarations
10955   PyObject *__pyx_t_1 = NULL;
10956   int __pyx_t_2;
10957   int __pyx_lineno = 0;
10958   const char *__pyx_filename = NULL;
10959   int __pyx_clineno = 0;
10960   __Pyx_RefNannySetupContext("__get__", 0);
10961 
10962   /* "View.MemoryView":554
10963  *     @property
10964  *     def T(self):
10965  *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
10966  *         transpose_memslice(&result.from_slice)
10967  *         return result
10968  */
10969   __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __pyx_L1_error)
10970   __Pyx_GOTREF(__pyx_t_1);
10971   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error)
10972   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
10973   __pyx_t_1 = 0;
10974 
10975   /* "View.MemoryView":555
10976  *     def T(self):
10977  *         cdef _memoryviewslice result = memoryview_copy(self)
10978  *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
10979  *         return result
10980  *
10981  */
10982   __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 555, __pyx_L1_error)
10983 
10984   /* "View.MemoryView":556
10985  *         cdef _memoryviewslice result = memoryview_copy(self)
10986  *         transpose_memslice(&result.from_slice)
10987  *         return result             # <<<<<<<<<<<<<<
10988  *
10989  *     @property
10990  */
10991   __Pyx_XDECREF(__pyx_r);
10992   __Pyx_INCREF(((PyObject *)__pyx_v_result));
10993   __pyx_r = ((PyObject *)__pyx_v_result);
10994   goto __pyx_L0;
10995 
10996   /* "View.MemoryView":553
10997  *
10998  *     @property
10999  *     def T(self):             # <<<<<<<<<<<<<<
11000  *         cdef _memoryviewslice result = memoryview_copy(self)
11001  *         transpose_memslice(&result.from_slice)
11002  */
11003 
11004   /* function exit code */
11005   __pyx_L1_error:;
11006   __Pyx_XDECREF(__pyx_t_1);
11007   __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11008   __pyx_r = NULL;
11009   __pyx_L0:;
11010   __Pyx_XDECREF((PyObject *)__pyx_v_result);
11011   __Pyx_XGIVEREF(__pyx_r);
11012   __Pyx_RefNannyFinishContext();
11013   return __pyx_r;
11014 }
11015 
11016 /* "View.MemoryView":559
11017  *
11018  *     @property
11019  *     def base(self):             # <<<<<<<<<<<<<<
11020  *         return self.obj
11021  *
11022  */
11023 
11024 /* Python wrapper */
11025 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)11026 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
11027   PyObject *__pyx_r = 0;
11028   __Pyx_RefNannyDeclarations
11029   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11030   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11031 
11032   /* function exit code */
11033   __Pyx_RefNannyFinishContext();
11034   return __pyx_r;
11035 }
11036 
__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj * __pyx_v_self)11037 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
11038   PyObject *__pyx_r = NULL;
11039   __Pyx_RefNannyDeclarations
11040   __Pyx_RefNannySetupContext("__get__", 0);
11041 
11042   /* "View.MemoryView":560
11043  *     @property
11044  *     def base(self):
11045  *         return self.obj             # <<<<<<<<<<<<<<
11046  *
11047  *     @property
11048  */
11049   __Pyx_XDECREF(__pyx_r);
11050   __Pyx_INCREF(__pyx_v_self->obj);
11051   __pyx_r = __pyx_v_self->obj;
11052   goto __pyx_L0;
11053 
11054   /* "View.MemoryView":559
11055  *
11056  *     @property
11057  *     def base(self):             # <<<<<<<<<<<<<<
11058  *         return self.obj
11059  *
11060  */
11061 
11062   /* function exit code */
11063   __pyx_L0:;
11064   __Pyx_XGIVEREF(__pyx_r);
11065   __Pyx_RefNannyFinishContext();
11066   return __pyx_r;
11067 }
11068 
11069 /* "View.MemoryView":563
11070  *
11071  *     @property
11072  *     def shape(self):             # <<<<<<<<<<<<<<
11073  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
11074  *
11075  */
11076 
11077 /* Python wrapper */
11078 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)11079 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
11080   PyObject *__pyx_r = 0;
11081   __Pyx_RefNannyDeclarations
11082   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11083   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11084 
11085   /* function exit code */
11086   __Pyx_RefNannyFinishContext();
11087   return __pyx_r;
11088 }
11089 
__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj * __pyx_v_self)11090 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
11091   Py_ssize_t __pyx_v_length;
11092   PyObject *__pyx_r = NULL;
11093   __Pyx_RefNannyDeclarations
11094   PyObject *__pyx_t_1 = NULL;
11095   Py_ssize_t *__pyx_t_2;
11096   Py_ssize_t *__pyx_t_3;
11097   Py_ssize_t *__pyx_t_4;
11098   PyObject *__pyx_t_5 = NULL;
11099   int __pyx_lineno = 0;
11100   const char *__pyx_filename = NULL;
11101   int __pyx_clineno = 0;
11102   __Pyx_RefNannySetupContext("__get__", 0);
11103 
11104   /* "View.MemoryView":564
11105  *     @property
11106  *     def shape(self):
11107  *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
11108  *
11109  *     @property
11110  */
11111   __Pyx_XDECREF(__pyx_r);
11112   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error)
11113   __Pyx_GOTREF(__pyx_t_1);
11114   __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
11115   for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
11116     __pyx_t_2 = __pyx_t_4;
11117     __pyx_v_length = (__pyx_t_2[0]);
11118     __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
11119     __Pyx_GOTREF(__pyx_t_5);
11120     if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error)
11121     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11122   }
11123   __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
11124   __Pyx_GOTREF(__pyx_t_5);
11125   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11126   __pyx_r = __pyx_t_5;
11127   __pyx_t_5 = 0;
11128   goto __pyx_L0;
11129 
11130   /* "View.MemoryView":563
11131  *
11132  *     @property
11133  *     def shape(self):             # <<<<<<<<<<<<<<
11134  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
11135  *
11136  */
11137 
11138   /* function exit code */
11139   __pyx_L1_error:;
11140   __Pyx_XDECREF(__pyx_t_1);
11141   __Pyx_XDECREF(__pyx_t_5);
11142   __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11143   __pyx_r = NULL;
11144   __pyx_L0:;
11145   __Pyx_XGIVEREF(__pyx_r);
11146   __Pyx_RefNannyFinishContext();
11147   return __pyx_r;
11148 }
11149 
11150 /* "View.MemoryView":567
11151  *
11152  *     @property
11153  *     def strides(self):             # <<<<<<<<<<<<<<
11154  *         if self.view.strides == NULL:
11155  *
11156  */
11157 
11158 /* Python wrapper */
11159 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)11160 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
11161   PyObject *__pyx_r = 0;
11162   __Pyx_RefNannyDeclarations
11163   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11164   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11165 
11166   /* function exit code */
11167   __Pyx_RefNannyFinishContext();
11168   return __pyx_r;
11169 }
11170 
__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj * __pyx_v_self)11171 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
11172   Py_ssize_t __pyx_v_stride;
11173   PyObject *__pyx_r = NULL;
11174   __Pyx_RefNannyDeclarations
11175   int __pyx_t_1;
11176   PyObject *__pyx_t_2 = NULL;
11177   Py_ssize_t *__pyx_t_3;
11178   Py_ssize_t *__pyx_t_4;
11179   Py_ssize_t *__pyx_t_5;
11180   PyObject *__pyx_t_6 = NULL;
11181   int __pyx_lineno = 0;
11182   const char *__pyx_filename = NULL;
11183   int __pyx_clineno = 0;
11184   __Pyx_RefNannySetupContext("__get__", 0);
11185 
11186   /* "View.MemoryView":568
11187  *     @property
11188  *     def strides(self):
11189  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
11190  *
11191  *             raise ValueError("Buffer view does not expose strides")
11192  */
11193   __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
11194   if (unlikely(__pyx_t_1)) {
11195 
11196     /* "View.MemoryView":570
11197  *         if self.view.strides == NULL:
11198  *
11199  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
11200  *
11201  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
11202  */
11203     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 570, __pyx_L1_error)
11204     __Pyx_GOTREF(__pyx_t_2);
11205     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11206     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11207     __PYX_ERR(2, 570, __pyx_L1_error)
11208 
11209     /* "View.MemoryView":568
11210  *     @property
11211  *     def strides(self):
11212  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
11213  *
11214  *             raise ValueError("Buffer view does not expose strides")
11215  */
11216   }
11217 
11218   /* "View.MemoryView":572
11219  *             raise ValueError("Buffer view does not expose strides")
11220  *
11221  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
11222  *
11223  *     @property
11224  */
11225   __Pyx_XDECREF(__pyx_r);
11226   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
11227   __Pyx_GOTREF(__pyx_t_2);
11228   __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
11229   for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
11230     __pyx_t_3 = __pyx_t_5;
11231     __pyx_v_stride = (__pyx_t_3[0]);
11232     __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
11233     __Pyx_GOTREF(__pyx_t_6);
11234     if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error)
11235     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11236   }
11237   __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
11238   __Pyx_GOTREF(__pyx_t_6);
11239   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11240   __pyx_r = __pyx_t_6;
11241   __pyx_t_6 = 0;
11242   goto __pyx_L0;
11243 
11244   /* "View.MemoryView":567
11245  *
11246  *     @property
11247  *     def strides(self):             # <<<<<<<<<<<<<<
11248  *         if self.view.strides == NULL:
11249  *
11250  */
11251 
11252   /* function exit code */
11253   __pyx_L1_error:;
11254   __Pyx_XDECREF(__pyx_t_2);
11255   __Pyx_XDECREF(__pyx_t_6);
11256   __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11257   __pyx_r = NULL;
11258   __pyx_L0:;
11259   __Pyx_XGIVEREF(__pyx_r);
11260   __Pyx_RefNannyFinishContext();
11261   return __pyx_r;
11262 }
11263 
11264 /* "View.MemoryView":575
11265  *
11266  *     @property
11267  *     def suboffsets(self):             # <<<<<<<<<<<<<<
11268  *         if self.view.suboffsets == NULL:
11269  *             return (-1,) * self.view.ndim
11270  */
11271 
11272 /* Python wrapper */
11273 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)11274 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
11275   PyObject *__pyx_r = 0;
11276   __Pyx_RefNannyDeclarations
11277   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11278   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11279 
11280   /* function exit code */
11281   __Pyx_RefNannyFinishContext();
11282   return __pyx_r;
11283 }
11284 
__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj * __pyx_v_self)11285 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
11286   Py_ssize_t __pyx_v_suboffset;
11287   PyObject *__pyx_r = NULL;
11288   __Pyx_RefNannyDeclarations
11289   int __pyx_t_1;
11290   PyObject *__pyx_t_2 = NULL;
11291   PyObject *__pyx_t_3 = NULL;
11292   Py_ssize_t *__pyx_t_4;
11293   Py_ssize_t *__pyx_t_5;
11294   Py_ssize_t *__pyx_t_6;
11295   int __pyx_lineno = 0;
11296   const char *__pyx_filename = NULL;
11297   int __pyx_clineno = 0;
11298   __Pyx_RefNannySetupContext("__get__", 0);
11299 
11300   /* "View.MemoryView":576
11301  *     @property
11302  *     def suboffsets(self):
11303  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
11304  *             return (-1,) * self.view.ndim
11305  *
11306  */
11307   __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
11308   if (__pyx_t_1) {
11309 
11310     /* "View.MemoryView":577
11311  *     def suboffsets(self):
11312  *         if self.view.suboffsets == NULL:
11313  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
11314  *
11315  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
11316  */
11317     __Pyx_XDECREF(__pyx_r);
11318     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error)
11319     __Pyx_GOTREF(__pyx_t_2);
11320     __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__15, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __pyx_L1_error)
11321     __Pyx_GOTREF(__pyx_t_3);
11322     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11323     __pyx_r = __pyx_t_3;
11324     __pyx_t_3 = 0;
11325     goto __pyx_L0;
11326 
11327     /* "View.MemoryView":576
11328  *     @property
11329  *     def suboffsets(self):
11330  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
11331  *             return (-1,) * self.view.ndim
11332  *
11333  */
11334   }
11335 
11336   /* "View.MemoryView":579
11337  *             return (-1,) * self.view.ndim
11338  *
11339  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
11340  *
11341  *     @property
11342  */
11343   __Pyx_XDECREF(__pyx_r);
11344   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
11345   __Pyx_GOTREF(__pyx_t_3);
11346   __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
11347   for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
11348     __pyx_t_4 = __pyx_t_6;
11349     __pyx_v_suboffset = (__pyx_t_4[0]);
11350     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
11351     __Pyx_GOTREF(__pyx_t_2);
11352     if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error)
11353     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11354   }
11355   __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
11356   __Pyx_GOTREF(__pyx_t_2);
11357   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11358   __pyx_r = __pyx_t_2;
11359   __pyx_t_2 = 0;
11360   goto __pyx_L0;
11361 
11362   /* "View.MemoryView":575
11363  *
11364  *     @property
11365  *     def suboffsets(self):             # <<<<<<<<<<<<<<
11366  *         if self.view.suboffsets == NULL:
11367  *             return (-1,) * self.view.ndim
11368  */
11369 
11370   /* function exit code */
11371   __pyx_L1_error:;
11372   __Pyx_XDECREF(__pyx_t_2);
11373   __Pyx_XDECREF(__pyx_t_3);
11374   __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11375   __pyx_r = NULL;
11376   __pyx_L0:;
11377   __Pyx_XGIVEREF(__pyx_r);
11378   __Pyx_RefNannyFinishContext();
11379   return __pyx_r;
11380 }
11381 
11382 /* "View.MemoryView":582
11383  *
11384  *     @property
11385  *     def ndim(self):             # <<<<<<<<<<<<<<
11386  *         return self.view.ndim
11387  *
11388  */
11389 
11390 /* Python wrapper */
11391 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)11392 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
11393   PyObject *__pyx_r = 0;
11394   __Pyx_RefNannyDeclarations
11395   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11396   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11397 
11398   /* function exit code */
11399   __Pyx_RefNannyFinishContext();
11400   return __pyx_r;
11401 }
11402 
__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj * __pyx_v_self)11403 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
11404   PyObject *__pyx_r = NULL;
11405   __Pyx_RefNannyDeclarations
11406   PyObject *__pyx_t_1 = NULL;
11407   int __pyx_lineno = 0;
11408   const char *__pyx_filename = NULL;
11409   int __pyx_clineno = 0;
11410   __Pyx_RefNannySetupContext("__get__", 0);
11411 
11412   /* "View.MemoryView":583
11413  *     @property
11414  *     def ndim(self):
11415  *         return self.view.ndim             # <<<<<<<<<<<<<<
11416  *
11417  *     @property
11418  */
11419   __Pyx_XDECREF(__pyx_r);
11420   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error)
11421   __Pyx_GOTREF(__pyx_t_1);
11422   __pyx_r = __pyx_t_1;
11423   __pyx_t_1 = 0;
11424   goto __pyx_L0;
11425 
11426   /* "View.MemoryView":582
11427  *
11428  *     @property
11429  *     def ndim(self):             # <<<<<<<<<<<<<<
11430  *         return self.view.ndim
11431  *
11432  */
11433 
11434   /* function exit code */
11435   __pyx_L1_error:;
11436   __Pyx_XDECREF(__pyx_t_1);
11437   __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11438   __pyx_r = NULL;
11439   __pyx_L0:;
11440   __Pyx_XGIVEREF(__pyx_r);
11441   __Pyx_RefNannyFinishContext();
11442   return __pyx_r;
11443 }
11444 
11445 /* "View.MemoryView":586
11446  *
11447  *     @property
11448  *     def itemsize(self):             # <<<<<<<<<<<<<<
11449  *         return self.view.itemsize
11450  *
11451  */
11452 
11453 /* Python wrapper */
11454 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)11455 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
11456   PyObject *__pyx_r = 0;
11457   __Pyx_RefNannyDeclarations
11458   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11459   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11460 
11461   /* function exit code */
11462   __Pyx_RefNannyFinishContext();
11463   return __pyx_r;
11464 }
11465 
__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj * __pyx_v_self)11466 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
11467   PyObject *__pyx_r = NULL;
11468   __Pyx_RefNannyDeclarations
11469   PyObject *__pyx_t_1 = NULL;
11470   int __pyx_lineno = 0;
11471   const char *__pyx_filename = NULL;
11472   int __pyx_clineno = 0;
11473   __Pyx_RefNannySetupContext("__get__", 0);
11474 
11475   /* "View.MemoryView":587
11476  *     @property
11477  *     def itemsize(self):
11478  *         return self.view.itemsize             # <<<<<<<<<<<<<<
11479  *
11480  *     @property
11481  */
11482   __Pyx_XDECREF(__pyx_r);
11483   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error)
11484   __Pyx_GOTREF(__pyx_t_1);
11485   __pyx_r = __pyx_t_1;
11486   __pyx_t_1 = 0;
11487   goto __pyx_L0;
11488 
11489   /* "View.MemoryView":586
11490  *
11491  *     @property
11492  *     def itemsize(self):             # <<<<<<<<<<<<<<
11493  *         return self.view.itemsize
11494  *
11495  */
11496 
11497   /* function exit code */
11498   __pyx_L1_error:;
11499   __Pyx_XDECREF(__pyx_t_1);
11500   __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11501   __pyx_r = NULL;
11502   __pyx_L0:;
11503   __Pyx_XGIVEREF(__pyx_r);
11504   __Pyx_RefNannyFinishContext();
11505   return __pyx_r;
11506 }
11507 
11508 /* "View.MemoryView":590
11509  *
11510  *     @property
11511  *     def nbytes(self):             # <<<<<<<<<<<<<<
11512  *         return self.size * self.view.itemsize
11513  *
11514  */
11515 
11516 /* Python wrapper */
11517 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)11518 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
11519   PyObject *__pyx_r = 0;
11520   __Pyx_RefNannyDeclarations
11521   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11522   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11523 
11524   /* function exit code */
11525   __Pyx_RefNannyFinishContext();
11526   return __pyx_r;
11527 }
11528 
__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj * __pyx_v_self)11529 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
11530   PyObject *__pyx_r = NULL;
11531   __Pyx_RefNannyDeclarations
11532   PyObject *__pyx_t_1 = NULL;
11533   PyObject *__pyx_t_2 = NULL;
11534   PyObject *__pyx_t_3 = NULL;
11535   int __pyx_lineno = 0;
11536   const char *__pyx_filename = NULL;
11537   int __pyx_clineno = 0;
11538   __Pyx_RefNannySetupContext("__get__", 0);
11539 
11540   /* "View.MemoryView":591
11541  *     @property
11542  *     def nbytes(self):
11543  *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
11544  *
11545  *     @property
11546  */
11547   __Pyx_XDECREF(__pyx_r);
11548   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 591, __pyx_L1_error)
11549   __Pyx_GOTREF(__pyx_t_1);
11550   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __pyx_L1_error)
11551   __Pyx_GOTREF(__pyx_t_2);
11552   __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __pyx_L1_error)
11553   __Pyx_GOTREF(__pyx_t_3);
11554   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11555   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11556   __pyx_r = __pyx_t_3;
11557   __pyx_t_3 = 0;
11558   goto __pyx_L0;
11559 
11560   /* "View.MemoryView":590
11561  *
11562  *     @property
11563  *     def nbytes(self):             # <<<<<<<<<<<<<<
11564  *         return self.size * self.view.itemsize
11565  *
11566  */
11567 
11568   /* function exit code */
11569   __pyx_L1_error:;
11570   __Pyx_XDECREF(__pyx_t_1);
11571   __Pyx_XDECREF(__pyx_t_2);
11572   __Pyx_XDECREF(__pyx_t_3);
11573   __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11574   __pyx_r = NULL;
11575   __pyx_L0:;
11576   __Pyx_XGIVEREF(__pyx_r);
11577   __Pyx_RefNannyFinishContext();
11578   return __pyx_r;
11579 }
11580 
11581 /* "View.MemoryView":594
11582  *
11583  *     @property
11584  *     def size(self):             # <<<<<<<<<<<<<<
11585  *         if self._size is None:
11586  *             result = 1
11587  */
11588 
11589 /* Python wrapper */
11590 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)11591 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
11592   PyObject *__pyx_r = 0;
11593   __Pyx_RefNannyDeclarations
11594   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11595   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11596 
11597   /* function exit code */
11598   __Pyx_RefNannyFinishContext();
11599   return __pyx_r;
11600 }
11601 
__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj * __pyx_v_self)11602 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
11603   PyObject *__pyx_v_result = NULL;
11604   PyObject *__pyx_v_length = NULL;
11605   PyObject *__pyx_r = NULL;
11606   __Pyx_RefNannyDeclarations
11607   int __pyx_t_1;
11608   int __pyx_t_2;
11609   Py_ssize_t *__pyx_t_3;
11610   Py_ssize_t *__pyx_t_4;
11611   Py_ssize_t *__pyx_t_5;
11612   PyObject *__pyx_t_6 = NULL;
11613   int __pyx_lineno = 0;
11614   const char *__pyx_filename = NULL;
11615   int __pyx_clineno = 0;
11616   __Pyx_RefNannySetupContext("__get__", 0);
11617 
11618   /* "View.MemoryView":595
11619  *     @property
11620  *     def size(self):
11621  *         if self._size is None:             # <<<<<<<<<<<<<<
11622  *             result = 1
11623  *
11624  */
11625   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
11626   __pyx_t_2 = (__pyx_t_1 != 0);
11627   if (__pyx_t_2) {
11628 
11629     /* "View.MemoryView":596
11630  *     def size(self):
11631  *         if self._size is None:
11632  *             result = 1             # <<<<<<<<<<<<<<
11633  *
11634  *             for length in self.view.shape[:self.view.ndim]:
11635  */
11636     __Pyx_INCREF(__pyx_int_1);
11637     __pyx_v_result = __pyx_int_1;
11638 
11639     /* "View.MemoryView":598
11640  *             result = 1
11641  *
11642  *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
11643  *                 result *= length
11644  *
11645  */
11646     __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
11647     for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
11648       __pyx_t_3 = __pyx_t_5;
11649       __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error)
11650       __Pyx_GOTREF(__pyx_t_6);
11651       __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
11652       __pyx_t_6 = 0;
11653 
11654       /* "View.MemoryView":599
11655  *
11656  *             for length in self.view.shape[:self.view.ndim]:
11657  *                 result *= length             # <<<<<<<<<<<<<<
11658  *
11659  *             self._size = result
11660  */
11661       __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error)
11662       __Pyx_GOTREF(__pyx_t_6);
11663       __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
11664       __pyx_t_6 = 0;
11665     }
11666 
11667     /* "View.MemoryView":601
11668  *                 result *= length
11669  *
11670  *             self._size = result             # <<<<<<<<<<<<<<
11671  *
11672  *         return self._size
11673  */
11674     __Pyx_INCREF(__pyx_v_result);
11675     __Pyx_GIVEREF(__pyx_v_result);
11676     __Pyx_GOTREF(__pyx_v_self->_size);
11677     __Pyx_DECREF(__pyx_v_self->_size);
11678     __pyx_v_self->_size = __pyx_v_result;
11679 
11680     /* "View.MemoryView":595
11681  *     @property
11682  *     def size(self):
11683  *         if self._size is None:             # <<<<<<<<<<<<<<
11684  *             result = 1
11685  *
11686  */
11687   }
11688 
11689   /* "View.MemoryView":603
11690  *             self._size = result
11691  *
11692  *         return self._size             # <<<<<<<<<<<<<<
11693  *
11694  *     def __len__(self):
11695  */
11696   __Pyx_XDECREF(__pyx_r);
11697   __Pyx_INCREF(__pyx_v_self->_size);
11698   __pyx_r = __pyx_v_self->_size;
11699   goto __pyx_L0;
11700 
11701   /* "View.MemoryView":594
11702  *
11703  *     @property
11704  *     def size(self):             # <<<<<<<<<<<<<<
11705  *         if self._size is None:
11706  *             result = 1
11707  */
11708 
11709   /* function exit code */
11710   __pyx_L1_error:;
11711   __Pyx_XDECREF(__pyx_t_6);
11712   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11713   __pyx_r = NULL;
11714   __pyx_L0:;
11715   __Pyx_XDECREF(__pyx_v_result);
11716   __Pyx_XDECREF(__pyx_v_length);
11717   __Pyx_XGIVEREF(__pyx_r);
11718   __Pyx_RefNannyFinishContext();
11719   return __pyx_r;
11720 }
11721 
11722 /* "View.MemoryView":605
11723  *         return self._size
11724  *
11725  *     def __len__(self):             # <<<<<<<<<<<<<<
11726  *         if self.view.ndim >= 1:
11727  *             return self.view.shape[0]
11728  */
11729 
11730 /* Python wrapper */
11731 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___len__(PyObject * __pyx_v_self)11732 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
11733   Py_ssize_t __pyx_r;
11734   __Pyx_RefNannyDeclarations
11735   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
11736   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11737 
11738   /* function exit code */
11739   __Pyx_RefNannyFinishContext();
11740   return __pyx_r;
11741 }
11742 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj * __pyx_v_self)11743 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
11744   Py_ssize_t __pyx_r;
11745   __Pyx_RefNannyDeclarations
11746   int __pyx_t_1;
11747   __Pyx_RefNannySetupContext("__len__", 0);
11748 
11749   /* "View.MemoryView":606
11750  *
11751  *     def __len__(self):
11752  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
11753  *             return self.view.shape[0]
11754  *
11755  */
11756   __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
11757   if (__pyx_t_1) {
11758 
11759     /* "View.MemoryView":607
11760  *     def __len__(self):
11761  *         if self.view.ndim >= 1:
11762  *             return self.view.shape[0]             # <<<<<<<<<<<<<<
11763  *
11764  *         return 0
11765  */
11766     __pyx_r = (__pyx_v_self->view.shape[0]);
11767     goto __pyx_L0;
11768 
11769     /* "View.MemoryView":606
11770  *
11771  *     def __len__(self):
11772  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
11773  *             return self.view.shape[0]
11774  *
11775  */
11776   }
11777 
11778   /* "View.MemoryView":609
11779  *             return self.view.shape[0]
11780  *
11781  *         return 0             # <<<<<<<<<<<<<<
11782  *
11783  *     def __repr__(self):
11784  */
11785   __pyx_r = 0;
11786   goto __pyx_L0;
11787 
11788   /* "View.MemoryView":605
11789  *         return self._size
11790  *
11791  *     def __len__(self):             # <<<<<<<<<<<<<<
11792  *         if self.view.ndim >= 1:
11793  *             return self.view.shape[0]
11794  */
11795 
11796   /* function exit code */
11797   __pyx_L0:;
11798   __Pyx_RefNannyFinishContext();
11799   return __pyx_r;
11800 }
11801 
11802 /* "View.MemoryView":611
11803  *         return 0
11804  *
11805  *     def __repr__(self):             # <<<<<<<<<<<<<<
11806  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
11807  *                                                id(self))
11808  */
11809 
11810 /* Python wrapper */
11811 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___repr__(PyObject * __pyx_v_self)11812 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
11813   PyObject *__pyx_r = 0;
11814   __Pyx_RefNannyDeclarations
11815   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
11816   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11817 
11818   /* function exit code */
11819   __Pyx_RefNannyFinishContext();
11820   return __pyx_r;
11821 }
11822 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj * __pyx_v_self)11823 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
11824   PyObject *__pyx_r = NULL;
11825   __Pyx_RefNannyDeclarations
11826   PyObject *__pyx_t_1 = NULL;
11827   PyObject *__pyx_t_2 = NULL;
11828   PyObject *__pyx_t_3 = NULL;
11829   int __pyx_lineno = 0;
11830   const char *__pyx_filename = NULL;
11831   int __pyx_clineno = 0;
11832   __Pyx_RefNannySetupContext("__repr__", 0);
11833 
11834   /* "View.MemoryView":612
11835  *
11836  *     def __repr__(self):
11837  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
11838  *                                                id(self))
11839  *
11840  */
11841   __Pyx_XDECREF(__pyx_r);
11842   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
11843   __Pyx_GOTREF(__pyx_t_1);
11844   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
11845   __Pyx_GOTREF(__pyx_t_2);
11846   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11847   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
11848   __Pyx_GOTREF(__pyx_t_1);
11849   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11850 
11851   /* "View.MemoryView":613
11852  *     def __repr__(self):
11853  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
11854  *                                                id(self))             # <<<<<<<<<<<<<<
11855  *
11856  *     def __str__(self):
11857  */
11858   __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 613, __pyx_L1_error)
11859   __Pyx_GOTREF(__pyx_t_2);
11860 
11861   /* "View.MemoryView":612
11862  *
11863  *     def __repr__(self):
11864  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
11865  *                                                id(self))
11866  *
11867  */
11868   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error)
11869   __Pyx_GOTREF(__pyx_t_3);
11870   __Pyx_GIVEREF(__pyx_t_1);
11871   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
11872   __Pyx_GIVEREF(__pyx_t_2);
11873   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
11874   __pyx_t_1 = 0;
11875   __pyx_t_2 = 0;
11876   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
11877   __Pyx_GOTREF(__pyx_t_2);
11878   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11879   __pyx_r = __pyx_t_2;
11880   __pyx_t_2 = 0;
11881   goto __pyx_L0;
11882 
11883   /* "View.MemoryView":611
11884  *         return 0
11885  *
11886  *     def __repr__(self):             # <<<<<<<<<<<<<<
11887  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
11888  *                                                id(self))
11889  */
11890 
11891   /* function exit code */
11892   __pyx_L1_error:;
11893   __Pyx_XDECREF(__pyx_t_1);
11894   __Pyx_XDECREF(__pyx_t_2);
11895   __Pyx_XDECREF(__pyx_t_3);
11896   __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11897   __pyx_r = NULL;
11898   __pyx_L0:;
11899   __Pyx_XGIVEREF(__pyx_r);
11900   __Pyx_RefNannyFinishContext();
11901   return __pyx_r;
11902 }
11903 
11904 /* "View.MemoryView":615
11905  *                                                id(self))
11906  *
11907  *     def __str__(self):             # <<<<<<<<<<<<<<
11908  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
11909  *
11910  */
11911 
11912 /* Python wrapper */
11913 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___str__(PyObject * __pyx_v_self)11914 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
11915   PyObject *__pyx_r = 0;
11916   __Pyx_RefNannyDeclarations
11917   __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
11918   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11919 
11920   /* function exit code */
11921   __Pyx_RefNannyFinishContext();
11922   return __pyx_r;
11923 }
11924 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj * __pyx_v_self)11925 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
11926   PyObject *__pyx_r = NULL;
11927   __Pyx_RefNannyDeclarations
11928   PyObject *__pyx_t_1 = NULL;
11929   PyObject *__pyx_t_2 = NULL;
11930   int __pyx_lineno = 0;
11931   const char *__pyx_filename = NULL;
11932   int __pyx_clineno = 0;
11933   __Pyx_RefNannySetupContext("__str__", 0);
11934 
11935   /* "View.MemoryView":616
11936  *
11937  *     def __str__(self):
11938  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
11939  *
11940  *
11941  */
11942   __Pyx_XDECREF(__pyx_r);
11943   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
11944   __Pyx_GOTREF(__pyx_t_1);
11945   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
11946   __Pyx_GOTREF(__pyx_t_2);
11947   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11948   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
11949   __Pyx_GOTREF(__pyx_t_1);
11950   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11951   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
11952   __Pyx_GOTREF(__pyx_t_2);
11953   __Pyx_GIVEREF(__pyx_t_1);
11954   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
11955   __pyx_t_1 = 0;
11956   __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
11957   __Pyx_GOTREF(__pyx_t_1);
11958   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11959   __pyx_r = __pyx_t_1;
11960   __pyx_t_1 = 0;
11961   goto __pyx_L0;
11962 
11963   /* "View.MemoryView":615
11964  *                                                id(self))
11965  *
11966  *     def __str__(self):             # <<<<<<<<<<<<<<
11967  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
11968  *
11969  */
11970 
11971   /* function exit code */
11972   __pyx_L1_error:;
11973   __Pyx_XDECREF(__pyx_t_1);
11974   __Pyx_XDECREF(__pyx_t_2);
11975   __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11976   __pyx_r = NULL;
11977   __pyx_L0:;
11978   __Pyx_XGIVEREF(__pyx_r);
11979   __Pyx_RefNannyFinishContext();
11980   return __pyx_r;
11981 }
11982 
11983 /* "View.MemoryView":619
11984  *
11985  *
11986  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
11987  *         cdef __Pyx_memviewslice *mslice
11988  *         cdef __Pyx_memviewslice tmp
11989  */
11990 
11991 /* Python wrapper */
11992 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)11993 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11994   PyObject *__pyx_r = 0;
11995   __Pyx_RefNannyDeclarations
11996   __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
11997   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
11998 
11999   /* function exit code */
12000   __Pyx_RefNannyFinishContext();
12001   return __pyx_r;
12002 }
12003 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj * __pyx_v_self)12004 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
12005   __Pyx_memviewslice *__pyx_v_mslice;
12006   __Pyx_memviewslice __pyx_v_tmp;
12007   PyObject *__pyx_r = NULL;
12008   __Pyx_RefNannyDeclarations
12009   __Pyx_memviewslice *__pyx_t_1;
12010   PyObject *__pyx_t_2 = NULL;
12011   int __pyx_lineno = 0;
12012   const char *__pyx_filename = NULL;
12013   int __pyx_clineno = 0;
12014   __Pyx_RefNannySetupContext("is_c_contig", 0);
12015 
12016   /* "View.MemoryView":622
12017  *         cdef __Pyx_memviewslice *mslice
12018  *         cdef __Pyx_memviewslice tmp
12019  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
12020  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
12021  *
12022  */
12023   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 622, __pyx_L1_error)
12024   __pyx_v_mslice = __pyx_t_1;
12025 
12026   /* "View.MemoryView":623
12027  *         cdef __Pyx_memviewslice tmp
12028  *         mslice = get_slice_from_memview(self, &tmp)
12029  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
12030  *
12031  *     def is_f_contig(self):
12032  */
12033   __Pyx_XDECREF(__pyx_r);
12034   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 623, __pyx_L1_error)
12035   __Pyx_GOTREF(__pyx_t_2);
12036   __pyx_r = __pyx_t_2;
12037   __pyx_t_2 = 0;
12038   goto __pyx_L0;
12039 
12040   /* "View.MemoryView":619
12041  *
12042  *
12043  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
12044  *         cdef __Pyx_memviewslice *mslice
12045  *         cdef __Pyx_memviewslice tmp
12046  */
12047 
12048   /* function exit code */
12049   __pyx_L1_error:;
12050   __Pyx_XDECREF(__pyx_t_2);
12051   __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
12052   __pyx_r = NULL;
12053   __pyx_L0:;
12054   __Pyx_XGIVEREF(__pyx_r);
12055   __Pyx_RefNannyFinishContext();
12056   return __pyx_r;
12057 }
12058 
12059 /* "View.MemoryView":625
12060  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
12061  *
12062  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
12063  *         cdef __Pyx_memviewslice *mslice
12064  *         cdef __Pyx_memviewslice tmp
12065  */
12066 
12067 /* Python wrapper */
12068 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)12069 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12070   PyObject *__pyx_r = 0;
12071   __Pyx_RefNannyDeclarations
12072   __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
12073   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
12074 
12075   /* function exit code */
12076   __Pyx_RefNannyFinishContext();
12077   return __pyx_r;
12078 }
12079 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj * __pyx_v_self)12080 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
12081   __Pyx_memviewslice *__pyx_v_mslice;
12082   __Pyx_memviewslice __pyx_v_tmp;
12083   PyObject *__pyx_r = NULL;
12084   __Pyx_RefNannyDeclarations
12085   __Pyx_memviewslice *__pyx_t_1;
12086   PyObject *__pyx_t_2 = NULL;
12087   int __pyx_lineno = 0;
12088   const char *__pyx_filename = NULL;
12089   int __pyx_clineno = 0;
12090   __Pyx_RefNannySetupContext("is_f_contig", 0);
12091 
12092   /* "View.MemoryView":628
12093  *         cdef __Pyx_memviewslice *mslice
12094  *         cdef __Pyx_memviewslice tmp
12095  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
12096  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
12097  *
12098  */
12099   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 628, __pyx_L1_error)
12100   __pyx_v_mslice = __pyx_t_1;
12101 
12102   /* "View.MemoryView":629
12103  *         cdef __Pyx_memviewslice tmp
12104  *         mslice = get_slice_from_memview(self, &tmp)
12105  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
12106  *
12107  *     def copy(self):
12108  */
12109   __Pyx_XDECREF(__pyx_r);
12110   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 629, __pyx_L1_error)
12111   __Pyx_GOTREF(__pyx_t_2);
12112   __pyx_r = __pyx_t_2;
12113   __pyx_t_2 = 0;
12114   goto __pyx_L0;
12115 
12116   /* "View.MemoryView":625
12117  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
12118  *
12119  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
12120  *         cdef __Pyx_memviewslice *mslice
12121  *         cdef __Pyx_memviewslice tmp
12122  */
12123 
12124   /* function exit code */
12125   __pyx_L1_error:;
12126   __Pyx_XDECREF(__pyx_t_2);
12127   __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
12128   __pyx_r = NULL;
12129   __pyx_L0:;
12130   __Pyx_XGIVEREF(__pyx_r);
12131   __Pyx_RefNannyFinishContext();
12132   return __pyx_r;
12133 }
12134 
12135 /* "View.MemoryView":631
12136  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
12137  *
12138  *     def copy(self):             # <<<<<<<<<<<<<<
12139  *         cdef __Pyx_memviewslice mslice
12140  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
12141  */
12142 
12143 /* Python wrapper */
12144 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)12145 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12146   PyObject *__pyx_r = 0;
12147   __Pyx_RefNannyDeclarations
12148   __Pyx_RefNannySetupContext("copy (wrapper)", 0);
12149   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
12150 
12151   /* function exit code */
12152   __Pyx_RefNannyFinishContext();
12153   return __pyx_r;
12154 }
12155 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj * __pyx_v_self)12156 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
12157   __Pyx_memviewslice __pyx_v_mslice;
12158   int __pyx_v_flags;
12159   PyObject *__pyx_r = NULL;
12160   __Pyx_RefNannyDeclarations
12161   __Pyx_memviewslice __pyx_t_1;
12162   PyObject *__pyx_t_2 = NULL;
12163   int __pyx_lineno = 0;
12164   const char *__pyx_filename = NULL;
12165   int __pyx_clineno = 0;
12166   __Pyx_RefNannySetupContext("copy", 0);
12167 
12168   /* "View.MemoryView":633
12169  *     def copy(self):
12170  *         cdef __Pyx_memviewslice mslice
12171  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
12172  *
12173  *         slice_copy(self, &mslice)
12174  */
12175   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
12176 
12177   /* "View.MemoryView":635
12178  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
12179  *
12180  *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
12181  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
12182  *                                    self.view.itemsize,
12183  */
12184   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
12185 
12186   /* "View.MemoryView":636
12187  *
12188  *         slice_copy(self, &mslice)
12189  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
12190  *                                    self.view.itemsize,
12191  *                                    flags|PyBUF_C_CONTIGUOUS,
12192  */
12193   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 636, __pyx_L1_error)
12194   __pyx_v_mslice = __pyx_t_1;
12195 
12196   /* "View.MemoryView":641
12197  *                                    self.dtype_is_object)
12198  *
12199  *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
12200  *
12201  *     def copy_fortran(self):
12202  */
12203   __Pyx_XDECREF(__pyx_r);
12204   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 641, __pyx_L1_error)
12205   __Pyx_GOTREF(__pyx_t_2);
12206   __pyx_r = __pyx_t_2;
12207   __pyx_t_2 = 0;
12208   goto __pyx_L0;
12209 
12210   /* "View.MemoryView":631
12211  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
12212  *
12213  *     def copy(self):             # <<<<<<<<<<<<<<
12214  *         cdef __Pyx_memviewslice mslice
12215  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
12216  */
12217 
12218   /* function exit code */
12219   __pyx_L1_error:;
12220   __Pyx_XDECREF(__pyx_t_2);
12221   __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
12222   __pyx_r = NULL;
12223   __pyx_L0:;
12224   __Pyx_XGIVEREF(__pyx_r);
12225   __Pyx_RefNannyFinishContext();
12226   return __pyx_r;
12227 }
12228 
12229 /* "View.MemoryView":643
12230  *         return memoryview_copy_from_slice(self, &mslice)
12231  *
12232  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
12233  *         cdef __Pyx_memviewslice src, dst
12234  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
12235  */
12236 
12237 /* Python wrapper */
12238 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)12239 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12240   PyObject *__pyx_r = 0;
12241   __Pyx_RefNannyDeclarations
12242   __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
12243   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
12244 
12245   /* function exit code */
12246   __Pyx_RefNannyFinishContext();
12247   return __pyx_r;
12248 }
12249 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj * __pyx_v_self)12250 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
12251   __Pyx_memviewslice __pyx_v_src;
12252   __Pyx_memviewslice __pyx_v_dst;
12253   int __pyx_v_flags;
12254   PyObject *__pyx_r = NULL;
12255   __Pyx_RefNannyDeclarations
12256   __Pyx_memviewslice __pyx_t_1;
12257   PyObject *__pyx_t_2 = NULL;
12258   int __pyx_lineno = 0;
12259   const char *__pyx_filename = NULL;
12260   int __pyx_clineno = 0;
12261   __Pyx_RefNannySetupContext("copy_fortran", 0);
12262 
12263   /* "View.MemoryView":645
12264  *     def copy_fortran(self):
12265  *         cdef __Pyx_memviewslice src, dst
12266  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
12267  *
12268  *         slice_copy(self, &src)
12269  */
12270   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
12271 
12272   /* "View.MemoryView":647
12273  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
12274  *
12275  *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
12276  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
12277  *                                 self.view.itemsize,
12278  */
12279   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
12280 
12281   /* "View.MemoryView":648
12282  *
12283  *         slice_copy(self, &src)
12284  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
12285  *                                 self.view.itemsize,
12286  *                                 flags|PyBUF_F_CONTIGUOUS,
12287  */
12288   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 648, __pyx_L1_error)
12289   __pyx_v_dst = __pyx_t_1;
12290 
12291   /* "View.MemoryView":653
12292  *                                 self.dtype_is_object)
12293  *
12294  *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
12295  *
12296  *
12297  */
12298   __Pyx_XDECREF(__pyx_r);
12299   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error)
12300   __Pyx_GOTREF(__pyx_t_2);
12301   __pyx_r = __pyx_t_2;
12302   __pyx_t_2 = 0;
12303   goto __pyx_L0;
12304 
12305   /* "View.MemoryView":643
12306  *         return memoryview_copy_from_slice(self, &mslice)
12307  *
12308  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
12309  *         cdef __Pyx_memviewslice src, dst
12310  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
12311  */
12312 
12313   /* function exit code */
12314   __pyx_L1_error:;
12315   __Pyx_XDECREF(__pyx_t_2);
12316   __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
12317   __pyx_r = NULL;
12318   __pyx_L0:;
12319   __Pyx_XGIVEREF(__pyx_r);
12320   __Pyx_RefNannyFinishContext();
12321   return __pyx_r;
12322 }
12323 
12324 /* "(tree fragment)":1
12325  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
12326  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12327  * def __setstate_cython__(self, __pyx_state):
12328  */
12329 
12330 /* Python wrapper */
12331 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)12332 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12333   PyObject *__pyx_r = 0;
12334   __Pyx_RefNannyDeclarations
12335   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
12336   __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12337 
12338   /* function exit code */
12339   __Pyx_RefNannyFinishContext();
12340   return __pyx_r;
12341 }
12342 
__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self)12343 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
12344   PyObject *__pyx_r = NULL;
12345   __Pyx_RefNannyDeclarations
12346   PyObject *__pyx_t_1 = NULL;
12347   int __pyx_lineno = 0;
12348   const char *__pyx_filename = NULL;
12349   int __pyx_clineno = 0;
12350   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
12351 
12352   /* "(tree fragment)":2
12353  * def __reduce_cython__(self):
12354  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
12355  * def __setstate_cython__(self, __pyx_state):
12356  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12357  */
12358   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
12359   __Pyx_GOTREF(__pyx_t_1);
12360   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
12361   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12362   __PYX_ERR(2, 2, __pyx_L1_error)
12363 
12364   /* "(tree fragment)":1
12365  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
12366  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12367  * def __setstate_cython__(self, __pyx_state):
12368  */
12369 
12370   /* function exit code */
12371   __pyx_L1_error:;
12372   __Pyx_XDECREF(__pyx_t_1);
12373   __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12374   __pyx_r = NULL;
12375   __Pyx_XGIVEREF(__pyx_r);
12376   __Pyx_RefNannyFinishContext();
12377   return __pyx_r;
12378 }
12379 
12380 /* "(tree fragment)":3
12381  * def __reduce_cython__(self):
12382  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12383  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
12384  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12385  */
12386 
12387 /* Python wrapper */
12388 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)12389 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
12390   PyObject *__pyx_r = 0;
12391   __Pyx_RefNannyDeclarations
12392   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
12393   __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
12394 
12395   /* function exit code */
12396   __Pyx_RefNannyFinishContext();
12397   return __pyx_r;
12398 }
12399 
__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)12400 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) {
12401   PyObject *__pyx_r = NULL;
12402   __Pyx_RefNannyDeclarations
12403   PyObject *__pyx_t_1 = NULL;
12404   int __pyx_lineno = 0;
12405   const char *__pyx_filename = NULL;
12406   int __pyx_clineno = 0;
12407   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
12408 
12409   /* "(tree fragment)":4
12410  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12411  * def __setstate_cython__(self, __pyx_state):
12412  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
12413  */
12414   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
12415   __Pyx_GOTREF(__pyx_t_1);
12416   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
12417   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12418   __PYX_ERR(2, 4, __pyx_L1_error)
12419 
12420   /* "(tree fragment)":3
12421  * def __reduce_cython__(self):
12422  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12423  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
12424  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12425  */
12426 
12427   /* function exit code */
12428   __pyx_L1_error:;
12429   __Pyx_XDECREF(__pyx_t_1);
12430   __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12431   __pyx_r = NULL;
12432   __Pyx_XGIVEREF(__pyx_r);
12433   __Pyx_RefNannyFinishContext();
12434   return __pyx_r;
12435 }
12436 
12437 /* "View.MemoryView":657
12438  *
12439  * @cname('__pyx_memoryview_new')
12440  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
12441  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
12442  *     result.typeinfo = typeinfo
12443  */
12444 
__pyx_memoryview_new(PyObject * __pyx_v_o,int __pyx_v_flags,int __pyx_v_dtype_is_object,__Pyx_TypeInfo * __pyx_v_typeinfo)12445 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
12446   struct __pyx_memoryview_obj *__pyx_v_result = 0;
12447   PyObject *__pyx_r = NULL;
12448   __Pyx_RefNannyDeclarations
12449   PyObject *__pyx_t_1 = NULL;
12450   PyObject *__pyx_t_2 = NULL;
12451   PyObject *__pyx_t_3 = NULL;
12452   int __pyx_lineno = 0;
12453   const char *__pyx_filename = NULL;
12454   int __pyx_clineno = 0;
12455   __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
12456 
12457   /* "View.MemoryView":658
12458  * @cname('__pyx_memoryview_new')
12459  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
12460  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
12461  *     result.typeinfo = typeinfo
12462  *     return result
12463  */
12464   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error)
12465   __Pyx_GOTREF(__pyx_t_1);
12466   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
12467   __Pyx_GOTREF(__pyx_t_2);
12468   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error)
12469   __Pyx_GOTREF(__pyx_t_3);
12470   __Pyx_INCREF(__pyx_v_o);
12471   __Pyx_GIVEREF(__pyx_v_o);
12472   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
12473   __Pyx_GIVEREF(__pyx_t_1);
12474   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
12475   __Pyx_GIVEREF(__pyx_t_2);
12476   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
12477   __pyx_t_1 = 0;
12478   __pyx_t_2 = 0;
12479   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
12480   __Pyx_GOTREF(__pyx_t_2);
12481   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12482   __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
12483   __pyx_t_2 = 0;
12484 
12485   /* "View.MemoryView":659
12486  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
12487  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
12488  *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
12489  *     return result
12490  *
12491  */
12492   __pyx_v_result->typeinfo = __pyx_v_typeinfo;
12493 
12494   /* "View.MemoryView":660
12495  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
12496  *     result.typeinfo = typeinfo
12497  *     return result             # <<<<<<<<<<<<<<
12498  *
12499  * @cname('__pyx_memoryview_check')
12500  */
12501   __Pyx_XDECREF(__pyx_r);
12502   __Pyx_INCREF(((PyObject *)__pyx_v_result));
12503   __pyx_r = ((PyObject *)__pyx_v_result);
12504   goto __pyx_L0;
12505 
12506   /* "View.MemoryView":657
12507  *
12508  * @cname('__pyx_memoryview_new')
12509  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
12510  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
12511  *     result.typeinfo = typeinfo
12512  */
12513 
12514   /* function exit code */
12515   __pyx_L1_error:;
12516   __Pyx_XDECREF(__pyx_t_1);
12517   __Pyx_XDECREF(__pyx_t_2);
12518   __Pyx_XDECREF(__pyx_t_3);
12519   __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
12520   __pyx_r = 0;
12521   __pyx_L0:;
12522   __Pyx_XDECREF((PyObject *)__pyx_v_result);
12523   __Pyx_XGIVEREF(__pyx_r);
12524   __Pyx_RefNannyFinishContext();
12525   return __pyx_r;
12526 }
12527 
12528 /* "View.MemoryView":663
12529  *
12530  * @cname('__pyx_memoryview_check')
12531  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
12532  *     return isinstance(o, memoryview)
12533  *
12534  */
12535 
__pyx_memoryview_check(PyObject * __pyx_v_o)12536 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
12537   int __pyx_r;
12538   __Pyx_RefNannyDeclarations
12539   int __pyx_t_1;
12540   __Pyx_RefNannySetupContext("memoryview_check", 0);
12541 
12542   /* "View.MemoryView":664
12543  * @cname('__pyx_memoryview_check')
12544  * cdef inline bint memoryview_check(object o):
12545  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
12546  *
12547  * cdef tuple _unellipsify(object index, int ndim):
12548  */
12549   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
12550   __pyx_r = __pyx_t_1;
12551   goto __pyx_L0;
12552 
12553   /* "View.MemoryView":663
12554  *
12555  * @cname('__pyx_memoryview_check')
12556  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
12557  *     return isinstance(o, memoryview)
12558  *
12559  */
12560 
12561   /* function exit code */
12562   __pyx_L0:;
12563   __Pyx_RefNannyFinishContext();
12564   return __pyx_r;
12565 }
12566 
12567 /* "View.MemoryView":666
12568  *     return isinstance(o, memoryview)
12569  *
12570  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
12571  *     """
12572  *     Replace all ellipses with full slices and fill incomplete indices with
12573  */
12574 
_unellipsify(PyObject * __pyx_v_index,int __pyx_v_ndim)12575 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
12576   PyObject *__pyx_v_tup = NULL;
12577   PyObject *__pyx_v_result = NULL;
12578   int __pyx_v_have_slices;
12579   int __pyx_v_seen_ellipsis;
12580   CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
12581   PyObject *__pyx_v_item = NULL;
12582   Py_ssize_t __pyx_v_nslices;
12583   PyObject *__pyx_r = NULL;
12584   __Pyx_RefNannyDeclarations
12585   int __pyx_t_1;
12586   int __pyx_t_2;
12587   PyObject *__pyx_t_3 = NULL;
12588   PyObject *__pyx_t_4 = NULL;
12589   Py_ssize_t __pyx_t_5;
12590   PyObject *(*__pyx_t_6)(PyObject *);
12591   PyObject *__pyx_t_7 = NULL;
12592   Py_ssize_t __pyx_t_8;
12593   int __pyx_t_9;
12594   int __pyx_t_10;
12595   PyObject *__pyx_t_11 = NULL;
12596   int __pyx_lineno = 0;
12597   const char *__pyx_filename = NULL;
12598   int __pyx_clineno = 0;
12599   __Pyx_RefNannySetupContext("_unellipsify", 0);
12600 
12601   /* "View.MemoryView":671
12602  *     full slices.
12603  *     """
12604  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
12605  *         tup = (index,)
12606  *     else:
12607  */
12608   __pyx_t_1 = PyTuple_Check(__pyx_v_index);
12609   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
12610   if (__pyx_t_2) {
12611 
12612     /* "View.MemoryView":672
12613  *     """
12614  *     if not isinstance(index, tuple):
12615  *         tup = (index,)             # <<<<<<<<<<<<<<
12616  *     else:
12617  *         tup = index
12618  */
12619     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error)
12620     __Pyx_GOTREF(__pyx_t_3);
12621     __Pyx_INCREF(__pyx_v_index);
12622     __Pyx_GIVEREF(__pyx_v_index);
12623     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
12624     __pyx_v_tup = __pyx_t_3;
12625     __pyx_t_3 = 0;
12626 
12627     /* "View.MemoryView":671
12628  *     full slices.
12629  *     """
12630  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
12631  *         tup = (index,)
12632  *     else:
12633  */
12634     goto __pyx_L3;
12635   }
12636 
12637   /* "View.MemoryView":674
12638  *         tup = (index,)
12639  *     else:
12640  *         tup = index             # <<<<<<<<<<<<<<
12641  *
12642  *     result = []
12643  */
12644   /*else*/ {
12645     __Pyx_INCREF(__pyx_v_index);
12646     __pyx_v_tup = __pyx_v_index;
12647   }
12648   __pyx_L3:;
12649 
12650   /* "View.MemoryView":676
12651  *         tup = index
12652  *
12653  *     result = []             # <<<<<<<<<<<<<<
12654  *     have_slices = False
12655  *     seen_ellipsis = False
12656  */
12657   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error)
12658   __Pyx_GOTREF(__pyx_t_3);
12659   __pyx_v_result = ((PyObject*)__pyx_t_3);
12660   __pyx_t_3 = 0;
12661 
12662   /* "View.MemoryView":677
12663  *
12664  *     result = []
12665  *     have_slices = False             # <<<<<<<<<<<<<<
12666  *     seen_ellipsis = False
12667  *     for idx, item in enumerate(tup):
12668  */
12669   __pyx_v_have_slices = 0;
12670 
12671   /* "View.MemoryView":678
12672  *     result = []
12673  *     have_slices = False
12674  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
12675  *     for idx, item in enumerate(tup):
12676  *         if item is Ellipsis:
12677  */
12678   __pyx_v_seen_ellipsis = 0;
12679 
12680   /* "View.MemoryView":679
12681  *     have_slices = False
12682  *     seen_ellipsis = False
12683  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
12684  *         if item is Ellipsis:
12685  *             if not seen_ellipsis:
12686  */
12687   __Pyx_INCREF(__pyx_int_0);
12688   __pyx_t_3 = __pyx_int_0;
12689   if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
12690     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
12691     __pyx_t_6 = NULL;
12692   } else {
12693     __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error)
12694     __Pyx_GOTREF(__pyx_t_4);
12695     __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error)
12696   }
12697   for (;;) {
12698     if (likely(!__pyx_t_6)) {
12699       if (likely(PyList_CheckExact(__pyx_t_4))) {
12700         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
12701         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12702         __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
12703         #else
12704         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
12705         __Pyx_GOTREF(__pyx_t_7);
12706         #endif
12707       } else {
12708         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
12709         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12710         __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
12711         #else
12712         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
12713         __Pyx_GOTREF(__pyx_t_7);
12714         #endif
12715       }
12716     } else {
12717       __pyx_t_7 = __pyx_t_6(__pyx_t_4);
12718       if (unlikely(!__pyx_t_7)) {
12719         PyObject* exc_type = PyErr_Occurred();
12720         if (exc_type) {
12721           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12722           else __PYX_ERR(2, 679, __pyx_L1_error)
12723         }
12724         break;
12725       }
12726       __Pyx_GOTREF(__pyx_t_7);
12727     }
12728     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
12729     __pyx_t_7 = 0;
12730     __Pyx_INCREF(__pyx_t_3);
12731     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
12732     __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
12733     __Pyx_GOTREF(__pyx_t_7);
12734     __Pyx_DECREF(__pyx_t_3);
12735     __pyx_t_3 = __pyx_t_7;
12736     __pyx_t_7 = 0;
12737 
12738     /* "View.MemoryView":680
12739  *     seen_ellipsis = False
12740  *     for idx, item in enumerate(tup):
12741  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
12742  *             if not seen_ellipsis:
12743  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
12744  */
12745     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
12746     __pyx_t_1 = (__pyx_t_2 != 0);
12747     if (__pyx_t_1) {
12748 
12749       /* "View.MemoryView":681
12750  *     for idx, item in enumerate(tup):
12751  *         if item is Ellipsis:
12752  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
12753  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
12754  *                 seen_ellipsis = True
12755  */
12756       __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
12757       if (__pyx_t_1) {
12758 
12759         /* "View.MemoryView":682
12760  *         if item is Ellipsis:
12761  *             if not seen_ellipsis:
12762  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
12763  *                 seen_ellipsis = True
12764  *             else:
12765  */
12766         __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
12767         __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 682, __pyx_L1_error)
12768         __Pyx_GOTREF(__pyx_t_7);
12769         { Py_ssize_t __pyx_temp;
12770           for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
12771             __Pyx_INCREF(__pyx_slice__18);
12772             __Pyx_GIVEREF(__pyx_slice__18);
12773             PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__18);
12774           }
12775         }
12776         __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
12777         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12778 
12779         /* "View.MemoryView":683
12780  *             if not seen_ellipsis:
12781  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
12782  *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
12783  *             else:
12784  *                 result.append(slice(None))
12785  */
12786         __pyx_v_seen_ellipsis = 1;
12787 
12788         /* "View.MemoryView":681
12789  *     for idx, item in enumerate(tup):
12790  *         if item is Ellipsis:
12791  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
12792  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
12793  *                 seen_ellipsis = True
12794  */
12795         goto __pyx_L7;
12796       }
12797 
12798       /* "View.MemoryView":685
12799  *                 seen_ellipsis = True
12800  *             else:
12801  *                 result.append(slice(None))             # <<<<<<<<<<<<<<
12802  *             have_slices = True
12803  *         else:
12804  */
12805       /*else*/ {
12806         __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__18); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 685, __pyx_L1_error)
12807       }
12808       __pyx_L7:;
12809 
12810       /* "View.MemoryView":686
12811  *             else:
12812  *                 result.append(slice(None))
12813  *             have_slices = True             # <<<<<<<<<<<<<<
12814  *         else:
12815  *             if not isinstance(item, slice) and not PyIndex_Check(item):
12816  */
12817       __pyx_v_have_slices = 1;
12818 
12819       /* "View.MemoryView":680
12820  *     seen_ellipsis = False
12821  *     for idx, item in enumerate(tup):
12822  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
12823  *             if not seen_ellipsis:
12824  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
12825  */
12826       goto __pyx_L6;
12827     }
12828 
12829     /* "View.MemoryView":688
12830  *             have_slices = True
12831  *         else:
12832  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
12833  *                 raise TypeError("Cannot index with type '%s'" % type(item))
12834  *
12835  */
12836     /*else*/ {
12837       __pyx_t_2 = PySlice_Check(__pyx_v_item);
12838       __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
12839       if (__pyx_t_10) {
12840       } else {
12841         __pyx_t_1 = __pyx_t_10;
12842         goto __pyx_L9_bool_binop_done;
12843       }
12844       __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
12845       __pyx_t_1 = __pyx_t_10;
12846       __pyx_L9_bool_binop_done:;
12847       if (unlikely(__pyx_t_1)) {
12848 
12849         /* "View.MemoryView":689
12850  *         else:
12851  *             if not isinstance(item, slice) and not PyIndex_Check(item):
12852  *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
12853  *
12854  *             have_slices = have_slices or isinstance(item, slice)
12855  */
12856         __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 689, __pyx_L1_error)
12857         __Pyx_GOTREF(__pyx_t_7);
12858         __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error)
12859         __Pyx_GOTREF(__pyx_t_11);
12860         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12861         __Pyx_Raise(__pyx_t_11, 0, 0, 0);
12862         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
12863         __PYX_ERR(2, 689, __pyx_L1_error)
12864 
12865         /* "View.MemoryView":688
12866  *             have_slices = True
12867  *         else:
12868  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
12869  *                 raise TypeError("Cannot index with type '%s'" % type(item))
12870  *
12871  */
12872       }
12873 
12874       /* "View.MemoryView":691
12875  *                 raise TypeError("Cannot index with type '%s'" % type(item))
12876  *
12877  *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
12878  *             result.append(item)
12879  *
12880  */
12881       __pyx_t_10 = (__pyx_v_have_slices != 0);
12882       if (!__pyx_t_10) {
12883       } else {
12884         __pyx_t_1 = __pyx_t_10;
12885         goto __pyx_L11_bool_binop_done;
12886       }
12887       __pyx_t_10 = PySlice_Check(__pyx_v_item);
12888       __pyx_t_2 = (__pyx_t_10 != 0);
12889       __pyx_t_1 = __pyx_t_2;
12890       __pyx_L11_bool_binop_done:;
12891       __pyx_v_have_slices = __pyx_t_1;
12892 
12893       /* "View.MemoryView":692
12894  *
12895  *             have_slices = have_slices or isinstance(item, slice)
12896  *             result.append(item)             # <<<<<<<<<<<<<<
12897  *
12898  *     nslices = ndim - len(result)
12899  */
12900       __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error)
12901     }
12902     __pyx_L6:;
12903 
12904     /* "View.MemoryView":679
12905  *     have_slices = False
12906  *     seen_ellipsis = False
12907  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
12908  *         if item is Ellipsis:
12909  *             if not seen_ellipsis:
12910  */
12911   }
12912   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12913   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12914 
12915   /* "View.MemoryView":694
12916  *             result.append(item)
12917  *
12918  *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
12919  *     if nslices:
12920  *         result.extend([slice(None)] * nslices)
12921  */
12922   __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 694, __pyx_L1_error)
12923   __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
12924 
12925   /* "View.MemoryView":695
12926  *
12927  *     nslices = ndim - len(result)
12928  *     if nslices:             # <<<<<<<<<<<<<<
12929  *         result.extend([slice(None)] * nslices)
12930  *
12931  */
12932   __pyx_t_1 = (__pyx_v_nslices != 0);
12933   if (__pyx_t_1) {
12934 
12935     /* "View.MemoryView":696
12936  *     nslices = ndim - len(result)
12937  *     if nslices:
12938  *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
12939  *
12940  *     return have_slices or nslices, tuple(result)
12941  */
12942     __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 696, __pyx_L1_error)
12943     __Pyx_GOTREF(__pyx_t_3);
12944     { Py_ssize_t __pyx_temp;
12945       for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
12946         __Pyx_INCREF(__pyx_slice__18);
12947         __Pyx_GIVEREF(__pyx_slice__18);
12948         PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__18);
12949       }
12950     }
12951     __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 696, __pyx_L1_error)
12952     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12953 
12954     /* "View.MemoryView":695
12955  *
12956  *     nslices = ndim - len(result)
12957  *     if nslices:             # <<<<<<<<<<<<<<
12958  *         result.extend([slice(None)] * nslices)
12959  *
12960  */
12961   }
12962 
12963   /* "View.MemoryView":698
12964  *         result.extend([slice(None)] * nslices)
12965  *
12966  *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
12967  *
12968  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
12969  */
12970   __Pyx_XDECREF(__pyx_r);
12971   if (!__pyx_v_have_slices) {
12972   } else {
12973     __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
12974     __Pyx_GOTREF(__pyx_t_4);
12975     __pyx_t_3 = __pyx_t_4;
12976     __pyx_t_4 = 0;
12977     goto __pyx_L14_bool_binop_done;
12978   }
12979   __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
12980   __Pyx_GOTREF(__pyx_t_4);
12981   __pyx_t_3 = __pyx_t_4;
12982   __pyx_t_4 = 0;
12983   __pyx_L14_bool_binop_done:;
12984   __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
12985   __Pyx_GOTREF(__pyx_t_4);
12986   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error)
12987   __Pyx_GOTREF(__pyx_t_11);
12988   __Pyx_GIVEREF(__pyx_t_3);
12989   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
12990   __Pyx_GIVEREF(__pyx_t_4);
12991   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
12992   __pyx_t_3 = 0;
12993   __pyx_t_4 = 0;
12994   __pyx_r = ((PyObject*)__pyx_t_11);
12995   __pyx_t_11 = 0;
12996   goto __pyx_L0;
12997 
12998   /* "View.MemoryView":666
12999  *     return isinstance(o, memoryview)
13000  *
13001  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
13002  *     """
13003  *     Replace all ellipses with full slices and fill incomplete indices with
13004  */
13005 
13006   /* function exit code */
13007   __pyx_L1_error:;
13008   __Pyx_XDECREF(__pyx_t_3);
13009   __Pyx_XDECREF(__pyx_t_4);
13010   __Pyx_XDECREF(__pyx_t_7);
13011   __Pyx_XDECREF(__pyx_t_11);
13012   __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
13013   __pyx_r = 0;
13014   __pyx_L0:;
13015   __Pyx_XDECREF(__pyx_v_tup);
13016   __Pyx_XDECREF(__pyx_v_result);
13017   __Pyx_XDECREF(__pyx_v_idx);
13018   __Pyx_XDECREF(__pyx_v_item);
13019   __Pyx_XGIVEREF(__pyx_r);
13020   __Pyx_RefNannyFinishContext();
13021   return __pyx_r;
13022 }
13023 
13024 /* "View.MemoryView":700
13025  *     return have_slices or nslices, tuple(result)
13026  *
13027  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
13028  *     for suboffset in suboffsets[:ndim]:
13029  *         if suboffset >= 0:
13030  */
13031 
assert_direct_dimensions(Py_ssize_t * __pyx_v_suboffsets,int __pyx_v_ndim)13032 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
13033   Py_ssize_t __pyx_v_suboffset;
13034   PyObject *__pyx_r = NULL;
13035   __Pyx_RefNannyDeclarations
13036   Py_ssize_t *__pyx_t_1;
13037   Py_ssize_t *__pyx_t_2;
13038   Py_ssize_t *__pyx_t_3;
13039   int __pyx_t_4;
13040   PyObject *__pyx_t_5 = NULL;
13041   int __pyx_lineno = 0;
13042   const char *__pyx_filename = NULL;
13043   int __pyx_clineno = 0;
13044   __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
13045 
13046   /* "View.MemoryView":701
13047  *
13048  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
13049  *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
13050  *         if suboffset >= 0:
13051  *             raise ValueError("Indirect dimensions not supported")
13052  */
13053   __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
13054   for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
13055     __pyx_t_1 = __pyx_t_3;
13056     __pyx_v_suboffset = (__pyx_t_1[0]);
13057 
13058     /* "View.MemoryView":702
13059  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
13060  *     for suboffset in suboffsets[:ndim]:
13061  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
13062  *             raise ValueError("Indirect dimensions not supported")
13063  *
13064  */
13065     __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
13066     if (unlikely(__pyx_t_4)) {
13067 
13068       /* "View.MemoryView":703
13069  *     for suboffset in suboffsets[:ndim]:
13070  *         if suboffset >= 0:
13071  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
13072  *
13073  *
13074  */
13075       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 703, __pyx_L1_error)
13076       __Pyx_GOTREF(__pyx_t_5);
13077       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
13078       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13079       __PYX_ERR(2, 703, __pyx_L1_error)
13080 
13081       /* "View.MemoryView":702
13082  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
13083  *     for suboffset in suboffsets[:ndim]:
13084  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
13085  *             raise ValueError("Indirect dimensions not supported")
13086  *
13087  */
13088     }
13089   }
13090 
13091   /* "View.MemoryView":700
13092  *     return have_slices or nslices, tuple(result)
13093  *
13094  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
13095  *     for suboffset in suboffsets[:ndim]:
13096  *         if suboffset >= 0:
13097  */
13098 
13099   /* function exit code */
13100   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13101   goto __pyx_L0;
13102   __pyx_L1_error:;
13103   __Pyx_XDECREF(__pyx_t_5);
13104   __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
13105   __pyx_r = 0;
13106   __pyx_L0:;
13107   __Pyx_XGIVEREF(__pyx_r);
13108   __Pyx_RefNannyFinishContext();
13109   return __pyx_r;
13110 }
13111 
13112 /* "View.MemoryView":710
13113  *
13114  * @cname('__pyx_memview_slice')
13115  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
13116  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
13117  *     cdef bint negative_step
13118  */
13119 
__pyx_memview_slice(struct __pyx_memoryview_obj * __pyx_v_memview,PyObject * __pyx_v_indices)13120 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
13121   int __pyx_v_new_ndim;
13122   int __pyx_v_suboffset_dim;
13123   int __pyx_v_dim;
13124   __Pyx_memviewslice __pyx_v_src;
13125   __Pyx_memviewslice __pyx_v_dst;
13126   __Pyx_memviewslice *__pyx_v_p_src;
13127   struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
13128   __Pyx_memviewslice *__pyx_v_p_dst;
13129   int *__pyx_v_p_suboffset_dim;
13130   Py_ssize_t __pyx_v_start;
13131   Py_ssize_t __pyx_v_stop;
13132   Py_ssize_t __pyx_v_step;
13133   int __pyx_v_have_start;
13134   int __pyx_v_have_stop;
13135   int __pyx_v_have_step;
13136   PyObject *__pyx_v_index = NULL;
13137   struct __pyx_memoryview_obj *__pyx_r = NULL;
13138   __Pyx_RefNannyDeclarations
13139   int __pyx_t_1;
13140   int __pyx_t_2;
13141   PyObject *__pyx_t_3 = NULL;
13142   struct __pyx_memoryview_obj *__pyx_t_4;
13143   char *__pyx_t_5;
13144   int __pyx_t_6;
13145   Py_ssize_t __pyx_t_7;
13146   PyObject *(*__pyx_t_8)(PyObject *);
13147   PyObject *__pyx_t_9 = NULL;
13148   Py_ssize_t __pyx_t_10;
13149   int __pyx_t_11;
13150   Py_ssize_t __pyx_t_12;
13151   int __pyx_lineno = 0;
13152   const char *__pyx_filename = NULL;
13153   int __pyx_clineno = 0;
13154   __Pyx_RefNannySetupContext("memview_slice", 0);
13155 
13156   /* "View.MemoryView":711
13157  * @cname('__pyx_memview_slice')
13158  * cdef memoryview memview_slice(memoryview memview, object indices):
13159  *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
13160  *     cdef bint negative_step
13161  *     cdef __Pyx_memviewslice src, dst
13162  */
13163   __pyx_v_new_ndim = 0;
13164   __pyx_v_suboffset_dim = -1;
13165 
13166   /* "View.MemoryView":718
13167  *
13168  *
13169  *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
13170  *
13171  *     cdef _memoryviewslice memviewsliceobj
13172  */
13173   (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
13174 
13175   /* "View.MemoryView":722
13176  *     cdef _memoryviewslice memviewsliceobj
13177  *
13178  *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
13179  *
13180  *     if isinstance(memview, _memoryviewslice):
13181  */
13182   #ifndef CYTHON_WITHOUT_ASSERTIONS
13183   if (unlikely(!Py_OptimizeFlag)) {
13184     if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
13185       PyErr_SetNone(PyExc_AssertionError);
13186       __PYX_ERR(2, 722, __pyx_L1_error)
13187     }
13188   }
13189   #endif
13190 
13191   /* "View.MemoryView":724
13192  *     assert memview.view.ndim > 0
13193  *
13194  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
13195  *         memviewsliceobj = memview
13196  *         p_src = &memviewsliceobj.from_slice
13197  */
13198   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
13199   __pyx_t_2 = (__pyx_t_1 != 0);
13200   if (__pyx_t_2) {
13201 
13202     /* "View.MemoryView":725
13203  *
13204  *     if isinstance(memview, _memoryviewslice):
13205  *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
13206  *         p_src = &memviewsliceobj.from_slice
13207  *     else:
13208  */
13209     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 725, __pyx_L1_error)
13210     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
13211     __Pyx_INCREF(__pyx_t_3);
13212     __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
13213     __pyx_t_3 = 0;
13214 
13215     /* "View.MemoryView":726
13216  *     if isinstance(memview, _memoryviewslice):
13217  *         memviewsliceobj = memview
13218  *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
13219  *     else:
13220  *         slice_copy(memview, &src)
13221  */
13222     __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
13223 
13224     /* "View.MemoryView":724
13225  *     assert memview.view.ndim > 0
13226  *
13227  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
13228  *         memviewsliceobj = memview
13229  *         p_src = &memviewsliceobj.from_slice
13230  */
13231     goto __pyx_L3;
13232   }
13233 
13234   /* "View.MemoryView":728
13235  *         p_src = &memviewsliceobj.from_slice
13236  *     else:
13237  *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
13238  *         p_src = &src
13239  *
13240  */
13241   /*else*/ {
13242     __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
13243 
13244     /* "View.MemoryView":729
13245  *     else:
13246  *         slice_copy(memview, &src)
13247  *         p_src = &src             # <<<<<<<<<<<<<<
13248  *
13249  *
13250  */
13251     __pyx_v_p_src = (&__pyx_v_src);
13252   }
13253   __pyx_L3:;
13254 
13255   /* "View.MemoryView":735
13256  *
13257  *
13258  *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
13259  *     dst.data = p_src.data
13260  *
13261  */
13262   __pyx_t_4 = __pyx_v_p_src->memview;
13263   __pyx_v_dst.memview = __pyx_t_4;
13264 
13265   /* "View.MemoryView":736
13266  *
13267  *     dst.memview = p_src.memview
13268  *     dst.data = p_src.data             # <<<<<<<<<<<<<<
13269  *
13270  *
13271  */
13272   __pyx_t_5 = __pyx_v_p_src->data;
13273   __pyx_v_dst.data = __pyx_t_5;
13274 
13275   /* "View.MemoryView":741
13276  *
13277  *
13278  *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
13279  *     cdef int *p_suboffset_dim = &suboffset_dim
13280  *     cdef Py_ssize_t start, stop, step
13281  */
13282   __pyx_v_p_dst = (&__pyx_v_dst);
13283 
13284   /* "View.MemoryView":742
13285  *
13286  *     cdef __Pyx_memviewslice *p_dst = &dst
13287  *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
13288  *     cdef Py_ssize_t start, stop, step
13289  *     cdef bint have_start, have_stop, have_step
13290  */
13291   __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
13292 
13293   /* "View.MemoryView":746
13294  *     cdef bint have_start, have_stop, have_step
13295  *
13296  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
13297  *         if PyIndex_Check(index):
13298  *             slice_memviewslice(
13299  */
13300   __pyx_t_6 = 0;
13301   if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
13302     __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
13303     __pyx_t_8 = NULL;
13304   } else {
13305     __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error)
13306     __Pyx_GOTREF(__pyx_t_3);
13307     __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error)
13308   }
13309   for (;;) {
13310     if (likely(!__pyx_t_8)) {
13311       if (likely(PyList_CheckExact(__pyx_t_3))) {
13312         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
13313         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13314         __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
13315         #else
13316         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
13317         __Pyx_GOTREF(__pyx_t_9);
13318         #endif
13319       } else {
13320         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
13321         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13322         __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
13323         #else
13324         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
13325         __Pyx_GOTREF(__pyx_t_9);
13326         #endif
13327       }
13328     } else {
13329       __pyx_t_9 = __pyx_t_8(__pyx_t_3);
13330       if (unlikely(!__pyx_t_9)) {
13331         PyObject* exc_type = PyErr_Occurred();
13332         if (exc_type) {
13333           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
13334           else __PYX_ERR(2, 746, __pyx_L1_error)
13335         }
13336         break;
13337       }
13338       __Pyx_GOTREF(__pyx_t_9);
13339     }
13340     __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
13341     __pyx_t_9 = 0;
13342     __pyx_v_dim = __pyx_t_6;
13343     __pyx_t_6 = (__pyx_t_6 + 1);
13344 
13345     /* "View.MemoryView":747
13346  *
13347  *     for dim, index in enumerate(indices):
13348  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
13349  *             slice_memviewslice(
13350  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
13351  */
13352     __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
13353     if (__pyx_t_2) {
13354 
13355       /* "View.MemoryView":751
13356  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
13357  *                 dim, new_ndim, p_suboffset_dim,
13358  *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
13359  *                 0, 0, 0, # have_{start,stop,step}
13360  *                 False)
13361  */
13362       __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 751, __pyx_L1_error)
13363 
13364       /* "View.MemoryView":748
13365  *     for dim, index in enumerate(indices):
13366  *         if PyIndex_Check(index):
13367  *             slice_memviewslice(             # <<<<<<<<<<<<<<
13368  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
13369  *                 dim, new_ndim, p_suboffset_dim,
13370  */
13371       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 748, __pyx_L1_error)
13372 
13373       /* "View.MemoryView":747
13374  *
13375  *     for dim, index in enumerate(indices):
13376  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
13377  *             slice_memviewslice(
13378  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
13379  */
13380       goto __pyx_L6;
13381     }
13382 
13383     /* "View.MemoryView":754
13384  *                 0, 0, 0, # have_{start,stop,step}
13385  *                 False)
13386  *         elif index is None:             # <<<<<<<<<<<<<<
13387  *             p_dst.shape[new_ndim] = 1
13388  *             p_dst.strides[new_ndim] = 0
13389  */
13390     __pyx_t_2 = (__pyx_v_index == Py_None);
13391     __pyx_t_1 = (__pyx_t_2 != 0);
13392     if (__pyx_t_1) {
13393 
13394       /* "View.MemoryView":755
13395  *                 False)
13396  *         elif index is None:
13397  *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
13398  *             p_dst.strides[new_ndim] = 0
13399  *             p_dst.suboffsets[new_ndim] = -1
13400  */
13401       (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
13402 
13403       /* "View.MemoryView":756
13404  *         elif index is None:
13405  *             p_dst.shape[new_ndim] = 1
13406  *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
13407  *             p_dst.suboffsets[new_ndim] = -1
13408  *             new_ndim += 1
13409  */
13410       (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
13411 
13412       /* "View.MemoryView":757
13413  *             p_dst.shape[new_ndim] = 1
13414  *             p_dst.strides[new_ndim] = 0
13415  *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
13416  *             new_ndim += 1
13417  *         else:
13418  */
13419       (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
13420 
13421       /* "View.MemoryView":758
13422  *             p_dst.strides[new_ndim] = 0
13423  *             p_dst.suboffsets[new_ndim] = -1
13424  *             new_ndim += 1             # <<<<<<<<<<<<<<
13425  *         else:
13426  *             start = index.start or 0
13427  */
13428       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
13429 
13430       /* "View.MemoryView":754
13431  *                 0, 0, 0, # have_{start,stop,step}
13432  *                 False)
13433  *         elif index is None:             # <<<<<<<<<<<<<<
13434  *             p_dst.shape[new_ndim] = 1
13435  *             p_dst.strides[new_ndim] = 0
13436  */
13437       goto __pyx_L6;
13438     }
13439 
13440     /* "View.MemoryView":760
13441  *             new_ndim += 1
13442  *         else:
13443  *             start = index.start or 0             # <<<<<<<<<<<<<<
13444  *             stop = index.stop or 0
13445  *             step = index.step or 0
13446  */
13447     /*else*/ {
13448       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error)
13449       __Pyx_GOTREF(__pyx_t_9);
13450       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error)
13451       if (!__pyx_t_1) {
13452         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13453       } else {
13454         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 760, __pyx_L1_error)
13455         __pyx_t_10 = __pyx_t_12;
13456         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13457         goto __pyx_L7_bool_binop_done;
13458       }
13459       __pyx_t_10 = 0;
13460       __pyx_L7_bool_binop_done:;
13461       __pyx_v_start = __pyx_t_10;
13462 
13463       /* "View.MemoryView":761
13464  *         else:
13465  *             start = index.start or 0
13466  *             stop = index.stop or 0             # <<<<<<<<<<<<<<
13467  *             step = index.step or 0
13468  *
13469  */
13470       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error)
13471       __Pyx_GOTREF(__pyx_t_9);
13472       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error)
13473       if (!__pyx_t_1) {
13474         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13475       } else {
13476         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 761, __pyx_L1_error)
13477         __pyx_t_10 = __pyx_t_12;
13478         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13479         goto __pyx_L9_bool_binop_done;
13480       }
13481       __pyx_t_10 = 0;
13482       __pyx_L9_bool_binop_done:;
13483       __pyx_v_stop = __pyx_t_10;
13484 
13485       /* "View.MemoryView":762
13486  *             start = index.start or 0
13487  *             stop = index.stop or 0
13488  *             step = index.step or 0             # <<<<<<<<<<<<<<
13489  *
13490  *             have_start = index.start is not None
13491  */
13492       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error)
13493       __Pyx_GOTREF(__pyx_t_9);
13494       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
13495       if (!__pyx_t_1) {
13496         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13497       } else {
13498         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error)
13499         __pyx_t_10 = __pyx_t_12;
13500         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13501         goto __pyx_L11_bool_binop_done;
13502       }
13503       __pyx_t_10 = 0;
13504       __pyx_L11_bool_binop_done:;
13505       __pyx_v_step = __pyx_t_10;
13506 
13507       /* "View.MemoryView":764
13508  *             step = index.step or 0
13509  *
13510  *             have_start = index.start is not None             # <<<<<<<<<<<<<<
13511  *             have_stop = index.stop is not None
13512  *             have_step = index.step is not None
13513  */
13514       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error)
13515       __Pyx_GOTREF(__pyx_t_9);
13516       __pyx_t_1 = (__pyx_t_9 != Py_None);
13517       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13518       __pyx_v_have_start = __pyx_t_1;
13519 
13520       /* "View.MemoryView":765
13521  *
13522  *             have_start = index.start is not None
13523  *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
13524  *             have_step = index.step is not None
13525  *
13526  */
13527       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 765, __pyx_L1_error)
13528       __Pyx_GOTREF(__pyx_t_9);
13529       __pyx_t_1 = (__pyx_t_9 != Py_None);
13530       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13531       __pyx_v_have_stop = __pyx_t_1;
13532 
13533       /* "View.MemoryView":766
13534  *             have_start = index.start is not None
13535  *             have_stop = index.stop is not None
13536  *             have_step = index.step is not None             # <<<<<<<<<<<<<<
13537  *
13538  *             slice_memviewslice(
13539  */
13540       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error)
13541       __Pyx_GOTREF(__pyx_t_9);
13542       __pyx_t_1 = (__pyx_t_9 != Py_None);
13543       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13544       __pyx_v_have_step = __pyx_t_1;
13545 
13546       /* "View.MemoryView":768
13547  *             have_step = index.step is not None
13548  *
13549  *             slice_memviewslice(             # <<<<<<<<<<<<<<
13550  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
13551  *                 dim, new_ndim, p_suboffset_dim,
13552  */
13553       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 768, __pyx_L1_error)
13554 
13555       /* "View.MemoryView":774
13556  *                 have_start, have_stop, have_step,
13557  *                 True)
13558  *             new_ndim += 1             # <<<<<<<<<<<<<<
13559  *
13560  *     if isinstance(memview, _memoryviewslice):
13561  */
13562       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
13563     }
13564     __pyx_L6:;
13565 
13566     /* "View.MemoryView":746
13567  *     cdef bint have_start, have_stop, have_step
13568  *
13569  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
13570  *         if PyIndex_Check(index):
13571  *             slice_memviewslice(
13572  */
13573   }
13574   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13575 
13576   /* "View.MemoryView":776
13577  *             new_ndim += 1
13578  *
13579  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
13580  *         return memoryview_fromslice(dst, new_ndim,
13581  *                                     memviewsliceobj.to_object_func,
13582  */
13583   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
13584   __pyx_t_2 = (__pyx_t_1 != 0);
13585   if (__pyx_t_2) {
13586 
13587     /* "View.MemoryView":777
13588  *
13589  *     if isinstance(memview, _memoryviewslice):
13590  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
13591  *                                     memviewsliceobj.to_object_func,
13592  *                                     memviewsliceobj.to_dtype_func,
13593  */
13594     __Pyx_XDECREF(((PyObject *)__pyx_r));
13595 
13596     /* "View.MemoryView":778
13597  *     if isinstance(memview, _memoryviewslice):
13598  *         return memoryview_fromslice(dst, new_ndim,
13599  *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
13600  *                                     memviewsliceobj.to_dtype_func,
13601  *                                     memview.dtype_is_object)
13602  */
13603     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) }
13604 
13605     /* "View.MemoryView":779
13606  *         return memoryview_fromslice(dst, new_ndim,
13607  *                                     memviewsliceobj.to_object_func,
13608  *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
13609  *                                     memview.dtype_is_object)
13610  *     else:
13611  */
13612     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) }
13613 
13614     /* "View.MemoryView":777
13615  *
13616  *     if isinstance(memview, _memoryviewslice):
13617  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
13618  *                                     memviewsliceobj.to_object_func,
13619  *                                     memviewsliceobj.to_dtype_func,
13620  */
13621     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 777, __pyx_L1_error)
13622     __Pyx_GOTREF(__pyx_t_3);
13623     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error)
13624     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
13625     __pyx_t_3 = 0;
13626     goto __pyx_L0;
13627 
13628     /* "View.MemoryView":776
13629  *             new_ndim += 1
13630  *
13631  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
13632  *         return memoryview_fromslice(dst, new_ndim,
13633  *                                     memviewsliceobj.to_object_func,
13634  */
13635   }
13636 
13637   /* "View.MemoryView":782
13638  *                                     memview.dtype_is_object)
13639  *     else:
13640  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
13641  *                                     memview.dtype_is_object)
13642  *
13643  */
13644   /*else*/ {
13645     __Pyx_XDECREF(((PyObject *)__pyx_r));
13646 
13647     /* "View.MemoryView":783
13648  *     else:
13649  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
13650  *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
13651  *
13652  *
13653  */
13654     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 782, __pyx_L1_error)
13655     __Pyx_GOTREF(__pyx_t_3);
13656 
13657     /* "View.MemoryView":782
13658  *                                     memview.dtype_is_object)
13659  *     else:
13660  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
13661  *                                     memview.dtype_is_object)
13662  *
13663  */
13664     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error)
13665     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
13666     __pyx_t_3 = 0;
13667     goto __pyx_L0;
13668   }
13669 
13670   /* "View.MemoryView":710
13671  *
13672  * @cname('__pyx_memview_slice')
13673  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
13674  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
13675  *     cdef bint negative_step
13676  */
13677 
13678   /* function exit code */
13679   __pyx_L1_error:;
13680   __Pyx_XDECREF(__pyx_t_3);
13681   __Pyx_XDECREF(__pyx_t_9);
13682   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
13683   __pyx_r = 0;
13684   __pyx_L0:;
13685   __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
13686   __Pyx_XDECREF(__pyx_v_index);
13687   __Pyx_XGIVEREF((PyObject *)__pyx_r);
13688   __Pyx_RefNannyFinishContext();
13689   return __pyx_r;
13690 }
13691 
13692 /* "View.MemoryView":807
13693  *
13694  * @cname('__pyx_memoryview_slice_memviewslice')
13695  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
13696  *         __Pyx_memviewslice *dst,
13697  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
13698  */
13699 
__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)13700 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) {
13701   Py_ssize_t __pyx_v_new_shape;
13702   int __pyx_v_negative_step;
13703   int __pyx_r;
13704   int __pyx_t_1;
13705   int __pyx_t_2;
13706   int __pyx_t_3;
13707   int __pyx_lineno = 0;
13708   const char *__pyx_filename = NULL;
13709   int __pyx_clineno = 0;
13710 
13711   /* "View.MemoryView":827
13712  *     cdef bint negative_step
13713  *
13714  *     if not is_slice:             # <<<<<<<<<<<<<<
13715  *
13716  *         if start < 0:
13717  */
13718   __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
13719   if (__pyx_t_1) {
13720 
13721     /* "View.MemoryView":829
13722  *     if not is_slice:
13723  *
13724  *         if start < 0:             # <<<<<<<<<<<<<<
13725  *             start += shape
13726  *         if not 0 <= start < shape:
13727  */
13728     __pyx_t_1 = ((__pyx_v_start < 0) != 0);
13729     if (__pyx_t_1) {
13730 
13731       /* "View.MemoryView":830
13732  *
13733  *         if start < 0:
13734  *             start += shape             # <<<<<<<<<<<<<<
13735  *         if not 0 <= start < shape:
13736  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
13737  */
13738       __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
13739 
13740       /* "View.MemoryView":829
13741  *     if not is_slice:
13742  *
13743  *         if start < 0:             # <<<<<<<<<<<<<<
13744  *             start += shape
13745  *         if not 0 <= start < shape:
13746  */
13747     }
13748 
13749     /* "View.MemoryView":831
13750  *         if start < 0:
13751  *             start += shape
13752  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
13753  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
13754  *     else:
13755  */
13756     __pyx_t_1 = (0 <= __pyx_v_start);
13757     if (__pyx_t_1) {
13758       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
13759     }
13760     __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
13761     if (__pyx_t_2) {
13762 
13763       /* "View.MemoryView":832
13764  *             start += shape
13765  *         if not 0 <= start < shape:
13766  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
13767  *     else:
13768  *
13769  */
13770       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 832, __pyx_L1_error)
13771 
13772       /* "View.MemoryView":831
13773  *         if start < 0:
13774  *             start += shape
13775  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
13776  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
13777  *     else:
13778  */
13779     }
13780 
13781     /* "View.MemoryView":827
13782  *     cdef bint negative_step
13783  *
13784  *     if not is_slice:             # <<<<<<<<<<<<<<
13785  *
13786  *         if start < 0:
13787  */
13788     goto __pyx_L3;
13789   }
13790 
13791   /* "View.MemoryView":835
13792  *     else:
13793  *
13794  *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
13795  *
13796  *         if have_step and step == 0:
13797  */
13798   /*else*/ {
13799     __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
13800     if (__pyx_t_1) {
13801     } else {
13802       __pyx_t_2 = __pyx_t_1;
13803       goto __pyx_L6_bool_binop_done;
13804     }
13805     __pyx_t_1 = ((__pyx_v_step < 0) != 0);
13806     __pyx_t_2 = __pyx_t_1;
13807     __pyx_L6_bool_binop_done:;
13808     __pyx_v_negative_step = __pyx_t_2;
13809 
13810     /* "View.MemoryView":837
13811  *         negative_step = have_step != 0 and step < 0
13812  *
13813  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
13814  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
13815  *
13816  */
13817     __pyx_t_1 = (__pyx_v_have_step != 0);
13818     if (__pyx_t_1) {
13819     } else {
13820       __pyx_t_2 = __pyx_t_1;
13821       goto __pyx_L9_bool_binop_done;
13822     }
13823     __pyx_t_1 = ((__pyx_v_step == 0) != 0);
13824     __pyx_t_2 = __pyx_t_1;
13825     __pyx_L9_bool_binop_done:;
13826     if (__pyx_t_2) {
13827 
13828       /* "View.MemoryView":838
13829  *
13830  *         if have_step and step == 0:
13831  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
13832  *
13833  *
13834  */
13835       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 838, __pyx_L1_error)
13836 
13837       /* "View.MemoryView":837
13838  *         negative_step = have_step != 0 and step < 0
13839  *
13840  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
13841  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
13842  *
13843  */
13844     }
13845 
13846     /* "View.MemoryView":841
13847  *
13848  *
13849  *         if have_start:             # <<<<<<<<<<<<<<
13850  *             if start < 0:
13851  *                 start += shape
13852  */
13853     __pyx_t_2 = (__pyx_v_have_start != 0);
13854     if (__pyx_t_2) {
13855 
13856       /* "View.MemoryView":842
13857  *
13858  *         if have_start:
13859  *             if start < 0:             # <<<<<<<<<<<<<<
13860  *                 start += shape
13861  *                 if start < 0:
13862  */
13863       __pyx_t_2 = ((__pyx_v_start < 0) != 0);
13864       if (__pyx_t_2) {
13865 
13866         /* "View.MemoryView":843
13867  *         if have_start:
13868  *             if start < 0:
13869  *                 start += shape             # <<<<<<<<<<<<<<
13870  *                 if start < 0:
13871  *                     start = 0
13872  */
13873         __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
13874 
13875         /* "View.MemoryView":844
13876  *             if start < 0:
13877  *                 start += shape
13878  *                 if start < 0:             # <<<<<<<<<<<<<<
13879  *                     start = 0
13880  *             elif start >= shape:
13881  */
13882         __pyx_t_2 = ((__pyx_v_start < 0) != 0);
13883         if (__pyx_t_2) {
13884 
13885           /* "View.MemoryView":845
13886  *                 start += shape
13887  *                 if start < 0:
13888  *                     start = 0             # <<<<<<<<<<<<<<
13889  *             elif start >= shape:
13890  *                 if negative_step:
13891  */
13892           __pyx_v_start = 0;
13893 
13894           /* "View.MemoryView":844
13895  *             if start < 0:
13896  *                 start += shape
13897  *                 if start < 0:             # <<<<<<<<<<<<<<
13898  *                     start = 0
13899  *             elif start >= shape:
13900  */
13901         }
13902 
13903         /* "View.MemoryView":842
13904  *
13905  *         if have_start:
13906  *             if start < 0:             # <<<<<<<<<<<<<<
13907  *                 start += shape
13908  *                 if start < 0:
13909  */
13910         goto __pyx_L12;
13911       }
13912 
13913       /* "View.MemoryView":846
13914  *                 if start < 0:
13915  *                     start = 0
13916  *             elif start >= shape:             # <<<<<<<<<<<<<<
13917  *                 if negative_step:
13918  *                     start = shape - 1
13919  */
13920       __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
13921       if (__pyx_t_2) {
13922 
13923         /* "View.MemoryView":847
13924  *                     start = 0
13925  *             elif start >= shape:
13926  *                 if negative_step:             # <<<<<<<<<<<<<<
13927  *                     start = shape - 1
13928  *                 else:
13929  */
13930         __pyx_t_2 = (__pyx_v_negative_step != 0);
13931         if (__pyx_t_2) {
13932 
13933           /* "View.MemoryView":848
13934  *             elif start >= shape:
13935  *                 if negative_step:
13936  *                     start = shape - 1             # <<<<<<<<<<<<<<
13937  *                 else:
13938  *                     start = shape
13939  */
13940           __pyx_v_start = (__pyx_v_shape - 1);
13941 
13942           /* "View.MemoryView":847
13943  *                     start = 0
13944  *             elif start >= shape:
13945  *                 if negative_step:             # <<<<<<<<<<<<<<
13946  *                     start = shape - 1
13947  *                 else:
13948  */
13949           goto __pyx_L14;
13950         }
13951 
13952         /* "View.MemoryView":850
13953  *                     start = shape - 1
13954  *                 else:
13955  *                     start = shape             # <<<<<<<<<<<<<<
13956  *         else:
13957  *             if negative_step:
13958  */
13959         /*else*/ {
13960           __pyx_v_start = __pyx_v_shape;
13961         }
13962         __pyx_L14:;
13963 
13964         /* "View.MemoryView":846
13965  *                 if start < 0:
13966  *                     start = 0
13967  *             elif start >= shape:             # <<<<<<<<<<<<<<
13968  *                 if negative_step:
13969  *                     start = shape - 1
13970  */
13971       }
13972       __pyx_L12:;
13973 
13974       /* "View.MemoryView":841
13975  *
13976  *
13977  *         if have_start:             # <<<<<<<<<<<<<<
13978  *             if start < 0:
13979  *                 start += shape
13980  */
13981       goto __pyx_L11;
13982     }
13983 
13984     /* "View.MemoryView":852
13985  *                     start = shape
13986  *         else:
13987  *             if negative_step:             # <<<<<<<<<<<<<<
13988  *                 start = shape - 1
13989  *             else:
13990  */
13991     /*else*/ {
13992       __pyx_t_2 = (__pyx_v_negative_step != 0);
13993       if (__pyx_t_2) {
13994 
13995         /* "View.MemoryView":853
13996  *         else:
13997  *             if negative_step:
13998  *                 start = shape - 1             # <<<<<<<<<<<<<<
13999  *             else:
14000  *                 start = 0
14001  */
14002         __pyx_v_start = (__pyx_v_shape - 1);
14003 
14004         /* "View.MemoryView":852
14005  *                     start = shape
14006  *         else:
14007  *             if negative_step:             # <<<<<<<<<<<<<<
14008  *                 start = shape - 1
14009  *             else:
14010  */
14011         goto __pyx_L15;
14012       }
14013 
14014       /* "View.MemoryView":855
14015  *                 start = shape - 1
14016  *             else:
14017  *                 start = 0             # <<<<<<<<<<<<<<
14018  *
14019  *         if have_stop:
14020  */
14021       /*else*/ {
14022         __pyx_v_start = 0;
14023       }
14024       __pyx_L15:;
14025     }
14026     __pyx_L11:;
14027 
14028     /* "View.MemoryView":857
14029  *                 start = 0
14030  *
14031  *         if have_stop:             # <<<<<<<<<<<<<<
14032  *             if stop < 0:
14033  *                 stop += shape
14034  */
14035     __pyx_t_2 = (__pyx_v_have_stop != 0);
14036     if (__pyx_t_2) {
14037 
14038       /* "View.MemoryView":858
14039  *
14040  *         if have_stop:
14041  *             if stop < 0:             # <<<<<<<<<<<<<<
14042  *                 stop += shape
14043  *                 if stop < 0:
14044  */
14045       __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
14046       if (__pyx_t_2) {
14047 
14048         /* "View.MemoryView":859
14049  *         if have_stop:
14050  *             if stop < 0:
14051  *                 stop += shape             # <<<<<<<<<<<<<<
14052  *                 if stop < 0:
14053  *                     stop = 0
14054  */
14055         __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
14056 
14057         /* "View.MemoryView":860
14058  *             if stop < 0:
14059  *                 stop += shape
14060  *                 if stop < 0:             # <<<<<<<<<<<<<<
14061  *                     stop = 0
14062  *             elif stop > shape:
14063  */
14064         __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
14065         if (__pyx_t_2) {
14066 
14067           /* "View.MemoryView":861
14068  *                 stop += shape
14069  *                 if stop < 0:
14070  *                     stop = 0             # <<<<<<<<<<<<<<
14071  *             elif stop > shape:
14072  *                 stop = shape
14073  */
14074           __pyx_v_stop = 0;
14075 
14076           /* "View.MemoryView":860
14077  *             if stop < 0:
14078  *                 stop += shape
14079  *                 if stop < 0:             # <<<<<<<<<<<<<<
14080  *                     stop = 0
14081  *             elif stop > shape:
14082  */
14083         }
14084 
14085         /* "View.MemoryView":858
14086  *
14087  *         if have_stop:
14088  *             if stop < 0:             # <<<<<<<<<<<<<<
14089  *                 stop += shape
14090  *                 if stop < 0:
14091  */
14092         goto __pyx_L17;
14093       }
14094 
14095       /* "View.MemoryView":862
14096  *                 if stop < 0:
14097  *                     stop = 0
14098  *             elif stop > shape:             # <<<<<<<<<<<<<<
14099  *                 stop = shape
14100  *         else:
14101  */
14102       __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
14103       if (__pyx_t_2) {
14104 
14105         /* "View.MemoryView":863
14106  *                     stop = 0
14107  *             elif stop > shape:
14108  *                 stop = shape             # <<<<<<<<<<<<<<
14109  *         else:
14110  *             if negative_step:
14111  */
14112         __pyx_v_stop = __pyx_v_shape;
14113 
14114         /* "View.MemoryView":862
14115  *                 if stop < 0:
14116  *                     stop = 0
14117  *             elif stop > shape:             # <<<<<<<<<<<<<<
14118  *                 stop = shape
14119  *         else:
14120  */
14121       }
14122       __pyx_L17:;
14123 
14124       /* "View.MemoryView":857
14125  *                 start = 0
14126  *
14127  *         if have_stop:             # <<<<<<<<<<<<<<
14128  *             if stop < 0:
14129  *                 stop += shape
14130  */
14131       goto __pyx_L16;
14132     }
14133 
14134     /* "View.MemoryView":865
14135  *                 stop = shape
14136  *         else:
14137  *             if negative_step:             # <<<<<<<<<<<<<<
14138  *                 stop = -1
14139  *             else:
14140  */
14141     /*else*/ {
14142       __pyx_t_2 = (__pyx_v_negative_step != 0);
14143       if (__pyx_t_2) {
14144 
14145         /* "View.MemoryView":866
14146  *         else:
14147  *             if negative_step:
14148  *                 stop = -1             # <<<<<<<<<<<<<<
14149  *             else:
14150  *                 stop = shape
14151  */
14152         __pyx_v_stop = -1L;
14153 
14154         /* "View.MemoryView":865
14155  *                 stop = shape
14156  *         else:
14157  *             if negative_step:             # <<<<<<<<<<<<<<
14158  *                 stop = -1
14159  *             else:
14160  */
14161         goto __pyx_L19;
14162       }
14163 
14164       /* "View.MemoryView":868
14165  *                 stop = -1
14166  *             else:
14167  *                 stop = shape             # <<<<<<<<<<<<<<
14168  *
14169  *         if not have_step:
14170  */
14171       /*else*/ {
14172         __pyx_v_stop = __pyx_v_shape;
14173       }
14174       __pyx_L19:;
14175     }
14176     __pyx_L16:;
14177 
14178     /* "View.MemoryView":870
14179  *                 stop = shape
14180  *
14181  *         if not have_step:             # <<<<<<<<<<<<<<
14182  *             step = 1
14183  *
14184  */
14185     __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
14186     if (__pyx_t_2) {
14187 
14188       /* "View.MemoryView":871
14189  *
14190  *         if not have_step:
14191  *             step = 1             # <<<<<<<<<<<<<<
14192  *
14193  *
14194  */
14195       __pyx_v_step = 1;
14196 
14197       /* "View.MemoryView":870
14198  *                 stop = shape
14199  *
14200  *         if not have_step:             # <<<<<<<<<<<<<<
14201  *             step = 1
14202  *
14203  */
14204     }
14205 
14206     /* "View.MemoryView":875
14207  *
14208  *         with cython.cdivision(True):
14209  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
14210  *
14211  *             if (stop - start) - step * new_shape:
14212  */
14213     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
14214 
14215     /* "View.MemoryView":877
14216  *             new_shape = (stop - start) // step
14217  *
14218  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
14219  *                 new_shape += 1
14220  *
14221  */
14222     __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
14223     if (__pyx_t_2) {
14224 
14225       /* "View.MemoryView":878
14226  *
14227  *             if (stop - start) - step * new_shape:
14228  *                 new_shape += 1             # <<<<<<<<<<<<<<
14229  *
14230  *         if new_shape < 0:
14231  */
14232       __pyx_v_new_shape = (__pyx_v_new_shape + 1);
14233 
14234       /* "View.MemoryView":877
14235  *             new_shape = (stop - start) // step
14236  *
14237  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
14238  *                 new_shape += 1
14239  *
14240  */
14241     }
14242 
14243     /* "View.MemoryView":880
14244  *                 new_shape += 1
14245  *
14246  *         if new_shape < 0:             # <<<<<<<<<<<<<<
14247  *             new_shape = 0
14248  *
14249  */
14250     __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
14251     if (__pyx_t_2) {
14252 
14253       /* "View.MemoryView":881
14254  *
14255  *         if new_shape < 0:
14256  *             new_shape = 0             # <<<<<<<<<<<<<<
14257  *
14258  *
14259  */
14260       __pyx_v_new_shape = 0;
14261 
14262       /* "View.MemoryView":880
14263  *                 new_shape += 1
14264  *
14265  *         if new_shape < 0:             # <<<<<<<<<<<<<<
14266  *             new_shape = 0
14267  *
14268  */
14269     }
14270 
14271     /* "View.MemoryView":884
14272  *
14273  *
14274  *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
14275  *         dst.shape[new_ndim] = new_shape
14276  *         dst.suboffsets[new_ndim] = suboffset
14277  */
14278     (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
14279 
14280     /* "View.MemoryView":885
14281  *
14282  *         dst.strides[new_ndim] = stride * step
14283  *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
14284  *         dst.suboffsets[new_ndim] = suboffset
14285  *
14286  */
14287     (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
14288 
14289     /* "View.MemoryView":886
14290  *         dst.strides[new_ndim] = stride * step
14291  *         dst.shape[new_ndim] = new_shape
14292  *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
14293  *
14294  *
14295  */
14296     (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
14297   }
14298   __pyx_L3:;
14299 
14300   /* "View.MemoryView":889
14301  *
14302  *
14303  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
14304  *         dst.data += start * stride
14305  *     else:
14306  */
14307   __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
14308   if (__pyx_t_2) {
14309 
14310     /* "View.MemoryView":890
14311  *
14312  *     if suboffset_dim[0] < 0:
14313  *         dst.data += start * stride             # <<<<<<<<<<<<<<
14314  *     else:
14315  *         dst.suboffsets[suboffset_dim[0]] += start * stride
14316  */
14317     __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
14318 
14319     /* "View.MemoryView":889
14320  *
14321  *
14322  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
14323  *         dst.data += start * stride
14324  *     else:
14325  */
14326     goto __pyx_L23;
14327   }
14328 
14329   /* "View.MemoryView":892
14330  *         dst.data += start * stride
14331  *     else:
14332  *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
14333  *
14334  *     if suboffset >= 0:
14335  */
14336   /*else*/ {
14337     __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
14338     (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
14339   }
14340   __pyx_L23:;
14341 
14342   /* "View.MemoryView":894
14343  *         dst.suboffsets[suboffset_dim[0]] += start * stride
14344  *
14345  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
14346  *         if not is_slice:
14347  *             if new_ndim == 0:
14348  */
14349   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
14350   if (__pyx_t_2) {
14351 
14352     /* "View.MemoryView":895
14353  *
14354  *     if suboffset >= 0:
14355  *         if not is_slice:             # <<<<<<<<<<<<<<
14356  *             if new_ndim == 0:
14357  *                 dst.data = (<char **> dst.data)[0] + suboffset
14358  */
14359     __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
14360     if (__pyx_t_2) {
14361 
14362       /* "View.MemoryView":896
14363  *     if suboffset >= 0:
14364  *         if not is_slice:
14365  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
14366  *                 dst.data = (<char **> dst.data)[0] + suboffset
14367  *             else:
14368  */
14369       __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
14370       if (__pyx_t_2) {
14371 
14372         /* "View.MemoryView":897
14373  *         if not is_slice:
14374  *             if new_ndim == 0:
14375  *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
14376  *             else:
14377  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
14378  */
14379         __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
14380 
14381         /* "View.MemoryView":896
14382  *     if suboffset >= 0:
14383  *         if not is_slice:
14384  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
14385  *                 dst.data = (<char **> dst.data)[0] + suboffset
14386  *             else:
14387  */
14388         goto __pyx_L26;
14389       }
14390 
14391       /* "View.MemoryView":899
14392  *                 dst.data = (<char **> dst.data)[0] + suboffset
14393  *             else:
14394  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
14395  *                                      "must be indexed and not sliced", dim)
14396  *         else:
14397  */
14398       /*else*/ {
14399 
14400         /* "View.MemoryView":900
14401  *             else:
14402  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
14403  *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
14404  *         else:
14405  *             suboffset_dim[0] = new_ndim
14406  */
14407         __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 899, __pyx_L1_error)
14408       }
14409       __pyx_L26:;
14410 
14411       /* "View.MemoryView":895
14412  *
14413  *     if suboffset >= 0:
14414  *         if not is_slice:             # <<<<<<<<<<<<<<
14415  *             if new_ndim == 0:
14416  *                 dst.data = (<char **> dst.data)[0] + suboffset
14417  */
14418       goto __pyx_L25;
14419     }
14420 
14421     /* "View.MemoryView":902
14422  *                                      "must be indexed and not sliced", dim)
14423  *         else:
14424  *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
14425  *
14426  *     return 0
14427  */
14428     /*else*/ {
14429       (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
14430     }
14431     __pyx_L25:;
14432 
14433     /* "View.MemoryView":894
14434  *         dst.suboffsets[suboffset_dim[0]] += start * stride
14435  *
14436  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
14437  *         if not is_slice:
14438  *             if new_ndim == 0:
14439  */
14440   }
14441 
14442   /* "View.MemoryView":904
14443  *             suboffset_dim[0] = new_ndim
14444  *
14445  *     return 0             # <<<<<<<<<<<<<<
14446  *
14447  *
14448  */
14449   __pyx_r = 0;
14450   goto __pyx_L0;
14451 
14452   /* "View.MemoryView":807
14453  *
14454  * @cname('__pyx_memoryview_slice_memviewslice')
14455  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
14456  *         __Pyx_memviewslice *dst,
14457  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
14458  */
14459 
14460   /* function exit code */
14461   __pyx_L1_error:;
14462   {
14463     #ifdef WITH_THREAD
14464     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
14465     #endif
14466     __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14467     #ifdef WITH_THREAD
14468     __Pyx_PyGILState_Release(__pyx_gilstate_save);
14469     #endif
14470   }
14471   __pyx_r = -1;
14472   __pyx_L0:;
14473   return __pyx_r;
14474 }
14475 
14476 /* "View.MemoryView":910
14477  *
14478  * @cname('__pyx_pybuffer_index')
14479  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
14480  *                           Py_ssize_t dim) except NULL:
14481  *     cdef Py_ssize_t shape, stride, suboffset = -1
14482  */
14483 
__pyx_pybuffer_index(Py_buffer * __pyx_v_view,char * __pyx_v_bufp,Py_ssize_t __pyx_v_index,Py_ssize_t __pyx_v_dim)14484 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) {
14485   Py_ssize_t __pyx_v_shape;
14486   Py_ssize_t __pyx_v_stride;
14487   Py_ssize_t __pyx_v_suboffset;
14488   Py_ssize_t __pyx_v_itemsize;
14489   char *__pyx_v_resultp;
14490   char *__pyx_r;
14491   __Pyx_RefNannyDeclarations
14492   Py_ssize_t __pyx_t_1;
14493   int __pyx_t_2;
14494   PyObject *__pyx_t_3 = NULL;
14495   PyObject *__pyx_t_4 = NULL;
14496   int __pyx_lineno = 0;
14497   const char *__pyx_filename = NULL;
14498   int __pyx_clineno = 0;
14499   __Pyx_RefNannySetupContext("pybuffer_index", 0);
14500 
14501   /* "View.MemoryView":912
14502  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
14503  *                           Py_ssize_t dim) except NULL:
14504  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
14505  *     cdef Py_ssize_t itemsize = view.itemsize
14506  *     cdef char *resultp
14507  */
14508   __pyx_v_suboffset = -1L;
14509 
14510   /* "View.MemoryView":913
14511  *                           Py_ssize_t dim) except NULL:
14512  *     cdef Py_ssize_t shape, stride, suboffset = -1
14513  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
14514  *     cdef char *resultp
14515  *
14516  */
14517   __pyx_t_1 = __pyx_v_view->itemsize;
14518   __pyx_v_itemsize = __pyx_t_1;
14519 
14520   /* "View.MemoryView":916
14521  *     cdef char *resultp
14522  *
14523  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
14524  *         shape = view.len / itemsize
14525  *         stride = itemsize
14526  */
14527   __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
14528   if (__pyx_t_2) {
14529 
14530     /* "View.MemoryView":917
14531  *
14532  *     if view.ndim == 0:
14533  *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
14534  *         stride = itemsize
14535  *     else:
14536  */
14537     if (unlikely(__pyx_v_itemsize == 0)) {
14538       PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
14539       __PYX_ERR(2, 917, __pyx_L1_error)
14540     }
14541     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))) {
14542       PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
14543       __PYX_ERR(2, 917, __pyx_L1_error)
14544     }
14545     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
14546 
14547     /* "View.MemoryView":918
14548  *     if view.ndim == 0:
14549  *         shape = view.len / itemsize
14550  *         stride = itemsize             # <<<<<<<<<<<<<<
14551  *     else:
14552  *         shape = view.shape[dim]
14553  */
14554     __pyx_v_stride = __pyx_v_itemsize;
14555 
14556     /* "View.MemoryView":916
14557  *     cdef char *resultp
14558  *
14559  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
14560  *         shape = view.len / itemsize
14561  *         stride = itemsize
14562  */
14563     goto __pyx_L3;
14564   }
14565 
14566   /* "View.MemoryView":920
14567  *         stride = itemsize
14568  *     else:
14569  *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
14570  *         stride = view.strides[dim]
14571  *         if view.suboffsets != NULL:
14572  */
14573   /*else*/ {
14574     __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
14575 
14576     /* "View.MemoryView":921
14577  *     else:
14578  *         shape = view.shape[dim]
14579  *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
14580  *         if view.suboffsets != NULL:
14581  *             suboffset = view.suboffsets[dim]
14582  */
14583     __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
14584 
14585     /* "View.MemoryView":922
14586  *         shape = view.shape[dim]
14587  *         stride = view.strides[dim]
14588  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
14589  *             suboffset = view.suboffsets[dim]
14590  *
14591  */
14592     __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
14593     if (__pyx_t_2) {
14594 
14595       /* "View.MemoryView":923
14596  *         stride = view.strides[dim]
14597  *         if view.suboffsets != NULL:
14598  *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
14599  *
14600  *     if index < 0:
14601  */
14602       __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
14603 
14604       /* "View.MemoryView":922
14605  *         shape = view.shape[dim]
14606  *         stride = view.strides[dim]
14607  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
14608  *             suboffset = view.suboffsets[dim]
14609  *
14610  */
14611     }
14612   }
14613   __pyx_L3:;
14614 
14615   /* "View.MemoryView":925
14616  *             suboffset = view.suboffsets[dim]
14617  *
14618  *     if index < 0:             # <<<<<<<<<<<<<<
14619  *         index += view.shape[dim]
14620  *         if index < 0:
14621  */
14622   __pyx_t_2 = ((__pyx_v_index < 0) != 0);
14623   if (__pyx_t_2) {
14624 
14625     /* "View.MemoryView":926
14626  *
14627  *     if index < 0:
14628  *         index += view.shape[dim]             # <<<<<<<<<<<<<<
14629  *         if index < 0:
14630  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14631  */
14632     __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
14633 
14634     /* "View.MemoryView":927
14635  *     if index < 0:
14636  *         index += view.shape[dim]
14637  *         if index < 0:             # <<<<<<<<<<<<<<
14638  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14639  *
14640  */
14641     __pyx_t_2 = ((__pyx_v_index < 0) != 0);
14642     if (unlikely(__pyx_t_2)) {
14643 
14644       /* "View.MemoryView":928
14645  *         index += view.shape[dim]
14646  *         if index < 0:
14647  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
14648  *
14649  *     if index >= shape:
14650  */
14651       __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
14652       __Pyx_GOTREF(__pyx_t_3);
14653       __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 928, __pyx_L1_error)
14654       __Pyx_GOTREF(__pyx_t_4);
14655       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14656       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
14657       __Pyx_GOTREF(__pyx_t_3);
14658       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14659       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
14660       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14661       __PYX_ERR(2, 928, __pyx_L1_error)
14662 
14663       /* "View.MemoryView":927
14664  *     if index < 0:
14665  *         index += view.shape[dim]
14666  *         if index < 0:             # <<<<<<<<<<<<<<
14667  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14668  *
14669  */
14670     }
14671 
14672     /* "View.MemoryView":925
14673  *             suboffset = view.suboffsets[dim]
14674  *
14675  *     if index < 0:             # <<<<<<<<<<<<<<
14676  *         index += view.shape[dim]
14677  *         if index < 0:
14678  */
14679   }
14680 
14681   /* "View.MemoryView":930
14682  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14683  *
14684  *     if index >= shape:             # <<<<<<<<<<<<<<
14685  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14686  *
14687  */
14688   __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
14689   if (unlikely(__pyx_t_2)) {
14690 
14691     /* "View.MemoryView":931
14692  *
14693  *     if index >= shape:
14694  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
14695  *
14696  *     resultp = bufp + index * stride
14697  */
14698     __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
14699     __Pyx_GOTREF(__pyx_t_3);
14700     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 931, __pyx_L1_error)
14701     __Pyx_GOTREF(__pyx_t_4);
14702     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14703     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
14704     __Pyx_GOTREF(__pyx_t_3);
14705     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14706     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
14707     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14708     __PYX_ERR(2, 931, __pyx_L1_error)
14709 
14710     /* "View.MemoryView":930
14711  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14712  *
14713  *     if index >= shape:             # <<<<<<<<<<<<<<
14714  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14715  *
14716  */
14717   }
14718 
14719   /* "View.MemoryView":933
14720  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14721  *
14722  *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
14723  *     if suboffset >= 0:
14724  *         resultp = (<char **> resultp)[0] + suboffset
14725  */
14726   __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
14727 
14728   /* "View.MemoryView":934
14729  *
14730  *     resultp = bufp + index * stride
14731  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
14732  *         resultp = (<char **> resultp)[0] + suboffset
14733  *
14734  */
14735   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
14736   if (__pyx_t_2) {
14737 
14738     /* "View.MemoryView":935
14739  *     resultp = bufp + index * stride
14740  *     if suboffset >= 0:
14741  *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
14742  *
14743  *     return resultp
14744  */
14745     __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
14746 
14747     /* "View.MemoryView":934
14748  *
14749  *     resultp = bufp + index * stride
14750  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
14751  *         resultp = (<char **> resultp)[0] + suboffset
14752  *
14753  */
14754   }
14755 
14756   /* "View.MemoryView":937
14757  *         resultp = (<char **> resultp)[0] + suboffset
14758  *
14759  *     return resultp             # <<<<<<<<<<<<<<
14760  *
14761  *
14762  */
14763   __pyx_r = __pyx_v_resultp;
14764   goto __pyx_L0;
14765 
14766   /* "View.MemoryView":910
14767  *
14768  * @cname('__pyx_pybuffer_index')
14769  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
14770  *                           Py_ssize_t dim) except NULL:
14771  *     cdef Py_ssize_t shape, stride, suboffset = -1
14772  */
14773 
14774   /* function exit code */
14775   __pyx_L1_error:;
14776   __Pyx_XDECREF(__pyx_t_3);
14777   __Pyx_XDECREF(__pyx_t_4);
14778   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
14779   __pyx_r = NULL;
14780   __pyx_L0:;
14781   __Pyx_RefNannyFinishContext();
14782   return __pyx_r;
14783 }
14784 
14785 /* "View.MemoryView":943
14786  *
14787  * @cname('__pyx_memslice_transpose')
14788  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
14789  *     cdef int ndim = memslice.memview.view.ndim
14790  *
14791  */
14792 
__pyx_memslice_transpose(__Pyx_memviewslice * __pyx_v_memslice)14793 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
14794   int __pyx_v_ndim;
14795   Py_ssize_t *__pyx_v_shape;
14796   Py_ssize_t *__pyx_v_strides;
14797   int __pyx_v_i;
14798   int __pyx_v_j;
14799   int __pyx_r;
14800   int __pyx_t_1;
14801   Py_ssize_t *__pyx_t_2;
14802   long __pyx_t_3;
14803   long __pyx_t_4;
14804   Py_ssize_t __pyx_t_5;
14805   Py_ssize_t __pyx_t_6;
14806   int __pyx_t_7;
14807   int __pyx_t_8;
14808   int __pyx_t_9;
14809   int __pyx_lineno = 0;
14810   const char *__pyx_filename = NULL;
14811   int __pyx_clineno = 0;
14812 
14813   /* "View.MemoryView":944
14814  * @cname('__pyx_memslice_transpose')
14815  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
14816  *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
14817  *
14818  *     cdef Py_ssize_t *shape = memslice.shape
14819  */
14820   __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
14821   __pyx_v_ndim = __pyx_t_1;
14822 
14823   /* "View.MemoryView":946
14824  *     cdef int ndim = memslice.memview.view.ndim
14825  *
14826  *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
14827  *     cdef Py_ssize_t *strides = memslice.strides
14828  *
14829  */
14830   __pyx_t_2 = __pyx_v_memslice->shape;
14831   __pyx_v_shape = __pyx_t_2;
14832 
14833   /* "View.MemoryView":947
14834  *
14835  *     cdef Py_ssize_t *shape = memslice.shape
14836  *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
14837  *
14838  *
14839  */
14840   __pyx_t_2 = __pyx_v_memslice->strides;
14841   __pyx_v_strides = __pyx_t_2;
14842 
14843   /* "View.MemoryView":951
14844  *
14845  *     cdef int i, j
14846  *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
14847  *         j = ndim - 1 - i
14848  *         strides[i], strides[j] = strides[j], strides[i]
14849  */
14850   __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
14851   __pyx_t_4 = __pyx_t_3;
14852   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
14853     __pyx_v_i = __pyx_t_1;
14854 
14855     /* "View.MemoryView":952
14856  *     cdef int i, j
14857  *     for i in range(ndim / 2):
14858  *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
14859  *         strides[i], strides[j] = strides[j], strides[i]
14860  *         shape[i], shape[j] = shape[j], shape[i]
14861  */
14862     __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
14863 
14864     /* "View.MemoryView":953
14865  *     for i in range(ndim / 2):
14866  *         j = ndim - 1 - i
14867  *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
14868  *         shape[i], shape[j] = shape[j], shape[i]
14869  *
14870  */
14871     __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
14872     __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
14873     (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
14874     (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
14875 
14876     /* "View.MemoryView":954
14877  *         j = ndim - 1 - i
14878  *         strides[i], strides[j] = strides[j], strides[i]
14879  *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
14880  *
14881  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
14882  */
14883     __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
14884     __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
14885     (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
14886     (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
14887 
14888     /* "View.MemoryView":956
14889  *         shape[i], shape[j] = shape[j], shape[i]
14890  *
14891  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
14892  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
14893  *
14894  */
14895     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
14896     if (!__pyx_t_8) {
14897     } else {
14898       __pyx_t_7 = __pyx_t_8;
14899       goto __pyx_L6_bool_binop_done;
14900     }
14901     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
14902     __pyx_t_7 = __pyx_t_8;
14903     __pyx_L6_bool_binop_done:;
14904     if (__pyx_t_7) {
14905 
14906       /* "View.MemoryView":957
14907  *
14908  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
14909  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
14910  *
14911  *     return 1
14912  */
14913       __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 957, __pyx_L1_error)
14914 
14915       /* "View.MemoryView":956
14916  *         shape[i], shape[j] = shape[j], shape[i]
14917  *
14918  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
14919  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
14920  *
14921  */
14922     }
14923   }
14924 
14925   /* "View.MemoryView":959
14926  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
14927  *
14928  *     return 1             # <<<<<<<<<<<<<<
14929  *
14930  *
14931  */
14932   __pyx_r = 1;
14933   goto __pyx_L0;
14934 
14935   /* "View.MemoryView":943
14936  *
14937  * @cname('__pyx_memslice_transpose')
14938  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
14939  *     cdef int ndim = memslice.memview.view.ndim
14940  *
14941  */
14942 
14943   /* function exit code */
14944   __pyx_L1_error:;
14945   {
14946     #ifdef WITH_THREAD
14947     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
14948     #endif
14949     __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14950     #ifdef WITH_THREAD
14951     __Pyx_PyGILState_Release(__pyx_gilstate_save);
14952     #endif
14953   }
14954   __pyx_r = 0;
14955   __pyx_L0:;
14956   return __pyx_r;
14957 }
14958 
14959 /* "View.MemoryView":976
14960  *     cdef int (*to_dtype_func)(char *, object) except 0
14961  *
14962  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
14963  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
14964  *
14965  */
14966 
14967 /* Python wrapper */
14968 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryviewslice___dealloc__(PyObject * __pyx_v_self)14969 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
14970   __Pyx_RefNannyDeclarations
14971   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
14972   __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
14973 
14974   /* function exit code */
14975   __Pyx_RefNannyFinishContext();
14976 }
14977 
__pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj * __pyx_v_self)14978 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
14979   __Pyx_RefNannyDeclarations
14980   __Pyx_RefNannySetupContext("__dealloc__", 0);
14981 
14982   /* "View.MemoryView":977
14983  *
14984  *     def __dealloc__(self):
14985  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
14986  *
14987  *     cdef convert_item_to_object(self, char *itemp):
14988  */
14989   __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
14990 
14991   /* "View.MemoryView":976
14992  *     cdef int (*to_dtype_func)(char *, object) except 0
14993  *
14994  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
14995  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
14996  *
14997  */
14998 
14999   /* function exit code */
15000   __Pyx_RefNannyFinishContext();
15001 }
15002 
15003 /* "View.MemoryView":979
15004  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
15005  *
15006  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
15007  *         if self.to_object_func != NULL:
15008  *             return self.to_object_func(itemp)
15009  */
15010 
__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp)15011 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
15012   PyObject *__pyx_r = NULL;
15013   __Pyx_RefNannyDeclarations
15014   int __pyx_t_1;
15015   PyObject *__pyx_t_2 = NULL;
15016   int __pyx_lineno = 0;
15017   const char *__pyx_filename = NULL;
15018   int __pyx_clineno = 0;
15019   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
15020 
15021   /* "View.MemoryView":980
15022  *
15023  *     cdef convert_item_to_object(self, char *itemp):
15024  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
15025  *             return self.to_object_func(itemp)
15026  *         else:
15027  */
15028   __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
15029   if (__pyx_t_1) {
15030 
15031     /* "View.MemoryView":981
15032  *     cdef convert_item_to_object(self, char *itemp):
15033  *         if self.to_object_func != NULL:
15034  *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
15035  *         else:
15036  *             return memoryview.convert_item_to_object(self, itemp)
15037  */
15038     __Pyx_XDECREF(__pyx_r);
15039     __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error)
15040     __Pyx_GOTREF(__pyx_t_2);
15041     __pyx_r = __pyx_t_2;
15042     __pyx_t_2 = 0;
15043     goto __pyx_L0;
15044 
15045     /* "View.MemoryView":980
15046  *
15047  *     cdef convert_item_to_object(self, char *itemp):
15048  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
15049  *             return self.to_object_func(itemp)
15050  *         else:
15051  */
15052   }
15053 
15054   /* "View.MemoryView":983
15055  *             return self.to_object_func(itemp)
15056  *         else:
15057  *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
15058  *
15059  *     cdef assign_item_from_object(self, char *itemp, object value):
15060  */
15061   /*else*/ {
15062     __Pyx_XDECREF(__pyx_r);
15063     __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error)
15064     __Pyx_GOTREF(__pyx_t_2);
15065     __pyx_r = __pyx_t_2;
15066     __pyx_t_2 = 0;
15067     goto __pyx_L0;
15068   }
15069 
15070   /* "View.MemoryView":979
15071  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
15072  *
15073  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
15074  *         if self.to_object_func != NULL:
15075  *             return self.to_object_func(itemp)
15076  */
15077 
15078   /* function exit code */
15079   __pyx_L1_error:;
15080   __Pyx_XDECREF(__pyx_t_2);
15081   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
15082   __pyx_r = 0;
15083   __pyx_L0:;
15084   __Pyx_XGIVEREF(__pyx_r);
15085   __Pyx_RefNannyFinishContext();
15086   return __pyx_r;
15087 }
15088 
15089 /* "View.MemoryView":985
15090  *             return memoryview.convert_item_to_object(self, itemp)
15091  *
15092  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
15093  *         if self.to_dtype_func != NULL:
15094  *             self.to_dtype_func(itemp, value)
15095  */
15096 
__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)15097 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
15098   PyObject *__pyx_r = NULL;
15099   __Pyx_RefNannyDeclarations
15100   int __pyx_t_1;
15101   int __pyx_t_2;
15102   PyObject *__pyx_t_3 = NULL;
15103   int __pyx_lineno = 0;
15104   const char *__pyx_filename = NULL;
15105   int __pyx_clineno = 0;
15106   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
15107 
15108   /* "View.MemoryView":986
15109  *
15110  *     cdef assign_item_from_object(self, char *itemp, object value):
15111  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
15112  *             self.to_dtype_func(itemp, value)
15113  *         else:
15114  */
15115   __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
15116   if (__pyx_t_1) {
15117 
15118     /* "View.MemoryView":987
15119  *     cdef assign_item_from_object(self, char *itemp, object value):
15120  *         if self.to_dtype_func != NULL:
15121  *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
15122  *         else:
15123  *             memoryview.assign_item_from_object(self, itemp, value)
15124  */
15125     __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 987, __pyx_L1_error)
15126 
15127     /* "View.MemoryView":986
15128  *
15129  *     cdef assign_item_from_object(self, char *itemp, object value):
15130  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
15131  *             self.to_dtype_func(itemp, value)
15132  *         else:
15133  */
15134     goto __pyx_L3;
15135   }
15136 
15137   /* "View.MemoryView":989
15138  *             self.to_dtype_func(itemp, value)
15139  *         else:
15140  *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
15141  *
15142  *     @property
15143  */
15144   /*else*/ {
15145     __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 989, __pyx_L1_error)
15146     __Pyx_GOTREF(__pyx_t_3);
15147     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15148   }
15149   __pyx_L3:;
15150 
15151   /* "View.MemoryView":985
15152  *             return memoryview.convert_item_to_object(self, itemp)
15153  *
15154  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
15155  *         if self.to_dtype_func != NULL:
15156  *             self.to_dtype_func(itemp, value)
15157  */
15158 
15159   /* function exit code */
15160   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15161   goto __pyx_L0;
15162   __pyx_L1_error:;
15163   __Pyx_XDECREF(__pyx_t_3);
15164   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
15165   __pyx_r = 0;
15166   __pyx_L0:;
15167   __Pyx_XGIVEREF(__pyx_r);
15168   __Pyx_RefNannyFinishContext();
15169   return __pyx_r;
15170 }
15171 
15172 /* "View.MemoryView":992
15173  *
15174  *     @property
15175  *     def base(self):             # <<<<<<<<<<<<<<
15176  *         return self.from_object
15177  *
15178  */
15179 
15180 /* Python wrapper */
15181 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)15182 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
15183   PyObject *__pyx_r = 0;
15184   __Pyx_RefNannyDeclarations
15185   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15186   __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
15187 
15188   /* function exit code */
15189   __Pyx_RefNannyFinishContext();
15190   return __pyx_r;
15191 }
15192 
__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj * __pyx_v_self)15193 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
15194   PyObject *__pyx_r = NULL;
15195   __Pyx_RefNannyDeclarations
15196   __Pyx_RefNannySetupContext("__get__", 0);
15197 
15198   /* "View.MemoryView":993
15199  *     @property
15200  *     def base(self):
15201  *         return self.from_object             # <<<<<<<<<<<<<<
15202  *
15203  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
15204  */
15205   __Pyx_XDECREF(__pyx_r);
15206   __Pyx_INCREF(__pyx_v_self->from_object);
15207   __pyx_r = __pyx_v_self->from_object;
15208   goto __pyx_L0;
15209 
15210   /* "View.MemoryView":992
15211  *
15212  *     @property
15213  *     def base(self):             # <<<<<<<<<<<<<<
15214  *         return self.from_object
15215  *
15216  */
15217 
15218   /* function exit code */
15219   __pyx_L0:;
15220   __Pyx_XGIVEREF(__pyx_r);
15221   __Pyx_RefNannyFinishContext();
15222   return __pyx_r;
15223 }
15224 
15225 /* "(tree fragment)":1
15226  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
15227  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15228  * def __setstate_cython__(self, __pyx_state):
15229  */
15230 
15231 /* Python wrapper */
15232 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)15233 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15234   PyObject *__pyx_r = 0;
15235   __Pyx_RefNannyDeclarations
15236   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
15237   __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
15238 
15239   /* function exit code */
15240   __Pyx_RefNannyFinishContext();
15241   return __pyx_r;
15242 }
15243 
__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self)15244 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
15245   PyObject *__pyx_r = NULL;
15246   __Pyx_RefNannyDeclarations
15247   PyObject *__pyx_t_1 = NULL;
15248   int __pyx_lineno = 0;
15249   const char *__pyx_filename = NULL;
15250   int __pyx_clineno = 0;
15251   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
15252 
15253   /* "(tree fragment)":2
15254  * def __reduce_cython__(self):
15255  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
15256  * def __setstate_cython__(self, __pyx_state):
15257  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15258  */
15259   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
15260   __Pyx_GOTREF(__pyx_t_1);
15261   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15262   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15263   __PYX_ERR(2, 2, __pyx_L1_error)
15264 
15265   /* "(tree fragment)":1
15266  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
15267  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15268  * def __setstate_cython__(self, __pyx_state):
15269  */
15270 
15271   /* function exit code */
15272   __pyx_L1_error:;
15273   __Pyx_XDECREF(__pyx_t_1);
15274   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15275   __pyx_r = NULL;
15276   __Pyx_XGIVEREF(__pyx_r);
15277   __Pyx_RefNannyFinishContext();
15278   return __pyx_r;
15279 }
15280 
15281 /* "(tree fragment)":3
15282  * def __reduce_cython__(self):
15283  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15284  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
15285  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15286  */
15287 
15288 /* Python wrapper */
15289 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)15290 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
15291   PyObject *__pyx_r = 0;
15292   __Pyx_RefNannyDeclarations
15293   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
15294   __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
15295 
15296   /* function exit code */
15297   __Pyx_RefNannyFinishContext();
15298   return __pyx_r;
15299 }
15300 
__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)15301 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) {
15302   PyObject *__pyx_r = NULL;
15303   __Pyx_RefNannyDeclarations
15304   PyObject *__pyx_t_1 = NULL;
15305   int __pyx_lineno = 0;
15306   const char *__pyx_filename = NULL;
15307   int __pyx_clineno = 0;
15308   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
15309 
15310   /* "(tree fragment)":4
15311  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15312  * def __setstate_cython__(self, __pyx_state):
15313  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
15314  */
15315   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
15316   __Pyx_GOTREF(__pyx_t_1);
15317   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15318   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15319   __PYX_ERR(2, 4, __pyx_L1_error)
15320 
15321   /* "(tree fragment)":3
15322  * def __reduce_cython__(self):
15323  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15324  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
15325  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15326  */
15327 
15328   /* function exit code */
15329   __pyx_L1_error:;
15330   __Pyx_XDECREF(__pyx_t_1);
15331   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15332   __pyx_r = NULL;
15333   __Pyx_XGIVEREF(__pyx_r);
15334   __Pyx_RefNannyFinishContext();
15335   return __pyx_r;
15336 }
15337 
15338 /* "View.MemoryView":999
15339  *
15340  * @cname('__pyx_memoryview_fromslice')
15341  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
15342  *                           int ndim,
15343  *                           object (*to_object_func)(char *),
15344  */
15345 
__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)15346 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) {
15347   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
15348   Py_ssize_t __pyx_v_suboffset;
15349   PyObject *__pyx_v_length = NULL;
15350   PyObject *__pyx_r = NULL;
15351   __Pyx_RefNannyDeclarations
15352   int __pyx_t_1;
15353   PyObject *__pyx_t_2 = NULL;
15354   PyObject *__pyx_t_3 = NULL;
15355   __Pyx_TypeInfo *__pyx_t_4;
15356   Py_buffer __pyx_t_5;
15357   Py_ssize_t *__pyx_t_6;
15358   Py_ssize_t *__pyx_t_7;
15359   Py_ssize_t *__pyx_t_8;
15360   Py_ssize_t __pyx_t_9;
15361   int __pyx_lineno = 0;
15362   const char *__pyx_filename = NULL;
15363   int __pyx_clineno = 0;
15364   __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
15365 
15366   /* "View.MemoryView":1007
15367  *     cdef _memoryviewslice result
15368  *
15369  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
15370  *         return None
15371  *
15372  */
15373   __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
15374   if (__pyx_t_1) {
15375 
15376     /* "View.MemoryView":1008
15377  *
15378  *     if <PyObject *> memviewslice.memview == Py_None:
15379  *         return None             # <<<<<<<<<<<<<<
15380  *
15381  *
15382  */
15383     __Pyx_XDECREF(__pyx_r);
15384     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15385     goto __pyx_L0;
15386 
15387     /* "View.MemoryView":1007
15388  *     cdef _memoryviewslice result
15389  *
15390  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
15391  *         return None
15392  *
15393  */
15394   }
15395 
15396   /* "View.MemoryView":1013
15397  *
15398  *
15399  *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
15400  *
15401  *     result.from_slice = memviewslice
15402  */
15403   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
15404   __Pyx_GOTREF(__pyx_t_2);
15405   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error)
15406   __Pyx_GOTREF(__pyx_t_3);
15407   __Pyx_INCREF(Py_None);
15408   __Pyx_GIVEREF(Py_None);
15409   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
15410   __Pyx_INCREF(__pyx_int_0);
15411   __Pyx_GIVEREF(__pyx_int_0);
15412   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
15413   __Pyx_GIVEREF(__pyx_t_2);
15414   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
15415   __pyx_t_2 = 0;
15416   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
15417   __Pyx_GOTREF(__pyx_t_2);
15418   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15419   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
15420   __pyx_t_2 = 0;
15421 
15422   /* "View.MemoryView":1015
15423  *     result = _memoryviewslice(None, 0, dtype_is_object)
15424  *
15425  *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
15426  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
15427  *
15428  */
15429   __pyx_v_result->from_slice = __pyx_v_memviewslice;
15430 
15431   /* "View.MemoryView":1016
15432  *
15433  *     result.from_slice = memviewslice
15434  *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
15435  *
15436  *     result.from_object = (<memoryview> memviewslice.memview).base
15437  */
15438   __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
15439 
15440   /* "View.MemoryView":1018
15441  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
15442  *
15443  *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
15444  *     result.typeinfo = memviewslice.memview.typeinfo
15445  *
15446  */
15447   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1018, __pyx_L1_error)
15448   __Pyx_GOTREF(__pyx_t_2);
15449   __Pyx_GIVEREF(__pyx_t_2);
15450   __Pyx_GOTREF(__pyx_v_result->from_object);
15451   __Pyx_DECREF(__pyx_v_result->from_object);
15452   __pyx_v_result->from_object = __pyx_t_2;
15453   __pyx_t_2 = 0;
15454 
15455   /* "View.MemoryView":1019
15456  *
15457  *     result.from_object = (<memoryview> memviewslice.memview).base
15458  *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
15459  *
15460  *     result.view = memviewslice.memview.view
15461  */
15462   __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
15463   __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
15464 
15465   /* "View.MemoryView":1021
15466  *     result.typeinfo = memviewslice.memview.typeinfo
15467  *
15468  *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
15469  *     result.view.buf = <void *> memviewslice.data
15470  *     result.view.ndim = ndim
15471  */
15472   __pyx_t_5 = __pyx_v_memviewslice.memview->view;
15473   __pyx_v_result->__pyx_base.view = __pyx_t_5;
15474 
15475   /* "View.MemoryView":1022
15476  *
15477  *     result.view = memviewslice.memview.view
15478  *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
15479  *     result.view.ndim = ndim
15480  *     (<__pyx_buffer *> &result.view).obj = Py_None
15481  */
15482   __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
15483 
15484   /* "View.MemoryView":1023
15485  *     result.view = memviewslice.memview.view
15486  *     result.view.buf = <void *> memviewslice.data
15487  *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
15488  *     (<__pyx_buffer *> &result.view).obj = Py_None
15489  *     Py_INCREF(Py_None)
15490  */
15491   __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
15492 
15493   /* "View.MemoryView":1024
15494  *     result.view.buf = <void *> memviewslice.data
15495  *     result.view.ndim = ndim
15496  *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
15497  *     Py_INCREF(Py_None)
15498  *
15499  */
15500   ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
15501 
15502   /* "View.MemoryView":1025
15503  *     result.view.ndim = ndim
15504  *     (<__pyx_buffer *> &result.view).obj = Py_None
15505  *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
15506  *
15507  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
15508  */
15509   Py_INCREF(Py_None);
15510 
15511   /* "View.MemoryView":1027
15512  *     Py_INCREF(Py_None)
15513  *
15514  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
15515  *         result.flags = PyBUF_RECORDS
15516  *     else:
15517  */
15518   __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
15519   if (__pyx_t_1) {
15520 
15521     /* "View.MemoryView":1028
15522  *
15523  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
15524  *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
15525  *     else:
15526  *         result.flags = PyBUF_RECORDS_RO
15527  */
15528     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
15529 
15530     /* "View.MemoryView":1027
15531  *     Py_INCREF(Py_None)
15532  *
15533  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
15534  *         result.flags = PyBUF_RECORDS
15535  *     else:
15536  */
15537     goto __pyx_L4;
15538   }
15539 
15540   /* "View.MemoryView":1030
15541  *         result.flags = PyBUF_RECORDS
15542  *     else:
15543  *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
15544  *
15545  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
15546  */
15547   /*else*/ {
15548     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
15549   }
15550   __pyx_L4:;
15551 
15552   /* "View.MemoryView":1032
15553  *         result.flags = PyBUF_RECORDS_RO
15554  *
15555  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
15556  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
15557  *
15558  */
15559   __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
15560 
15561   /* "View.MemoryView":1033
15562  *
15563  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
15564  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
15565  *
15566  *
15567  */
15568   __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
15569 
15570   /* "View.MemoryView":1036
15571  *
15572  *
15573  *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
15574  *     for suboffset in result.from_slice.suboffsets[:ndim]:
15575  *         if suboffset >= 0:
15576  */
15577   __pyx_v_result->__pyx_base.view.suboffsets = NULL;
15578 
15579   /* "View.MemoryView":1037
15580  *
15581  *     result.view.suboffsets = NULL
15582  *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
15583  *         if suboffset >= 0:
15584  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
15585  */
15586   __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
15587   for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
15588     __pyx_t_6 = __pyx_t_8;
15589     __pyx_v_suboffset = (__pyx_t_6[0]);
15590 
15591     /* "View.MemoryView":1038
15592  *     result.view.suboffsets = NULL
15593  *     for suboffset in result.from_slice.suboffsets[:ndim]:
15594  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
15595  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
15596  *             break
15597  */
15598     __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
15599     if (__pyx_t_1) {
15600 
15601       /* "View.MemoryView":1039
15602  *     for suboffset in result.from_slice.suboffsets[:ndim]:
15603  *         if suboffset >= 0:
15604  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
15605  *             break
15606  *
15607  */
15608       __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
15609 
15610       /* "View.MemoryView":1040
15611  *         if suboffset >= 0:
15612  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
15613  *             break             # <<<<<<<<<<<<<<
15614  *
15615  *     result.view.len = result.view.itemsize
15616  */
15617       goto __pyx_L6_break;
15618 
15619       /* "View.MemoryView":1038
15620  *     result.view.suboffsets = NULL
15621  *     for suboffset in result.from_slice.suboffsets[:ndim]:
15622  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
15623  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
15624  *             break
15625  */
15626     }
15627   }
15628   __pyx_L6_break:;
15629 
15630   /* "View.MemoryView":1042
15631  *             break
15632  *
15633  *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
15634  *     for length in result.view.shape[:ndim]:
15635  *         result.view.len *= length
15636  */
15637   __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
15638   __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
15639 
15640   /* "View.MemoryView":1043
15641  *
15642  *     result.view.len = result.view.itemsize
15643  *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
15644  *         result.view.len *= length
15645  *
15646  */
15647   __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
15648   for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
15649     __pyx_t_6 = __pyx_t_8;
15650     __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error)
15651     __Pyx_GOTREF(__pyx_t_2);
15652     __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
15653     __pyx_t_2 = 0;
15654 
15655     /* "View.MemoryView":1044
15656  *     result.view.len = result.view.itemsize
15657  *     for length in result.view.shape[:ndim]:
15658  *         result.view.len *= length             # <<<<<<<<<<<<<<
15659  *
15660  *     result.to_object_func = to_object_func
15661  */
15662     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1044, __pyx_L1_error)
15663     __Pyx_GOTREF(__pyx_t_2);
15664     __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error)
15665     __Pyx_GOTREF(__pyx_t_3);
15666     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15667     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1044, __pyx_L1_error)
15668     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15669     __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
15670   }
15671 
15672   /* "View.MemoryView":1046
15673  *         result.view.len *= length
15674  *
15675  *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
15676  *     result.to_dtype_func = to_dtype_func
15677  *
15678  */
15679   __pyx_v_result->to_object_func = __pyx_v_to_object_func;
15680 
15681   /* "View.MemoryView":1047
15682  *
15683  *     result.to_object_func = to_object_func
15684  *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
15685  *
15686  *     return result
15687  */
15688   __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
15689 
15690   /* "View.MemoryView":1049
15691  *     result.to_dtype_func = to_dtype_func
15692  *
15693  *     return result             # <<<<<<<<<<<<<<
15694  *
15695  * @cname('__pyx_memoryview_get_slice_from_memoryview')
15696  */
15697   __Pyx_XDECREF(__pyx_r);
15698   __Pyx_INCREF(((PyObject *)__pyx_v_result));
15699   __pyx_r = ((PyObject *)__pyx_v_result);
15700   goto __pyx_L0;
15701 
15702   /* "View.MemoryView":999
15703  *
15704  * @cname('__pyx_memoryview_fromslice')
15705  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
15706  *                           int ndim,
15707  *                           object (*to_object_func)(char *),
15708  */
15709 
15710   /* function exit code */
15711   __pyx_L1_error:;
15712   __Pyx_XDECREF(__pyx_t_2);
15713   __Pyx_XDECREF(__pyx_t_3);
15714   __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15715   __pyx_r = 0;
15716   __pyx_L0:;
15717   __Pyx_XDECREF((PyObject *)__pyx_v_result);
15718   __Pyx_XDECREF(__pyx_v_length);
15719   __Pyx_XGIVEREF(__pyx_r);
15720   __Pyx_RefNannyFinishContext();
15721   return __pyx_r;
15722 }
15723 
15724 /* "View.MemoryView":1052
15725  *
15726  * @cname('__pyx_memoryview_get_slice_from_memoryview')
15727  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
15728  *                                                    __Pyx_memviewslice *mslice) except NULL:
15729  *     cdef _memoryviewslice obj
15730  */
15731 
__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_mslice)15732 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
15733   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
15734   __Pyx_memviewslice *__pyx_r;
15735   __Pyx_RefNannyDeclarations
15736   int __pyx_t_1;
15737   int __pyx_t_2;
15738   PyObject *__pyx_t_3 = NULL;
15739   int __pyx_lineno = 0;
15740   const char *__pyx_filename = NULL;
15741   int __pyx_clineno = 0;
15742   __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
15743 
15744   /* "View.MemoryView":1055
15745  *                                                    __Pyx_memviewslice *mslice) except NULL:
15746  *     cdef _memoryviewslice obj
15747  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
15748  *         obj = memview
15749  *         return &obj.from_slice
15750  */
15751   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15752   __pyx_t_2 = (__pyx_t_1 != 0);
15753   if (__pyx_t_2) {
15754 
15755     /* "View.MemoryView":1056
15756  *     cdef _memoryviewslice obj
15757  *     if isinstance(memview, _memoryviewslice):
15758  *         obj = memview             # <<<<<<<<<<<<<<
15759  *         return &obj.from_slice
15760  *     else:
15761  */
15762     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1056, __pyx_L1_error)
15763     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
15764     __Pyx_INCREF(__pyx_t_3);
15765     __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
15766     __pyx_t_3 = 0;
15767 
15768     /* "View.MemoryView":1057
15769  *     if isinstance(memview, _memoryviewslice):
15770  *         obj = memview
15771  *         return &obj.from_slice             # <<<<<<<<<<<<<<
15772  *     else:
15773  *         slice_copy(memview, mslice)
15774  */
15775     __pyx_r = (&__pyx_v_obj->from_slice);
15776     goto __pyx_L0;
15777 
15778     /* "View.MemoryView":1055
15779  *                                                    __Pyx_memviewslice *mslice) except NULL:
15780  *     cdef _memoryviewslice obj
15781  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
15782  *         obj = memview
15783  *         return &obj.from_slice
15784  */
15785   }
15786 
15787   /* "View.MemoryView":1059
15788  *         return &obj.from_slice
15789  *     else:
15790  *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
15791  *         return mslice
15792  *
15793  */
15794   /*else*/ {
15795     __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
15796 
15797     /* "View.MemoryView":1060
15798  *     else:
15799  *         slice_copy(memview, mslice)
15800  *         return mslice             # <<<<<<<<<<<<<<
15801  *
15802  * @cname('__pyx_memoryview_slice_copy')
15803  */
15804     __pyx_r = __pyx_v_mslice;
15805     goto __pyx_L0;
15806   }
15807 
15808   /* "View.MemoryView":1052
15809  *
15810  * @cname('__pyx_memoryview_get_slice_from_memoryview')
15811  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
15812  *                                                    __Pyx_memviewslice *mslice) except NULL:
15813  *     cdef _memoryviewslice obj
15814  */
15815 
15816   /* function exit code */
15817   __pyx_L1_error:;
15818   __Pyx_XDECREF(__pyx_t_3);
15819   __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
15820   __pyx_r = NULL;
15821   __pyx_L0:;
15822   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
15823   __Pyx_RefNannyFinishContext();
15824   return __pyx_r;
15825 }
15826 
15827 /* "View.MemoryView":1063
15828  *
15829  * @cname('__pyx_memoryview_slice_copy')
15830  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
15831  *     cdef int dim
15832  *     cdef (Py_ssize_t*) shape, strides, suboffsets
15833  */
15834 
__pyx_memoryview_slice_copy(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_dst)15835 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
15836   int __pyx_v_dim;
15837   Py_ssize_t *__pyx_v_shape;
15838   Py_ssize_t *__pyx_v_strides;
15839   Py_ssize_t *__pyx_v_suboffsets;
15840   __Pyx_RefNannyDeclarations
15841   Py_ssize_t *__pyx_t_1;
15842   int __pyx_t_2;
15843   int __pyx_t_3;
15844   int __pyx_t_4;
15845   Py_ssize_t __pyx_t_5;
15846   __Pyx_RefNannySetupContext("slice_copy", 0);
15847 
15848   /* "View.MemoryView":1067
15849  *     cdef (Py_ssize_t*) shape, strides, suboffsets
15850  *
15851  *     shape = memview.view.shape             # <<<<<<<<<<<<<<
15852  *     strides = memview.view.strides
15853  *     suboffsets = memview.view.suboffsets
15854  */
15855   __pyx_t_1 = __pyx_v_memview->view.shape;
15856   __pyx_v_shape = __pyx_t_1;
15857 
15858   /* "View.MemoryView":1068
15859  *
15860  *     shape = memview.view.shape
15861  *     strides = memview.view.strides             # <<<<<<<<<<<<<<
15862  *     suboffsets = memview.view.suboffsets
15863  *
15864  */
15865   __pyx_t_1 = __pyx_v_memview->view.strides;
15866   __pyx_v_strides = __pyx_t_1;
15867 
15868   /* "View.MemoryView":1069
15869  *     shape = memview.view.shape
15870  *     strides = memview.view.strides
15871  *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
15872  *
15873  *     dst.memview = <__pyx_memoryview *> memview
15874  */
15875   __pyx_t_1 = __pyx_v_memview->view.suboffsets;
15876   __pyx_v_suboffsets = __pyx_t_1;
15877 
15878   /* "View.MemoryView":1071
15879  *     suboffsets = memview.view.suboffsets
15880  *
15881  *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
15882  *     dst.data = <char *> memview.view.buf
15883  *
15884  */
15885   __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
15886 
15887   /* "View.MemoryView":1072
15888  *
15889  *     dst.memview = <__pyx_memoryview *> memview
15890  *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
15891  *
15892  *     for dim in range(memview.view.ndim):
15893  */
15894   __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
15895 
15896   /* "View.MemoryView":1074
15897  *     dst.data = <char *> memview.view.buf
15898  *
15899  *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
15900  *         dst.shape[dim] = shape[dim]
15901  *         dst.strides[dim] = strides[dim]
15902  */
15903   __pyx_t_2 = __pyx_v_memview->view.ndim;
15904   __pyx_t_3 = __pyx_t_2;
15905   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
15906     __pyx_v_dim = __pyx_t_4;
15907 
15908     /* "View.MemoryView":1075
15909  *
15910  *     for dim in range(memview.view.ndim):
15911  *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
15912  *         dst.strides[dim] = strides[dim]
15913  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
15914  */
15915     (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
15916 
15917     /* "View.MemoryView":1076
15918  *     for dim in range(memview.view.ndim):
15919  *         dst.shape[dim] = shape[dim]
15920  *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
15921  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
15922  *
15923  */
15924     (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
15925 
15926     /* "View.MemoryView":1077
15927  *         dst.shape[dim] = shape[dim]
15928  *         dst.strides[dim] = strides[dim]
15929  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
15930  *
15931  * @cname('__pyx_memoryview_copy_object')
15932  */
15933     if ((__pyx_v_suboffsets != 0)) {
15934       __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
15935     } else {
15936       __pyx_t_5 = -1L;
15937     }
15938     (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
15939   }
15940 
15941   /* "View.MemoryView":1063
15942  *
15943  * @cname('__pyx_memoryview_slice_copy')
15944  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
15945  *     cdef int dim
15946  *     cdef (Py_ssize_t*) shape, strides, suboffsets
15947  */
15948 
15949   /* function exit code */
15950   __Pyx_RefNannyFinishContext();
15951 }
15952 
15953 /* "View.MemoryView":1080
15954  *
15955  * @cname('__pyx_memoryview_copy_object')
15956  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
15957  *     "Create a new memoryview object"
15958  *     cdef __Pyx_memviewslice memviewslice
15959  */
15960 
__pyx_memoryview_copy_object(struct __pyx_memoryview_obj * __pyx_v_memview)15961 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
15962   __Pyx_memviewslice __pyx_v_memviewslice;
15963   PyObject *__pyx_r = NULL;
15964   __Pyx_RefNannyDeclarations
15965   PyObject *__pyx_t_1 = NULL;
15966   int __pyx_lineno = 0;
15967   const char *__pyx_filename = NULL;
15968   int __pyx_clineno = 0;
15969   __Pyx_RefNannySetupContext("memoryview_copy", 0);
15970 
15971   /* "View.MemoryView":1083
15972  *     "Create a new memoryview object"
15973  *     cdef __Pyx_memviewslice memviewslice
15974  *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
15975  *     return memoryview_copy_from_slice(memview, &memviewslice)
15976  *
15977  */
15978   __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
15979 
15980   /* "View.MemoryView":1084
15981  *     cdef __Pyx_memviewslice memviewslice
15982  *     slice_copy(memview, &memviewslice)
15983  *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
15984  *
15985  * @cname('__pyx_memoryview_copy_object_from_slice')
15986  */
15987   __Pyx_XDECREF(__pyx_r);
15988   __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1084, __pyx_L1_error)
15989   __Pyx_GOTREF(__pyx_t_1);
15990   __pyx_r = __pyx_t_1;
15991   __pyx_t_1 = 0;
15992   goto __pyx_L0;
15993 
15994   /* "View.MemoryView":1080
15995  *
15996  * @cname('__pyx_memoryview_copy_object')
15997  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
15998  *     "Create a new memoryview object"
15999  *     cdef __Pyx_memviewslice memviewslice
16000  */
16001 
16002   /* function exit code */
16003   __pyx_L1_error:;
16004   __Pyx_XDECREF(__pyx_t_1);
16005   __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
16006   __pyx_r = 0;
16007   __pyx_L0:;
16008   __Pyx_XGIVEREF(__pyx_r);
16009   __Pyx_RefNannyFinishContext();
16010   return __pyx_r;
16011 }
16012 
16013 /* "View.MemoryView":1087
16014  *
16015  * @cname('__pyx_memoryview_copy_object_from_slice')
16016  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
16017  *     """
16018  *     Create a new memoryview object from a given memoryview object and slice.
16019  */
16020 
__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_memviewslice)16021 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
16022   PyObject *(*__pyx_v_to_object_func)(char *);
16023   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
16024   PyObject *__pyx_r = NULL;
16025   __Pyx_RefNannyDeclarations
16026   int __pyx_t_1;
16027   int __pyx_t_2;
16028   PyObject *(*__pyx_t_3)(char *);
16029   int (*__pyx_t_4)(char *, PyObject *);
16030   PyObject *__pyx_t_5 = NULL;
16031   int __pyx_lineno = 0;
16032   const char *__pyx_filename = NULL;
16033   int __pyx_clineno = 0;
16034   __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
16035 
16036   /* "View.MemoryView":1094
16037  *     cdef int (*to_dtype_func)(char *, object) except 0
16038  *
16039  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16040  *         to_object_func = (<_memoryviewslice> memview).to_object_func
16041  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
16042  */
16043   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
16044   __pyx_t_2 = (__pyx_t_1 != 0);
16045   if (__pyx_t_2) {
16046 
16047     /* "View.MemoryView":1095
16048  *
16049  *     if isinstance(memview, _memoryviewslice):
16050  *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
16051  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
16052  *     else:
16053  */
16054     __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
16055     __pyx_v_to_object_func = __pyx_t_3;
16056 
16057     /* "View.MemoryView":1096
16058  *     if isinstance(memview, _memoryviewslice):
16059  *         to_object_func = (<_memoryviewslice> memview).to_object_func
16060  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
16061  *     else:
16062  *         to_object_func = NULL
16063  */
16064     __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
16065     __pyx_v_to_dtype_func = __pyx_t_4;
16066 
16067     /* "View.MemoryView":1094
16068  *     cdef int (*to_dtype_func)(char *, object) except 0
16069  *
16070  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16071  *         to_object_func = (<_memoryviewslice> memview).to_object_func
16072  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
16073  */
16074     goto __pyx_L3;
16075   }
16076 
16077   /* "View.MemoryView":1098
16078  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
16079  *     else:
16080  *         to_object_func = NULL             # <<<<<<<<<<<<<<
16081  *         to_dtype_func = NULL
16082  *
16083  */
16084   /*else*/ {
16085     __pyx_v_to_object_func = NULL;
16086 
16087     /* "View.MemoryView":1099
16088  *     else:
16089  *         to_object_func = NULL
16090  *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
16091  *
16092  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
16093  */
16094     __pyx_v_to_dtype_func = NULL;
16095   }
16096   __pyx_L3:;
16097 
16098   /* "View.MemoryView":1101
16099  *         to_dtype_func = NULL
16100  *
16101  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
16102  *                                 to_object_func, to_dtype_func,
16103  *                                 memview.dtype_is_object)
16104  */
16105   __Pyx_XDECREF(__pyx_r);
16106 
16107   /* "View.MemoryView":1103
16108  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
16109  *                                 to_object_func, to_dtype_func,
16110  *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
16111  *
16112  *
16113  */
16114   __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1101, __pyx_L1_error)
16115   __Pyx_GOTREF(__pyx_t_5);
16116   __pyx_r = __pyx_t_5;
16117   __pyx_t_5 = 0;
16118   goto __pyx_L0;
16119 
16120   /* "View.MemoryView":1087
16121  *
16122  * @cname('__pyx_memoryview_copy_object_from_slice')
16123  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
16124  *     """
16125  *     Create a new memoryview object from a given memoryview object and slice.
16126  */
16127 
16128   /* function exit code */
16129   __pyx_L1_error:;
16130   __Pyx_XDECREF(__pyx_t_5);
16131   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16132   __pyx_r = 0;
16133   __pyx_L0:;
16134   __Pyx_XGIVEREF(__pyx_r);
16135   __Pyx_RefNannyFinishContext();
16136   return __pyx_r;
16137 }
16138 
16139 /* "View.MemoryView":1109
16140  *
16141  *
16142  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
16143  *     if arg < 0:
16144  *         return -arg
16145  */
16146 
abs_py_ssize_t(Py_ssize_t __pyx_v_arg)16147 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
16148   Py_ssize_t __pyx_r;
16149   int __pyx_t_1;
16150 
16151   /* "View.MemoryView":1110
16152  *
16153  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
16154  *     if arg < 0:             # <<<<<<<<<<<<<<
16155  *         return -arg
16156  *     else:
16157  */
16158   __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
16159   if (__pyx_t_1) {
16160 
16161     /* "View.MemoryView":1111
16162  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
16163  *     if arg < 0:
16164  *         return -arg             # <<<<<<<<<<<<<<
16165  *     else:
16166  *         return arg
16167  */
16168     __pyx_r = (-__pyx_v_arg);
16169     goto __pyx_L0;
16170 
16171     /* "View.MemoryView":1110
16172  *
16173  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
16174  *     if arg < 0:             # <<<<<<<<<<<<<<
16175  *         return -arg
16176  *     else:
16177  */
16178   }
16179 
16180   /* "View.MemoryView":1113
16181  *         return -arg
16182  *     else:
16183  *         return arg             # <<<<<<<<<<<<<<
16184  *
16185  * @cname('__pyx_get_best_slice_order')
16186  */
16187   /*else*/ {
16188     __pyx_r = __pyx_v_arg;
16189     goto __pyx_L0;
16190   }
16191 
16192   /* "View.MemoryView":1109
16193  *
16194  *
16195  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
16196  *     if arg < 0:
16197  *         return -arg
16198  */
16199 
16200   /* function exit code */
16201   __pyx_L0:;
16202   return __pyx_r;
16203 }
16204 
16205 /* "View.MemoryView":1116
16206  *
16207  * @cname('__pyx_get_best_slice_order')
16208  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
16209  *     """
16210  *     Figure out the best memory access order for a given slice.
16211  */
16212 
__pyx_get_best_slice_order(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim)16213 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
16214   int __pyx_v_i;
16215   Py_ssize_t __pyx_v_c_stride;
16216   Py_ssize_t __pyx_v_f_stride;
16217   char __pyx_r;
16218   int __pyx_t_1;
16219   int __pyx_t_2;
16220   int __pyx_t_3;
16221   int __pyx_t_4;
16222 
16223   /* "View.MemoryView":1121
16224  *     """
16225  *     cdef int i
16226  *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
16227  *     cdef Py_ssize_t f_stride = 0
16228  *
16229  */
16230   __pyx_v_c_stride = 0;
16231 
16232   /* "View.MemoryView":1122
16233  *     cdef int i
16234  *     cdef Py_ssize_t c_stride = 0
16235  *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
16236  *
16237  *     for i in range(ndim - 1, -1, -1):
16238  */
16239   __pyx_v_f_stride = 0;
16240 
16241   /* "View.MemoryView":1124
16242  *     cdef Py_ssize_t f_stride = 0
16243  *
16244  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
16245  *         if mslice.shape[i] > 1:
16246  *             c_stride = mslice.strides[i]
16247  */
16248   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
16249     __pyx_v_i = __pyx_t_1;
16250 
16251     /* "View.MemoryView":1125
16252  *
16253  *     for i in range(ndim - 1, -1, -1):
16254  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
16255  *             c_stride = mslice.strides[i]
16256  *             break
16257  */
16258     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
16259     if (__pyx_t_2) {
16260 
16261       /* "View.MemoryView":1126
16262  *     for i in range(ndim - 1, -1, -1):
16263  *         if mslice.shape[i] > 1:
16264  *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
16265  *             break
16266  *
16267  */
16268       __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
16269 
16270       /* "View.MemoryView":1127
16271  *         if mslice.shape[i] > 1:
16272  *             c_stride = mslice.strides[i]
16273  *             break             # <<<<<<<<<<<<<<
16274  *
16275  *     for i in range(ndim):
16276  */
16277       goto __pyx_L4_break;
16278 
16279       /* "View.MemoryView":1125
16280  *
16281  *     for i in range(ndim - 1, -1, -1):
16282  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
16283  *             c_stride = mslice.strides[i]
16284  *             break
16285  */
16286     }
16287   }
16288   __pyx_L4_break:;
16289 
16290   /* "View.MemoryView":1129
16291  *             break
16292  *
16293  *     for i in range(ndim):             # <<<<<<<<<<<<<<
16294  *         if mslice.shape[i] > 1:
16295  *             f_stride = mslice.strides[i]
16296  */
16297   __pyx_t_1 = __pyx_v_ndim;
16298   __pyx_t_3 = __pyx_t_1;
16299   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
16300     __pyx_v_i = __pyx_t_4;
16301 
16302     /* "View.MemoryView":1130
16303  *
16304  *     for i in range(ndim):
16305  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
16306  *             f_stride = mslice.strides[i]
16307  *             break
16308  */
16309     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
16310     if (__pyx_t_2) {
16311 
16312       /* "View.MemoryView":1131
16313  *     for i in range(ndim):
16314  *         if mslice.shape[i] > 1:
16315  *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
16316  *             break
16317  *
16318  */
16319       __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
16320 
16321       /* "View.MemoryView":1132
16322  *         if mslice.shape[i] > 1:
16323  *             f_stride = mslice.strides[i]
16324  *             break             # <<<<<<<<<<<<<<
16325  *
16326  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
16327  */
16328       goto __pyx_L7_break;
16329 
16330       /* "View.MemoryView":1130
16331  *
16332  *     for i in range(ndim):
16333  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
16334  *             f_stride = mslice.strides[i]
16335  *             break
16336  */
16337     }
16338   }
16339   __pyx_L7_break:;
16340 
16341   /* "View.MemoryView":1134
16342  *             break
16343  *
16344  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
16345  *         return 'C'
16346  *     else:
16347  */
16348   __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
16349   if (__pyx_t_2) {
16350 
16351     /* "View.MemoryView":1135
16352  *
16353  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
16354  *         return 'C'             # <<<<<<<<<<<<<<
16355  *     else:
16356  *         return 'F'
16357  */
16358     __pyx_r = 'C';
16359     goto __pyx_L0;
16360 
16361     /* "View.MemoryView":1134
16362  *             break
16363  *
16364  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
16365  *         return 'C'
16366  *     else:
16367  */
16368   }
16369 
16370   /* "View.MemoryView":1137
16371  *         return 'C'
16372  *     else:
16373  *         return 'F'             # <<<<<<<<<<<<<<
16374  *
16375  * @cython.cdivision(True)
16376  */
16377   /*else*/ {
16378     __pyx_r = 'F';
16379     goto __pyx_L0;
16380   }
16381 
16382   /* "View.MemoryView":1116
16383  *
16384  * @cname('__pyx_get_best_slice_order')
16385  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
16386  *     """
16387  *     Figure out the best memory access order for a given slice.
16388  */
16389 
16390   /* function exit code */
16391   __pyx_L0:;
16392   return __pyx_r;
16393 }
16394 
16395 /* "View.MemoryView":1140
16396  *
16397  * @cython.cdivision(True)
16398  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
16399  *                                    char *dst_data, Py_ssize_t *dst_strides,
16400  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
16401  */
16402 
_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)16403 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) {
16404   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
16405   CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
16406   Py_ssize_t __pyx_v_dst_extent;
16407   Py_ssize_t __pyx_v_src_stride;
16408   Py_ssize_t __pyx_v_dst_stride;
16409   int __pyx_t_1;
16410   int __pyx_t_2;
16411   int __pyx_t_3;
16412   Py_ssize_t __pyx_t_4;
16413   Py_ssize_t __pyx_t_5;
16414   Py_ssize_t __pyx_t_6;
16415 
16416   /* "View.MemoryView":1147
16417  *
16418  *     cdef Py_ssize_t i
16419  *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
16420  *     cdef Py_ssize_t dst_extent = dst_shape[0]
16421  *     cdef Py_ssize_t src_stride = src_strides[0]
16422  */
16423   __pyx_v_src_extent = (__pyx_v_src_shape[0]);
16424 
16425   /* "View.MemoryView":1148
16426  *     cdef Py_ssize_t i
16427  *     cdef Py_ssize_t src_extent = src_shape[0]
16428  *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
16429  *     cdef Py_ssize_t src_stride = src_strides[0]
16430  *     cdef Py_ssize_t dst_stride = dst_strides[0]
16431  */
16432   __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
16433 
16434   /* "View.MemoryView":1149
16435  *     cdef Py_ssize_t src_extent = src_shape[0]
16436  *     cdef Py_ssize_t dst_extent = dst_shape[0]
16437  *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
16438  *     cdef Py_ssize_t dst_stride = dst_strides[0]
16439  *
16440  */
16441   __pyx_v_src_stride = (__pyx_v_src_strides[0]);
16442 
16443   /* "View.MemoryView":1150
16444  *     cdef Py_ssize_t dst_extent = dst_shape[0]
16445  *     cdef Py_ssize_t src_stride = src_strides[0]
16446  *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
16447  *
16448  *     if ndim == 1:
16449  */
16450   __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
16451 
16452   /* "View.MemoryView":1152
16453  *     cdef Py_ssize_t dst_stride = dst_strides[0]
16454  *
16455  *     if ndim == 1:             # <<<<<<<<<<<<<<
16456  *        if (src_stride > 0 and dst_stride > 0 and
16457  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
16458  */
16459   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
16460   if (__pyx_t_1) {
16461 
16462     /* "View.MemoryView":1153
16463  *
16464  *     if ndim == 1:
16465  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
16466  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
16467  *            memcpy(dst_data, src_data, itemsize * dst_extent)
16468  */
16469     __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
16470     if (__pyx_t_2) {
16471     } else {
16472       __pyx_t_1 = __pyx_t_2;
16473       goto __pyx_L5_bool_binop_done;
16474     }
16475     __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
16476     if (__pyx_t_2) {
16477     } else {
16478       __pyx_t_1 = __pyx_t_2;
16479       goto __pyx_L5_bool_binop_done;
16480     }
16481 
16482     /* "View.MemoryView":1154
16483  *     if ndim == 1:
16484  *        if (src_stride > 0 and dst_stride > 0 and
16485  *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
16486  *            memcpy(dst_data, src_data, itemsize * dst_extent)
16487  *        else:
16488  */
16489     __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
16490     if (__pyx_t_2) {
16491       __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
16492     }
16493     __pyx_t_3 = (__pyx_t_2 != 0);
16494     __pyx_t_1 = __pyx_t_3;
16495     __pyx_L5_bool_binop_done:;
16496 
16497     /* "View.MemoryView":1153
16498  *
16499  *     if ndim == 1:
16500  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
16501  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
16502  *            memcpy(dst_data, src_data, itemsize * dst_extent)
16503  */
16504     if (__pyx_t_1) {
16505 
16506       /* "View.MemoryView":1155
16507  *        if (src_stride > 0 and dst_stride > 0 and
16508  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
16509  *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
16510  *        else:
16511  *            for i in range(dst_extent):
16512  */
16513       (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
16514 
16515       /* "View.MemoryView":1153
16516  *
16517  *     if ndim == 1:
16518  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
16519  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
16520  *            memcpy(dst_data, src_data, itemsize * dst_extent)
16521  */
16522       goto __pyx_L4;
16523     }
16524 
16525     /* "View.MemoryView":1157
16526  *            memcpy(dst_data, src_data, itemsize * dst_extent)
16527  *        else:
16528  *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
16529  *                memcpy(dst_data, src_data, itemsize)
16530  *                src_data += src_stride
16531  */
16532     /*else*/ {
16533       __pyx_t_4 = __pyx_v_dst_extent;
16534       __pyx_t_5 = __pyx_t_4;
16535       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16536         __pyx_v_i = __pyx_t_6;
16537 
16538         /* "View.MemoryView":1158
16539  *        else:
16540  *            for i in range(dst_extent):
16541  *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
16542  *                src_data += src_stride
16543  *                dst_data += dst_stride
16544  */
16545         (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
16546 
16547         /* "View.MemoryView":1159
16548  *            for i in range(dst_extent):
16549  *                memcpy(dst_data, src_data, itemsize)
16550  *                src_data += src_stride             # <<<<<<<<<<<<<<
16551  *                dst_data += dst_stride
16552  *     else:
16553  */
16554         __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
16555 
16556         /* "View.MemoryView":1160
16557  *                memcpy(dst_data, src_data, itemsize)
16558  *                src_data += src_stride
16559  *                dst_data += dst_stride             # <<<<<<<<<<<<<<
16560  *     else:
16561  *         for i in range(dst_extent):
16562  */
16563         __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
16564       }
16565     }
16566     __pyx_L4:;
16567 
16568     /* "View.MemoryView":1152
16569  *     cdef Py_ssize_t dst_stride = dst_strides[0]
16570  *
16571  *     if ndim == 1:             # <<<<<<<<<<<<<<
16572  *        if (src_stride > 0 and dst_stride > 0 and
16573  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
16574  */
16575     goto __pyx_L3;
16576   }
16577 
16578   /* "View.MemoryView":1162
16579  *                dst_data += dst_stride
16580  *     else:
16581  *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
16582  *             _copy_strided_to_strided(src_data, src_strides + 1,
16583  *                                      dst_data, dst_strides + 1,
16584  */
16585   /*else*/ {
16586     __pyx_t_4 = __pyx_v_dst_extent;
16587     __pyx_t_5 = __pyx_t_4;
16588     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16589       __pyx_v_i = __pyx_t_6;
16590 
16591       /* "View.MemoryView":1163
16592  *     else:
16593  *         for i in range(dst_extent):
16594  *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
16595  *                                      dst_data, dst_strides + 1,
16596  *                                      src_shape + 1, dst_shape + 1,
16597  */
16598       _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);
16599 
16600       /* "View.MemoryView":1167
16601  *                                      src_shape + 1, dst_shape + 1,
16602  *                                      ndim - 1, itemsize)
16603  *             src_data += src_stride             # <<<<<<<<<<<<<<
16604  *             dst_data += dst_stride
16605  *
16606  */
16607       __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
16608 
16609       /* "View.MemoryView":1168
16610  *                                      ndim - 1, itemsize)
16611  *             src_data += src_stride
16612  *             dst_data += dst_stride             # <<<<<<<<<<<<<<
16613  *
16614  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
16615  */
16616       __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
16617     }
16618   }
16619   __pyx_L3:;
16620 
16621   /* "View.MemoryView":1140
16622  *
16623  * @cython.cdivision(True)
16624  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
16625  *                                    char *dst_data, Py_ssize_t *dst_strides,
16626  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
16627  */
16628 
16629   /* function exit code */
16630 }
16631 
16632 /* "View.MemoryView":1170
16633  *             dst_data += dst_stride
16634  *
16635  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
16636  *                                   __Pyx_memviewslice *dst,
16637  *                                   int ndim, size_t itemsize) nogil:
16638  */
16639 
copy_strided_to_strided(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize)16640 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) {
16641 
16642   /* "View.MemoryView":1173
16643  *                                   __Pyx_memviewslice *dst,
16644  *                                   int ndim, size_t itemsize) nogil:
16645  *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
16646  *                              src.shape, dst.shape, ndim, itemsize)
16647  *
16648  */
16649   _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);
16650 
16651   /* "View.MemoryView":1170
16652  *             dst_data += dst_stride
16653  *
16654  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
16655  *                                   __Pyx_memviewslice *dst,
16656  *                                   int ndim, size_t itemsize) nogil:
16657  */
16658 
16659   /* function exit code */
16660 }
16661 
16662 /* "View.MemoryView":1177
16663  *
16664  * @cname('__pyx_memoryview_slice_get_size')
16665  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
16666  *     "Return the size of the memory occupied by the slice in number of bytes"
16667  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
16668  */
16669 
__pyx_memoryview_slice_get_size(__Pyx_memviewslice * __pyx_v_src,int __pyx_v_ndim)16670 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
16671   Py_ssize_t __pyx_v_shape;
16672   Py_ssize_t __pyx_v_size;
16673   Py_ssize_t __pyx_r;
16674   Py_ssize_t __pyx_t_1;
16675   Py_ssize_t *__pyx_t_2;
16676   Py_ssize_t *__pyx_t_3;
16677   Py_ssize_t *__pyx_t_4;
16678 
16679   /* "View.MemoryView":1179
16680  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
16681  *     "Return the size of the memory occupied by the slice in number of bytes"
16682  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
16683  *
16684  *     for shape in src.shape[:ndim]:
16685  */
16686   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
16687   __pyx_v_size = __pyx_t_1;
16688 
16689   /* "View.MemoryView":1181
16690  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
16691  *
16692  *     for shape in src.shape[:ndim]:             # <<<<<<<<<<<<<<
16693  *         size *= shape
16694  *
16695  */
16696   __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
16697   for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
16698     __pyx_t_2 = __pyx_t_4;
16699     __pyx_v_shape = (__pyx_t_2[0]);
16700 
16701     /* "View.MemoryView":1182
16702  *
16703  *     for shape in src.shape[:ndim]:
16704  *         size *= shape             # <<<<<<<<<<<<<<
16705  *
16706  *     return size
16707  */
16708     __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
16709   }
16710 
16711   /* "View.MemoryView":1184
16712  *         size *= shape
16713  *
16714  *     return size             # <<<<<<<<<<<<<<
16715  *
16716  * @cname('__pyx_fill_contig_strides_array')
16717  */
16718   __pyx_r = __pyx_v_size;
16719   goto __pyx_L0;
16720 
16721   /* "View.MemoryView":1177
16722  *
16723  * @cname('__pyx_memoryview_slice_get_size')
16724  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
16725  *     "Return the size of the memory occupied by the slice in number of bytes"
16726  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
16727  */
16728 
16729   /* function exit code */
16730   __pyx_L0:;
16731   return __pyx_r;
16732 }
16733 
16734 /* "View.MemoryView":1187
16735  *
16736  * @cname('__pyx_fill_contig_strides_array')
16737  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
16738  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
16739  *                 int ndim, char order) nogil:
16740  */
16741 
__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)16742 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) {
16743   int __pyx_v_idx;
16744   Py_ssize_t __pyx_r;
16745   int __pyx_t_1;
16746   int __pyx_t_2;
16747   int __pyx_t_3;
16748   int __pyx_t_4;
16749 
16750   /* "View.MemoryView":1196
16751  *     cdef int idx
16752  *
16753  *     if order == 'F':             # <<<<<<<<<<<<<<
16754  *         for idx in range(ndim):
16755  *             strides[idx] = stride
16756  */
16757   __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
16758   if (__pyx_t_1) {
16759 
16760     /* "View.MemoryView":1197
16761  *
16762  *     if order == 'F':
16763  *         for idx in range(ndim):             # <<<<<<<<<<<<<<
16764  *             strides[idx] = stride
16765  *             stride *= shape[idx]
16766  */
16767     __pyx_t_2 = __pyx_v_ndim;
16768     __pyx_t_3 = __pyx_t_2;
16769     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
16770       __pyx_v_idx = __pyx_t_4;
16771 
16772       /* "View.MemoryView":1198
16773  *     if order == 'F':
16774  *         for idx in range(ndim):
16775  *             strides[idx] = stride             # <<<<<<<<<<<<<<
16776  *             stride *= shape[idx]
16777  *     else:
16778  */
16779       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
16780 
16781       /* "View.MemoryView":1199
16782  *         for idx in range(ndim):
16783  *             strides[idx] = stride
16784  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
16785  *     else:
16786  *         for idx in range(ndim - 1, -1, -1):
16787  */
16788       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
16789     }
16790 
16791     /* "View.MemoryView":1196
16792  *     cdef int idx
16793  *
16794  *     if order == 'F':             # <<<<<<<<<<<<<<
16795  *         for idx in range(ndim):
16796  *             strides[idx] = stride
16797  */
16798     goto __pyx_L3;
16799   }
16800 
16801   /* "View.MemoryView":1201
16802  *             stride *= shape[idx]
16803  *     else:
16804  *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
16805  *             strides[idx] = stride
16806  *             stride *= shape[idx]
16807  */
16808   /*else*/ {
16809     for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
16810       __pyx_v_idx = __pyx_t_2;
16811 
16812       /* "View.MemoryView":1202
16813  *     else:
16814  *         for idx in range(ndim - 1, -1, -1):
16815  *             strides[idx] = stride             # <<<<<<<<<<<<<<
16816  *             stride *= shape[idx]
16817  *
16818  */
16819       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
16820 
16821       /* "View.MemoryView":1203
16822  *         for idx in range(ndim - 1, -1, -1):
16823  *             strides[idx] = stride
16824  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
16825  *
16826  *     return stride
16827  */
16828       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
16829     }
16830   }
16831   __pyx_L3:;
16832 
16833   /* "View.MemoryView":1205
16834  *             stride *= shape[idx]
16835  *
16836  *     return stride             # <<<<<<<<<<<<<<
16837  *
16838  * @cname('__pyx_memoryview_copy_data_to_temp')
16839  */
16840   __pyx_r = __pyx_v_stride;
16841   goto __pyx_L0;
16842 
16843   /* "View.MemoryView":1187
16844  *
16845  * @cname('__pyx_fill_contig_strides_array')
16846  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
16847  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
16848  *                 int ndim, char order) nogil:
16849  */
16850 
16851   /* function exit code */
16852   __pyx_L0:;
16853   return __pyx_r;
16854 }
16855 
16856 /* "View.MemoryView":1208
16857  *
16858  * @cname('__pyx_memoryview_copy_data_to_temp')
16859  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
16860  *                              __Pyx_memviewslice *tmpslice,
16861  *                              char order,
16862  */
16863 
__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_tmpslice,char __pyx_v_order,int __pyx_v_ndim)16864 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) {
16865   int __pyx_v_i;
16866   void *__pyx_v_result;
16867   size_t __pyx_v_itemsize;
16868   size_t __pyx_v_size;
16869   void *__pyx_r;
16870   Py_ssize_t __pyx_t_1;
16871   int __pyx_t_2;
16872   int __pyx_t_3;
16873   struct __pyx_memoryview_obj *__pyx_t_4;
16874   int __pyx_t_5;
16875   int __pyx_t_6;
16876   int __pyx_lineno = 0;
16877   const char *__pyx_filename = NULL;
16878   int __pyx_clineno = 0;
16879 
16880   /* "View.MemoryView":1219
16881  *     cdef void *result
16882  *
16883  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
16884  *     cdef size_t size = slice_get_size(src, ndim)
16885  *
16886  */
16887   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
16888   __pyx_v_itemsize = __pyx_t_1;
16889 
16890   /* "View.MemoryView":1220
16891  *
16892  *     cdef size_t itemsize = src.memview.view.itemsize
16893  *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
16894  *
16895  *     result = malloc(size)
16896  */
16897   __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
16898 
16899   /* "View.MemoryView":1222
16900  *     cdef size_t size = slice_get_size(src, ndim)
16901  *
16902  *     result = malloc(size)             # <<<<<<<<<<<<<<
16903  *     if not result:
16904  *         _err(MemoryError, NULL)
16905  */
16906   __pyx_v_result = malloc(__pyx_v_size);
16907 
16908   /* "View.MemoryView":1223
16909  *
16910  *     result = malloc(size)
16911  *     if not result:             # <<<<<<<<<<<<<<
16912  *         _err(MemoryError, NULL)
16913  *
16914  */
16915   __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
16916   if (__pyx_t_2) {
16917 
16918     /* "View.MemoryView":1224
16919  *     result = malloc(size)
16920  *     if not result:
16921  *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
16922  *
16923  *
16924  */
16925     __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1224, __pyx_L1_error)
16926 
16927     /* "View.MemoryView":1223
16928  *
16929  *     result = malloc(size)
16930  *     if not result:             # <<<<<<<<<<<<<<
16931  *         _err(MemoryError, NULL)
16932  *
16933  */
16934   }
16935 
16936   /* "View.MemoryView":1227
16937  *
16938  *
16939  *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
16940  *     tmpslice.memview = src.memview
16941  *     for i in range(ndim):
16942  */
16943   __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
16944 
16945   /* "View.MemoryView":1228
16946  *
16947  *     tmpslice.data = <char *> result
16948  *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
16949  *     for i in range(ndim):
16950  *         tmpslice.shape[i] = src.shape[i]
16951  */
16952   __pyx_t_4 = __pyx_v_src->memview;
16953   __pyx_v_tmpslice->memview = __pyx_t_4;
16954 
16955   /* "View.MemoryView":1229
16956  *     tmpslice.data = <char *> result
16957  *     tmpslice.memview = src.memview
16958  *     for i in range(ndim):             # <<<<<<<<<<<<<<
16959  *         tmpslice.shape[i] = src.shape[i]
16960  *         tmpslice.suboffsets[i] = -1
16961  */
16962   __pyx_t_3 = __pyx_v_ndim;
16963   __pyx_t_5 = __pyx_t_3;
16964   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16965     __pyx_v_i = __pyx_t_6;
16966 
16967     /* "View.MemoryView":1230
16968  *     tmpslice.memview = src.memview
16969  *     for i in range(ndim):
16970  *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
16971  *         tmpslice.suboffsets[i] = -1
16972  *
16973  */
16974     (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
16975 
16976     /* "View.MemoryView":1231
16977  *     for i in range(ndim):
16978  *         tmpslice.shape[i] = src.shape[i]
16979  *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
16980  *
16981  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
16982  */
16983     (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
16984   }
16985 
16986   /* "View.MemoryView":1233
16987  *         tmpslice.suboffsets[i] = -1
16988  *
16989  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
16990  *                               ndim, order)
16991  *
16992  */
16993   (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));
16994 
16995   /* "View.MemoryView":1237
16996  *
16997  *
16998  *     for i in range(ndim):             # <<<<<<<<<<<<<<
16999  *         if tmpslice.shape[i] == 1:
17000  *             tmpslice.strides[i] = 0
17001  */
17002   __pyx_t_3 = __pyx_v_ndim;
17003   __pyx_t_5 = __pyx_t_3;
17004   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17005     __pyx_v_i = __pyx_t_6;
17006 
17007     /* "View.MemoryView":1238
17008  *
17009  *     for i in range(ndim):
17010  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
17011  *             tmpslice.strides[i] = 0
17012  *
17013  */
17014     __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
17015     if (__pyx_t_2) {
17016 
17017       /* "View.MemoryView":1239
17018  *     for i in range(ndim):
17019  *         if tmpslice.shape[i] == 1:
17020  *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
17021  *
17022  *     if slice_is_contig(src[0], order, ndim):
17023  */
17024       (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
17025 
17026       /* "View.MemoryView":1238
17027  *
17028  *     for i in range(ndim):
17029  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
17030  *             tmpslice.strides[i] = 0
17031  *
17032  */
17033     }
17034   }
17035 
17036   /* "View.MemoryView":1241
17037  *             tmpslice.strides[i] = 0
17038  *
17039  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
17040  *         memcpy(result, src.data, size)
17041  *     else:
17042  */
17043   __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
17044   if (__pyx_t_2) {
17045 
17046     /* "View.MemoryView":1242
17047  *
17048  *     if slice_is_contig(src[0], order, ndim):
17049  *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
17050  *     else:
17051  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
17052  */
17053     (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
17054 
17055     /* "View.MemoryView":1241
17056  *             tmpslice.strides[i] = 0
17057  *
17058  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
17059  *         memcpy(result, src.data, size)
17060  *     else:
17061  */
17062     goto __pyx_L9;
17063   }
17064 
17065   /* "View.MemoryView":1244
17066  *         memcpy(result, src.data, size)
17067  *     else:
17068  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
17069  *
17070  *     return result
17071  */
17072   /*else*/ {
17073     copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
17074   }
17075   __pyx_L9:;
17076 
17077   /* "View.MemoryView":1246
17078  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
17079  *
17080  *     return result             # <<<<<<<<<<<<<<
17081  *
17082  *
17083  */
17084   __pyx_r = __pyx_v_result;
17085   goto __pyx_L0;
17086 
17087   /* "View.MemoryView":1208
17088  *
17089  * @cname('__pyx_memoryview_copy_data_to_temp')
17090  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
17091  *                              __Pyx_memviewslice *tmpslice,
17092  *                              char order,
17093  */
17094 
17095   /* function exit code */
17096   __pyx_L1_error:;
17097   {
17098     #ifdef WITH_THREAD
17099     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17100     #endif
17101     __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
17102     #ifdef WITH_THREAD
17103     __Pyx_PyGILState_Release(__pyx_gilstate_save);
17104     #endif
17105   }
17106   __pyx_r = NULL;
17107   __pyx_L0:;
17108   return __pyx_r;
17109 }
17110 
17111 /* "View.MemoryView":1251
17112  *
17113  * @cname('__pyx_memoryview_err_extents')
17114  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
17115  *                              Py_ssize_t extent2) except -1 with gil:
17116  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
17117  */
17118 
__pyx_memoryview_err_extents(int __pyx_v_i,Py_ssize_t __pyx_v_extent1,Py_ssize_t __pyx_v_extent2)17119 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
17120   int __pyx_r;
17121   __Pyx_RefNannyDeclarations
17122   PyObject *__pyx_t_1 = NULL;
17123   PyObject *__pyx_t_2 = NULL;
17124   PyObject *__pyx_t_3 = NULL;
17125   PyObject *__pyx_t_4 = NULL;
17126   int __pyx_lineno = 0;
17127   const char *__pyx_filename = NULL;
17128   int __pyx_clineno = 0;
17129   #ifdef WITH_THREAD
17130   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17131   #endif
17132   __Pyx_RefNannySetupContext("_err_extents", 0);
17133 
17134   /* "View.MemoryView":1254
17135  *                              Py_ssize_t extent2) except -1 with gil:
17136  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
17137  *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
17138  *
17139  * @cname('__pyx_memoryview_err_dim')
17140  */
17141   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error)
17142   __Pyx_GOTREF(__pyx_t_1);
17143   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __pyx_L1_error)
17144   __Pyx_GOTREF(__pyx_t_2);
17145   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error)
17146   __Pyx_GOTREF(__pyx_t_3);
17147   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error)
17148   __Pyx_GOTREF(__pyx_t_4);
17149   __Pyx_GIVEREF(__pyx_t_1);
17150   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
17151   __Pyx_GIVEREF(__pyx_t_2);
17152   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
17153   __Pyx_GIVEREF(__pyx_t_3);
17154   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
17155   __pyx_t_1 = 0;
17156   __pyx_t_2 = 0;
17157   __pyx_t_3 = 0;
17158 
17159   /* "View.MemoryView":1253
17160  * cdef int _err_extents(int i, Py_ssize_t extent1,
17161  *                              Py_ssize_t extent2) except -1 with gil:
17162  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
17163  *                                                         (i, extent1, extent2))
17164  *
17165  */
17166   __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1253, __pyx_L1_error)
17167   __Pyx_GOTREF(__pyx_t_3);
17168   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17169   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1253, __pyx_L1_error)
17170   __Pyx_GOTREF(__pyx_t_4);
17171   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17172   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
17173   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17174   __PYX_ERR(2, 1253, __pyx_L1_error)
17175 
17176   /* "View.MemoryView":1251
17177  *
17178  * @cname('__pyx_memoryview_err_extents')
17179  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
17180  *                              Py_ssize_t extent2) except -1 with gil:
17181  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
17182  */
17183 
17184   /* function exit code */
17185   __pyx_L1_error:;
17186   __Pyx_XDECREF(__pyx_t_1);
17187   __Pyx_XDECREF(__pyx_t_2);
17188   __Pyx_XDECREF(__pyx_t_3);
17189   __Pyx_XDECREF(__pyx_t_4);
17190   __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
17191   __pyx_r = -1;
17192   __Pyx_RefNannyFinishContext();
17193   #ifdef WITH_THREAD
17194   __Pyx_PyGILState_Release(__pyx_gilstate_save);
17195   #endif
17196   return __pyx_r;
17197 }
17198 
17199 /* "View.MemoryView":1257
17200  *
17201  * @cname('__pyx_memoryview_err_dim')
17202  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
17203  *     raise error(msg.decode('ascii') % dim)
17204  *
17205  */
17206 
__pyx_memoryview_err_dim(PyObject * __pyx_v_error,char * __pyx_v_msg,int __pyx_v_dim)17207 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
17208   int __pyx_r;
17209   __Pyx_RefNannyDeclarations
17210   PyObject *__pyx_t_1 = NULL;
17211   PyObject *__pyx_t_2 = NULL;
17212   PyObject *__pyx_t_3 = NULL;
17213   PyObject *__pyx_t_4 = NULL;
17214   int __pyx_lineno = 0;
17215   const char *__pyx_filename = NULL;
17216   int __pyx_clineno = 0;
17217   #ifdef WITH_THREAD
17218   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17219   #endif
17220   __Pyx_RefNannySetupContext("_err_dim", 0);
17221   __Pyx_INCREF(__pyx_v_error);
17222 
17223   /* "View.MemoryView":1258
17224  * @cname('__pyx_memoryview_err_dim')
17225  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
17226  *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
17227  *
17228  * @cname('__pyx_memoryview_err')
17229  */
17230   __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1258, __pyx_L1_error)
17231   __Pyx_GOTREF(__pyx_t_2);
17232   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1258, __pyx_L1_error)
17233   __Pyx_GOTREF(__pyx_t_3);
17234   __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1258, __pyx_L1_error)
17235   __Pyx_GOTREF(__pyx_t_4);
17236   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17237   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17238   __Pyx_INCREF(__pyx_v_error);
17239   __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
17240   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
17241     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
17242     if (likely(__pyx_t_2)) {
17243       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
17244       __Pyx_INCREF(__pyx_t_2);
17245       __Pyx_INCREF(function);
17246       __Pyx_DECREF_SET(__pyx_t_3, function);
17247     }
17248   }
17249   __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);
17250   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
17251   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17252   if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1258, __pyx_L1_error)
17253   __Pyx_GOTREF(__pyx_t_1);
17254   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17255   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17256   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17257   __PYX_ERR(2, 1258, __pyx_L1_error)
17258 
17259   /* "View.MemoryView":1257
17260  *
17261  * @cname('__pyx_memoryview_err_dim')
17262  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
17263  *     raise error(msg.decode('ascii') % dim)
17264  *
17265  */
17266 
17267   /* function exit code */
17268   __pyx_L1_error:;
17269   __Pyx_XDECREF(__pyx_t_1);
17270   __Pyx_XDECREF(__pyx_t_2);
17271   __Pyx_XDECREF(__pyx_t_3);
17272   __Pyx_XDECREF(__pyx_t_4);
17273   __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
17274   __pyx_r = -1;
17275   __Pyx_XDECREF(__pyx_v_error);
17276   __Pyx_RefNannyFinishContext();
17277   #ifdef WITH_THREAD
17278   __Pyx_PyGILState_Release(__pyx_gilstate_save);
17279   #endif
17280   return __pyx_r;
17281 }
17282 
17283 /* "View.MemoryView":1261
17284  *
17285  * @cname('__pyx_memoryview_err')
17286  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
17287  *     if msg != NULL:
17288  *         raise error(msg.decode('ascii'))
17289  */
17290 
__pyx_memoryview_err(PyObject * __pyx_v_error,char * __pyx_v_msg)17291 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
17292   int __pyx_r;
17293   __Pyx_RefNannyDeclarations
17294   int __pyx_t_1;
17295   PyObject *__pyx_t_2 = NULL;
17296   PyObject *__pyx_t_3 = NULL;
17297   PyObject *__pyx_t_4 = NULL;
17298   PyObject *__pyx_t_5 = NULL;
17299   int __pyx_lineno = 0;
17300   const char *__pyx_filename = NULL;
17301   int __pyx_clineno = 0;
17302   #ifdef WITH_THREAD
17303   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17304   #endif
17305   __Pyx_RefNannySetupContext("_err", 0);
17306   __Pyx_INCREF(__pyx_v_error);
17307 
17308   /* "View.MemoryView":1262
17309  * @cname('__pyx_memoryview_err')
17310  * cdef int _err(object error, char *msg) except -1 with gil:
17311  *     if msg != NULL:             # <<<<<<<<<<<<<<
17312  *         raise error(msg.decode('ascii'))
17313  *     else:
17314  */
17315   __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
17316   if (unlikely(__pyx_t_1)) {
17317 
17318     /* "View.MemoryView":1263
17319  * cdef int _err(object error, char *msg) except -1 with gil:
17320  *     if msg != NULL:
17321  *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
17322  *     else:
17323  *         raise error
17324  */
17325     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1263, __pyx_L1_error)
17326     __Pyx_GOTREF(__pyx_t_3);
17327     __Pyx_INCREF(__pyx_v_error);
17328     __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
17329     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
17330       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
17331       if (likely(__pyx_t_5)) {
17332         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
17333         __Pyx_INCREF(__pyx_t_5);
17334         __Pyx_INCREF(function);
17335         __Pyx_DECREF_SET(__pyx_t_4, function);
17336       }
17337     }
17338     __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);
17339     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
17340     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17341     if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1263, __pyx_L1_error)
17342     __Pyx_GOTREF(__pyx_t_2);
17343     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17344     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
17345     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17346     __PYX_ERR(2, 1263, __pyx_L1_error)
17347 
17348     /* "View.MemoryView":1262
17349  * @cname('__pyx_memoryview_err')
17350  * cdef int _err(object error, char *msg) except -1 with gil:
17351  *     if msg != NULL:             # <<<<<<<<<<<<<<
17352  *         raise error(msg.decode('ascii'))
17353  *     else:
17354  */
17355   }
17356 
17357   /* "View.MemoryView":1265
17358  *         raise error(msg.decode('ascii'))
17359  *     else:
17360  *         raise error             # <<<<<<<<<<<<<<
17361  *
17362  * @cname('__pyx_memoryview_copy_contents')
17363  */
17364   /*else*/ {
17365     __Pyx_Raise(__pyx_v_error, 0, 0, 0);
17366     __PYX_ERR(2, 1265, __pyx_L1_error)
17367   }
17368 
17369   /* "View.MemoryView":1261
17370  *
17371  * @cname('__pyx_memoryview_err')
17372  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
17373  *     if msg != NULL:
17374  *         raise error(msg.decode('ascii'))
17375  */
17376 
17377   /* function exit code */
17378   __pyx_L1_error:;
17379   __Pyx_XDECREF(__pyx_t_2);
17380   __Pyx_XDECREF(__pyx_t_3);
17381   __Pyx_XDECREF(__pyx_t_4);
17382   __Pyx_XDECREF(__pyx_t_5);
17383   __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
17384   __pyx_r = -1;
17385   __Pyx_XDECREF(__pyx_v_error);
17386   __Pyx_RefNannyFinishContext();
17387   #ifdef WITH_THREAD
17388   __Pyx_PyGILState_Release(__pyx_gilstate_save);
17389   #endif
17390   return __pyx_r;
17391 }
17392 
17393 /* "View.MemoryView":1268
17394  *
17395  * @cname('__pyx_memoryview_copy_contents')
17396  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
17397  *                                   __Pyx_memviewslice dst,
17398  *                                   int src_ndim, int dst_ndim,
17399  */
17400 
__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)17401 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) {
17402   void *__pyx_v_tmpdata;
17403   size_t __pyx_v_itemsize;
17404   int __pyx_v_i;
17405   char __pyx_v_order;
17406   int __pyx_v_broadcasting;
17407   int __pyx_v_direct_copy;
17408   __Pyx_memviewslice __pyx_v_tmp;
17409   int __pyx_v_ndim;
17410   int __pyx_r;
17411   Py_ssize_t __pyx_t_1;
17412   int __pyx_t_2;
17413   int __pyx_t_3;
17414   int __pyx_t_4;
17415   int __pyx_t_5;
17416   int __pyx_t_6;
17417   void *__pyx_t_7;
17418   int __pyx_t_8;
17419   int __pyx_lineno = 0;
17420   const char *__pyx_filename = NULL;
17421   int __pyx_clineno = 0;
17422 
17423   /* "View.MemoryView":1276
17424  *     Check for overlapping memory and verify the shapes.
17425  *     """
17426  *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
17427  *     cdef size_t itemsize = src.memview.view.itemsize
17428  *     cdef int i
17429  */
17430   __pyx_v_tmpdata = NULL;
17431 
17432   /* "View.MemoryView":1277
17433  *     """
17434  *     cdef void *tmpdata = NULL
17435  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
17436  *     cdef int i
17437  *     cdef char order = get_best_order(&src, src_ndim)
17438  */
17439   __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
17440   __pyx_v_itemsize = __pyx_t_1;
17441 
17442   /* "View.MemoryView":1279
17443  *     cdef size_t itemsize = src.memview.view.itemsize
17444  *     cdef int i
17445  *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
17446  *     cdef bint broadcasting = False
17447  *     cdef bint direct_copy = False
17448  */
17449   __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
17450 
17451   /* "View.MemoryView":1280
17452  *     cdef int i
17453  *     cdef char order = get_best_order(&src, src_ndim)
17454  *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
17455  *     cdef bint direct_copy = False
17456  *     cdef __Pyx_memviewslice tmp
17457  */
17458   __pyx_v_broadcasting = 0;
17459 
17460   /* "View.MemoryView":1281
17461  *     cdef char order = get_best_order(&src, src_ndim)
17462  *     cdef bint broadcasting = False
17463  *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
17464  *     cdef __Pyx_memviewslice tmp
17465  *
17466  */
17467   __pyx_v_direct_copy = 0;
17468 
17469   /* "View.MemoryView":1284
17470  *     cdef __Pyx_memviewslice tmp
17471  *
17472  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
17473  *         broadcast_leading(&src, src_ndim, dst_ndim)
17474  *     elif dst_ndim < src_ndim:
17475  */
17476   __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
17477   if (__pyx_t_2) {
17478 
17479     /* "View.MemoryView":1285
17480  *
17481  *     if src_ndim < dst_ndim:
17482  *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
17483  *     elif dst_ndim < src_ndim:
17484  *         broadcast_leading(&dst, dst_ndim, src_ndim)
17485  */
17486     __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
17487 
17488     /* "View.MemoryView":1284
17489  *     cdef __Pyx_memviewslice tmp
17490  *
17491  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
17492  *         broadcast_leading(&src, src_ndim, dst_ndim)
17493  *     elif dst_ndim < src_ndim:
17494  */
17495     goto __pyx_L3;
17496   }
17497 
17498   /* "View.MemoryView":1286
17499  *     if src_ndim < dst_ndim:
17500  *         broadcast_leading(&src, src_ndim, dst_ndim)
17501  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
17502  *         broadcast_leading(&dst, dst_ndim, src_ndim)
17503  *
17504  */
17505   __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
17506   if (__pyx_t_2) {
17507 
17508     /* "View.MemoryView":1287
17509  *         broadcast_leading(&src, src_ndim, dst_ndim)
17510  *     elif dst_ndim < src_ndim:
17511  *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
17512  *
17513  *     cdef int ndim = max(src_ndim, dst_ndim)
17514  */
17515     __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
17516 
17517     /* "View.MemoryView":1286
17518  *     if src_ndim < dst_ndim:
17519  *         broadcast_leading(&src, src_ndim, dst_ndim)
17520  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
17521  *         broadcast_leading(&dst, dst_ndim, src_ndim)
17522  *
17523  */
17524   }
17525   __pyx_L3:;
17526 
17527   /* "View.MemoryView":1289
17528  *         broadcast_leading(&dst, dst_ndim, src_ndim)
17529  *
17530  *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
17531  *
17532  *     for i in range(ndim):
17533  */
17534   __pyx_t_3 = __pyx_v_dst_ndim;
17535   __pyx_t_4 = __pyx_v_src_ndim;
17536   if (((__pyx_t_3 > __pyx_t_4) != 0)) {
17537     __pyx_t_5 = __pyx_t_3;
17538   } else {
17539     __pyx_t_5 = __pyx_t_4;
17540   }
17541   __pyx_v_ndim = __pyx_t_5;
17542 
17543   /* "View.MemoryView":1291
17544  *     cdef int ndim = max(src_ndim, dst_ndim)
17545  *
17546  *     for i in range(ndim):             # <<<<<<<<<<<<<<
17547  *         if src.shape[i] != dst.shape[i]:
17548  *             if src.shape[i] == 1:
17549  */
17550   __pyx_t_5 = __pyx_v_ndim;
17551   __pyx_t_3 = __pyx_t_5;
17552   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17553     __pyx_v_i = __pyx_t_4;
17554 
17555     /* "View.MemoryView":1292
17556  *
17557  *     for i in range(ndim):
17558  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
17559  *             if src.shape[i] == 1:
17560  *                 broadcasting = True
17561  */
17562     __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
17563     if (__pyx_t_2) {
17564 
17565       /* "View.MemoryView":1293
17566  *     for i in range(ndim):
17567  *         if src.shape[i] != dst.shape[i]:
17568  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
17569  *                 broadcasting = True
17570  *                 src.strides[i] = 0
17571  */
17572       __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
17573       if (__pyx_t_2) {
17574 
17575         /* "View.MemoryView":1294
17576  *         if src.shape[i] != dst.shape[i]:
17577  *             if src.shape[i] == 1:
17578  *                 broadcasting = True             # <<<<<<<<<<<<<<
17579  *                 src.strides[i] = 0
17580  *             else:
17581  */
17582         __pyx_v_broadcasting = 1;
17583 
17584         /* "View.MemoryView":1295
17585  *             if src.shape[i] == 1:
17586  *                 broadcasting = True
17587  *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
17588  *             else:
17589  *                 _err_extents(i, dst.shape[i], src.shape[i])
17590  */
17591         (__pyx_v_src.strides[__pyx_v_i]) = 0;
17592 
17593         /* "View.MemoryView":1293
17594  *     for i in range(ndim):
17595  *         if src.shape[i] != dst.shape[i]:
17596  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
17597  *                 broadcasting = True
17598  *                 src.strides[i] = 0
17599  */
17600         goto __pyx_L7;
17601       }
17602 
17603       /* "View.MemoryView":1297
17604  *                 src.strides[i] = 0
17605  *             else:
17606  *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
17607  *
17608  *         if src.suboffsets[i] >= 0:
17609  */
17610       /*else*/ {
17611         __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1297, __pyx_L1_error)
17612       }
17613       __pyx_L7:;
17614 
17615       /* "View.MemoryView":1292
17616  *
17617  *     for i in range(ndim):
17618  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
17619  *             if src.shape[i] == 1:
17620  *                 broadcasting = True
17621  */
17622     }
17623 
17624     /* "View.MemoryView":1299
17625  *                 _err_extents(i, dst.shape[i], src.shape[i])
17626  *
17627  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
17628  *             _err_dim(ValueError, "Dimension %d is not direct", i)
17629  *
17630  */
17631     __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
17632     if (__pyx_t_2) {
17633 
17634       /* "View.MemoryView":1300
17635  *
17636  *         if src.suboffsets[i] >= 0:
17637  *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
17638  *
17639  *     if slices_overlap(&src, &dst, ndim, itemsize):
17640  */
17641       __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1300, __pyx_L1_error)
17642 
17643       /* "View.MemoryView":1299
17644  *                 _err_extents(i, dst.shape[i], src.shape[i])
17645  *
17646  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
17647  *             _err_dim(ValueError, "Dimension %d is not direct", i)
17648  *
17649  */
17650     }
17651   }
17652 
17653   /* "View.MemoryView":1302
17654  *             _err_dim(ValueError, "Dimension %d is not direct", i)
17655  *
17656  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
17657  *
17658  *         if not slice_is_contig(src, order, ndim):
17659  */
17660   __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
17661   if (__pyx_t_2) {
17662 
17663     /* "View.MemoryView":1304
17664  *     if slices_overlap(&src, &dst, ndim, itemsize):
17665  *
17666  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
17667  *             order = get_best_order(&dst, ndim)
17668  *
17669  */
17670     __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
17671     if (__pyx_t_2) {
17672 
17673       /* "View.MemoryView":1305
17674  *
17675  *         if not slice_is_contig(src, order, ndim):
17676  *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
17677  *
17678  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
17679  */
17680       __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
17681 
17682       /* "View.MemoryView":1304
17683  *     if slices_overlap(&src, &dst, ndim, itemsize):
17684  *
17685  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
17686  *             order = get_best_order(&dst, ndim)
17687  *
17688  */
17689     }
17690 
17691     /* "View.MemoryView":1307
17692  *             order = get_best_order(&dst, ndim)
17693  *
17694  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
17695  *         src = tmp
17696  *
17697  */
17698     __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1307, __pyx_L1_error)
17699     __pyx_v_tmpdata = __pyx_t_7;
17700 
17701     /* "View.MemoryView":1308
17702  *
17703  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
17704  *         src = tmp             # <<<<<<<<<<<<<<
17705  *
17706  *     if not broadcasting:
17707  */
17708     __pyx_v_src = __pyx_v_tmp;
17709 
17710     /* "View.MemoryView":1302
17711  *             _err_dim(ValueError, "Dimension %d is not direct", i)
17712  *
17713  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
17714  *
17715  *         if not slice_is_contig(src, order, ndim):
17716  */
17717   }
17718 
17719   /* "View.MemoryView":1310
17720  *         src = tmp
17721  *
17722  *     if not broadcasting:             # <<<<<<<<<<<<<<
17723  *
17724  *
17725  */
17726   __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
17727   if (__pyx_t_2) {
17728 
17729     /* "View.MemoryView":1313
17730  *
17731  *
17732  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
17733  *             direct_copy = slice_is_contig(dst, 'C', ndim)
17734  *         elif slice_is_contig(src, 'F', ndim):
17735  */
17736     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
17737     if (__pyx_t_2) {
17738 
17739       /* "View.MemoryView":1314
17740  *
17741  *         if slice_is_contig(src, 'C', ndim):
17742  *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
17743  *         elif slice_is_contig(src, 'F', ndim):
17744  *             direct_copy = slice_is_contig(dst, 'F', ndim)
17745  */
17746       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
17747 
17748       /* "View.MemoryView":1313
17749  *
17750  *
17751  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
17752  *             direct_copy = slice_is_contig(dst, 'C', ndim)
17753  *         elif slice_is_contig(src, 'F', ndim):
17754  */
17755       goto __pyx_L12;
17756     }
17757 
17758     /* "View.MemoryView":1315
17759  *         if slice_is_contig(src, 'C', ndim):
17760  *             direct_copy = slice_is_contig(dst, 'C', ndim)
17761  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
17762  *             direct_copy = slice_is_contig(dst, 'F', ndim)
17763  *
17764  */
17765     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
17766     if (__pyx_t_2) {
17767 
17768       /* "View.MemoryView":1316
17769  *             direct_copy = slice_is_contig(dst, 'C', ndim)
17770  *         elif slice_is_contig(src, 'F', ndim):
17771  *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
17772  *
17773  *         if direct_copy:
17774  */
17775       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
17776 
17777       /* "View.MemoryView":1315
17778  *         if slice_is_contig(src, 'C', ndim):
17779  *             direct_copy = slice_is_contig(dst, 'C', ndim)
17780  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
17781  *             direct_copy = slice_is_contig(dst, 'F', ndim)
17782  *
17783  */
17784     }
17785     __pyx_L12:;
17786 
17787     /* "View.MemoryView":1318
17788  *             direct_copy = slice_is_contig(dst, 'F', ndim)
17789  *
17790  *         if direct_copy:             # <<<<<<<<<<<<<<
17791  *
17792  *             refcount_copying(&dst, dtype_is_object, ndim, False)
17793  */
17794     __pyx_t_2 = (__pyx_v_direct_copy != 0);
17795     if (__pyx_t_2) {
17796 
17797       /* "View.MemoryView":1320
17798  *         if direct_copy:
17799  *
17800  *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
17801  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
17802  *             refcount_copying(&dst, dtype_is_object, ndim, True)
17803  */
17804       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
17805 
17806       /* "View.MemoryView":1321
17807  *
17808  *             refcount_copying(&dst, dtype_is_object, ndim, False)
17809  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
17810  *             refcount_copying(&dst, dtype_is_object, ndim, True)
17811  *             free(tmpdata)
17812  */
17813       (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
17814 
17815       /* "View.MemoryView":1322
17816  *             refcount_copying(&dst, dtype_is_object, ndim, False)
17817  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
17818  *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
17819  *             free(tmpdata)
17820  *             return 0
17821  */
17822       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
17823 
17824       /* "View.MemoryView":1323
17825  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
17826  *             refcount_copying(&dst, dtype_is_object, ndim, True)
17827  *             free(tmpdata)             # <<<<<<<<<<<<<<
17828  *             return 0
17829  *
17830  */
17831       free(__pyx_v_tmpdata);
17832 
17833       /* "View.MemoryView":1324
17834  *             refcount_copying(&dst, dtype_is_object, ndim, True)
17835  *             free(tmpdata)
17836  *             return 0             # <<<<<<<<<<<<<<
17837  *
17838  *     if order == 'F' == get_best_order(&dst, ndim):
17839  */
17840       __pyx_r = 0;
17841       goto __pyx_L0;
17842 
17843       /* "View.MemoryView":1318
17844  *             direct_copy = slice_is_contig(dst, 'F', ndim)
17845  *
17846  *         if direct_copy:             # <<<<<<<<<<<<<<
17847  *
17848  *             refcount_copying(&dst, dtype_is_object, ndim, False)
17849  */
17850     }
17851 
17852     /* "View.MemoryView":1310
17853  *         src = tmp
17854  *
17855  *     if not broadcasting:             # <<<<<<<<<<<<<<
17856  *
17857  *
17858  */
17859   }
17860 
17861   /* "View.MemoryView":1326
17862  *             return 0
17863  *
17864  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
17865  *
17866  *
17867  */
17868   __pyx_t_2 = (__pyx_v_order == 'F');
17869   if (__pyx_t_2) {
17870     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
17871   }
17872   __pyx_t_8 = (__pyx_t_2 != 0);
17873   if (__pyx_t_8) {
17874 
17875     /* "View.MemoryView":1329
17876  *
17877  *
17878  *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
17879  *         transpose_memslice(&dst)
17880  *
17881  */
17882     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1329, __pyx_L1_error)
17883 
17884     /* "View.MemoryView":1330
17885  *
17886  *         transpose_memslice(&src)
17887  *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
17888  *
17889  *     refcount_copying(&dst, dtype_is_object, ndim, False)
17890  */
17891     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error)
17892 
17893     /* "View.MemoryView":1326
17894  *             return 0
17895  *
17896  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
17897  *
17898  *
17899  */
17900   }
17901 
17902   /* "View.MemoryView":1332
17903  *         transpose_memslice(&dst)
17904  *
17905  *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
17906  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
17907  *     refcount_copying(&dst, dtype_is_object, ndim, True)
17908  */
17909   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
17910 
17911   /* "View.MemoryView":1333
17912  *
17913  *     refcount_copying(&dst, dtype_is_object, ndim, False)
17914  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
17915  *     refcount_copying(&dst, dtype_is_object, ndim, True)
17916  *
17917  */
17918   copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
17919 
17920   /* "View.MemoryView":1334
17921  *     refcount_copying(&dst, dtype_is_object, ndim, False)
17922  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
17923  *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
17924  *
17925  *     free(tmpdata)
17926  */
17927   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
17928 
17929   /* "View.MemoryView":1336
17930  *     refcount_copying(&dst, dtype_is_object, ndim, True)
17931  *
17932  *     free(tmpdata)             # <<<<<<<<<<<<<<
17933  *     return 0
17934  *
17935  */
17936   free(__pyx_v_tmpdata);
17937 
17938   /* "View.MemoryView":1337
17939  *
17940  *     free(tmpdata)
17941  *     return 0             # <<<<<<<<<<<<<<
17942  *
17943  * @cname('__pyx_memoryview_broadcast_leading')
17944  */
17945   __pyx_r = 0;
17946   goto __pyx_L0;
17947 
17948   /* "View.MemoryView":1268
17949  *
17950  * @cname('__pyx_memoryview_copy_contents')
17951  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
17952  *                                   __Pyx_memviewslice dst,
17953  *                                   int src_ndim, int dst_ndim,
17954  */
17955 
17956   /* function exit code */
17957   __pyx_L1_error:;
17958   {
17959     #ifdef WITH_THREAD
17960     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17961     #endif
17962     __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
17963     #ifdef WITH_THREAD
17964     __Pyx_PyGILState_Release(__pyx_gilstate_save);
17965     #endif
17966   }
17967   __pyx_r = -1;
17968   __pyx_L0:;
17969   return __pyx_r;
17970 }
17971 
17972 /* "View.MemoryView":1340
17973  *
17974  * @cname('__pyx_memoryview_broadcast_leading')
17975  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
17976  *                             int ndim,
17977  *                             int ndim_other) nogil:
17978  */
17979 
__pyx_memoryview_broadcast_leading(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim,int __pyx_v_ndim_other)17980 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
17981   int __pyx_v_i;
17982   int __pyx_v_offset;
17983   int __pyx_t_1;
17984   int __pyx_t_2;
17985   int __pyx_t_3;
17986 
17987   /* "View.MemoryView":1344
17988  *                             int ndim_other) nogil:
17989  *     cdef int i
17990  *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
17991  *
17992  *     for i in range(ndim - 1, -1, -1):
17993  */
17994   __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
17995 
17996   /* "View.MemoryView":1346
17997  *     cdef int offset = ndim_other - ndim
17998  *
17999  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
18000  *         mslice.shape[i + offset] = mslice.shape[i]
18001  *         mslice.strides[i + offset] = mslice.strides[i]
18002  */
18003   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
18004     __pyx_v_i = __pyx_t_1;
18005 
18006     /* "View.MemoryView":1347
18007  *
18008  *     for i in range(ndim - 1, -1, -1):
18009  *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
18010  *         mslice.strides[i + offset] = mslice.strides[i]
18011  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
18012  */
18013     (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
18014 
18015     /* "View.MemoryView":1348
18016  *     for i in range(ndim - 1, -1, -1):
18017  *         mslice.shape[i + offset] = mslice.shape[i]
18018  *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
18019  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
18020  *
18021  */
18022     (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
18023 
18024     /* "View.MemoryView":1349
18025  *         mslice.shape[i + offset] = mslice.shape[i]
18026  *         mslice.strides[i + offset] = mslice.strides[i]
18027  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
18028  *
18029  *     for i in range(offset):
18030  */
18031     (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
18032   }
18033 
18034   /* "View.MemoryView":1351
18035  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
18036  *
18037  *     for i in range(offset):             # <<<<<<<<<<<<<<
18038  *         mslice.shape[i] = 1
18039  *         mslice.strides[i] = mslice.strides[0]
18040  */
18041   __pyx_t_1 = __pyx_v_offset;
18042   __pyx_t_2 = __pyx_t_1;
18043   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
18044     __pyx_v_i = __pyx_t_3;
18045 
18046     /* "View.MemoryView":1352
18047  *
18048  *     for i in range(offset):
18049  *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
18050  *         mslice.strides[i] = mslice.strides[0]
18051  *         mslice.suboffsets[i] = -1
18052  */
18053     (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
18054 
18055     /* "View.MemoryView":1353
18056  *     for i in range(offset):
18057  *         mslice.shape[i] = 1
18058  *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
18059  *         mslice.suboffsets[i] = -1
18060  *
18061  */
18062     (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
18063 
18064     /* "View.MemoryView":1354
18065  *         mslice.shape[i] = 1
18066  *         mslice.strides[i] = mslice.strides[0]
18067  *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
18068  *
18069  *
18070  */
18071     (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
18072   }
18073 
18074   /* "View.MemoryView":1340
18075  *
18076  * @cname('__pyx_memoryview_broadcast_leading')
18077  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
18078  *                             int ndim,
18079  *                             int ndim_other) nogil:
18080  */
18081 
18082   /* function exit code */
18083 }
18084 
18085 /* "View.MemoryView":1362
18086  *
18087  * @cname('__pyx_memoryview_refcount_copying')
18088  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
18089  *                            int ndim, bint inc) nogil:
18090  *
18091  */
18092 
__pyx_memoryview_refcount_copying(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_dtype_is_object,int __pyx_v_ndim,int __pyx_v_inc)18093 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) {
18094   int __pyx_t_1;
18095 
18096   /* "View.MemoryView":1366
18097  *
18098  *
18099  *     if dtype_is_object:             # <<<<<<<<<<<<<<
18100  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
18101  *                                            dst.strides, ndim, inc)
18102  */
18103   __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
18104   if (__pyx_t_1) {
18105 
18106     /* "View.MemoryView":1367
18107  *
18108  *     if dtype_is_object:
18109  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
18110  *                                            dst.strides, ndim, inc)
18111  *
18112  */
18113     __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);
18114 
18115     /* "View.MemoryView":1366
18116  *
18117  *
18118  *     if dtype_is_object:             # <<<<<<<<<<<<<<
18119  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
18120  *                                            dst.strides, ndim, inc)
18121  */
18122   }
18123 
18124   /* "View.MemoryView":1362
18125  *
18126  * @cname('__pyx_memoryview_refcount_copying')
18127  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
18128  *                            int ndim, bint inc) nogil:
18129  *
18130  */
18131 
18132   /* function exit code */
18133 }
18134 
18135 /* "View.MemoryView":1371
18136  *
18137  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
18138  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
18139  *                                              Py_ssize_t *strides, int ndim,
18140  *                                              bint inc) with gil:
18141  */
18142 
__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)18143 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) {
18144   __Pyx_RefNannyDeclarations
18145   #ifdef WITH_THREAD
18146   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18147   #endif
18148   __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
18149 
18150   /* "View.MemoryView":1374
18151  *                                              Py_ssize_t *strides, int ndim,
18152  *                                              bint inc) with gil:
18153  *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
18154  *
18155  * @cname('__pyx_memoryview_refcount_objects_in_slice')
18156  */
18157   __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
18158 
18159   /* "View.MemoryView":1371
18160  *
18161  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
18162  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
18163  *                                              Py_ssize_t *strides, int ndim,
18164  *                                              bint inc) with gil:
18165  */
18166 
18167   /* function exit code */
18168   __Pyx_RefNannyFinishContext();
18169   #ifdef WITH_THREAD
18170   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18171   #endif
18172 }
18173 
18174 /* "View.MemoryView":1377
18175  *
18176  * @cname('__pyx_memoryview_refcount_objects_in_slice')
18177  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
18178  *                                     Py_ssize_t *strides, int ndim, bint inc):
18179  *     cdef Py_ssize_t i
18180  */
18181 
__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)18182 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) {
18183   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
18184   __Pyx_RefNannyDeclarations
18185   Py_ssize_t __pyx_t_1;
18186   Py_ssize_t __pyx_t_2;
18187   Py_ssize_t __pyx_t_3;
18188   int __pyx_t_4;
18189   __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
18190 
18191   /* "View.MemoryView":1381
18192  *     cdef Py_ssize_t i
18193  *
18194  *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
18195  *         if ndim == 1:
18196  *             if inc:
18197  */
18198   __pyx_t_1 = (__pyx_v_shape[0]);
18199   __pyx_t_2 = __pyx_t_1;
18200   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
18201     __pyx_v_i = __pyx_t_3;
18202 
18203     /* "View.MemoryView":1382
18204  *
18205  *     for i in range(shape[0]):
18206  *         if ndim == 1:             # <<<<<<<<<<<<<<
18207  *             if inc:
18208  *                 Py_INCREF((<PyObject **> data)[0])
18209  */
18210     __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
18211     if (__pyx_t_4) {
18212 
18213       /* "View.MemoryView":1383
18214  *     for i in range(shape[0]):
18215  *         if ndim == 1:
18216  *             if inc:             # <<<<<<<<<<<<<<
18217  *                 Py_INCREF((<PyObject **> data)[0])
18218  *             else:
18219  */
18220       __pyx_t_4 = (__pyx_v_inc != 0);
18221       if (__pyx_t_4) {
18222 
18223         /* "View.MemoryView":1384
18224  *         if ndim == 1:
18225  *             if inc:
18226  *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
18227  *             else:
18228  *                 Py_DECREF((<PyObject **> data)[0])
18229  */
18230         Py_INCREF((((PyObject **)__pyx_v_data)[0]));
18231 
18232         /* "View.MemoryView":1383
18233  *     for i in range(shape[0]):
18234  *         if ndim == 1:
18235  *             if inc:             # <<<<<<<<<<<<<<
18236  *                 Py_INCREF((<PyObject **> data)[0])
18237  *             else:
18238  */
18239         goto __pyx_L6;
18240       }
18241 
18242       /* "View.MemoryView":1386
18243  *                 Py_INCREF((<PyObject **> data)[0])
18244  *             else:
18245  *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
18246  *         else:
18247  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
18248  */
18249       /*else*/ {
18250         Py_DECREF((((PyObject **)__pyx_v_data)[0]));
18251       }
18252       __pyx_L6:;
18253 
18254       /* "View.MemoryView":1382
18255  *
18256  *     for i in range(shape[0]):
18257  *         if ndim == 1:             # <<<<<<<<<<<<<<
18258  *             if inc:
18259  *                 Py_INCREF((<PyObject **> data)[0])
18260  */
18261       goto __pyx_L5;
18262     }
18263 
18264     /* "View.MemoryView":1388
18265  *                 Py_DECREF((<PyObject **> data)[0])
18266  *         else:
18267  *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
18268  *                                       ndim - 1, inc)
18269  *
18270  */
18271     /*else*/ {
18272 
18273       /* "View.MemoryView":1389
18274  *         else:
18275  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
18276  *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
18277  *
18278  *         data += strides[0]
18279  */
18280       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
18281     }
18282     __pyx_L5:;
18283 
18284     /* "View.MemoryView":1391
18285  *                                       ndim - 1, inc)
18286  *
18287  *         data += strides[0]             # <<<<<<<<<<<<<<
18288  *
18289  *
18290  */
18291     __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
18292   }
18293 
18294   /* "View.MemoryView":1377
18295  *
18296  * @cname('__pyx_memoryview_refcount_objects_in_slice')
18297  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
18298  *                                     Py_ssize_t *strides, int ndim, bint inc):
18299  *     cdef Py_ssize_t i
18300  */
18301 
18302   /* function exit code */
18303   __Pyx_RefNannyFinishContext();
18304 }
18305 
18306 /* "View.MemoryView":1397
18307  *
18308  * @cname('__pyx_memoryview_slice_assign_scalar')
18309  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
18310  *                               size_t itemsize, void *item,
18311  *                               bint dtype_is_object) nogil:
18312  */
18313 
__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)18314 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) {
18315 
18316   /* "View.MemoryView":1400
18317  *                               size_t itemsize, void *item,
18318  *                               bint dtype_is_object) nogil:
18319  *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
18320  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
18321  *                          itemsize, item)
18322  */
18323   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
18324 
18325   /* "View.MemoryView":1401
18326  *                               bint dtype_is_object) nogil:
18327  *     refcount_copying(dst, dtype_is_object, ndim, False)
18328  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
18329  *                          itemsize, item)
18330  *     refcount_copying(dst, dtype_is_object, ndim, True)
18331  */
18332   __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);
18333 
18334   /* "View.MemoryView":1403
18335  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
18336  *                          itemsize, item)
18337  *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
18338  *
18339  *
18340  */
18341   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
18342 
18343   /* "View.MemoryView":1397
18344  *
18345  * @cname('__pyx_memoryview_slice_assign_scalar')
18346  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
18347  *                               size_t itemsize, void *item,
18348  *                               bint dtype_is_object) nogil:
18349  */
18350 
18351   /* function exit code */
18352 }
18353 
18354 /* "View.MemoryView":1407
18355  *
18356  * @cname('__pyx_memoryview__slice_assign_scalar')
18357  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
18358  *                               Py_ssize_t *strides, int ndim,
18359  *                               size_t itemsize, void *item) nogil:
18360  */
18361 
__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)18362 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) {
18363   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
18364   Py_ssize_t __pyx_v_stride;
18365   Py_ssize_t __pyx_v_extent;
18366   int __pyx_t_1;
18367   Py_ssize_t __pyx_t_2;
18368   Py_ssize_t __pyx_t_3;
18369   Py_ssize_t __pyx_t_4;
18370 
18371   /* "View.MemoryView":1411
18372  *                               size_t itemsize, void *item) nogil:
18373  *     cdef Py_ssize_t i
18374  *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
18375  *     cdef Py_ssize_t extent = shape[0]
18376  *
18377  */
18378   __pyx_v_stride = (__pyx_v_strides[0]);
18379 
18380   /* "View.MemoryView":1412
18381  *     cdef Py_ssize_t i
18382  *     cdef Py_ssize_t stride = strides[0]
18383  *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
18384  *
18385  *     if ndim == 1:
18386  */
18387   __pyx_v_extent = (__pyx_v_shape[0]);
18388 
18389   /* "View.MemoryView":1414
18390  *     cdef Py_ssize_t extent = shape[0]
18391  *
18392  *     if ndim == 1:             # <<<<<<<<<<<<<<
18393  *         for i in range(extent):
18394  *             memcpy(data, item, itemsize)
18395  */
18396   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
18397   if (__pyx_t_1) {
18398 
18399     /* "View.MemoryView":1415
18400  *
18401  *     if ndim == 1:
18402  *         for i in range(extent):             # <<<<<<<<<<<<<<
18403  *             memcpy(data, item, itemsize)
18404  *             data += stride
18405  */
18406     __pyx_t_2 = __pyx_v_extent;
18407     __pyx_t_3 = __pyx_t_2;
18408     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18409       __pyx_v_i = __pyx_t_4;
18410 
18411       /* "View.MemoryView":1416
18412  *     if ndim == 1:
18413  *         for i in range(extent):
18414  *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
18415  *             data += stride
18416  *     else:
18417  */
18418       (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
18419 
18420       /* "View.MemoryView":1417
18421  *         for i in range(extent):
18422  *             memcpy(data, item, itemsize)
18423  *             data += stride             # <<<<<<<<<<<<<<
18424  *     else:
18425  *         for i in range(extent):
18426  */
18427       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
18428     }
18429 
18430     /* "View.MemoryView":1414
18431  *     cdef Py_ssize_t extent = shape[0]
18432  *
18433  *     if ndim == 1:             # <<<<<<<<<<<<<<
18434  *         for i in range(extent):
18435  *             memcpy(data, item, itemsize)
18436  */
18437     goto __pyx_L3;
18438   }
18439 
18440   /* "View.MemoryView":1419
18441  *             data += stride
18442  *     else:
18443  *         for i in range(extent):             # <<<<<<<<<<<<<<
18444  *             _slice_assign_scalar(data, shape + 1, strides + 1,
18445  *                                 ndim - 1, itemsize, item)
18446  */
18447   /*else*/ {
18448     __pyx_t_2 = __pyx_v_extent;
18449     __pyx_t_3 = __pyx_t_2;
18450     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18451       __pyx_v_i = __pyx_t_4;
18452 
18453       /* "View.MemoryView":1420
18454  *     else:
18455  *         for i in range(extent):
18456  *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
18457  *                                 ndim - 1, itemsize, item)
18458  *             data += stride
18459  */
18460       __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);
18461 
18462       /* "View.MemoryView":1422
18463  *             _slice_assign_scalar(data, shape + 1, strides + 1,
18464  *                                 ndim - 1, itemsize, item)
18465  *             data += stride             # <<<<<<<<<<<<<<
18466  *
18467  *
18468  */
18469       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
18470     }
18471   }
18472   __pyx_L3:;
18473 
18474   /* "View.MemoryView":1407
18475  *
18476  * @cname('__pyx_memoryview__slice_assign_scalar')
18477  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
18478  *                               Py_ssize_t *strides, int ndim,
18479  *                               size_t itemsize, void *item) nogil:
18480  */
18481 
18482   /* function exit code */
18483 }
18484 
18485 /* "(tree fragment)":1
18486  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
18487  *     cdef object __pyx_PickleError
18488  *     cdef object __pyx_result
18489  */
18490 
18491 /* Python wrapper */
18492 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18493 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)18494 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18495   PyObject *__pyx_v___pyx_type = 0;
18496   long __pyx_v___pyx_checksum;
18497   PyObject *__pyx_v___pyx_state = 0;
18498   int __pyx_lineno = 0;
18499   const char *__pyx_filename = NULL;
18500   int __pyx_clineno = 0;
18501   PyObject *__pyx_r = 0;
18502   __Pyx_RefNannyDeclarations
18503   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
18504   {
18505     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
18506     PyObject* values[3] = {0,0,0};
18507     if (unlikely(__pyx_kwds)) {
18508       Py_ssize_t kw_args;
18509       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
18510       switch (pos_args) {
18511         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18512         CYTHON_FALLTHROUGH;
18513         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18514         CYTHON_FALLTHROUGH;
18515         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18516         CYTHON_FALLTHROUGH;
18517         case  0: break;
18518         default: goto __pyx_L5_argtuple_error;
18519       }
18520       kw_args = PyDict_Size(__pyx_kwds);
18521       switch (pos_args) {
18522         case  0:
18523         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
18524         else goto __pyx_L5_argtuple_error;
18525         CYTHON_FALLTHROUGH;
18526         case  1:
18527         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
18528         else {
18529           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
18530         }
18531         CYTHON_FALLTHROUGH;
18532         case  2:
18533         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
18534         else {
18535           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
18536         }
18537       }
18538       if (unlikely(kw_args > 0)) {
18539         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
18540       }
18541     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
18542       goto __pyx_L5_argtuple_error;
18543     } else {
18544       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18545       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18546       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18547     }
18548     __pyx_v___pyx_type = values[0];
18549     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
18550     __pyx_v___pyx_state = values[2];
18551   }
18552   goto __pyx_L4_argument_unpacking_done;
18553   __pyx_L5_argtuple_error:;
18554   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
18555   __pyx_L3_error:;
18556   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
18557   __Pyx_RefNannyFinishContext();
18558   return NULL;
18559   __pyx_L4_argument_unpacking_done:;
18560   __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
18561 
18562   /* function exit code */
18563   __Pyx_RefNannyFinishContext();
18564   return __pyx_r;
18565 }
18566 
__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)18567 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) {
18568   PyObject *__pyx_v___pyx_PickleError = 0;
18569   PyObject *__pyx_v___pyx_result = 0;
18570   PyObject *__pyx_r = NULL;
18571   __Pyx_RefNannyDeclarations
18572   int __pyx_t_1;
18573   PyObject *__pyx_t_2 = NULL;
18574   PyObject *__pyx_t_3 = NULL;
18575   PyObject *__pyx_t_4 = NULL;
18576   PyObject *__pyx_t_5 = NULL;
18577   int __pyx_t_6;
18578   int __pyx_lineno = 0;
18579   const char *__pyx_filename = NULL;
18580   int __pyx_clineno = 0;
18581   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
18582 
18583   /* "(tree fragment)":4
18584  *     cdef object __pyx_PickleError
18585  *     cdef object __pyx_result
18586  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
18587  *         from pickle import PickleError as __pyx_PickleError
18588  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18589  */
18590   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
18591   if (__pyx_t_1) {
18592 
18593     /* "(tree fragment)":5
18594  *     cdef object __pyx_result
18595  *     if __pyx_checksum != 0xb068931:
18596  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
18597  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18598  *     __pyx_result = Enum.__new__(__pyx_type)
18599  */
18600     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
18601     __Pyx_GOTREF(__pyx_t_2);
18602     __Pyx_INCREF(__pyx_n_s_PickleError);
18603     __Pyx_GIVEREF(__pyx_n_s_PickleError);
18604     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
18605     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
18606     __Pyx_GOTREF(__pyx_t_3);
18607     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18608     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
18609     __Pyx_GOTREF(__pyx_t_2);
18610     __Pyx_INCREF(__pyx_t_2);
18611     __pyx_v___pyx_PickleError = __pyx_t_2;
18612     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18613     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18614 
18615     /* "(tree fragment)":6
18616  *     if __pyx_checksum != 0xb068931:
18617  *         from pickle import PickleError as __pyx_PickleError
18618  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
18619  *     __pyx_result = Enum.__new__(__pyx_type)
18620  *     if __pyx_state is not None:
18621  */
18622     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
18623     __Pyx_GOTREF(__pyx_t_2);
18624     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
18625     __Pyx_GOTREF(__pyx_t_4);
18626     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18627     __Pyx_INCREF(__pyx_v___pyx_PickleError);
18628     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
18629     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
18630       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
18631       if (likely(__pyx_t_5)) {
18632         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
18633         __Pyx_INCREF(__pyx_t_5);
18634         __Pyx_INCREF(function);
18635         __Pyx_DECREF_SET(__pyx_t_2, function);
18636       }
18637     }
18638     __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);
18639     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
18640     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18641     if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
18642     __Pyx_GOTREF(__pyx_t_3);
18643     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18644     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
18645     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18646     __PYX_ERR(2, 6, __pyx_L1_error)
18647 
18648     /* "(tree fragment)":4
18649  *     cdef object __pyx_PickleError
18650  *     cdef object __pyx_result
18651  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
18652  *         from pickle import PickleError as __pyx_PickleError
18653  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18654  */
18655   }
18656 
18657   /* "(tree fragment)":7
18658  *         from pickle import PickleError as __pyx_PickleError
18659  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18660  *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
18661  *     if __pyx_state is not None:
18662  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18663  */
18664   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error)
18665   __Pyx_GOTREF(__pyx_t_2);
18666   __pyx_t_4 = NULL;
18667   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
18668     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
18669     if (likely(__pyx_t_4)) {
18670       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
18671       __Pyx_INCREF(__pyx_t_4);
18672       __Pyx_INCREF(function);
18673       __Pyx_DECREF_SET(__pyx_t_2, function);
18674     }
18675   }
18676   __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);
18677   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
18678   if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
18679   __Pyx_GOTREF(__pyx_t_3);
18680   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18681   __pyx_v___pyx_result = __pyx_t_3;
18682   __pyx_t_3 = 0;
18683 
18684   /* "(tree fragment)":8
18685  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18686  *     __pyx_result = Enum.__new__(__pyx_type)
18687  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
18688  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18689  *     return __pyx_result
18690  */
18691   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
18692   __pyx_t_6 = (__pyx_t_1 != 0);
18693   if (__pyx_t_6) {
18694 
18695     /* "(tree fragment)":9
18696  *     __pyx_result = Enum.__new__(__pyx_type)
18697  *     if __pyx_state is not None:
18698  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
18699  *     return __pyx_result
18700  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18701  */
18702     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error)
18703     __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 9, __pyx_L1_error)
18704     __Pyx_GOTREF(__pyx_t_3);
18705     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18706 
18707     /* "(tree fragment)":8
18708  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18709  *     __pyx_result = Enum.__new__(__pyx_type)
18710  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
18711  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18712  *     return __pyx_result
18713  */
18714   }
18715 
18716   /* "(tree fragment)":10
18717  *     if __pyx_state is not None:
18718  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18719  *     return __pyx_result             # <<<<<<<<<<<<<<
18720  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18721  *     __pyx_result.name = __pyx_state[0]
18722  */
18723   __Pyx_XDECREF(__pyx_r);
18724   __Pyx_INCREF(__pyx_v___pyx_result);
18725   __pyx_r = __pyx_v___pyx_result;
18726   goto __pyx_L0;
18727 
18728   /* "(tree fragment)":1
18729  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
18730  *     cdef object __pyx_PickleError
18731  *     cdef object __pyx_result
18732  */
18733 
18734   /* function exit code */
18735   __pyx_L1_error:;
18736   __Pyx_XDECREF(__pyx_t_2);
18737   __Pyx_XDECREF(__pyx_t_3);
18738   __Pyx_XDECREF(__pyx_t_4);
18739   __Pyx_XDECREF(__pyx_t_5);
18740   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
18741   __pyx_r = NULL;
18742   __pyx_L0:;
18743   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
18744   __Pyx_XDECREF(__pyx_v___pyx_result);
18745   __Pyx_XGIVEREF(__pyx_r);
18746   __Pyx_RefNannyFinishContext();
18747   return __pyx_r;
18748 }
18749 
18750 /* "(tree fragment)":11
18751  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18752  *     return __pyx_result
18753  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
18754  *     __pyx_result.name = __pyx_state[0]
18755  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
18756  */
18757 
__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)18758 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
18759   PyObject *__pyx_r = NULL;
18760   __Pyx_RefNannyDeclarations
18761   PyObject *__pyx_t_1 = NULL;
18762   int __pyx_t_2;
18763   Py_ssize_t __pyx_t_3;
18764   int __pyx_t_4;
18765   int __pyx_t_5;
18766   PyObject *__pyx_t_6 = NULL;
18767   PyObject *__pyx_t_7 = NULL;
18768   PyObject *__pyx_t_8 = NULL;
18769   int __pyx_lineno = 0;
18770   const char *__pyx_filename = NULL;
18771   int __pyx_clineno = 0;
18772   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
18773 
18774   /* "(tree fragment)":12
18775  *     return __pyx_result
18776  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18777  *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
18778  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
18779  *         __pyx_result.__dict__.update(__pyx_state[1])
18780  */
18781   if (unlikely(__pyx_v___pyx_state == Py_None)) {
18782     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
18783     __PYX_ERR(2, 12, __pyx_L1_error)
18784   }
18785   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
18786   __Pyx_GOTREF(__pyx_t_1);
18787   __Pyx_GIVEREF(__pyx_t_1);
18788   __Pyx_GOTREF(__pyx_v___pyx_result->name);
18789   __Pyx_DECREF(__pyx_v___pyx_result->name);
18790   __pyx_v___pyx_result->name = __pyx_t_1;
18791   __pyx_t_1 = 0;
18792 
18793   /* "(tree fragment)":13
18794  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18795  *     __pyx_result.name = __pyx_state[0]
18796  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
18797  *         __pyx_result.__dict__.update(__pyx_state[1])
18798  */
18799   if (unlikely(__pyx_v___pyx_state == Py_None)) {
18800     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
18801     __PYX_ERR(2, 13, __pyx_L1_error)
18802   }
18803   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
18804   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
18805   if (__pyx_t_4) {
18806   } else {
18807     __pyx_t_2 = __pyx_t_4;
18808     goto __pyx_L4_bool_binop_done;
18809   }
18810   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
18811   __pyx_t_5 = (__pyx_t_4 != 0);
18812   __pyx_t_2 = __pyx_t_5;
18813   __pyx_L4_bool_binop_done:;
18814   if (__pyx_t_2) {
18815 
18816     /* "(tree fragment)":14
18817  *     __pyx_result.name = __pyx_state[0]
18818  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
18819  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
18820  */
18821     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
18822     __Pyx_GOTREF(__pyx_t_6);
18823     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error)
18824     __Pyx_GOTREF(__pyx_t_7);
18825     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18826     if (unlikely(__pyx_v___pyx_state == Py_None)) {
18827       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
18828       __PYX_ERR(2, 14, __pyx_L1_error)
18829     }
18830     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
18831     __Pyx_GOTREF(__pyx_t_6);
18832     __pyx_t_8 = NULL;
18833     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
18834       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
18835       if (likely(__pyx_t_8)) {
18836         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
18837         __Pyx_INCREF(__pyx_t_8);
18838         __Pyx_INCREF(function);
18839         __Pyx_DECREF_SET(__pyx_t_7, function);
18840       }
18841     }
18842     __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);
18843     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
18844     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18845     if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
18846     __Pyx_GOTREF(__pyx_t_1);
18847     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
18848     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18849 
18850     /* "(tree fragment)":13
18851  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18852  *     __pyx_result.name = __pyx_state[0]
18853  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
18854  *         __pyx_result.__dict__.update(__pyx_state[1])
18855  */
18856   }
18857 
18858   /* "(tree fragment)":11
18859  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18860  *     return __pyx_result
18861  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
18862  *     __pyx_result.name = __pyx_state[0]
18863  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
18864  */
18865 
18866   /* function exit code */
18867   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18868   goto __pyx_L0;
18869   __pyx_L1_error:;
18870   __Pyx_XDECREF(__pyx_t_1);
18871   __Pyx_XDECREF(__pyx_t_6);
18872   __Pyx_XDECREF(__pyx_t_7);
18873   __Pyx_XDECREF(__pyx_t_8);
18874   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
18875   __pyx_r = 0;
18876   __pyx_L0:;
18877   __Pyx_XGIVEREF(__pyx_r);
18878   __Pyx_RefNannyFinishContext();
18879   return __pyx_r;
18880 }
18881 static struct __pyx_vtabstruct_array __pyx_vtable_array;
18882 
__pyx_tp_new_array(PyTypeObject * t,PyObject * a,PyObject * k)18883 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
18884   struct __pyx_array_obj *p;
18885   PyObject *o;
18886   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18887     o = (*t->tp_alloc)(t, 0);
18888   } else {
18889     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18890   }
18891   if (unlikely(!o)) return 0;
18892   p = ((struct __pyx_array_obj *)o);
18893   p->__pyx_vtab = __pyx_vtabptr_array;
18894   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
18895   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
18896   if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
18897   return o;
18898   bad:
18899   Py_DECREF(o); o = 0;
18900   return NULL;
18901 }
18902 
__pyx_tp_dealloc_array(PyObject * o)18903 static void __pyx_tp_dealloc_array(PyObject *o) {
18904   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
18905   #if CYTHON_USE_TP_FINALIZE
18906   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))) {
18907     if (PyObject_CallFinalizerFromDealloc(o)) return;
18908   }
18909   #endif
18910   {
18911     PyObject *etype, *eval, *etb;
18912     PyErr_Fetch(&etype, &eval, &etb);
18913     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
18914     __pyx_array___dealloc__(o);
18915     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
18916     PyErr_Restore(etype, eval, etb);
18917   }
18918   Py_CLEAR(p->mode);
18919   Py_CLEAR(p->_format);
18920   (*Py_TYPE(o)->tp_free)(o);
18921 }
__pyx_sq_item_array(PyObject * o,Py_ssize_t i)18922 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
18923   PyObject *r;
18924   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
18925   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
18926   Py_DECREF(x);
18927   return r;
18928 }
18929 
__pyx_mp_ass_subscript_array(PyObject * o,PyObject * i,PyObject * v)18930 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
18931   if (v) {
18932     return __pyx_array___setitem__(o, i, v);
18933   }
18934   else {
18935     PyErr_Format(PyExc_NotImplementedError,
18936       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
18937     return -1;
18938   }
18939 }
18940 
__pyx_tp_getattro_array(PyObject * o,PyObject * n)18941 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
18942   PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
18943   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
18944     PyErr_Clear();
18945     v = __pyx_array___getattr__(o, n);
18946   }
18947   return v;
18948 }
18949 
__pyx_getprop___pyx_array_memview(PyObject * o,CYTHON_UNUSED void * x)18950 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
18951   return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
18952 }
18953 
18954 static PyMethodDef __pyx_methods_array[] = {
18955   {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
18956   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
18957   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
18958   {0, 0, 0, 0}
18959 };
18960 
18961 static struct PyGetSetDef __pyx_getsets_array[] = {
18962   {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
18963   {0, 0, 0, 0, 0}
18964 };
18965 
18966 static PySequenceMethods __pyx_tp_as_sequence_array = {
18967   __pyx_array___len__, /*sq_length*/
18968   0, /*sq_concat*/
18969   0, /*sq_repeat*/
18970   __pyx_sq_item_array, /*sq_item*/
18971   0, /*sq_slice*/
18972   0, /*sq_ass_item*/
18973   0, /*sq_ass_slice*/
18974   0, /*sq_contains*/
18975   0, /*sq_inplace_concat*/
18976   0, /*sq_inplace_repeat*/
18977 };
18978 
18979 static PyMappingMethods __pyx_tp_as_mapping_array = {
18980   __pyx_array___len__, /*mp_length*/
18981   __pyx_array___getitem__, /*mp_subscript*/
18982   __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
18983 };
18984 
18985 static PyBufferProcs __pyx_tp_as_buffer_array = {
18986   #if PY_MAJOR_VERSION < 3
18987   0, /*bf_getreadbuffer*/
18988   #endif
18989   #if PY_MAJOR_VERSION < 3
18990   0, /*bf_getwritebuffer*/
18991   #endif
18992   #if PY_MAJOR_VERSION < 3
18993   0, /*bf_getsegcount*/
18994   #endif
18995   #if PY_MAJOR_VERSION < 3
18996   0, /*bf_getcharbuffer*/
18997   #endif
18998   __pyx_array_getbuffer, /*bf_getbuffer*/
18999   0, /*bf_releasebuffer*/
19000 };
19001 
19002 static PyTypeObject __pyx_type___pyx_array = {
19003   PyVarObject_HEAD_INIT(0, 0)
19004   "pymatgen.optimization.linear_assignment.array", /*tp_name*/
19005   sizeof(struct __pyx_array_obj), /*tp_basicsize*/
19006   0, /*tp_itemsize*/
19007   __pyx_tp_dealloc_array, /*tp_dealloc*/
19008   #if PY_VERSION_HEX < 0x030800b4
19009   0, /*tp_print*/
19010   #endif
19011   #if PY_VERSION_HEX >= 0x030800b4
19012   0, /*tp_vectorcall_offset*/
19013   #endif
19014   0, /*tp_getattr*/
19015   0, /*tp_setattr*/
19016   #if PY_MAJOR_VERSION < 3
19017   0, /*tp_compare*/
19018   #endif
19019   #if PY_MAJOR_VERSION >= 3
19020   0, /*tp_as_async*/
19021   #endif
19022   0, /*tp_repr*/
19023   0, /*tp_as_number*/
19024   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
19025   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
19026   0, /*tp_hash*/
19027   0, /*tp_call*/
19028   0, /*tp_str*/
19029   __pyx_tp_getattro_array, /*tp_getattro*/
19030   0, /*tp_setattro*/
19031   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
19032   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
19033   0, /*tp_doc*/
19034   0, /*tp_traverse*/
19035   0, /*tp_clear*/
19036   0, /*tp_richcompare*/
19037   0, /*tp_weaklistoffset*/
19038   0, /*tp_iter*/
19039   0, /*tp_iternext*/
19040   __pyx_methods_array, /*tp_methods*/
19041   0, /*tp_members*/
19042   __pyx_getsets_array, /*tp_getset*/
19043   0, /*tp_base*/
19044   0, /*tp_dict*/
19045   0, /*tp_descr_get*/
19046   0, /*tp_descr_set*/
19047   0, /*tp_dictoffset*/
19048   0, /*tp_init*/
19049   0, /*tp_alloc*/
19050   __pyx_tp_new_array, /*tp_new*/
19051   0, /*tp_free*/
19052   0, /*tp_is_gc*/
19053   0, /*tp_bases*/
19054   0, /*tp_mro*/
19055   0, /*tp_cache*/
19056   0, /*tp_subclasses*/
19057   0, /*tp_weaklist*/
19058   0, /*tp_del*/
19059   0, /*tp_version_tag*/
19060   #if PY_VERSION_HEX >= 0x030400a1
19061   0, /*tp_finalize*/
19062   #endif
19063   #if PY_VERSION_HEX >= 0x030800b1
19064   0, /*tp_vectorcall*/
19065   #endif
19066   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
19067   0, /*tp_print*/
19068   #endif
19069 };
19070 
__pyx_tp_new_Enum(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)19071 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
19072   struct __pyx_MemviewEnum_obj *p;
19073   PyObject *o;
19074   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
19075     o = (*t->tp_alloc)(t, 0);
19076   } else {
19077     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
19078   }
19079   if (unlikely(!o)) return 0;
19080   p = ((struct __pyx_MemviewEnum_obj *)o);
19081   p->name = Py_None; Py_INCREF(Py_None);
19082   return o;
19083 }
19084 
__pyx_tp_dealloc_Enum(PyObject * o)19085 static void __pyx_tp_dealloc_Enum(PyObject *o) {
19086   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
19087   #if CYTHON_USE_TP_FINALIZE
19088   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
19089     if (PyObject_CallFinalizerFromDealloc(o)) return;
19090   }
19091   #endif
19092   PyObject_GC_UnTrack(o);
19093   Py_CLEAR(p->name);
19094   (*Py_TYPE(o)->tp_free)(o);
19095 }
19096 
__pyx_tp_traverse_Enum(PyObject * o,visitproc v,void * a)19097 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
19098   int e;
19099   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
19100   if (p->name) {
19101     e = (*v)(p->name, a); if (e) return e;
19102   }
19103   return 0;
19104 }
19105 
__pyx_tp_clear_Enum(PyObject * o)19106 static int __pyx_tp_clear_Enum(PyObject *o) {
19107   PyObject* tmp;
19108   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
19109   tmp = ((PyObject*)p->name);
19110   p->name = Py_None; Py_INCREF(Py_None);
19111   Py_XDECREF(tmp);
19112   return 0;
19113 }
19114 
19115 static PyMethodDef __pyx_methods_Enum[] = {
19116   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
19117   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
19118   {0, 0, 0, 0}
19119 };
19120 
19121 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
19122   PyVarObject_HEAD_INIT(0, 0)
19123   "pymatgen.optimization.linear_assignment.Enum", /*tp_name*/
19124   sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
19125   0, /*tp_itemsize*/
19126   __pyx_tp_dealloc_Enum, /*tp_dealloc*/
19127   #if PY_VERSION_HEX < 0x030800b4
19128   0, /*tp_print*/
19129   #endif
19130   #if PY_VERSION_HEX >= 0x030800b4
19131   0, /*tp_vectorcall_offset*/
19132   #endif
19133   0, /*tp_getattr*/
19134   0, /*tp_setattr*/
19135   #if PY_MAJOR_VERSION < 3
19136   0, /*tp_compare*/
19137   #endif
19138   #if PY_MAJOR_VERSION >= 3
19139   0, /*tp_as_async*/
19140   #endif
19141   __pyx_MemviewEnum___repr__, /*tp_repr*/
19142   0, /*tp_as_number*/
19143   0, /*tp_as_sequence*/
19144   0, /*tp_as_mapping*/
19145   0, /*tp_hash*/
19146   0, /*tp_call*/
19147   0, /*tp_str*/
19148   0, /*tp_getattro*/
19149   0, /*tp_setattro*/
19150   0, /*tp_as_buffer*/
19151   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
19152   0, /*tp_doc*/
19153   __pyx_tp_traverse_Enum, /*tp_traverse*/
19154   __pyx_tp_clear_Enum, /*tp_clear*/
19155   0, /*tp_richcompare*/
19156   0, /*tp_weaklistoffset*/
19157   0, /*tp_iter*/
19158   0, /*tp_iternext*/
19159   __pyx_methods_Enum, /*tp_methods*/
19160   0, /*tp_members*/
19161   0, /*tp_getset*/
19162   0, /*tp_base*/
19163   0, /*tp_dict*/
19164   0, /*tp_descr_get*/
19165   0, /*tp_descr_set*/
19166   0, /*tp_dictoffset*/
19167   __pyx_MemviewEnum___init__, /*tp_init*/
19168   0, /*tp_alloc*/
19169   __pyx_tp_new_Enum, /*tp_new*/
19170   0, /*tp_free*/
19171   0, /*tp_is_gc*/
19172   0, /*tp_bases*/
19173   0, /*tp_mro*/
19174   0, /*tp_cache*/
19175   0, /*tp_subclasses*/
19176   0, /*tp_weaklist*/
19177   0, /*tp_del*/
19178   0, /*tp_version_tag*/
19179   #if PY_VERSION_HEX >= 0x030400a1
19180   0, /*tp_finalize*/
19181   #endif
19182   #if PY_VERSION_HEX >= 0x030800b1
19183   0, /*tp_vectorcall*/
19184   #endif
19185   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
19186   0, /*tp_print*/
19187   #endif
19188 };
19189 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
19190 
__pyx_tp_new_memoryview(PyTypeObject * t,PyObject * a,PyObject * k)19191 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
19192   struct __pyx_memoryview_obj *p;
19193   PyObject *o;
19194   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
19195     o = (*t->tp_alloc)(t, 0);
19196   } else {
19197     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
19198   }
19199   if (unlikely(!o)) return 0;
19200   p = ((struct __pyx_memoryview_obj *)o);
19201   p->__pyx_vtab = __pyx_vtabptr_memoryview;
19202   p->obj = Py_None; Py_INCREF(Py_None);
19203   p->_size = Py_None; Py_INCREF(Py_None);
19204   p->_array_interface = Py_None; Py_INCREF(Py_None);
19205   p->view.obj = NULL;
19206   if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
19207   return o;
19208   bad:
19209   Py_DECREF(o); o = 0;
19210   return NULL;
19211 }
19212 
__pyx_tp_dealloc_memoryview(PyObject * o)19213 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
19214   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
19215   #if CYTHON_USE_TP_FINALIZE
19216   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
19217     if (PyObject_CallFinalizerFromDealloc(o)) return;
19218   }
19219   #endif
19220   PyObject_GC_UnTrack(o);
19221   {
19222     PyObject *etype, *eval, *etb;
19223     PyErr_Fetch(&etype, &eval, &etb);
19224     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
19225     __pyx_memoryview___dealloc__(o);
19226     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
19227     PyErr_Restore(etype, eval, etb);
19228   }
19229   Py_CLEAR(p->obj);
19230   Py_CLEAR(p->_size);
19231   Py_CLEAR(p->_array_interface);
19232   (*Py_TYPE(o)->tp_free)(o);
19233 }
19234 
__pyx_tp_traverse_memoryview(PyObject * o,visitproc v,void * a)19235 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
19236   int e;
19237   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
19238   if (p->obj) {
19239     e = (*v)(p->obj, a); if (e) return e;
19240   }
19241   if (p->_size) {
19242     e = (*v)(p->_size, a); if (e) return e;
19243   }
19244   if (p->_array_interface) {
19245     e = (*v)(p->_array_interface, a); if (e) return e;
19246   }
19247   if (p->view.obj) {
19248     e = (*v)(p->view.obj, a); if (e) return e;
19249   }
19250   return 0;
19251 }
19252 
__pyx_tp_clear_memoryview(PyObject * o)19253 static int __pyx_tp_clear_memoryview(PyObject *o) {
19254   PyObject* tmp;
19255   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
19256   tmp = ((PyObject*)p->obj);
19257   p->obj = Py_None; Py_INCREF(Py_None);
19258   Py_XDECREF(tmp);
19259   tmp = ((PyObject*)p->_size);
19260   p->_size = Py_None; Py_INCREF(Py_None);
19261   Py_XDECREF(tmp);
19262   tmp = ((PyObject*)p->_array_interface);
19263   p->_array_interface = Py_None; Py_INCREF(Py_None);
19264   Py_XDECREF(tmp);
19265   Py_CLEAR(p->view.obj);
19266   return 0;
19267 }
__pyx_sq_item_memoryview(PyObject * o,Py_ssize_t i)19268 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
19269   PyObject *r;
19270   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
19271   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
19272   Py_DECREF(x);
19273   return r;
19274 }
19275 
__pyx_mp_ass_subscript_memoryview(PyObject * o,PyObject * i,PyObject * v)19276 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
19277   if (v) {
19278     return __pyx_memoryview___setitem__(o, i, v);
19279   }
19280   else {
19281     PyErr_Format(PyExc_NotImplementedError,
19282       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
19283     return -1;
19284   }
19285 }
19286 
__pyx_getprop___pyx_memoryview_T(PyObject * o,CYTHON_UNUSED void * x)19287 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
19288   return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
19289 }
19290 
__pyx_getprop___pyx_memoryview_base(PyObject * o,CYTHON_UNUSED void * x)19291 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
19292   return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
19293 }
19294 
__pyx_getprop___pyx_memoryview_shape(PyObject * o,CYTHON_UNUSED void * x)19295 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
19296   return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
19297 }
19298 
__pyx_getprop___pyx_memoryview_strides(PyObject * o,CYTHON_UNUSED void * x)19299 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
19300   return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
19301 }
19302 
__pyx_getprop___pyx_memoryview_suboffsets(PyObject * o,CYTHON_UNUSED void * x)19303 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
19304   return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
19305 }
19306 
__pyx_getprop___pyx_memoryview_ndim(PyObject * o,CYTHON_UNUSED void * x)19307 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
19308   return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
19309 }
19310 
__pyx_getprop___pyx_memoryview_itemsize(PyObject * o,CYTHON_UNUSED void * x)19311 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
19312   return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
19313 }
19314 
__pyx_getprop___pyx_memoryview_nbytes(PyObject * o,CYTHON_UNUSED void * x)19315 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
19316   return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
19317 }
19318 
__pyx_getprop___pyx_memoryview_size(PyObject * o,CYTHON_UNUSED void * x)19319 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
19320   return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
19321 }
19322 
19323 static PyMethodDef __pyx_methods_memoryview[] = {
19324   {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
19325   {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
19326   {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
19327   {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
19328   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
19329   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
19330   {0, 0, 0, 0}
19331 };
19332 
19333 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
19334   {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
19335   {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
19336   {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
19337   {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
19338   {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
19339   {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
19340   {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
19341   {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
19342   {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
19343   {0, 0, 0, 0, 0}
19344 };
19345 
19346 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
19347   __pyx_memoryview___len__, /*sq_length*/
19348   0, /*sq_concat*/
19349   0, /*sq_repeat*/
19350   __pyx_sq_item_memoryview, /*sq_item*/
19351   0, /*sq_slice*/
19352   0, /*sq_ass_item*/
19353   0, /*sq_ass_slice*/
19354   0, /*sq_contains*/
19355   0, /*sq_inplace_concat*/
19356   0, /*sq_inplace_repeat*/
19357 };
19358 
19359 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
19360   __pyx_memoryview___len__, /*mp_length*/
19361   __pyx_memoryview___getitem__, /*mp_subscript*/
19362   __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
19363 };
19364 
19365 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
19366   #if PY_MAJOR_VERSION < 3
19367   0, /*bf_getreadbuffer*/
19368   #endif
19369   #if PY_MAJOR_VERSION < 3
19370   0, /*bf_getwritebuffer*/
19371   #endif
19372   #if PY_MAJOR_VERSION < 3
19373   0, /*bf_getsegcount*/
19374   #endif
19375   #if PY_MAJOR_VERSION < 3
19376   0, /*bf_getcharbuffer*/
19377   #endif
19378   __pyx_memoryview_getbuffer, /*bf_getbuffer*/
19379   0, /*bf_releasebuffer*/
19380 };
19381 
19382 static PyTypeObject __pyx_type___pyx_memoryview = {
19383   PyVarObject_HEAD_INIT(0, 0)
19384   "pymatgen.optimization.linear_assignment.memoryview", /*tp_name*/
19385   sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
19386   0, /*tp_itemsize*/
19387   __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
19388   #if PY_VERSION_HEX < 0x030800b4
19389   0, /*tp_print*/
19390   #endif
19391   #if PY_VERSION_HEX >= 0x030800b4
19392   0, /*tp_vectorcall_offset*/
19393   #endif
19394   0, /*tp_getattr*/
19395   0, /*tp_setattr*/
19396   #if PY_MAJOR_VERSION < 3
19397   0, /*tp_compare*/
19398   #endif
19399   #if PY_MAJOR_VERSION >= 3
19400   0, /*tp_as_async*/
19401   #endif
19402   __pyx_memoryview___repr__, /*tp_repr*/
19403   0, /*tp_as_number*/
19404   &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
19405   &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
19406   0, /*tp_hash*/
19407   0, /*tp_call*/
19408   __pyx_memoryview___str__, /*tp_str*/
19409   0, /*tp_getattro*/
19410   0, /*tp_setattro*/
19411   &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
19412   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
19413   0, /*tp_doc*/
19414   __pyx_tp_traverse_memoryview, /*tp_traverse*/
19415   __pyx_tp_clear_memoryview, /*tp_clear*/
19416   0, /*tp_richcompare*/
19417   0, /*tp_weaklistoffset*/
19418   0, /*tp_iter*/
19419   0, /*tp_iternext*/
19420   __pyx_methods_memoryview, /*tp_methods*/
19421   0, /*tp_members*/
19422   __pyx_getsets_memoryview, /*tp_getset*/
19423   0, /*tp_base*/
19424   0, /*tp_dict*/
19425   0, /*tp_descr_get*/
19426   0, /*tp_descr_set*/
19427   0, /*tp_dictoffset*/
19428   0, /*tp_init*/
19429   0, /*tp_alloc*/
19430   __pyx_tp_new_memoryview, /*tp_new*/
19431   0, /*tp_free*/
19432   0, /*tp_is_gc*/
19433   0, /*tp_bases*/
19434   0, /*tp_mro*/
19435   0, /*tp_cache*/
19436   0, /*tp_subclasses*/
19437   0, /*tp_weaklist*/
19438   0, /*tp_del*/
19439   0, /*tp_version_tag*/
19440   #if PY_VERSION_HEX >= 0x030400a1
19441   0, /*tp_finalize*/
19442   #endif
19443   #if PY_VERSION_HEX >= 0x030800b1
19444   0, /*tp_vectorcall*/
19445   #endif
19446   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
19447   0, /*tp_print*/
19448   #endif
19449 };
19450 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
19451 
__pyx_tp_new__memoryviewslice(PyTypeObject * t,PyObject * a,PyObject * k)19452 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
19453   struct __pyx_memoryviewslice_obj *p;
19454   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
19455   if (unlikely(!o)) return 0;
19456   p = ((struct __pyx_memoryviewslice_obj *)o);
19457   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
19458   p->from_object = Py_None; Py_INCREF(Py_None);
19459   p->from_slice.memview = NULL;
19460   return o;
19461 }
19462 
__pyx_tp_dealloc__memoryviewslice(PyObject * o)19463 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
19464   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
19465   #if CYTHON_USE_TP_FINALIZE
19466   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
19467     if (PyObject_CallFinalizerFromDealloc(o)) return;
19468   }
19469   #endif
19470   PyObject_GC_UnTrack(o);
19471   {
19472     PyObject *etype, *eval, *etb;
19473     PyErr_Fetch(&etype, &eval, &etb);
19474     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
19475     __pyx_memoryviewslice___dealloc__(o);
19476     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
19477     PyErr_Restore(etype, eval, etb);
19478   }
19479   Py_CLEAR(p->from_object);
19480   PyObject_GC_Track(o);
19481   __pyx_tp_dealloc_memoryview(o);
19482 }
19483 
__pyx_tp_traverse__memoryviewslice(PyObject * o,visitproc v,void * a)19484 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
19485   int e;
19486   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
19487   e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
19488   if (p->from_object) {
19489     e = (*v)(p->from_object, a); if (e) return e;
19490   }
19491   return 0;
19492 }
19493 
__pyx_tp_clear__memoryviewslice(PyObject * o)19494 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
19495   PyObject* tmp;
19496   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
19497   __pyx_tp_clear_memoryview(o);
19498   tmp = ((PyObject*)p->from_object);
19499   p->from_object = Py_None; Py_INCREF(Py_None);
19500   Py_XDECREF(tmp);
19501   __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
19502   return 0;
19503 }
19504 
__pyx_getprop___pyx_memoryviewslice_base(PyObject * o,CYTHON_UNUSED void * x)19505 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
19506   return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
19507 }
19508 
19509 static PyMethodDef __pyx_methods__memoryviewslice[] = {
19510   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
19511   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
19512   {0, 0, 0, 0}
19513 };
19514 
19515 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
19516   {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
19517   {0, 0, 0, 0, 0}
19518 };
19519 
19520 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
19521   PyVarObject_HEAD_INIT(0, 0)
19522   "pymatgen.optimization.linear_assignment._memoryviewslice", /*tp_name*/
19523   sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
19524   0, /*tp_itemsize*/
19525   __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
19526   #if PY_VERSION_HEX < 0x030800b4
19527   0, /*tp_print*/
19528   #endif
19529   #if PY_VERSION_HEX >= 0x030800b4
19530   0, /*tp_vectorcall_offset*/
19531   #endif
19532   0, /*tp_getattr*/
19533   0, /*tp_setattr*/
19534   #if PY_MAJOR_VERSION < 3
19535   0, /*tp_compare*/
19536   #endif
19537   #if PY_MAJOR_VERSION >= 3
19538   0, /*tp_as_async*/
19539   #endif
19540   #if CYTHON_COMPILING_IN_PYPY
19541   __pyx_memoryview___repr__, /*tp_repr*/
19542   #else
19543   0, /*tp_repr*/
19544   #endif
19545   0, /*tp_as_number*/
19546   0, /*tp_as_sequence*/
19547   0, /*tp_as_mapping*/
19548   0, /*tp_hash*/
19549   0, /*tp_call*/
19550   #if CYTHON_COMPILING_IN_PYPY
19551   __pyx_memoryview___str__, /*tp_str*/
19552   #else
19553   0, /*tp_str*/
19554   #endif
19555   0, /*tp_getattro*/
19556   0, /*tp_setattro*/
19557   0, /*tp_as_buffer*/
19558   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
19559   "Internal class for passing memoryview slices to Python", /*tp_doc*/
19560   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
19561   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
19562   0, /*tp_richcompare*/
19563   0, /*tp_weaklistoffset*/
19564   0, /*tp_iter*/
19565   0, /*tp_iternext*/
19566   __pyx_methods__memoryviewslice, /*tp_methods*/
19567   0, /*tp_members*/
19568   __pyx_getsets__memoryviewslice, /*tp_getset*/
19569   0, /*tp_base*/
19570   0, /*tp_dict*/
19571   0, /*tp_descr_get*/
19572   0, /*tp_descr_set*/
19573   0, /*tp_dictoffset*/
19574   0, /*tp_init*/
19575   0, /*tp_alloc*/
19576   __pyx_tp_new__memoryviewslice, /*tp_new*/
19577   0, /*tp_free*/
19578   0, /*tp_is_gc*/
19579   0, /*tp_bases*/
19580   0, /*tp_mro*/
19581   0, /*tp_cache*/
19582   0, /*tp_subclasses*/
19583   0, /*tp_weaklist*/
19584   0, /*tp_del*/
19585   0, /*tp_version_tag*/
19586   #if PY_VERSION_HEX >= 0x030400a1
19587   0, /*tp_finalize*/
19588   #endif
19589   #if PY_VERSION_HEX >= 0x030800b1
19590   0, /*tp_vectorcall*/
19591   #endif
19592   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
19593   0, /*tp_print*/
19594   #endif
19595 };
19596 
19597 static PyMethodDef __pyx_methods[] = {
19598   {0, 0, 0, 0}
19599 };
19600 
19601 #if PY_MAJOR_VERSION >= 3
19602 #if CYTHON_PEP489_MULTI_PHASE_INIT
19603 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
19604 static int __pyx_pymod_exec_linear_assignment(PyObject* module); /*proto*/
19605 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
19606   {Py_mod_create, (void*)__pyx_pymod_create},
19607   {Py_mod_exec, (void*)__pyx_pymod_exec_linear_assignment},
19608   {0, NULL}
19609 };
19610 #endif
19611 
19612 static struct PyModuleDef __pyx_moduledef = {
19613     PyModuleDef_HEAD_INIT,
19614     "linear_assignment",
19615     0, /* m_doc */
19616   #if CYTHON_PEP489_MULTI_PHASE_INIT
19617     0, /* m_size */
19618   #else
19619     -1, /* m_size */
19620   #endif
19621     __pyx_methods /* m_methods */,
19622   #if CYTHON_PEP489_MULTI_PHASE_INIT
19623     __pyx_moduledef_slots, /* m_slots */
19624   #else
19625     NULL, /* m_reload */
19626   #endif
19627     NULL, /* m_traverse */
19628     NULL, /* m_clear */
19629     NULL /* m_free */
19630 };
19631 #endif
19632 #ifndef CYTHON_SMALL_CODE
19633 #if defined(__clang__)
19634     #define CYTHON_SMALL_CODE
19635 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
19636     #define CYTHON_SMALL_CODE __attribute__((cold))
19637 #else
19638     #define CYTHON_SMALL_CODE
19639 #endif
19640 #endif
19641 
19642 static __Pyx_StringTabEntry __pyx_string_tab[] = {
19643   {&__pyx_kp_u_1_0, __pyx_k_1_0, sizeof(__pyx_k_1_0), 0, 1, 0, 0},
19644   {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
19645   {&__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},
19646   {&__pyx_n_u_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 1, 0, 1},
19647   {&__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},
19648   {&__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},
19649   {&__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},
19650   {&__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},
19651   {&__pyx_kp_u_Copyright_2011_The_Materials_Pro, __pyx_k_Copyright_2011_The_Materials_Pro, sizeof(__pyx_k_Copyright_2011_The_Materials_Pro), 0, 1, 0, 0},
19652   {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
19653   {&__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},
19654   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
19655   {&__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},
19656   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
19657   {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
19658   {&__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},
19659   {&__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},
19660   {&__pyx_kp_u_Jan_28_2013, __pyx_k_Jan_28_2013, sizeof(__pyx_k_Jan_28_2013), 0, 1, 0, 0},
19661   {&__pyx_n_s_LinearAssignment, __pyx_k_LinearAssignment, sizeof(__pyx_k_LinearAssignment), 0, 0, 1, 1},
19662   {&__pyx_n_s_LinearAssignment___init, __pyx_k_LinearAssignment___init, sizeof(__pyx_k_LinearAssignment___init), 0, 0, 1, 1},
19663   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
19664   {&__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},
19665   {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
19666   {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
19667   {&__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},
19668   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
19669   {&__pyx_kp_s_This_class_finds_the_solution_t, __pyx_k_This_class_finds_the_solution_t, sizeof(__pyx_k_This_class_finds_the_solution_t), 0, 0, 1, 0},
19670   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
19671   {&__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},
19672   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
19673   {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
19674   {&__pyx_kp_u_Will_Richards, __pyx_k_Will_Richards, sizeof(__pyx_k_Will_Richards), 0, 1, 0, 0},
19675   {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
19676   {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
19677   {&__pyx_n_s_author, __pyx_k_author, sizeof(__pyx_k_author), 0, 0, 1, 1},
19678   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
19679   {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
19680   {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
19681   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
19682   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
19683   {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
19684   {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
19685   {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
19686   {&__pyx_n_s_copyright, __pyx_k_copyright, sizeof(__pyx_k_copyright), 0, 0, 1, 1},
19687   {&__pyx_kp_u_cost_matrix_must_have_at_least_a, __pyx_k_cost_matrix_must_have_at_least_a, sizeof(__pyx_k_cost_matrix_must_have_at_least_a), 0, 1, 0, 0},
19688   {&__pyx_n_s_costs, __pyx_k_costs, sizeof(__pyx_k_costs), 0, 0, 1, 1},
19689   {&__pyx_n_s_date, __pyx_k_date, sizeof(__pyx_k_date), 0, 0, 1, 1},
19690   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
19691   {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
19692   {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
19693   {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
19694   {&__pyx_n_s_email, __pyx_k_email, sizeof(__pyx_k_email), 0, 0, 1, 1},
19695   {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
19696   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
19697   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
19698   {&__pyx_n_s_epsilon, __pyx_k_epsilon, sizeof(__pyx_k_epsilon), 0, 0, 1, 1},
19699   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
19700   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
19701   {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1},
19702   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
19703   {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
19704   {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
19705   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
19706   {&__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},
19707   {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
19708   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
19709   {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
19710   {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1},
19711   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
19712   {&__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},
19713   {&__pyx_kp_s_linear_assignment_pyx, __pyx_k_linear_assignment_pyx, sizeof(__pyx_k_linear_assignment_pyx), 0, 0, 1, 0},
19714   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
19715   {&__pyx_n_s_maintainer, __pyx_k_maintainer, sizeof(__pyx_k_maintainer), 0, 0, 1, 1},
19716   {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
19717   {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
19718   {&__pyx_n_s_min_cost, __pyx_k_min_cost, sizeof(__pyx_k_min_cost), 0, 0, 1, 1},
19719   {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
19720   {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
19721   {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
19722   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
19723   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
19724   {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
19725   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
19726   {&__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},
19727   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
19728   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
19729   {&__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},
19730   {&__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},
19731   {&__pyx_n_s_nx, __pyx_k_nx, sizeof(__pyx_k_nx), 0, 0, 1, 1},
19732   {&__pyx_n_s_ny, __pyx_k_ny, sizeof(__pyx_k_ny), 0, 0, 1, 1},
19733   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
19734   {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1},
19735   {&__pyx_n_s_orig_c, __pyx_k_orig_c, sizeof(__pyx_k_orig_c), 0, 0, 1, 1},
19736   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
19737   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
19738   {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
19739   {&__pyx_n_s_pymatgen_optimization_linear_ass, __pyx_k_pymatgen_optimization_linear_ass, sizeof(__pyx_k_pymatgen_optimization_linear_ass), 0, 0, 1, 1},
19740   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
19741   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
19742   {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
19743   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
19744   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
19745   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
19746   {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
19747   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
19748   {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
19749   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
19750   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
19751   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
19752   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
19753   {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
19754   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
19755   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
19756   {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
19757   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
19758   {&__pyx_n_s_solution, __pyx_k_solution, sizeof(__pyx_k_solution), 0, 0, 1, 1},
19759   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
19760   {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
19761   {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
19762   {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
19763   {&__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},
19764   {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
19765   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
19766   {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
19767   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
19768   {&__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},
19769   {&__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},
19770   {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
19771   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
19772   {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
19773   {&__pyx_kp_u_wrichards_mit_edu, __pyx_k_wrichards_mit_edu, sizeof(__pyx_k_wrichards_mit_edu), 0, 1, 0, 0},
19774   {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
19775   {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
19776   {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
19777   {0, 0, 0, 0, 0, 0, 0}
19778 };
__Pyx_InitCachedBuiltins(void)19779 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
19780   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 63, __pyx_L1_error)
19781   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 94, __pyx_L1_error)
19782   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 884, __pyx_L1_error)
19783   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error)
19784   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 151, __pyx_L1_error)
19785   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
19786   __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error)
19787   __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error)
19788   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error)
19789   return 0;
19790   __pyx_L1_error:;
19791   return -1;
19792 }
19793 
__Pyx_InitCachedConstants(void)19794 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
19795   __Pyx_RefNannyDeclarations
19796   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
19797 
19798   /* "pymatgen/optimization/linear_assignment.pyx":63
19799  *         #check that cost matrix is square
19800  *         if self.nx > self.ny:
19801  *             raise ValueError("cost matrix must have at least as many columns as rows")             # <<<<<<<<<<<<<<
19802  *
19803  *         if self.nx == self.ny:
19804  */
19805   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_cost_matrix_must_have_at_least_a); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 63, __pyx_L1_error)
19806   __Pyx_GOTREF(__pyx_tuple_);
19807   __Pyx_GIVEREF(__pyx_tuple_);
19808 
19809   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":884
19810  *         __pyx_import_array()
19811  *     except Exception:
19812  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
19813  *
19814  * cdef inline int import_umath() except -1:
19815  */
19816   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 884, __pyx_L1_error)
19817   __Pyx_GOTREF(__pyx_tuple__2);
19818   __Pyx_GIVEREF(__pyx_tuple__2);
19819 
19820   /* "../../../../opt/miniconda3/envs/mavrl/lib/python3.9/site-packages/numpy/__init__.pxd":890
19821  *         _import_umath()
19822  *     except Exception:
19823  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
19824  *
19825  * cdef inline int import_ufunc() except -1:
19826  */
19827   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 890, __pyx_L1_error)
19828   __Pyx_GOTREF(__pyx_tuple__3);
19829   __Pyx_GIVEREF(__pyx_tuple__3);
19830 
19831   /* "View.MemoryView":133
19832  *
19833  *         if not self.ndim:
19834  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
19835  *
19836  *         if itemsize <= 0:
19837  */
19838   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 133, __pyx_L1_error)
19839   __Pyx_GOTREF(__pyx_tuple__4);
19840   __Pyx_GIVEREF(__pyx_tuple__4);
19841 
19842   /* "View.MemoryView":136
19843  *
19844  *         if itemsize <= 0:
19845  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
19846  *
19847  *         if not isinstance(format, bytes):
19848  */
19849   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 136, __pyx_L1_error)
19850   __Pyx_GOTREF(__pyx_tuple__5);
19851   __Pyx_GIVEREF(__pyx_tuple__5);
19852 
19853   /* "View.MemoryView":148
19854  *
19855  *         if not self._shape:
19856  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
19857  *
19858  *
19859  */
19860   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 148, __pyx_L1_error)
19861   __Pyx_GOTREF(__pyx_tuple__6);
19862   __Pyx_GIVEREF(__pyx_tuple__6);
19863 
19864   /* "View.MemoryView":176
19865  *             self.data = <char *>malloc(self.len)
19866  *             if not self.data:
19867  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
19868  *
19869  *             if self.dtype_is_object:
19870  */
19871   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 176, __pyx_L1_error)
19872   __Pyx_GOTREF(__pyx_tuple__7);
19873   __Pyx_GIVEREF(__pyx_tuple__7);
19874 
19875   /* "View.MemoryView":192
19876  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
19877  *         if not (flags & bufmode):
19878  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
19879  *         info.buf = self.data
19880  *         info.len = self.len
19881  */
19882   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 192, __pyx_L1_error)
19883   __Pyx_GOTREF(__pyx_tuple__8);
19884   __Pyx_GIVEREF(__pyx_tuple__8);
19885 
19886   /* "(tree fragment)":2
19887  * def __reduce_cython__(self):
19888  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
19889  * def __setstate_cython__(self, __pyx_state):
19890  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19891  */
19892   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 2, __pyx_L1_error)
19893   __Pyx_GOTREF(__pyx_tuple__9);
19894   __Pyx_GIVEREF(__pyx_tuple__9);
19895 
19896   /* "(tree fragment)":4
19897  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19898  * def __setstate_cython__(self, __pyx_state):
19899  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
19900  */
19901   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 4, __pyx_L1_error)
19902   __Pyx_GOTREF(__pyx_tuple__10);
19903   __Pyx_GIVEREF(__pyx_tuple__10);
19904 
19905   /* "View.MemoryView":418
19906  *     def __setitem__(memoryview self, object index, object value):
19907  *         if self.view.readonly:
19908  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
19909  *
19910  *         have_slices, index = _unellipsify(index, self.view.ndim)
19911  */
19912   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 418, __pyx_L1_error)
19913   __Pyx_GOTREF(__pyx_tuple__11);
19914   __Pyx_GIVEREF(__pyx_tuple__11);
19915 
19916   /* "View.MemoryView":495
19917  *             result = struct.unpack(self.view.format, bytesitem)
19918  *         except struct.error:
19919  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
19920  *         else:
19921  *             if len(self.view.format) == 1:
19922  */
19923   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 495, __pyx_L1_error)
19924   __Pyx_GOTREF(__pyx_tuple__12);
19925   __Pyx_GIVEREF(__pyx_tuple__12);
19926 
19927   /* "View.MemoryView":520
19928  *     def __getbuffer__(self, Py_buffer *info, int flags):
19929  *         if flags & PyBUF_WRITABLE and self.view.readonly:
19930  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
19931  *
19932  *         if flags & PyBUF_ND:
19933  */
19934   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 520, __pyx_L1_error)
19935   __Pyx_GOTREF(__pyx_tuple__13);
19936   __Pyx_GIVEREF(__pyx_tuple__13);
19937 
19938   /* "View.MemoryView":570
19939  *         if self.view.strides == NULL:
19940  *
19941  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
19942  *
19943  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
19944  */
19945   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 570, __pyx_L1_error)
19946   __Pyx_GOTREF(__pyx_tuple__14);
19947   __Pyx_GIVEREF(__pyx_tuple__14);
19948 
19949   /* "View.MemoryView":577
19950  *     def suboffsets(self):
19951  *         if self.view.suboffsets == NULL:
19952  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
19953  *
19954  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
19955  */
19956   __pyx_tuple__15 = PyTuple_New(1); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 577, __pyx_L1_error)
19957   __Pyx_GOTREF(__pyx_tuple__15);
19958   __Pyx_INCREF(__pyx_int_neg_1);
19959   __Pyx_GIVEREF(__pyx_int_neg_1);
19960   PyTuple_SET_ITEM(__pyx_tuple__15, 0, __pyx_int_neg_1);
19961   __Pyx_GIVEREF(__pyx_tuple__15);
19962 
19963   /* "(tree fragment)":2
19964  * def __reduce_cython__(self):
19965  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
19966  * def __setstate_cython__(self, __pyx_state):
19967  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19968  */
19969   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 2, __pyx_L1_error)
19970   __Pyx_GOTREF(__pyx_tuple__16);
19971   __Pyx_GIVEREF(__pyx_tuple__16);
19972 
19973   /* "(tree fragment)":4
19974  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19975  * def __setstate_cython__(self, __pyx_state):
19976  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
19977  */
19978   __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 4, __pyx_L1_error)
19979   __Pyx_GOTREF(__pyx_tuple__17);
19980   __Pyx_GIVEREF(__pyx_tuple__17);
19981 
19982   /* "View.MemoryView":682
19983  *         if item is Ellipsis:
19984  *             if not seen_ellipsis:
19985  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
19986  *                 seen_ellipsis = True
19987  *             else:
19988  */
19989   __pyx_slice__18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__18)) __PYX_ERR(2, 682, __pyx_L1_error)
19990   __Pyx_GOTREF(__pyx_slice__18);
19991   __Pyx_GIVEREF(__pyx_slice__18);
19992 
19993   /* "View.MemoryView":703
19994  *     for suboffset in suboffsets[:ndim]:
19995  *         if suboffset >= 0:
19996  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
19997  *
19998  *
19999  */
20000   __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 703, __pyx_L1_error)
20001   __Pyx_GOTREF(__pyx_tuple__19);
20002   __Pyx_GIVEREF(__pyx_tuple__19);
20003 
20004   /* "(tree fragment)":2
20005  * def __reduce_cython__(self):
20006  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20007  * def __setstate_cython__(self, __pyx_state):
20008  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20009  */
20010   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 2, __pyx_L1_error)
20011   __Pyx_GOTREF(__pyx_tuple__20);
20012   __Pyx_GIVEREF(__pyx_tuple__20);
20013 
20014   /* "(tree fragment)":4
20015  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20016  * def __setstate_cython__(self, __pyx_state):
20017  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20018  */
20019   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 4, __pyx_L1_error)
20020   __Pyx_GOTREF(__pyx_tuple__21);
20021   __Pyx_GIVEREF(__pyx_tuple__21);
20022 
20023   /* "pymatgen/optimization/linear_assignment.pyx":54
20024  *     """
20025  *
20026  *     def __init__(self, costs, epsilon=1e-13):             # <<<<<<<<<<<<<<
20027  *         self.orig_c = np.array(costs, dtype=np.float_, copy=False, order='C')
20028  *         self.nx, self.ny = self.orig_c.shape
20029  */
20030   __pyx_tuple__22 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_costs, __pyx_n_s_epsilon); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 54, __pyx_L1_error)
20031   __Pyx_GOTREF(__pyx_tuple__22);
20032   __Pyx_GIVEREF(__pyx_tuple__22);
20033   __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_linear_assignment_pyx, __pyx_n_s_init, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 54, __pyx_L1_error)
20034   __pyx_tuple__24 = PyTuple_Pack(1, ((PyObject*)__pyx_float_1eneg_13)); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 54, __pyx_L1_error)
20035   __Pyx_GOTREF(__pyx_tuple__24);
20036   __Pyx_GIVEREF(__pyx_tuple__24);
20037 
20038   /* "View.MemoryView":286
20039  *         return self.name
20040  *
20041  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
20042  * cdef strided = Enum("<strided and direct>") # default
20043  * cdef indirect = Enum("<strided and indirect>")
20044  */
20045   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 286, __pyx_L1_error)
20046   __Pyx_GOTREF(__pyx_tuple__25);
20047   __Pyx_GIVEREF(__pyx_tuple__25);
20048 
20049   /* "View.MemoryView":287
20050  *
20051  * cdef generic = Enum("<strided and direct or indirect>")
20052  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
20053  * cdef indirect = Enum("<strided and indirect>")
20054  *
20055  */
20056   __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 287, __pyx_L1_error)
20057   __Pyx_GOTREF(__pyx_tuple__26);
20058   __Pyx_GIVEREF(__pyx_tuple__26);
20059 
20060   /* "View.MemoryView":288
20061  * cdef generic = Enum("<strided and direct or indirect>")
20062  * cdef strided = Enum("<strided and direct>") # default
20063  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
20064  *
20065  *
20066  */
20067   __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 288, __pyx_L1_error)
20068   __Pyx_GOTREF(__pyx_tuple__27);
20069   __Pyx_GIVEREF(__pyx_tuple__27);
20070 
20071   /* "View.MemoryView":291
20072  *
20073  *
20074  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
20075  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
20076  *
20077  */
20078   __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 291, __pyx_L1_error)
20079   __Pyx_GOTREF(__pyx_tuple__28);
20080   __Pyx_GIVEREF(__pyx_tuple__28);
20081 
20082   /* "View.MemoryView":292
20083  *
20084  * cdef contiguous = Enum("<contiguous and direct>")
20085  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
20086  *
20087  *
20088  */
20089   __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 292, __pyx_L1_error)
20090   __Pyx_GOTREF(__pyx_tuple__29);
20091   __Pyx_GIVEREF(__pyx_tuple__29);
20092 
20093   /* "(tree fragment)":1
20094  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
20095  *     cdef object __pyx_PickleError
20096  *     cdef object __pyx_result
20097  */
20098   __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(2, 1, __pyx_L1_error)
20099   __Pyx_GOTREF(__pyx_tuple__30);
20100   __Pyx_GIVEREF(__pyx_tuple__30);
20101   __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(2, 1, __pyx_L1_error)
20102   __Pyx_RefNannyFinishContext();
20103   return 0;
20104   __pyx_L1_error:;
20105   __Pyx_RefNannyFinishContext();
20106   return -1;
20107 }
20108 
__Pyx_InitGlobals(void)20109 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
20110   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
20111   __pyx_float_1eneg_13 = PyFloat_FromDouble(1e-13); if (unlikely(!__pyx_float_1eneg_13)) __PYX_ERR(0, 1, __pyx_L1_error)
20112   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
20113   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
20114   __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
20115   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
20116   return 0;
20117   __pyx_L1_error:;
20118   return -1;
20119 }
20120 
20121 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
20122 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
20123 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
20124 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
20125 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
20126 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
20127 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
20128 
__Pyx_modinit_global_init_code(void)20129 static int __Pyx_modinit_global_init_code(void) {
20130   __Pyx_RefNannyDeclarations
20131   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
20132   /*--- Global init code ---*/
20133   generic = Py_None; Py_INCREF(Py_None);
20134   strided = Py_None; Py_INCREF(Py_None);
20135   indirect = Py_None; Py_INCREF(Py_None);
20136   contiguous = Py_None; Py_INCREF(Py_None);
20137   indirect_contiguous = Py_None; Py_INCREF(Py_None);
20138   __Pyx_RefNannyFinishContext();
20139   return 0;
20140 }
20141 
__Pyx_modinit_variable_export_code(void)20142 static int __Pyx_modinit_variable_export_code(void) {
20143   __Pyx_RefNannyDeclarations
20144   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
20145   /*--- Variable export code ---*/
20146   __Pyx_RefNannyFinishContext();
20147   return 0;
20148 }
20149 
__Pyx_modinit_function_export_code(void)20150 static int __Pyx_modinit_function_export_code(void) {
20151   __Pyx_RefNannyDeclarations
20152   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
20153   /*--- Function export code ---*/
20154   __Pyx_RefNannyFinishContext();
20155   return 0;
20156 }
20157 
__Pyx_modinit_type_init_code(void)20158 static int __Pyx_modinit_type_init_code(void) {
20159   __Pyx_RefNannyDeclarations
20160   int __pyx_lineno = 0;
20161   const char *__pyx_filename = NULL;
20162   int __pyx_clineno = 0;
20163   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
20164   /*--- Type init code ---*/
20165   __pyx_vtabptr_array = &__pyx_vtable_array;
20166   __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
20167   if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
20168   #if PY_VERSION_HEX < 0x030800B1
20169   __pyx_type___pyx_array.tp_print = 0;
20170   #endif
20171   if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
20172   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
20173   __pyx_array_type = &__pyx_type___pyx_array;
20174   if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
20175   #if PY_VERSION_HEX < 0x030800B1
20176   __pyx_type___pyx_MemviewEnum.tp_print = 0;
20177   #endif
20178   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
20179     __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
20180   }
20181   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
20182   __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
20183   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
20184   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
20185   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
20186   __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
20187   __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
20188   __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
20189   __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
20190   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
20191   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
20192   #if PY_VERSION_HEX < 0x030800B1
20193   __pyx_type___pyx_memoryview.tp_print = 0;
20194   #endif
20195   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
20196     __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
20197   }
20198   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
20199   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
20200   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
20201   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
20202   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
20203   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
20204   __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
20205   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
20206   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
20207   #if PY_VERSION_HEX < 0x030800B1
20208   __pyx_type___pyx_memoryviewslice.tp_print = 0;
20209   #endif
20210   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
20211     __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
20212   }
20213   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
20214   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
20215   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
20216   __Pyx_RefNannyFinishContext();
20217   return 0;
20218   __pyx_L1_error:;
20219   __Pyx_RefNannyFinishContext();
20220   return -1;
20221 }
20222 
__Pyx_modinit_type_import_code(void)20223 static int __Pyx_modinit_type_import_code(void) {
20224   __Pyx_RefNannyDeclarations
20225   PyObject *__pyx_t_1 = NULL;
20226   int __pyx_lineno = 0;
20227   const char *__pyx_filename = NULL;
20228   int __pyx_clineno = 0;
20229   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
20230   /*--- Type import code ---*/
20231   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
20232   __Pyx_GOTREF(__pyx_t_1);
20233   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
20234   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
20235   sizeof(PyTypeObject),
20236   #else
20237   sizeof(PyHeapTypeObject),
20238   #endif
20239   __Pyx_ImportType_CheckSize_Warn);
20240    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
20241   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20242   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 199, __pyx_L1_error)
20243   __Pyx_GOTREF(__pyx_t_1);
20244   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
20245    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 199, __pyx_L1_error)
20246   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
20247    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 222, __pyx_L1_error)
20248   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
20249    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 226, __pyx_L1_error)
20250   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
20251    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 238, __pyx_L1_error)
20252   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
20253    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 764, __pyx_L1_error)
20254   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20255   __Pyx_RefNannyFinishContext();
20256   return 0;
20257   __pyx_L1_error:;
20258   __Pyx_XDECREF(__pyx_t_1);
20259   __Pyx_RefNannyFinishContext();
20260   return -1;
20261 }
20262 
__Pyx_modinit_variable_import_code(void)20263 static int __Pyx_modinit_variable_import_code(void) {
20264   __Pyx_RefNannyDeclarations
20265   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
20266   /*--- Variable import code ---*/
20267   __Pyx_RefNannyFinishContext();
20268   return 0;
20269 }
20270 
__Pyx_modinit_function_import_code(void)20271 static int __Pyx_modinit_function_import_code(void) {
20272   __Pyx_RefNannyDeclarations
20273   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
20274   /*--- Function import code ---*/
20275   __Pyx_RefNannyFinishContext();
20276   return 0;
20277 }
20278 
20279 
20280 #ifndef CYTHON_NO_PYINIT_EXPORT
20281 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
20282 #elif PY_MAJOR_VERSION < 3
20283 #ifdef __cplusplus
20284 #define __Pyx_PyMODINIT_FUNC extern "C" void
20285 #else
20286 #define __Pyx_PyMODINIT_FUNC void
20287 #endif
20288 #else
20289 #ifdef __cplusplus
20290 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
20291 #else
20292 #define __Pyx_PyMODINIT_FUNC PyObject *
20293 #endif
20294 #endif
20295 
20296 
20297 #if PY_MAJOR_VERSION < 3
20298 __Pyx_PyMODINIT_FUNC initlinear_assignment(void) CYTHON_SMALL_CODE; /*proto*/
initlinear_assignment(void)20299 __Pyx_PyMODINIT_FUNC initlinear_assignment(void)
20300 #else
20301 __Pyx_PyMODINIT_FUNC PyInit_linear_assignment(void) CYTHON_SMALL_CODE; /*proto*/
20302 __Pyx_PyMODINIT_FUNC PyInit_linear_assignment(void)
20303 #if CYTHON_PEP489_MULTI_PHASE_INIT
20304 {
20305   return PyModuleDef_Init(&__pyx_moduledef);
20306 }
20307 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
20308     #if PY_VERSION_HEX >= 0x030700A1
20309     static PY_INT64_T main_interpreter_id = -1;
20310     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
20311     if (main_interpreter_id == -1) {
20312         main_interpreter_id = current_id;
20313         return (unlikely(current_id == -1)) ? -1 : 0;
20314     } else if (unlikely(main_interpreter_id != current_id))
20315     #else
20316     static PyInterpreterState *main_interpreter = NULL;
20317     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
20318     if (!main_interpreter) {
20319         main_interpreter = current_interpreter;
20320     } else if (unlikely(main_interpreter != current_interpreter))
20321     #endif
20322     {
20323         PyErr_SetString(
20324             PyExc_ImportError,
20325             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
20326         return -1;
20327     }
20328     return 0;
20329 }
20330 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) {
20331     PyObject *value = PyObject_GetAttrString(spec, from_name);
20332     int result = 0;
20333     if (likely(value)) {
20334         if (allow_none || value != Py_None) {
20335             result = PyDict_SetItemString(moddict, to_name, value);
20336         }
20337         Py_DECREF(value);
20338     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
20339         PyErr_Clear();
20340     } else {
20341         result = -1;
20342     }
20343     return result;
20344 }
20345 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
20346     PyObject *module = NULL, *moddict, *modname;
20347     if (__Pyx_check_single_interpreter())
20348         return NULL;
20349     if (__pyx_m)
20350         return __Pyx_NewRef(__pyx_m);
20351     modname = PyObject_GetAttrString(spec, "name");
20352     if (unlikely(!modname)) goto bad;
20353     module = PyModule_NewObject(modname);
20354     Py_DECREF(modname);
20355     if (unlikely(!module)) goto bad;
20356     moddict = PyModule_GetDict(module);
20357     if (unlikely(!moddict)) goto bad;
20358     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
20359     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
20360     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
20361     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
20362     return module;
20363 bad:
20364     Py_XDECREF(module);
20365     return NULL;
20366 }
20367 
20368 
20369 static CYTHON_SMALL_CODE int __pyx_pymod_exec_linear_assignment(PyObject *__pyx_pyinit_module)
20370 #endif
20371 #endif
20372 {
20373   PyObject *__pyx_t_1 = NULL;
20374   PyObject *__pyx_t_2 = NULL;
20375   static PyThread_type_lock __pyx_t_3[8];
20376   int __pyx_lineno = 0;
20377   const char *__pyx_filename = NULL;
20378   int __pyx_clineno = 0;
20379   __Pyx_RefNannyDeclarations
20380   #if CYTHON_PEP489_MULTI_PHASE_INIT
20381   if (__pyx_m) {
20382     if (__pyx_m == __pyx_pyinit_module) return 0;
20383     PyErr_SetString(PyExc_RuntimeError, "Module 'linear_assignment' has already been imported. Re-initialisation is not supported.");
20384     return -1;
20385   }
20386   #elif PY_MAJOR_VERSION >= 3
20387   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
20388   #endif
20389   #if CYTHON_REFNANNY
20390 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
20391 if (!__Pyx_RefNanny) {
20392   PyErr_Clear();
20393   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
20394   if (!__Pyx_RefNanny)
20395       Py_FatalError("failed to import 'refnanny' module");
20396 }
20397 #endif
20398   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_linear_assignment(void)", 0);
20399   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20400   #ifdef __Pxy_PyFrame_Initialize_Offsets
20401   __Pxy_PyFrame_Initialize_Offsets();
20402   #endif
20403   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
20404   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
20405   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
20406   #ifdef __Pyx_CyFunction_USED
20407   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20408   #endif
20409   #ifdef __Pyx_FusedFunction_USED
20410   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20411   #endif
20412   #ifdef __Pyx_Coroutine_USED
20413   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20414   #endif
20415   #ifdef __Pyx_Generator_USED
20416   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20417   #endif
20418   #ifdef __Pyx_AsyncGen_USED
20419   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20420   #endif
20421   #ifdef __Pyx_StopAsyncIteration_USED
20422   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20423   #endif
20424   /*--- Library function declarations ---*/
20425   /*--- Threads initialization code ---*/
20426   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
20427   #ifdef WITH_THREAD /* Python build with threading support? */
20428   PyEval_InitThreads();
20429   #endif
20430   #endif
20431   /*--- Module creation code ---*/
20432   #if CYTHON_PEP489_MULTI_PHASE_INIT
20433   __pyx_m = __pyx_pyinit_module;
20434   Py_INCREF(__pyx_m);
20435   #else
20436   #if PY_MAJOR_VERSION < 3
20437   __pyx_m = Py_InitModule4("linear_assignment", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
20438   #else
20439   __pyx_m = PyModule_Create(&__pyx_moduledef);
20440   #endif
20441   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
20442   #endif
20443   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
20444   Py_INCREF(__pyx_d);
20445   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
20446   Py_INCREF(__pyx_b);
20447   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
20448   Py_INCREF(__pyx_cython_runtime);
20449   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
20450   /*--- Initialize various global constants etc. ---*/
20451   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20452   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
20453   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20454   #endif
20455   if (__pyx_module_is_main_pymatgen__optimization__linear_assignment) {
20456     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20457   }
20458   #if PY_MAJOR_VERSION >= 3
20459   {
20460     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
20461     if (!PyDict_GetItemString(modules, "pymatgen.optimization.linear_assignment")) {
20462       if (unlikely(PyDict_SetItemString(modules, "pymatgen.optimization.linear_assignment", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
20463     }
20464   }
20465   #endif
20466   /*--- Builtin init code ---*/
20467   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20468   /*--- Constants init code ---*/
20469   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20470   /*--- Global type/function init code ---*/
20471   (void)__Pyx_modinit_global_init_code();
20472   (void)__Pyx_modinit_variable_export_code();
20473   (void)__Pyx_modinit_function_export_code();
20474   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
20475   if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
20476   (void)__Pyx_modinit_variable_import_code();
20477   (void)__Pyx_modinit_function_import_code();
20478   /*--- Execution code ---*/
20479   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
20480   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20481   #endif
20482 
20483   /* "pymatgen/optimization/linear_assignment.pyx":11
20484  *
20485  *
20486  * __author__ = "Will Richards"             # <<<<<<<<<<<<<<
20487  * __copyright__ = "Copyright 2011, The Materials Project"
20488  * __version__ = "1.0"
20489  */
20490   if (PyDict_SetItem(__pyx_d, __pyx_n_s_author, __pyx_kp_u_Will_Richards) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
20491 
20492   /* "pymatgen/optimization/linear_assignment.pyx":12
20493  *
20494  * __author__ = "Will Richards"
20495  * __copyright__ = "Copyright 2011, The Materials Project"             # <<<<<<<<<<<<<<
20496  * __version__ = "1.0"
20497  * __maintainer__ = "Will Richards"
20498  */
20499   if (PyDict_SetItem(__pyx_d, __pyx_n_s_copyright, __pyx_kp_u_Copyright_2011_The_Materials_Pro) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
20500 
20501   /* "pymatgen/optimization/linear_assignment.pyx":13
20502  * __author__ = "Will Richards"
20503  * __copyright__ = "Copyright 2011, The Materials Project"
20504  * __version__ = "1.0"             # <<<<<<<<<<<<<<
20505  * __maintainer__ = "Will Richards"
20506  * __email__ = "wrichards@mit.edu"
20507  */
20508   if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_u_1_0) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
20509 
20510   /* "pymatgen/optimization/linear_assignment.pyx":14
20511  * __copyright__ = "Copyright 2011, The Materials Project"
20512  * __version__ = "1.0"
20513  * __maintainer__ = "Will Richards"             # <<<<<<<<<<<<<<
20514  * __email__ = "wrichards@mit.edu"
20515  * __date__ = "Jan 28, 2013"
20516  */
20517   if (PyDict_SetItem(__pyx_d, __pyx_n_s_maintainer, __pyx_kp_u_Will_Richards) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
20518 
20519   /* "pymatgen/optimization/linear_assignment.pyx":15
20520  * __version__ = "1.0"
20521  * __maintainer__ = "Will Richards"
20522  * __email__ = "wrichards@mit.edu"             # <<<<<<<<<<<<<<
20523  * __date__ = "Jan 28, 2013"
20524  *
20525  */
20526   if (PyDict_SetItem(__pyx_d, __pyx_n_s_email, __pyx_kp_u_wrichards_mit_edu) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
20527 
20528   /* "pymatgen/optimization/linear_assignment.pyx":16
20529  * __maintainer__ = "Will Richards"
20530  * __email__ = "wrichards@mit.edu"
20531  * __date__ = "Jan 28, 2013"             # <<<<<<<<<<<<<<
20532  *
20533  * import numpy as np
20534  */
20535   if (PyDict_SetItem(__pyx_d, __pyx_n_s_date, __pyx_kp_u_Jan_28_2013) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
20536 
20537   /* "pymatgen/optimization/linear_assignment.pyx":18
20538  * __date__ = "Jan 28, 2013"
20539  *
20540  * import numpy as np             # <<<<<<<<<<<<<<
20541  *
20542  * cimport cython
20543  */
20544   __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
20545   __Pyx_GOTREF(__pyx_t_1);
20546   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
20547   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20548 
20549   /* "pymatgen/optimization/linear_assignment.pyx":26
20550  *
20551  *
20552  * class LinearAssignment:             # <<<<<<<<<<<<<<
20553  *     """
20554  *     This class finds the solution to the Linear Assignment Problem.
20555  */
20556   __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_LinearAssignment, __pyx_n_s_LinearAssignment, (PyObject *) NULL, __pyx_n_s_pymatgen_optimization_linear_ass, __pyx_kp_s_This_class_finds_the_solution_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
20557   __Pyx_GOTREF(__pyx_t_1);
20558 
20559   /* "pymatgen/optimization/linear_assignment.pyx":54
20560  *     """
20561  *
20562  *     def __init__(self, costs, epsilon=1e-13):             # <<<<<<<<<<<<<<
20563  *         self.orig_c = np.array(costs, dtype=np.float_, copy=False, order='C')
20564  *         self.nx, self.ny = self.orig_c.shape
20565  */
20566   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pymatgen_12optimization_17linear_assignment_16LinearAssignment_1__init__, 0, __pyx_n_s_LinearAssignment___init, NULL, __pyx_n_s_pymatgen_optimization_linear_ass, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
20567   __Pyx_GOTREF(__pyx_t_2);
20568   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__24);
20569   if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
20570   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20571 
20572   /* "pymatgen/optimization/linear_assignment.pyx":26
20573  *
20574  *
20575  * class LinearAssignment:             # <<<<<<<<<<<<<<
20576  *     """
20577  *     This class finds the solution to the Linear Assignment Problem.
20578  */
20579   __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_LinearAssignment, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
20580   __Pyx_GOTREF(__pyx_t_2);
20581   if (PyDict_SetItem(__pyx_d, __pyx_n_s_LinearAssignment, __pyx_t_2) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
20582   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20583   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20584 
20585   /* "pymatgen/optimization/linear_assignment.pyx":1
20586  * #cython: language_level=3             # <<<<<<<<<<<<<<
20587  * # coding: utf-8
20588  *
20589  */
20590   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
20591   __Pyx_GOTREF(__pyx_t_1);
20592   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20593   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20594 
20595   /* "View.MemoryView":209
20596  *         info.obj = self
20597  *
20598  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
20599  *
20600  *     def __dealloc__(array self):
20601  */
20602   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 209, __pyx_L1_error)
20603   __Pyx_GOTREF(__pyx_t_1);
20604   if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 209, __pyx_L1_error)
20605   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20606   PyType_Modified(__pyx_array_type);
20607 
20608   /* "View.MemoryView":286
20609  *         return self.name
20610  *
20611  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
20612  * cdef strided = Enum("<strided and direct>") # default
20613  * cdef indirect = Enum("<strided and indirect>")
20614  */
20615   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error)
20616   __Pyx_GOTREF(__pyx_t_1);
20617   __Pyx_XGOTREF(generic);
20618   __Pyx_DECREF_SET(generic, __pyx_t_1);
20619   __Pyx_GIVEREF(__pyx_t_1);
20620   __pyx_t_1 = 0;
20621 
20622   /* "View.MemoryView":287
20623  *
20624  * cdef generic = Enum("<strided and direct or indirect>")
20625  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
20626  * cdef indirect = Enum("<strided and indirect>")
20627  *
20628  */
20629   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error)
20630   __Pyx_GOTREF(__pyx_t_1);
20631   __Pyx_XGOTREF(strided);
20632   __Pyx_DECREF_SET(strided, __pyx_t_1);
20633   __Pyx_GIVEREF(__pyx_t_1);
20634   __pyx_t_1 = 0;
20635 
20636   /* "View.MemoryView":288
20637  * cdef generic = Enum("<strided and direct or indirect>")
20638  * cdef strided = Enum("<strided and direct>") # default
20639  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
20640  *
20641  *
20642  */
20643   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error)
20644   __Pyx_GOTREF(__pyx_t_1);
20645   __Pyx_XGOTREF(indirect);
20646   __Pyx_DECREF_SET(indirect, __pyx_t_1);
20647   __Pyx_GIVEREF(__pyx_t_1);
20648   __pyx_t_1 = 0;
20649 
20650   /* "View.MemoryView":291
20651  *
20652  *
20653  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
20654  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
20655  *
20656  */
20657   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error)
20658   __Pyx_GOTREF(__pyx_t_1);
20659   __Pyx_XGOTREF(contiguous);
20660   __Pyx_DECREF_SET(contiguous, __pyx_t_1);
20661   __Pyx_GIVEREF(__pyx_t_1);
20662   __pyx_t_1 = 0;
20663 
20664   /* "View.MemoryView":292
20665  *
20666  * cdef contiguous = Enum("<contiguous and direct>")
20667  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
20668  *
20669  *
20670  */
20671   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error)
20672   __Pyx_GOTREF(__pyx_t_1);
20673   __Pyx_XGOTREF(indirect_contiguous);
20674   __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
20675   __Pyx_GIVEREF(__pyx_t_1);
20676   __pyx_t_1 = 0;
20677 
20678   /* "View.MemoryView":316
20679  *
20680  * DEF THREAD_LOCKS_PREALLOCATED = 8
20681  * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
20682  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
20683  *     PyThread_allocate_lock(),
20684  */
20685   __pyx_memoryview_thread_locks_used = 0;
20686 
20687   /* "View.MemoryView":317
20688  * DEF THREAD_LOCKS_PREALLOCATED = 8
20689  * cdef int __pyx_memoryview_thread_locks_used = 0
20690  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
20691  *     PyThread_allocate_lock(),
20692  *     PyThread_allocate_lock(),
20693  */
20694   __pyx_t_3[0] = PyThread_allocate_lock();
20695   __pyx_t_3[1] = PyThread_allocate_lock();
20696   __pyx_t_3[2] = PyThread_allocate_lock();
20697   __pyx_t_3[3] = PyThread_allocate_lock();
20698   __pyx_t_3[4] = PyThread_allocate_lock();
20699   __pyx_t_3[5] = PyThread_allocate_lock();
20700   __pyx_t_3[6] = PyThread_allocate_lock();
20701   __pyx_t_3[7] = PyThread_allocate_lock();
20702   memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_3, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
20703 
20704   /* "View.MemoryView":549
20705  *         info.obj = self
20706  *
20707  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
20708  *
20709  *
20710  */
20711   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 549, __pyx_L1_error)
20712   __Pyx_GOTREF(__pyx_t_1);
20713   if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 549, __pyx_L1_error)
20714   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20715   PyType_Modified(__pyx_memoryview_type);
20716 
20717   /* "View.MemoryView":995
20718  *         return self.from_object
20719  *
20720  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
20721  *
20722  *
20723  */
20724   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 995, __pyx_L1_error)
20725   __Pyx_GOTREF(__pyx_t_1);
20726   if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 995, __pyx_L1_error)
20727   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20728   PyType_Modified(__pyx_memoryviewslice_type);
20729 
20730   /* "(tree fragment)":1
20731  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
20732  *     cdef object __pyx_PickleError
20733  *     cdef object __pyx_result
20734  */
20735   __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(2, 1, __pyx_L1_error)
20736   __Pyx_GOTREF(__pyx_t_1);
20737   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
20738   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20739 
20740   /* "(tree fragment)":11
20741  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
20742  *     return __pyx_result
20743  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
20744  *     __pyx_result.name = __pyx_state[0]
20745  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
20746  */
20747 
20748   /*--- Wrapped vars code ---*/
20749 
20750   goto __pyx_L0;
20751   __pyx_L1_error:;
20752   __Pyx_XDECREF(__pyx_t_1);
20753   __Pyx_XDECREF(__pyx_t_2);
20754   if (__pyx_m) {
20755     if (__pyx_d) {
20756       __Pyx_AddTraceback("init pymatgen.optimization.linear_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
20757     }
20758     Py_CLEAR(__pyx_m);
20759   } else if (!PyErr_Occurred()) {
20760     PyErr_SetString(PyExc_ImportError, "init pymatgen.optimization.linear_assignment");
20761   }
20762   __pyx_L0:;
20763   __Pyx_RefNannyFinishContext();
20764   #if CYTHON_PEP489_MULTI_PHASE_INIT
20765   return (__pyx_m != NULL) ? 0 : -1;
20766   #elif PY_MAJOR_VERSION >= 3
20767   return __pyx_m;
20768   #else
20769   return;
20770   #endif
20771 }
20772 
20773 /* --- Runtime support code --- */
20774 /* Refnanny */
20775 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)20776 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
20777     PyObject *m = NULL, *p = NULL;
20778     void *r = NULL;
20779     m = PyImport_ImportModule(modname);
20780     if (!m) goto end;
20781     p = PyObject_GetAttrString(m, "RefNannyAPI");
20782     if (!p) goto end;
20783     r = PyLong_AsVoidPtr(p);
20784 end:
20785     Py_XDECREF(p);
20786     Py_XDECREF(m);
20787     return (__Pyx_RefNannyAPIStruct *)r;
20788 }
20789 #endif
20790 
20791 /* PyObjectGetAttrStr */
20792 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)20793 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
20794     PyTypeObject* tp = Py_TYPE(obj);
20795     if (likely(tp->tp_getattro))
20796         return tp->tp_getattro(obj, attr_name);
20797 #if PY_MAJOR_VERSION < 3
20798     if (likely(tp->tp_getattr))
20799         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
20800 #endif
20801     return PyObject_GetAttr(obj, attr_name);
20802 }
20803 #endif
20804 
20805 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)20806 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
20807     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
20808     if (unlikely(!result)) {
20809         PyErr_Format(PyExc_NameError,
20810 #if PY_MAJOR_VERSION >= 3
20811             "name '%U' is not defined", name);
20812 #else
20813             "name '%.200s' is not defined", PyString_AS_STRING(name));
20814 #endif
20815     }
20816     return result;
20817 }
20818 
20819 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)20820 static void __Pyx_RaiseArgtupleInvalid(
20821     const char* func_name,
20822     int exact,
20823     Py_ssize_t num_min,
20824     Py_ssize_t num_max,
20825     Py_ssize_t num_found)
20826 {
20827     Py_ssize_t num_expected;
20828     const char *more_or_less;
20829     if (num_found < num_min) {
20830         num_expected = num_min;
20831         more_or_less = "at least";
20832     } else {
20833         num_expected = num_max;
20834         more_or_less = "at most";
20835     }
20836     if (exact) {
20837         more_or_less = "exactly";
20838     }
20839     PyErr_Format(PyExc_TypeError,
20840                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
20841                  func_name, more_or_less, num_expected,
20842                  (num_expected == 1) ? "" : "s", num_found);
20843 }
20844 
20845 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)20846 static void __Pyx_RaiseDoubleKeywordsError(
20847     const char* func_name,
20848     PyObject* kw_name)
20849 {
20850     PyErr_Format(PyExc_TypeError,
20851         #if PY_MAJOR_VERSION >= 3
20852         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
20853         #else
20854         "%s() got multiple values for keyword argument '%s'", func_name,
20855         PyString_AsString(kw_name));
20856         #endif
20857 }
20858 
20859 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)20860 static int __Pyx_ParseOptionalKeywords(
20861     PyObject *kwds,
20862     PyObject **argnames[],
20863     PyObject *kwds2,
20864     PyObject *values[],
20865     Py_ssize_t num_pos_args,
20866     const char* function_name)
20867 {
20868     PyObject *key = 0, *value = 0;
20869     Py_ssize_t pos = 0;
20870     PyObject*** name;
20871     PyObject*** first_kw_arg = argnames + num_pos_args;
20872     while (PyDict_Next(kwds, &pos, &key, &value)) {
20873         name = first_kw_arg;
20874         while (*name && (**name != key)) name++;
20875         if (*name) {
20876             values[name-argnames] = value;
20877             continue;
20878         }
20879         name = first_kw_arg;
20880         #if PY_MAJOR_VERSION < 3
20881         if (likely(PyString_Check(key))) {
20882             while (*name) {
20883                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
20884                         && _PyString_Eq(**name, key)) {
20885                     values[name-argnames] = value;
20886                     break;
20887                 }
20888                 name++;
20889             }
20890             if (*name) continue;
20891             else {
20892                 PyObject*** argname = argnames;
20893                 while (argname != first_kw_arg) {
20894                     if ((**argname == key) || (
20895                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
20896                              && _PyString_Eq(**argname, key))) {
20897                         goto arg_passed_twice;
20898                     }
20899                     argname++;
20900                 }
20901             }
20902         } else
20903         #endif
20904         if (likely(PyUnicode_Check(key))) {
20905             while (*name) {
20906                 int cmp = (**name == key) ? 0 :
20907                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
20908                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
20909                 #endif
20910                     PyUnicode_Compare(**name, key);
20911                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
20912                 if (cmp == 0) {
20913                     values[name-argnames] = value;
20914                     break;
20915                 }
20916                 name++;
20917             }
20918             if (*name) continue;
20919             else {
20920                 PyObject*** argname = argnames;
20921                 while (argname != first_kw_arg) {
20922                     int cmp = (**argname == key) ? 0 :
20923                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
20924                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
20925                     #endif
20926                         PyUnicode_Compare(**argname, key);
20927                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
20928                     if (cmp == 0) goto arg_passed_twice;
20929                     argname++;
20930                 }
20931             }
20932         } else
20933             goto invalid_keyword_type;
20934         if (kwds2) {
20935             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
20936         } else {
20937             goto invalid_keyword;
20938         }
20939     }
20940     return 0;
20941 arg_passed_twice:
20942     __Pyx_RaiseDoubleKeywordsError(function_name, key);
20943     goto bad;
20944 invalid_keyword_type:
20945     PyErr_Format(PyExc_TypeError,
20946         "%.200s() keywords must be strings", function_name);
20947     goto bad;
20948 invalid_keyword:
20949     PyErr_Format(PyExc_TypeError,
20950     #if PY_MAJOR_VERSION < 3
20951         "%.200s() got an unexpected keyword argument '%.200s'",
20952         function_name, PyString_AsString(key));
20953     #else
20954         "%s() got an unexpected keyword argument '%U'",
20955         function_name, key);
20956     #endif
20957 bad:
20958     return -1;
20959 }
20960 
20961 /* PyDictVersioning */
20962 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)20963 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
20964     PyObject *dict = Py_TYPE(obj)->tp_dict;
20965     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
20966 }
__Pyx_get_object_dict_version(PyObject * obj)20967 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
20968     PyObject **dictptr = NULL;
20969     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
20970     if (offset) {
20971 #if CYTHON_COMPILING_IN_CPYTHON
20972         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
20973 #else
20974         dictptr = _PyObject_GetDictPtr(obj);
20975 #endif
20976     }
20977     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
20978 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)20979 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
20980     PyObject *dict = Py_TYPE(obj)->tp_dict;
20981     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
20982         return 0;
20983     return obj_dict_version == __Pyx_get_object_dict_version(obj);
20984 }
20985 #endif
20986 
20987 /* GetModuleGlobalName */
20988 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)20989 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
20990 #else
20991 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
20992 #endif
20993 {
20994     PyObject *result;
20995 #if !CYTHON_AVOID_BORROWED_REFS
20996 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
20997     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
20998     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
20999     if (likely(result)) {
21000         return __Pyx_NewRef(result);
21001     } else if (unlikely(PyErr_Occurred())) {
21002         return NULL;
21003     }
21004 #else
21005     result = PyDict_GetItem(__pyx_d, name);
21006     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
21007     if (likely(result)) {
21008         return __Pyx_NewRef(result);
21009     }
21010 #endif
21011 #else
21012     result = PyObject_GetItem(__pyx_d, name);
21013     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
21014     if (likely(result)) {
21015         return __Pyx_NewRef(result);
21016     }
21017     PyErr_Clear();
21018 #endif
21019     return __Pyx_GetBuiltinName(name);
21020 }
21021 
21022 /* PyObjectCall */
21023 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)21024 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
21025     PyObject *result;
21026     ternaryfunc call = func->ob_type->tp_call;
21027     if (unlikely(!call))
21028         return PyObject_Call(func, arg, kw);
21029     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
21030         return NULL;
21031     result = (*call)(func, arg, kw);
21032     Py_LeaveRecursiveCall();
21033     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
21034         PyErr_SetString(
21035             PyExc_SystemError,
21036             "NULL result without error in PyObject_Call");
21037     }
21038     return result;
21039 }
21040 #endif
21041 
21042 /* PyObjectSetAttrStr */
21043 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_SetAttrStr(PyObject * obj,PyObject * attr_name,PyObject * value)21044 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
21045     PyTypeObject* tp = Py_TYPE(obj);
21046     if (likely(tp->tp_setattro))
21047         return tp->tp_setattro(obj, attr_name, value);
21048 #if PY_MAJOR_VERSION < 3
21049     if (likely(tp->tp_setattr))
21050         return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
21051 #endif
21052     return PyObject_SetAttr(obj, attr_name, value);
21053 }
21054 #endif
21055 
21056 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)21057 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
21058     PyErr_Format(PyExc_ValueError,
21059                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
21060 }
21061 
21062 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)21063 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
21064     PyErr_Format(PyExc_ValueError,
21065                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
21066                  index, (index == 1) ? "" : "s");
21067 }
21068 
21069 /* IterFinish */
__Pyx_IterFinish(void)21070 static CYTHON_INLINE int __Pyx_IterFinish(void) {
21071 #if CYTHON_FAST_THREAD_STATE
21072     PyThreadState *tstate = __Pyx_PyThreadState_Current;
21073     PyObject* exc_type = tstate->curexc_type;
21074     if (unlikely(exc_type)) {
21075         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
21076             PyObject *exc_value, *exc_tb;
21077             exc_value = tstate->curexc_value;
21078             exc_tb = tstate->curexc_traceback;
21079             tstate->curexc_type = 0;
21080             tstate->curexc_value = 0;
21081             tstate->curexc_traceback = 0;
21082             Py_DECREF(exc_type);
21083             Py_XDECREF(exc_value);
21084             Py_XDECREF(exc_tb);
21085             return 0;
21086         } else {
21087             return -1;
21088         }
21089     }
21090     return 0;
21091 #else
21092     if (unlikely(PyErr_Occurred())) {
21093         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
21094             PyErr_Clear();
21095             return 0;
21096         } else {
21097             return -1;
21098         }
21099     }
21100     return 0;
21101 #endif
21102 }
21103 
21104 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)21105 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
21106     if (unlikely(retval)) {
21107         Py_DECREF(retval);
21108         __Pyx_RaiseTooManyValuesError(expected);
21109         return -1;
21110     } else {
21111         return __Pyx_IterFinish();
21112     }
21113     return 0;
21114 }
21115 
21116 /* PyErrFetchRestore */
21117 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)21118 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
21119     PyObject *tmp_type, *tmp_value, *tmp_tb;
21120     tmp_type = tstate->curexc_type;
21121     tmp_value = tstate->curexc_value;
21122     tmp_tb = tstate->curexc_traceback;
21123     tstate->curexc_type = type;
21124     tstate->curexc_value = value;
21125     tstate->curexc_traceback = tb;
21126     Py_XDECREF(tmp_type);
21127     Py_XDECREF(tmp_value);
21128     Py_XDECREF(tmp_tb);
21129 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)21130 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
21131     *type = tstate->curexc_type;
21132     *value = tstate->curexc_value;
21133     *tb = tstate->curexc_traceback;
21134     tstate->curexc_type = 0;
21135     tstate->curexc_value = 0;
21136     tstate->curexc_traceback = 0;
21137 }
21138 #endif
21139 
21140 /* RaiseException */
21141 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)21142 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
21143                         CYTHON_UNUSED PyObject *cause) {
21144     __Pyx_PyThreadState_declare
21145     Py_XINCREF(type);
21146     if (!value || value == Py_None)
21147         value = NULL;
21148     else
21149         Py_INCREF(value);
21150     if (!tb || tb == Py_None)
21151         tb = NULL;
21152     else {
21153         Py_INCREF(tb);
21154         if (!PyTraceBack_Check(tb)) {
21155             PyErr_SetString(PyExc_TypeError,
21156                 "raise: arg 3 must be a traceback or None");
21157             goto raise_error;
21158         }
21159     }
21160     if (PyType_Check(type)) {
21161 #if CYTHON_COMPILING_IN_PYPY
21162         if (!value) {
21163             Py_INCREF(Py_None);
21164             value = Py_None;
21165         }
21166 #endif
21167         PyErr_NormalizeException(&type, &value, &tb);
21168     } else {
21169         if (value) {
21170             PyErr_SetString(PyExc_TypeError,
21171                 "instance exception may not have a separate value");
21172             goto raise_error;
21173         }
21174         value = type;
21175         type = (PyObject*) Py_TYPE(type);
21176         Py_INCREF(type);
21177         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
21178             PyErr_SetString(PyExc_TypeError,
21179                 "raise: exception class must be a subclass of BaseException");
21180             goto raise_error;
21181         }
21182     }
21183     __Pyx_PyThreadState_assign
21184     __Pyx_ErrRestore(type, value, tb);
21185     return;
21186 raise_error:
21187     Py_XDECREF(value);
21188     Py_XDECREF(type);
21189     Py_XDECREF(tb);
21190     return;
21191 }
21192 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)21193 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
21194     PyObject* owned_instance = NULL;
21195     if (tb == Py_None) {
21196         tb = 0;
21197     } else if (tb && !PyTraceBack_Check(tb)) {
21198         PyErr_SetString(PyExc_TypeError,
21199             "raise: arg 3 must be a traceback or None");
21200         goto bad;
21201     }
21202     if (value == Py_None)
21203         value = 0;
21204     if (PyExceptionInstance_Check(type)) {
21205         if (value) {
21206             PyErr_SetString(PyExc_TypeError,
21207                 "instance exception may not have a separate value");
21208             goto bad;
21209         }
21210         value = type;
21211         type = (PyObject*) Py_TYPE(value);
21212     } else if (PyExceptionClass_Check(type)) {
21213         PyObject *instance_class = NULL;
21214         if (value && PyExceptionInstance_Check(value)) {
21215             instance_class = (PyObject*) Py_TYPE(value);
21216             if (instance_class != type) {
21217                 int is_subclass = PyObject_IsSubclass(instance_class, type);
21218                 if (!is_subclass) {
21219                     instance_class = NULL;
21220                 } else if (unlikely(is_subclass == -1)) {
21221                     goto bad;
21222                 } else {
21223                     type = instance_class;
21224                 }
21225             }
21226         }
21227         if (!instance_class) {
21228             PyObject *args;
21229             if (!value)
21230                 args = PyTuple_New(0);
21231             else if (PyTuple_Check(value)) {
21232                 Py_INCREF(value);
21233                 args = value;
21234             } else
21235                 args = PyTuple_Pack(1, value);
21236             if (!args)
21237                 goto bad;
21238             owned_instance = PyObject_Call(type, args, NULL);
21239             Py_DECREF(args);
21240             if (!owned_instance)
21241                 goto bad;
21242             value = owned_instance;
21243             if (!PyExceptionInstance_Check(value)) {
21244                 PyErr_Format(PyExc_TypeError,
21245                              "calling %R should have returned an instance of "
21246                              "BaseException, not %R",
21247                              type, Py_TYPE(value));
21248                 goto bad;
21249             }
21250         }
21251     } else {
21252         PyErr_SetString(PyExc_TypeError,
21253             "raise: exception class must be a subclass of BaseException");
21254         goto bad;
21255     }
21256     if (cause) {
21257         PyObject *fixed_cause;
21258         if (cause == Py_None) {
21259             fixed_cause = NULL;
21260         } else if (PyExceptionClass_Check(cause)) {
21261             fixed_cause = PyObject_CallObject(cause, NULL);
21262             if (fixed_cause == NULL)
21263                 goto bad;
21264         } else if (PyExceptionInstance_Check(cause)) {
21265             fixed_cause = cause;
21266             Py_INCREF(fixed_cause);
21267         } else {
21268             PyErr_SetString(PyExc_TypeError,
21269                             "exception causes must derive from "
21270                             "BaseException");
21271             goto bad;
21272         }
21273         PyException_SetCause(value, fixed_cause);
21274     }
21275     PyErr_SetObject(type, value);
21276     if (tb) {
21277 #if CYTHON_COMPILING_IN_PYPY
21278         PyObject *tmp_type, *tmp_value, *tmp_tb;
21279         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
21280         Py_INCREF(tb);
21281         PyErr_Restore(tmp_type, tmp_value, tb);
21282         Py_XDECREF(tmp_tb);
21283 #else
21284         PyThreadState *tstate = __Pyx_PyThreadState_Current;
21285         PyObject* tmp_tb = tstate->curexc_traceback;
21286         if (tb != tmp_tb) {
21287             Py_INCREF(tb);
21288             tstate->curexc_traceback = tb;
21289             Py_XDECREF(tmp_tb);
21290         }
21291 #endif
21292     }
21293 bad:
21294     Py_XDECREF(owned_instance);
21295     return;
21296 }
21297 #endif
21298 
21299 /* SliceObject */
__Pyx_PyObject_SetSlice(PyObject * obj,PyObject * value,Py_ssize_t cstart,Py_ssize_t cstop,PyObject ** _py_start,PyObject ** _py_stop,PyObject ** _py_slice,int has_cstart,int has_cstop,CYTHON_UNUSED int wraparound)21300 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
21301         Py_ssize_t cstart, Py_ssize_t cstop,
21302         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
21303         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
21304 #if CYTHON_USE_TYPE_SLOTS
21305     PyMappingMethods* mp;
21306 #if PY_MAJOR_VERSION < 3
21307     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
21308     if (likely(ms && ms->sq_ass_slice)) {
21309         if (!has_cstart) {
21310             if (_py_start && (*_py_start != Py_None)) {
21311                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
21312                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
21313             } else
21314                 cstart = 0;
21315         }
21316         if (!has_cstop) {
21317             if (_py_stop && (*_py_stop != Py_None)) {
21318                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
21319                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
21320             } else
21321                 cstop = PY_SSIZE_T_MAX;
21322         }
21323         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
21324             Py_ssize_t l = ms->sq_length(obj);
21325             if (likely(l >= 0)) {
21326                 if (cstop < 0) {
21327                     cstop += l;
21328                     if (cstop < 0) cstop = 0;
21329                 }
21330                 if (cstart < 0) {
21331                     cstart += l;
21332                     if (cstart < 0) cstart = 0;
21333                 }
21334             } else {
21335                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
21336                     goto bad;
21337                 PyErr_Clear();
21338             }
21339         }
21340         return ms->sq_ass_slice(obj, cstart, cstop, value);
21341     }
21342 #endif
21343     mp = Py_TYPE(obj)->tp_as_mapping;
21344     if (likely(mp && mp->mp_ass_subscript))
21345 #endif
21346     {
21347         int result;
21348         PyObject *py_slice, *py_start, *py_stop;
21349         if (_py_slice) {
21350             py_slice = *_py_slice;
21351         } else {
21352             PyObject* owned_start = NULL;
21353             PyObject* owned_stop = NULL;
21354             if (_py_start) {
21355                 py_start = *_py_start;
21356             } else {
21357                 if (has_cstart) {
21358                     owned_start = py_start = PyInt_FromSsize_t(cstart);
21359                     if (unlikely(!py_start)) goto bad;
21360                 } else
21361                     py_start = Py_None;
21362             }
21363             if (_py_stop) {
21364                 py_stop = *_py_stop;
21365             } else {
21366                 if (has_cstop) {
21367                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
21368                     if (unlikely(!py_stop)) {
21369                         Py_XDECREF(owned_start);
21370                         goto bad;
21371                     }
21372                 } else
21373                     py_stop = Py_None;
21374             }
21375             py_slice = PySlice_New(py_start, py_stop, Py_None);
21376             Py_XDECREF(owned_start);
21377             Py_XDECREF(owned_stop);
21378             if (unlikely(!py_slice)) goto bad;
21379         }
21380 #if CYTHON_USE_TYPE_SLOTS
21381         result = mp->mp_ass_subscript(obj, py_slice, value);
21382 #else
21383         result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
21384 #endif
21385         if (!_py_slice) {
21386             Py_DECREF(py_slice);
21387         }
21388         return result;
21389     }
21390     PyErr_Format(PyExc_TypeError,
21391         "'%.200s' object does not support slice %.10s",
21392         Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
21393 bad:
21394     return -1;
21395 }
21396 
21397 /* MemviewSliceInit */
21398 static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj * memview,int ndim,__Pyx_memviewslice * memviewslice,int memview_is_new_reference)21399 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
21400                         int ndim,
21401                         __Pyx_memviewslice *memviewslice,
21402                         int memview_is_new_reference)
21403 {
21404     __Pyx_RefNannyDeclarations
21405     int i, retval=-1;
21406     Py_buffer *buf = &memview->view;
21407     __Pyx_RefNannySetupContext("init_memviewslice", 0);
21408     if (unlikely(memviewslice->memview || memviewslice->data)) {
21409         PyErr_SetString(PyExc_ValueError,
21410             "memviewslice is already initialized!");
21411         goto fail;
21412     }
21413     if (buf->strides) {
21414         for (i = 0; i < ndim; i++) {
21415             memviewslice->strides[i] = buf->strides[i];
21416         }
21417     } else {
21418         Py_ssize_t stride = buf->itemsize;
21419         for (i = ndim - 1; i >= 0; i--) {
21420             memviewslice->strides[i] = stride;
21421             stride *= buf->shape[i];
21422         }
21423     }
21424     for (i = 0; i < ndim; i++) {
21425         memviewslice->shape[i]   = buf->shape[i];
21426         if (buf->suboffsets) {
21427             memviewslice->suboffsets[i] = buf->suboffsets[i];
21428         } else {
21429             memviewslice->suboffsets[i] = -1;
21430         }
21431     }
21432     memviewslice->memview = memview;
21433     memviewslice->data = (char *)buf->buf;
21434     if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
21435         Py_INCREF(memview);
21436     }
21437     retval = 0;
21438     goto no_fail;
21439 fail:
21440     memviewslice->memview = 0;
21441     memviewslice->data = 0;
21442     retval = -1;
21443 no_fail:
21444     __Pyx_RefNannyFinishContext();
21445     return retval;
21446 }
21447 #ifndef Py_NO_RETURN
21448 #define Py_NO_RETURN
21449 #endif
__pyx_fatalerror(const char * fmt,...)21450 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
21451     va_list vargs;
21452     char msg[200];
21453 #ifdef HAVE_STDARG_PROTOTYPES
21454     va_start(vargs, fmt);
21455 #else
21456     va_start(vargs);
21457 #endif
21458     vsnprintf(msg, 200, fmt, vargs);
21459     va_end(vargs);
21460     Py_FatalError(msg);
21461 }
21462 static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)21463 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
21464                                    PyThread_type_lock lock)
21465 {
21466     int result;
21467     PyThread_acquire_lock(lock, 1);
21468     result = (*acquisition_count)++;
21469     PyThread_release_lock(lock);
21470     return result;
21471 }
21472 static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)21473 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
21474                                    PyThread_type_lock lock)
21475 {
21476     int result;
21477     PyThread_acquire_lock(lock, 1);
21478     result = (*acquisition_count)--;
21479     PyThread_release_lock(lock);
21480     return result;
21481 }
21482 static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)21483 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
21484 {
21485     int first_time;
21486     struct __pyx_memoryview_obj *memview = memslice->memview;
21487     if (unlikely(!memview || (PyObject *) memview == Py_None))
21488         return;
21489     if (unlikely(__pyx_get_slice_count(memview) < 0))
21490         __pyx_fatalerror("Acquisition count is %d (line %d)",
21491                          __pyx_get_slice_count(memview), lineno);
21492     first_time = __pyx_add_acquisition_count(memview) == 0;
21493     if (unlikely(first_time)) {
21494         if (have_gil) {
21495             Py_INCREF((PyObject *) memview);
21496         } else {
21497             PyGILState_STATE _gilstate = PyGILState_Ensure();
21498             Py_INCREF((PyObject *) memview);
21499             PyGILState_Release(_gilstate);
21500         }
21501     }
21502 }
__Pyx_XDEC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)21503 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
21504                                              int have_gil, int lineno) {
21505     int last_time;
21506     struct __pyx_memoryview_obj *memview = memslice->memview;
21507     if (unlikely(!memview || (PyObject *) memview == Py_None)) {
21508         memslice->memview = NULL;
21509         return;
21510     }
21511     if (unlikely(__pyx_get_slice_count(memview) <= 0))
21512         __pyx_fatalerror("Acquisition count is %d (line %d)",
21513                          __pyx_get_slice_count(memview), lineno);
21514     last_time = __pyx_sub_acquisition_count(memview) == 1;
21515     memslice->data = NULL;
21516     if (unlikely(last_time)) {
21517         if (have_gil) {
21518             Py_CLEAR(memslice->memview);
21519         } else {
21520             PyGILState_STATE _gilstate = PyGILState_Ensure();
21521             Py_CLEAR(memslice->memview);
21522             PyGILState_Release(_gilstate);
21523         }
21524     } else {
21525         memslice->memview = NULL;
21526     }
21527 }
21528 
21529 /* SliceObject */
__Pyx_PyObject_GetSlice(PyObject * obj,Py_ssize_t cstart,Py_ssize_t cstop,PyObject ** _py_start,PyObject ** _py_stop,PyObject ** _py_slice,int has_cstart,int has_cstop,CYTHON_UNUSED int wraparound)21530 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
21531         Py_ssize_t cstart, Py_ssize_t cstop,
21532         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
21533         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
21534 #if CYTHON_USE_TYPE_SLOTS
21535     PyMappingMethods* mp;
21536 #if PY_MAJOR_VERSION < 3
21537     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
21538     if (likely(ms && ms->sq_slice)) {
21539         if (!has_cstart) {
21540             if (_py_start && (*_py_start != Py_None)) {
21541                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
21542                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
21543             } else
21544                 cstart = 0;
21545         }
21546         if (!has_cstop) {
21547             if (_py_stop && (*_py_stop != Py_None)) {
21548                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
21549                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
21550             } else
21551                 cstop = PY_SSIZE_T_MAX;
21552         }
21553         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
21554             Py_ssize_t l = ms->sq_length(obj);
21555             if (likely(l >= 0)) {
21556                 if (cstop < 0) {
21557                     cstop += l;
21558                     if (cstop < 0) cstop = 0;
21559                 }
21560                 if (cstart < 0) {
21561                     cstart += l;
21562                     if (cstart < 0) cstart = 0;
21563                 }
21564             } else {
21565                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
21566                     goto bad;
21567                 PyErr_Clear();
21568             }
21569         }
21570         return ms->sq_slice(obj, cstart, cstop);
21571     }
21572 #endif
21573     mp = Py_TYPE(obj)->tp_as_mapping;
21574     if (likely(mp && mp->mp_subscript))
21575 #endif
21576     {
21577         PyObject* result;
21578         PyObject *py_slice, *py_start, *py_stop;
21579         if (_py_slice) {
21580             py_slice = *_py_slice;
21581         } else {
21582             PyObject* owned_start = NULL;
21583             PyObject* owned_stop = NULL;
21584             if (_py_start) {
21585                 py_start = *_py_start;
21586             } else {
21587                 if (has_cstart) {
21588                     owned_start = py_start = PyInt_FromSsize_t(cstart);
21589                     if (unlikely(!py_start)) goto bad;
21590                 } else
21591                     py_start = Py_None;
21592             }
21593             if (_py_stop) {
21594                 py_stop = *_py_stop;
21595             } else {
21596                 if (has_cstop) {
21597                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
21598                     if (unlikely(!py_stop)) {
21599                         Py_XDECREF(owned_start);
21600                         goto bad;
21601                     }
21602                 } else
21603                     py_stop = Py_None;
21604             }
21605             py_slice = PySlice_New(py_start, py_stop, Py_None);
21606             Py_XDECREF(owned_start);
21607             Py_XDECREF(owned_stop);
21608             if (unlikely(!py_slice)) goto bad;
21609         }
21610 #if CYTHON_USE_TYPE_SLOTS
21611         result = mp->mp_subscript(obj, py_slice);
21612 #else
21613         result = PyObject_GetItem(obj, py_slice);
21614 #endif
21615         if (!_py_slice) {
21616             Py_DECREF(py_slice);
21617         }
21618         return result;
21619     }
21620     PyErr_Format(PyExc_TypeError,
21621         "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
21622 bad:
21623     return NULL;
21624 }
21625 
21626 /* GetTopmostException */
21627 #if CYTHON_USE_EXC_INFO_STACK
21628 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)21629 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
21630 {
21631     _PyErr_StackItem *exc_info = tstate->exc_info;
21632     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
21633            exc_info->previous_item != NULL)
21634     {
21635         exc_info = exc_info->previous_item;
21636     }
21637     return exc_info;
21638 }
21639 #endif
21640 
21641 /* SaveResetException */
21642 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)21643 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
21644     #if CYTHON_USE_EXC_INFO_STACK
21645     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
21646     *type = exc_info->exc_type;
21647     *value = exc_info->exc_value;
21648     *tb = exc_info->exc_traceback;
21649     #else
21650     *type = tstate->exc_type;
21651     *value = tstate->exc_value;
21652     *tb = tstate->exc_traceback;
21653     #endif
21654     Py_XINCREF(*type);
21655     Py_XINCREF(*value);
21656     Py_XINCREF(*tb);
21657 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)21658 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
21659     PyObject *tmp_type, *tmp_value, *tmp_tb;
21660     #if CYTHON_USE_EXC_INFO_STACK
21661     _PyErr_StackItem *exc_info = tstate->exc_info;
21662     tmp_type = exc_info->exc_type;
21663     tmp_value = exc_info->exc_value;
21664     tmp_tb = exc_info->exc_traceback;
21665     exc_info->exc_type = type;
21666     exc_info->exc_value = value;
21667     exc_info->exc_traceback = tb;
21668     #else
21669     tmp_type = tstate->exc_type;
21670     tmp_value = tstate->exc_value;
21671     tmp_tb = tstate->exc_traceback;
21672     tstate->exc_type = type;
21673     tstate->exc_value = value;
21674     tstate->exc_traceback = tb;
21675     #endif
21676     Py_XDECREF(tmp_type);
21677     Py_XDECREF(tmp_value);
21678     Py_XDECREF(tmp_tb);
21679 }
21680 #endif
21681 
21682 /* PyErrExceptionMatches */
21683 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)21684 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
21685     Py_ssize_t i, n;
21686     n = PyTuple_GET_SIZE(tuple);
21687 #if PY_MAJOR_VERSION >= 3
21688     for (i=0; i<n; i++) {
21689         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
21690     }
21691 #endif
21692     for (i=0; i<n; i++) {
21693         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
21694     }
21695     return 0;
21696 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)21697 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
21698     PyObject *exc_type = tstate->curexc_type;
21699     if (exc_type == err) return 1;
21700     if (unlikely(!exc_type)) return 0;
21701     if (unlikely(PyTuple_Check(err)))
21702         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
21703     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
21704 }
21705 #endif
21706 
21707 /* GetException */
21708 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)21709 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
21710 #else
21711 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
21712 #endif
21713 {
21714     PyObject *local_type, *local_value, *local_tb;
21715 #if CYTHON_FAST_THREAD_STATE
21716     PyObject *tmp_type, *tmp_value, *tmp_tb;
21717     local_type = tstate->curexc_type;
21718     local_value = tstate->curexc_value;
21719     local_tb = tstate->curexc_traceback;
21720     tstate->curexc_type = 0;
21721     tstate->curexc_value = 0;
21722     tstate->curexc_traceback = 0;
21723 #else
21724     PyErr_Fetch(&local_type, &local_value, &local_tb);
21725 #endif
21726     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
21727 #if CYTHON_FAST_THREAD_STATE
21728     if (unlikely(tstate->curexc_type))
21729 #else
21730     if (unlikely(PyErr_Occurred()))
21731 #endif
21732         goto bad;
21733     #if PY_MAJOR_VERSION >= 3
21734     if (local_tb) {
21735         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
21736             goto bad;
21737     }
21738     #endif
21739     Py_XINCREF(local_tb);
21740     Py_XINCREF(local_type);
21741     Py_XINCREF(local_value);
21742     *type = local_type;
21743     *value = local_value;
21744     *tb = local_tb;
21745 #if CYTHON_FAST_THREAD_STATE
21746     #if CYTHON_USE_EXC_INFO_STACK
21747     {
21748         _PyErr_StackItem *exc_info = tstate->exc_info;
21749         tmp_type = exc_info->exc_type;
21750         tmp_value = exc_info->exc_value;
21751         tmp_tb = exc_info->exc_traceback;
21752         exc_info->exc_type = local_type;
21753         exc_info->exc_value = local_value;
21754         exc_info->exc_traceback = local_tb;
21755     }
21756     #else
21757     tmp_type = tstate->exc_type;
21758     tmp_value = tstate->exc_value;
21759     tmp_tb = tstate->exc_traceback;
21760     tstate->exc_type = local_type;
21761     tstate->exc_value = local_value;
21762     tstate->exc_traceback = local_tb;
21763     #endif
21764     Py_XDECREF(tmp_type);
21765     Py_XDECREF(tmp_value);
21766     Py_XDECREF(tmp_tb);
21767 #else
21768     PyErr_SetExcInfo(local_type, local_value, local_tb);
21769 #endif
21770     return 0;
21771 bad:
21772     *type = 0;
21773     *value = 0;
21774     *tb = 0;
21775     Py_XDECREF(local_type);
21776     Py_XDECREF(local_value);
21777     Py_XDECREF(local_tb);
21778     return -1;
21779 }
21780 
21781 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)21782 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
21783 {
21784     if (unlikely(!type)) {
21785         PyErr_SetString(PyExc_SystemError, "Missing type object");
21786         return 0;
21787     }
21788     else if (exact) {
21789         #if PY_MAJOR_VERSION == 2
21790         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
21791         #endif
21792     }
21793     else {
21794         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
21795     }
21796     PyErr_Format(PyExc_TypeError,
21797         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
21798         name, type->tp_name, Py_TYPE(obj)->tp_name);
21799     return 0;
21800 }
21801 
21802 /* PyCFunctionFastCall */
21803 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)21804 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
21805     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
21806     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
21807     PyObject *self = PyCFunction_GET_SELF(func);
21808     int flags = PyCFunction_GET_FLAGS(func);
21809     assert(PyCFunction_Check(func));
21810     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
21811     assert(nargs >= 0);
21812     assert(nargs == 0 || args != NULL);
21813     /* _PyCFunction_FastCallDict() must not be called with an exception set,
21814        because it may clear it (directly or indirectly) and so the
21815        caller loses its exception */
21816     assert(!PyErr_Occurred());
21817     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
21818         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
21819     } else {
21820         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
21821     }
21822 }
21823 #endif
21824 
21825 /* PyFunctionFastCall */
21826 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)21827 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
21828                                                PyObject *globals) {
21829     PyFrameObject *f;
21830     PyThreadState *tstate = __Pyx_PyThreadState_Current;
21831     PyObject **fastlocals;
21832     Py_ssize_t i;
21833     PyObject *result;
21834     assert(globals != NULL);
21835     /* XXX Perhaps we should create a specialized
21836        PyFrame_New() that doesn't take locals, but does
21837        take builtins without sanity checking them.
21838        */
21839     assert(tstate != NULL);
21840     f = PyFrame_New(tstate, co, globals, NULL);
21841     if (f == NULL) {
21842         return NULL;
21843     }
21844     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
21845     for (i = 0; i < na; i++) {
21846         Py_INCREF(*args);
21847         fastlocals[i] = *args++;
21848     }
21849     result = PyEval_EvalFrameEx(f,0);
21850     ++tstate->recursion_depth;
21851     Py_DECREF(f);
21852     --tstate->recursion_depth;
21853     return result;
21854 }
21855 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)21856 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
21857     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
21858     PyObject *globals = PyFunction_GET_GLOBALS(func);
21859     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
21860     PyObject *closure;
21861 #if PY_MAJOR_VERSION >= 3
21862     PyObject *kwdefs;
21863 #endif
21864     PyObject *kwtuple, **k;
21865     PyObject **d;
21866     Py_ssize_t nd;
21867     Py_ssize_t nk;
21868     PyObject *result;
21869     assert(kwargs == NULL || PyDict_Check(kwargs));
21870     nk = kwargs ? PyDict_Size(kwargs) : 0;
21871     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
21872         return NULL;
21873     }
21874     if (
21875 #if PY_MAJOR_VERSION >= 3
21876             co->co_kwonlyargcount == 0 &&
21877 #endif
21878             likely(kwargs == NULL || nk == 0) &&
21879             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
21880         if (argdefs == NULL && co->co_argcount == nargs) {
21881             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
21882             goto done;
21883         }
21884         else if (nargs == 0 && argdefs != NULL
21885                  && co->co_argcount == Py_SIZE(argdefs)) {
21886             /* function called with no arguments, but all parameters have
21887                a default value: use default values as arguments .*/
21888             args = &PyTuple_GET_ITEM(argdefs, 0);
21889             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
21890             goto done;
21891         }
21892     }
21893     if (kwargs != NULL) {
21894         Py_ssize_t pos, i;
21895         kwtuple = PyTuple_New(2 * nk);
21896         if (kwtuple == NULL) {
21897             result = NULL;
21898             goto done;
21899         }
21900         k = &PyTuple_GET_ITEM(kwtuple, 0);
21901         pos = i = 0;
21902         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
21903             Py_INCREF(k[i]);
21904             Py_INCREF(k[i+1]);
21905             i += 2;
21906         }
21907         nk = i / 2;
21908     }
21909     else {
21910         kwtuple = NULL;
21911         k = NULL;
21912     }
21913     closure = PyFunction_GET_CLOSURE(func);
21914 #if PY_MAJOR_VERSION >= 3
21915     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
21916 #endif
21917     if (argdefs != NULL) {
21918         d = &PyTuple_GET_ITEM(argdefs, 0);
21919         nd = Py_SIZE(argdefs);
21920     }
21921     else {
21922         d = NULL;
21923         nd = 0;
21924     }
21925 #if PY_MAJOR_VERSION >= 3
21926     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
21927                                args, (int)nargs,
21928                                k, (int)nk,
21929                                d, (int)nd, kwdefs, closure);
21930 #else
21931     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
21932                                args, (int)nargs,
21933                                k, (int)nk,
21934                                d, (int)nd, closure);
21935 #endif
21936     Py_XDECREF(kwtuple);
21937 done:
21938     Py_LeaveRecursiveCall();
21939     return result;
21940 }
21941 #endif
21942 #endif
21943 
21944 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)21945 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
21946     PyObject *args, *result = NULL;
21947     #if CYTHON_FAST_PYCALL
21948     if (PyFunction_Check(function)) {
21949         PyObject *args[2] = {arg1, arg2};
21950         return __Pyx_PyFunction_FastCall(function, args, 2);
21951     }
21952     #endif
21953     #if CYTHON_FAST_PYCCALL
21954     if (__Pyx_PyFastCFunction_Check(function)) {
21955         PyObject *args[2] = {arg1, arg2};
21956         return __Pyx_PyCFunction_FastCall(function, args, 2);
21957     }
21958     #endif
21959     args = PyTuple_New(2);
21960     if (unlikely(!args)) goto done;
21961     Py_INCREF(arg1);
21962     PyTuple_SET_ITEM(args, 0, arg1);
21963     Py_INCREF(arg2);
21964     PyTuple_SET_ITEM(args, 1, arg2);
21965     Py_INCREF(function);
21966     result = __Pyx_PyObject_Call(function, args, NULL);
21967     Py_DECREF(args);
21968     Py_DECREF(function);
21969 done:
21970     return result;
21971 }
21972 
21973 /* PyObjectCallMethO */
21974 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)21975 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
21976     PyObject *self, *result;
21977     PyCFunction cfunc;
21978     cfunc = PyCFunction_GET_FUNCTION(func);
21979     self = PyCFunction_GET_SELF(func);
21980     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
21981         return NULL;
21982     result = cfunc(self, arg);
21983     Py_LeaveRecursiveCall();
21984     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
21985         PyErr_SetString(
21986             PyExc_SystemError,
21987             "NULL result without error in PyObject_Call");
21988     }
21989     return result;
21990 }
21991 #endif
21992 
21993 /* PyObjectCallOneArg */
21994 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)21995 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
21996     PyObject *result;
21997     PyObject *args = PyTuple_New(1);
21998     if (unlikely(!args)) return NULL;
21999     Py_INCREF(arg);
22000     PyTuple_SET_ITEM(args, 0, arg);
22001     result = __Pyx_PyObject_Call(func, args, NULL);
22002     Py_DECREF(args);
22003     return result;
22004 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)22005 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22006 #if CYTHON_FAST_PYCALL
22007     if (PyFunction_Check(func)) {
22008         return __Pyx_PyFunction_FastCall(func, &arg, 1);
22009     }
22010 #endif
22011     if (likely(PyCFunction_Check(func))) {
22012         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
22013             return __Pyx_PyObject_CallMethO(func, arg);
22014 #if CYTHON_FAST_PYCCALL
22015         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
22016             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
22017 #endif
22018         }
22019     }
22020     return __Pyx__PyObject_CallOneArg(func, arg);
22021 }
22022 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)22023 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22024     PyObject *result;
22025     PyObject *args = PyTuple_Pack(1, arg);
22026     if (unlikely(!args)) return NULL;
22027     result = __Pyx_PyObject_Call(func, args, NULL);
22028     Py_DECREF(args);
22029     return result;
22030 }
22031 #endif
22032 
22033 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)22034 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
22035 #if CYTHON_COMPILING_IN_PYPY
22036     return PyObject_RichCompareBool(s1, s2, equals);
22037 #else
22038     if (s1 == s2) {
22039         return (equals == Py_EQ);
22040     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
22041         const char *ps1, *ps2;
22042         Py_ssize_t length = PyBytes_GET_SIZE(s1);
22043         if (length != PyBytes_GET_SIZE(s2))
22044             return (equals == Py_NE);
22045         ps1 = PyBytes_AS_STRING(s1);
22046         ps2 = PyBytes_AS_STRING(s2);
22047         if (ps1[0] != ps2[0]) {
22048             return (equals == Py_NE);
22049         } else if (length == 1) {
22050             return (equals == Py_EQ);
22051         } else {
22052             int result;
22053 #if CYTHON_USE_UNICODE_INTERNALS
22054             Py_hash_t hash1, hash2;
22055             hash1 = ((PyBytesObject*)s1)->ob_shash;
22056             hash2 = ((PyBytesObject*)s2)->ob_shash;
22057             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
22058                 return (equals == Py_NE);
22059             }
22060 #endif
22061             result = memcmp(ps1, ps2, (size_t)length);
22062             return (equals == Py_EQ) ? (result == 0) : (result != 0);
22063         }
22064     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
22065         return (equals == Py_NE);
22066     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
22067         return (equals == Py_NE);
22068     } else {
22069         int result;
22070         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
22071         if (!py_result)
22072             return -1;
22073         result = __Pyx_PyObject_IsTrue(py_result);
22074         Py_DECREF(py_result);
22075         return result;
22076     }
22077 #endif
22078 }
22079 
22080 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)22081 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
22082 #if CYTHON_COMPILING_IN_PYPY
22083     return PyObject_RichCompareBool(s1, s2, equals);
22084 #else
22085 #if PY_MAJOR_VERSION < 3
22086     PyObject* owned_ref = NULL;
22087 #endif
22088     int s1_is_unicode, s2_is_unicode;
22089     if (s1 == s2) {
22090         goto return_eq;
22091     }
22092     s1_is_unicode = PyUnicode_CheckExact(s1);
22093     s2_is_unicode = PyUnicode_CheckExact(s2);
22094 #if PY_MAJOR_VERSION < 3
22095     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
22096         owned_ref = PyUnicode_FromObject(s2);
22097         if (unlikely(!owned_ref))
22098             return -1;
22099         s2 = owned_ref;
22100         s2_is_unicode = 1;
22101     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
22102         owned_ref = PyUnicode_FromObject(s1);
22103         if (unlikely(!owned_ref))
22104             return -1;
22105         s1 = owned_ref;
22106         s1_is_unicode = 1;
22107     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
22108         return __Pyx_PyBytes_Equals(s1, s2, equals);
22109     }
22110 #endif
22111     if (s1_is_unicode & s2_is_unicode) {
22112         Py_ssize_t length;
22113         int kind;
22114         void *data1, *data2;
22115         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
22116             return -1;
22117         length = __Pyx_PyUnicode_GET_LENGTH(s1);
22118         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
22119             goto return_ne;
22120         }
22121 #if CYTHON_USE_UNICODE_INTERNALS
22122         {
22123             Py_hash_t hash1, hash2;
22124         #if CYTHON_PEP393_ENABLED
22125             hash1 = ((PyASCIIObject*)s1)->hash;
22126             hash2 = ((PyASCIIObject*)s2)->hash;
22127         #else
22128             hash1 = ((PyUnicodeObject*)s1)->hash;
22129             hash2 = ((PyUnicodeObject*)s2)->hash;
22130         #endif
22131             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
22132                 goto return_ne;
22133             }
22134         }
22135 #endif
22136         kind = __Pyx_PyUnicode_KIND(s1);
22137         if (kind != __Pyx_PyUnicode_KIND(s2)) {
22138             goto return_ne;
22139         }
22140         data1 = __Pyx_PyUnicode_DATA(s1);
22141         data2 = __Pyx_PyUnicode_DATA(s2);
22142         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
22143             goto return_ne;
22144         } else if (length == 1) {
22145             goto return_eq;
22146         } else {
22147             int result = memcmp(data1, data2, (size_t)(length * kind));
22148             #if PY_MAJOR_VERSION < 3
22149             Py_XDECREF(owned_ref);
22150             #endif
22151             return (equals == Py_EQ) ? (result == 0) : (result != 0);
22152         }
22153     } else if ((s1 == Py_None) & s2_is_unicode) {
22154         goto return_ne;
22155     } else if ((s2 == Py_None) & s1_is_unicode) {
22156         goto return_ne;
22157     } else {
22158         int result;
22159         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
22160         #if PY_MAJOR_VERSION < 3
22161         Py_XDECREF(owned_ref);
22162         #endif
22163         if (!py_result)
22164             return -1;
22165         result = __Pyx_PyObject_IsTrue(py_result);
22166         Py_DECREF(py_result);
22167         return result;
22168     }
22169 return_eq:
22170     #if PY_MAJOR_VERSION < 3
22171     Py_XDECREF(owned_ref);
22172     #endif
22173     return (equals == Py_EQ);
22174 return_ne:
22175     #if PY_MAJOR_VERSION < 3
22176     Py_XDECREF(owned_ref);
22177     #endif
22178     return (equals == Py_NE);
22179 #endif
22180 }
22181 
22182 /* None */
__Pyx_div_Py_ssize_t(Py_ssize_t a,Py_ssize_t b)22183 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
22184     Py_ssize_t q = a / b;
22185     Py_ssize_t r = a - q*b;
22186     q -= ((r != 0) & ((r ^ b) < 0));
22187     return q;
22188 }
22189 
22190 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)22191 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
22192 #if CYTHON_USE_TYPE_SLOTS
22193 #if PY_MAJOR_VERSION >= 3
22194     if (likely(PyUnicode_Check(n)))
22195 #else
22196     if (likely(PyString_Check(n)))
22197 #endif
22198         return __Pyx_PyObject_GetAttrStr(o, n);
22199 #endif
22200     return PyObject_GetAttr(o, n);
22201 }
22202 
22203 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)22204 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
22205     PyObject *r;
22206     if (!j) return NULL;
22207     r = PyObject_GetItem(o, j);
22208     Py_DECREF(j);
22209     return r;
22210 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)22211 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
22212                                                               CYTHON_NCP_UNUSED int wraparound,
22213                                                               CYTHON_NCP_UNUSED int boundscheck) {
22214 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22215     Py_ssize_t wrapped_i = i;
22216     if (wraparound & unlikely(i < 0)) {
22217         wrapped_i += PyList_GET_SIZE(o);
22218     }
22219     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
22220         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
22221         Py_INCREF(r);
22222         return r;
22223     }
22224     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
22225 #else
22226     return PySequence_GetItem(o, i);
22227 #endif
22228 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)22229 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
22230                                                               CYTHON_NCP_UNUSED int wraparound,
22231                                                               CYTHON_NCP_UNUSED int boundscheck) {
22232 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22233     Py_ssize_t wrapped_i = i;
22234     if (wraparound & unlikely(i < 0)) {
22235         wrapped_i += PyTuple_GET_SIZE(o);
22236     }
22237     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
22238         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
22239         Py_INCREF(r);
22240         return r;
22241     }
22242     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
22243 #else
22244     return PySequence_GetItem(o, i);
22245 #endif
22246 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)22247 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
22248                                                      CYTHON_NCP_UNUSED int wraparound,
22249                                                      CYTHON_NCP_UNUSED int boundscheck) {
22250 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
22251     if (is_list || PyList_CheckExact(o)) {
22252         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
22253         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
22254             PyObject *r = PyList_GET_ITEM(o, n);
22255             Py_INCREF(r);
22256             return r;
22257         }
22258     }
22259     else if (PyTuple_CheckExact(o)) {
22260         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
22261         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
22262             PyObject *r = PyTuple_GET_ITEM(o, n);
22263             Py_INCREF(r);
22264             return r;
22265         }
22266     } else {
22267         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
22268         if (likely(m && m->sq_item)) {
22269             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
22270                 Py_ssize_t l = m->sq_length(o);
22271                 if (likely(l >= 0)) {
22272                     i += l;
22273                 } else {
22274                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
22275                         return NULL;
22276                     PyErr_Clear();
22277                 }
22278             }
22279             return m->sq_item(o, i);
22280         }
22281     }
22282 #else
22283     if (is_list || PySequence_Check(o)) {
22284         return PySequence_GetItem(o, i);
22285     }
22286 #endif
22287     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
22288 }
22289 
22290 /* ObjectGetItem */
22291 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)22292 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
22293     PyObject *runerr;
22294     Py_ssize_t key_value;
22295     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
22296     if (unlikely(!(m && m->sq_item))) {
22297         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
22298         return NULL;
22299     }
22300     key_value = __Pyx_PyIndex_AsSsize_t(index);
22301     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
22302         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
22303     }
22304     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
22305         PyErr_Clear();
22306         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
22307     }
22308     return NULL;
22309 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)22310 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
22311     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
22312     if (likely(m && m->mp_subscript)) {
22313         return m->mp_subscript(obj, key);
22314     }
22315     return __Pyx_PyObject_GetIndex(obj, key);
22316 }
22317 #endif
22318 
22319 /* 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))22320 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
22321          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
22322          const char* encoding, const char* errors,
22323          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
22324     Py_ssize_t length;
22325     if (unlikely((start < 0) | (stop < 0))) {
22326         size_t slen = strlen(cstring);
22327         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
22328             PyErr_SetString(PyExc_OverflowError,
22329                             "c-string too long to convert to Python");
22330             return NULL;
22331         }
22332         length = (Py_ssize_t) slen;
22333         if (start < 0) {
22334             start += length;
22335             if (start < 0)
22336                 start = 0;
22337         }
22338         if (stop < 0)
22339             stop += length;
22340     }
22341     if (unlikely(stop <= start))
22342         return __Pyx_NewRef(__pyx_empty_unicode);
22343     length = stop - start;
22344     cstring += start;
22345     if (decode_func) {
22346         return decode_func(cstring, length, errors);
22347     } else {
22348         return PyUnicode_Decode(cstring, length, encoding, errors);
22349     }
22350 }
22351 
22352 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)22353 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
22354     __Pyx_PyThreadState_declare
22355     __Pyx_PyThreadState_assign
22356     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
22357         return NULL;
22358     __Pyx_PyErr_Clear();
22359     Py_INCREF(d);
22360     return d;
22361 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)22362 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
22363     PyObject *r = __Pyx_GetAttr(o, n);
22364     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
22365 }
22366 
22367 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)22368 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
22369     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
22370 }
22371 
22372 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)22373 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
22374     if (unlikely(!type)) {
22375         PyErr_SetString(PyExc_SystemError, "Missing type object");
22376         return 0;
22377     }
22378     if (likely(__Pyx_TypeCheck(obj, type)))
22379         return 1;
22380     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
22381                  Py_TYPE(obj)->tp_name, type->tp_name);
22382     return 0;
22383 }
22384 
22385 /* SwapException */
22386 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)22387 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22388     PyObject *tmp_type, *tmp_value, *tmp_tb;
22389     #if CYTHON_USE_EXC_INFO_STACK
22390     _PyErr_StackItem *exc_info = tstate->exc_info;
22391     tmp_type = exc_info->exc_type;
22392     tmp_value = exc_info->exc_value;
22393     tmp_tb = exc_info->exc_traceback;
22394     exc_info->exc_type = *type;
22395     exc_info->exc_value = *value;
22396     exc_info->exc_traceback = *tb;
22397     #else
22398     tmp_type = tstate->exc_type;
22399     tmp_value = tstate->exc_value;
22400     tmp_tb = tstate->exc_traceback;
22401     tstate->exc_type = *type;
22402     tstate->exc_value = *value;
22403     tstate->exc_traceback = *tb;
22404     #endif
22405     *type = tmp_type;
22406     *value = tmp_value;
22407     *tb = tmp_tb;
22408 }
22409 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)22410 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
22411     PyObject *tmp_type, *tmp_value, *tmp_tb;
22412     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
22413     PyErr_SetExcInfo(*type, *value, *tb);
22414     *type = tmp_type;
22415     *value = tmp_value;
22416     *tb = tmp_tb;
22417 }
22418 #endif
22419 
22420 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)22421 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
22422     PyObject *empty_list = 0;
22423     PyObject *module = 0;
22424     PyObject *global_dict = 0;
22425     PyObject *empty_dict = 0;
22426     PyObject *list;
22427     #if PY_MAJOR_VERSION < 3
22428     PyObject *py_import;
22429     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
22430     if (!py_import)
22431         goto bad;
22432     #endif
22433     if (from_list)
22434         list = from_list;
22435     else {
22436         empty_list = PyList_New(0);
22437         if (!empty_list)
22438             goto bad;
22439         list = empty_list;
22440     }
22441     global_dict = PyModule_GetDict(__pyx_m);
22442     if (!global_dict)
22443         goto bad;
22444     empty_dict = PyDict_New();
22445     if (!empty_dict)
22446         goto bad;
22447     {
22448         #if PY_MAJOR_VERSION >= 3
22449         if (level == -1) {
22450             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
22451                 module = PyImport_ImportModuleLevelObject(
22452                     name, global_dict, empty_dict, list, 1);
22453                 if (!module) {
22454                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
22455                         goto bad;
22456                     PyErr_Clear();
22457                 }
22458             }
22459             level = 0;
22460         }
22461         #endif
22462         if (!module) {
22463             #if PY_MAJOR_VERSION < 3
22464             PyObject *py_level = PyInt_FromLong(level);
22465             if (!py_level)
22466                 goto bad;
22467             module = PyObject_CallFunctionObjArgs(py_import,
22468                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
22469             Py_DECREF(py_level);
22470             #else
22471             module = PyImport_ImportModuleLevelObject(
22472                 name, global_dict, empty_dict, list, level);
22473             #endif
22474         }
22475     }
22476 bad:
22477     #if PY_MAJOR_VERSION < 3
22478     Py_XDECREF(py_import);
22479     #endif
22480     Py_XDECREF(empty_list);
22481     Py_XDECREF(empty_dict);
22482     return module;
22483 }
22484 
22485 /* FastTypeChecks */
22486 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)22487 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
22488     while (a) {
22489         a = a->tp_base;
22490         if (a == b)
22491             return 1;
22492     }
22493     return b == &PyBaseObject_Type;
22494 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)22495 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
22496     PyObject *mro;
22497     if (a == b) return 1;
22498     mro = a->tp_mro;
22499     if (likely(mro)) {
22500         Py_ssize_t i, n;
22501         n = PyTuple_GET_SIZE(mro);
22502         for (i = 0; i < n; i++) {
22503             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
22504                 return 1;
22505         }
22506         return 0;
22507     }
22508     return __Pyx_InBases(a, b);
22509 }
22510 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)22511 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
22512     PyObject *exception, *value, *tb;
22513     int res;
22514     __Pyx_PyThreadState_declare
22515     __Pyx_PyThreadState_assign
22516     __Pyx_ErrFetch(&exception, &value, &tb);
22517     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
22518     if (unlikely(res == -1)) {
22519         PyErr_WriteUnraisable(err);
22520         res = 0;
22521     }
22522     if (!res) {
22523         res = PyObject_IsSubclass(err, exc_type2);
22524         if (unlikely(res == -1)) {
22525             PyErr_WriteUnraisable(err);
22526             res = 0;
22527         }
22528     }
22529     __Pyx_ErrRestore(exception, value, tb);
22530     return res;
22531 }
22532 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)22533 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
22534     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
22535     if (!res) {
22536         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
22537     }
22538     return res;
22539 }
22540 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)22541 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
22542     Py_ssize_t i, n;
22543     assert(PyExceptionClass_Check(exc_type));
22544     n = PyTuple_GET_SIZE(tuple);
22545 #if PY_MAJOR_VERSION >= 3
22546     for (i=0; i<n; i++) {
22547         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
22548     }
22549 #endif
22550     for (i=0; i<n; i++) {
22551         PyObject *t = PyTuple_GET_ITEM(tuple, i);
22552         #if PY_MAJOR_VERSION < 3
22553         if (likely(exc_type == t)) return 1;
22554         #endif
22555         if (likely(PyExceptionClass_Check(t))) {
22556             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
22557         } else {
22558         }
22559     }
22560     return 0;
22561 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)22562 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
22563     if (likely(err == exc_type)) return 1;
22564     if (likely(PyExceptionClass_Check(err))) {
22565         if (likely(PyExceptionClass_Check(exc_type))) {
22566             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
22567         } else if (likely(PyTuple_Check(exc_type))) {
22568             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
22569         } else {
22570         }
22571     }
22572     return PyErr_GivenExceptionMatches(err, exc_type);
22573 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)22574 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
22575     assert(PyExceptionClass_Check(exc_type1));
22576     assert(PyExceptionClass_Check(exc_type2));
22577     if (likely(err == exc_type1 || err == exc_type2)) return 1;
22578     if (likely(PyExceptionClass_Check(err))) {
22579         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
22580     }
22581     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
22582 }
22583 #endif
22584 
22585 /* PyIntBinop */
22586 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)22587 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
22588     (void)inplace;
22589     (void)zerodivision_check;
22590     #if PY_MAJOR_VERSION < 3
22591     if (likely(PyInt_CheckExact(op1))) {
22592         const long b = intval;
22593         long x;
22594         long a = PyInt_AS_LONG(op1);
22595             x = (long)((unsigned long)a + b);
22596             if (likely((x^a) >= 0 || (x^b) >= 0))
22597                 return PyInt_FromLong(x);
22598             return PyLong_Type.tp_as_number->nb_add(op1, op2);
22599     }
22600     #endif
22601     #if CYTHON_USE_PYLONG_INTERNALS
22602     if (likely(PyLong_CheckExact(op1))) {
22603         const long b = intval;
22604         long a, x;
22605 #ifdef HAVE_LONG_LONG
22606         const PY_LONG_LONG llb = intval;
22607         PY_LONG_LONG lla, llx;
22608 #endif
22609         const digit* digits = ((PyLongObject*)op1)->ob_digit;
22610         const Py_ssize_t size = Py_SIZE(op1);
22611         if (likely(__Pyx_sst_abs(size) <= 1)) {
22612             a = likely(size) ? digits[0] : 0;
22613             if (size == -1) a = -a;
22614         } else {
22615             switch (size) {
22616                 case -2:
22617                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
22618                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22619                         break;
22620 #ifdef HAVE_LONG_LONG
22621                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
22622                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22623                         goto long_long;
22624 #endif
22625                     }
22626                     CYTHON_FALLTHROUGH;
22627                 case 2:
22628                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
22629                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22630                         break;
22631 #ifdef HAVE_LONG_LONG
22632                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
22633                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22634                         goto long_long;
22635 #endif
22636                     }
22637                     CYTHON_FALLTHROUGH;
22638                 case -3:
22639                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
22640                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22641                         break;
22642 #ifdef HAVE_LONG_LONG
22643                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
22644                         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]));
22645                         goto long_long;
22646 #endif
22647                     }
22648                     CYTHON_FALLTHROUGH;
22649                 case 3:
22650                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
22651                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22652                         break;
22653 #ifdef HAVE_LONG_LONG
22654                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
22655                         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]));
22656                         goto long_long;
22657 #endif
22658                     }
22659                     CYTHON_FALLTHROUGH;
22660                 case -4:
22661                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
22662                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22663                         break;
22664 #ifdef HAVE_LONG_LONG
22665                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
22666                         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]));
22667                         goto long_long;
22668 #endif
22669                     }
22670                     CYTHON_FALLTHROUGH;
22671                 case 4:
22672                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
22673                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22674                         break;
22675 #ifdef HAVE_LONG_LONG
22676                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
22677                         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]));
22678                         goto long_long;
22679 #endif
22680                     }
22681                     CYTHON_FALLTHROUGH;
22682                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
22683             }
22684         }
22685                 x = a + b;
22686             return PyLong_FromLong(x);
22687 #ifdef HAVE_LONG_LONG
22688         long_long:
22689                 llx = lla + llb;
22690             return PyLong_FromLongLong(llx);
22691 #endif
22692 
22693 
22694     }
22695     #endif
22696     if (PyFloat_CheckExact(op1)) {
22697         const long b = intval;
22698         double a = PyFloat_AS_DOUBLE(op1);
22699             double result;
22700             PyFPE_START_PROTECT("add", return NULL)
22701             result = ((double)a) + (double)b;
22702             PyFPE_END_PROTECT(result)
22703             return PyFloat_FromDouble(result);
22704     }
22705     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
22706 }
22707 #endif
22708 
22709 /* None */
__Pyx_RaiseUnboundLocalError(const char * varname)22710 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
22711     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
22712 }
22713 
22714 /* None */
__Pyx_div_long(long a,long b)22715 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
22716     long q = a / b;
22717     long r = a - q*b;
22718     q -= ((r != 0) & ((r ^ b) < 0));
22719     return q;
22720 }
22721 
22722 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)22723 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
22724     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
22725     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
22726         PyErr_Format(PyExc_ImportError,
22727         #if PY_MAJOR_VERSION < 3
22728             "cannot import name %.230s", PyString_AS_STRING(name));
22729         #else
22730             "cannot import name %S", name);
22731         #endif
22732     }
22733     return value;
22734 }
22735 
22736 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)22737 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
22738     PyObject *r;
22739     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
22740         PyErr_SetString(PyExc_TypeError,
22741                         "hasattr(): attribute name must be string");
22742         return -1;
22743     }
22744     r = __Pyx_GetAttr(o, n);
22745     if (unlikely(!r)) {
22746         PyErr_Clear();
22747         return 0;
22748     } else {
22749         Py_DECREF(r);
22750         return 1;
22751     }
22752 }
22753 
22754 /* PyObject_GenericGetAttrNoDict */
22755 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)22756 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
22757     PyErr_Format(PyExc_AttributeError,
22758 #if PY_MAJOR_VERSION >= 3
22759                  "'%.50s' object has no attribute '%U'",
22760                  tp->tp_name, attr_name);
22761 #else
22762                  "'%.50s' object has no attribute '%.400s'",
22763                  tp->tp_name, PyString_AS_STRING(attr_name));
22764 #endif
22765     return NULL;
22766 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)22767 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
22768     PyObject *descr;
22769     PyTypeObject *tp = Py_TYPE(obj);
22770     if (unlikely(!PyString_Check(attr_name))) {
22771         return PyObject_GenericGetAttr(obj, attr_name);
22772     }
22773     assert(!tp->tp_dictoffset);
22774     descr = _PyType_Lookup(tp, attr_name);
22775     if (unlikely(!descr)) {
22776         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
22777     }
22778     Py_INCREF(descr);
22779     #if PY_MAJOR_VERSION < 3
22780     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
22781     #endif
22782     {
22783         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
22784         if (unlikely(f)) {
22785             PyObject *res = f(descr, obj, (PyObject *)tp);
22786             Py_DECREF(descr);
22787             return res;
22788         }
22789     }
22790     return descr;
22791 }
22792 #endif
22793 
22794 /* PyObject_GenericGetAttr */
22795 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)22796 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
22797     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
22798         return PyObject_GenericGetAttr(obj, attr_name);
22799     }
22800     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
22801 }
22802 #endif
22803 
22804 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)22805 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
22806 #if PY_VERSION_HEX >= 0x02070000
22807     PyObject *ob = PyCapsule_New(vtable, 0, 0);
22808 #else
22809     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
22810 #endif
22811     if (!ob)
22812         goto bad;
22813     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
22814         goto bad;
22815     Py_DECREF(ob);
22816     return 0;
22817 bad:
22818     Py_XDECREF(ob);
22819     return -1;
22820 }
22821 
22822 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)22823 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
22824     __Pyx_PyThreadState_declare
22825     __Pyx_PyThreadState_assign
22826     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
22827         __Pyx_PyErr_Clear();
22828 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)22829 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
22830     PyObject *result;
22831 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
22832     PyTypeObject* tp = Py_TYPE(obj);
22833     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
22834         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
22835     }
22836 #endif
22837     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
22838     if (unlikely(!result)) {
22839         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
22840     }
22841     return result;
22842 }
22843 
22844 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)22845 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
22846   int ret;
22847   PyObject *name_attr;
22848   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
22849   if (likely(name_attr)) {
22850       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
22851   } else {
22852       ret = -1;
22853   }
22854   if (unlikely(ret < 0)) {
22855       PyErr_Clear();
22856       ret = 0;
22857   }
22858   Py_XDECREF(name_attr);
22859   return ret;
22860 }
__Pyx_setup_reduce(PyObject * type_obj)22861 static int __Pyx_setup_reduce(PyObject* type_obj) {
22862     int ret = 0;
22863     PyObject *object_reduce = NULL;
22864     PyObject *object_reduce_ex = NULL;
22865     PyObject *reduce = NULL;
22866     PyObject *reduce_ex = NULL;
22867     PyObject *reduce_cython = NULL;
22868     PyObject *setstate = NULL;
22869     PyObject *setstate_cython = NULL;
22870 #if CYTHON_USE_PYTYPE_LOOKUP
22871     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
22872 #else
22873     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
22874 #endif
22875 #if CYTHON_USE_PYTYPE_LOOKUP
22876     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
22877 #else
22878     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
22879 #endif
22880     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
22881     if (reduce_ex == object_reduce_ex) {
22882 #if CYTHON_USE_PYTYPE_LOOKUP
22883         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
22884 #else
22885         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
22886 #endif
22887         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
22888         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
22889             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
22890             if (likely(reduce_cython)) {
22891                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
22892                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
22893             } else if (reduce == object_reduce || PyErr_Occurred()) {
22894                 goto __PYX_BAD;
22895             }
22896             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
22897             if (!setstate) PyErr_Clear();
22898             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
22899                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
22900                 if (likely(setstate_cython)) {
22901                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
22902                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
22903                 } else if (!setstate || PyErr_Occurred()) {
22904                     goto __PYX_BAD;
22905                 }
22906             }
22907             PyType_Modified((PyTypeObject*)type_obj);
22908         }
22909     }
22910     goto __PYX_GOOD;
22911 __PYX_BAD:
22912     if (!PyErr_Occurred())
22913         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
22914     ret = -1;
22915 __PYX_GOOD:
22916 #if !CYTHON_USE_PYTYPE_LOOKUP
22917     Py_XDECREF(object_reduce);
22918     Py_XDECREF(object_reduce_ex);
22919 #endif
22920     Py_XDECREF(reduce);
22921     Py_XDECREF(reduce_ex);
22922     Py_XDECREF(reduce_cython);
22923     Py_XDECREF(setstate);
22924     Py_XDECREF(setstate_cython);
22925     return ret;
22926 }
22927 
22928 /* TypeImport */
22929 #ifndef __PYX_HAVE_RT_ImportType
22930 #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)22931 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
22932     size_t size, enum __Pyx_ImportType_CheckSize check_size)
22933 {
22934     PyObject *result = 0;
22935     char warning[200];
22936     Py_ssize_t basicsize;
22937 #ifdef Py_LIMITED_API
22938     PyObject *py_basicsize;
22939 #endif
22940     result = PyObject_GetAttrString(module, class_name);
22941     if (!result)
22942         goto bad;
22943     if (!PyType_Check(result)) {
22944         PyErr_Format(PyExc_TypeError,
22945             "%.200s.%.200s is not a type object",
22946             module_name, class_name);
22947         goto bad;
22948     }
22949 #ifndef Py_LIMITED_API
22950     basicsize = ((PyTypeObject *)result)->tp_basicsize;
22951 #else
22952     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
22953     if (!py_basicsize)
22954         goto bad;
22955     basicsize = PyLong_AsSsize_t(py_basicsize);
22956     Py_DECREF(py_basicsize);
22957     py_basicsize = 0;
22958     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
22959         goto bad;
22960 #endif
22961     if ((size_t)basicsize < size) {
22962         PyErr_Format(PyExc_ValueError,
22963             "%.200s.%.200s size changed, may indicate binary incompatibility. "
22964             "Expected %zd from C header, got %zd from PyObject",
22965             module_name, class_name, size, basicsize);
22966         goto bad;
22967     }
22968     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
22969         PyErr_Format(PyExc_ValueError,
22970             "%.200s.%.200s size changed, may indicate binary incompatibility. "
22971             "Expected %zd from C header, got %zd from PyObject",
22972             module_name, class_name, size, basicsize);
22973         goto bad;
22974     }
22975     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
22976         PyOS_snprintf(warning, sizeof(warning),
22977             "%s.%s size changed, may indicate binary incompatibility. "
22978             "Expected %zd from C header, got %zd from PyObject",
22979             module_name, class_name, size, basicsize);
22980         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
22981     }
22982     return (PyTypeObject *)result;
22983 bad:
22984     Py_XDECREF(result);
22985     return NULL;
22986 }
22987 #endif
22988 
22989 /* FetchCommonType */
__Pyx_FetchCommonType(PyTypeObject * type)22990 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
22991     PyObject* fake_module;
22992     PyTypeObject* cached_type = NULL;
22993     fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
22994     if (!fake_module) return NULL;
22995     Py_INCREF(fake_module);
22996     cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
22997     if (cached_type) {
22998         if (!PyType_Check((PyObject*)cached_type)) {
22999             PyErr_Format(PyExc_TypeError,
23000                 "Shared Cython type %.200s is not a type object",
23001                 type->tp_name);
23002             goto bad;
23003         }
23004         if (cached_type->tp_basicsize != type->tp_basicsize) {
23005             PyErr_Format(PyExc_TypeError,
23006                 "Shared Cython type %.200s has the wrong size, try recompiling",
23007                 type->tp_name);
23008             goto bad;
23009         }
23010     } else {
23011         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
23012         PyErr_Clear();
23013         if (PyType_Ready(type) < 0) goto bad;
23014         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
23015             goto bad;
23016         Py_INCREF(type);
23017         cached_type = type;
23018     }
23019 done:
23020     Py_DECREF(fake_module);
23021     return cached_type;
23022 bad:
23023     Py_XDECREF(cached_type);
23024     cached_type = NULL;
23025     goto done;
23026 }
23027 
23028 /* CythonFunctionShared */
23029 #include <structmember.h>
23030 static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * closure)23031 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
23032 {
23033     if (unlikely(op->func_doc == NULL)) {
23034         if (op->func.m_ml->ml_doc) {
23035 #if PY_MAJOR_VERSION >= 3
23036             op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
23037 #else
23038             op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
23039 #endif
23040             if (unlikely(op->func_doc == NULL))
23041                 return NULL;
23042         } else {
23043             Py_INCREF(Py_None);
23044             return Py_None;
23045         }
23046     }
23047     Py_INCREF(op->func_doc);
23048     return op->func_doc;
23049 }
23050 static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23051 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
23052 {
23053     PyObject *tmp = op->func_doc;
23054     if (value == NULL) {
23055         value = Py_None;
23056     }
23057     Py_INCREF(value);
23058     op->func_doc = value;
23059     Py_XDECREF(tmp);
23060     return 0;
23061 }
23062 static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23063 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
23064 {
23065     if (unlikely(op->func_name == NULL)) {
23066 #if PY_MAJOR_VERSION >= 3
23067         op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
23068 #else
23069         op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
23070 #endif
23071         if (unlikely(op->func_name == NULL))
23072             return NULL;
23073     }
23074     Py_INCREF(op->func_name);
23075     return op->func_name;
23076 }
23077 static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23078 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
23079 {
23080     PyObject *tmp;
23081 #if PY_MAJOR_VERSION >= 3
23082     if (unlikely(value == NULL || !PyUnicode_Check(value)))
23083 #else
23084     if (unlikely(value == NULL || !PyString_Check(value)))
23085 #endif
23086     {
23087         PyErr_SetString(PyExc_TypeError,
23088                         "__name__ must be set to a string object");
23089         return -1;
23090     }
23091     tmp = op->func_name;
23092     Py_INCREF(value);
23093     op->func_name = value;
23094     Py_XDECREF(tmp);
23095     return 0;
23096 }
23097 static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23098 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
23099 {
23100     Py_INCREF(op->func_qualname);
23101     return op->func_qualname;
23102 }
23103 static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23104 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
23105 {
23106     PyObject *tmp;
23107 #if PY_MAJOR_VERSION >= 3
23108     if (unlikely(value == NULL || !PyUnicode_Check(value)))
23109 #else
23110     if (unlikely(value == NULL || !PyString_Check(value)))
23111 #endif
23112     {
23113         PyErr_SetString(PyExc_TypeError,
23114                         "__qualname__ must be set to a string object");
23115         return -1;
23116     }
23117     tmp = op->func_qualname;
23118     Py_INCREF(value);
23119     op->func_qualname = value;
23120     Py_XDECREF(tmp);
23121     return 0;
23122 }
23123 static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject * m,CYTHON_UNUSED void * closure)23124 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
23125 {
23126     PyObject *self;
23127     self = m->func_closure;
23128     if (self == NULL)
23129         self = Py_None;
23130     Py_INCREF(self);
23131     return self;
23132 }
23133 static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23134 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
23135 {
23136     if (unlikely(op->func_dict == NULL)) {
23137         op->func_dict = PyDict_New();
23138         if (unlikely(op->func_dict == NULL))
23139             return NULL;
23140     }
23141     Py_INCREF(op->func_dict);
23142     return op->func_dict;
23143 }
23144 static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23145 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
23146 {
23147     PyObject *tmp;
23148     if (unlikely(value == NULL)) {
23149         PyErr_SetString(PyExc_TypeError,
23150                "function's dictionary may not be deleted");
23151         return -1;
23152     }
23153     if (unlikely(!PyDict_Check(value))) {
23154         PyErr_SetString(PyExc_TypeError,
23155                "setting function's dictionary to a non-dict");
23156         return -1;
23157     }
23158     tmp = op->func_dict;
23159     Py_INCREF(value);
23160     op->func_dict = value;
23161     Py_XDECREF(tmp);
23162     return 0;
23163 }
23164 static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23165 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
23166 {
23167     Py_INCREF(op->func_globals);
23168     return op->func_globals;
23169 }
23170 static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23171 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
23172 {
23173     Py_INCREF(Py_None);
23174     return Py_None;
23175 }
23176 static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23177 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
23178 {
23179     PyObject* result = (op->func_code) ? op->func_code : Py_None;
23180     Py_INCREF(result);
23181     return result;
23182 }
23183 static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject * op)23184 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
23185     int result = 0;
23186     PyObject *res = op->defaults_getter((PyObject *) op);
23187     if (unlikely(!res))
23188         return -1;
23189     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23190     op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
23191     Py_INCREF(op->defaults_tuple);
23192     op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
23193     Py_INCREF(op->defaults_kwdict);
23194     #else
23195     op->defaults_tuple = PySequence_ITEM(res, 0);
23196     if (unlikely(!op->defaults_tuple)) result = -1;
23197     else {
23198         op->defaults_kwdict = PySequence_ITEM(res, 1);
23199         if (unlikely(!op->defaults_kwdict)) result = -1;
23200     }
23201     #endif
23202     Py_DECREF(res);
23203     return result;
23204 }
23205 static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23206 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
23207     PyObject* tmp;
23208     if (!value) {
23209         value = Py_None;
23210     } else if (value != Py_None && !PyTuple_Check(value)) {
23211         PyErr_SetString(PyExc_TypeError,
23212                         "__defaults__ must be set to a tuple object");
23213         return -1;
23214     }
23215     Py_INCREF(value);
23216     tmp = op->defaults_tuple;
23217     op->defaults_tuple = value;
23218     Py_XDECREF(tmp);
23219     return 0;
23220 }
23221 static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23222 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
23223     PyObject* result = op->defaults_tuple;
23224     if (unlikely(!result)) {
23225         if (op->defaults_getter) {
23226             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
23227             result = op->defaults_tuple;
23228         } else {
23229             result = Py_None;
23230         }
23231     }
23232     Py_INCREF(result);
23233     return result;
23234 }
23235 static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23236 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
23237     PyObject* tmp;
23238     if (!value) {
23239         value = Py_None;
23240     } else if (value != Py_None && !PyDict_Check(value)) {
23241         PyErr_SetString(PyExc_TypeError,
23242                         "__kwdefaults__ must be set to a dict object");
23243         return -1;
23244     }
23245     Py_INCREF(value);
23246     tmp = op->defaults_kwdict;
23247     op->defaults_kwdict = value;
23248     Py_XDECREF(tmp);
23249     return 0;
23250 }
23251 static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23252 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
23253     PyObject* result = op->defaults_kwdict;
23254     if (unlikely(!result)) {
23255         if (op->defaults_getter) {
23256             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
23257             result = op->defaults_kwdict;
23258         } else {
23259             result = Py_None;
23260         }
23261     }
23262     Py_INCREF(result);
23263     return result;
23264 }
23265 static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23266 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
23267     PyObject* tmp;
23268     if (!value || value == Py_None) {
23269         value = NULL;
23270     } else if (!PyDict_Check(value)) {
23271         PyErr_SetString(PyExc_TypeError,
23272                         "__annotations__ must be set to a dict object");
23273         return -1;
23274     }
23275     Py_XINCREF(value);
23276     tmp = op->func_annotations;
23277     op->func_annotations = value;
23278     Py_XDECREF(tmp);
23279     return 0;
23280 }
23281 static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23282 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
23283     PyObject* result = op->func_annotations;
23284     if (unlikely(!result)) {
23285         result = PyDict_New();
23286         if (unlikely(!result)) return NULL;
23287         op->func_annotations = result;
23288     }
23289     Py_INCREF(result);
23290     return result;
23291 }
23292 static PyGetSetDef __pyx_CyFunction_getsets[] = {
23293     {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
23294     {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
23295     {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
23296     {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
23297     {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
23298     {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
23299     {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
23300     {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
23301     {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
23302     {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
23303     {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
23304     {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
23305     {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
23306     {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
23307     {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
23308     {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
23309     {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
23310     {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
23311     {0, 0, 0, 0, 0}
23312 };
23313 static PyMemberDef __pyx_CyFunction_members[] = {
23314     {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
23315     {0, 0, 0,  0, 0}
23316 };
23317 static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject * m,CYTHON_UNUSED PyObject * args)23318 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
23319 {
23320 #if PY_MAJOR_VERSION >= 3
23321     return PyUnicode_FromString(m->func.m_ml->ml_name);
23322 #else
23323     return PyString_FromString(m->func.m_ml->ml_name);
23324 #endif
23325 }
23326 static PyMethodDef __pyx_CyFunction_methods[] = {
23327     {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
23328     {0, 0, 0, 0}
23329 };
23330 #if PY_VERSION_HEX < 0x030500A0
23331 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
23332 #else
23333 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
23334 #endif
__Pyx_CyFunction_Init(__pyx_CyFunctionObject * op,PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)23335 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
23336                                        PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
23337     if (unlikely(op == NULL))
23338         return NULL;
23339     op->flags = flags;
23340     __Pyx_CyFunction_weakreflist(op) = NULL;
23341     op->func.m_ml = ml;
23342     op->func.m_self = (PyObject *) op;
23343     Py_XINCREF(closure);
23344     op->func_closure = closure;
23345     Py_XINCREF(module);
23346     op->func.m_module = module;
23347     op->func_dict = NULL;
23348     op->func_name = NULL;
23349     Py_INCREF(qualname);
23350     op->func_qualname = qualname;
23351     op->func_doc = NULL;
23352     op->func_classobj = NULL;
23353     op->func_globals = globals;
23354     Py_INCREF(op->func_globals);
23355     Py_XINCREF(code);
23356     op->func_code = code;
23357     op->defaults_pyobjects = 0;
23358     op->defaults_size = 0;
23359     op->defaults = NULL;
23360     op->defaults_tuple = NULL;
23361     op->defaults_kwdict = NULL;
23362     op->defaults_getter = NULL;
23363     op->func_annotations = NULL;
23364     return (PyObject *) op;
23365 }
23366 static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject * m)23367 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
23368 {
23369     Py_CLEAR(m->func_closure);
23370     Py_CLEAR(m->func.m_module);
23371     Py_CLEAR(m->func_dict);
23372     Py_CLEAR(m->func_name);
23373     Py_CLEAR(m->func_qualname);
23374     Py_CLEAR(m->func_doc);
23375     Py_CLEAR(m->func_globals);
23376     Py_CLEAR(m->func_code);
23377     Py_CLEAR(m->func_classobj);
23378     Py_CLEAR(m->defaults_tuple);
23379     Py_CLEAR(m->defaults_kwdict);
23380     Py_CLEAR(m->func_annotations);
23381     if (m->defaults) {
23382         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
23383         int i;
23384         for (i = 0; i < m->defaults_pyobjects; i++)
23385             Py_XDECREF(pydefaults[i]);
23386         PyObject_Free(m->defaults);
23387         m->defaults = NULL;
23388     }
23389     return 0;
23390 }
__Pyx__CyFunction_dealloc(__pyx_CyFunctionObject * m)23391 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
23392 {
23393     if (__Pyx_CyFunction_weakreflist(m) != NULL)
23394         PyObject_ClearWeakRefs((PyObject *) m);
23395     __Pyx_CyFunction_clear(m);
23396     PyObject_GC_Del(m);
23397 }
__Pyx_CyFunction_dealloc(__pyx_CyFunctionObject * m)23398 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
23399 {
23400     PyObject_GC_UnTrack(m);
23401     __Pyx__CyFunction_dealloc(m);
23402 }
__Pyx_CyFunction_traverse(__pyx_CyFunctionObject * m,visitproc visit,void * arg)23403 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
23404 {
23405     Py_VISIT(m->func_closure);
23406     Py_VISIT(m->func.m_module);
23407     Py_VISIT(m->func_dict);
23408     Py_VISIT(m->func_name);
23409     Py_VISIT(m->func_qualname);
23410     Py_VISIT(m->func_doc);
23411     Py_VISIT(m->func_globals);
23412     Py_VISIT(m->func_code);
23413     Py_VISIT(m->func_classobj);
23414     Py_VISIT(m->defaults_tuple);
23415     Py_VISIT(m->defaults_kwdict);
23416     if (m->defaults) {
23417         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
23418         int i;
23419         for (i = 0; i < m->defaults_pyobjects; i++)
23420             Py_VISIT(pydefaults[i]);
23421     }
23422     return 0;
23423 }
__Pyx_CyFunction_descr_get(PyObject * func,PyObject * obj,PyObject * type)23424 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
23425 {
23426 #if PY_MAJOR_VERSION < 3
23427     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
23428     if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
23429         Py_INCREF(func);
23430         return func;
23431     }
23432     if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
23433         if (type == NULL)
23434             type = (PyObject *)(Py_TYPE(obj));
23435         return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
23436     }
23437     if (obj == Py_None)
23438         obj = NULL;
23439 #endif
23440     return __Pyx_PyMethod_New(func, obj, type);
23441 }
23442 static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject * op)23443 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
23444 {
23445 #if PY_MAJOR_VERSION >= 3
23446     return PyUnicode_FromFormat("<cyfunction %U at %p>",
23447                                 op->func_qualname, (void *)op);
23448 #else
23449     return PyString_FromFormat("<cyfunction %s at %p>",
23450                                PyString_AsString(op->func_qualname), (void *)op);
23451 #endif
23452 }
__Pyx_CyFunction_CallMethod(PyObject * func,PyObject * self,PyObject * arg,PyObject * kw)23453 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
23454     PyCFunctionObject* f = (PyCFunctionObject*)func;
23455     PyCFunction meth = f->m_ml->ml_meth;
23456     Py_ssize_t size;
23457     switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
23458     case METH_VARARGS:
23459         if (likely(kw == NULL || PyDict_Size(kw) == 0))
23460             return (*meth)(self, arg);
23461         break;
23462     case METH_VARARGS | METH_KEYWORDS:
23463         return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
23464     case METH_NOARGS:
23465         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
23466             size = PyTuple_GET_SIZE(arg);
23467             if (likely(size == 0))
23468                 return (*meth)(self, NULL);
23469             PyErr_Format(PyExc_TypeError,
23470                 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
23471                 f->m_ml->ml_name, size);
23472             return NULL;
23473         }
23474         break;
23475     case METH_O:
23476         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
23477             size = PyTuple_GET_SIZE(arg);
23478             if (likely(size == 1)) {
23479                 PyObject *result, *arg0;
23480                 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23481                 arg0 = PyTuple_GET_ITEM(arg, 0);
23482                 #else
23483                 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
23484                 #endif
23485                 result = (*meth)(self, arg0);
23486                 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
23487                 Py_DECREF(arg0);
23488                 #endif
23489                 return result;
23490             }
23491             PyErr_Format(PyExc_TypeError,
23492                 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
23493                 f->m_ml->ml_name, size);
23494             return NULL;
23495         }
23496         break;
23497     default:
23498         PyErr_SetString(PyExc_SystemError, "Bad call flags in "
23499                         "__Pyx_CyFunction_Call. METH_OLDARGS is no "
23500                         "longer supported!");
23501         return NULL;
23502     }
23503     PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
23504                  f->m_ml->ml_name);
23505     return NULL;
23506 }
__Pyx_CyFunction_Call(PyObject * func,PyObject * arg,PyObject * kw)23507 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
23508     return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
23509 }
__Pyx_CyFunction_CallAsMethod(PyObject * func,PyObject * args,PyObject * kw)23510 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
23511     PyObject *result;
23512     __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
23513     if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
23514         Py_ssize_t argc;
23515         PyObject *new_args;
23516         PyObject *self;
23517         argc = PyTuple_GET_SIZE(args);
23518         new_args = PyTuple_GetSlice(args, 1, argc);
23519         if (unlikely(!new_args))
23520             return NULL;
23521         self = PyTuple_GetItem(args, 0);
23522         if (unlikely(!self)) {
23523             Py_DECREF(new_args);
23524             return NULL;
23525         }
23526         result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
23527         Py_DECREF(new_args);
23528     } else {
23529         result = __Pyx_CyFunction_Call(func, args, kw);
23530     }
23531     return result;
23532 }
23533 static PyTypeObject __pyx_CyFunctionType_type = {
23534     PyVarObject_HEAD_INIT(0, 0)
23535     "cython_function_or_method",
23536     sizeof(__pyx_CyFunctionObject),
23537     0,
23538     (destructor) __Pyx_CyFunction_dealloc,
23539     0,
23540     0,
23541     0,
23542 #if PY_MAJOR_VERSION < 3
23543     0,
23544 #else
23545     0,
23546 #endif
23547     (reprfunc) __Pyx_CyFunction_repr,
23548     0,
23549     0,
23550     0,
23551     0,
23552     __Pyx_CyFunction_CallAsMethod,
23553     0,
23554     0,
23555     0,
23556     0,
23557     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
23558     0,
23559     (traverseproc) __Pyx_CyFunction_traverse,
23560     (inquiry) __Pyx_CyFunction_clear,
23561     0,
23562 #if PY_VERSION_HEX < 0x030500A0
23563     offsetof(__pyx_CyFunctionObject, func_weakreflist),
23564 #else
23565     offsetof(PyCFunctionObject, m_weakreflist),
23566 #endif
23567     0,
23568     0,
23569     __pyx_CyFunction_methods,
23570     __pyx_CyFunction_members,
23571     __pyx_CyFunction_getsets,
23572     0,
23573     0,
23574     __Pyx_CyFunction_descr_get,
23575     0,
23576     offsetof(__pyx_CyFunctionObject, func_dict),
23577     0,
23578     0,
23579     0,
23580     0,
23581     0,
23582     0,
23583     0,
23584     0,
23585     0,
23586     0,
23587     0,
23588     0,
23589 #if PY_VERSION_HEX >= 0x030400a1
23590     0,
23591 #endif
23592 #if PY_VERSION_HEX >= 0x030800b1
23593     0,
23594 #endif
23595 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
23596     0,
23597 #endif
23598 };
__pyx_CyFunction_init(void)23599 static int __pyx_CyFunction_init(void) {
23600     __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
23601     if (unlikely(__pyx_CyFunctionType == NULL)) {
23602         return -1;
23603     }
23604     return 0;
23605 }
__Pyx_CyFunction_InitDefaults(PyObject * func,size_t size,int pyobjects)23606 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
23607     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
23608     m->defaults = PyObject_Malloc(size);
23609     if (unlikely(!m->defaults))
23610         return PyErr_NoMemory();
23611     memset(m->defaults, 0, size);
23612     m->defaults_pyobjects = pyobjects;
23613     m->defaults_size = size;
23614     return m->defaults;
23615 }
__Pyx_CyFunction_SetDefaultsTuple(PyObject * func,PyObject * tuple)23616 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
23617     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
23618     m->defaults_tuple = tuple;
23619     Py_INCREF(tuple);
23620 }
__Pyx_CyFunction_SetDefaultsKwDict(PyObject * func,PyObject * dict)23621 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
23622     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
23623     m->defaults_kwdict = dict;
23624     Py_INCREF(dict);
23625 }
__Pyx_CyFunction_SetAnnotationsDict(PyObject * func,PyObject * dict)23626 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
23627     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
23628     m->func_annotations = dict;
23629     Py_INCREF(dict);
23630 }
23631 
23632 /* CythonFunction */
__Pyx_CyFunction_New(PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)23633 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
23634                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
23635     PyObject *op = __Pyx_CyFunction_Init(
23636         PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
23637         ml, flags, qualname, closure, module, globals, code
23638     );
23639     if (likely(op)) {
23640         PyObject_GC_Track(op);
23641     }
23642     return op;
23643 }
23644 
23645 /* CalculateMetaclass */
__Pyx_CalculateMetaclass(PyTypeObject * metaclass,PyObject * bases)23646 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
23647     Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
23648     for (i=0; i < nbases; i++) {
23649         PyTypeObject *tmptype;
23650         PyObject *tmp = PyTuple_GET_ITEM(bases, i);
23651         tmptype = Py_TYPE(tmp);
23652 #if PY_MAJOR_VERSION < 3
23653         if (tmptype == &PyClass_Type)
23654             continue;
23655 #endif
23656         if (!metaclass) {
23657             metaclass = tmptype;
23658             continue;
23659         }
23660         if (PyType_IsSubtype(metaclass, tmptype))
23661             continue;
23662         if (PyType_IsSubtype(tmptype, metaclass)) {
23663             metaclass = tmptype;
23664             continue;
23665         }
23666         PyErr_SetString(PyExc_TypeError,
23667                         "metaclass conflict: "
23668                         "the metaclass of a derived class "
23669                         "must be a (non-strict) subclass "
23670                         "of the metaclasses of all its bases");
23671         return NULL;
23672     }
23673     if (!metaclass) {
23674 #if PY_MAJOR_VERSION < 3
23675         metaclass = &PyClass_Type;
23676 #else
23677         metaclass = &PyType_Type;
23678 #endif
23679     }
23680     Py_INCREF((PyObject*) metaclass);
23681     return (PyObject*) metaclass;
23682 }
23683 
23684 /* Py3ClassCreate */
__Pyx_Py3MetaclassPrepare(PyObject * metaclass,PyObject * bases,PyObject * name,PyObject * qualname,PyObject * mkw,PyObject * modname,PyObject * doc)23685 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
23686                                            PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
23687     PyObject *ns;
23688     if (metaclass) {
23689         PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
23690         if (prep) {
23691             PyObject *pargs = PyTuple_Pack(2, name, bases);
23692             if (unlikely(!pargs)) {
23693                 Py_DECREF(prep);
23694                 return NULL;
23695             }
23696             ns = PyObject_Call(prep, pargs, mkw);
23697             Py_DECREF(prep);
23698             Py_DECREF(pargs);
23699         } else {
23700             if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
23701                 return NULL;
23702             PyErr_Clear();
23703             ns = PyDict_New();
23704         }
23705     } else {
23706         ns = PyDict_New();
23707     }
23708     if (unlikely(!ns))
23709         return NULL;
23710     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
23711     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
23712     if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
23713     return ns;
23714 bad:
23715     Py_DECREF(ns);
23716     return NULL;
23717 }
__Pyx_Py3ClassCreate(PyObject * metaclass,PyObject * name,PyObject * bases,PyObject * dict,PyObject * mkw,int calculate_metaclass,int allow_py2_metaclass)23718 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
23719                                       PyObject *dict, PyObject *mkw,
23720                                       int calculate_metaclass, int allow_py2_metaclass) {
23721     PyObject *result, *margs;
23722     PyObject *owned_metaclass = NULL;
23723     if (allow_py2_metaclass) {
23724         owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
23725         if (owned_metaclass) {
23726             metaclass = owned_metaclass;
23727         } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
23728             PyErr_Clear();
23729         } else {
23730             return NULL;
23731         }
23732     }
23733     if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
23734         metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
23735         Py_XDECREF(owned_metaclass);
23736         if (unlikely(!metaclass))
23737             return NULL;
23738         owned_metaclass = metaclass;
23739     }
23740     margs = PyTuple_Pack(3, name, bases, dict);
23741     if (unlikely(!margs)) {
23742         result = NULL;
23743     } else {
23744         result = PyObject_Call(metaclass, margs, mkw);
23745         Py_DECREF(margs);
23746     }
23747     Py_XDECREF(owned_metaclass);
23748     return result;
23749 }
23750 
23751 /* CLineInTraceback */
23752 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)23753 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
23754     PyObject *use_cline;
23755     PyObject *ptype, *pvalue, *ptraceback;
23756 #if CYTHON_COMPILING_IN_CPYTHON
23757     PyObject **cython_runtime_dict;
23758 #endif
23759     if (unlikely(!__pyx_cython_runtime)) {
23760         return c_line;
23761     }
23762     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
23763 #if CYTHON_COMPILING_IN_CPYTHON
23764     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
23765     if (likely(cython_runtime_dict)) {
23766         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
23767             use_cline, *cython_runtime_dict,
23768             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
23769     } else
23770 #endif
23771     {
23772       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
23773       if (use_cline_obj) {
23774         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
23775         Py_DECREF(use_cline_obj);
23776       } else {
23777         PyErr_Clear();
23778         use_cline = NULL;
23779       }
23780     }
23781     if (!use_cline) {
23782         c_line = 0;
23783         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
23784     }
23785     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
23786         c_line = 0;
23787     }
23788     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
23789     return c_line;
23790 }
23791 #endif
23792 
23793 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)23794 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
23795     int start = 0, mid = 0, end = count - 1;
23796     if (end >= 0 && code_line > entries[end].code_line) {
23797         return count;
23798     }
23799     while (start < end) {
23800         mid = start + (end - start) / 2;
23801         if (code_line < entries[mid].code_line) {
23802             end = mid;
23803         } else if (code_line > entries[mid].code_line) {
23804              start = mid + 1;
23805         } else {
23806             return mid;
23807         }
23808     }
23809     if (code_line <= entries[mid].code_line) {
23810         return mid;
23811     } else {
23812         return mid + 1;
23813     }
23814 }
__pyx_find_code_object(int code_line)23815 static PyCodeObject *__pyx_find_code_object(int code_line) {
23816     PyCodeObject* code_object;
23817     int pos;
23818     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
23819         return NULL;
23820     }
23821     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
23822     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
23823         return NULL;
23824     }
23825     code_object = __pyx_code_cache.entries[pos].code_object;
23826     Py_INCREF(code_object);
23827     return code_object;
23828 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)23829 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
23830     int pos, i;
23831     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
23832     if (unlikely(!code_line)) {
23833         return;
23834     }
23835     if (unlikely(!entries)) {
23836         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
23837         if (likely(entries)) {
23838             __pyx_code_cache.entries = entries;
23839             __pyx_code_cache.max_count = 64;
23840             __pyx_code_cache.count = 1;
23841             entries[0].code_line = code_line;
23842             entries[0].code_object = code_object;
23843             Py_INCREF(code_object);
23844         }
23845         return;
23846     }
23847     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
23848     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
23849         PyCodeObject* tmp = entries[pos].code_object;
23850         entries[pos].code_object = code_object;
23851         Py_DECREF(tmp);
23852         return;
23853     }
23854     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
23855         int new_max = __pyx_code_cache.max_count + 64;
23856         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
23857             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
23858         if (unlikely(!entries)) {
23859             return;
23860         }
23861         __pyx_code_cache.entries = entries;
23862         __pyx_code_cache.max_count = new_max;
23863     }
23864     for (i=__pyx_code_cache.count; i>pos; i--) {
23865         entries[i] = entries[i-1];
23866     }
23867     entries[pos].code_line = code_line;
23868     entries[pos].code_object = code_object;
23869     __pyx_code_cache.count++;
23870     Py_INCREF(code_object);
23871 }
23872 
23873 /* AddTraceback */
23874 #include "compile.h"
23875 #include "frameobject.h"
23876 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)23877 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
23878             const char *funcname, int c_line,
23879             int py_line, const char *filename) {
23880     PyCodeObject *py_code = 0;
23881     PyObject *py_srcfile = 0;
23882     PyObject *py_funcname = 0;
23883     #if PY_MAJOR_VERSION < 3
23884     py_srcfile = PyString_FromString(filename);
23885     #else
23886     py_srcfile = PyUnicode_FromString(filename);
23887     #endif
23888     if (!py_srcfile) goto bad;
23889     if (c_line) {
23890         #if PY_MAJOR_VERSION < 3
23891         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
23892         #else
23893         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
23894         #endif
23895     }
23896     else {
23897         #if PY_MAJOR_VERSION < 3
23898         py_funcname = PyString_FromString(funcname);
23899         #else
23900         py_funcname = PyUnicode_FromString(funcname);
23901         #endif
23902     }
23903     if (!py_funcname) goto bad;
23904     py_code = __Pyx_PyCode_New(
23905         0,
23906         0,
23907         0,
23908         0,
23909         0,
23910         __pyx_empty_bytes, /*PyObject *code,*/
23911         __pyx_empty_tuple, /*PyObject *consts,*/
23912         __pyx_empty_tuple, /*PyObject *names,*/
23913         __pyx_empty_tuple, /*PyObject *varnames,*/
23914         __pyx_empty_tuple, /*PyObject *freevars,*/
23915         __pyx_empty_tuple, /*PyObject *cellvars,*/
23916         py_srcfile,   /*PyObject *filename,*/
23917         py_funcname,  /*PyObject *name,*/
23918         py_line,
23919         __pyx_empty_bytes  /*PyObject *lnotab*/
23920     );
23921     Py_DECREF(py_srcfile);
23922     Py_DECREF(py_funcname);
23923     return py_code;
23924 bad:
23925     Py_XDECREF(py_srcfile);
23926     Py_XDECREF(py_funcname);
23927     return NULL;
23928 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)23929 static void __Pyx_AddTraceback(const char *funcname, int c_line,
23930                                int py_line, const char *filename) {
23931     PyCodeObject *py_code = 0;
23932     PyFrameObject *py_frame = 0;
23933     PyThreadState *tstate = __Pyx_PyThreadState_Current;
23934     if (c_line) {
23935         c_line = __Pyx_CLineForTraceback(tstate, c_line);
23936     }
23937     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
23938     if (!py_code) {
23939         py_code = __Pyx_CreateCodeObjectForTraceback(
23940             funcname, c_line, py_line, filename);
23941         if (!py_code) goto bad;
23942         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
23943     }
23944     py_frame = PyFrame_New(
23945         tstate,            /*PyThreadState *tstate,*/
23946         py_code,           /*PyCodeObject *code,*/
23947         __pyx_d,    /*PyObject *globals,*/
23948         0                  /*PyObject *locals*/
23949     );
23950     if (!py_frame) goto bad;
23951     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
23952     PyTraceBack_Here(py_frame);
23953 bad:
23954     Py_XDECREF(py_code);
23955     Py_XDECREF(py_frame);
23956 }
23957 
23958 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)23959 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
23960     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
23961         if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
23962         if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
23963     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
23964     return -1;
23965 }
__Pyx_ReleaseBuffer(Py_buffer * view)23966 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
23967     PyObject *obj = view->obj;
23968     if (!obj) return;
23969     if (PyObject_CheckBuffer(obj)) {
23970         PyBuffer_Release(view);
23971         return;
23972     }
23973     if ((0)) {}
23974     view->obj = NULL;
23975     Py_DECREF(obj);
23976 }
23977 #endif
23978 
23979 
23980 /* MemviewSliceIsContig */
23981 static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs,char order,int ndim)23982 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
23983 {
23984     int i, index, step, start;
23985     Py_ssize_t itemsize = mvs.memview->view.itemsize;
23986     if (order == 'F') {
23987         step = 1;
23988         start = 0;
23989     } else {
23990         step = -1;
23991         start = ndim - 1;
23992     }
23993     for (i = 0; i < ndim; i++) {
23994         index = start + step * i;
23995         if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
23996             return 0;
23997         itemsize *= mvs.shape[index];
23998     }
23999     return 1;
24000 }
24001 
24002 /* OverlappingSlices */
24003 static void
__pyx_get_array_memory_extents(__Pyx_memviewslice * slice,void ** out_start,void ** out_end,int ndim,size_t itemsize)24004 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
24005                                void **out_start, void **out_end,
24006                                int ndim, size_t itemsize)
24007 {
24008     char *start, *end;
24009     int i;
24010     start = end = slice->data;
24011     for (i = 0; i < ndim; i++) {
24012         Py_ssize_t stride = slice->strides[i];
24013         Py_ssize_t extent = slice->shape[i];
24014         if (extent == 0) {
24015             *out_start = *out_end = start;
24016             return;
24017         } else {
24018             if (stride > 0)
24019                 end += stride * (extent - 1);
24020             else
24021                 start += stride * (extent - 1);
24022         }
24023     }
24024     *out_start = start;
24025     *out_end = end + itemsize;
24026 }
24027 static int
__pyx_slices_overlap(__Pyx_memviewslice * slice1,__Pyx_memviewslice * slice2,int ndim,size_t itemsize)24028 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
24029                      __Pyx_memviewslice *slice2,
24030                      int ndim, size_t itemsize)
24031 {
24032     void *start1, *end1, *start2, *end2;
24033     __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
24034     __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
24035     return (start1 < end2) && (start2 < end1);
24036 }
24037 
24038 /* Capsule */
24039 static CYTHON_INLINE PyObject *
__pyx_capsule_create(void * p,CYTHON_UNUSED const char * sig)24040 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
24041 {
24042     PyObject *cobj;
24043 #if PY_VERSION_HEX >= 0x02070000
24044     cobj = PyCapsule_New(p, sig, NULL);
24045 #else
24046     cobj = PyCObject_FromVoidPtr(p, NULL);
24047 #endif
24048     return cobj;
24049 }
24050 
24051 /* CIntFromPyVerify */
24052 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
24053     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
24054 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
24055     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
24056 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
24057     {\
24058         func_type value = func_value;\
24059         if (sizeof(target_type) < sizeof(func_type)) {\
24060             if (unlikely(value != (func_type) (target_type) value)) {\
24061                 func_type zero = 0;\
24062                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
24063                     return (target_type) -1;\
24064                 if (is_unsigned && unlikely(value < zero))\
24065                     goto raise_neg_overflow;\
24066                 else\
24067                     goto raise_overflow;\
24068             }\
24069         }\
24070         return (target_type) value;\
24071     }
24072 
24073 /* CIntToPy */
__Pyx_PyInt_From_int(int value)24074 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
24075     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
24076     const int is_unsigned = neg_one > const_zero;
24077     if (is_unsigned) {
24078         if (sizeof(int) < sizeof(long)) {
24079             return PyInt_FromLong((long) value);
24080         } else if (sizeof(int) <= sizeof(unsigned long)) {
24081             return PyLong_FromUnsignedLong((unsigned long) value);
24082 #ifdef HAVE_LONG_LONG
24083         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
24084             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
24085 #endif
24086         }
24087     } else {
24088         if (sizeof(int) <= sizeof(long)) {
24089             return PyInt_FromLong((long) value);
24090 #ifdef HAVE_LONG_LONG
24091         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
24092             return PyLong_FromLongLong((PY_LONG_LONG) value);
24093 #endif
24094         }
24095     }
24096     {
24097         int one = 1; int little = (int)*(unsigned char *)&one;
24098         unsigned char *bytes = (unsigned char *)&value;
24099         return _PyLong_FromByteArray(bytes, sizeof(int),
24100                                      little, !is_unsigned);
24101     }
24102 }
24103 
24104 /* CIntToPy */
__Pyx_PyInt_From_long(long value)24105 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
24106     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
24107     const int is_unsigned = neg_one > const_zero;
24108     if (is_unsigned) {
24109         if (sizeof(long) < sizeof(long)) {
24110             return PyInt_FromLong((long) value);
24111         } else if (sizeof(long) <= sizeof(unsigned long)) {
24112             return PyLong_FromUnsignedLong((unsigned long) value);
24113 #ifdef HAVE_LONG_LONG
24114         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
24115             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
24116 #endif
24117         }
24118     } else {
24119         if (sizeof(long) <= sizeof(long)) {
24120             return PyInt_FromLong((long) value);
24121 #ifdef HAVE_LONG_LONG
24122         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
24123             return PyLong_FromLongLong((PY_LONG_LONG) value);
24124 #endif
24125         }
24126     }
24127     {
24128         int one = 1; int little = (int)*(unsigned char *)&one;
24129         unsigned char *bytes = (unsigned char *)&value;
24130         return _PyLong_FromByteArray(bytes, sizeof(long),
24131                                      little, !is_unsigned);
24132     }
24133 }
24134 
24135 /* Declarations */
24136 #if CYTHON_CCOMPLEX
24137   #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)24138     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
24139       return ::std::complex< float >(x, y);
24140     }
24141   #else
__pyx_t_float_complex_from_parts(float x,float y)24142     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
24143       return x + y*(__pyx_t_float_complex)_Complex_I;
24144     }
24145   #endif
24146 #else
__pyx_t_float_complex_from_parts(float x,float y)24147     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
24148       __pyx_t_float_complex z;
24149       z.real = x;
24150       z.imag = y;
24151       return z;
24152     }
24153 #endif
24154 
24155 /* Arithmetic */
24156 #if CYTHON_CCOMPLEX
24157 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24158     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24159        return (a.real == b.real) && (a.imag == b.imag);
24160     }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24161     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24162         __pyx_t_float_complex z;
24163         z.real = a.real + b.real;
24164         z.imag = a.imag + b.imag;
24165         return z;
24166     }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24167     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24168         __pyx_t_float_complex z;
24169         z.real = a.real - b.real;
24170         z.imag = a.imag - b.imag;
24171         return z;
24172     }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24173     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24174         __pyx_t_float_complex z;
24175         z.real = a.real * b.real - a.imag * b.imag;
24176         z.imag = a.real * b.imag + a.imag * b.real;
24177         return z;
24178     }
24179     #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24180     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24181         if (b.imag == 0) {
24182             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
24183         } else if (fabsf(b.real) >= fabsf(b.imag)) {
24184             if (b.real == 0 && b.imag == 0) {
24185                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
24186             } else {
24187                 float r = b.imag / b.real;
24188                 float s = (float)(1.0) / (b.real + b.imag * r);
24189                 return __pyx_t_float_complex_from_parts(
24190                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
24191             }
24192         } else {
24193             float r = b.real / b.imag;
24194             float s = (float)(1.0) / (b.imag + b.real * r);
24195             return __pyx_t_float_complex_from_parts(
24196                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
24197         }
24198     }
24199     #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24200     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24201         if (b.imag == 0) {
24202             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
24203         } else {
24204             float denom = b.real * b.real + b.imag * b.imag;
24205             return __pyx_t_float_complex_from_parts(
24206                 (a.real * b.real + a.imag * b.imag) / denom,
24207                 (a.imag * b.real - a.real * b.imag) / denom);
24208         }
24209     }
24210     #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)24211     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
24212         __pyx_t_float_complex z;
24213         z.real = -a.real;
24214         z.imag = -a.imag;
24215         return z;
24216     }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)24217     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
24218        return (a.real == 0) && (a.imag == 0);
24219     }
__Pyx_c_conj_float(__pyx_t_float_complex a)24220     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
24221         __pyx_t_float_complex z;
24222         z.real =  a.real;
24223         z.imag = -a.imag;
24224         return z;
24225     }
24226     #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)24227         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
24228           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
24229             return sqrtf(z.real*z.real + z.imag*z.imag);
24230           #else
24231             return hypotf(z.real, z.imag);
24232           #endif
24233         }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24234         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24235             __pyx_t_float_complex z;
24236             float r, lnr, theta, z_r, z_theta;
24237             if (b.imag == 0 && b.real == (int)b.real) {
24238                 if (b.real < 0) {
24239                     float denom = a.real * a.real + a.imag * a.imag;
24240                     a.real = a.real / denom;
24241                     a.imag = -a.imag / denom;
24242                     b.real = -b.real;
24243                 }
24244                 switch ((int)b.real) {
24245                     case 0:
24246                         z.real = 1;
24247                         z.imag = 0;
24248                         return z;
24249                     case 1:
24250                         return a;
24251                     case 2:
24252                         return __Pyx_c_prod_float(a, a);
24253                     case 3:
24254                         z = __Pyx_c_prod_float(a, a);
24255                         return __Pyx_c_prod_float(z, a);
24256                     case 4:
24257                         z = __Pyx_c_prod_float(a, a);
24258                         return __Pyx_c_prod_float(z, z);
24259                 }
24260             }
24261             if (a.imag == 0) {
24262                 if (a.real == 0) {
24263                     return a;
24264                 } else if (b.imag == 0) {
24265                     z.real = powf(a.real, b.real);
24266                     z.imag = 0;
24267                     return z;
24268                 } else if (a.real > 0) {
24269                     r = a.real;
24270                     theta = 0;
24271                 } else {
24272                     r = -a.real;
24273                     theta = atan2f(0.0, -1.0);
24274                 }
24275             } else {
24276                 r = __Pyx_c_abs_float(a);
24277                 theta = atan2f(a.imag, a.real);
24278             }
24279             lnr = logf(r);
24280             z_r = expf(lnr * b.real - theta * b.imag);
24281             z_theta = theta * b.real + lnr * b.imag;
24282             z.real = z_r * cosf(z_theta);
24283             z.imag = z_r * sinf(z_theta);
24284             return z;
24285         }
24286     #endif
24287 #endif
24288 
24289 /* Declarations */
24290 #if CYTHON_CCOMPLEX
24291   #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)24292     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
24293       return ::std::complex< double >(x, y);
24294     }
24295   #else
__pyx_t_double_complex_from_parts(double x,double y)24296     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
24297       return x + y*(__pyx_t_double_complex)_Complex_I;
24298     }
24299   #endif
24300 #else
__pyx_t_double_complex_from_parts(double x,double y)24301     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
24302       __pyx_t_double_complex z;
24303       z.real = x;
24304       z.imag = y;
24305       return z;
24306     }
24307 #endif
24308 
24309 /* Arithmetic */
24310 #if CYTHON_CCOMPLEX
24311 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)24312     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
24313        return (a.real == b.real) && (a.imag == b.imag);
24314     }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)24315     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
24316         __pyx_t_double_complex z;
24317         z.real = a.real + b.real;
24318         z.imag = a.imag + b.imag;
24319         return z;
24320     }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)24321     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
24322         __pyx_t_double_complex z;
24323         z.real = a.real - b.real;
24324         z.imag = a.imag - b.imag;
24325         return z;
24326     }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)24327     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
24328         __pyx_t_double_complex z;
24329         z.real = a.real * b.real - a.imag * b.imag;
24330         z.imag = a.real * b.imag + a.imag * b.real;
24331         return z;
24332     }
24333     #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)24334     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
24335         if (b.imag == 0) {
24336             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
24337         } else if (fabs(b.real) >= fabs(b.imag)) {
24338             if (b.real == 0 && b.imag == 0) {
24339                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
24340             } else {
24341                 double r = b.imag / b.real;
24342                 double s = (double)(1.0) / (b.real + b.imag * r);
24343                 return __pyx_t_double_complex_from_parts(
24344                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
24345             }
24346         } else {
24347             double r = b.real / b.imag;
24348             double s = (double)(1.0) / (b.imag + b.real * r);
24349             return __pyx_t_double_complex_from_parts(
24350                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
24351         }
24352     }
24353     #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)24354     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
24355         if (b.imag == 0) {
24356             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
24357         } else {
24358             double denom = b.real * b.real + b.imag * b.imag;
24359             return __pyx_t_double_complex_from_parts(
24360                 (a.real * b.real + a.imag * b.imag) / denom,
24361                 (a.imag * b.real - a.real * b.imag) / denom);
24362         }
24363     }
24364     #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)24365     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
24366         __pyx_t_double_complex z;
24367         z.real = -a.real;
24368         z.imag = -a.imag;
24369         return z;
24370     }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)24371     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
24372        return (a.real == 0) && (a.imag == 0);
24373     }
__Pyx_c_conj_double(__pyx_t_double_complex a)24374     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
24375         __pyx_t_double_complex z;
24376         z.real =  a.real;
24377         z.imag = -a.imag;
24378         return z;
24379     }
24380     #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)24381         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
24382           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
24383             return sqrt(z.real*z.real + z.imag*z.imag);
24384           #else
24385             return hypot(z.real, z.imag);
24386           #endif
24387         }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)24388         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
24389             __pyx_t_double_complex z;
24390             double r, lnr, theta, z_r, z_theta;
24391             if (b.imag == 0 && b.real == (int)b.real) {
24392                 if (b.real < 0) {
24393                     double denom = a.real * a.real + a.imag * a.imag;
24394                     a.real = a.real / denom;
24395                     a.imag = -a.imag / denom;
24396                     b.real = -b.real;
24397                 }
24398                 switch ((int)b.real) {
24399                     case 0:
24400                         z.real = 1;
24401                         z.imag = 0;
24402                         return z;
24403                     case 1:
24404                         return a;
24405                     case 2:
24406                         return __Pyx_c_prod_double(a, a);
24407                     case 3:
24408                         z = __Pyx_c_prod_double(a, a);
24409                         return __Pyx_c_prod_double(z, a);
24410                     case 4:
24411                         z = __Pyx_c_prod_double(a, a);
24412                         return __Pyx_c_prod_double(z, z);
24413                 }
24414             }
24415             if (a.imag == 0) {
24416                 if (a.real == 0) {
24417                     return a;
24418                 } else if (b.imag == 0) {
24419                     z.real = pow(a.real, b.real);
24420                     z.imag = 0;
24421                     return z;
24422                 } else if (a.real > 0) {
24423                     r = a.real;
24424                     theta = 0;
24425                 } else {
24426                     r = -a.real;
24427                     theta = atan2(0.0, -1.0);
24428                 }
24429             } else {
24430                 r = __Pyx_c_abs_double(a);
24431                 theta = atan2(a.imag, a.real);
24432             }
24433             lnr = log(r);
24434             z_r = exp(lnr * b.real - theta * b.imag);
24435             z_theta = theta * b.real + lnr * b.imag;
24436             z.real = z_r * cos(z_theta);
24437             z.imag = z_r * sin(z_theta);
24438             return z;
24439         }
24440     #endif
24441 #endif
24442 
24443 /* MemviewSliceCopyTemplate */
24444 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)24445 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
24446                                  const char *mode, int ndim,
24447                                  size_t sizeof_dtype, int contig_flag,
24448                                  int dtype_is_object)
24449 {
24450     __Pyx_RefNannyDeclarations
24451     int i;
24452     __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
24453     struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
24454     Py_buffer *buf = &from_memview->view;
24455     PyObject *shape_tuple = NULL;
24456     PyObject *temp_int = NULL;
24457     struct __pyx_array_obj *array_obj = NULL;
24458     struct __pyx_memoryview_obj *memview_obj = NULL;
24459     __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
24460     for (i = 0; i < ndim; i++) {
24461         if (unlikely(from_mvs->suboffsets[i] >= 0)) {
24462             PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
24463                                            "indirect dimensions (axis %d)", i);
24464             goto fail;
24465         }
24466     }
24467     shape_tuple = PyTuple_New(ndim);
24468     if (unlikely(!shape_tuple)) {
24469         goto fail;
24470     }
24471     __Pyx_GOTREF(shape_tuple);
24472     for(i = 0; i < ndim; i++) {
24473         temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
24474         if(unlikely(!temp_int)) {
24475             goto fail;
24476         } else {
24477             PyTuple_SET_ITEM(shape_tuple, i, temp_int);
24478             temp_int = NULL;
24479         }
24480     }
24481     array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
24482     if (unlikely(!array_obj)) {
24483         goto fail;
24484     }
24485     __Pyx_GOTREF(array_obj);
24486     memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
24487                                     (PyObject *) array_obj, contig_flag,
24488                                     dtype_is_object,
24489                                     from_mvs->memview->typeinfo);
24490     if (unlikely(!memview_obj))
24491         goto fail;
24492     if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
24493         goto fail;
24494     if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
24495                                                 dtype_is_object) < 0))
24496         goto fail;
24497     goto no_fail;
24498 fail:
24499     __Pyx_XDECREF(new_mvs.memview);
24500     new_mvs.memview = NULL;
24501     new_mvs.data = NULL;
24502 no_fail:
24503     __Pyx_XDECREF(shape_tuple);
24504     __Pyx_XDECREF(temp_int);
24505     __Pyx_XDECREF(array_obj);
24506     __Pyx_RefNannyFinishContext();
24507     return new_mvs;
24508 }
24509 
24510 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)24511 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
24512     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
24513     const int is_unsigned = neg_one > const_zero;
24514 #if PY_MAJOR_VERSION < 3
24515     if (likely(PyInt_Check(x))) {
24516         if (sizeof(int) < sizeof(long)) {
24517             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
24518         } else {
24519             long val = PyInt_AS_LONG(x);
24520             if (is_unsigned && unlikely(val < 0)) {
24521                 goto raise_neg_overflow;
24522             }
24523             return (int) val;
24524         }
24525     } else
24526 #endif
24527     if (likely(PyLong_Check(x))) {
24528         if (is_unsigned) {
24529 #if CYTHON_USE_PYLONG_INTERNALS
24530             const digit* digits = ((PyLongObject*)x)->ob_digit;
24531             switch (Py_SIZE(x)) {
24532                 case  0: return (int) 0;
24533                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
24534                 case 2:
24535                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
24536                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24537                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24538                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
24539                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
24540                         }
24541                     }
24542                     break;
24543                 case 3:
24544                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
24545                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24546                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24547                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
24548                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
24549                         }
24550                     }
24551                     break;
24552                 case 4:
24553                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
24554                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24555                             __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])))
24556                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
24557                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
24558                         }
24559                     }
24560                     break;
24561             }
24562 #endif
24563 #if CYTHON_COMPILING_IN_CPYTHON
24564             if (unlikely(Py_SIZE(x) < 0)) {
24565                 goto raise_neg_overflow;
24566             }
24567 #else
24568             {
24569                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
24570                 if (unlikely(result < 0))
24571                     return (int) -1;
24572                 if (unlikely(result == 1))
24573                     goto raise_neg_overflow;
24574             }
24575 #endif
24576             if (sizeof(int) <= sizeof(unsigned long)) {
24577                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
24578 #ifdef HAVE_LONG_LONG
24579             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
24580                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
24581 #endif
24582             }
24583         } else {
24584 #if CYTHON_USE_PYLONG_INTERNALS
24585             const digit* digits = ((PyLongObject*)x)->ob_digit;
24586             switch (Py_SIZE(x)) {
24587                 case  0: return (int) 0;
24588                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
24589                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
24590                 case -2:
24591                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
24592                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24593                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24594                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
24595                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24596                         }
24597                     }
24598                     break;
24599                 case 2:
24600                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
24601                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24602                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24603                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
24604                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24605                         }
24606                     }
24607                     break;
24608                 case -3:
24609                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
24610                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24611                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24612                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
24613                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24614                         }
24615                     }
24616                     break;
24617                 case 3:
24618                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
24619                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24620                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24621                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
24622                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24623                         }
24624                     }
24625                     break;
24626                 case -4:
24627                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
24628                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24629                             __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])))
24630                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
24631                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24632                         }
24633                     }
24634                     break;
24635                 case 4:
24636                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
24637                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24638                             __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])))
24639                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
24640                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24641                         }
24642                     }
24643                     break;
24644             }
24645 #endif
24646             if (sizeof(int) <= sizeof(long)) {
24647                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
24648 #ifdef HAVE_LONG_LONG
24649             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
24650                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
24651 #endif
24652             }
24653         }
24654         {
24655 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
24656             PyErr_SetString(PyExc_RuntimeError,
24657                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
24658 #else
24659             int val;
24660             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
24661  #if PY_MAJOR_VERSION < 3
24662             if (likely(v) && !PyLong_Check(v)) {
24663                 PyObject *tmp = v;
24664                 v = PyNumber_Long(tmp);
24665                 Py_DECREF(tmp);
24666             }
24667  #endif
24668             if (likely(v)) {
24669                 int one = 1; int is_little = (int)*(unsigned char *)&one;
24670                 unsigned char *bytes = (unsigned char *)&val;
24671                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
24672                                               bytes, sizeof(val),
24673                                               is_little, !is_unsigned);
24674                 Py_DECREF(v);
24675                 if (likely(!ret))
24676                     return val;
24677             }
24678 #endif
24679             return (int) -1;
24680         }
24681     } else {
24682         int val;
24683         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
24684         if (!tmp) return (int) -1;
24685         val = __Pyx_PyInt_As_int(tmp);
24686         Py_DECREF(tmp);
24687         return val;
24688     }
24689 raise_overflow:
24690     PyErr_SetString(PyExc_OverflowError,
24691         "value too large to convert to int");
24692     return (int) -1;
24693 raise_neg_overflow:
24694     PyErr_SetString(PyExc_OverflowError,
24695         "can't convert negative value to int");
24696     return (int) -1;
24697 }
24698 
24699 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)24700 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
24701     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
24702     const int is_unsigned = neg_one > const_zero;
24703 #if PY_MAJOR_VERSION < 3
24704     if (likely(PyInt_Check(x))) {
24705         if (sizeof(long) < sizeof(long)) {
24706             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
24707         } else {
24708             long val = PyInt_AS_LONG(x);
24709             if (is_unsigned && unlikely(val < 0)) {
24710                 goto raise_neg_overflow;
24711             }
24712             return (long) val;
24713         }
24714     } else
24715 #endif
24716     if (likely(PyLong_Check(x))) {
24717         if (is_unsigned) {
24718 #if CYTHON_USE_PYLONG_INTERNALS
24719             const digit* digits = ((PyLongObject*)x)->ob_digit;
24720             switch (Py_SIZE(x)) {
24721                 case  0: return (long) 0;
24722                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
24723                 case 2:
24724                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
24725                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24726                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24727                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
24728                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
24729                         }
24730                     }
24731                     break;
24732                 case 3:
24733                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
24734                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24735                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24736                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
24737                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
24738                         }
24739                     }
24740                     break;
24741                 case 4:
24742                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
24743                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24744                             __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])))
24745                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
24746                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
24747                         }
24748                     }
24749                     break;
24750             }
24751 #endif
24752 #if CYTHON_COMPILING_IN_CPYTHON
24753             if (unlikely(Py_SIZE(x) < 0)) {
24754                 goto raise_neg_overflow;
24755             }
24756 #else
24757             {
24758                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
24759                 if (unlikely(result < 0))
24760                     return (long) -1;
24761                 if (unlikely(result == 1))
24762                     goto raise_neg_overflow;
24763             }
24764 #endif
24765             if (sizeof(long) <= sizeof(unsigned long)) {
24766                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
24767 #ifdef HAVE_LONG_LONG
24768             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
24769                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
24770 #endif
24771             }
24772         } else {
24773 #if CYTHON_USE_PYLONG_INTERNALS
24774             const digit* digits = ((PyLongObject*)x)->ob_digit;
24775             switch (Py_SIZE(x)) {
24776                 case  0: return (long) 0;
24777                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
24778                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
24779                 case -2:
24780                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
24781                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24782                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24783                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
24784                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
24785                         }
24786                     }
24787                     break;
24788                 case 2:
24789                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
24790                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24791                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24792                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
24793                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
24794                         }
24795                     }
24796                     break;
24797                 case -3:
24798                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
24799                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24800                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24801                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
24802                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
24803                         }
24804                     }
24805                     break;
24806                 case 3:
24807                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
24808                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24809                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24810                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
24811                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
24812                         }
24813                     }
24814                     break;
24815                 case -4:
24816                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
24817                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24818                             __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])))
24819                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
24820                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
24821                         }
24822                     }
24823                     break;
24824                 case 4:
24825                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
24826                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24827                             __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])))
24828                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
24829                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
24830                         }
24831                     }
24832                     break;
24833             }
24834 #endif
24835             if (sizeof(long) <= sizeof(long)) {
24836                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
24837 #ifdef HAVE_LONG_LONG
24838             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
24839                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
24840 #endif
24841             }
24842         }
24843         {
24844 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
24845             PyErr_SetString(PyExc_RuntimeError,
24846                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
24847 #else
24848             long val;
24849             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
24850  #if PY_MAJOR_VERSION < 3
24851             if (likely(v) && !PyLong_Check(v)) {
24852                 PyObject *tmp = v;
24853                 v = PyNumber_Long(tmp);
24854                 Py_DECREF(tmp);
24855             }
24856  #endif
24857             if (likely(v)) {
24858                 int one = 1; int is_little = (int)*(unsigned char *)&one;
24859                 unsigned char *bytes = (unsigned char *)&val;
24860                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
24861                                               bytes, sizeof(val),
24862                                               is_little, !is_unsigned);
24863                 Py_DECREF(v);
24864                 if (likely(!ret))
24865                     return val;
24866             }
24867 #endif
24868             return (long) -1;
24869         }
24870     } else {
24871         long val;
24872         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
24873         if (!tmp) return (long) -1;
24874         val = __Pyx_PyInt_As_long(tmp);
24875         Py_DECREF(tmp);
24876         return val;
24877     }
24878 raise_overflow:
24879     PyErr_SetString(PyExc_OverflowError,
24880         "value too large to convert to long");
24881     return (long) -1;
24882 raise_neg_overflow:
24883     PyErr_SetString(PyExc_OverflowError,
24884         "can't convert negative value to long");
24885     return (long) -1;
24886 }
24887 
24888 /* CIntFromPy */
__Pyx_PyInt_As_char(PyObject * x)24889 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
24890     const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
24891     const int is_unsigned = neg_one > const_zero;
24892 #if PY_MAJOR_VERSION < 3
24893     if (likely(PyInt_Check(x))) {
24894         if (sizeof(char) < sizeof(long)) {
24895             __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
24896         } else {
24897             long val = PyInt_AS_LONG(x);
24898             if (is_unsigned && unlikely(val < 0)) {
24899                 goto raise_neg_overflow;
24900             }
24901             return (char) val;
24902         }
24903     } else
24904 #endif
24905     if (likely(PyLong_Check(x))) {
24906         if (is_unsigned) {
24907 #if CYTHON_USE_PYLONG_INTERNALS
24908             const digit* digits = ((PyLongObject*)x)->ob_digit;
24909             switch (Py_SIZE(x)) {
24910                 case  0: return (char) 0;
24911                 case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
24912                 case 2:
24913                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
24914                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24915                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24916                         } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
24917                             return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
24918                         }
24919                     }
24920                     break;
24921                 case 3:
24922                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
24923                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24924                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24925                         } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
24926                             return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
24927                         }
24928                     }
24929                     break;
24930                 case 4:
24931                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
24932                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24933                             __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])))
24934                         } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
24935                             return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
24936                         }
24937                     }
24938                     break;
24939             }
24940 #endif
24941 #if CYTHON_COMPILING_IN_CPYTHON
24942             if (unlikely(Py_SIZE(x) < 0)) {
24943                 goto raise_neg_overflow;
24944             }
24945 #else
24946             {
24947                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
24948                 if (unlikely(result < 0))
24949                     return (char) -1;
24950                 if (unlikely(result == 1))
24951                     goto raise_neg_overflow;
24952             }
24953 #endif
24954             if (sizeof(char) <= sizeof(unsigned long)) {
24955                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
24956 #ifdef HAVE_LONG_LONG
24957             } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
24958                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
24959 #endif
24960             }
24961         } else {
24962 #if CYTHON_USE_PYLONG_INTERNALS
24963             const digit* digits = ((PyLongObject*)x)->ob_digit;
24964             switch (Py_SIZE(x)) {
24965                 case  0: return (char) 0;
24966                 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
24967                 case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
24968                 case -2:
24969                     if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
24970                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24971                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24972                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
24973                             return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
24974                         }
24975                     }
24976                     break;
24977                 case 2:
24978                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
24979                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24980                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24981                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
24982                             return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
24983                         }
24984                     }
24985                     break;
24986                 case -3:
24987                     if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
24988                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24989                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24990                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
24991                             return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
24992                         }
24993                     }
24994                     break;
24995                 case 3:
24996                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
24997                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24998                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24999                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
25000                             return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
25001                         }
25002                     }
25003                     break;
25004                 case -4:
25005                     if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
25006                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25007                             __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])))
25008                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
25009                             return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
25010                         }
25011                     }
25012                     break;
25013                 case 4:
25014                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
25015                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25016                             __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])))
25017                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
25018                             return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
25019                         }
25020                     }
25021                     break;
25022             }
25023 #endif
25024             if (sizeof(char) <= sizeof(long)) {
25025                 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
25026 #ifdef HAVE_LONG_LONG
25027             } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
25028                 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
25029 #endif
25030             }
25031         }
25032         {
25033 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25034             PyErr_SetString(PyExc_RuntimeError,
25035                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25036 #else
25037             char val;
25038             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25039  #if PY_MAJOR_VERSION < 3
25040             if (likely(v) && !PyLong_Check(v)) {
25041                 PyObject *tmp = v;
25042                 v = PyNumber_Long(tmp);
25043                 Py_DECREF(tmp);
25044             }
25045  #endif
25046             if (likely(v)) {
25047                 int one = 1; int is_little = (int)*(unsigned char *)&one;
25048                 unsigned char *bytes = (unsigned char *)&val;
25049                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25050                                               bytes, sizeof(val),
25051                                               is_little, !is_unsigned);
25052                 Py_DECREF(v);
25053                 if (likely(!ret))
25054                     return val;
25055             }
25056 #endif
25057             return (char) -1;
25058         }
25059     } else {
25060         char val;
25061         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25062         if (!tmp) return (char) -1;
25063         val = __Pyx_PyInt_As_char(tmp);
25064         Py_DECREF(tmp);
25065         return val;
25066     }
25067 raise_overflow:
25068     PyErr_SetString(PyExc_OverflowError,
25069         "value too large to convert to char");
25070     return (char) -1;
25071 raise_neg_overflow:
25072     PyErr_SetString(PyExc_OverflowError,
25073         "can't convert negative value to char");
25074     return (char) -1;
25075 }
25076 
25077 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)25078 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
25079 {
25080   union {
25081     uint32_t u32;
25082     uint8_t u8[4];
25083   } S;
25084   S.u32 = 0x01020304;
25085   return S.u8[0] == 4;
25086 }
25087 
25088 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)25089 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
25090                               __Pyx_BufFmt_StackElem* stack,
25091                               __Pyx_TypeInfo* type) {
25092   stack[0].field = &ctx->root;
25093   stack[0].parent_offset = 0;
25094   ctx->root.type = type;
25095   ctx->root.name = "buffer dtype";
25096   ctx->root.offset = 0;
25097   ctx->head = stack;
25098   ctx->head->field = &ctx->root;
25099   ctx->fmt_offset = 0;
25100   ctx->head->parent_offset = 0;
25101   ctx->new_packmode = '@';
25102   ctx->enc_packmode = '@';
25103   ctx->new_count = 1;
25104   ctx->enc_count = 0;
25105   ctx->enc_type = 0;
25106   ctx->is_complex = 0;
25107   ctx->is_valid_array = 0;
25108   ctx->struct_alignment = 0;
25109   while (type->typegroup == 'S') {
25110     ++ctx->head;
25111     ctx->head->field = type->fields;
25112     ctx->head->parent_offset = 0;
25113     type = type->fields->type;
25114   }
25115 }
__Pyx_BufFmt_ParseNumber(const char ** ts)25116 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
25117     int count;
25118     const char* t = *ts;
25119     if (*t < '0' || *t > '9') {
25120       return -1;
25121     } else {
25122         count = *t++ - '0';
25123         while (*t >= '0' && *t <= '9') {
25124             count *= 10;
25125             count += *t++ - '0';
25126         }
25127     }
25128     *ts = t;
25129     return count;
25130 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)25131 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
25132     int number = __Pyx_BufFmt_ParseNumber(ts);
25133     if (number == -1)
25134         PyErr_Format(PyExc_ValueError,\
25135                      "Does not understand character buffer dtype format string ('%c')", **ts);
25136     return number;
25137 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)25138 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
25139   PyErr_Format(PyExc_ValueError,
25140                "Unexpected format string character: '%c'", ch);
25141 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)25142 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
25143   switch (ch) {
25144     case '?': return "'bool'";
25145     case 'c': return "'char'";
25146     case 'b': return "'signed char'";
25147     case 'B': return "'unsigned char'";
25148     case 'h': return "'short'";
25149     case 'H': return "'unsigned short'";
25150     case 'i': return "'int'";
25151     case 'I': return "'unsigned int'";
25152     case 'l': return "'long'";
25153     case 'L': return "'unsigned long'";
25154     case 'q': return "'long long'";
25155     case 'Q': return "'unsigned long long'";
25156     case 'f': return (is_complex ? "'complex float'" : "'float'");
25157     case 'd': return (is_complex ? "'complex double'" : "'double'");
25158     case 'g': return (is_complex ? "'complex long double'" : "'long double'");
25159     case 'T': return "a struct";
25160     case 'O': return "Python object";
25161     case 'P': return "a pointer";
25162     case 's': case 'p': return "a string";
25163     case 0: return "end";
25164     default: return "unparseable format string";
25165   }
25166 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)25167 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
25168   switch (ch) {
25169     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25170     case 'h': case 'H': return 2;
25171     case 'i': case 'I': case 'l': case 'L': return 4;
25172     case 'q': case 'Q': return 8;
25173     case 'f': return (is_complex ? 8 : 4);
25174     case 'd': return (is_complex ? 16 : 8);
25175     case 'g': {
25176       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
25177       return 0;
25178     }
25179     case 'O': case 'P': return sizeof(void*);
25180     default:
25181       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25182       return 0;
25183     }
25184 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)25185 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
25186   switch (ch) {
25187     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25188     case 'h': case 'H': return sizeof(short);
25189     case 'i': case 'I': return sizeof(int);
25190     case 'l': case 'L': return sizeof(long);
25191     #ifdef HAVE_LONG_LONG
25192     case 'q': case 'Q': return sizeof(PY_LONG_LONG);
25193     #endif
25194     case 'f': return sizeof(float) * (is_complex ? 2 : 1);
25195     case 'd': return sizeof(double) * (is_complex ? 2 : 1);
25196     case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
25197     case 'O': case 'P': return sizeof(void*);
25198     default: {
25199       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25200       return 0;
25201     }
25202   }
25203 }
25204 typedef struct { char c; short x; } __Pyx_st_short;
25205 typedef struct { char c; int x; } __Pyx_st_int;
25206 typedef struct { char c; long x; } __Pyx_st_long;
25207 typedef struct { char c; float x; } __Pyx_st_float;
25208 typedef struct { char c; double x; } __Pyx_st_double;
25209 typedef struct { char c; long double x; } __Pyx_st_longdouble;
25210 typedef struct { char c; void *x; } __Pyx_st_void_p;
25211 #ifdef HAVE_LONG_LONG
25212 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
25213 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)25214 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
25215   switch (ch) {
25216     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25217     case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
25218     case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
25219     case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
25220 #ifdef HAVE_LONG_LONG
25221     case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
25222 #endif
25223     case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
25224     case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
25225     case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
25226     case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
25227     default:
25228       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25229       return 0;
25230     }
25231 }
25232 /* These are for computing the padding at the end of the struct to align
25233    on the first member of the struct. This will probably the same as above,
25234    but we don't have any guarantees.
25235  */
25236 typedef struct { short x; char c; } __Pyx_pad_short;
25237 typedef struct { int x; char c; } __Pyx_pad_int;
25238 typedef struct { long x; char c; } __Pyx_pad_long;
25239 typedef struct { float x; char c; } __Pyx_pad_float;
25240 typedef struct { double x; char c; } __Pyx_pad_double;
25241 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
25242 typedef struct { void *x; char c; } __Pyx_pad_void_p;
25243 #ifdef HAVE_LONG_LONG
25244 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
25245 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)25246 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
25247   switch (ch) {
25248     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25249     case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
25250     case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
25251     case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
25252 #ifdef HAVE_LONG_LONG
25253     case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
25254 #endif
25255     case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
25256     case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
25257     case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
25258     case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
25259     default:
25260       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25261       return 0;
25262     }
25263 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)25264 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
25265   switch (ch) {
25266     case 'c':
25267         return 'H';
25268     case 'b': case 'h': case 'i':
25269     case 'l': case 'q': case 's': case 'p':
25270         return 'I';
25271     case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
25272         return 'U';
25273     case 'f': case 'd': case 'g':
25274         return (is_complex ? 'C' : 'R');
25275     case 'O':
25276         return 'O';
25277     case 'P':
25278         return 'P';
25279     default: {
25280       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25281       return 0;
25282     }
25283   }
25284 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)25285 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
25286   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
25287     const char* expected;
25288     const char* quote;
25289     if (ctx->head == NULL) {
25290       expected = "end";
25291       quote = "";
25292     } else {
25293       expected = ctx->head->field->type->name;
25294       quote = "'";
25295     }
25296     PyErr_Format(PyExc_ValueError,
25297                  "Buffer dtype mismatch, expected %s%s%s but got %s",
25298                  quote, expected, quote,
25299                  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
25300   } else {
25301     __Pyx_StructField* field = ctx->head->field;
25302     __Pyx_StructField* parent = (ctx->head - 1)->field;
25303     PyErr_Format(PyExc_ValueError,
25304                  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
25305                  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
25306                  parent->type->name, field->name);
25307   }
25308 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)25309 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
25310   char group;
25311   size_t size, offset, arraysize = 1;
25312   if (ctx->enc_type == 0) return 0;
25313   if (ctx->head->field->type->arraysize[0]) {
25314     int i, ndim = 0;
25315     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
25316         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
25317         ndim = 1;
25318         if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
25319             PyErr_Format(PyExc_ValueError,
25320                          "Expected a dimension of size %zu, got %zu",
25321                          ctx->head->field->type->arraysize[0], ctx->enc_count);
25322             return -1;
25323         }
25324     }
25325     if (!ctx->is_valid_array) {
25326       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
25327                    ctx->head->field->type->ndim, ndim);
25328       return -1;
25329     }
25330     for (i = 0; i < ctx->head->field->type->ndim; i++) {
25331       arraysize *= ctx->head->field->type->arraysize[i];
25332     }
25333     ctx->is_valid_array = 0;
25334     ctx->enc_count = 1;
25335   }
25336   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
25337   do {
25338     __Pyx_StructField* field = ctx->head->field;
25339     __Pyx_TypeInfo* type = field->type;
25340     if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
25341       size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
25342     } else {
25343       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
25344     }
25345     if (ctx->enc_packmode == '@') {
25346       size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
25347       size_t align_mod_offset;
25348       if (align_at == 0) return -1;
25349       align_mod_offset = ctx->fmt_offset % align_at;
25350       if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
25351       if (ctx->struct_alignment == 0)
25352           ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
25353                                                                  ctx->is_complex);
25354     }
25355     if (type->size != size || type->typegroup != group) {
25356       if (type->typegroup == 'C' && type->fields != NULL) {
25357         size_t parent_offset = ctx->head->parent_offset + field->offset;
25358         ++ctx->head;
25359         ctx->head->field = type->fields;
25360         ctx->head->parent_offset = parent_offset;
25361         continue;
25362       }
25363       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
25364       } else {
25365           __Pyx_BufFmt_RaiseExpected(ctx);
25366           return -1;
25367       }
25368     }
25369     offset = ctx->head->parent_offset + field->offset;
25370     if (ctx->fmt_offset != offset) {
25371       PyErr_Format(PyExc_ValueError,
25372                    "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
25373                    (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
25374       return -1;
25375     }
25376     ctx->fmt_offset += size;
25377     if (arraysize)
25378       ctx->fmt_offset += (arraysize - 1) * size;
25379     --ctx->enc_count;
25380     while (1) {
25381       if (field == &ctx->root) {
25382         ctx->head = NULL;
25383         if (ctx->enc_count != 0) {
25384           __Pyx_BufFmt_RaiseExpected(ctx);
25385           return -1;
25386         }
25387         break;
25388       }
25389       ctx->head->field = ++field;
25390       if (field->type == NULL) {
25391         --ctx->head;
25392         field = ctx->head->field;
25393         continue;
25394       } else if (field->type->typegroup == 'S') {
25395         size_t parent_offset = ctx->head->parent_offset + field->offset;
25396         if (field->type->fields->type == NULL) continue;
25397         field = field->type->fields;
25398         ++ctx->head;
25399         ctx->head->field = field;
25400         ctx->head->parent_offset = parent_offset;
25401         break;
25402       } else {
25403         break;
25404       }
25405     }
25406   } while (ctx->enc_count);
25407   ctx->enc_type = 0;
25408   ctx->is_complex = 0;
25409   return 0;
25410 }
25411 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)25412 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
25413 {
25414     const char *ts = *tsp;
25415     int i = 0, number, ndim;
25416     ++ts;
25417     if (ctx->new_count != 1) {
25418         PyErr_SetString(PyExc_ValueError,
25419                         "Cannot handle repeated arrays in format string");
25420         return NULL;
25421     }
25422     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25423     ndim = ctx->head->field->type->ndim;
25424     while (*ts && *ts != ')') {
25425         switch (*ts) {
25426             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
25427             default:  break;
25428         }
25429         number = __Pyx_BufFmt_ExpectNumber(&ts);
25430         if (number == -1) return NULL;
25431         if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
25432             return PyErr_Format(PyExc_ValueError,
25433                         "Expected a dimension of size %zu, got %d",
25434                         ctx->head->field->type->arraysize[i], number);
25435         if (*ts != ',' && *ts != ')')
25436             return PyErr_Format(PyExc_ValueError,
25437                                 "Expected a comma in format string, got '%c'", *ts);
25438         if (*ts == ',') ts++;
25439         i++;
25440     }
25441     if (i != ndim)
25442         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
25443                             ctx->head->field->type->ndim, i);
25444     if (!*ts) {
25445         PyErr_SetString(PyExc_ValueError,
25446                         "Unexpected end of format string, expected ')'");
25447         return NULL;
25448     }
25449     ctx->is_valid_array = 1;
25450     ctx->new_count = 1;
25451     *tsp = ++ts;
25452     return Py_None;
25453 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)25454 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
25455   int got_Z = 0;
25456   while (1) {
25457     switch(*ts) {
25458       case 0:
25459         if (ctx->enc_type != 0 && ctx->head == NULL) {
25460           __Pyx_BufFmt_RaiseExpected(ctx);
25461           return NULL;
25462         }
25463         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25464         if (ctx->head != NULL) {
25465           __Pyx_BufFmt_RaiseExpected(ctx);
25466           return NULL;
25467         }
25468         return ts;
25469       case ' ':
25470       case '\r':
25471       case '\n':
25472         ++ts;
25473         break;
25474       case '<':
25475         if (!__Pyx_Is_Little_Endian()) {
25476           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
25477           return NULL;
25478         }
25479         ctx->new_packmode = '=';
25480         ++ts;
25481         break;
25482       case '>':
25483       case '!':
25484         if (__Pyx_Is_Little_Endian()) {
25485           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
25486           return NULL;
25487         }
25488         ctx->new_packmode = '=';
25489         ++ts;
25490         break;
25491       case '=':
25492       case '@':
25493       case '^':
25494         ctx->new_packmode = *ts++;
25495         break;
25496       case 'T':
25497         {
25498           const char* ts_after_sub;
25499           size_t i, struct_count = ctx->new_count;
25500           size_t struct_alignment = ctx->struct_alignment;
25501           ctx->new_count = 1;
25502           ++ts;
25503           if (*ts != '{') {
25504             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
25505             return NULL;
25506           }
25507           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25508           ctx->enc_type = 0;
25509           ctx->enc_count = 0;
25510           ctx->struct_alignment = 0;
25511           ++ts;
25512           ts_after_sub = ts;
25513           for (i = 0; i != struct_count; ++i) {
25514             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
25515             if (!ts_after_sub) return NULL;
25516           }
25517           ts = ts_after_sub;
25518           if (struct_alignment) ctx->struct_alignment = struct_alignment;
25519         }
25520         break;
25521       case '}':
25522         {
25523           size_t alignment = ctx->struct_alignment;
25524           ++ts;
25525           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25526           ctx->enc_type = 0;
25527           if (alignment && ctx->fmt_offset % alignment) {
25528             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
25529           }
25530         }
25531         return ts;
25532       case 'x':
25533         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25534         ctx->fmt_offset += ctx->new_count;
25535         ctx->new_count = 1;
25536         ctx->enc_count = 0;
25537         ctx->enc_type = 0;
25538         ctx->enc_packmode = ctx->new_packmode;
25539         ++ts;
25540         break;
25541       case 'Z':
25542         got_Z = 1;
25543         ++ts;
25544         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
25545           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
25546           return NULL;
25547         }
25548         CYTHON_FALLTHROUGH;
25549       case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
25550       case 'l': case 'L': case 'q': case 'Q':
25551       case 'f': case 'd': case 'g':
25552       case 'O': case 'p':
25553         if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
25554             (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
25555           ctx->enc_count += ctx->new_count;
25556           ctx->new_count = 1;
25557           got_Z = 0;
25558           ++ts;
25559           break;
25560         }
25561         CYTHON_FALLTHROUGH;
25562       case 's':
25563         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25564         ctx->enc_count = ctx->new_count;
25565         ctx->enc_packmode = ctx->new_packmode;
25566         ctx->enc_type = *ts;
25567         ctx->is_complex = got_Z;
25568         ++ts;
25569         ctx->new_count = 1;
25570         got_Z = 0;
25571         break;
25572       case ':':
25573         ++ts;
25574         while(*ts != ':') ++ts;
25575         ++ts;
25576         break;
25577       case '(':
25578         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
25579         break;
25580       default:
25581         {
25582           int number = __Pyx_BufFmt_ExpectNumber(&ts);
25583           if (number == -1) return NULL;
25584           ctx->new_count = (size_t)number;
25585         }
25586     }
25587   }
25588 }
25589 
25590 /* TypeInfoCompare */
25591   static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo * a,__Pyx_TypeInfo * b)25592 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
25593 {
25594     int i;
25595     if (!a || !b)
25596         return 0;
25597     if (a == b)
25598         return 1;
25599     if (a->size != b->size || a->typegroup != b->typegroup ||
25600             a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
25601         if (a->typegroup == 'H' || b->typegroup == 'H') {
25602             return a->size == b->size;
25603         } else {
25604             return 0;
25605         }
25606     }
25607     if (a->ndim) {
25608         for (i = 0; i < a->ndim; i++)
25609             if (a->arraysize[i] != b->arraysize[i])
25610                 return 0;
25611     }
25612     if (a->typegroup == 'S') {
25613         if (a->flags != b->flags)
25614             return 0;
25615         if (a->fields || b->fields) {
25616             if (!(a->fields && b->fields))
25617                 return 0;
25618             for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
25619                 __Pyx_StructField *field_a = a->fields + i;
25620                 __Pyx_StructField *field_b = b->fields + i;
25621                 if (field_a->offset != field_b->offset ||
25622                     !__pyx_typeinfo_cmp(field_a->type, field_b->type))
25623                     return 0;
25624             }
25625             return !a->fields[i].type && !b->fields[i].type;
25626         }
25627     }
25628     return 1;
25629 }
25630 
25631 /* MemviewSliceValidateAndInit */
25632   static int
__pyx_check_strides(Py_buffer * buf,int dim,int ndim,int spec)25633 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
25634 {
25635     if (buf->shape[dim] <= 1)
25636         return 1;
25637     if (buf->strides) {
25638         if (spec & __Pyx_MEMVIEW_CONTIG) {
25639             if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
25640                 if (unlikely(buf->strides[dim] != sizeof(void *))) {
25641                     PyErr_Format(PyExc_ValueError,
25642                                  "Buffer is not indirectly contiguous "
25643                                  "in dimension %d.", dim);
25644                     goto fail;
25645                 }
25646             } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
25647                 PyErr_SetString(PyExc_ValueError,
25648                                 "Buffer and memoryview are not contiguous "
25649                                 "in the same dimension.");
25650                 goto fail;
25651             }
25652         }
25653         if (spec & __Pyx_MEMVIEW_FOLLOW) {
25654             Py_ssize_t stride = buf->strides[dim];
25655             if (stride < 0)
25656                 stride = -stride;
25657             if (unlikely(stride < buf->itemsize)) {
25658                 PyErr_SetString(PyExc_ValueError,
25659                                 "Buffer and memoryview are not contiguous "
25660                                 "in the same dimension.");
25661                 goto fail;
25662             }
25663         }
25664     } else {
25665         if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
25666             PyErr_Format(PyExc_ValueError,
25667                          "C-contiguous buffer is not contiguous in "
25668                          "dimension %d", dim);
25669             goto fail;
25670         } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
25671             PyErr_Format(PyExc_ValueError,
25672                          "C-contiguous buffer is not indirect in "
25673                          "dimension %d", dim);
25674             goto fail;
25675         } else if (unlikely(buf->suboffsets)) {
25676             PyErr_SetString(PyExc_ValueError,
25677                             "Buffer exposes suboffsets but no strides");
25678             goto fail;
25679         }
25680     }
25681     return 1;
25682 fail:
25683     return 0;
25684 }
25685 static int
__pyx_check_suboffsets(Py_buffer * buf,int dim,CYTHON_UNUSED int ndim,int spec)25686 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
25687 {
25688     if (spec & __Pyx_MEMVIEW_DIRECT) {
25689         if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
25690             PyErr_Format(PyExc_ValueError,
25691                          "Buffer not compatible with direct access "
25692                          "in dimension %d.", dim);
25693             goto fail;
25694         }
25695     }
25696     if (spec & __Pyx_MEMVIEW_PTR) {
25697         if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
25698             PyErr_Format(PyExc_ValueError,
25699                          "Buffer is not indirectly accessible "
25700                          "in dimension %d.", dim);
25701             goto fail;
25702         }
25703     }
25704     return 1;
25705 fail:
25706     return 0;
25707 }
25708 static int
__pyx_verify_contig(Py_buffer * buf,int ndim,int c_or_f_flag)25709 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
25710 {
25711     int i;
25712     if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
25713         Py_ssize_t stride = 1;
25714         for (i = 0; i < ndim; i++) {
25715             if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
25716                 PyErr_SetString(PyExc_ValueError,
25717                     "Buffer not fortran contiguous.");
25718                 goto fail;
25719             }
25720             stride = stride * buf->shape[i];
25721         }
25722     } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
25723         Py_ssize_t stride = 1;
25724         for (i = ndim - 1; i >- 1; i--) {
25725             if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
25726                 PyErr_SetString(PyExc_ValueError,
25727                     "Buffer not C contiguous.");
25728                 goto fail;
25729             }
25730             stride = stride * buf->shape[i];
25731         }
25732     }
25733     return 1;
25734 fail:
25735     return 0;
25736 }
__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)25737 static int __Pyx_ValidateAndInit_memviewslice(
25738                 int *axes_specs,
25739                 int c_or_f_flag,
25740                 int buf_flags,
25741                 int ndim,
25742                 __Pyx_TypeInfo *dtype,
25743                 __Pyx_BufFmt_StackElem stack[],
25744                 __Pyx_memviewslice *memviewslice,
25745                 PyObject *original_obj)
25746 {
25747     struct __pyx_memoryview_obj *memview, *new_memview;
25748     __Pyx_RefNannyDeclarations
25749     Py_buffer *buf;
25750     int i, spec = 0, retval = -1;
25751     __Pyx_BufFmt_Context ctx;
25752     int from_memoryview = __pyx_memoryview_check(original_obj);
25753     __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
25754     if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
25755                                                             original_obj)->typeinfo)) {
25756         memview = (struct __pyx_memoryview_obj *) original_obj;
25757         new_memview = NULL;
25758     } else {
25759         memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
25760                                             original_obj, buf_flags, 0, dtype);
25761         new_memview = memview;
25762         if (unlikely(!memview))
25763             goto fail;
25764     }
25765     buf = &memview->view;
25766     if (unlikely(buf->ndim != ndim)) {
25767         PyErr_Format(PyExc_ValueError,
25768                 "Buffer has wrong number of dimensions (expected %d, got %d)",
25769                 ndim, buf->ndim);
25770         goto fail;
25771     }
25772     if (new_memview) {
25773         __Pyx_BufFmt_Init(&ctx, stack, dtype);
25774         if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
25775     }
25776     if (unlikely((unsigned) buf->itemsize != dtype->size)) {
25777         PyErr_Format(PyExc_ValueError,
25778                      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
25779                      "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
25780                      buf->itemsize,
25781                      (buf->itemsize > 1) ? "s" : "",
25782                      dtype->name,
25783                      dtype->size,
25784                      (dtype->size > 1) ? "s" : "");
25785         goto fail;
25786     }
25787     if (buf->len > 0) {
25788         for (i = 0; i < ndim; i++) {
25789             spec = axes_specs[i];
25790             if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
25791                 goto fail;
25792             if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
25793                 goto fail;
25794         }
25795         if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
25796             goto fail;
25797     }
25798     if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
25799                                          new_memview != NULL) == -1)) {
25800         goto fail;
25801     }
25802     retval = 0;
25803     goto no_fail;
25804 fail:
25805     Py_XDECREF(new_memview);
25806     retval = -1;
25807 no_fail:
25808     __Pyx_RefNannyFinishContext();
25809     return retval;
25810 }
25811 
25812 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float_t(PyObject * obj,int writable_flag)25813   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float_t(PyObject *obj, int writable_flag) {
25814     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
25815     __Pyx_BufFmt_StackElem stack[1];
25816     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
25817     int retcode;
25818     if (obj == Py_None) {
25819         result.memview = (struct __pyx_memoryview_obj *) Py_None;
25820         return result;
25821     }
25822     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
25823                                                  PyBUF_RECORDS_RO | writable_flag, 2,
25824                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, stack,
25825                                                  &result, obj);
25826     if (unlikely(retcode == -1))
25827         goto __pyx_fail;
25828     return result;
25829 __pyx_fail:
25830     result.memview = NULL;
25831     result.data = NULL;
25832     return result;
25833 }
25834 
25835 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int_t(PyObject * obj,int writable_flag)25836   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int_t(PyObject *obj, int writable_flag) {
25837     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
25838     __Pyx_BufFmt_StackElem stack[1];
25839     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
25840     int retcode;
25841     if (obj == Py_None) {
25842         result.memview = (struct __pyx_memoryview_obj *) Py_None;
25843         return result;
25844     }
25845     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
25846                                                  PyBUF_RECORDS_RO | writable_flag, 1,
25847                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, stack,
25848                                                  &result, obj);
25849     if (unlikely(retcode == -1))
25850         goto __pyx_fail;
25851     return result;
25852 __pyx_fail:
25853     result.memview = NULL;
25854     result.data = NULL;
25855     return result;
25856 }
25857 
25858 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)25859   static int __Pyx_check_binary_version(void) {
25860     char ctversion[4], rtversion[4];
25861     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
25862     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
25863     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
25864         char message[200];
25865         PyOS_snprintf(message, sizeof(message),
25866                       "compiletime version %s of module '%.100s' "
25867                       "does not match runtime version %s",
25868                       ctversion, __Pyx_MODULE_NAME, rtversion);
25869         return PyErr_WarnEx(NULL, message, 1);
25870     }
25871     return 0;
25872 }
25873 
25874 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)25875   static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
25876     while (t->p) {
25877         #if PY_MAJOR_VERSION < 3
25878         if (t->is_unicode) {
25879             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
25880         } else if (t->intern) {
25881             *t->p = PyString_InternFromString(t->s);
25882         } else {
25883             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
25884         }
25885         #else
25886         if (t->is_unicode | t->is_str) {
25887             if (t->intern) {
25888                 *t->p = PyUnicode_InternFromString(t->s);
25889             } else if (t->encoding) {
25890                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
25891             } else {
25892                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
25893             }
25894         } else {
25895             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
25896         }
25897         #endif
25898         if (!*t->p)
25899             return -1;
25900         if (PyObject_Hash(*t->p) == -1)
25901             return -1;
25902         ++t;
25903     }
25904     return 0;
25905 }
25906 
__Pyx_PyUnicode_FromString(const char * c_str)25907 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
25908     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
25909 }
__Pyx_PyObject_AsString(PyObject * o)25910 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
25911     Py_ssize_t ignore;
25912     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
25913 }
25914 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
25915 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)25916 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
25917     char* defenc_c;
25918     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
25919     if (!defenc) return NULL;
25920     defenc_c = PyBytes_AS_STRING(defenc);
25921 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
25922     {
25923         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
25924         char* c;
25925         for (c = defenc_c; c < end; c++) {
25926             if ((unsigned char) (*c) >= 128) {
25927                 PyUnicode_AsASCIIString(o);
25928                 return NULL;
25929             }
25930         }
25931     }
25932 #endif
25933     *length = PyBytes_GET_SIZE(defenc);
25934     return defenc_c;
25935 }
25936 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)25937 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
25938     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
25939 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
25940     if (likely(PyUnicode_IS_ASCII(o))) {
25941         *length = PyUnicode_GET_LENGTH(o);
25942         return PyUnicode_AsUTF8(o);
25943     } else {
25944         PyUnicode_AsASCIIString(o);
25945         return NULL;
25946     }
25947 #else
25948     return PyUnicode_AsUTF8AndSize(o, length);
25949 #endif
25950 }
25951 #endif
25952 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)25953 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
25954 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
25955     if (
25956 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
25957             __Pyx_sys_getdefaultencoding_not_ascii &&
25958 #endif
25959             PyUnicode_Check(o)) {
25960         return __Pyx_PyUnicode_AsStringAndSize(o, length);
25961     } else
25962 #endif
25963 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
25964     if (PyByteArray_Check(o)) {
25965         *length = PyByteArray_GET_SIZE(o);
25966         return PyByteArray_AS_STRING(o);
25967     } else
25968 #endif
25969     {
25970         char* result;
25971         int r = PyBytes_AsStringAndSize(o, &result, length);
25972         if (unlikely(r < 0)) {
25973             return NULL;
25974         } else {
25975             return result;
25976         }
25977     }
25978 }
__Pyx_PyObject_IsTrue(PyObject * x)25979 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
25980    int is_true = x == Py_True;
25981    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
25982    else return PyObject_IsTrue(x);
25983 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)25984 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
25985     int retval;
25986     if (unlikely(!x)) return -1;
25987     retval = __Pyx_PyObject_IsTrue(x);
25988     Py_DECREF(x);
25989     return retval;
25990 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)25991 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
25992 #if PY_MAJOR_VERSION >= 3
25993     if (PyLong_Check(result)) {
25994         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
25995                 "__int__ returned non-int (type %.200s).  "
25996                 "The ability to return an instance of a strict subclass of int "
25997                 "is deprecated, and may be removed in a future version of Python.",
25998                 Py_TYPE(result)->tp_name)) {
25999             Py_DECREF(result);
26000             return NULL;
26001         }
26002         return result;
26003     }
26004 #endif
26005     PyErr_Format(PyExc_TypeError,
26006                  "__%.4s__ returned non-%.4s (type %.200s)",
26007                  type_name, type_name, Py_TYPE(result)->tp_name);
26008     Py_DECREF(result);
26009     return NULL;
26010 }
__Pyx_PyNumber_IntOrLong(PyObject * x)26011 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
26012 #if CYTHON_USE_TYPE_SLOTS
26013   PyNumberMethods *m;
26014 #endif
26015   const char *name = NULL;
26016   PyObject *res = NULL;
26017 #if PY_MAJOR_VERSION < 3
26018   if (likely(PyInt_Check(x) || PyLong_Check(x)))
26019 #else
26020   if (likely(PyLong_Check(x)))
26021 #endif
26022     return __Pyx_NewRef(x);
26023 #if CYTHON_USE_TYPE_SLOTS
26024   m = Py_TYPE(x)->tp_as_number;
26025   #if PY_MAJOR_VERSION < 3
26026   if (m && m->nb_int) {
26027     name = "int";
26028     res = m->nb_int(x);
26029   }
26030   else if (m && m->nb_long) {
26031     name = "long";
26032     res = m->nb_long(x);
26033   }
26034   #else
26035   if (likely(m && m->nb_int)) {
26036     name = "int";
26037     res = m->nb_int(x);
26038   }
26039   #endif
26040 #else
26041   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
26042     res = PyNumber_Int(x);
26043   }
26044 #endif
26045   if (likely(res)) {
26046 #if PY_MAJOR_VERSION < 3
26047     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
26048 #else
26049     if (unlikely(!PyLong_CheckExact(res))) {
26050 #endif
26051         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
26052     }
26053   }
26054   else if (!PyErr_Occurred()) {
26055     PyErr_SetString(PyExc_TypeError,
26056                     "an integer is required");
26057   }
26058   return res;
26059 }
26060 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
26061   Py_ssize_t ival;
26062   PyObject *x;
26063 #if PY_MAJOR_VERSION < 3
26064   if (likely(PyInt_CheckExact(b))) {
26065     if (sizeof(Py_ssize_t) >= sizeof(long))
26066         return PyInt_AS_LONG(b);
26067     else
26068         return PyInt_AsSsize_t(b);
26069   }
26070 #endif
26071   if (likely(PyLong_CheckExact(b))) {
26072     #if CYTHON_USE_PYLONG_INTERNALS
26073     const digit* digits = ((PyLongObject*)b)->ob_digit;
26074     const Py_ssize_t size = Py_SIZE(b);
26075     if (likely(__Pyx_sst_abs(size) <= 1)) {
26076         ival = likely(size) ? digits[0] : 0;
26077         if (size == -1) ival = -ival;
26078         return ival;
26079     } else {
26080       switch (size) {
26081          case 2:
26082            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26083              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26084            }
26085            break;
26086          case -2:
26087            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26088              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26089            }
26090            break;
26091          case 3:
26092            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
26093              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26094            }
26095            break;
26096          case -3:
26097            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
26098              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26099            }
26100            break;
26101          case 4:
26102            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
26103              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]));
26104            }
26105            break;
26106          case -4:
26107            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
26108              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]));
26109            }
26110            break;
26111       }
26112     }
26113     #endif
26114     return PyLong_AsSsize_t(b);
26115   }
26116   x = PyNumber_Index(b);
26117   if (!x) return -1;
26118   ival = PyInt_AsSsize_t(x);
26119   Py_DECREF(x);
26120   return ival;
26121 }
26122 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
26123   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
26124 }
26125 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
26126     return PyInt_FromSize_t(ival);
26127 }
26128 
26129 
26130 #endif /* Py_PYTHON_H */
26131