3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
8 #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10 #error Cython requires Python 2.6+ or Python 3.3+.
12 #define CYTHON_ABI "0_29_30"
13 #define CYTHON_HEX_VERSION 0x001D1EF0
14 #define CYTHON_FUTURE_DIVISION 0
17 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
31 #define DL_IMPORT(t) t
34 #define DL_EXPORT(t) t
37 #ifndef HAVE_LONG_LONG
38 #if PY_VERSION_HEX >= 0x02070000
39 #define HAVE_LONG_LONG
43 #define PY_LONG_LONG LONG_LONG
46 #define Py_HUGE_VAL HUGE_VAL
49 #define CYTHON_COMPILING_IN_PYPY 1
50 #define CYTHON_COMPILING_IN_PYSTON 0
51 #define CYTHON_COMPILING_IN_CPYTHON 0
52 #undef CYTHON_USE_TYPE_SLOTS
53 #define CYTHON_USE_TYPE_SLOTS 0
54 #undef CYTHON_USE_PYTYPE_LOOKUP
55 #define CYTHON_USE_PYTYPE_LOOKUP 0
56 #if PY_VERSION_HEX < 0x03050000
57 #undef CYTHON_USE_ASYNC_SLOTS
58 #define CYTHON_USE_ASYNC_SLOTS 0
59 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60 #define CYTHON_USE_ASYNC_SLOTS 1
62 #undef CYTHON_USE_PYLIST_INTERNALS
63 #define CYTHON_USE_PYLIST_INTERNALS 0
64 #undef CYTHON_USE_UNICODE_INTERNALS
65 #define CYTHON_USE_UNICODE_INTERNALS 0
66 #undef CYTHON_USE_UNICODE_WRITER
67 #define CYTHON_USE_UNICODE_WRITER 0
68 #undef CYTHON_USE_PYLONG_INTERNALS
69 #define CYTHON_USE_PYLONG_INTERNALS 0
70 #undef CYTHON_AVOID_BORROWED_REFS
71 #define CYTHON_AVOID_BORROWED_REFS 1
72 #undef CYTHON_ASSUME_SAFE_MACROS
73 #define CYTHON_ASSUME_SAFE_MACROS 0
74 #undef CYTHON_UNPACK_METHODS
75 #define CYTHON_UNPACK_METHODS 0
76 #undef CYTHON_FAST_THREAD_STATE
77 #define CYTHON_FAST_THREAD_STATE 0
78 #undef CYTHON_FAST_PYCALL
79 #define CYTHON_FAST_PYCALL 0
80 #undef CYTHON_PEP489_MULTI_PHASE_INIT
81 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82 #undef CYTHON_USE_TP_FINALIZE
83 #define CYTHON_USE_TP_FINALIZE 0
84 #undef CYTHON_USE_DICT_VERSIONS
85 #define CYTHON_USE_DICT_VERSIONS 0
86 #undef CYTHON_USE_EXC_INFO_STACK
87 #define CYTHON_USE_EXC_INFO_STACK 0
88 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
89 #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900)
91 #elif defined(PYSTON_VERSION)
92 #define CYTHON_COMPILING_IN_PYPY 0
93 #define CYTHON_COMPILING_IN_PYSTON 1
94 #define CYTHON_COMPILING_IN_CPYTHON 0
95 #ifndef CYTHON_USE_TYPE_SLOTS
96 #define CYTHON_USE_TYPE_SLOTS 1
98 #undef CYTHON_USE_PYTYPE_LOOKUP
99 #define CYTHON_USE_PYTYPE_LOOKUP 0
100 #undef CYTHON_USE_ASYNC_SLOTS
101 #define CYTHON_USE_ASYNC_SLOTS 0
102 #undef CYTHON_USE_PYLIST_INTERNALS
103 #define CYTHON_USE_PYLIST_INTERNALS 0
104 #ifndef CYTHON_USE_UNICODE_INTERNALS
105 #define CYTHON_USE_UNICODE_INTERNALS 1
107 #undef CYTHON_USE_UNICODE_WRITER
108 #define CYTHON_USE_UNICODE_WRITER 0
109 #undef CYTHON_USE_PYLONG_INTERNALS
110 #define CYTHON_USE_PYLONG_INTERNALS 0
111 #ifndef CYTHON_AVOID_BORROWED_REFS
112 #define CYTHON_AVOID_BORROWED_REFS 0
114 #ifndef CYTHON_ASSUME_SAFE_MACROS
115 #define CYTHON_ASSUME_SAFE_MACROS 1
117 #ifndef CYTHON_UNPACK_METHODS
118 #define CYTHON_UNPACK_METHODS 1
120 #undef CYTHON_FAST_THREAD_STATE
121 #define CYTHON_FAST_THREAD_STATE 0
122 #undef CYTHON_FAST_PYCALL
123 #define CYTHON_FAST_PYCALL 0
124 #undef CYTHON_PEP489_MULTI_PHASE_INIT
125 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
126 #undef CYTHON_USE_TP_FINALIZE
127 #define CYTHON_USE_TP_FINALIZE 0
128 #undef CYTHON_USE_DICT_VERSIONS
129 #define CYTHON_USE_DICT_VERSIONS 0
130 #undef CYTHON_USE_EXC_INFO_STACK
131 #define CYTHON_USE_EXC_INFO_STACK 0
132 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
133 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
136 #define CYTHON_COMPILING_IN_PYPY 0
137 #define CYTHON_COMPILING_IN_PYSTON 0
138 #define CYTHON_COMPILING_IN_CPYTHON 1
139 #ifndef CYTHON_USE_TYPE_SLOTS
140 #define CYTHON_USE_TYPE_SLOTS 1
142 #if PY_VERSION_HEX < 0x02070000
143 #undef CYTHON_USE_PYTYPE_LOOKUP
144 #define CYTHON_USE_PYTYPE_LOOKUP 0
145 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
146 #define CYTHON_USE_PYTYPE_LOOKUP 1
148 #if PY_MAJOR_VERSION < 3
149 #undef CYTHON_USE_ASYNC_SLOTS
150 #define CYTHON_USE_ASYNC_SLOTS 0
151 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
152 #define CYTHON_USE_ASYNC_SLOTS 1
154 #if PY_VERSION_HEX < 0x02070000
155 #undef CYTHON_USE_PYLONG_INTERNALS
156 #define CYTHON_USE_PYLONG_INTERNALS 0
157 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
158 #define CYTHON_USE_PYLONG_INTERNALS 1
160 #ifndef CYTHON_USE_PYLIST_INTERNALS
161 #define CYTHON_USE_PYLIST_INTERNALS 1
163 #ifndef CYTHON_USE_UNICODE_INTERNALS
164 #define CYTHON_USE_UNICODE_INTERNALS 1
166 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
167 #undef CYTHON_USE_UNICODE_WRITER
168 #define CYTHON_USE_UNICODE_WRITER 0
169 #elif !defined(CYTHON_USE_UNICODE_WRITER)
170 #define CYTHON_USE_UNICODE_WRITER 1
172 #ifndef CYTHON_AVOID_BORROWED_REFS
173 #define CYTHON_AVOID_BORROWED_REFS 0
175 #ifndef CYTHON_ASSUME_SAFE_MACROS
176 #define CYTHON_ASSUME_SAFE_MACROS 1
178 #ifndef CYTHON_UNPACK_METHODS
179 #define CYTHON_UNPACK_METHODS 1
181 #if PY_VERSION_HEX >= 0x030B00A4
182 #undef CYTHON_FAST_THREAD_STATE
183 #define CYTHON_FAST_THREAD_STATE 0
184 #elif !defined(CYTHON_FAST_THREAD_STATE)
185 #define CYTHON_FAST_THREAD_STATE 1
187 #ifndef CYTHON_FAST_PYCALL
188 #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
190 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
191 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
193 #ifndef CYTHON_USE_TP_FINALIZE
194 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
196 #ifndef CYTHON_USE_DICT_VERSIONS
197 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
199 #if PY_VERSION_HEX >= 0x030B00A4
200 #undef CYTHON_USE_EXC_INFO_STACK
201 #define CYTHON_USE_EXC_INFO_STACK 0
202 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
203 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
205 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
206 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
209 #if !defined(CYTHON_FAST_PYCCALL)
210 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
212 #if CYTHON_USE_PYLONG_INTERNALS
213 #if PY_MAJOR_VERSION < 3
214 #include "longintrepr.h"
220 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P ==
sizeof(
void*)) };
223 #ifndef __has_attribute
224 #define __has_attribute(x) 0
226 #ifndef __has_cpp_attribute
227 #define __has_cpp_attribute(x) 0
229 #ifndef CYTHON_RESTRICT
230 #if defined(__GNUC__)
231 #define CYTHON_RESTRICT __restrict__
232 #elif defined(_MSC_VER) && _MSC_VER >= 1400
233 #define CYTHON_RESTRICT __restrict
234 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
235 #define CYTHON_RESTRICT restrict
237 #define CYTHON_RESTRICT
240 #ifndef CYTHON_UNUSED
241 # if defined(__GNUC__)
242 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
243 # define CYTHON_UNUSED __attribute__ ((__unused__))
245 # define CYTHON_UNUSED
247 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
248 # define CYTHON_UNUSED __attribute__ ((__unused__))
250 # define CYTHON_UNUSED
253 #ifndef CYTHON_MAYBE_UNUSED_VAR
254 # if defined(__cplusplus)
255 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
257 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
260 #ifndef CYTHON_NCP_UNUSED
261 # if CYTHON_COMPILING_IN_CPYTHON
262 # define CYTHON_NCP_UNUSED
264 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
267 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
269 #ifndef _MSC_STDINT_H_
271 typedef unsigned char uint8_t;
272 typedef unsigned int uint32_t;
274 typedef unsigned __int8 uint8_t;
275 typedef unsigned __int32 uint32_t;
281 #ifndef CYTHON_FALLTHROUGH
282 #if defined(__cplusplus) && __cplusplus >= 201103L
283 #if __has_cpp_attribute(fallthrough)
284 #define CYTHON_FALLTHROUGH [[fallthrough]]
285 #elif __has_cpp_attribute(clang::fallthrough)
286 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
287 #elif __has_cpp_attribute(gnu::fallthrough)
288 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
291 #ifndef CYTHON_FALLTHROUGH
292 #if __has_attribute(fallthrough)
293 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
295 #define CYTHON_FALLTHROUGH
298 #if defined(__clang__ ) && defined(__apple_build_version__)
299 #if __apple_build_version__ < 7000000
300 #undef CYTHON_FALLTHROUGH
301 #define CYTHON_FALLTHROUGH
307 #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
309 #ifndef CYTHON_INLINE
310 #if defined(__clang__)
311 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
313 #define CYTHON_INLINE inline
317 void __Pyx_call_destructor(
T& x) {
321 class __Pyx_FakeReference {
323 __Pyx_FakeReference() : ptr(NULL) { }
324 __Pyx_FakeReference(
const T& ref) : ptr(const_cast<
T*>(&ref)) { }
325 T *operator->() {
return ptr; }
326 T *operator&() {
return ptr; }
327 operator T&() {
return *ptr; }
328 template<
typename U>
bool operator ==(
U other) {
return *ptr == other; }
329 template<
typename U>
bool operator !=(
U other) {
return *ptr != other; }
334 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
335 #define Py_OptimizeFlag 0
337 #define __PYX_BUILD_PY_SSIZE_T "n"
338 #define CYTHON_FORMAT_SSIZE_T "z"
339 #if PY_MAJOR_VERSION < 3
340 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
341 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
342 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
343 #define __Pyx_DefaultClassType PyClass_Type
345 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
346 #define __Pyx_DefaultClassType PyType_Type
347 #if PY_VERSION_HEX >= 0x030B00A1
348 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(
int a,
int k,
int l,
int s,
int f,
349 PyObject *code, PyObject *
c, PyObject*
n, PyObject *
v,
350 PyObject *fv, PyObject *cell, PyObject* fn,
351 PyObject *name,
int fline, PyObject *lnos) {
352 PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
353 PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
354 const char *fn_cstr=NULL;
355 const char *name_cstr=NULL;
356 PyCodeObject* co=NULL;
357 PyObject *type, *value, *traceback;
358 PyErr_Fetch(&type, &value, &traceback);
359 if (!(kwds=PyDict_New()))
goto end;
360 if (!(argcount=PyLong_FromLong(a)))
goto end;
361 if (PyDict_SetItemString(kwds,
"co_argcount", argcount) != 0)
goto end;
362 if (!(posonlyargcount=PyLong_FromLong(0)))
goto end;
363 if (PyDict_SetItemString(kwds,
"co_posonlyargcount", posonlyargcount) != 0)
goto end;
364 if (!(kwonlyargcount=PyLong_FromLong(k)))
goto end;
365 if (PyDict_SetItemString(kwds,
"co_kwonlyargcount", kwonlyargcount) != 0)
goto end;
366 if (!(nlocals=PyLong_FromLong(l)))
goto end;
367 if (PyDict_SetItemString(kwds,
"co_nlocals", nlocals) != 0)
goto end;
368 if (!(stacksize=PyLong_FromLong(
s)))
goto end;
369 if (PyDict_SetItemString(kwds,
"co_stacksize", stacksize) != 0)
goto end;
370 if (!(flags=PyLong_FromLong(
f)))
goto end;
371 if (PyDict_SetItemString(kwds,
"co_flags", flags) != 0)
goto end;
372 if (PyDict_SetItemString(kwds,
"co_code", code) != 0)
goto end;
373 if (PyDict_SetItemString(kwds,
"co_consts",
c) != 0)
goto end;
374 if (PyDict_SetItemString(kwds,
"co_names",
n) != 0)
goto end;
375 if (PyDict_SetItemString(kwds,
"co_varnames",
v) != 0)
goto end;
376 if (PyDict_SetItemString(kwds,
"co_freevars", fv) != 0)
goto end;
377 if (PyDict_SetItemString(kwds,
"co_cellvars", cell) != 0)
goto end;
378 if (PyDict_SetItemString(kwds,
"co_linetable", lnos) != 0)
goto end;
379 if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL)))
goto end;
380 if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL)))
goto end;
381 if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline)))
goto end;
382 if (!(replace = PyObject_GetAttrString((PyObject*)co,
"replace")))
goto cleanup_code_too;
383 if (!(empty = PyTuple_New(0)))
goto cleanup_code_too;
384 if (!(call_result = PyObject_Call(replace, empty, kwds)))
goto cleanup_code_too;
385 Py_XDECREF((PyObject*)co);
386 co = (PyCodeObject*)call_result;
390 Py_XDECREF((PyObject*)co);
395 Py_XDECREF(argcount);
396 Py_XDECREF(posonlyargcount);
397 Py_XDECREF(kwonlyargcount);
399 Py_XDECREF(stacksize);
401 Py_XDECREF(call_result);
404 PyErr_Restore(type, value, traceback);
409 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
410 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
412 #define __Pyx_DefaultClassType PyType_Type
414 #ifndef Py_TPFLAGS_CHECKTYPES
415 #define Py_TPFLAGS_CHECKTYPES 0
417 #ifndef Py_TPFLAGS_HAVE_INDEX
418 #define Py_TPFLAGS_HAVE_INDEX 0
420 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
421 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
423 #ifndef Py_TPFLAGS_HAVE_FINALIZE
424 #define Py_TPFLAGS_HAVE_FINALIZE 0
426 #ifndef METH_STACKLESS
427 #define METH_STACKLESS 0
429 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
430 #ifndef METH_FASTCALL
431 #define METH_FASTCALL 0x80
433 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *
self, PyObject *
const *args, Py_ssize_t nargs);
434 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *
self, PyObject *
const *args,
435 Py_ssize_t nargs, PyObject *kwnames);
437 #define __Pyx_PyCFunctionFast _PyCFunctionFast
438 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
440 #if CYTHON_FAST_PYCCALL
441 #define __Pyx_PyFastCFunction_Check(func)\
442 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
444 #define __Pyx_PyFastCFunction_Check(func) 0
446 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
447 #define PyObject_Malloc(s) PyMem_Malloc(s)
448 #define PyObject_Free(p) PyMem_Free(p)
449 #define PyObject_Realloc(p) PyMem_Realloc(p)
451 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
452 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
453 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
454 #define PyMem_RawFree(p) PyMem_Free(p)
456 #if CYTHON_COMPILING_IN_PYSTON
457 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
458 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
460 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
461 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
463 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
464 #define __Pyx_PyThreadState_Current PyThreadState_GET()
465 #elif PY_VERSION_HEX >= 0x03060000
466 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
467 #elif PY_VERSION_HEX >= 0x03000000
468 #define __Pyx_PyThreadState_Current PyThreadState_GET()
470 #define __Pyx_PyThreadState_Current _PyThreadState_Current
472 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
473 #include "pythread.h"
474 #define Py_tss_NEEDS_INIT 0
475 typedef int Py_tss_t;
476 static CYTHON_INLINE
int PyThread_tss_create(Py_tss_t *key) {
477 *key = PyThread_create_key();
480 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(
void) {
481 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(
sizeof(Py_tss_t));
482 *key = Py_tss_NEEDS_INIT;
485 static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
488 static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
489 return *key != Py_tss_NEEDS_INIT;
491 static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
492 PyThread_delete_key(*key);
493 *key = Py_tss_NEEDS_INIT;
495 static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
496 return PyThread_set_key_value(*key, value);
498 static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
499 return PyThread_get_key_value(*key);
502 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
503 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
505 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
507 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
508 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
509 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
511 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
512 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
514 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
515 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
517 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
519 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
520 #define CYTHON_PEP393_ENABLED 1
521 #if defined(PyUnicode_IS_READY)
522 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
523 0 : _PyUnicode_Ready((PyObject *)(op)))
525 #define __Pyx_PyUnicode_READY(op) (0)
527 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
528 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
529 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
530 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
531 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
532 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
533 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
534 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
535 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
536 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
538 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
541 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
544 #define CYTHON_PEP393_ENABLED 0
545 #define PyUnicode_1BYTE_KIND 1
546 #define PyUnicode_2BYTE_KIND 2
547 #define PyUnicode_4BYTE_KIND 4
548 #define __Pyx_PyUnicode_READY(op) (0)
549 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
550 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
551 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
552 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
553 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
554 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
555 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
556 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
558 #if CYTHON_COMPILING_IN_PYPY
559 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
560 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
562 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
563 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
564 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
566 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
567 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
569 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
570 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
572 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
573 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
575 #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))
576 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
577 #if PY_MAJOR_VERSION >= 3
578 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
580 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
582 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
583 #define PyObject_ASCII(o) PyObject_Repr(o)
585 #if PY_MAJOR_VERSION >= 3
586 #define PyBaseString_Type PyUnicode_Type
587 #define PyStringObject PyUnicodeObject
588 #define PyString_Type PyUnicode_Type
589 #define PyString_Check PyUnicode_Check
590 #define PyString_CheckExact PyUnicode_CheckExact
591 #ifndef PyObject_Unicode
592 #define PyObject_Unicode PyObject_Str
595 #if PY_MAJOR_VERSION >= 3
596 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
597 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
599 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
600 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
602 #ifndef PySet_CheckExact
603 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
605 #if PY_VERSION_HEX >= 0x030900A4
606 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
607 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
609 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
610 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
612 #if CYTHON_ASSUME_SAFE_MACROS
613 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
615 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
617 #if PY_MAJOR_VERSION >= 3
618 #define PyIntObject PyLongObject
619 #define PyInt_Type PyLong_Type
620 #define PyInt_Check(op) PyLong_Check(op)
621 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
622 #define PyInt_FromString PyLong_FromString
623 #define PyInt_FromUnicode PyLong_FromUnicode
624 #define PyInt_FromLong PyLong_FromLong
625 #define PyInt_FromSize_t PyLong_FromSize_t
626 #define PyInt_FromSsize_t PyLong_FromSsize_t
627 #define PyInt_AsLong PyLong_AsLong
628 #define PyInt_AS_LONG PyLong_AS_LONG
629 #define PyInt_AsSsize_t PyLong_AsSsize_t
630 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
631 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
632 #define PyNumber_Int PyNumber_Long
634 #if PY_MAJOR_VERSION >= 3
635 #define PyBoolObject PyLongObject
637 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
638 #ifndef PyUnicode_InternFromString
639 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
642 #if PY_VERSION_HEX < 0x030200A4
643 typedef long Py_hash_t;
644 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
645 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
647 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
648 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
650 #if PY_MAJOR_VERSION >= 3
651 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
653 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
655 #if CYTHON_USE_ASYNC_SLOTS
656 #if PY_VERSION_HEX >= 0x030500B1
657 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
658 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
660 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
663 #define __Pyx_PyType_AsAsync(obj) NULL
665 #ifndef __Pyx_PyAsyncMethodsStruct
670 } __Pyx_PyAsyncMethodsStruct;
673 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
674 #if !defined(_USE_MATH_DEFINES)
675 #define _USE_MATH_DEFINES
680 #define __PYX_NAN() ((float) NAN)
682 static CYTHON_INLINE
float __PYX_NAN() {
684 memset(&value, 0xFF,
sizeof(value));
688 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
689 #define __Pyx_truncl trunc
691 #define __Pyx_truncl truncl
694 #define __PYX_MARK_ERR_POS(f_index, lineno) \
695 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
696 #define __PYX_ERR(f_index, lineno, Ln_error) \
697 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
699 #ifndef __PYX_EXTERN_C
701 #define __PYX_EXTERN_C extern "C"
703 #define __PYX_EXTERN_C extern
707 #define __PYX_HAVE__csparsity
708 #define __PYX_HAVE_API__csparsity
713 #include "numpy/arrayobject.h"
714 #include "numpy/ndarrayobject.h"
715 #include "numpy/ndarraytypes.h"
716 #include "numpy/arrayscalars.h"
717 #include "numpy/ufuncobject.h"
721 #include "pythread.h"
728 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
729 #define CYTHON_WITHOUT_ASSERTIONS
732 typedef struct {PyObject **p;
const char *
s;
const Py_ssize_t
n;
const char* encoding;
733 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
735 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
736 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
737 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
738 #define __PYX_DEFAULT_STRING_ENCODING ""
739 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
740 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
741 #define __Pyx_uchar_cast(c) ((unsigned char)c)
742 #define __Pyx_long_cast(x) ((long)x)
743 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
744 (sizeof(type) < sizeof(Py_ssize_t)) ||\
745 (sizeof(type) > sizeof(Py_ssize_t) &&\
746 likely(v < (type)PY_SSIZE_T_MAX ||\
747 v == (type)PY_SSIZE_T_MAX) &&\
748 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
749 v == (type)PY_SSIZE_T_MIN))) ||\
750 (sizeof(type) == sizeof(Py_ssize_t) &&\
751 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
752 v == (type)PY_SSIZE_T_MAX))) )
753 static CYTHON_INLINE
int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
754 return (
size_t) i < (size_t) limit;
756 #if defined (__cplusplus) && __cplusplus >= 201103L
758 #define __Pyx_sst_abs(value) std::abs(value)
759 #elif SIZEOF_INT >= SIZEOF_SIZE_T
760 #define __Pyx_sst_abs(value) abs(value)
761 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
762 #define __Pyx_sst_abs(value) labs(value)
763 #elif defined (_MSC_VER)
764 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
765 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
766 #define __Pyx_sst_abs(value) llabs(value)
767 #elif defined (__GNUC__)
768 #define __Pyx_sst_abs(value) __builtin_llabs(value)
770 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
772 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
773 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
774 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
775 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
776 #define __Pyx_PyBytes_FromString PyBytes_FromString
777 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
778 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
779 #if PY_MAJOR_VERSION < 3
780 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
781 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
783 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
784 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
786 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
787 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
788 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
789 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
790 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
791 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
792 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
793 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
794 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
795 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
796 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
797 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
798 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
799 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
800 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
801 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
802 static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *
u) {
803 const Py_UNICODE *u_end =
u;
805 return (
size_t)(u_end -
u - 1);
807 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
808 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
809 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
810 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
811 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
812 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b);
813 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
814 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
815 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
816 #define __Pyx_PySequence_Tuple(obj)\
817 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
818 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
819 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
820 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
821 #if CYTHON_ASSUME_SAFE_MACROS
822 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
824 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
826 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
827 #if PY_MAJOR_VERSION >= 3
828 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
830 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
832 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
833 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
834 static int __Pyx_sys_getdefaultencoding_not_ascii;
835 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
837 PyObject* default_encoding = NULL;
838 PyObject* ascii_chars_u = NULL;
839 PyObject* ascii_chars_b = NULL;
840 const char* default_encoding_c;
841 sys = PyImport_ImportModule(
"sys");
843 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
845 if (!default_encoding)
goto bad;
846 default_encoding_c = PyBytes_AsString(default_encoding);
847 if (!default_encoding_c)
goto bad;
848 if (strcmp(default_encoding_c,
"ascii") == 0) {
849 __Pyx_sys_getdefaultencoding_not_ascii = 0;
851 char ascii_chars[128];
853 for (
c = 0;
c < 128;
c++) {
856 __Pyx_sys_getdefaultencoding_not_ascii = 1;
857 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
858 if (!ascii_chars_u)
goto bad;
859 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
860 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
863 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
867 Py_DECREF(ascii_chars_u);
868 Py_DECREF(ascii_chars_b);
870 Py_DECREF(default_encoding);
873 Py_XDECREF(default_encoding);
874 Py_XDECREF(ascii_chars_u);
875 Py_XDECREF(ascii_chars_b);
879 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
880 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
882 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
883 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
884 static char* __PYX_DEFAULT_STRING_ENCODING;
885 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
887 PyObject* default_encoding = NULL;
888 char* default_encoding_c;
889 sys = PyImport_ImportModule(
"sys");
891 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
893 if (!default_encoding)
goto bad;
894 default_encoding_c = PyBytes_AsString(default_encoding);
895 if (!default_encoding_c)
goto bad;
896 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c) + 1);
897 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
898 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
899 Py_DECREF(default_encoding);
902 Py_XDECREF(default_encoding);
910 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
911 #define likely(x) __builtin_expect(!!(x), 1)
912 #define unlikely(x) __builtin_expect(!!(x), 0)
914 #define likely(x) (x)
915 #define unlikely(x) (x)
917 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
919 static PyObject *__pyx_m = NULL;
920 static PyObject *__pyx_d;
921 static PyObject *__pyx_b;
922 static PyObject *__pyx_cython_runtime = NULL;
923 static PyObject *__pyx_empty_tuple;
924 static PyObject *__pyx_empty_bytes;
925 static PyObject *__pyx_empty_unicode;
926 static int __pyx_lineno;
927 static int __pyx_clineno = 0;
928 static const char * __pyx_cfilenm= __FILE__;
929 static const char *__pyx_filename;
932 #if !defined(CYTHON_CCOMPLEX)
933 #if defined(__cplusplus)
934 #define CYTHON_CCOMPLEX 1
935 #elif defined(_Complex_I)
936 #define CYTHON_CCOMPLEX 1
938 #define CYTHON_CCOMPLEX 0
948 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
950 #define _Complex_I 1.0fj
954 static const char *__pyx_f[] = {
956 "proteus/csparsity.pyx",
961 #ifndef __PYX_FORCE_INIT_THREADS
962 #define __PYX_FORCE_INIT_THREADS 0
966 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
967 #define __Pyx_PyGILState_Release PyGILState_Release
968 #define __Pyx_FastGIL_Remember()
969 #define __Pyx_FastGIL_Forget()
970 #define __Pyx_FastGilFuncInit()
973 #define IS_UNSIGNED(type) (((type) -1) > 0)
974 struct __Pyx_StructField_;
975 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
978 struct __Pyx_StructField_* fields;
986 typedef struct __Pyx_StructField_ {
987 __Pyx_TypeInfo* type;
992 __Pyx_StructField* field;
993 size_t parent_offset;
994 } __Pyx_BufFmt_StackElem;
996 __Pyx_StructField root;
997 __Pyx_BufFmt_StackElem* head;
999 size_t new_count, enc_count;
1000 size_t struct_alignment;
1005 char is_valid_array;
1006 } __Pyx_BufFmt_Context;
1009 #include <pythread.h>
1010 #ifndef CYTHON_ATOMICS
1011 #define CYTHON_ATOMICS 1
1013 #define __pyx_atomic_int_type int
1014 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
1015 (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
1017 #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
1018 #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
1019 #ifdef __PYX_DEBUG_ATOMICS
1020 #warning "Using GNU atomics"
1022 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
1023 #include <Windows.h>
1024 #undef __pyx_atomic_int_type
1025 #define __pyx_atomic_int_type LONG
1026 #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
1027 #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
1028 #ifdef __PYX_DEBUG_ATOMICS
1029 #pragma message ("Using MSVC atomics")
1031 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
1032 #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
1033 #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
1034 #ifdef __PYX_DEBUG_ATOMICS
1035 #warning "Using Intel atomics"
1038 #undef CYTHON_ATOMICS
1039 #define CYTHON_ATOMICS 0
1040 #ifdef __PYX_DEBUG_ATOMICS
1041 #warning "Not using atomics"
1044 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
1046 #define __pyx_add_acquisition_count(memview)\
1047 __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
1048 #define __pyx_sub_acquisition_count(memview)\
1049 __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
1051 #define __pyx_add_acquisition_count(memview)\
1052 __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1053 #define __pyx_sub_acquisition_count(memview)\
1054 __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1058 struct __pyx_memoryview_obj;
1060 struct __pyx_memoryview_obj *memview;
1062 Py_ssize_t shape[8];
1063 Py_ssize_t strides[8];
1064 Py_ssize_t suboffsets[8];
1065 } __Pyx_memviewslice;
1066 #define __Pyx_MemoryView_Len(m) (m.shape[0])
1076 typedef npy_int8 __pyx_t_5numpy_int8_t;
1085 typedef npy_int16 __pyx_t_5numpy_int16_t;
1094 typedef npy_int32 __pyx_t_5numpy_int32_t;
1103 typedef npy_int64 __pyx_t_5numpy_int64_t;
1112 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1121 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1130 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1139 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1148 typedef npy_float32 __pyx_t_5numpy_float32_t;
1157 typedef npy_float64 __pyx_t_5numpy_float64_t;
1166 typedef npy_long __pyx_t_5numpy_int_t;
1175 typedef npy_longlong __pyx_t_5numpy_long_t;
1184 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1193 typedef npy_ulong __pyx_t_5numpy_uint_t;
1202 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1211 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1220 typedef npy_intp __pyx_t_5numpy_intp_t;
1229 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1238 typedef npy_double __pyx_t_5numpy_float_t;
1247 typedef npy_double __pyx_t_5numpy_double_t;
1256 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1260 typedef ::std::complex< float > __pyx_t_float_complex;
1262 typedef float _Complex __pyx_t_float_complex;
1265 typedef struct {
float real, imag; } __pyx_t_float_complex;
1267 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float,
float);
1272 typedef ::std::complex< double > __pyx_t_double_complex;
1274 typedef double _Complex __pyx_t_double_complex;
1277 typedef struct {
double real, imag; } __pyx_t_double_complex;
1279 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double,
double);
1283 struct __pyx_obj_9csparsity_PySparsityInfo;
1284 struct __pyx_array_obj;
1285 struct __pyx_MemviewEnum_obj;
1286 struct __pyx_memoryview_obj;
1287 struct __pyx_memoryviewslice_obj;
1296 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1305 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1314 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1323 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1332 struct __pyx_obj_9csparsity_PySparsityInfo {
1345 struct __pyx_array_obj {
1347 struct __pyx_vtabstruct_array *__pyx_vtab;
1353 Py_ssize_t *_strides;
1354 Py_ssize_t itemsize;
1357 void (*callback_free_data)(
void *);
1359 int dtype_is_object;
1370 struct __pyx_MemviewEnum_obj {
1383 struct __pyx_memoryview_obj {
1385 struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1388 PyObject *_array_interface;
1389 PyThread_type_lock lock;
1390 __pyx_atomic_int acquisition_count[2];
1391 __pyx_atomic_int *acquisition_count_aligned_p;
1394 int dtype_is_object;
1395 __Pyx_TypeInfo *typeinfo;
1406 struct __pyx_memoryviewslice_obj {
1407 struct __pyx_memoryview_obj __pyx_base;
1408 __Pyx_memviewslice from_slice;
1409 PyObject *from_object;
1410 PyObject *(*to_object_func)(
char *);
1411 int (*to_dtype_func)(
char *, PyObject *);
1424 struct __pyx_vtabstruct_array {
1425 PyObject *(*get_memview)(
struct __pyx_array_obj *);
1427 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1438 struct __pyx_vtabstruct_memoryview {
1439 char *(*get_item_pointer)(
struct __pyx_memoryview_obj *, PyObject *);
1440 PyObject *(*is_slice)(
struct __pyx_memoryview_obj *, PyObject *);
1441 PyObject *(*setitem_slice_assignment)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1442 PyObject *(*setitem_slice_assign_scalar)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *);
1443 PyObject *(*setitem_indexed)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1444 PyObject *(*convert_item_to_object)(
struct __pyx_memoryview_obj *,
char *);
1445 PyObject *(*assign_item_from_object)(
struct __pyx_memoryview_obj *,
char *, PyObject *);
1447 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1458 struct __pyx_vtabstruct__memoryviewslice {
1459 struct __pyx_vtabstruct_memoryview __pyx_base;
1461 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1465 #ifndef CYTHON_REFNANNY
1466 #define CYTHON_REFNANNY 0
1470 void (*INCREF)(
void*, PyObject*, int);
1471 void (*DECREF)(
void*, PyObject*, int);
1472 void (*GOTREF)(
void*, PyObject*, int);
1473 void (*GIVEREF)(
void*, PyObject*, int);
1474 void* (*SetupContext)(
const char*, int,
const char*);
1475 void (*FinishContext)(
void**);
1476 } __Pyx_RefNannyAPIStruct;
1477 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1478 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
1479 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1481 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1483 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1484 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1485 PyGILState_Release(__pyx_gilstate_save);\
1487 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1490 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1491 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1493 #define __Pyx_RefNannyFinishContext()\
1494 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1495 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1496 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1497 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1498 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1499 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1500 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1501 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1502 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1504 #define __Pyx_RefNannyDeclarations
1505 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1506 #define __Pyx_RefNannyFinishContext()
1507 #define __Pyx_INCREF(r) Py_INCREF(r)
1508 #define __Pyx_DECREF(r) Py_DECREF(r)
1509 #define __Pyx_GOTREF(r)
1510 #define __Pyx_GIVEREF(r)
1511 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1512 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1513 #define __Pyx_XGOTREF(r)
1514 #define __Pyx_XGIVEREF(r)
1516 #define __Pyx_XDECREF_SET(r, v) do {\
1517 PyObject *tmp = (PyObject *) r;\
1518 r = v; __Pyx_XDECREF(tmp);\
1520 #define __Pyx_DECREF_SET(r, v) do {\
1521 PyObject *tmp = (PyObject *) r;\
1522 r = v; __Pyx_DECREF(tmp);\
1524 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1525 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1528 #if CYTHON_USE_TYPE_SLOTS
1529 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1531 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1535 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1538 static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
1539 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1542 static int __Pyx_CheckKeywordStrings(PyObject *kwdict,
const char* function_name,
int kw_allowed);
1545 static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name);
1548 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1549 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1550 const char* function_name);
1553 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1554 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1555 __Pyx__ArgTypeTest(obj, type, name, exact))
1556 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact);
1559 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1560 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1561 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1562 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1563 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1564 (cache_var) = (value);
1565 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1566 static PY_UINT64_T __pyx_dict_version = 0;\
1567 static PyObject *__pyx_dict_cached_value = NULL;\
1568 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1569 (VAR) = __pyx_dict_cached_value;\
1571 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1572 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1575 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1576 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1577 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1579 #define __PYX_GET_DICT_VERSION(dict) (0)
1580 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1581 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1585 #if CYTHON_USE_DICT_VERSIONS
1586 #define __Pyx_GetModuleGlobalName(var, name) {\
1587 static PY_UINT64_T __pyx_dict_version = 0;\
1588 static PyObject *__pyx_dict_cached_value = NULL;\
1589 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1590 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1591 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1593 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1594 PY_UINT64_T __pyx_dict_version;\
1595 PyObject *__pyx_dict_cached_value;\
1596 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1598 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1600 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1601 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1602 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1606 #if CYTHON_FAST_PYCCALL
1607 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1609 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1613 #if CYTHON_FAST_PYCALL
1614 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1615 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1616 #if 1 || PY_VERSION_HEX < 0x030600B1
1617 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1619 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1621 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1622 (sizeof(char [1 - 2*!(cond)]) - 1)
1623 #ifndef Py_MEMBER_SIZE
1624 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1626 #if CYTHON_FAST_PYCALL
1627 static size_t __pyx_pyframe_localsplus_offset = 0;
1628 #include "frameobject.h"
1629 #if PY_VERSION_HEX >= 0x030b00a6
1630 #ifndef Py_BUILD_CORE
1631 #define Py_BUILD_CORE 1
1633 #include "internal/pycore_frame.h"
1635 #define __Pxy_PyFrame_Initialize_Offsets()\
1636 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1637 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1638 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1639 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1640 #endif // CYTHON_FAST_PYCALL
1644 #if CYTHON_COMPILING_IN_CPYTHON
1645 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1647 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1651 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2);
1654 #if CYTHON_COMPILING_IN_CPYTHON
1655 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1659 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1662 #if CYTHON_FAST_THREAD_STATE
1663 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1664 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1665 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1667 #define __Pyx_PyThreadState_declare
1668 #define __Pyx_PyThreadState_assign
1669 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1673 #if CYTHON_FAST_THREAD_STATE
1674 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1675 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1676 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1677 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1678 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1679 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1680 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1681 #if CYTHON_COMPILING_IN_CPYTHON
1682 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1684 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1687 #define __Pyx_PyErr_Clear() PyErr_Clear()
1688 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1689 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1690 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1691 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1692 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1693 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1694 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1698 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1701 #if CYTHON_USE_EXC_INFO_STACK
1702 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1706 #if CYTHON_FAST_THREAD_STATE
1707 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1708 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1709 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1710 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1712 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1713 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1717 #if CYTHON_FAST_THREAD_STATE
1718 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1719 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1721 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1725 #if CYTHON_FAST_THREAD_STATE
1726 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1727 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1729 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1736 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals);
1739 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals);
1742 #if PY_MAJOR_VERSION >= 3
1743 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1745 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1749 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1752 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1753 (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1755 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1756 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *);
1758 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1761 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1762 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1763 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1764 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1765 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1766 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1767 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1768 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1769 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1770 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1771 int wraparound,
int boundscheck);
1772 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1773 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1774 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1775 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1776 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1777 int wraparound,
int boundscheck);
1778 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1779 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1780 int is_list,
int wraparound,
int boundscheck);
1783 #if CYTHON_USE_TYPE_SLOTS
1784 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1786 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1790 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(
const char *
s, Py_ssize_t size,
const char *errors) {
1792 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1794 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(
const char *
s, Py_ssize_t size,
const char *errors) {
1796 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1798 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(
const char *
s, Py_ssize_t size,
const char *errors) {
1800 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1804 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1805 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1806 const char* encoding,
const char* errors,
1807 PyObject* (*decode_func)(
const char *
s, Py_ssize_t size,
const char *errors));
1810 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1813 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1816 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1819 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void);
1822 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1825 #if CYTHON_FAST_THREAD_STATE
1826 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1827 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1829 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1833 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
1836 #if CYTHON_COMPILING_IN_CPYTHON
1837 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1838 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1839 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1840 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1842 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1843 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1844 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1846 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1848 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1850 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1851 static CYTHON_INLINE
int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1852 PyListObject*
L = (PyListObject*) list;
1853 Py_ssize_t len = Py_SIZE(list);
1854 if (likely(
L->allocated > len)) {
1856 PyList_SET_ITEM(list, len, x);
1857 __Pyx_SET_SIZE(list, len + 1);
1860 return PyList_Append(list, x);
1863 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1867 #if !CYTHON_COMPILING_IN_PYPY
1868 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2,
long intval,
int inplace,
int zerodivision_check);
1870 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1871 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1875 static CYTHON_INLINE
int __Pyx_PyList_Extend(PyObject*
L, PyObject*
v) {
1876 #if CYTHON_COMPILING_IN_CPYTHON
1877 PyObject* none = _PyList_Extend((PyListObject*)
L,
v);
1878 if (unlikely(!none))
1883 return PyList_SetSlice(
L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX,
v);
1888 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1889 static CYTHON_INLINE
int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1890 PyListObject*
L = (PyListObject*) list;
1891 Py_ssize_t len = Py_SIZE(list);
1892 if (likely(
L->allocated > len) & likely(len > (
L->allocated >> 1))) {
1894 PyList_SET_ITEM(list, len, x);
1895 __Pyx_SET_SIZE(list, len + 1);
1898 return PyList_Append(list, x);
1901 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1905 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname);
1908 static CYTHON_INLINE
long __Pyx_div_long(
long,
long);
1911 static CYTHON_INLINE
int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq,
int eq) {
1912 int result = PySequence_Contains(seq, item);
1913 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1917 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1920 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *, PyObject *);
1923 #if PY_MAJOR_VERSION < 3
1924 #define __Pyx_PyString_Join __Pyx_PyBytes_Join
1925 #define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
1927 #define __Pyx_PyString_Join PyUnicode_Join
1928 #define __Pyx_PyBaseString_Join PyUnicode_Join
1930 #if CYTHON_COMPILING_IN_CPYTHON
1931 #if PY_MAJOR_VERSION < 3
1932 #define __Pyx_PyBytes_Join _PyString_Join
1934 #define __Pyx_PyBytes_Join _PyBytes_Join
1937 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
1941 #if PY_MAJOR_VERSION >= 3
1942 #define __Pyx_PyObject_Unicode(obj)\
1943 (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
1945 #define __Pyx_PyObject_Unicode(obj)\
1946 (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj))
1950 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1951 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1953 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1957 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1958 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1960 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1964 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1967 static int __Pyx_setup_reduce(PyObject* type_obj);
1970 static int __Pyx_SetVtable(PyObject *dict,
void *vtable);
1973 #ifndef __PYX_HAVE_RT_ImportType_proto
1974 #define __PYX_HAVE_RT_ImportType_proto
1975 enum __Pyx_ImportType_CheckSize {
1976 __Pyx_ImportType_CheckSize_Error = 0,
1977 __Pyx_ImportType_CheckSize_Warn = 1,
1978 __Pyx_ImportType_CheckSize_Ignore = 2
1980 static PyTypeObject *__Pyx_ImportType(PyObject* module,
const char *module_name,
const char *class_name,
size_t size,
enum __Pyx_ImportType_CheckSize check_size);
1984 #ifdef CYTHON_CLINE_IN_TRACEBACK
1985 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1987 static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
1992 PyCodeObject* code_object;
1994 } __Pyx_CodeObjectCacheEntry;
1995 struct __Pyx_CodeObjectCache {
1998 __Pyx_CodeObjectCacheEntry* entries;
2000 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2001 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
2002 static PyCodeObject *__pyx_find_code_object(
int code_line);
2003 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
2006 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
2007 int py_line,
const char *filename);
2013 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2014 #define __Pyx_HAS_GCC_DIAGNOSTIC
2018 static CYTHON_INLINE PyObject *__pyx_memview_get_int(
const char *itemp);
2019 static CYTHON_INLINE
int __pyx_memview_set_int(
const char *itemp, PyObject *obj);
2022 static CYTHON_INLINE PyObject *__pyx_memview_get_double(
const char *itemp);
2023 static CYTHON_INLINE
int __pyx_memview_set_double(
const char *itemp, PyObject *obj);
2028 #define __Pyx_CREAL(z) ((z).real())
2029 #define __Pyx_CIMAG(z) ((z).imag())
2031 #define __Pyx_CREAL(z) (__real__(z))
2032 #define __Pyx_CIMAG(z) (__imag__(z))
2035 #define __Pyx_CREAL(z) ((z).real)
2036 #define __Pyx_CIMAG(z) ((z).imag)
2038 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2039 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2040 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2041 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2043 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2044 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2049 #define __Pyx_c_eq_float(a, b) ((a)==(b))
2050 #define __Pyx_c_sum_float(a, b) ((a)+(b))
2051 #define __Pyx_c_diff_float(a, b) ((a)-(b))
2052 #define __Pyx_c_prod_float(a, b) ((a)*(b))
2053 #define __Pyx_c_quot_float(a, b) ((a)/(b))
2054 #define __Pyx_c_neg_float(a) (-(a))
2056 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2057 #define __Pyx_c_conj_float(z) (::std::conj(z))
2059 #define __Pyx_c_abs_float(z) (::std::abs(z))
2060 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
2063 #define __Pyx_c_is_zero_float(z) ((z)==0)
2064 #define __Pyx_c_conj_float(z) (conjf(z))
2066 #define __Pyx_c_abs_float(z) (cabsf(z))
2067 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
2071 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2072 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2073 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2074 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2075 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2076 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2077 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2078 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2080 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex);
2081 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2087 #define __Pyx_c_eq_double(a, b) ((a)==(b))
2088 #define __Pyx_c_sum_double(a, b) ((a)+(b))
2089 #define __Pyx_c_diff_double(a, b) ((a)-(b))
2090 #define __Pyx_c_prod_double(a, b) ((a)*(b))
2091 #define __Pyx_c_quot_double(a, b) ((a)/(b))
2092 #define __Pyx_c_neg_double(a) (-(a))
2094 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2095 #define __Pyx_c_conj_double(z) (::std::conj(z))
2097 #define __Pyx_c_abs_double(z) (::std::abs(z))
2098 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
2101 #define __Pyx_c_is_zero_double(z) ((z)==0)
2102 #define __Pyx_c_conj_double(z) (conj(z))
2104 #define __Pyx_c_abs_double(z) (cabs(z))
2105 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
2109 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2110 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2111 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2112 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2113 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2114 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2115 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2116 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2118 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex);
2119 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2123 #if PY_MAJOR_VERSION < 3
2124 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags);
2125 static void __Pyx_ReleaseBuffer(Py_buffer *view);
2127 #define __Pyx_GetBuffer PyObject_GetBuffer
2128 #define __Pyx_ReleaseBuffer PyBuffer_Release
2134 Py_ssize_t shape, strides, suboffsets;
2135 } __Pyx_Buf_DimInfo;
2141 __Pyx_Buffer *rcbuffer;
2143 __Pyx_Buf_DimInfo diminfo[8];
2144 } __Pyx_LocalBuf_ND;
2147 static int __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim);
2150 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2151 __Pyx_memviewslice *slice2,
2152 int ndim,
size_t itemsize);
2155 static CYTHON_INLINE PyObject *__pyx_capsule_create(
void *p,
const char *sig);
2158 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
2161 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value);
2164 struct __pyx_typeinfo_string {
2167 static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type);
2170 static __Pyx_memviewslice
2171 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
2172 const char *mode,
int ndim,
2173 size_t sizeof_dtype,
int contig_flag,
2174 int dtype_is_object);
2177 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
2178 #define __Pyx_MEMVIEW_DIRECT 1
2179 #define __Pyx_MEMVIEW_PTR 2
2180 #define __Pyx_MEMVIEW_FULL 4
2181 #define __Pyx_MEMVIEW_CONTIG 8
2182 #define __Pyx_MEMVIEW_STRIDED 16
2183 #define __Pyx_MEMVIEW_FOLLOW 32
2184 #define __Pyx_IS_C_CONTIG 1
2185 #define __Pyx_IS_F_CONTIG 2
2186 static int __Pyx_init_memviewslice(
2187 struct __pyx_memoryview_obj *memview,
2189 __Pyx_memviewslice *memviewslice,
2190 int memview_is_new_reference);
2191 static CYTHON_INLINE
int __pyx_add_acquisition_count_locked(
2192 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
2193 static CYTHON_INLINE
int __pyx_sub_acquisition_count_locked(
2194 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
2195 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
2196 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
2197 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
2198 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
2199 static CYTHON_INLINE
void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
2200 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
2203 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
2206 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
2209 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *);
2212 static int __Pyx_check_binary_version(
void);
2215 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2217 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self);
2218 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2219 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj);
2220 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src);
2221 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);
2222 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2223 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp);
2224 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2225 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp);
2226 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2237 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2250 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2251 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2252 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2253 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2254 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2255 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2256 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2257 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2258 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2259 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2260 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2261 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2262 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2263 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2264 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2267 static PyTypeObject *__pyx_ptype_9csparsity_PySparsityInfo = 0;
2268 static PyTypeObject *__pyx_array_type = 0;
2269 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2270 static PyTypeObject *__pyx_memoryview_type = 0;
2271 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2272 static PyObject *
generic = 0;
2273 static PyObject *strided = 0;
2274 static PyObject *indirect = 0;
2275 static PyObject *contiguous = 0;
2276 static PyObject *indirect_contiguous = 0;
2277 static int __pyx_memoryview_thread_locks_used;
2278 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2279 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t,
char *,
char *,
char *);
2280 static void *__pyx_align_pointer(
void *,
size_t);
2281 static PyObject *__pyx_memoryview_new(PyObject *,
int,
int, __Pyx_TypeInfo *);
2282 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *);
2283 static PyObject *_unellipsify(PyObject *,
int);
2284 static PyObject *assert_direct_dimensions(Py_ssize_t *,
int);
2285 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *, PyObject *);
2286 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);
2287 static char *__pyx_pybuffer_index(Py_buffer *,
char *, Py_ssize_t, Py_ssize_t);
2288 static int __pyx_memslice_transpose(__Pyx_memviewslice *);
2289 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice,
int, PyObject *(*)(
char *),
int (*)(
char *, PyObject *),
int);
2290 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2291 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2292 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *);
2293 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2294 static Py_ssize_t abs_py_ssize_t(Py_ssize_t);
2295 static char __pyx_get_best_slice_order(__Pyx_memviewslice *,
int);
2296 static void _copy_strided_to_strided(
char *, Py_ssize_t *,
char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *,
int,
size_t);
2297 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *,
int,
size_t);
2298 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *,
int);
2299 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t,
int,
char);
2300 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *,
char,
int);
2301 static int __pyx_memoryview_err_extents(
int, Py_ssize_t, Py_ssize_t);
2302 static int __pyx_memoryview_err_dim(PyObject *,
char *,
int);
2303 static int __pyx_memoryview_err(PyObject *,
char *);
2304 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice,
int,
int,
int);
2305 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *,
int,
int);
2306 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *,
int,
int,
int);
2307 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2308 static void __pyx_memoryview_refcount_objects_in_slice(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2309 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *,
int,
size_t,
void *,
int);
2310 static void __pyx_memoryview__slice_assign_scalar(
char *, Py_ssize_t *, Py_ssize_t *,
int,
size_t,
void *);
2311 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *, PyObject *);
2312 static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *);
2313 static __Pyx_TypeInfo __Pyx_TypeInfo_int = {
"int", NULL,
sizeof(int), { 0 }, 0, IS_UNSIGNED(
int) ?
'U' :
'I', IS_UNSIGNED(
int), 0 };
2314 static __Pyx_TypeInfo __Pyx_TypeInfo_double = {
"double", NULL,
sizeof(double), { 0 }, 0,
'R', 0, 0 };
2315 #define __Pyx_MODULE_NAME "csparsity"
2316 extern int __pyx_module_is_main_csparsity;
2317 int __pyx_module_is_main_csparsity = 0;
2320 static PyObject *__pyx_builtin_TypeError;
2321 static PyObject *__pyx_builtin_ImportError;
2322 static PyObject *__pyx_builtin_ValueError;
2323 static PyObject *__pyx_builtin_MemoryError;
2324 static PyObject *__pyx_builtin_enumerate;
2325 static PyObject *__pyx_builtin_range;
2326 static PyObject *__pyx_builtin_Ellipsis;
2327 static PyObject *__pyx_builtin_id;
2328 static PyObject *__pyx_builtin_IndexError;
2329 static const char __pyx_k_O[] =
"O";
2330 static const char __pyx_k_T[] =
"T{";
2331 static const char __pyx_k_c[] =
"c";
2332 static const char __pyx_k_s[] =
"(%s)";
2333 static const char __pyx_k_id[] =
"id";
2334 static const char __pyx_k_np[] =
"np";
2335 static const char __pyx_k__24[] =
"^";
2336 static const char __pyx_k__25[] =
"";
2337 static const char __pyx_k__26[] =
":";
2338 static const char __pyx_k__27[] =
"}";
2339 static const char __pyx_k__28[] =
",";
2340 static const char __pyx_k_new[] =
"__new__";
2341 static const char __pyx_k_obj[] =
"obj";
2342 static const char __pyx_k_base[] =
"base";
2343 static const char __pyx_k_dict[] =
"__dict__";
2344 static const char __pyx_k_join[] =
"join";
2345 static const char __pyx_k_main[] =
"__main__";
2346 static const char __pyx_k_mode[] =
"mode";
2347 static const char __pyx_k_name[] =
"name";
2348 static const char __pyx_k_ndim[] =
"ndim";
2349 static const char __pyx_k_pack[] =
"pack";
2350 static const char __pyx_k_size[] =
"size";
2351 static const char __pyx_k_step[] =
"step";
2352 static const char __pyx_k_stop[] =
"stop";
2353 static const char __pyx_k_test[] =
"__test__";
2354 static const char __pyx_k_ASCII[] =
"ASCII";
2355 static const char __pyx_k_class[] =
"__class__";
2356 static const char __pyx_k_error[] =
"error";
2357 static const char __pyx_k_flags[] =
"flags";
2358 static const char __pyx_k_numpy[] =
"numpy";
2359 static const char __pyx_k_range[] =
"range";
2360 static const char __pyx_k_shape[] =
"shape";
2361 static const char __pyx_k_start[] =
"start";
2362 static const char __pyx_k_encode[] =
"encode";
2363 static const char __pyx_k_format[] =
"format";
2364 static const char __pyx_k_import[] =
"__import__";
2365 static const char __pyx_k_name_2[] =
"__name__";
2366 static const char __pyx_k_pickle[] =
"pickle";
2367 static const char __pyx_k_reduce[] =
"__reduce__";
2368 static const char __pyx_k_rowptr[] =
"rowptr";
2369 static const char __pyx_k_struct[] =
"struct";
2370 static const char __pyx_k_unpack[] =
"unpack";
2371 static const char __pyx_k_update[] =
"update";
2372 static const char __pyx_k_asarray[] =
"asarray";
2373 static const char __pyx_k_fortran[] =
"fortran";
2374 static const char __pyx_k_memview[] =
"memview";
2375 static const char __pyx_k_Ellipsis[] =
"Ellipsis";
2376 static const char __pyx_k_getstate[] =
"__getstate__";
2377 static const char __pyx_k_itemsize[] =
"itemsize";
2378 static const char __pyx_k_pyx_type[] =
"__pyx_type";
2379 static const char __pyx_k_setstate[] =
"__setstate__";
2380 static const char __pyx_k_TypeError[] =
"TypeError";
2381 static const char __pyx_k_enumerate[] =
"enumerate";
2382 static const char __pyx_k_pyx_state[] =
"__pyx_state";
2383 static const char __pyx_k_reduce_ex[] =
"__reduce_ex__";
2384 static const char __pyx_k_IndexError[] =
"IndexError";
2385 static const char __pyx_k_ValueError[] =
"ValueError";
2386 static const char __pyx_k_pyx_result[] =
"__pyx_result";
2387 static const char __pyx_k_pyx_vtable[] =
"__pyx_vtable__";
2388 static const char __pyx_k_ImportError[] =
"ImportError";
2389 static const char __pyx_k_MemoryError[] =
"MemoryError";
2390 static const char __pyx_k_PickleError[] =
"PickleError";
2391 static const char __pyx_k_offset_test[] =
"offset_test";
2392 static const char __pyx_k_stride_test[] =
"stride_test";
2393 static const char __pyx_k_offset_trial[] =
"offset_trial";
2394 static const char __pyx_k_pyx_checksum[] =
"__pyx_checksum";
2395 static const char __pyx_k_stride_trial[] =
"stride_trial";
2396 static const char __pyx_k_stringsource[] =
"stringsource";
2397 static const char __pyx_k_csrRowIndeces[] =
"csrRowIndeces";
2398 static const char __pyx_k_nFreeDOF_test[] =
"nFreeDOF_test";
2399 static const char __pyx_k_pyx_getbuffer[] =
"__pyx_getbuffer";
2400 static const char __pyx_k_reduce_cython[] =
"__reduce_cython__";
2401 static const char __pyx_k_PySparsityInfo[] =
"PySparsityInfo";
2402 static const char __pyx_k_nFreeDOF_trial[] =
"nFreeDOF_trial";
2403 static const char __pyx_k_View_MemoryView[] =
"View.MemoryView";
2404 static const char __pyx_k_allocate_buffer[] =
"allocate_buffer";
2405 static const char __pyx_k_dtype_is_object[] =
"dtype_is_object";
2406 static const char __pyx_k_freeGlobal_test[] =
"freeGlobal_test";
2407 static const char __pyx_k_pyx_PickleError[] =
"__pyx_PickleError";
2408 static const char __pyx_k_setstate_cython[] =
"__setstate_cython__";
2409 static const char __pyx_k_csrColumnOffsets[] =
"csrColumnOffsets";
2410 static const char __pyx_k_freeGlobal_trial[] =
"freeGlobal_trial";
2411 static const char __pyx_k_hasNumericalFlux[] =
"hasNumericalFlux";
2412 static const char __pyx_k_nElements_global[] =
"nElements_global";
2413 static const char __pyx_k_nDOF_test_element[] =
"nDOF_test_element";
2414 static const char __pyx_k_pyx_unpickle_Enum[] =
"__pyx_unpickle_Enum";
2415 static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
2416 static const char __pyx_k_hasOutflowBoundary[] =
"hasOutflowBoundary";
2417 static const char __pyx_k_nDOF_trial_element[] =
"nDOF_trial_element";
2418 static const char __pyx_k_strided_and_direct[] =
"<strided and direct>";
2419 static const char __pyx_k_csrColumnOffsets_eb[] =
"csrColumnOffsets_eb";
2420 static const char __pyx_k_needOutflowJacobian[] =
"needOutflowJacobian";
2421 static const char __pyx_k_strided_and_indirect[] =
"<strided and indirect>";
2422 static const char __pyx_k_contiguous_and_direct[] =
"<contiguous and direct>";
2423 static const char __pyx_k_elementNeighborsArray[] =
"elementNeighborsArray";
2424 static const char __pyx_k_MemoryView_of_r_object[] =
"<MemoryView of %r object>";
2425 static const char __pyx_k_csrColumnOffsets_eNebN[] =
"csrColumnOffsets_eNebN";
2426 static const char __pyx_k_MemoryView_of_r_at_0x_x[] =
"<MemoryView of %r at 0x%x>";
2427 static const char __pyx_k_contiguous_and_indirect[] =
"<contiguous and indirect>";
2428 static const char __pyx_k_hasDiffusionInMixedForm[] =
"hasDiffusionInMixedForm";
2429 static const char __pyx_k_Cannot_index_with_type_s[] =
"Cannot index with type '%s'";
2430 static const char __pyx_k_Invalid_shape_in_axis_d_d[] =
"Invalid shape in axis %d: %d.";
2431 static const char __pyx_k_csrColumnOffsets_eb_eNebN[] =
"csrColumnOffsets_eb_eNebN";
2432 static const char __pyx_k_hasFluxBoundaryConditions[] =
"hasFluxBoundaryConditions";
2433 static const char __pyx_k_needNumericalFluxJacobian[] =
"needNumericalFluxJacobian";
2434 static const char __pyx_k_nElementBoundaries_element[] =
"nElementBoundaries_element";
2435 static const char __pyx_k_itemsize_0_for_cython_array[] =
"itemsize <= 0 for cython.array";
2436 static const char __pyx_k_elementBoundaryElementsArray[] =
"elementBoundaryElementsArray";
2437 static const char __pyx_k_unable_to_allocate_array_data[] =
"unable to allocate array data.";
2438 static const char __pyx_k_exteriorElementBoundariesArray[] =
"exteriorElementBoundariesArray";
2439 static const char __pyx_k_interiorElementBoundariesArray[] =
"interiorElementBoundariesArray";
2440 static const char __pyx_k_strided_and_direct_or_indirect[] =
"<strided and direct or indirect>";
2441 static const char __pyx_k_numpy_core_multiarray_failed_to[] =
"numpy.core.multiarray failed to import";
2442 static const char __pyx_k_Buffer_view_does_not_expose_stri[] =
"Buffer view does not expose strides";
2443 static const char __pyx_k_Can_only_create_a_buffer_that_is[] =
"Can only create a buffer that is contiguous in memory.";
2444 static const char __pyx_k_Cannot_assign_to_read_only_memor[] =
"Cannot assign to read-only memoryview";
2445 static const char __pyx_k_Cannot_create_writable_memory_vi[] =
"Cannot create writable memory view from read-only memoryview";
2446 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] =
"Empty shape tuple for cython.array";
2447 static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] =
"Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))";
2448 static const char __pyx_k_Indirect_dimensions_not_supporte[] =
"Indirect dimensions not supported";
2449 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] =
"Invalid mode, expected 'c' or 'fortran', got %s";
2450 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] =
"Out of bounds on buffer access (axis %d)";
2451 static const char __pyx_k_Unable_to_convert_item_to_object[] =
"Unable to convert item to object";
2452 static const char __pyx_k_elementBoundaryLocalElementBound[] =
"elementBoundaryLocalElementBoundariesArray";
2453 static const char __pyx_k_got_differing_extents_in_dimensi[] =
"got differing extents in dimension %d (got %d and %d)";
2454 static const char __pyx_k_nExteriorElementBoundaries_globa[] =
"nExteriorElementBoundaries_global";
2455 static const char __pyx_k_nInteriorElementBoundaries_globa[] =
"nInteriorElementBoundaries_global";
2456 static const char __pyx_k_no_default___reduce___due_to_non[] =
"no default __reduce__ due to non-trivial __cinit__";
2457 static const char __pyx_k_numpy_core_umath_failed_to_impor[] =
"numpy.core.umath failed to import";
2458 static const char __pyx_k_unable_to_allocate_shape_and_str[] =
"unable to allocate shape and strides.";
2459 static PyObject *__pyx_n_s_ASCII;
2460 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2461 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2462 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2463 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2464 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2465 static PyObject *__pyx_n_s_Ellipsis;
2466 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2467 static PyObject *__pyx_n_s_ImportError;
2468 static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0;
2469 static PyObject *__pyx_n_s_IndexError;
2470 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2471 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2472 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2473 static PyObject *__pyx_n_s_MemoryError;
2474 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2475 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2476 static PyObject *__pyx_n_b_O;
2477 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2478 static PyObject *__pyx_n_s_PickleError;
2479 static PyObject *__pyx_n_s_PySparsityInfo;
2480 static PyObject *__pyx_kp_b_T;
2481 static PyObject *__pyx_n_s_TypeError;
2482 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2483 static PyObject *__pyx_n_s_ValueError;
2484 static PyObject *__pyx_n_s_View_MemoryView;
2485 static PyObject *__pyx_kp_b__24;
2486 static PyObject *__pyx_kp_b__25;
2487 static PyObject *__pyx_kp_b__26;
2488 static PyObject *__pyx_kp_b__27;
2489 static PyObject *__pyx_kp_u__28;
2490 static PyObject *__pyx_n_s_allocate_buffer;
2491 static PyObject *__pyx_n_s_asarray;
2492 static PyObject *__pyx_n_s_base;
2493 static PyObject *__pyx_n_s_c;
2494 static PyObject *__pyx_n_u_c;
2495 static PyObject *__pyx_n_s_class;
2496 static PyObject *__pyx_n_s_cline_in_traceback;
2497 static PyObject *__pyx_kp_s_contiguous_and_direct;
2498 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2499 static PyObject *__pyx_n_s_csrColumnOffsets;
2500 static PyObject *__pyx_n_s_csrColumnOffsets_eNebN;
2501 static PyObject *__pyx_n_s_csrColumnOffsets_eb;
2502 static PyObject *__pyx_n_s_csrColumnOffsets_eb_eNebN;
2503 static PyObject *__pyx_n_s_csrRowIndeces;
2504 static PyObject *__pyx_n_s_dict;
2505 static PyObject *__pyx_n_s_dtype_is_object;
2506 static PyObject *__pyx_n_s_elementBoundaryElementsArray;
2507 static PyObject *__pyx_n_s_elementBoundaryLocalElementBound;
2508 static PyObject *__pyx_n_s_elementNeighborsArray;
2509 static PyObject *__pyx_n_s_encode;
2510 static PyObject *__pyx_n_s_enumerate;
2511 static PyObject *__pyx_n_s_error;
2512 static PyObject *__pyx_n_s_exteriorElementBoundariesArray;
2513 static PyObject *__pyx_n_s_flags;
2514 static PyObject *__pyx_n_s_format;
2515 static PyObject *__pyx_n_s_fortran;
2516 static PyObject *__pyx_n_u_fortran;
2517 static PyObject *__pyx_n_s_freeGlobal_test;
2518 static PyObject *__pyx_n_s_freeGlobal_trial;
2519 static PyObject *__pyx_n_s_getstate;
2520 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2521 static PyObject *__pyx_n_s_hasDiffusionInMixedForm;
2522 static PyObject *__pyx_n_s_hasFluxBoundaryConditions;
2523 static PyObject *__pyx_n_s_hasNumericalFlux;
2524 static PyObject *__pyx_n_s_hasOutflowBoundary;
2525 static PyObject *__pyx_n_s_id;
2526 static PyObject *__pyx_n_s_import;
2527 static PyObject *__pyx_n_s_interiorElementBoundariesArray;
2528 static PyObject *__pyx_n_s_itemsize;
2529 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2530 static PyObject *__pyx_n_s_join;
2531 static PyObject *__pyx_n_s_main;
2532 static PyObject *__pyx_n_s_memview;
2533 static PyObject *__pyx_n_s_mode;
2534 static PyObject *__pyx_n_s_nDOF_test_element;
2535 static PyObject *__pyx_n_s_nDOF_trial_element;
2536 static PyObject *__pyx_n_s_nElementBoundaries_element;
2537 static PyObject *__pyx_n_s_nElements_global;
2538 static PyObject *__pyx_n_s_nExteriorElementBoundaries_globa;
2539 static PyObject *__pyx_n_s_nFreeDOF_test;
2540 static PyObject *__pyx_n_s_nFreeDOF_trial;
2541 static PyObject *__pyx_n_s_nInteriorElementBoundaries_globa;
2542 static PyObject *__pyx_n_s_name;
2543 static PyObject *__pyx_n_s_name_2;
2544 static PyObject *__pyx_n_s_ndim;
2545 static PyObject *__pyx_n_s_needNumericalFluxJacobian;
2546 static PyObject *__pyx_n_s_needOutflowJacobian;
2547 static PyObject *__pyx_n_s_new;
2548 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2549 static PyObject *__pyx_n_s_np;
2550 static PyObject *__pyx_n_s_numpy;
2551 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2552 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2553 static PyObject *__pyx_n_s_obj;
2554 static PyObject *__pyx_n_s_offset_test;
2555 static PyObject *__pyx_n_s_offset_trial;
2556 static PyObject *__pyx_n_s_pack;
2557 static PyObject *__pyx_n_s_pickle;
2558 static PyObject *__pyx_n_s_pyx_PickleError;
2559 static PyObject *__pyx_n_s_pyx_checksum;
2560 static PyObject *__pyx_n_s_pyx_getbuffer;
2561 static PyObject *__pyx_n_s_pyx_result;
2562 static PyObject *__pyx_n_s_pyx_state;
2563 static PyObject *__pyx_n_s_pyx_type;
2564 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2565 static PyObject *__pyx_n_s_pyx_vtable;
2566 static PyObject *__pyx_n_s_range;
2567 static PyObject *__pyx_n_s_reduce;
2568 static PyObject *__pyx_n_s_reduce_cython;
2569 static PyObject *__pyx_n_s_reduce_ex;
2570 static PyObject *__pyx_n_s_rowptr;
2571 static PyObject *__pyx_kp_u_s;
2572 static PyObject *__pyx_n_s_setstate;
2573 static PyObject *__pyx_n_s_setstate_cython;
2574 static PyObject *__pyx_n_s_shape;
2575 static PyObject *__pyx_n_s_size;
2576 static PyObject *__pyx_n_s_start;
2577 static PyObject *__pyx_n_s_step;
2578 static PyObject *__pyx_n_s_stop;
2579 static PyObject *__pyx_n_s_stride_test;
2580 static PyObject *__pyx_n_s_stride_trial;
2581 static PyObject *__pyx_kp_s_strided_and_direct;
2582 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2583 static PyObject *__pyx_kp_s_strided_and_indirect;
2584 static PyObject *__pyx_kp_s_stringsource;
2585 static PyObject *__pyx_n_s_struct;
2586 static PyObject *__pyx_n_s_test;
2587 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2588 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2589 static PyObject *__pyx_n_s_unpack;
2590 static PyObject *__pyx_n_s_update;
2591 static int __pyx_pf_9csparsity_14PySparsityInfo___cinit__(CYTHON_UNUSED
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self);
2592 static void __pyx_pf_9csparsity_14PySparsityInfo_2__dealloc__(CYTHON_UNUSED
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self);
2593 static PyObject *__pyx_pf_9csparsity_14PySparsityInfo_4findNonzeros(
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self,
int __pyx_v_nElements_global,
int __pyx_v_nDOF_test_element,
int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_nFreeDOF_test, PyArrayObject *__pyx_v_freeGlobal_test, PyArrayObject *__pyx_v_nFreeDOF_trial, PyArrayObject *__pyx_v_freeGlobal_trial,
int __pyx_v_offset_test,
int __pyx_v_stride_test,
int __pyx_v_offset_trial,
int __pyx_v_stride_trial,
int __pyx_v_hasNumericalFlux,
int __pyx_v_hasDiffusionInMixedForm,
int __pyx_v_needNumericalFluxJacobian,
int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray,
int __pyx_v_nInteriorElementBoundaries_global, PyArrayObject *__pyx_v_interiorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementBoundaryLocalElementBoundariesArray,
int __pyx_v_hasFluxBoundaryConditions,
int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray,
int __pyx_v_hasOutflowBoundary,
int __pyx_v_needOutflowJacobian);
2594 static PyObject *__pyx_pf_9csparsity_14PySparsityInfo_6getOffsets_CSR(
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self,
int __pyx_v_nElements_global,
int __pyx_v_nDOF_test_element,
int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_nFreeDOF_test, PyArrayObject *__pyx_v_freeGlobal_test, PyArrayObject *__pyx_v_nFreeDOF_trial, PyArrayObject *__pyx_v_freeGlobal_trial,
int __pyx_v_offset_test,
int __pyx_v_stride_test,
int __pyx_v_offset_trial,
int __pyx_v_stride_trial,
int __pyx_v_hasNumericalFlux,
int __pyx_v_hasDiffusionInMixedForm,
int __pyx_v_needNumericalFluxJacobian,
int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray,
int __pyx_v_nInteriorElementBoundaries_global, PyArrayObject *__pyx_v_interiorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementBoundaryLocalElementBoundariesArray,
int __pyx_v_hasFluxBoundaryConditions,
int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray,
int __pyx_v_hasOutflowBoundary,
int __pyx_v_needOutflowJacobian, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_csrRowIndeces, PyArrayObject *__pyx_v_csrColumnOffsets, PyArrayObject *__pyx_v_csrColumnOffsets_eNebN, PyArrayObject *__pyx_v_csrColumnOffsets_eb, PyArrayObject *__pyx_v_csrColumnOffsets_eb_eNebN);
2595 static PyObject *__pyx_pf_9csparsity_14PySparsityInfo_8getCSR(
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self);
2596 static PyObject *__pyx_pf_9csparsity_14PySparsityInfo_10__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self);
2597 static PyObject *__pyx_pf_9csparsity_14PySparsityInfo_12__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2598 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);
2599 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);
2600 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self);
2601 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self);
2602 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self);
2603 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr);
2604 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item);
2605 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);
2606 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self);
2607 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);
2608 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name);
2609 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2610 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2611 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state);
2612 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);
2613 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self);
2614 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2615 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);
2616 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);
2617 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2618 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2619 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2620 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2621 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2622 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2623 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2624 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2625 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2626 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self);
2627 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self);
2628 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self);
2629 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2630 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2631 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self);
2632 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self);
2633 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self);
2634 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);
2635 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2636 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2637 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2638 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);
2639 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);
2640 static PyObject *__pyx_tp_new_9csparsity_PySparsityInfo(PyTypeObject *t, PyObject *a, PyObject *k);
2641 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k);
2642 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k);
2643 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k);
2644 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k);
2645 static PyObject *__pyx_int_0;
2646 static PyObject *__pyx_int_1;
2647 static PyObject *__pyx_int_112105877;
2648 static PyObject *__pyx_int_136983863;
2649 static PyObject *__pyx_int_184977713;
2650 static PyObject *__pyx_int_neg_1;
2651 static PyObject *__pyx_tuple_;
2652 static PyObject *__pyx_tuple__2;
2653 static PyObject *__pyx_tuple__3;
2654 static PyObject *__pyx_tuple__4;
2655 static PyObject *__pyx_tuple__5;
2656 static PyObject *__pyx_tuple__6;
2657 static PyObject *__pyx_tuple__7;
2658 static PyObject *__pyx_tuple__8;
2659 static PyObject *__pyx_tuple__9;
2660 static PyObject *__pyx_slice__19;
2661 static PyObject *__pyx_tuple__10;
2662 static PyObject *__pyx_tuple__11;
2663 static PyObject *__pyx_tuple__12;
2664 static PyObject *__pyx_tuple__13;
2665 static PyObject *__pyx_tuple__14;
2666 static PyObject *__pyx_tuple__15;
2667 static PyObject *__pyx_tuple__16;
2668 static PyObject *__pyx_tuple__17;
2669 static PyObject *__pyx_tuple__18;
2670 static PyObject *__pyx_tuple__20;
2671 static PyObject *__pyx_tuple__21;
2672 static PyObject *__pyx_tuple__22;
2673 static PyObject *__pyx_tuple__23;
2674 static PyObject *__pyx_tuple__29;
2675 static PyObject *__pyx_tuple__30;
2676 static PyObject *__pyx_tuple__31;
2677 static PyObject *__pyx_tuple__32;
2678 static PyObject *__pyx_tuple__33;
2679 static PyObject *__pyx_tuple__34;
2680 static PyObject *__pyx_codeobj__35;
2692 static int __pyx_pw_9csparsity_14PySparsityInfo_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
2693 static int __pyx_pw_9csparsity_14PySparsityInfo_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2695 __Pyx_RefNannyDeclarations
2696 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
2697 if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
2698 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args));
return -1;}
2699 if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds,
"__cinit__", 0)))
return -1;
2700 __pyx_r = __pyx_pf_9csparsity_14PySparsityInfo___cinit__(((
struct __pyx_obj_9csparsity_PySparsityInfo *)__pyx_v_self));
2703 __Pyx_RefNannyFinishContext();
2707 static int __pyx_pf_9csparsity_14PySparsityInfo___cinit__(CYTHON_UNUSED
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self) {
2709 __Pyx_RefNannyDeclarations
2710 __Pyx_RefNannySetupContext(
"__cinit__", 0);
2714 __Pyx_RefNannyFinishContext();
2727 static void __pyx_pw_9csparsity_14PySparsityInfo_3__dealloc__(PyObject *__pyx_v_self);
2728 static void __pyx_pw_9csparsity_14PySparsityInfo_3__dealloc__(PyObject *__pyx_v_self) {
2729 __Pyx_RefNannyDeclarations
2730 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
2731 __pyx_pf_9csparsity_14PySparsityInfo_2__dealloc__(((
struct __pyx_obj_9csparsity_PySparsityInfo *)__pyx_v_self));
2734 __Pyx_RefNannyFinishContext();
2737 static void __pyx_pf_9csparsity_14PySparsityInfo_2__dealloc__(CYTHON_UNUSED
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self) {
2738 __Pyx_RefNannyDeclarations
2739 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
2742 __Pyx_RefNannyFinishContext();
2754 static PyObject *__pyx_pw_9csparsity_14PySparsityInfo_5findNonzeros(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
2755 static PyObject *__pyx_pw_9csparsity_14PySparsityInfo_5findNonzeros(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2756 int __pyx_v_nElements_global;
2757 int __pyx_v_nDOF_test_element;
2758 int __pyx_v_nDOF_trial_element;
2759 PyArrayObject *__pyx_v_nFreeDOF_test = 0;
2760 PyArrayObject *__pyx_v_freeGlobal_test = 0;
2761 PyArrayObject *__pyx_v_nFreeDOF_trial = 0;
2762 PyArrayObject *__pyx_v_freeGlobal_trial = 0;
2763 int __pyx_v_offset_test;
2764 int __pyx_v_stride_test;
2765 int __pyx_v_offset_trial;
2766 int __pyx_v_stride_trial;
2767 int __pyx_v_hasNumericalFlux;
2768 int __pyx_v_hasDiffusionInMixedForm;
2769 int __pyx_v_needNumericalFluxJacobian;
2770 int __pyx_v_nElementBoundaries_element;
2771 PyArrayObject *__pyx_v_elementNeighborsArray = 0;
2772 int __pyx_v_nInteriorElementBoundaries_global;
2773 PyArrayObject *__pyx_v_interiorElementBoundariesArray = 0;
2774 PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2775 PyArrayObject *__pyx_v_elementBoundaryLocalElementBoundariesArray = 0;
2776 int __pyx_v_hasFluxBoundaryConditions;
2777 int __pyx_v_nExteriorElementBoundaries_global;
2778 PyArrayObject *__pyx_v_exteriorElementBoundariesArray = 0;
2779 int __pyx_v_hasOutflowBoundary;
2780 int __pyx_v_needOutflowJacobian;
2781 int __pyx_lineno = 0;
2782 const char *__pyx_filename = NULL;
2783 int __pyx_clineno = 0;
2784 PyObject *__pyx_r = 0;
2785 __Pyx_RefNannyDeclarations
2786 __Pyx_RefNannySetupContext(
"findNonzeros (wrapper)", 0);
2788 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nElements_global,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_nFreeDOF_test,&__pyx_n_s_freeGlobal_test,&__pyx_n_s_nFreeDOF_trial,&__pyx_n_s_freeGlobal_trial,&__pyx_n_s_offset_test,&__pyx_n_s_stride_test,&__pyx_n_s_offset_trial,&__pyx_n_s_stride_trial,&__pyx_n_s_hasNumericalFlux,&__pyx_n_s_hasDiffusionInMixedForm,&__pyx_n_s_needNumericalFluxJacobian,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_nInteriorElementBoundaries_globa,&__pyx_n_s_interiorElementBoundariesArray,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementBoundaryLocalElementBound,&__pyx_n_s_hasFluxBoundaryConditions,&__pyx_n_s_nExteriorElementBoundaries_globa,&__pyx_n_s_exteriorElementBoundariesArray,&__pyx_n_s_hasOutflowBoundary,&__pyx_n_s_needOutflowJacobian,0};
2789 PyObject* values[25] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
2790 if (unlikely(__pyx_kwds)) {
2792 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2794 case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
2796 case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
2798 case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
2800 case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
2802 case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
2804 case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
2806 case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
2808 case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
2810 case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
2812 case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
2814 case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
2816 case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
2818 case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
2820 case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
2822 case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
2824 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
2826 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
2828 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
2830 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2832 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2834 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2836 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2838 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2840 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2842 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2845 default:
goto __pyx_L5_argtuple_error;
2847 kw_args = PyDict_Size(__pyx_kwds);
2850 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
2851 else goto __pyx_L5_argtuple_error;
2854 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
2856 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 1); __PYX_ERR(1, 14, __pyx_L3_error)
2860 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
2862 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 2); __PYX_ERR(1, 14, __pyx_L3_error)
2866 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nFreeDOF_test)) != 0)) kw_args--;
2868 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 3); __PYX_ERR(1, 14, __pyx_L3_error)
2872 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_freeGlobal_test)) != 0)) kw_args--;
2874 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 4); __PYX_ERR(1, 14, __pyx_L3_error)
2878 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nFreeDOF_trial)) != 0)) kw_args--;
2880 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 5); __PYX_ERR(1, 14, __pyx_L3_error)
2884 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_freeGlobal_trial)) != 0)) kw_args--;
2886 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 6); __PYX_ERR(1, 14, __pyx_L3_error)
2890 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset_test)) != 0)) kw_args--;
2892 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 7); __PYX_ERR(1, 14, __pyx_L3_error)
2896 if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stride_test)) != 0)) kw_args--;
2898 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 8); __PYX_ERR(1, 14, __pyx_L3_error)
2902 if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset_trial)) != 0)) kw_args--;
2904 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 9); __PYX_ERR(1, 14, __pyx_L3_error)
2908 if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stride_trial)) != 0)) kw_args--;
2910 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 10); __PYX_ERR(1, 14, __pyx_L3_error)
2914 if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hasNumericalFlux)) != 0)) kw_args--;
2916 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 11); __PYX_ERR(1, 14, __pyx_L3_error)
2920 if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hasDiffusionInMixedForm)) != 0)) kw_args--;
2922 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 12); __PYX_ERR(1, 14, __pyx_L3_error)
2926 if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_needNumericalFluxJacobian)) != 0)) kw_args--;
2928 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 13); __PYX_ERR(1, 14, __pyx_L3_error)
2932 if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
2934 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 14); __PYX_ERR(1, 14, __pyx_L3_error)
2938 if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
2940 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 15); __PYX_ERR(1, 14, __pyx_L3_error)
2944 if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nInteriorElementBoundaries_globa)) != 0)) kw_args--;
2946 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 16); __PYX_ERR(1, 14, __pyx_L3_error)
2950 if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interiorElementBoundariesArray)) != 0)) kw_args--;
2952 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 17); __PYX_ERR(1, 14, __pyx_L3_error)
2956 if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2958 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 18); __PYX_ERR(1, 14, __pyx_L3_error)
2962 if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryLocalElementBound)) != 0)) kw_args--;
2964 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 19); __PYX_ERR(1, 14, __pyx_L3_error)
2968 if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hasFluxBoundaryConditions)) != 0)) kw_args--;
2970 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 20); __PYX_ERR(1, 14, __pyx_L3_error)
2974 if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nExteriorElementBoundaries_globa)) != 0)) kw_args--;
2976 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 21); __PYX_ERR(1, 14, __pyx_L3_error)
2980 if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundariesArray)) != 0)) kw_args--;
2982 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 22); __PYX_ERR(1, 14, __pyx_L3_error)
2986 if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hasOutflowBoundary)) != 0)) kw_args--;
2988 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 23); __PYX_ERR(1, 14, __pyx_L3_error)
2992 if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_needOutflowJacobian)) != 0)) kw_args--;
2994 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, 24); __PYX_ERR(1, 14, __pyx_L3_error)
2997 if (unlikely(kw_args > 0)) {
2998 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"findNonzeros") < 0)) __PYX_ERR(1, 14, __pyx_L3_error)
3000 }
else if (PyTuple_GET_SIZE(__pyx_args) != 25) {
3001 goto __pyx_L5_argtuple_error;
3003 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3004 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3005 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3006 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3007 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3008 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3009 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3010 values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3011 values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3012 values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3013 values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3014 values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3015 values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
3016 values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
3017 values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
3018 values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
3019 values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
3020 values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
3021 values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
3022 values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
3023 values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
3024 values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
3025 values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
3026 values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
3027 values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
3029 __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[0]);
if (unlikely((__pyx_v_nElements_global == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 15, __pyx_L3_error)
3030 __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_nDOF_test_element == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error)
3031 __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[2]);
if (unlikely((__pyx_v_nDOF_trial_element == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 17, __pyx_L3_error)
3032 __pyx_v_nFreeDOF_test = ((PyArrayObject *)values[3]);
3033 __pyx_v_freeGlobal_test = ((PyArrayObject *)values[4]);
3034 __pyx_v_nFreeDOF_trial = ((PyArrayObject *)values[5]);
3035 __pyx_v_freeGlobal_trial = ((PyArrayObject *)values[6]);
3036 __pyx_v_offset_test = __Pyx_PyInt_As_int(values[7]);
if (unlikely((__pyx_v_offset_test == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 22, __pyx_L3_error)
3037 __pyx_v_stride_test = __Pyx_PyInt_As_int(values[8]);
if (unlikely((__pyx_v_stride_test == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 23, __pyx_L3_error)
3038 __pyx_v_offset_trial = __Pyx_PyInt_As_int(values[9]);
if (unlikely((__pyx_v_offset_trial == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 24, __pyx_L3_error)
3039 __pyx_v_stride_trial = __Pyx_PyInt_As_int(values[10]);
if (unlikely((__pyx_v_stride_trial == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L3_error)
3040 __pyx_v_hasNumericalFlux = __Pyx_PyInt_As_int(values[11]);
if (unlikely((__pyx_v_hasNumericalFlux == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 26, __pyx_L3_error)
3041 __pyx_v_hasDiffusionInMixedForm = __Pyx_PyInt_As_int(values[12]);
if (unlikely((__pyx_v_hasDiffusionInMixedForm == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 27, __pyx_L3_error)
3042 __pyx_v_needNumericalFluxJacobian = __Pyx_PyInt_As_int(values[13]);
if (unlikely((__pyx_v_needNumericalFluxJacobian == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 28, __pyx_L3_error)
3043 __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[14]);
if (unlikely((__pyx_v_nElementBoundaries_element == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 29, __pyx_L3_error)
3044 __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[15]);
3045 __pyx_v_nInteriorElementBoundaries_global = __Pyx_PyInt_As_int(values[16]);
if (unlikely((__pyx_v_nInteriorElementBoundaries_global == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 31, __pyx_L3_error)
3046 __pyx_v_interiorElementBoundariesArray = ((PyArrayObject *)values[17]);
3047 __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[18]);
3048 __pyx_v_elementBoundaryLocalElementBoundariesArray = ((PyArrayObject *)values[19]);
3049 __pyx_v_hasFluxBoundaryConditions = __Pyx_PyInt_As_int(values[20]);
if (unlikely((__pyx_v_hasFluxBoundaryConditions == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 35, __pyx_L3_error)
3050 __pyx_v_nExteriorElementBoundaries_global = __Pyx_PyInt_As_int(values[21]);
if (unlikely((__pyx_v_nExteriorElementBoundaries_global == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 36, __pyx_L3_error)
3051 __pyx_v_exteriorElementBoundariesArray = ((PyArrayObject *)values[22]);
3052 __pyx_v_hasOutflowBoundary = __Pyx_PyInt_As_int(values[23]);
if (unlikely((__pyx_v_hasOutflowBoundary == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 38, __pyx_L3_error)
3053 __pyx_v_needOutflowJacobian = __Pyx_PyInt_As_int(values[24]);
if (unlikely((__pyx_v_needOutflowJacobian == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 39, __pyx_L3_error)
3055 goto __pyx_L4_argument_unpacking_done;
3056 __pyx_L5_argtuple_error:;
3057 __Pyx_RaiseArgtupleInvalid(
"findNonzeros", 1, 25, 25, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 14, __pyx_L3_error)
3059 __Pyx_AddTraceback(
"csparsity.PySparsityInfo.findNonzeros", __pyx_clineno, __pyx_lineno, __pyx_filename);
3060 __Pyx_RefNannyFinishContext();
3062 __pyx_L4_argument_unpacking_done:;
3063 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nFreeDOF_test), __pyx_ptype_5numpy_ndarray, 1,
"nFreeDOF_test", 0))) __PYX_ERR(1, 18, __pyx_L1_error)
3064 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_freeGlobal_test), __pyx_ptype_5numpy_ndarray, 1,
"freeGlobal_test", 0))) __PYX_ERR(1, 19, __pyx_L1_error)
3065 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nFreeDOF_trial), __pyx_ptype_5numpy_ndarray, 1,
"nFreeDOF_trial", 0))) __PYX_ERR(1, 20, __pyx_L1_error)
3066 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_freeGlobal_trial), __pyx_ptype_5numpy_ndarray, 1,
"freeGlobal_trial", 0))) __PYX_ERR(1, 21, __pyx_L1_error)
3067 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1,
"elementNeighborsArray", 0))) __PYX_ERR(1, 30, __pyx_L1_error)
3068 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interiorElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1,
"interiorElementBoundariesArray", 0))) __PYX_ERR(1, 32, __pyx_L1_error)
3069 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1,
"elementBoundaryElementsArray", 0))) __PYX_ERR(1, 33, __pyx_L1_error)
3070 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryLocalElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1,
"elementBoundaryLocalElementBoundariesArray", 0))) __PYX_ERR(1, 34, __pyx_L1_error)
3071 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1,
"exteriorElementBoundariesArray", 0))) __PYX_ERR(1, 37, __pyx_L1_error)
3072 __pyx_r = __pyx_pf_9csparsity_14PySparsityInfo_4findNonzeros(((
struct __pyx_obj_9csparsity_PySparsityInfo *)__pyx_v_self), __pyx_v_nElements_global, __pyx_v_nDOF_test_element, __pyx_v_nDOF_trial_element, __pyx_v_nFreeDOF_test, __pyx_v_freeGlobal_test, __pyx_v_nFreeDOF_trial, __pyx_v_freeGlobal_trial, __pyx_v_offset_test, __pyx_v_stride_test, __pyx_v_offset_trial, __pyx_v_stride_trial, __pyx_v_hasNumericalFlux, __pyx_v_hasDiffusionInMixedForm, __pyx_v_needNumericalFluxJacobian, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_nInteriorElementBoundaries_global, __pyx_v_interiorElementBoundariesArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementBoundaryLocalElementBoundariesArray, __pyx_v_hasFluxBoundaryConditions, __pyx_v_nExteriorElementBoundaries_global, __pyx_v_exteriorElementBoundariesArray, __pyx_v_hasOutflowBoundary, __pyx_v_needOutflowJacobian);
3079 __Pyx_RefNannyFinishContext();
3083 static PyObject *__pyx_pf_9csparsity_14PySparsityInfo_4findNonzeros(
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self,
int __pyx_v_nElements_global,
int __pyx_v_nDOF_test_element,
int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_nFreeDOF_test, PyArrayObject *__pyx_v_freeGlobal_test, PyArrayObject *__pyx_v_nFreeDOF_trial, PyArrayObject *__pyx_v_freeGlobal_trial,
int __pyx_v_offset_test,
int __pyx_v_stride_test,
int __pyx_v_offset_trial,
int __pyx_v_stride_trial,
int __pyx_v_hasNumericalFlux,
int __pyx_v_hasDiffusionInMixedForm,
int __pyx_v_needNumericalFluxJacobian,
int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray,
int __pyx_v_nInteriorElementBoundaries_global, PyArrayObject *__pyx_v_interiorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementBoundaryLocalElementBoundariesArray,
int __pyx_v_hasFluxBoundaryConditions,
int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray,
int __pyx_v_hasOutflowBoundary,
int __pyx_v_needOutflowJacobian) {
3084 PyObject *__pyx_r = NULL;
3085 __Pyx_RefNannyDeclarations
3086 __Pyx_RefNannySetupContext(
"findNonzeros", 0);
3095 __pyx_v_self->cpp.findNonzeros(__pyx_v_nElements_global, __pyx_v_nDOF_test_element, __pyx_v_nDOF_trial_element, ((
int *)__pyx_v_nFreeDOF_test->data), ((
int *)__pyx_v_freeGlobal_test->data), ((
int *)__pyx_v_nFreeDOF_trial->data), ((
int *)__pyx_v_freeGlobal_trial->data), __pyx_v_offset_test, __pyx_v_stride_test, __pyx_v_offset_trial, __pyx_v_stride_trial, __pyx_v_hasNumericalFlux, __pyx_v_hasDiffusionInMixedForm, __pyx_v_needNumericalFluxJacobian, __pyx_v_nElementBoundaries_element, ((
int *)__pyx_v_elementNeighborsArray->data), __pyx_v_nInteriorElementBoundaries_global, ((
int *)__pyx_v_interiorElementBoundariesArray->data), ((
int *)__pyx_v_elementBoundaryElementsArray->data), ((
int *)__pyx_v_elementBoundaryLocalElementBoundariesArray->data), __pyx_v_hasFluxBoundaryConditions, __pyx_v_nExteriorElementBoundaries_global, ((
int *)__pyx_v_exteriorElementBoundariesArray->data), __pyx_v_hasOutflowBoundary, __pyx_v_needOutflowJacobian);
3106 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3107 __Pyx_XGIVEREF(__pyx_r);
3108 __Pyx_RefNannyFinishContext();
3121 static PyObject *__pyx_pw_9csparsity_14PySparsityInfo_7getOffsets_CSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3122 static PyObject *__pyx_pw_9csparsity_14PySparsityInfo_7getOffsets_CSR(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3123 int __pyx_v_nElements_global;
3124 int __pyx_v_nDOF_test_element;
3125 int __pyx_v_nDOF_trial_element;
3126 PyArrayObject *__pyx_v_nFreeDOF_test = 0;
3127 PyArrayObject *__pyx_v_freeGlobal_test = 0;
3128 PyArrayObject *__pyx_v_nFreeDOF_trial = 0;
3129 PyArrayObject *__pyx_v_freeGlobal_trial = 0;
3130 int __pyx_v_offset_test;
3131 int __pyx_v_stride_test;
3132 int __pyx_v_offset_trial;
3133 int __pyx_v_stride_trial;
3134 int __pyx_v_hasNumericalFlux;
3135 int __pyx_v_hasDiffusionInMixedForm;
3136 int __pyx_v_needNumericalFluxJacobian;
3137 int __pyx_v_nElementBoundaries_element;
3138 PyArrayObject *__pyx_v_elementNeighborsArray = 0;
3139 int __pyx_v_nInteriorElementBoundaries_global;
3140 PyArrayObject *__pyx_v_interiorElementBoundariesArray = 0;
3141 PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
3142 PyArrayObject *__pyx_v_elementBoundaryLocalElementBoundariesArray = 0;
3143 int __pyx_v_hasFluxBoundaryConditions;
3144 int __pyx_v_nExteriorElementBoundaries_global;
3145 PyArrayObject *__pyx_v_exteriorElementBoundariesArray = 0;
3146 int __pyx_v_hasOutflowBoundary;
3147 int __pyx_v_needOutflowJacobian;
3148 PyArrayObject *__pyx_v_rowptr = 0;
3149 PyArrayObject *__pyx_v_csrRowIndeces = 0;
3150 PyArrayObject *__pyx_v_csrColumnOffsets = 0;
3151 PyArrayObject *__pyx_v_csrColumnOffsets_eNebN = 0;
3152 PyArrayObject *__pyx_v_csrColumnOffsets_eb = 0;
3153 PyArrayObject *__pyx_v_csrColumnOffsets_eb_eNebN = 0;
3154 int __pyx_lineno = 0;
3155 const char *__pyx_filename = NULL;
3156 int __pyx_clineno = 0;
3157 PyObject *__pyx_r = 0;
3158 __Pyx_RefNannyDeclarations
3159 __Pyx_RefNannySetupContext(
"getOffsets_CSR (wrapper)", 0);
3161 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nElements_global,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_nFreeDOF_test,&__pyx_n_s_freeGlobal_test,&__pyx_n_s_nFreeDOF_trial,&__pyx_n_s_freeGlobal_trial,&__pyx_n_s_offset_test,&__pyx_n_s_stride_test,&__pyx_n_s_offset_trial,&__pyx_n_s_stride_trial,&__pyx_n_s_hasNumericalFlux,&__pyx_n_s_hasDiffusionInMixedForm,&__pyx_n_s_needNumericalFluxJacobian,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_nInteriorElementBoundaries_globa,&__pyx_n_s_interiorElementBoundariesArray,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementBoundaryLocalElementBound,&__pyx_n_s_hasFluxBoundaryConditions,&__pyx_n_s_nExteriorElementBoundaries_globa,&__pyx_n_s_exteriorElementBoundariesArray,&__pyx_n_s_hasOutflowBoundary,&__pyx_n_s_needOutflowJacobian,&__pyx_n_s_rowptr,&__pyx_n_s_csrRowIndeces,&__pyx_n_s_csrColumnOffsets,&__pyx_n_s_csrColumnOffsets_eNebN,&__pyx_n_s_csrColumnOffsets_eb,&__pyx_n_s_csrColumnOffsets_eb_eNebN,0};
3162 PyObject* values[31] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
3163 if (unlikely(__pyx_kwds)) {
3165 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3167 case 31: values[30] = PyTuple_GET_ITEM(__pyx_args, 30);
3169 case 30: values[29] = PyTuple_GET_ITEM(__pyx_args, 29);
3171 case 29: values[28] = PyTuple_GET_ITEM(__pyx_args, 28);
3173 case 28: values[27] = PyTuple_GET_ITEM(__pyx_args, 27);
3175 case 27: values[26] = PyTuple_GET_ITEM(__pyx_args, 26);
3177 case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
3179 case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
3181 case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
3183 case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
3185 case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
3187 case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
3189 case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
3191 case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
3193 case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
3195 case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
3197 case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
3199 case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
3201 case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
3203 case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
3205 case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3207 case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3209 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3211 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3213 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3215 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3217 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3219 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3221 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3223 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3225 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3227 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3230 default:
goto __pyx_L5_argtuple_error;
3232 kw_args = PyDict_Size(__pyx_kwds);
3235 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
3236 else goto __pyx_L5_argtuple_error;
3239 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
3241 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 1); __PYX_ERR(1, 65, __pyx_L3_error)
3245 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
3247 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 2); __PYX_ERR(1, 65, __pyx_L3_error)
3251 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nFreeDOF_test)) != 0)) kw_args--;
3253 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 3); __PYX_ERR(1, 65, __pyx_L3_error)
3257 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_freeGlobal_test)) != 0)) kw_args--;
3259 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 4); __PYX_ERR(1, 65, __pyx_L3_error)
3263 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nFreeDOF_trial)) != 0)) kw_args--;
3265 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 5); __PYX_ERR(1, 65, __pyx_L3_error)
3269 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_freeGlobal_trial)) != 0)) kw_args--;
3271 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 6); __PYX_ERR(1, 65, __pyx_L3_error)
3275 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset_test)) != 0)) kw_args--;
3277 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 7); __PYX_ERR(1, 65, __pyx_L3_error)
3281 if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stride_test)) != 0)) kw_args--;
3283 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 8); __PYX_ERR(1, 65, __pyx_L3_error)
3287 if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset_trial)) != 0)) kw_args--;
3289 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 9); __PYX_ERR(1, 65, __pyx_L3_error)
3293 if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stride_trial)) != 0)) kw_args--;
3295 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 10); __PYX_ERR(1, 65, __pyx_L3_error)
3299 if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hasNumericalFlux)) != 0)) kw_args--;
3301 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 11); __PYX_ERR(1, 65, __pyx_L3_error)
3305 if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hasDiffusionInMixedForm)) != 0)) kw_args--;
3307 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 12); __PYX_ERR(1, 65, __pyx_L3_error)
3311 if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_needNumericalFluxJacobian)) != 0)) kw_args--;
3313 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 13); __PYX_ERR(1, 65, __pyx_L3_error)
3317 if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
3319 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 14); __PYX_ERR(1, 65, __pyx_L3_error)
3323 if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
3325 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 15); __PYX_ERR(1, 65, __pyx_L3_error)
3329 if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nInteriorElementBoundaries_globa)) != 0)) kw_args--;
3331 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 16); __PYX_ERR(1, 65, __pyx_L3_error)
3335 if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interiorElementBoundariesArray)) != 0)) kw_args--;
3337 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 17); __PYX_ERR(1, 65, __pyx_L3_error)
3341 if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
3343 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 18); __PYX_ERR(1, 65, __pyx_L3_error)
3347 if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryLocalElementBound)) != 0)) kw_args--;
3349 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 19); __PYX_ERR(1, 65, __pyx_L3_error)
3353 if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hasFluxBoundaryConditions)) != 0)) kw_args--;
3355 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 20); __PYX_ERR(1, 65, __pyx_L3_error)
3359 if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nExteriorElementBoundaries_globa)) != 0)) kw_args--;
3361 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 21); __PYX_ERR(1, 65, __pyx_L3_error)
3365 if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundariesArray)) != 0)) kw_args--;
3367 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 22); __PYX_ERR(1, 65, __pyx_L3_error)
3371 if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hasOutflowBoundary)) != 0)) kw_args--;
3373 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 23); __PYX_ERR(1, 65, __pyx_L3_error)
3377 if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_needOutflowJacobian)) != 0)) kw_args--;
3379 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 24); __PYX_ERR(1, 65, __pyx_L3_error)
3383 if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
3385 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 25); __PYX_ERR(1, 65, __pyx_L3_error)
3389 if (likely((values[26] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_csrRowIndeces)) != 0)) kw_args--;
3391 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 26); __PYX_ERR(1, 65, __pyx_L3_error)
3395 if (likely((values[27] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_csrColumnOffsets)) != 0)) kw_args--;
3397 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 27); __PYX_ERR(1, 65, __pyx_L3_error)
3401 if (likely((values[28] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_csrColumnOffsets_eNebN)) != 0)) kw_args--;
3403 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 28); __PYX_ERR(1, 65, __pyx_L3_error)
3407 if (likely((values[29] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_csrColumnOffsets_eb)) != 0)) kw_args--;
3409 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 29); __PYX_ERR(1, 65, __pyx_L3_error)
3413 if (likely((values[30] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_csrColumnOffsets_eb_eNebN)) != 0)) kw_args--;
3415 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, 30); __PYX_ERR(1, 65, __pyx_L3_error)
3418 if (unlikely(kw_args > 0)) {
3419 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"getOffsets_CSR") < 0)) __PYX_ERR(1, 65, __pyx_L3_error)
3421 }
else if (PyTuple_GET_SIZE(__pyx_args) != 31) {
3422 goto __pyx_L5_argtuple_error;
3424 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3425 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3426 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3427 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3428 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3429 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3430 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3431 values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3432 values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3433 values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3434 values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3435 values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3436 values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
3437 values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
3438 values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
3439 values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
3440 values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
3441 values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
3442 values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
3443 values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
3444 values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
3445 values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
3446 values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
3447 values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
3448 values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
3449 values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
3450 values[26] = PyTuple_GET_ITEM(__pyx_args, 26);
3451 values[27] = PyTuple_GET_ITEM(__pyx_args, 27);
3452 values[28] = PyTuple_GET_ITEM(__pyx_args, 28);
3453 values[29] = PyTuple_GET_ITEM(__pyx_args, 29);
3454 values[30] = PyTuple_GET_ITEM(__pyx_args, 30);
3456 __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[0]);
if (unlikely((__pyx_v_nElements_global == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 66, __pyx_L3_error)
3457 __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_nDOF_test_element == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L3_error)
3458 __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[2]);
if (unlikely((__pyx_v_nDOF_trial_element == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 68, __pyx_L3_error)
3459 __pyx_v_nFreeDOF_test = ((PyArrayObject *)values[3]);
3460 __pyx_v_freeGlobal_test = ((PyArrayObject *)values[4]);
3461 __pyx_v_nFreeDOF_trial = ((PyArrayObject *)values[5]);
3462 __pyx_v_freeGlobal_trial = ((PyArrayObject *)values[6]);
3463 __pyx_v_offset_test = __Pyx_PyInt_As_int(values[7]);
if (unlikely((__pyx_v_offset_test == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 73, __pyx_L3_error)
3464 __pyx_v_stride_test = __Pyx_PyInt_As_int(values[8]);
if (unlikely((__pyx_v_stride_test == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 74, __pyx_L3_error)
3465 __pyx_v_offset_trial = __Pyx_PyInt_As_int(values[9]);
if (unlikely((__pyx_v_offset_trial == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 75, __pyx_L3_error)
3466 __pyx_v_stride_trial = __Pyx_PyInt_As_int(values[10]);
if (unlikely((__pyx_v_stride_trial == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 76, __pyx_L3_error)
3467 __pyx_v_hasNumericalFlux = __Pyx_PyInt_As_int(values[11]);
if (unlikely((__pyx_v_hasNumericalFlux == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 77, __pyx_L3_error)
3468 __pyx_v_hasDiffusionInMixedForm = __Pyx_PyInt_As_int(values[12]);
if (unlikely((__pyx_v_hasDiffusionInMixedForm == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 78, __pyx_L3_error)
3469 __pyx_v_needNumericalFluxJacobian = __Pyx_PyInt_As_int(values[13]);
if (unlikely((__pyx_v_needNumericalFluxJacobian == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 79, __pyx_L3_error)
3470 __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[14]);
if (unlikely((__pyx_v_nElementBoundaries_element == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 80, __pyx_L3_error)
3471 __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[15]);
3472 __pyx_v_nInteriorElementBoundaries_global = __Pyx_PyInt_As_int(values[16]);
if (unlikely((__pyx_v_nInteriorElementBoundaries_global == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 82, __pyx_L3_error)
3473 __pyx_v_interiorElementBoundariesArray = ((PyArrayObject *)values[17]);
3474 __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[18]);
3475 __pyx_v_elementBoundaryLocalElementBoundariesArray = ((PyArrayObject *)values[19]);
3476 __pyx_v_hasFluxBoundaryConditions = __Pyx_PyInt_As_int(values[20]);
if (unlikely((__pyx_v_hasFluxBoundaryConditions == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 86, __pyx_L3_error)
3477 __pyx_v_nExteriorElementBoundaries_global = __Pyx_PyInt_As_int(values[21]);
if (unlikely((__pyx_v_nExteriorElementBoundaries_global == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 87, __pyx_L3_error)
3478 __pyx_v_exteriorElementBoundariesArray = ((PyArrayObject *)values[22]);
3479 __pyx_v_hasOutflowBoundary = __Pyx_PyInt_As_int(values[23]);
if (unlikely((__pyx_v_hasOutflowBoundary == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 89, __pyx_L3_error)
3480 __pyx_v_needOutflowJacobian = __Pyx_PyInt_As_int(values[24]);
if (unlikely((__pyx_v_needOutflowJacobian == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 90, __pyx_L3_error)
3481 __pyx_v_rowptr = ((PyArrayObject *)values[25]);
3482 __pyx_v_csrRowIndeces = ((PyArrayObject *)values[26]);
3483 __pyx_v_csrColumnOffsets = ((PyArrayObject *)values[27]);
3484 __pyx_v_csrColumnOffsets_eNebN = ((PyArrayObject *)values[28]);
3485 __pyx_v_csrColumnOffsets_eb = ((PyArrayObject *)values[29]);
3486 __pyx_v_csrColumnOffsets_eb_eNebN = ((PyArrayObject *)values[30]);
3488 goto __pyx_L4_argument_unpacking_done;
3489 __pyx_L5_argtuple_error:;
3490 __Pyx_RaiseArgtupleInvalid(
"getOffsets_CSR", 1, 31, 31, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 65, __pyx_L3_error)
3492 __Pyx_AddTraceback(
"csparsity.PySparsityInfo.getOffsets_CSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
3493 __Pyx_RefNannyFinishContext();
3495 __pyx_L4_argument_unpacking_done:;
3496 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nFreeDOF_test), __pyx_ptype_5numpy_ndarray, 1,
"nFreeDOF_test", 0))) __PYX_ERR(1, 69, __pyx_L1_error)
3497 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_freeGlobal_test), __pyx_ptype_5numpy_ndarray, 1,
"freeGlobal_test", 0))) __PYX_ERR(1, 70, __pyx_L1_error)
3498 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nFreeDOF_trial), __pyx_ptype_5numpy_ndarray, 1,
"nFreeDOF_trial", 0))) __PYX_ERR(1, 71, __pyx_L1_error)
3499 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_freeGlobal_trial), __pyx_ptype_5numpy_ndarray, 1,
"freeGlobal_trial", 0))) __PYX_ERR(1, 72, __pyx_L1_error)
3500 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1,
"elementNeighborsArray", 0))) __PYX_ERR(1, 81, __pyx_L1_error)
3501 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interiorElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1,
"interiorElementBoundariesArray", 0))) __PYX_ERR(1, 83, __pyx_L1_error)
3502 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1,
"elementBoundaryElementsArray", 0))) __PYX_ERR(1, 84, __pyx_L1_error)
3503 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryLocalElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1,
"elementBoundaryLocalElementBoundariesArray", 0))) __PYX_ERR(1, 85, __pyx_L1_error)
3504 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1,
"exteriorElementBoundariesArray", 0))) __PYX_ERR(1, 88, __pyx_L1_error)
3505 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1,
"rowptr", 0))) __PYX_ERR(1, 91, __pyx_L1_error)
3506 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_csrRowIndeces), __pyx_ptype_5numpy_ndarray, 1,
"csrRowIndeces", 0))) __PYX_ERR(1, 92, __pyx_L1_error)
3507 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_csrColumnOffsets), __pyx_ptype_5numpy_ndarray, 1,
"csrColumnOffsets", 0))) __PYX_ERR(1, 93, __pyx_L1_error)
3508 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_csrColumnOffsets_eNebN), __pyx_ptype_5numpy_ndarray, 1,
"csrColumnOffsets_eNebN", 0))) __PYX_ERR(1, 94, __pyx_L1_error)
3509 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_csrColumnOffsets_eb), __pyx_ptype_5numpy_ndarray, 1,
"csrColumnOffsets_eb", 0))) __PYX_ERR(1, 95, __pyx_L1_error)
3510 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_csrColumnOffsets_eb_eNebN), __pyx_ptype_5numpy_ndarray, 1,
"csrColumnOffsets_eb_eNebN", 0))) __PYX_ERR(1, 96, __pyx_L1_error)
3511 __pyx_r = __pyx_pf_9csparsity_14PySparsityInfo_6getOffsets_CSR(((
struct __pyx_obj_9csparsity_PySparsityInfo *)__pyx_v_self), __pyx_v_nElements_global, __pyx_v_nDOF_test_element, __pyx_v_nDOF_trial_element, __pyx_v_nFreeDOF_test, __pyx_v_freeGlobal_test, __pyx_v_nFreeDOF_trial, __pyx_v_freeGlobal_trial, __pyx_v_offset_test, __pyx_v_stride_test, __pyx_v_offset_trial, __pyx_v_stride_trial, __pyx_v_hasNumericalFlux, __pyx_v_hasDiffusionInMixedForm, __pyx_v_needNumericalFluxJacobian, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_nInteriorElementBoundaries_global, __pyx_v_interiorElementBoundariesArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementBoundaryLocalElementBoundariesArray, __pyx_v_hasFluxBoundaryConditions, __pyx_v_nExteriorElementBoundaries_global, __pyx_v_exteriorElementBoundariesArray, __pyx_v_hasOutflowBoundary, __pyx_v_needOutflowJacobian, __pyx_v_rowptr, __pyx_v_csrRowIndeces, __pyx_v_csrColumnOffsets, __pyx_v_csrColumnOffsets_eNebN, __pyx_v_csrColumnOffsets_eb, __pyx_v_csrColumnOffsets_eb_eNebN);
3518 __Pyx_RefNannyFinishContext();
3522 static PyObject *__pyx_pf_9csparsity_14PySparsityInfo_6getOffsets_CSR(
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self,
int __pyx_v_nElements_global,
int __pyx_v_nDOF_test_element,
int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_nFreeDOF_test, PyArrayObject *__pyx_v_freeGlobal_test, PyArrayObject *__pyx_v_nFreeDOF_trial, PyArrayObject *__pyx_v_freeGlobal_trial,
int __pyx_v_offset_test,
int __pyx_v_stride_test,
int __pyx_v_offset_trial,
int __pyx_v_stride_trial,
int __pyx_v_hasNumericalFlux,
int __pyx_v_hasDiffusionInMixedForm,
int __pyx_v_needNumericalFluxJacobian,
int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray,
int __pyx_v_nInteriorElementBoundaries_global, PyArrayObject *__pyx_v_interiorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementBoundaryLocalElementBoundariesArray,
int __pyx_v_hasFluxBoundaryConditions,
int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray,
int __pyx_v_hasOutflowBoundary,
int __pyx_v_needOutflowJacobian, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_csrRowIndeces, PyArrayObject *__pyx_v_csrColumnOffsets, PyArrayObject *__pyx_v_csrColumnOffsets_eNebN, PyArrayObject *__pyx_v_csrColumnOffsets_eb, PyArrayObject *__pyx_v_csrColumnOffsets_eb_eNebN) {
3523 PyObject *__pyx_r = NULL;
3524 __Pyx_RefNannyDeclarations
3525 __Pyx_RefNannySetupContext(
"getOffsets_CSR", 0);
3534 __pyx_v_self->cpp.getOffsets_CSR(__pyx_v_nElements_global, __pyx_v_nDOF_test_element, __pyx_v_nDOF_trial_element, ((
int *)__pyx_v_nFreeDOF_test->data), ((
int *)__pyx_v_freeGlobal_test->data), ((
int *)__pyx_v_nFreeDOF_trial->data), ((
int *)__pyx_v_freeGlobal_trial->data), __pyx_v_offset_test, __pyx_v_stride_test, __pyx_v_offset_trial, __pyx_v_stride_trial, __pyx_v_hasNumericalFlux, __pyx_v_hasDiffusionInMixedForm, __pyx_v_needNumericalFluxJacobian, __pyx_v_nElementBoundaries_element, ((
int *)__pyx_v_elementNeighborsArray->data), __pyx_v_nInteriorElementBoundaries_global, ((
int *)__pyx_v_interiorElementBoundariesArray->data), ((
int *)__pyx_v_elementBoundaryElementsArray->data), ((
int *)__pyx_v_elementBoundaryLocalElementBoundariesArray->data), __pyx_v_hasFluxBoundaryConditions, __pyx_v_nExteriorElementBoundaries_global, ((
int *)__pyx_v_exteriorElementBoundariesArray->data), __pyx_v_hasOutflowBoundary, __pyx_v_needOutflowJacobian, ((
int *)__pyx_v_rowptr->data), ((
int *)__pyx_v_csrRowIndeces->data), ((
int *)__pyx_v_csrColumnOffsets->data), ((
int *)__pyx_v_csrColumnOffsets_eNebN->data), ((
int *)__pyx_v_csrColumnOffsets_eb->data), ((
int *)__pyx_v_csrColumnOffsets_eb_eNebN->data));
3545 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3546 __Pyx_XGIVEREF(__pyx_r);
3547 __Pyx_RefNannyFinishContext();
3560 static PyObject *__pyx_pw_9csparsity_14PySparsityInfo_9getCSR(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
3561 static PyObject *__pyx_pw_9csparsity_14PySparsityInfo_9getCSR(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3562 PyObject *__pyx_r = 0;
3563 __Pyx_RefNannyDeclarations
3564 __Pyx_RefNannySetupContext(
"getCSR (wrapper)", 0);
3565 __pyx_r = __pyx_pf_9csparsity_14PySparsityInfo_8getCSR(((
struct __pyx_obj_9csparsity_PySparsityInfo *)__pyx_v_self));
3568 __Pyx_RefNannyFinishContext();
3572 static PyObject *__pyx_pf_9csparsity_14PySparsityInfo_8getCSR(
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self) {
3573 PyObject *__pyx_r = NULL;
3574 __Pyx_RefNannyDeclarations
3575 PyObject *__pyx_t_1 = NULL;
3576 PyObject *__pyx_t_2 = NULL;
3577 PyObject *__pyx_t_3 = NULL;
3579 struct __pyx_array_obj *__pyx_t_5 = NULL;
3580 PyObject *__pyx_t_6 = NULL;
3581 PyObject *__pyx_t_7 = NULL;
3582 PyObject *__pyx_t_8 = NULL;
3584 PyObject *__pyx_t_10 = NULL;
3585 int __pyx_lineno = 0;
3586 const char *__pyx_filename = NULL;
3587 int __pyx_clineno = 0;
3588 __Pyx_RefNannySetupContext(
"getCSR", 0);
3597 __pyx_v_self->cpp.getCSR();
3606 __Pyx_XDECREF(__pyx_r);
3607 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 130, __pyx_L1_error)
3608 __Pyx_GOTREF(__pyx_t_2);
3609 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 130, __pyx_L1_error)
3610 __Pyx_GOTREF(__pyx_t_3);
3611 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3612 __pyx_t_4 = __pyx_v_self->cpp.rowptr;
3614 PyErr_SetString(PyExc_ValueError,
"Cannot create cython.array from NULL pointer");
3615 __PYX_ERR(1, 130, __pyx_L1_error)
3617 __pyx_t_6 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 130, __pyx_L1_error)
3618 __Pyx_GOTREF(__pyx_t_6);
3619 __pyx_t_2 = Py_BuildValue((
char*)
"(" __PYX_BUILD_PY_SSIZE_T
")", ((Py_ssize_t)__pyx_v_self->cpp.nrows));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 130, __pyx_L1_error)
3620 __Pyx_GOTREF(__pyx_t_2);
3621 __pyx_t_5 = __pyx_array_new(__pyx_t_2,
sizeof(
int), PyBytes_AS_STRING(__pyx_t_6), (
char *)
"c", (
char *) __pyx_t_4);
3622 if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 130, __pyx_L1_error)
3623 __Pyx_GOTREF(__pyx_t_5);
3624 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3625 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3627 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3628 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
3629 if (likely(__pyx_t_6)) {
3630 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
3631 __Pyx_INCREF(__pyx_t_6);
3632 __Pyx_INCREF(
function);
3633 __Pyx_DECREF_SET(__pyx_t_3,
function);
3636 __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, ((PyObject *)__pyx_t_5)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_t_5));
3637 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3638 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
3639 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 130, __pyx_L1_error)
3640 __Pyx_GOTREF(__pyx_t_1);
3641 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3650 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 131, __pyx_L1_error)
3651 __Pyx_GOTREF(__pyx_t_6);
3652 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 131, __pyx_L1_error)
3653 __Pyx_GOTREF(__pyx_t_2);
3654 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3655 __pyx_t_4 = __pyx_v_self->cpp.colind;
3657 PyErr_SetString(PyExc_ValueError,
"Cannot create cython.array from NULL pointer");
3658 __PYX_ERR(1, 131, __pyx_L1_error)
3660 __pyx_t_7 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 131, __pyx_L1_error)
3661 __Pyx_GOTREF(__pyx_t_7);
3662 __pyx_t_6 = Py_BuildValue((
char*)
"(" __PYX_BUILD_PY_SSIZE_T
")", ((Py_ssize_t)__pyx_v_self->cpp.nnz));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 131, __pyx_L1_error)
3663 __Pyx_GOTREF(__pyx_t_6);
3664 __pyx_t_5 = __pyx_array_new(__pyx_t_6,
sizeof(
int), PyBytes_AS_STRING(__pyx_t_7), (
char *)
"c", (
char *) __pyx_t_4);
3665 if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 131, __pyx_L1_error)
3666 __Pyx_GOTREF(__pyx_t_5);
3667 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3668 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3670 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3671 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
3672 if (likely(__pyx_t_7)) {
3673 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
3674 __Pyx_INCREF(__pyx_t_7);
3675 __Pyx_INCREF(
function);
3676 __Pyx_DECREF_SET(__pyx_t_2,
function);
3679 __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, ((PyObject *)__pyx_t_5)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_t_5));
3680 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3681 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
3682 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 131, __pyx_L1_error)
3683 __Pyx_GOTREF(__pyx_t_3);
3684 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3692 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->cpp.nnz);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 132, __pyx_L1_error)
3693 __Pyx_GOTREF(__pyx_t_2);
3700 __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 133, __pyx_L1_error)
3701 __Pyx_GOTREF(__pyx_t_6);
3702 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 133, __pyx_L1_error)
3703 __Pyx_GOTREF(__pyx_t_8);
3704 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3705 __pyx_t_9 = __pyx_v_self->cpp.nzval;
3707 PyErr_SetString(PyExc_ValueError,
"Cannot create cython.array from NULL pointer");
3708 __PYX_ERR(1, 133, __pyx_L1_error)
3710 __pyx_t_10 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_double);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 133, __pyx_L1_error)
3711 __Pyx_GOTREF(__pyx_t_10);
3712 __pyx_t_6 = Py_BuildValue((
char*)
"(" __PYX_BUILD_PY_SSIZE_T
")", ((Py_ssize_t)__pyx_v_self->cpp.nnz));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 133, __pyx_L1_error)
3713 __Pyx_GOTREF(__pyx_t_6);
3714 __pyx_t_5 = __pyx_array_new(__pyx_t_6,
sizeof(
double), PyBytes_AS_STRING(__pyx_t_10), (
char *)
"c", (
char *) __pyx_t_9);
3715 if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 133, __pyx_L1_error)
3716 __Pyx_GOTREF(__pyx_t_5);
3717 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3718 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3720 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
3721 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
3722 if (likely(__pyx_t_10)) {
3723 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_8);
3724 __Pyx_INCREF(__pyx_t_10);
3725 __Pyx_INCREF(
function);
3726 __Pyx_DECREF_SET(__pyx_t_8,
function);
3729 __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, ((PyObject *)__pyx_t_5)) : __Pyx_PyObject_CallOneArg(__pyx_t_8, ((PyObject *)__pyx_t_5));
3730 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3731 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
3732 if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 133, __pyx_L1_error)
3733 __Pyx_GOTREF(__pyx_t_7);
3734 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3743 __pyx_t_8 = PyTuple_New(4);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 130, __pyx_L1_error)
3744 __Pyx_GOTREF(__pyx_t_8);
3745 __Pyx_GIVEREF(__pyx_t_1);
3746 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
3747 __Pyx_GIVEREF(__pyx_t_3);
3748 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
3749 __Pyx_GIVEREF(__pyx_t_2);
3750 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_2);
3751 __Pyx_GIVEREF(__pyx_t_7);
3752 PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_7);
3757 __pyx_r = __pyx_t_8;
3771 __Pyx_XDECREF(__pyx_t_1);
3772 __Pyx_XDECREF(__pyx_t_2);
3773 __Pyx_XDECREF(__pyx_t_3);
3774 __Pyx_XDECREF(((PyObject *)__pyx_t_5));
3775 __Pyx_XDECREF(__pyx_t_6);
3776 __Pyx_XDECREF(__pyx_t_7);
3777 __Pyx_XDECREF(__pyx_t_8);
3778 __Pyx_XDECREF(__pyx_t_10);
3779 __Pyx_AddTraceback(
"csparsity.PySparsityInfo.getCSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
3782 __Pyx_XGIVEREF(__pyx_r);
3783 __Pyx_RefNannyFinishContext();
3794 static PyObject *__pyx_pw_9csparsity_14PySparsityInfo_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
3795 static PyObject *__pyx_pw_9csparsity_14PySparsityInfo_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3796 PyObject *__pyx_r = 0;
3797 __Pyx_RefNannyDeclarations
3798 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
3799 __pyx_r = __pyx_pf_9csparsity_14PySparsityInfo_10__reduce_cython__(((
struct __pyx_obj_9csparsity_PySparsityInfo *)__pyx_v_self));
3802 __Pyx_RefNannyFinishContext();
3806 static PyObject *__pyx_pf_9csparsity_14PySparsityInfo_10__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self) {
3807 PyObject *__pyx_r = NULL;
3808 __Pyx_RefNannyDeclarations
3809 PyObject *__pyx_t_1 = NULL;
3810 int __pyx_lineno = 0;
3811 const char *__pyx_filename = NULL;
3812 int __pyx_clineno = 0;
3813 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
3821 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
3822 __Pyx_GOTREF(__pyx_t_1);
3823 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3824 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3825 __PYX_ERR(0, 2, __pyx_L1_error)
3835 __Pyx_XDECREF(__pyx_t_1);
3836 __Pyx_AddTraceback(
"csparsity.PySparsityInfo.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3838 __Pyx_XGIVEREF(__pyx_r);
3839 __Pyx_RefNannyFinishContext();
3851 static PyObject *__pyx_pw_9csparsity_14PySparsityInfo_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
3852 static PyObject *__pyx_pw_9csparsity_14PySparsityInfo_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3853 PyObject *__pyx_r = 0;
3854 __Pyx_RefNannyDeclarations
3855 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
3856 __pyx_r = __pyx_pf_9csparsity_14PySparsityInfo_12__setstate_cython__(((
struct __pyx_obj_9csparsity_PySparsityInfo *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3859 __Pyx_RefNannyFinishContext();
3863 static PyObject *__pyx_pf_9csparsity_14PySparsityInfo_12__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_9csparsity_PySparsityInfo *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
3864 PyObject *__pyx_r = NULL;
3865 __Pyx_RefNannyDeclarations
3866 PyObject *__pyx_t_1 = NULL;
3867 int __pyx_lineno = 0;
3868 const char *__pyx_filename = NULL;
3869 int __pyx_clineno = 0;
3870 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
3877 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
3878 __Pyx_GOTREF(__pyx_t_1);
3879 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3880 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3881 __PYX_ERR(0, 4, __pyx_L1_error)
3892 __Pyx_XDECREF(__pyx_t_1);
3893 __Pyx_AddTraceback(
"csparsity.PySparsityInfo.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3895 __Pyx_XGIVEREF(__pyx_r);
3896 __Pyx_RefNannyFinishContext();
3908 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
3909 PyObject *__pyx_r = NULL;
3910 __Pyx_RefNannyDeclarations
3911 PyObject *__pyx_t_1 = NULL;
3912 int __pyx_lineno = 0;
3913 const char *__pyx_filename = NULL;
3914 int __pyx_clineno = 0;
3915 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew1", 0);
3924 __Pyx_XDECREF(__pyx_r);
3925 __pyx_t_1 = PyArray_MultiIterNew(1, ((
void *)__pyx_v_a));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 736, __pyx_L1_error)
3926 __Pyx_GOTREF(__pyx_t_1);
3927 __pyx_r = __pyx_t_1;
3941 __Pyx_XDECREF(__pyx_t_1);
3942 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
3945 __Pyx_XGIVEREF(__pyx_r);
3946 __Pyx_RefNannyFinishContext();
3958 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
3959 PyObject *__pyx_r = NULL;
3960 __Pyx_RefNannyDeclarations
3961 PyObject *__pyx_t_1 = NULL;
3962 int __pyx_lineno = 0;
3963 const char *__pyx_filename = NULL;
3964 int __pyx_clineno = 0;
3965 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew2", 0);
3974 __Pyx_XDECREF(__pyx_r);
3975 __pyx_t_1 = PyArray_MultiIterNew(2, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 739, __pyx_L1_error)
3976 __Pyx_GOTREF(__pyx_t_1);
3977 __pyx_r = __pyx_t_1;
3991 __Pyx_XDECREF(__pyx_t_1);
3992 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
3995 __Pyx_XGIVEREF(__pyx_r);
3996 __Pyx_RefNannyFinishContext();
4008 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
4009 PyObject *__pyx_r = NULL;
4010 __Pyx_RefNannyDeclarations
4011 PyObject *__pyx_t_1 = NULL;
4012 int __pyx_lineno = 0;
4013 const char *__pyx_filename = NULL;
4014 int __pyx_clineno = 0;
4015 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew3", 0);
4024 __Pyx_XDECREF(__pyx_r);
4025 __pyx_t_1 = PyArray_MultiIterNew(3, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 742, __pyx_L1_error)
4026 __Pyx_GOTREF(__pyx_t_1);
4027 __pyx_r = __pyx_t_1;
4041 __Pyx_XDECREF(__pyx_t_1);
4042 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
4045 __Pyx_XGIVEREF(__pyx_r);
4046 __Pyx_RefNannyFinishContext();
4058 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) {
4059 PyObject *__pyx_r = NULL;
4060 __Pyx_RefNannyDeclarations
4061 PyObject *__pyx_t_1 = NULL;
4062 int __pyx_lineno = 0;
4063 const char *__pyx_filename = NULL;
4064 int __pyx_clineno = 0;
4065 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew4", 0);
4074 __Pyx_XDECREF(__pyx_r);
4075 __pyx_t_1 = PyArray_MultiIterNew(4, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c), ((
void *)__pyx_v_d));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 745, __pyx_L1_error)
4076 __Pyx_GOTREF(__pyx_t_1);
4077 __pyx_r = __pyx_t_1;
4091 __Pyx_XDECREF(__pyx_t_1);
4092 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
4095 __Pyx_XGIVEREF(__pyx_r);
4096 __Pyx_RefNannyFinishContext();
4108 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) {
4109 PyObject *__pyx_r = NULL;
4110 __Pyx_RefNannyDeclarations
4111 PyObject *__pyx_t_1 = NULL;
4112 int __pyx_lineno = 0;
4113 const char *__pyx_filename = NULL;
4114 int __pyx_clineno = 0;
4115 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew5", 0);
4124 __Pyx_XDECREF(__pyx_r);
4125 __pyx_t_1 = PyArray_MultiIterNew(5, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c), ((
void *)__pyx_v_d), ((
void *)__pyx_v_e));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 748, __pyx_L1_error)
4126 __Pyx_GOTREF(__pyx_t_1);
4127 __pyx_r = __pyx_t_1;
4141 __Pyx_XDECREF(__pyx_t_1);
4142 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
4145 __Pyx_XGIVEREF(__pyx_r);
4146 __Pyx_RefNannyFinishContext();
4158 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
4159 PyObject *__pyx_r = NULL;
4160 __Pyx_RefNannyDeclarations
4162 __Pyx_RefNannySetupContext(
"PyDataType_SHAPE", 0);
4171 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
4181 __Pyx_XDECREF(__pyx_r);
4182 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
4183 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
4203 __Pyx_XDECREF(__pyx_r);
4204 __Pyx_INCREF(__pyx_empty_tuple);
4205 __pyx_r = __pyx_empty_tuple;
4219 __Pyx_XGIVEREF(__pyx_r);
4220 __Pyx_RefNannyFinishContext();
4232 static CYTHON_INLINE
void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
4233 __Pyx_RefNannyDeclarations
4234 __Pyx_RefNannySetupContext(
"set_array_base", 0);
4243 Py_INCREF(__pyx_v_base);
4252 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
4263 __Pyx_RefNannyFinishContext();
4274 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
4275 PyObject *__pyx_v_base;
4276 PyObject *__pyx_r = NULL;
4277 __Pyx_RefNannyDeclarations
4279 __Pyx_RefNannySetupContext(
"get_array_base", 0);
4288 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
4297 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
4307 __Pyx_XDECREF(__pyx_r);
4308 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4327 __Pyx_XDECREF(__pyx_r);
4328 __Pyx_INCREF(((PyObject *)__pyx_v_base));
4329 __pyx_r = ((PyObject *)__pyx_v_base);
4342 __Pyx_XGIVEREF(__pyx_r);
4343 __Pyx_RefNannyFinishContext();
4355 static CYTHON_INLINE
int __pyx_f_5numpy_import_array(
void) {
4357 __Pyx_RefNannyDeclarations
4358 PyObject *__pyx_t_1 = NULL;
4359 PyObject *__pyx_t_2 = NULL;
4360 PyObject *__pyx_t_3 = NULL;
4362 PyObject *__pyx_t_5 = NULL;
4363 PyObject *__pyx_t_6 = NULL;
4364 PyObject *__pyx_t_7 = NULL;
4365 PyObject *__pyx_t_8 = NULL;
4366 int __pyx_lineno = 0;
4367 const char *__pyx_filename = NULL;
4368 int __pyx_clineno = 0;
4369 __Pyx_RefNannySetupContext(
"import_array", 0);
4379 __Pyx_PyThreadState_declare
4380 __Pyx_PyThreadState_assign
4381 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4382 __Pyx_XGOTREF(__pyx_t_1);
4383 __Pyx_XGOTREF(__pyx_t_2);
4384 __Pyx_XGOTREF(__pyx_t_3);
4394 __pyx_t_4 = _import_array();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 943, __pyx_L3_error)
4404 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4405 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4406 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4407 goto __pyx_L8_try_end;
4417 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4419 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
4420 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 944, __pyx_L5_except_error)
4421 __Pyx_GOTREF(__pyx_t_5);
4422 __Pyx_GOTREF(__pyx_t_6);
4423 __Pyx_GOTREF(__pyx_t_7);
4432 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 945, __pyx_L5_except_error)
4433 __Pyx_GOTREF(__pyx_t_8);
4434 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
4435 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4436 __PYX_ERR(2, 945, __pyx_L5_except_error)
4438 goto __pyx_L5_except_error;
4439 __pyx_L5_except_error:;
4448 __Pyx_XGIVEREF(__pyx_t_1);
4449 __Pyx_XGIVEREF(__pyx_t_2);
4450 __Pyx_XGIVEREF(__pyx_t_3);
4451 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4452 goto __pyx_L1_error;
4468 __Pyx_XDECREF(__pyx_t_5);
4469 __Pyx_XDECREF(__pyx_t_6);
4470 __Pyx_XDECREF(__pyx_t_7);
4471 __Pyx_XDECREF(__pyx_t_8);
4472 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
4475 __Pyx_RefNannyFinishContext();
4487 static CYTHON_INLINE
int __pyx_f_5numpy_import_umath(
void) {
4489 __Pyx_RefNannyDeclarations
4490 PyObject *__pyx_t_1 = NULL;
4491 PyObject *__pyx_t_2 = NULL;
4492 PyObject *__pyx_t_3 = NULL;
4494 PyObject *__pyx_t_5 = NULL;
4495 PyObject *__pyx_t_6 = NULL;
4496 PyObject *__pyx_t_7 = NULL;
4497 PyObject *__pyx_t_8 = NULL;
4498 int __pyx_lineno = 0;
4499 const char *__pyx_filename = NULL;
4500 int __pyx_clineno = 0;
4501 __Pyx_RefNannySetupContext(
"import_umath", 0);
4511 __Pyx_PyThreadState_declare
4512 __Pyx_PyThreadState_assign
4513 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4514 __Pyx_XGOTREF(__pyx_t_1);
4515 __Pyx_XGOTREF(__pyx_t_2);
4516 __Pyx_XGOTREF(__pyx_t_3);
4526 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 949, __pyx_L3_error)
4536 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4537 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4538 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4539 goto __pyx_L8_try_end;
4549 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4551 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
4552 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 950, __pyx_L5_except_error)
4553 __Pyx_GOTREF(__pyx_t_5);
4554 __Pyx_GOTREF(__pyx_t_6);
4555 __Pyx_GOTREF(__pyx_t_7);
4564 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__4, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 951, __pyx_L5_except_error)
4565 __Pyx_GOTREF(__pyx_t_8);
4566 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
4567 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4568 __PYX_ERR(2, 951, __pyx_L5_except_error)
4570 goto __pyx_L5_except_error;
4571 __pyx_L5_except_error:;
4580 __Pyx_XGIVEREF(__pyx_t_1);
4581 __Pyx_XGIVEREF(__pyx_t_2);
4582 __Pyx_XGIVEREF(__pyx_t_3);
4583 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4584 goto __pyx_L1_error;
4600 __Pyx_XDECREF(__pyx_t_5);
4601 __Pyx_XDECREF(__pyx_t_6);
4602 __Pyx_XDECREF(__pyx_t_7);
4603 __Pyx_XDECREF(__pyx_t_8);
4604 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
4607 __Pyx_RefNannyFinishContext();
4619 static CYTHON_INLINE
int __pyx_f_5numpy_import_ufunc(
void) {
4621 __Pyx_RefNannyDeclarations
4622 PyObject *__pyx_t_1 = NULL;
4623 PyObject *__pyx_t_2 = NULL;
4624 PyObject *__pyx_t_3 = NULL;
4626 PyObject *__pyx_t_5 = NULL;
4627 PyObject *__pyx_t_6 = NULL;
4628 PyObject *__pyx_t_7 = NULL;
4629 PyObject *__pyx_t_8 = NULL;
4630 int __pyx_lineno = 0;
4631 const char *__pyx_filename = NULL;
4632 int __pyx_clineno = 0;
4633 __Pyx_RefNannySetupContext(
"import_ufunc", 0);
4643 __Pyx_PyThreadState_declare
4644 __Pyx_PyThreadState_assign
4645 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4646 __Pyx_XGOTREF(__pyx_t_1);
4647 __Pyx_XGOTREF(__pyx_t_2);
4648 __Pyx_XGOTREF(__pyx_t_3);
4658 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 955, __pyx_L3_error)
4668 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4669 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4670 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4671 goto __pyx_L8_try_end;
4681 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4683 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
4684 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 956, __pyx_L5_except_error)
4685 __Pyx_GOTREF(__pyx_t_5);
4686 __Pyx_GOTREF(__pyx_t_6);
4687 __Pyx_GOTREF(__pyx_t_7);
4696 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__4, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 957, __pyx_L5_except_error)
4697 __Pyx_GOTREF(__pyx_t_8);
4698 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
4699 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4700 __PYX_ERR(2, 957, __pyx_L5_except_error)
4702 goto __pyx_L5_except_error;
4703 __pyx_L5_except_error:;
4712 __Pyx_XGIVEREF(__pyx_t_1);
4713 __Pyx_XGIVEREF(__pyx_t_2);
4714 __Pyx_XGIVEREF(__pyx_t_3);
4715 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4716 goto __pyx_L1_error;
4732 __Pyx_XDECREF(__pyx_t_5);
4733 __Pyx_XDECREF(__pyx_t_6);
4734 __Pyx_XDECREF(__pyx_t_7);
4735 __Pyx_XDECREF(__pyx_t_8);
4736 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
4739 __Pyx_RefNannyFinishContext();
4751 static CYTHON_INLINE
int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
4753 __Pyx_RefNannyDeclarations
4754 __Pyx_RefNannySetupContext(
"is_timedelta64_object", 0);
4763 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
4776 __Pyx_RefNannyFinishContext();
4788 static CYTHON_INLINE
int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
4790 __Pyx_RefNannyDeclarations
4791 __Pyx_RefNannySetupContext(
"is_datetime64_object", 0);
4800 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
4813 __Pyx_RefNannyFinishContext();
4825 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
4826 npy_datetime __pyx_r;
4835 __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
4859 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
4860 npy_timedelta __pyx_r;
4869 __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
4893 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
4894 NPY_DATETIMEUNIT __pyx_r;
4901 __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
4926 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4927 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4928 PyObject *__pyx_v_shape = 0;
4929 Py_ssize_t __pyx_v_itemsize;
4930 PyObject *__pyx_v_format = 0;
4931 PyObject *__pyx_v_mode = 0;
4932 int __pyx_v_allocate_buffer;
4933 int __pyx_lineno = 0;
4934 const char *__pyx_filename = NULL;
4935 int __pyx_clineno = 0;
4937 __Pyx_RefNannyDeclarations
4938 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
4940 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};
4941 PyObject* values[5] = {0,0,0,0,0};
4942 values[3] = ((PyObject *)__pyx_n_s_c);
4943 if (unlikely(__pyx_kwds)) {
4945 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4947 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4949 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4951 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4953 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4955 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4958 default:
goto __pyx_L5_argtuple_error;
4960 kw_args = PyDict_Size(__pyx_kwds);
4963 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
4964 else goto __pyx_L5_argtuple_error;
4967 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
4969 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 1); __PYX_ERR(0, 122, __pyx_L3_error)
4973 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
4975 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 2); __PYX_ERR(0, 122, __pyx_L3_error)
4980 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
4981 if (value) { values[3] = value; kw_args--; }
4986 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
4987 if (value) { values[4] = value; kw_args--; }
4990 if (unlikely(kw_args > 0)) {
4991 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(0, 122, __pyx_L3_error)
4994 switch (PyTuple_GET_SIZE(__pyx_args)) {
4995 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4997 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4999 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5000 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5001 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5003 default:
goto __pyx_L5_argtuple_error;
5006 __pyx_v_shape = ((PyObject*)values[0]);
5007 __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]);
if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L3_error)
5008 __pyx_v_format = values[2];
5009 __pyx_v_mode = values[3];
5011 __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]);
if (unlikely((__pyx_v_allocate_buffer == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L3_error)
5021 __pyx_v_allocate_buffer = ((int)1);
5024 goto __pyx_L4_argument_unpacking_done;
5025 __pyx_L5_argtuple_error:;
5026 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 122, __pyx_L3_error)
5028 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5029 __Pyx_RefNannyFinishContext();
5031 __pyx_L4_argument_unpacking_done:;
5032 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1,
"shape", 1))) __PYX_ERR(0, 122, __pyx_L1_error)
5033 if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
5034 PyErr_Format(PyExc_TypeError,
"Argument '%.200s' must not be None",
"format"); __PYX_ERR(0, 122, __pyx_L1_error)
5036 __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);
5051 __Pyx_RefNannyFinishContext();
5055 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) {
5057 Py_ssize_t __pyx_v_i;
5058 Py_ssize_t __pyx_v_dim;
5059 PyObject **__pyx_v_p;
5062 __Pyx_RefNannyDeclarations
5063 Py_ssize_t __pyx_t_1;
5065 PyObject *__pyx_t_3 = NULL;
5067 PyObject *__pyx_t_5 = NULL;
5068 PyObject *__pyx_t_6 = NULL;
5071 Py_ssize_t __pyx_t_9;
5072 PyObject *__pyx_t_10 = NULL;
5073 Py_ssize_t __pyx_t_11;
5074 int __pyx_lineno = 0;
5075 const char *__pyx_filename = NULL;
5076 int __pyx_clineno = 0;
5077 __Pyx_RefNannySetupContext(
"__cinit__", 0);
5078 __Pyx_INCREF(__pyx_v_format);
5087 if (unlikely(__pyx_v_shape == Py_None)) {
5088 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
5089 __PYX_ERR(0, 129, __pyx_L1_error)
5091 __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape);
if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 129, __pyx_L1_error)
5092 __pyx_v_self->ndim = ((int)__pyx_t_1);
5101 __pyx_v_self->itemsize = __pyx_v_itemsize;
5110 __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
5111 if (unlikely(__pyx_t_2)) {
5120 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error)
5121 __Pyx_GOTREF(__pyx_t_3);
5122 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5123 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5124 __PYX_ERR(0, 133, __pyx_L1_error)
5142 __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
5143 if (unlikely(__pyx_t_2)) {
5152 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error)
5153 __Pyx_GOTREF(__pyx_t_3);
5154 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5155 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5156 __PYX_ERR(0, 136, __pyx_L1_error)
5174 __pyx_t_2 = PyBytes_Check(__pyx_v_format);
5175 __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
5185 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 139, __pyx_L1_error)
5186 __Pyx_GOTREF(__pyx_t_5);
5188 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5189 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5190 if (likely(__pyx_t_6)) {
5191 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
5192 __Pyx_INCREF(__pyx_t_6);
5193 __Pyx_INCREF(
function);
5194 __Pyx_DECREF_SET(__pyx_t_5,
function);
5197 __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);
5198 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5199 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
5200 __Pyx_GOTREF(__pyx_t_3);
5201 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5202 __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
5221 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(0, 140, __pyx_L1_error)
5222 __pyx_t_3 = __pyx_v_format;
5223 __Pyx_INCREF(__pyx_t_3);
5224 __Pyx_GIVEREF(__pyx_t_3);
5225 __Pyx_GOTREF(__pyx_v_self->_format);
5226 __Pyx_DECREF(__pyx_v_self->_format);
5227 __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
5237 if (unlikely(__pyx_v_self->_format == Py_None)) {
5238 PyErr_SetString(PyExc_TypeError,
"expected bytes, NoneType found");
5239 __PYX_ERR(0, 141, __pyx_L1_error)
5241 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format);
if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error)
5242 __pyx_v_self->format = __pyx_t_7;
5251 __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((
sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
5260 __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
5269 __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
5270 if (unlikely(__pyx_t_4)) {
5279 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__7, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
5280 __Pyx_GOTREF(__pyx_t_3);
5281 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5282 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5283 __PYX_ERR(0, 148, __pyx_L1_error)
5302 __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
5304 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
5305 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5306 __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(0, 151, __pyx_L1_error)
5308 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 151, __pyx_L1_error)
5309 __Pyx_GOTREF(__pyx_t_5);
5311 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error)
5312 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5313 __pyx_v_dim = __pyx_t_9;
5314 __pyx_v_idx = __pyx_t_8;
5315 __pyx_t_8 = (__pyx_t_8 + 1);
5324 __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
5325 if (unlikely(__pyx_t_4)) {
5334 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 153, __pyx_L1_error)
5335 __Pyx_GOTREF(__pyx_t_5);
5336 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 153, __pyx_L1_error)
5337 __Pyx_GOTREF(__pyx_t_6);
5338 __pyx_t_10 = PyTuple_New(2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 153, __pyx_L1_error)
5339 __Pyx_GOTREF(__pyx_t_10);
5340 __Pyx_GIVEREF(__pyx_t_5);
5341 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
5342 __Pyx_GIVEREF(__pyx_t_6);
5343 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
5346 __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(0, 153, __pyx_L1_error)
5347 __Pyx_GOTREF(__pyx_t_6);
5348 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5349 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 153, __pyx_L1_error)
5350 __Pyx_GOTREF(__pyx_t_10);
5351 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5352 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
5353 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5354 __PYX_ERR(0, 153, __pyx_L1_error)
5372 (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
5382 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5391 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 157, __pyx_L1_error)
5401 __pyx_v_order =
'F';
5410 __Pyx_INCREF(__pyx_n_u_fortran);
5411 __Pyx_GIVEREF(__pyx_n_u_fortran);
5412 __Pyx_GOTREF(__pyx_v_self->mode);
5413 __Pyx_DECREF(__pyx_v_self->mode);
5414 __pyx_v_self->mode = __pyx_n_u_fortran;
5433 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 160, __pyx_L1_error)
5434 if (likely(__pyx_t_4)) {
5443 __pyx_v_order =
'C';
5452 __Pyx_INCREF(__pyx_n_u_c);
5453 __Pyx_GIVEREF(__pyx_n_u_c);
5454 __Pyx_GOTREF(__pyx_v_self->mode);
5455 __Pyx_DECREF(__pyx_v_self->mode);
5456 __pyx_v_self->mode = __pyx_n_u_c;
5476 __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(0, 164, __pyx_L1_error)
5477 __Pyx_GOTREF(__pyx_t_3);
5478 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 164, __pyx_L1_error)
5479 __Pyx_GOTREF(__pyx_t_10);
5480 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5481 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
5482 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5483 __PYX_ERR(0, 164, __pyx_L1_error)
5494 __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);
5503 __pyx_v_self->free_data = __pyx_v_allocate_buffer;
5512 __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(0, 170, __pyx_L1_error)
5513 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L1_error)
5514 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5515 __pyx_v_self->dtype_is_object = __pyx_t_4;
5524 __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
5534 __pyx_v_self->data = ((
char *)malloc(__pyx_v_self->len));
5543 __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
5544 if (unlikely(__pyx_t_4)) {
5553 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__8, NULL);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 176, __pyx_L1_error)
5554 __Pyx_GOTREF(__pyx_t_10);
5555 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
5556 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5557 __PYX_ERR(0, 176, __pyx_L1_error)
5575 __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
5585 __pyx_v_p = ((PyObject **)__pyx_v_self->data);
5594 if (unlikely(__pyx_v_itemsize == 0)) {
5595 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
5596 __PYX_ERR(0, 180, __pyx_L1_error)
5598 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))) {
5599 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
5600 __PYX_ERR(0, 180, __pyx_L1_error)
5602 __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
5603 __pyx_t_9 = __pyx_t_1;
5604 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
5605 __pyx_v_i = __pyx_t_11;
5614 (__pyx_v_p[__pyx_v_i]) = Py_None;
5656 __Pyx_XDECREF(__pyx_t_3);
5657 __Pyx_XDECREF(__pyx_t_5);
5658 __Pyx_XDECREF(__pyx_t_6);
5659 __Pyx_XDECREF(__pyx_t_10);
5660 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5663 __Pyx_XDECREF(__pyx_v_format);
5664 __Pyx_RefNannyFinishContext();
5677 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
5678 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
5680 __Pyx_RefNannyDeclarations
5681 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
5682 __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));
5685 __Pyx_RefNannyFinishContext();
5689 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) {
5690 int __pyx_v_bufmode;
5692 __Pyx_RefNannyDeclarations
5695 PyObject *__pyx_t_3 = NULL;
5697 Py_ssize_t __pyx_t_5;
5699 Py_ssize_t *__pyx_t_7;
5700 int __pyx_lineno = 0;
5701 const char *__pyx_filename = NULL;
5702 int __pyx_clineno = 0;
5703 if (__pyx_v_info == NULL) {
5704 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
5707 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
5708 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
5709 __Pyx_GIVEREF(__pyx_v_info->obj);
5718 __pyx_v_bufmode = -1;
5727 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 187, __pyx_L1_error)
5728 __pyx_t_2 = (__pyx_t_1 != 0);
5738 __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
5757 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ));
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 189, __pyx_L1_error)
5758 __pyx_t_1 = (__pyx_t_2 != 0);
5768 __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
5787 __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
5788 if (unlikely(__pyx_t_1)) {
5797 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
5798 __Pyx_GOTREF(__pyx_t_3);
5799 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5800 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5801 __PYX_ERR(0, 192, __pyx_L1_error)
5819 __pyx_t_4 = __pyx_v_self->data;
5820 __pyx_v_info->buf = __pyx_t_4;
5829 __pyx_t_5 = __pyx_v_self->len;
5830 __pyx_v_info->len = __pyx_t_5;
5839 __pyx_t_6 = __pyx_v_self->ndim;
5840 __pyx_v_info->ndim = __pyx_t_6;
5849 __pyx_t_7 = __pyx_v_self->_shape;
5850 __pyx_v_info->shape = __pyx_t_7;
5859 __pyx_t_7 = __pyx_v_self->_strides;
5860 __pyx_v_info->strides = __pyx_t_7;
5869 __pyx_v_info->suboffsets = NULL;
5878 __pyx_t_5 = __pyx_v_self->itemsize;
5879 __pyx_v_info->itemsize = __pyx_t_5;
5888 __pyx_v_info->readonly = 0;
5897 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
5907 __pyx_t_4 = __pyx_v_self->format;
5908 __pyx_v_info->format = __pyx_t_4;
5928 __pyx_v_info->format = NULL;
5939 __Pyx_INCREF(((PyObject *)__pyx_v_self));
5940 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
5941 __Pyx_GOTREF(__pyx_v_info->obj);
5942 __Pyx_DECREF(__pyx_v_info->obj);
5943 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
5957 __Pyx_XDECREF(__pyx_t_3);
5958 __Pyx_AddTraceback(
"View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5960 if (__pyx_v_info->obj != NULL) {
5961 __Pyx_GOTREF(__pyx_v_info->obj);
5962 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
5966 if (__pyx_v_info->obj == Py_None) {
5967 __Pyx_GOTREF(__pyx_v_info->obj);
5968 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
5971 __Pyx_RefNannyFinishContext();
5984 static void __pyx_array___dealloc__(PyObject *__pyx_v_self);
5985 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
5986 __Pyx_RefNannyDeclarations
5987 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
5988 __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((
struct __pyx_array_obj *)__pyx_v_self));
5991 __Pyx_RefNannyFinishContext();
5994 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self) {
5995 __Pyx_RefNannyDeclarations
5997 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
6006 __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
6016 __pyx_v_self->callback_free_data(__pyx_v_self->data);
6035 __pyx_t_1 = (__pyx_v_self->free_data != 0);
6045 __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
6055 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
6073 free(__pyx_v_self->data);
6092 PyObject_Free(__pyx_v_self->_shape);
6103 __Pyx_RefNannyFinishContext();
6115 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self);
6116 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
6117 PyObject *__pyx_r = 0;
6118 __Pyx_RefNannyDeclarations
6119 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
6120 __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((
struct __pyx_array_obj *)__pyx_v_self));
6123 __Pyx_RefNannyFinishContext();
6127 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self) {
6128 PyObject *__pyx_r = NULL;
6129 __Pyx_RefNannyDeclarations
6130 PyObject *__pyx_t_1 = NULL;
6131 int __pyx_lineno = 0;
6132 const char *__pyx_filename = NULL;
6133 int __pyx_clineno = 0;
6134 __Pyx_RefNannySetupContext(
"__get__", 0);
6143 __Pyx_XDECREF(__pyx_r);
6144 __pyx_t_1 = ((
struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
6145 __Pyx_GOTREF(__pyx_t_1);
6146 __pyx_r = __pyx_t_1;
6160 __Pyx_XDECREF(__pyx_t_1);
6161 __Pyx_AddTraceback(
"View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6164 __Pyx_XGIVEREF(__pyx_r);
6165 __Pyx_RefNannyFinishContext();
6177 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self) {
6179 PyObject *__pyx_r = NULL;
6180 __Pyx_RefNannyDeclarations
6181 PyObject *__pyx_t_1 = NULL;
6182 PyObject *__pyx_t_2 = NULL;
6183 PyObject *__pyx_t_3 = NULL;
6184 int __pyx_lineno = 0;
6185 const char *__pyx_filename = NULL;
6186 int __pyx_clineno = 0;
6187 __Pyx_RefNannySetupContext(
"get_memview", 0);
6196 __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
6205 __Pyx_XDECREF(__pyx_r);
6206 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
6207 __Pyx_GOTREF(__pyx_t_1);
6208 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error)
6209 __Pyx_GOTREF(__pyx_t_2);
6210 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error)
6211 __Pyx_GOTREF(__pyx_t_3);
6212 __Pyx_INCREF(((PyObject *)__pyx_v_self));
6213 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
6214 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
6215 __Pyx_GIVEREF(__pyx_t_1);
6216 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
6217 __Pyx_GIVEREF(__pyx_t_2);
6218 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
6221 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error)
6222 __Pyx_GOTREF(__pyx_t_2);
6223 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6224 __pyx_r = __pyx_t_2;
6238 __Pyx_XDECREF(__pyx_t_1);
6239 __Pyx_XDECREF(__pyx_t_2);
6240 __Pyx_XDECREF(__pyx_t_3);
6241 __Pyx_AddTraceback(
"View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
6244 __Pyx_XGIVEREF(__pyx_r);
6245 __Pyx_RefNannyFinishContext();
6258 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self);
6259 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
6261 __Pyx_RefNannyDeclarations
6262 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
6263 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((
struct __pyx_array_obj *)__pyx_v_self));
6266 __Pyx_RefNannyFinishContext();
6270 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self) {
6272 __Pyx_RefNannyDeclarations
6273 __Pyx_RefNannySetupContext(
"__len__", 0);
6282 __pyx_r = (__pyx_v_self->_shape[0]);
6295 __Pyx_RefNannyFinishContext();
6308 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr);
6309 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
6310 PyObject *__pyx_r = 0;
6311 __Pyx_RefNannyDeclarations
6312 __Pyx_RefNannySetupContext(
"__getattr__ (wrapper)", 0);
6313 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
6316 __Pyx_RefNannyFinishContext();
6320 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
6321 PyObject *__pyx_r = NULL;
6322 __Pyx_RefNannyDeclarations
6323 PyObject *__pyx_t_1 = NULL;
6324 PyObject *__pyx_t_2 = NULL;
6325 int __pyx_lineno = 0;
6326 const char *__pyx_filename = NULL;
6327 int __pyx_clineno = 0;
6328 __Pyx_RefNannySetupContext(
"__getattr__", 0);
6337 __Pyx_XDECREF(__pyx_r);
6338 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
6339 __Pyx_GOTREF(__pyx_t_1);
6340 __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error)
6341 __Pyx_GOTREF(__pyx_t_2);
6342 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6343 __pyx_r = __pyx_t_2;
6357 __Pyx_XDECREF(__pyx_t_1);
6358 __Pyx_XDECREF(__pyx_t_2);
6359 __Pyx_AddTraceback(
"View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6362 __Pyx_XGIVEREF(__pyx_r);
6363 __Pyx_RefNannyFinishContext();
6376 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item);
6377 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
6378 PyObject *__pyx_r = 0;
6379 __Pyx_RefNannyDeclarations
6380 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
6381 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
6384 __Pyx_RefNannyFinishContext();
6388 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
6389 PyObject *__pyx_r = NULL;
6390 __Pyx_RefNannyDeclarations
6391 PyObject *__pyx_t_1 = NULL;
6392 PyObject *__pyx_t_2 = NULL;
6393 int __pyx_lineno = 0;
6394 const char *__pyx_filename = NULL;
6395 int __pyx_clineno = 0;
6396 __Pyx_RefNannySetupContext(
"__getitem__", 0);
6405 __Pyx_XDECREF(__pyx_r);
6406 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error)
6407 __Pyx_GOTREF(__pyx_t_1);
6408 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
6409 __Pyx_GOTREF(__pyx_t_2);
6410 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6411 __pyx_r = __pyx_t_2;
6425 __Pyx_XDECREF(__pyx_t_1);
6426 __Pyx_XDECREF(__pyx_t_2);
6427 __Pyx_AddTraceback(
"View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6430 __Pyx_XGIVEREF(__pyx_r);
6431 __Pyx_RefNannyFinishContext();
6444 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
6445 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
6447 __Pyx_RefNannyDeclarations
6448 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
6449 __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));
6452 __Pyx_RefNannyFinishContext();
6456 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) {
6458 __Pyx_RefNannyDeclarations
6459 PyObject *__pyx_t_1 = NULL;
6460 int __pyx_lineno = 0;
6461 const char *__pyx_filename = NULL;
6462 int __pyx_clineno = 0;
6463 __Pyx_RefNannySetupContext(
"__setitem__", 0);
6472 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error)
6473 __Pyx_GOTREF(__pyx_t_1);
6474 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(0, 240, __pyx_L1_error)
6475 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6489 __Pyx_XDECREF(__pyx_t_1);
6490 __Pyx_AddTraceback(
"View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6493 __Pyx_RefNannyFinishContext();
6504 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
6505 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6506 PyObject *__pyx_r = 0;
6507 __Pyx_RefNannyDeclarations
6508 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
6509 __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((
struct __pyx_array_obj *)__pyx_v_self));
6512 __Pyx_RefNannyFinishContext();
6516 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self) {
6517 PyObject *__pyx_r = NULL;
6518 __Pyx_RefNannyDeclarations
6519 PyObject *__pyx_t_1 = NULL;
6520 int __pyx_lineno = 0;
6521 const char *__pyx_filename = NULL;
6522 int __pyx_clineno = 0;
6523 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
6531 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
6532 __Pyx_GOTREF(__pyx_t_1);
6533 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6534 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6535 __PYX_ERR(0, 2, __pyx_L1_error)
6545 __Pyx_XDECREF(__pyx_t_1);
6546 __Pyx_AddTraceback(
"View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6548 __Pyx_XGIVEREF(__pyx_r);
6549 __Pyx_RefNannyFinishContext();
6561 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
6562 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
6563 PyObject *__pyx_r = 0;
6564 __Pyx_RefNannyDeclarations
6565 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
6566 __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
6569 __Pyx_RefNannyFinishContext();
6573 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) {
6574 PyObject *__pyx_r = NULL;
6575 __Pyx_RefNannyDeclarations
6576 PyObject *__pyx_t_1 = NULL;
6577 int __pyx_lineno = 0;
6578 const char *__pyx_filename = NULL;
6579 int __pyx_clineno = 0;
6580 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
6587 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
6588 __Pyx_GOTREF(__pyx_t_1);
6589 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6590 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6591 __PYX_ERR(0, 4, __pyx_L1_error)
6602 __Pyx_XDECREF(__pyx_t_1);
6603 __Pyx_AddTraceback(
"View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6605 __Pyx_XGIVEREF(__pyx_r);
6606 __Pyx_RefNannyFinishContext();
6618 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) {
6619 struct __pyx_array_obj *__pyx_v_result = 0;
6620 struct __pyx_array_obj *__pyx_r = NULL;
6621 __Pyx_RefNannyDeclarations
6623 PyObject *__pyx_t_2 = NULL;
6624 PyObject *__pyx_t_3 = NULL;
6625 PyObject *__pyx_t_4 = NULL;
6626 PyObject *__pyx_t_5 = NULL;
6627 int __pyx_lineno = 0;
6628 const char *__pyx_filename = NULL;
6629 int __pyx_clineno = 0;
6630 __Pyx_RefNannySetupContext(
"array_cwrapper", 0);
6639 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
6649 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error)
6650 __Pyx_GOTREF(__pyx_t_2);
6651 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error)
6652 __Pyx_GOTREF(__pyx_t_3);
6653 __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(0, 249, __pyx_L1_error)
6654 __Pyx_GOTREF(__pyx_t_4);
6655 __pyx_t_5 = PyTuple_New(4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 249, __pyx_L1_error)
6656 __Pyx_GOTREF(__pyx_t_5);
6657 __Pyx_INCREF(__pyx_v_shape);
6658 __Pyx_GIVEREF(__pyx_v_shape);
6659 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
6660 __Pyx_GIVEREF(__pyx_t_2);
6661 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
6662 __Pyx_GIVEREF(__pyx_t_3);
6663 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
6664 __Pyx_GIVEREF(__pyx_t_4);
6665 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
6669 __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error)
6670 __Pyx_GOTREF(__pyx_t_4);
6671 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6672 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_4);
6693 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
6694 __Pyx_GOTREF(__pyx_t_4);
6695 __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 251, __pyx_L1_error)
6696 __Pyx_GOTREF(__pyx_t_5);
6697 __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(0, 251, __pyx_L1_error)
6698 __Pyx_GOTREF(__pyx_t_3);
6699 __pyx_t_2 = PyTuple_New(4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
6700 __Pyx_GOTREF(__pyx_t_2);
6701 __Pyx_INCREF(__pyx_v_shape);
6702 __Pyx_GIVEREF(__pyx_v_shape);
6703 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
6704 __Pyx_GIVEREF(__pyx_t_4);
6705 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
6706 __Pyx_GIVEREF(__pyx_t_5);
6707 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
6708 __Pyx_GIVEREF(__pyx_t_3);
6709 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
6721 __pyx_t_3 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 252, __pyx_L1_error)
6722 __Pyx_GOTREF(__pyx_t_3);
6723 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(0, 252, __pyx_L1_error)
6732 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 251, __pyx_L1_error)
6733 __Pyx_GOTREF(__pyx_t_5);
6734 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6735 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6736 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_5);
6746 __pyx_v_result->data = __pyx_v_buf;
6757 __Pyx_XDECREF(((PyObject *)__pyx_r));
6758 __Pyx_INCREF(((PyObject *)__pyx_v_result));
6759 __pyx_r = __pyx_v_result;
6772 __Pyx_XDECREF(__pyx_t_2);
6773 __Pyx_XDECREF(__pyx_t_3);
6774 __Pyx_XDECREF(__pyx_t_4);
6775 __Pyx_XDECREF(__pyx_t_5);
6776 __Pyx_AddTraceback(
"View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
6779 __Pyx_XDECREF((PyObject *)__pyx_v_result);
6780 __Pyx_XGIVEREF((PyObject *)__pyx_r);
6781 __Pyx_RefNannyFinishContext();
6794 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
6795 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6796 PyObject *__pyx_v_name = 0;
6797 int __pyx_lineno = 0;
6798 const char *__pyx_filename = NULL;
6799 int __pyx_clineno = 0;
6801 __Pyx_RefNannyDeclarations
6802 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
6804 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
6805 PyObject* values[1] = {0};
6806 if (unlikely(__pyx_kwds)) {
6808 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6810 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6813 default:
goto __pyx_L5_argtuple_error;
6815 kw_args = PyDict_Size(__pyx_kwds);
6818 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
6819 else goto __pyx_L5_argtuple_error;
6821 if (unlikely(kw_args > 0)) {
6822 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(0, 281, __pyx_L3_error)
6824 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
6825 goto __pyx_L5_argtuple_error;
6827 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6829 __pyx_v_name = values[0];
6831 goto __pyx_L4_argument_unpacking_done;
6832 __pyx_L5_argtuple_error:;
6833 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 281, __pyx_L3_error)
6835 __Pyx_AddTraceback(
"View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6836 __Pyx_RefNannyFinishContext();
6838 __pyx_L4_argument_unpacking_done:;
6839 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
6842 __Pyx_RefNannyFinishContext();
6846 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
6848 __Pyx_RefNannyDeclarations
6849 __Pyx_RefNannySetupContext(
"__init__", 0);
6858 __Pyx_INCREF(__pyx_v_name);
6859 __Pyx_GIVEREF(__pyx_v_name);
6860 __Pyx_GOTREF(__pyx_v_self->name);
6861 __Pyx_DECREF(__pyx_v_self->name);
6862 __pyx_v_self->name = __pyx_v_name;
6874 __Pyx_RefNannyFinishContext();
6887 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self);
6888 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
6889 PyObject *__pyx_r = 0;
6890 __Pyx_RefNannyDeclarations
6891 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
6892 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
6895 __Pyx_RefNannyFinishContext();
6899 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
6900 PyObject *__pyx_r = NULL;
6901 __Pyx_RefNannyDeclarations
6902 __Pyx_RefNannySetupContext(
"__repr__", 0);
6911 __Pyx_XDECREF(__pyx_r);
6912 __Pyx_INCREF(__pyx_v_self->name);
6913 __pyx_r = __pyx_v_self->name;
6926 __Pyx_XGIVEREF(__pyx_r);
6927 __Pyx_RefNannyFinishContext();
6938 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
6939 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6940 PyObject *__pyx_r = 0;
6941 __Pyx_RefNannyDeclarations
6942 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
6943 __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
6946 __Pyx_RefNannyFinishContext();
6950 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
6951 PyObject *__pyx_v_state = 0;
6952 PyObject *__pyx_v__dict = 0;
6953 int __pyx_v_use_setstate;
6954 PyObject *__pyx_r = NULL;
6955 __Pyx_RefNannyDeclarations
6956 PyObject *__pyx_t_1 = NULL;
6959 PyObject *__pyx_t_4 = NULL;
6960 PyObject *__pyx_t_5 = NULL;
6961 int __pyx_lineno = 0;
6962 const char *__pyx_filename = NULL;
6963 int __pyx_clineno = 0;
6964 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
6973 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
6974 __Pyx_GOTREF(__pyx_t_1);
6975 __Pyx_INCREF(__pyx_v_self->name);
6976 __Pyx_GIVEREF(__pyx_v_self->name);
6977 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
6978 __pyx_v_state = ((PyObject*)__pyx_t_1);
6988 __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
6989 __Pyx_GOTREF(__pyx_t_1);
6990 __pyx_v__dict = __pyx_t_1;
7000 __pyx_t_2 = (__pyx_v__dict != Py_None);
7001 __pyx_t_3 = (__pyx_t_2 != 0);
7011 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
7012 __Pyx_GOTREF(__pyx_t_1);
7013 __Pyx_INCREF(__pyx_v__dict);
7014 __Pyx_GIVEREF(__pyx_v__dict);
7015 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
7016 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 8, __pyx_L1_error)
7017 __Pyx_GOTREF(__pyx_t_4);
7018 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7019 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
7029 __pyx_v_use_setstate = 1;
7049 __pyx_t_3 = (__pyx_v_self->name != Py_None);
7050 __pyx_v_use_setstate = __pyx_t_3;
7061 __pyx_t_3 = (__pyx_v_use_setstate != 0);
7071 __Pyx_XDECREF(__pyx_r);
7072 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 13, __pyx_L1_error)
7073 __Pyx_GOTREF(__pyx_t_4);
7074 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
7075 __Pyx_GOTREF(__pyx_t_1);
7076 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7077 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7078 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7079 __Pyx_INCREF(__pyx_int_184977713);
7080 __Pyx_GIVEREF(__pyx_int_184977713);
7081 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
7082 __Pyx_INCREF(Py_None);
7083 __Pyx_GIVEREF(Py_None);
7084 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
7085 __pyx_t_5 = PyTuple_New(3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 13, __pyx_L1_error)
7086 __Pyx_GOTREF(__pyx_t_5);
7087 __Pyx_GIVEREF(__pyx_t_4);
7088 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
7089 __Pyx_GIVEREF(__pyx_t_1);
7090 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
7091 __Pyx_INCREF(__pyx_v_state);
7092 __Pyx_GIVEREF(__pyx_v_state);
7093 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
7096 __pyx_r = __pyx_t_5;
7117 __Pyx_XDECREF(__pyx_r);
7118 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error)
7119 __Pyx_GOTREF(__pyx_t_5);
7120 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
7121 __Pyx_GOTREF(__pyx_t_1);
7122 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7123 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7124 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7125 __Pyx_INCREF(__pyx_int_184977713);
7126 __Pyx_GIVEREF(__pyx_int_184977713);
7127 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
7128 __Pyx_INCREF(__pyx_v_state);
7129 __Pyx_GIVEREF(__pyx_v_state);
7130 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
7131 __pyx_t_4 = PyTuple_New(2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L1_error)
7132 __Pyx_GOTREF(__pyx_t_4);
7133 __Pyx_GIVEREF(__pyx_t_5);
7134 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
7135 __Pyx_GIVEREF(__pyx_t_1);
7136 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
7139 __pyx_r = __pyx_t_4;
7152 __Pyx_XDECREF(__pyx_t_1);
7153 __Pyx_XDECREF(__pyx_t_4);
7154 __Pyx_XDECREF(__pyx_t_5);
7155 __Pyx_AddTraceback(
"View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7158 __Pyx_XDECREF(__pyx_v_state);
7159 __Pyx_XDECREF(__pyx_v__dict);
7160 __Pyx_XGIVEREF(__pyx_r);
7161 __Pyx_RefNannyFinishContext();
7173 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
7174 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
7175 PyObject *__pyx_r = 0;
7176 __Pyx_RefNannyDeclarations
7177 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
7178 __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
7181 __Pyx_RefNannyFinishContext();
7185 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
7186 PyObject *__pyx_r = NULL;
7187 __Pyx_RefNannyDeclarations
7188 PyObject *__pyx_t_1 = NULL;
7189 int __pyx_lineno = 0;
7190 const char *__pyx_filename = NULL;
7191 int __pyx_clineno = 0;
7192 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
7199 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(0, 17, __pyx_L1_error)
7200 __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
7201 __Pyx_GOTREF(__pyx_t_1);
7202 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7212 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7215 __Pyx_XDECREF(__pyx_t_1);
7216 __Pyx_AddTraceback(
"View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7219 __Pyx_XGIVEREF(__pyx_r);
7220 __Pyx_RefNannyFinishContext();
7232 static void *__pyx_align_pointer(
void *__pyx_v_memory,
size_t __pyx_v_alignment) {
7233 Py_intptr_t __pyx_v_aligned_p;
7234 size_t __pyx_v_offset;
7245 __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
7254 __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
7263 __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
7273 __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
7291 __pyx_r = ((
void *)__pyx_v_aligned_p);
7316 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
7317 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7318 PyObject *__pyx_v_obj = 0;
7320 int __pyx_v_dtype_is_object;
7321 int __pyx_lineno = 0;
7322 const char *__pyx_filename = NULL;
7323 int __pyx_clineno = 0;
7325 __Pyx_RefNannyDeclarations
7326 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
7328 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
7329 PyObject* values[3] = {0,0,0};
7330 if (unlikely(__pyx_kwds)) {
7332 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7334 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7336 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7338 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7341 default:
goto __pyx_L5_argtuple_error;
7343 kw_args = PyDict_Size(__pyx_kwds);
7346 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
7347 else goto __pyx_L5_argtuple_error;
7350 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
7352 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, 1); __PYX_ERR(0, 345, __pyx_L3_error)
7357 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
7358 if (value) { values[2] = value; kw_args--; }
7361 if (unlikely(kw_args > 0)) {
7362 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(0, 345, __pyx_L3_error)
7365 switch (PyTuple_GET_SIZE(__pyx_args)) {
7366 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7368 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7369 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7371 default:
goto __pyx_L5_argtuple_error;
7374 __pyx_v_obj = values[0];
7375 __pyx_v_flags = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_flags == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 345, __pyx_L3_error)
7377 __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]);
if (unlikely((__pyx_v_dtype_is_object == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 345, __pyx_L3_error)
7379 __pyx_v_dtype_is_object = ((int)0);
7382 goto __pyx_L4_argument_unpacking_done;
7383 __pyx_L5_argtuple_error:;
7384 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 345, __pyx_L3_error)
7386 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7387 __Pyx_RefNannyFinishContext();
7389 __pyx_L4_argument_unpacking_done:;
7390 __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);
7393 __Pyx_RefNannyFinishContext();
7397 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) {
7399 __Pyx_RefNannyDeclarations
7404 int __pyx_lineno = 0;
7405 const char *__pyx_filename = NULL;
7406 int __pyx_clineno = 0;
7407 __Pyx_RefNannySetupContext(
"__cinit__", 0);
7416 __Pyx_INCREF(__pyx_v_obj);
7417 __Pyx_GIVEREF(__pyx_v_obj);
7418 __Pyx_GOTREF(__pyx_v_self->obj);
7419 __Pyx_DECREF(__pyx_v_self->obj);
7420 __pyx_v_self->obj = __pyx_v_obj;
7429 __pyx_v_self->flags = __pyx_v_flags;
7438 __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
7439 __pyx_t_3 = (__pyx_t_2 != 0);
7442 __pyx_t_1 = __pyx_t_3;
7443 goto __pyx_L4_bool_binop_done;
7445 __pyx_t_3 = (__pyx_v_obj != Py_None);
7446 __pyx_t_2 = (__pyx_t_3 != 0);
7447 __pyx_t_1 = __pyx_t_2;
7448 __pyx_L4_bool_binop_done:;
7458 __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(0, 349, __pyx_L1_error)
7467 __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
7477 ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
7513 __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
7523 __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
7532 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
7550 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
7560 __pyx_v_self->lock = PyThread_allocate_lock();
7569 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
7570 if (unlikely(__pyx_t_1)) {
7579 PyErr_NoMemory(); __PYX_ERR(0, 361, __pyx_L1_error)
7606 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
7616 __pyx_t_2 = (((__pyx_v_self->view.format[0]) ==
'O') != 0);
7619 __pyx_t_1 = __pyx_t_2;
7620 goto __pyx_L11_bool_binop_done;
7622 __pyx_t_2 = (((__pyx_v_self->view.format[1]) ==
'\x00') != 0);
7623 __pyx_t_1 = __pyx_t_2;
7624 __pyx_L11_bool_binop_done:;
7625 __pyx_v_self->dtype_is_object = __pyx_t_1;
7645 __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
7656 __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((
void *)(&(__pyx_v_self->acquisition_count[0]))), (
sizeof(__pyx_atomic_int))));
7665 __pyx_v_self->typeinfo = NULL;
7679 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7682 __Pyx_RefNannyFinishContext();
7695 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self);
7696 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
7697 __Pyx_RefNannyDeclarations
7698 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
7699 __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
7702 __Pyx_RefNannyFinishContext();
7705 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self) {
7707 __Pyx_RefNannyDeclarations
7713 PyThread_type_lock __pyx_t_6;
7714 PyThread_type_lock __pyx_t_7;
7715 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
7724 __pyx_t_1 = (__pyx_v_self->obj != Py_None);
7725 __pyx_t_2 = (__pyx_t_1 != 0);
7735 __Pyx_ReleaseBuffer((&__pyx_v_self->view));
7754 __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
7764 ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
7792 __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
7802 __pyx_t_3 = __pyx_memoryview_thread_locks_used;
7803 __pyx_t_4 = __pyx_t_3;
7804 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
7805 __pyx_v_i = __pyx_t_5;
7814 __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
7824 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
7833 __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
7843 __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
7844 __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
7853 (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
7854 (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
7872 goto __pyx_L6_break;
7892 PyThread_free_lock(__pyx_v_self->lock);
7914 __Pyx_RefNannyFinishContext();
7925 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
7926 Py_ssize_t __pyx_v_dim;
7927 char *__pyx_v_itemp;
7928 PyObject *__pyx_v_idx = NULL;
7930 __Pyx_RefNannyDeclarations
7931 Py_ssize_t __pyx_t_1;
7932 PyObject *__pyx_t_2 = NULL;
7933 Py_ssize_t __pyx_t_3;
7934 PyObject *(*__pyx_t_4)(PyObject *);
7935 PyObject *__pyx_t_5 = NULL;
7936 Py_ssize_t __pyx_t_6;
7938 int __pyx_lineno = 0;
7939 const char *__pyx_filename = NULL;
7940 int __pyx_clineno = 0;
7941 __Pyx_RefNannySetupContext(
"get_item_pointer", 0);
7950 __pyx_v_itemp = ((
char *)__pyx_v_self->view.buf);
7960 if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
7961 __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
7964 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error)
7965 __Pyx_GOTREF(__pyx_t_2);
7966 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 397, __pyx_L1_error)
7969 if (likely(!__pyx_t_4)) {
7970 if (likely(PyList_CheckExact(__pyx_t_2))) {
7971 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2))
break;
7972 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7973 __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(0, 397, __pyx_L1_error)
7975 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 397, __pyx_L1_error)
7976 __Pyx_GOTREF(__pyx_t_5);
7979 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2))
break;
7980 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7981 __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(0, 397, __pyx_L1_error)
7983 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 397, __pyx_L1_error)
7984 __Pyx_GOTREF(__pyx_t_5);
7988 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
7989 if (unlikely(!__pyx_t_5)) {
7990 PyObject* exc_type = PyErr_Occurred();
7992 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7993 else __PYX_ERR(0, 397, __pyx_L1_error)
7997 __Pyx_GOTREF(__pyx_t_5);
7999 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
8001 __pyx_v_dim = __pyx_t_1;
8002 __pyx_t_1 = (__pyx_t_1 + 1);
8011 __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx);
if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 398, __pyx_L1_error)
8012 __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(0, 398, __pyx_L1_error)
8013 __pyx_v_itemp = __pyx_t_7;
8023 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8032 __pyx_r = __pyx_v_itemp;
8045 __Pyx_XDECREF(__pyx_t_2);
8046 __Pyx_XDECREF(__pyx_t_5);
8047 __Pyx_AddTraceback(
"View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8050 __Pyx_XDECREF(__pyx_v_idx);
8051 __Pyx_RefNannyFinishContext();
8064 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index);
8065 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
8066 PyObject *__pyx_r = 0;
8067 __Pyx_RefNannyDeclarations
8068 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
8069 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
8072 __Pyx_RefNannyFinishContext();
8076 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
8077 PyObject *__pyx_v_have_slices = NULL;
8078 PyObject *__pyx_v_indices = NULL;
8079 char *__pyx_v_itemp;
8080 PyObject *__pyx_r = NULL;
8081 __Pyx_RefNannyDeclarations
8084 PyObject *__pyx_t_3 = NULL;
8085 PyObject *__pyx_t_4 = NULL;
8086 PyObject *__pyx_t_5 = NULL;
8088 int __pyx_lineno = 0;
8089 const char *__pyx_filename = NULL;
8090 int __pyx_clineno = 0;
8091 __Pyx_RefNannySetupContext(
"__getitem__", 0);
8100 __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
8101 __pyx_t_2 = (__pyx_t_1 != 0);
8111 __Pyx_XDECREF(__pyx_r);
8112 __Pyx_INCREF(((PyObject *)__pyx_v_self));
8113 __pyx_r = ((PyObject *)__pyx_v_self);
8132 __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error)
8133 __Pyx_GOTREF(__pyx_t_3);
8134 if (likely(__pyx_t_3 != Py_None)) {
8135 PyObject* sequence = __pyx_t_3;
8136 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
8137 if (unlikely(size != 2)) {
8138 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
8139 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
8140 __PYX_ERR(0, 407, __pyx_L1_error)
8142 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8143 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
8144 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
8145 __Pyx_INCREF(__pyx_t_4);
8146 __Pyx_INCREF(__pyx_t_5);
8148 __pyx_t_4 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 407, __pyx_L1_error)
8149 __Pyx_GOTREF(__pyx_t_4);
8150 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 407, __pyx_L1_error)
8151 __Pyx_GOTREF(__pyx_t_5);
8153 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8155 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 407, __pyx_L1_error)
8157 __pyx_v_have_slices = __pyx_t_4;
8159 __pyx_v_indices = __pyx_t_5;
8169 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 410, __pyx_L1_error)
8179 __Pyx_XDECREF(__pyx_r);
8180 __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error)
8181 __Pyx_GOTREF(__pyx_t_3);
8182 __pyx_r = __pyx_t_3;
8203 __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(0, 413, __pyx_L1_error)
8204 __pyx_v_itemp = __pyx_t_6;
8213 __Pyx_XDECREF(__pyx_r);
8214 __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(0, 414, __pyx_L1_error)
8215 __Pyx_GOTREF(__pyx_t_3);
8216 __pyx_r = __pyx_t_3;
8231 __Pyx_XDECREF(__pyx_t_3);
8232 __Pyx_XDECREF(__pyx_t_4);
8233 __Pyx_XDECREF(__pyx_t_5);
8234 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8237 __Pyx_XDECREF(__pyx_v_have_slices);
8238 __Pyx_XDECREF(__pyx_v_indices);
8239 __Pyx_XGIVEREF(__pyx_r);
8240 __Pyx_RefNannyFinishContext();
8253 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
8254 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
8256 __Pyx_RefNannyDeclarations
8257 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
8258 __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));
8261 __Pyx_RefNannyFinishContext();
8265 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) {
8266 PyObject *__pyx_v_have_slices = NULL;
8267 PyObject *__pyx_v_obj = NULL;
8269 __Pyx_RefNannyDeclarations
8271 PyObject *__pyx_t_2 = NULL;
8272 PyObject *__pyx_t_3 = NULL;
8273 PyObject *__pyx_t_4 = NULL;
8274 int __pyx_lineno = 0;
8275 const char *__pyx_filename = NULL;
8276 int __pyx_clineno = 0;
8277 __Pyx_RefNannySetupContext(
"__setitem__", 0);
8278 __Pyx_INCREF(__pyx_v_index);
8287 __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
8288 if (unlikely(__pyx_t_1)) {
8297 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error)
8298 __Pyx_GOTREF(__pyx_t_2);
8299 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8300 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8301 __PYX_ERR(0, 418, __pyx_L1_error)
8319 __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error)
8320 __Pyx_GOTREF(__pyx_t_2);
8321 if (likely(__pyx_t_2 != Py_None)) {
8322 PyObject* sequence = __pyx_t_2;
8323 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
8324 if (unlikely(size != 2)) {
8325 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
8326 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
8327 __PYX_ERR(0, 420, __pyx_L1_error)
8329 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8330 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
8331 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
8332 __Pyx_INCREF(__pyx_t_3);
8333 __Pyx_INCREF(__pyx_t_4);
8335 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 420, __pyx_L1_error)
8336 __Pyx_GOTREF(__pyx_t_3);
8337 __pyx_t_4 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 420, __pyx_L1_error)
8338 __Pyx_GOTREF(__pyx_t_4);
8340 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8342 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 420, __pyx_L1_error)
8344 __pyx_v_have_slices = __pyx_t_3;
8346 __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
8356 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 422, __pyx_L1_error)
8366 __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(0, 423, __pyx_L1_error)
8367 __Pyx_GOTREF(__pyx_t_2);
8368 __pyx_v_obj = __pyx_t_2;
8378 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 424, __pyx_L1_error)
8388 __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 425, __pyx_L1_error)
8389 __Pyx_GOTREF(__pyx_t_2);
8390 __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(0, 425, __pyx_L1_error)
8391 __Pyx_GOTREF(__pyx_t_4);
8392 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8393 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8413 __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L1_error)
8414 __Pyx_GOTREF(__pyx_t_4);
8415 if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(0, 427, __pyx_L1_error)
8416 __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(0, 427, __pyx_L1_error)
8417 __Pyx_GOTREF(__pyx_t_2);
8418 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8419 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8441 __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(0, 429, __pyx_L1_error)
8442 __Pyx_GOTREF(__pyx_t_2);
8443 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8459 __Pyx_XDECREF(__pyx_t_2);
8460 __Pyx_XDECREF(__pyx_t_3);
8461 __Pyx_XDECREF(__pyx_t_4);
8462 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8465 __Pyx_XDECREF(__pyx_v_have_slices);
8466 __Pyx_XDECREF(__pyx_v_obj);
8467 __Pyx_XDECREF(__pyx_v_index);
8468 __Pyx_RefNannyFinishContext();
8480 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
8481 PyObject *__pyx_r = NULL;
8482 __Pyx_RefNannyDeclarations
8485 PyObject *__pyx_t_3 = NULL;
8486 PyObject *__pyx_t_4 = NULL;
8487 PyObject *__pyx_t_5 = NULL;
8488 PyObject *__pyx_t_6 = NULL;
8489 PyObject *__pyx_t_7 = NULL;
8490 PyObject *__pyx_t_8 = NULL;
8492 int __pyx_lineno = 0;
8493 const char *__pyx_filename = NULL;
8494 int __pyx_clineno = 0;
8495 __Pyx_RefNannySetupContext(
"is_slice", 0);
8496 __Pyx_INCREF(__pyx_v_obj);
8505 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
8506 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
8517 __Pyx_PyThreadState_declare
8518 __Pyx_PyThreadState_assign
8519 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
8520 __Pyx_XGOTREF(__pyx_t_3);
8521 __Pyx_XGOTREF(__pyx_t_4);
8522 __Pyx_XGOTREF(__pyx_t_5);
8532 __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS));
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 434, __pyx_L4_error)
8533 __Pyx_GOTREF(__pyx_t_6);
8542 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 435, __pyx_L4_error)
8543 __Pyx_GOTREF(__pyx_t_7);
8552 __pyx_t_8 = PyTuple_New(3);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 434, __pyx_L4_error)
8553 __Pyx_GOTREF(__pyx_t_8);
8554 __Pyx_INCREF(__pyx_v_obj);
8555 __Pyx_GIVEREF(__pyx_v_obj);
8556 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
8557 __Pyx_GIVEREF(__pyx_t_6);
8558 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
8559 __Pyx_GIVEREF(__pyx_t_7);
8560 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
8563 __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL);
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 434, __pyx_L4_error)
8564 __Pyx_GOTREF(__pyx_t_7);
8565 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8566 __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
8577 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8578 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8579 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8580 goto __pyx_L9_try_end;
8582 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8583 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8584 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8593 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
8595 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
8596 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(0, 436, __pyx_L6_except_error)
8597 __Pyx_GOTREF(__pyx_t_7);
8598 __Pyx_GOTREF(__pyx_t_8);
8599 __Pyx_GOTREF(__pyx_t_6);
8608 __Pyx_XDECREF(__pyx_r);
8609 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8610 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8611 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8612 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8613 goto __pyx_L7_except_return;
8615 goto __pyx_L6_except_error;
8616 __pyx_L6_except_error:;
8625 __Pyx_XGIVEREF(__pyx_t_3);
8626 __Pyx_XGIVEREF(__pyx_t_4);
8627 __Pyx_XGIVEREF(__pyx_t_5);
8628 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
8629 goto __pyx_L1_error;
8630 __pyx_L7_except_return:;
8631 __Pyx_XGIVEREF(__pyx_t_3);
8632 __Pyx_XGIVEREF(__pyx_t_4);
8633 __Pyx_XGIVEREF(__pyx_t_5);
8634 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
8655 __Pyx_XDECREF(__pyx_r);
8656 __Pyx_INCREF(__pyx_v_obj);
8657 __pyx_r = __pyx_v_obj;
8670 __Pyx_XDECREF(__pyx_t_6);
8671 __Pyx_XDECREF(__pyx_t_7);
8672 __Pyx_XDECREF(__pyx_t_8);
8673 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
8676 __Pyx_XDECREF(__pyx_v_obj);
8677 __Pyx_XGIVEREF(__pyx_r);
8678 __Pyx_RefNannyFinishContext();
8690 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
8691 __Pyx_memviewslice __pyx_v_dst_slice;
8692 __Pyx_memviewslice __pyx_v_src_slice;
8693 PyObject *__pyx_r = NULL;
8694 __Pyx_RefNannyDeclarations
8695 __Pyx_memviewslice *__pyx_t_1;
8696 __Pyx_memviewslice *__pyx_t_2;
8697 PyObject *__pyx_t_3 = NULL;
8701 int __pyx_lineno = 0;
8702 const char *__pyx_filename = NULL;
8703 int __pyx_clineno = 0;
8704 __Pyx_RefNannySetupContext(
"setitem_slice_assignment", 0);
8713 if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(0, 445, __pyx_L1_error)
8714 __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(0, 445, __pyx_L1_error)
8723 if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(0, 446, __pyx_L1_error)
8724 __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(0, 446, __pyx_L1_error)
8733 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error)
8734 __Pyx_GOTREF(__pyx_t_3);
8735 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 447, __pyx_L1_error)
8736 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8737 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error)
8738 __Pyx_GOTREF(__pyx_t_3);
8739 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 447, __pyx_L1_error)
8740 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8749 __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(0, 445, __pyx_L1_error)
8760 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8763 __Pyx_XDECREF(__pyx_t_3);
8764 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
8767 __Pyx_XGIVEREF(__pyx_r);
8768 __Pyx_RefNannyFinishContext();
8780 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) {
8781 int __pyx_v_array[0x80];
8784 __Pyx_memviewslice *__pyx_v_dst_slice;
8785 __Pyx_memviewslice __pyx_v_tmp_slice;
8786 PyObject *__pyx_r = NULL;
8787 __Pyx_RefNannyDeclarations
8788 __Pyx_memviewslice *__pyx_t_1;
8790 PyObject *__pyx_t_3 = NULL;
8793 char const *__pyx_t_6;
8794 PyObject *__pyx_t_7 = NULL;
8795 PyObject *__pyx_t_8 = NULL;
8796 PyObject *__pyx_t_9 = NULL;
8797 PyObject *__pyx_t_10 = NULL;
8798 PyObject *__pyx_t_11 = NULL;
8799 PyObject *__pyx_t_12 = NULL;
8800 int __pyx_lineno = 0;
8801 const char *__pyx_filename = NULL;
8802 int __pyx_clineno = 0;
8803 __Pyx_RefNannySetupContext(
"setitem_slice_assign_scalar", 0);
8821 __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(0, 456, __pyx_L1_error)
8822 __pyx_v_dst_slice = __pyx_t_1;
8831 __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (
sizeof(__pyx_v_array))) != 0);
8841 __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
8850 __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
8851 if (unlikely(__pyx_t_2)) {
8860 PyErr_NoMemory(); __PYX_ERR(0, 461, __pyx_L1_error)
8878 __pyx_v_item = __pyx_v_tmp;
8898 __pyx_v_item = ((
void *)__pyx_v_array);
8918 __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
8928 (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
8948 __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(0, 470, __pyx_L6_error)
8949 __Pyx_GOTREF(__pyx_t_3);
8950 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8961 __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
8971 __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 475, __pyx_L6_error)
8972 __Pyx_GOTREF(__pyx_t_3);
8973 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8991 __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);
9003 PyMem_Free(__pyx_v_tmp);
9008 __Pyx_PyThreadState_declare
9009 __Pyx_PyThreadState_assign
9010 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
9011 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9012 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
9013 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);
9014 __Pyx_XGOTREF(__pyx_t_7);
9015 __Pyx_XGOTREF(__pyx_t_8);
9016 __Pyx_XGOTREF(__pyx_t_9);
9017 __Pyx_XGOTREF(__pyx_t_10);
9018 __Pyx_XGOTREF(__pyx_t_11);
9019 __Pyx_XGOTREF(__pyx_t_12);
9020 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
9022 PyMem_Free(__pyx_v_tmp);
9024 if (PY_MAJOR_VERSION >= 3) {
9025 __Pyx_XGIVEREF(__pyx_t_10);
9026 __Pyx_XGIVEREF(__pyx_t_11);
9027 __Pyx_XGIVEREF(__pyx_t_12);
9028 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
9030 __Pyx_XGIVEREF(__pyx_t_7);
9031 __Pyx_XGIVEREF(__pyx_t_8);
9032 __Pyx_XGIVEREF(__pyx_t_9);
9033 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
9034 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
9035 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
9036 goto __pyx_L1_error;
9050 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9053 __Pyx_XDECREF(__pyx_t_3);
9054 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
9057 __Pyx_XGIVEREF(__pyx_r);
9058 __Pyx_RefNannyFinishContext();
9070 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
9071 char *__pyx_v_itemp;
9072 PyObject *__pyx_r = NULL;
9073 __Pyx_RefNannyDeclarations
9075 PyObject *__pyx_t_2 = NULL;
9076 int __pyx_lineno = 0;
9077 const char *__pyx_filename = NULL;
9078 int __pyx_clineno = 0;
9079 __Pyx_RefNannySetupContext(
"setitem_indexed", 0);
9088 __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(0, 482, __pyx_L1_error)
9089 __pyx_v_itemp = __pyx_t_1;
9098 __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(0, 483, __pyx_L1_error)
9099 __Pyx_GOTREF(__pyx_t_2);
9100 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9111 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9114 __Pyx_XDECREF(__pyx_t_2);
9115 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
9118 __Pyx_XGIVEREF(__pyx_r);
9119 __Pyx_RefNannyFinishContext();
9131 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp) {
9132 PyObject *__pyx_v_struct = NULL;
9133 PyObject *__pyx_v_bytesitem = 0;
9134 PyObject *__pyx_v_result = NULL;
9135 PyObject *__pyx_r = NULL;
9136 __Pyx_RefNannyDeclarations
9137 PyObject *__pyx_t_1 = NULL;
9138 PyObject *__pyx_t_2 = NULL;
9139 PyObject *__pyx_t_3 = NULL;
9140 PyObject *__pyx_t_4 = NULL;
9141 PyObject *__pyx_t_5 = NULL;
9142 PyObject *__pyx_t_6 = NULL;
9143 PyObject *__pyx_t_7 = NULL;
9145 PyObject *__pyx_t_9 = NULL;
9148 int __pyx_lineno = 0;
9149 const char *__pyx_filename = NULL;
9150 int __pyx_clineno = 0;
9151 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
9160 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error)
9161 __Pyx_GOTREF(__pyx_t_1);
9162 __pyx_v_struct = __pyx_t_1;
9172 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L1_error)
9173 __Pyx_GOTREF(__pyx_t_1);
9174 __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
9185 __Pyx_PyThreadState_declare
9186 __Pyx_PyThreadState_assign
9187 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
9188 __Pyx_XGOTREF(__pyx_t_2);
9189 __Pyx_XGOTREF(__pyx_t_3);
9190 __Pyx_XGOTREF(__pyx_t_4);
9200 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 493, __pyx_L3_error)
9201 __Pyx_GOTREF(__pyx_t_5);
9202 __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 493, __pyx_L3_error)
9203 __Pyx_GOTREF(__pyx_t_6);
9206 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
9207 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
9208 if (likely(__pyx_t_7)) {
9209 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
9210 __Pyx_INCREF(__pyx_t_7);
9211 __Pyx_INCREF(
function);
9212 __Pyx_DECREF_SET(__pyx_t_5,
function);
9216 #if CYTHON_FAST_PYCALL
9217 if (PyFunction_Check(__pyx_t_5)) {
9218 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
9219 __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(0, 493, __pyx_L3_error)
9220 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9221 __Pyx_GOTREF(__pyx_t_1);
9222 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9225 #if CYTHON_FAST_PYCCALL
9226 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
9227 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
9228 __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(0, 493, __pyx_L3_error)
9229 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9230 __Pyx_GOTREF(__pyx_t_1);
9231 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9235 __pyx_t_9 = PyTuple_New(2+__pyx_t_8);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 493, __pyx_L3_error)
9236 __Pyx_GOTREF(__pyx_t_9);
9238 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
9240 __Pyx_GIVEREF(__pyx_t_6);
9241 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
9242 __Pyx_INCREF(__pyx_v_bytesitem);
9243 __Pyx_GIVEREF(__pyx_v_bytesitem);
9244 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
9246 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L3_error)
9247 __Pyx_GOTREF(__pyx_t_1);
9248 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9250 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9251 __pyx_v_result = __pyx_t_1;
9271 __pyx_t_10 = strlen(__pyx_v_self->view.format);
9272 __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
9282 __Pyx_XDECREF(__pyx_r);
9283 __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(0, 498, __pyx_L5_except_error)
9284 __Pyx_GOTREF(__pyx_t_1);
9285 __pyx_r = __pyx_t_1;
9287 goto __pyx_L6_except_return;
9305 __Pyx_XDECREF(__pyx_r);
9306 __Pyx_INCREF(__pyx_v_result);
9307 __pyx_r = __pyx_v_result;
9308 goto __pyx_L6_except_return;
9311 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9312 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9313 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9314 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9315 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
9324 __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
9325 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 494, __pyx_L5_except_error)
9326 __Pyx_GOTREF(__pyx_t_6);
9327 __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
9328 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9329 __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
9330 __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
9332 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
9333 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(0, 494, __pyx_L5_except_error)
9334 __Pyx_GOTREF(__pyx_t_9);
9335 __Pyx_GOTREF(__pyx_t_5);
9336 __Pyx_GOTREF(__pyx_t_1);
9345 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 495, __pyx_L5_except_error)
9346 __Pyx_GOTREF(__pyx_t_6);
9347 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
9348 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9349 __PYX_ERR(0, 495, __pyx_L5_except_error)
9351 goto __pyx_L5_except_error;
9352 __pyx_L5_except_error:;
9361 __Pyx_XGIVEREF(__pyx_t_2);
9362 __Pyx_XGIVEREF(__pyx_t_3);
9363 __Pyx_XGIVEREF(__pyx_t_4);
9364 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
9365 goto __pyx_L1_error;
9366 __pyx_L6_except_return:;
9367 __Pyx_XGIVEREF(__pyx_t_2);
9368 __Pyx_XGIVEREF(__pyx_t_3);
9369 __Pyx_XGIVEREF(__pyx_t_4);
9370 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
9384 __Pyx_XDECREF(__pyx_t_1);
9385 __Pyx_XDECREF(__pyx_t_5);
9386 __Pyx_XDECREF(__pyx_t_6);
9387 __Pyx_XDECREF(__pyx_t_7);
9388 __Pyx_XDECREF(__pyx_t_9);
9389 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
9392 __Pyx_XDECREF(__pyx_v_struct);
9393 __Pyx_XDECREF(__pyx_v_bytesitem);
9394 __Pyx_XDECREF(__pyx_v_result);
9395 __Pyx_XGIVEREF(__pyx_r);
9396 __Pyx_RefNannyFinishContext();
9408 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
9409 PyObject *__pyx_v_struct = NULL;
9411 PyObject *__pyx_v_bytesvalue = 0;
9412 Py_ssize_t __pyx_v_i;
9413 PyObject *__pyx_r = NULL;
9414 __Pyx_RefNannyDeclarations
9415 PyObject *__pyx_t_1 = NULL;
9418 PyObject *__pyx_t_4 = NULL;
9419 PyObject *__pyx_t_5 = NULL;
9420 PyObject *__pyx_t_6 = NULL;
9422 PyObject *__pyx_t_8 = NULL;
9423 Py_ssize_t __pyx_t_9;
9424 PyObject *__pyx_t_10 = NULL;
9429 int __pyx_lineno = 0;
9430 const char *__pyx_filename = NULL;
9431 int __pyx_clineno = 0;
9432 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
9441 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error)
9442 __Pyx_GOTREF(__pyx_t_1);
9443 __pyx_v_struct = __pyx_t_1;
9453 __pyx_t_2 = PyTuple_Check(__pyx_v_value);
9454 __pyx_t_3 = (__pyx_t_2 != 0);
9464 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error)
9465 __Pyx_GOTREF(__pyx_t_1);
9466 __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 510, __pyx_L1_error)
9467 __Pyx_GOTREF(__pyx_t_4);
9468 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 510, __pyx_L1_error)
9469 __Pyx_GOTREF(__pyx_t_5);
9470 __Pyx_GIVEREF(__pyx_t_4);
9471 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
9473 __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 510, __pyx_L1_error)
9474 __Pyx_GOTREF(__pyx_t_4);
9475 __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 510, __pyx_L1_error)
9476 __Pyx_GOTREF(__pyx_t_6);
9477 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9478 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9479 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 510, __pyx_L1_error)
9480 __Pyx_GOTREF(__pyx_t_4);
9481 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9482 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9483 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(0, 510, __pyx_L1_error)
9484 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
9505 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 512, __pyx_L1_error)
9506 __Pyx_GOTREF(__pyx_t_6);
9507 __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error)
9508 __Pyx_GOTREF(__pyx_t_1);
9511 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
9512 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
9513 if (likely(__pyx_t_5)) {
9514 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_6);
9515 __Pyx_INCREF(__pyx_t_5);
9516 __Pyx_INCREF(
function);
9517 __Pyx_DECREF_SET(__pyx_t_6,
function);
9521 #if CYTHON_FAST_PYCALL
9522 if (PyFunction_Check(__pyx_t_6)) {
9523 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
9524 __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(0, 512, __pyx_L1_error)
9525 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9526 __Pyx_GOTREF(__pyx_t_4);
9527 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9530 #if CYTHON_FAST_PYCCALL
9531 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
9532 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
9533 __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(0, 512, __pyx_L1_error)
9534 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9535 __Pyx_GOTREF(__pyx_t_4);
9536 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9540 __pyx_t_8 = PyTuple_New(2+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 512, __pyx_L1_error)
9541 __Pyx_GOTREF(__pyx_t_8);
9543 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
9545 __Pyx_GIVEREF(__pyx_t_1);
9546 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
9547 __Pyx_INCREF(__pyx_v_value);
9548 __Pyx_GIVEREF(__pyx_v_value);
9549 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
9551 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 512, __pyx_L1_error)
9552 __Pyx_GOTREF(__pyx_t_4);
9553 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9555 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9556 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(0, 512, __pyx_L1_error)
9557 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
9570 if (unlikely(__pyx_v_bytesvalue == Py_None)) {
9571 PyErr_SetString(PyExc_TypeError,
"'NoneType' is not iterable");
9572 __PYX_ERR(0, 514, __pyx_L1_error)
9574 __Pyx_INCREF(__pyx_v_bytesvalue);
9575 __pyx_t_10 = __pyx_v_bytesvalue;
9576 __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
9577 __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
9578 for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
9579 __pyx_t_11 = __pyx_t_14;
9580 __pyx_v_c = (__pyx_t_11[0]);
9589 __pyx_v_i = __pyx_t_9;
9598 __pyx_t_9 = (__pyx_t_9 + 1);
9607 (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
9609 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9620 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9623 __Pyx_XDECREF(__pyx_t_1);
9624 __Pyx_XDECREF(__pyx_t_4);
9625 __Pyx_XDECREF(__pyx_t_5);
9626 __Pyx_XDECREF(__pyx_t_6);
9627 __Pyx_XDECREF(__pyx_t_8);
9628 __Pyx_XDECREF(__pyx_t_10);
9629 __Pyx_AddTraceback(
"View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
9632 __Pyx_XDECREF(__pyx_v_struct);
9633 __Pyx_XDECREF(__pyx_v_bytesvalue);
9634 __Pyx_XGIVEREF(__pyx_r);
9635 __Pyx_RefNannyFinishContext();
9648 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
9649 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
9651 __Pyx_RefNannyDeclarations
9652 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
9653 __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));
9656 __Pyx_RefNannyFinishContext();
9660 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) {
9662 __Pyx_RefNannyDeclarations
9665 PyObject *__pyx_t_3 = NULL;
9666 Py_ssize_t *__pyx_t_4;
9670 Py_ssize_t __pyx_t_8;
9671 int __pyx_lineno = 0;
9672 const char *__pyx_filename = NULL;
9673 int __pyx_clineno = 0;
9674 if (__pyx_v_info == NULL) {
9675 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
9678 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
9679 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
9680 __Pyx_GIVEREF(__pyx_v_info->obj);
9689 __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
9692 __pyx_t_1 = __pyx_t_2;
9693 goto __pyx_L4_bool_binop_done;
9695 __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
9696 __pyx_t_1 = __pyx_t_2;
9697 __pyx_L4_bool_binop_done:;
9698 if (unlikely(__pyx_t_1)) {
9707 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 520, __pyx_L1_error)
9708 __Pyx_GOTREF(__pyx_t_3);
9709 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9710 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9711 __PYX_ERR(0, 520, __pyx_L1_error)
9729 __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
9739 __pyx_t_4 = __pyx_v_self->view.shape;
9740 __pyx_v_info->shape = __pyx_t_4;
9760 __pyx_v_info->shape = NULL;
9771 __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
9781 __pyx_t_4 = __pyx_v_self->view.strides;
9782 __pyx_v_info->strides = __pyx_t_4;
9802 __pyx_v_info->strides = NULL;
9813 __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
9823 __pyx_t_4 = __pyx_v_self->view.suboffsets;
9824 __pyx_v_info->suboffsets = __pyx_t_4;
9844 __pyx_v_info->suboffsets = NULL;
9855 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
9865 __pyx_t_5 = __pyx_v_self->view.format;
9866 __pyx_v_info->format = __pyx_t_5;
9886 __pyx_v_info->format = NULL;
9897 __pyx_t_6 = __pyx_v_self->view.buf;
9898 __pyx_v_info->buf = __pyx_t_6;
9907 __pyx_t_7 = __pyx_v_self->view.ndim;
9908 __pyx_v_info->ndim = __pyx_t_7;
9917 __pyx_t_8 = __pyx_v_self->view.itemsize;
9918 __pyx_v_info->itemsize = __pyx_t_8;
9927 __pyx_t_8 = __pyx_v_self->view.len;
9928 __pyx_v_info->len = __pyx_t_8;
9937 __pyx_t_1 = __pyx_v_self->view.readonly;
9938 __pyx_v_info->readonly = __pyx_t_1;
9947 __Pyx_INCREF(((PyObject *)__pyx_v_self));
9948 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
9949 __Pyx_GOTREF(__pyx_v_info->obj);
9950 __Pyx_DECREF(__pyx_v_info->obj);
9951 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
9965 __Pyx_XDECREF(__pyx_t_3);
9966 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9968 if (__pyx_v_info->obj != NULL) {
9969 __Pyx_GOTREF(__pyx_v_info->obj);
9970 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
9974 if (__pyx_v_info->obj == Py_None) {
9975 __Pyx_GOTREF(__pyx_v_info->obj);
9976 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
9979 __Pyx_RefNannyFinishContext();
9992 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self);
9993 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
9994 PyObject *__pyx_r = 0;
9995 __Pyx_RefNannyDeclarations
9996 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
9997 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10000 __Pyx_RefNannyFinishContext();
10004 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10005 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
10006 PyObject *__pyx_r = NULL;
10007 __Pyx_RefNannyDeclarations
10008 PyObject *__pyx_t_1 = NULL;
10010 int __pyx_lineno = 0;
10011 const char *__pyx_filename = NULL;
10012 int __pyx_clineno = 0;
10013 __Pyx_RefNannySetupContext(
"__get__", 0);
10022 __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 554, __pyx_L1_error)
10023 __Pyx_GOTREF(__pyx_t_1);
10024 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(0, 554, __pyx_L1_error)
10025 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_1);
10035 __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice));
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(0, 555, __pyx_L1_error)
10044 __Pyx_XDECREF(__pyx_r);
10045 __Pyx_INCREF(((PyObject *)__pyx_v_result));
10046 __pyx_r = ((PyObject *)__pyx_v_result);
10059 __Pyx_XDECREF(__pyx_t_1);
10060 __Pyx_AddTraceback(
"View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10063 __Pyx_XDECREF((PyObject *)__pyx_v_result);
10064 __Pyx_XGIVEREF(__pyx_r);
10065 __Pyx_RefNannyFinishContext();
10078 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self);
10079 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
10080 PyObject *__pyx_r = 0;
10081 __Pyx_RefNannyDeclarations
10082 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10083 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10086 __Pyx_RefNannyFinishContext();
10090 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10091 PyObject *__pyx_r = NULL;
10092 __Pyx_RefNannyDeclarations
10093 __Pyx_RefNannySetupContext(
"__get__", 0);
10102 __Pyx_XDECREF(__pyx_r);
10103 __Pyx_INCREF(__pyx_v_self->obj);
10104 __pyx_r = __pyx_v_self->obj;
10117 __Pyx_XGIVEREF(__pyx_r);
10118 __Pyx_RefNannyFinishContext();
10131 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self);
10132 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
10133 PyObject *__pyx_r = 0;
10134 __Pyx_RefNannyDeclarations
10135 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10136 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10139 __Pyx_RefNannyFinishContext();
10143 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10144 Py_ssize_t __pyx_v_length;
10145 PyObject *__pyx_r = NULL;
10146 __Pyx_RefNannyDeclarations
10147 PyObject *__pyx_t_1 = NULL;
10148 Py_ssize_t *__pyx_t_2;
10149 Py_ssize_t *__pyx_t_3;
10150 Py_ssize_t *__pyx_t_4;
10151 PyObject *__pyx_t_5 = NULL;
10152 int __pyx_lineno = 0;
10153 const char *__pyx_filename = NULL;
10154 int __pyx_clineno = 0;
10155 __Pyx_RefNannySetupContext(
"__get__", 0);
10164 __Pyx_XDECREF(__pyx_r);
10165 __pyx_t_1 = PyList_New(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
10166 __Pyx_GOTREF(__pyx_t_1);
10167 __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
10168 for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
10169 __pyx_t_2 = __pyx_t_4;
10170 __pyx_v_length = (__pyx_t_2[0]);
10171 __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error)
10172 __Pyx_GOTREF(__pyx_t_5);
10173 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 564, __pyx_L1_error)
10174 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10176 __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1));
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error)
10177 __Pyx_GOTREF(__pyx_t_5);
10178 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10179 __pyx_r = __pyx_t_5;
10193 __Pyx_XDECREF(__pyx_t_1);
10194 __Pyx_XDECREF(__pyx_t_5);
10195 __Pyx_AddTraceback(
"View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10198 __Pyx_XGIVEREF(__pyx_r);
10199 __Pyx_RefNannyFinishContext();
10212 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self);
10213 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
10214 PyObject *__pyx_r = 0;
10215 __Pyx_RefNannyDeclarations
10216 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10217 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10220 __Pyx_RefNannyFinishContext();
10224 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10225 Py_ssize_t __pyx_v_stride;
10226 PyObject *__pyx_r = NULL;
10227 __Pyx_RefNannyDeclarations
10229 PyObject *__pyx_t_2 = NULL;
10230 Py_ssize_t *__pyx_t_3;
10231 Py_ssize_t *__pyx_t_4;
10232 Py_ssize_t *__pyx_t_5;
10233 PyObject *__pyx_t_6 = NULL;
10234 int __pyx_lineno = 0;
10235 const char *__pyx_filename = NULL;
10236 int __pyx_clineno = 0;
10237 __Pyx_RefNannySetupContext(
"__get__", 0);
10246 __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
10247 if (unlikely(__pyx_t_1)) {
10256 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L1_error)
10257 __Pyx_GOTREF(__pyx_t_2);
10258 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10259 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10260 __PYX_ERR(0, 570, __pyx_L1_error)
10278 __Pyx_XDECREF(__pyx_r);
10279 __pyx_t_2 = PyList_New(0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 572, __pyx_L1_error)
10280 __Pyx_GOTREF(__pyx_t_2);
10281 __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
10282 for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
10283 __pyx_t_3 = __pyx_t_5;
10284 __pyx_v_stride = (__pyx_t_3[0]);
10285 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 572, __pyx_L1_error)
10286 __Pyx_GOTREF(__pyx_t_6);
10287 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 572, __pyx_L1_error)
10288 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10290 __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2));
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 572, __pyx_L1_error)
10291 __Pyx_GOTREF(__pyx_t_6);
10292 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10293 __pyx_r = __pyx_t_6;
10307 __Pyx_XDECREF(__pyx_t_2);
10308 __Pyx_XDECREF(__pyx_t_6);
10309 __Pyx_AddTraceback(
"View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10312 __Pyx_XGIVEREF(__pyx_r);
10313 __Pyx_RefNannyFinishContext();
10326 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self);
10327 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
10328 PyObject *__pyx_r = 0;
10329 __Pyx_RefNannyDeclarations
10330 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10331 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10334 __Pyx_RefNannyFinishContext();
10338 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10339 Py_ssize_t __pyx_v_suboffset;
10340 PyObject *__pyx_r = NULL;
10341 __Pyx_RefNannyDeclarations
10343 PyObject *__pyx_t_2 = NULL;
10344 PyObject *__pyx_t_3 = NULL;
10345 Py_ssize_t *__pyx_t_4;
10346 Py_ssize_t *__pyx_t_5;
10347 Py_ssize_t *__pyx_t_6;
10348 int __pyx_lineno = 0;
10349 const char *__pyx_filename = NULL;
10350 int __pyx_clineno = 0;
10351 __Pyx_RefNannySetupContext(
"__get__", 0);
10360 __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
10370 __Pyx_XDECREF(__pyx_r);
10371 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error)
10372 __Pyx_GOTREF(__pyx_t_2);
10373 __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__16, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 577, __pyx_L1_error)
10374 __Pyx_GOTREF(__pyx_t_3);
10375 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10376 __pyx_r = __pyx_t_3;
10396 __Pyx_XDECREF(__pyx_r);
10397 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error)
10398 __Pyx_GOTREF(__pyx_t_3);
10399 __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
10400 for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
10401 __pyx_t_4 = __pyx_t_6;
10402 __pyx_v_suboffset = (__pyx_t_4[0]);
10403 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
10404 __Pyx_GOTREF(__pyx_t_2);
10405 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 579, __pyx_L1_error)
10406 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10408 __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3));
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
10409 __Pyx_GOTREF(__pyx_t_2);
10410 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10411 __pyx_r = __pyx_t_2;
10425 __Pyx_XDECREF(__pyx_t_2);
10426 __Pyx_XDECREF(__pyx_t_3);
10427 __Pyx_AddTraceback(
"View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10430 __Pyx_XGIVEREF(__pyx_r);
10431 __Pyx_RefNannyFinishContext();
10444 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self);
10445 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
10446 PyObject *__pyx_r = 0;
10447 __Pyx_RefNannyDeclarations
10448 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10449 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10452 __Pyx_RefNannyFinishContext();
10456 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10457 PyObject *__pyx_r = NULL;
10458 __Pyx_RefNannyDeclarations
10459 PyObject *__pyx_t_1 = NULL;
10460 int __pyx_lineno = 0;
10461 const char *__pyx_filename = NULL;
10462 int __pyx_clineno = 0;
10463 __Pyx_RefNannySetupContext(
"__get__", 0);
10472 __Pyx_XDECREF(__pyx_r);
10473 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error)
10474 __Pyx_GOTREF(__pyx_t_1);
10475 __pyx_r = __pyx_t_1;
10489 __Pyx_XDECREF(__pyx_t_1);
10490 __Pyx_AddTraceback(
"View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10493 __Pyx_XGIVEREF(__pyx_r);
10494 __Pyx_RefNannyFinishContext();
10507 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self);
10508 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
10509 PyObject *__pyx_r = 0;
10510 __Pyx_RefNannyDeclarations
10511 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10512 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10515 __Pyx_RefNannyFinishContext();
10519 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10520 PyObject *__pyx_r = NULL;
10521 __Pyx_RefNannyDeclarations
10522 PyObject *__pyx_t_1 = NULL;
10523 int __pyx_lineno = 0;
10524 const char *__pyx_filename = NULL;
10525 int __pyx_clineno = 0;
10526 __Pyx_RefNannySetupContext(
"__get__", 0);
10535 __Pyx_XDECREF(__pyx_r);
10536 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error)
10537 __Pyx_GOTREF(__pyx_t_1);
10538 __pyx_r = __pyx_t_1;
10552 __Pyx_XDECREF(__pyx_t_1);
10553 __Pyx_AddTraceback(
"View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10556 __Pyx_XGIVEREF(__pyx_r);
10557 __Pyx_RefNannyFinishContext();
10570 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self);
10571 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
10572 PyObject *__pyx_r = 0;
10573 __Pyx_RefNannyDeclarations
10574 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10575 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10578 __Pyx_RefNannyFinishContext();
10582 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10583 PyObject *__pyx_r = NULL;
10584 __Pyx_RefNannyDeclarations
10585 PyObject *__pyx_t_1 = NULL;
10586 PyObject *__pyx_t_2 = NULL;
10587 PyObject *__pyx_t_3 = NULL;
10588 int __pyx_lineno = 0;
10589 const char *__pyx_filename = NULL;
10590 int __pyx_clineno = 0;
10591 __Pyx_RefNannySetupContext(
"__get__", 0);
10600 __Pyx_XDECREF(__pyx_r);
10601 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error)
10602 __Pyx_GOTREF(__pyx_t_1);
10603 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error)
10604 __Pyx_GOTREF(__pyx_t_2);
10605 __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error)
10606 __Pyx_GOTREF(__pyx_t_3);
10607 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10608 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10609 __pyx_r = __pyx_t_3;
10623 __Pyx_XDECREF(__pyx_t_1);
10624 __Pyx_XDECREF(__pyx_t_2);
10625 __Pyx_XDECREF(__pyx_t_3);
10626 __Pyx_AddTraceback(
"View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10629 __Pyx_XGIVEREF(__pyx_r);
10630 __Pyx_RefNannyFinishContext();
10643 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self);
10644 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
10645 PyObject *__pyx_r = 0;
10646 __Pyx_RefNannyDeclarations
10647 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10648 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10651 __Pyx_RefNannyFinishContext();
10655 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10656 PyObject *__pyx_v_result = NULL;
10657 PyObject *__pyx_v_length = NULL;
10658 PyObject *__pyx_r = NULL;
10659 __Pyx_RefNannyDeclarations
10662 Py_ssize_t *__pyx_t_3;
10663 Py_ssize_t *__pyx_t_4;
10664 Py_ssize_t *__pyx_t_5;
10665 PyObject *__pyx_t_6 = NULL;
10666 int __pyx_lineno = 0;
10667 const char *__pyx_filename = NULL;
10668 int __pyx_clineno = 0;
10669 __Pyx_RefNannySetupContext(
"__get__", 0);
10678 __pyx_t_1 = (__pyx_v_self->_size == Py_None);
10679 __pyx_t_2 = (__pyx_t_1 != 0);
10689 __Pyx_INCREF(__pyx_int_1);
10690 __pyx_v_result = __pyx_int_1;
10699 __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
10700 for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
10701 __pyx_t_3 = __pyx_t_5;
10702 __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0]));
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 598, __pyx_L1_error)
10703 __Pyx_GOTREF(__pyx_t_6);
10704 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
10714 __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 599, __pyx_L1_error)
10715 __Pyx_GOTREF(__pyx_t_6);
10716 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
10727 __Pyx_INCREF(__pyx_v_result);
10728 __Pyx_GIVEREF(__pyx_v_result);
10729 __Pyx_GOTREF(__pyx_v_self->_size);
10730 __Pyx_DECREF(__pyx_v_self->_size);
10731 __pyx_v_self->_size = __pyx_v_result;
10749 __Pyx_XDECREF(__pyx_r);
10750 __Pyx_INCREF(__pyx_v_self->_size);
10751 __pyx_r = __pyx_v_self->_size;
10764 __Pyx_XDECREF(__pyx_t_6);
10765 __Pyx_AddTraceback(
"View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10768 __Pyx_XDECREF(__pyx_v_result);
10769 __Pyx_XDECREF(__pyx_v_length);
10770 __Pyx_XGIVEREF(__pyx_r);
10771 __Pyx_RefNannyFinishContext();
10784 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self);
10785 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
10786 Py_ssize_t __pyx_r;
10787 __Pyx_RefNannyDeclarations
10788 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
10789 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10792 __Pyx_RefNannyFinishContext();
10796 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10797 Py_ssize_t __pyx_r;
10798 __Pyx_RefNannyDeclarations
10800 __Pyx_RefNannySetupContext(
"__len__", 0);
10809 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
10819 __pyx_r = (__pyx_v_self->view.shape[0]);
10851 __Pyx_RefNannyFinishContext();
10864 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self);
10865 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
10866 PyObject *__pyx_r = 0;
10867 __Pyx_RefNannyDeclarations
10868 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
10869 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10872 __Pyx_RefNannyFinishContext();
10876 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10877 PyObject *__pyx_r = NULL;
10878 __Pyx_RefNannyDeclarations
10879 PyObject *__pyx_t_1 = NULL;
10880 PyObject *__pyx_t_2 = NULL;
10881 PyObject *__pyx_t_3 = NULL;
10882 int __pyx_lineno = 0;
10883 const char *__pyx_filename = NULL;
10884 int __pyx_clineno = 0;
10885 __Pyx_RefNannySetupContext(
"__repr__", 0);
10894 __Pyx_XDECREF(__pyx_r);
10895 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error)
10896 __Pyx_GOTREF(__pyx_t_1);
10897 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error)
10898 __Pyx_GOTREF(__pyx_t_2);
10899 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10900 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error)
10901 __Pyx_GOTREF(__pyx_t_1);
10902 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10911 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self));
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error)
10912 __Pyx_GOTREF(__pyx_t_2);
10921 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 612, __pyx_L1_error)
10922 __Pyx_GOTREF(__pyx_t_3);
10923 __Pyx_GIVEREF(__pyx_t_1);
10924 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
10925 __Pyx_GIVEREF(__pyx_t_2);
10926 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
10929 __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(0, 612, __pyx_L1_error)
10930 __Pyx_GOTREF(__pyx_t_2);
10931 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10932 __pyx_r = __pyx_t_2;
10946 __Pyx_XDECREF(__pyx_t_1);
10947 __Pyx_XDECREF(__pyx_t_2);
10948 __Pyx_XDECREF(__pyx_t_3);
10949 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10952 __Pyx_XGIVEREF(__pyx_r);
10953 __Pyx_RefNannyFinishContext();
10966 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self);
10967 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
10968 PyObject *__pyx_r = 0;
10969 __Pyx_RefNannyDeclarations
10970 __Pyx_RefNannySetupContext(
"__str__ (wrapper)", 0);
10971 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10974 __Pyx_RefNannyFinishContext();
10978 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10979 PyObject *__pyx_r = NULL;
10980 __Pyx_RefNannyDeclarations
10981 PyObject *__pyx_t_1 = NULL;
10982 PyObject *__pyx_t_2 = NULL;
10983 int __pyx_lineno = 0;
10984 const char *__pyx_filename = NULL;
10985 int __pyx_clineno = 0;
10986 __Pyx_RefNannySetupContext(
"__str__", 0);
10995 __Pyx_XDECREF(__pyx_r);
10996 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 616, __pyx_L1_error)
10997 __Pyx_GOTREF(__pyx_t_1);
10998 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 616, __pyx_L1_error)
10999 __Pyx_GOTREF(__pyx_t_2);
11000 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11001 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 616, __pyx_L1_error)
11002 __Pyx_GOTREF(__pyx_t_1);
11003 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11004 __pyx_t_2 = PyTuple_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 616, __pyx_L1_error)
11005 __Pyx_GOTREF(__pyx_t_2);
11006 __Pyx_GIVEREF(__pyx_t_1);
11007 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
11009 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 616, __pyx_L1_error)
11010 __Pyx_GOTREF(__pyx_t_1);
11011 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11012 __pyx_r = __pyx_t_1;
11026 __Pyx_XDECREF(__pyx_t_1);
11027 __Pyx_XDECREF(__pyx_t_2);
11028 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11031 __Pyx_XGIVEREF(__pyx_r);
11032 __Pyx_RefNannyFinishContext();
11045 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
11046 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11047 PyObject *__pyx_r = 0;
11048 __Pyx_RefNannyDeclarations
11049 __Pyx_RefNannySetupContext(
"is_c_contig (wrapper)", 0);
11050 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11053 __Pyx_RefNannyFinishContext();
11057 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
11058 __Pyx_memviewslice *__pyx_v_mslice;
11059 __Pyx_memviewslice __pyx_v_tmp;
11060 PyObject *__pyx_r = NULL;
11061 __Pyx_RefNannyDeclarations
11062 __Pyx_memviewslice *__pyx_t_1;
11063 PyObject *__pyx_t_2 = NULL;
11064 int __pyx_lineno = 0;
11065 const char *__pyx_filename = NULL;
11066 int __pyx_clineno = 0;
11067 __Pyx_RefNannySetupContext(
"is_c_contig", 0);
11076 __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(0, 622, __pyx_L1_error)
11077 __pyx_v_mslice = __pyx_t_1;
11086 __Pyx_XDECREF(__pyx_r);
11087 __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(0, 623, __pyx_L1_error)
11088 __Pyx_GOTREF(__pyx_t_2);
11089 __pyx_r = __pyx_t_2;
11103 __Pyx_XDECREF(__pyx_t_2);
11104 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
11107 __Pyx_XGIVEREF(__pyx_r);
11108 __Pyx_RefNannyFinishContext();
11121 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
11122 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11123 PyObject *__pyx_r = 0;
11124 __Pyx_RefNannyDeclarations
11125 __Pyx_RefNannySetupContext(
"is_f_contig (wrapper)", 0);
11126 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11129 __Pyx_RefNannyFinishContext();
11133 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
11134 __Pyx_memviewslice *__pyx_v_mslice;
11135 __Pyx_memviewslice __pyx_v_tmp;
11136 PyObject *__pyx_r = NULL;
11137 __Pyx_RefNannyDeclarations
11138 __Pyx_memviewslice *__pyx_t_1;
11139 PyObject *__pyx_t_2 = NULL;
11140 int __pyx_lineno = 0;
11141 const char *__pyx_filename = NULL;
11142 int __pyx_clineno = 0;
11143 __Pyx_RefNannySetupContext(
"is_f_contig", 0);
11152 __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(0, 628, __pyx_L1_error)
11153 __pyx_v_mslice = __pyx_t_1;
11162 __Pyx_XDECREF(__pyx_r);
11163 __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(0, 629, __pyx_L1_error)
11164 __Pyx_GOTREF(__pyx_t_2);
11165 __pyx_r = __pyx_t_2;
11179 __Pyx_XDECREF(__pyx_t_2);
11180 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
11183 __Pyx_XGIVEREF(__pyx_r);
11184 __Pyx_RefNannyFinishContext();
11197 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
11198 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11199 PyObject *__pyx_r = 0;
11200 __Pyx_RefNannyDeclarations
11201 __Pyx_RefNannySetupContext(
"copy (wrapper)", 0);
11202 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11205 __Pyx_RefNannyFinishContext();
11209 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self) {
11210 __Pyx_memviewslice __pyx_v_mslice;
11212 PyObject *__pyx_r = NULL;
11213 __Pyx_RefNannyDeclarations
11214 __Pyx_memviewslice __pyx_t_1;
11215 PyObject *__pyx_t_2 = NULL;
11216 int __pyx_lineno = 0;
11217 const char *__pyx_filename = NULL;
11218 int __pyx_clineno = 0;
11219 __Pyx_RefNannySetupContext(
"copy", 0);
11228 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
11237 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
11246 __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(0, 636, __pyx_L1_error)
11247 __pyx_v_mslice = __pyx_t_1;
11256 __Pyx_XDECREF(__pyx_r);
11257 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice));
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error)
11258 __Pyx_GOTREF(__pyx_t_2);
11259 __pyx_r = __pyx_t_2;
11273 __Pyx_XDECREF(__pyx_t_2);
11274 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
11277 __Pyx_XGIVEREF(__pyx_r);
11278 __Pyx_RefNannyFinishContext();
11291 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
11292 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11293 PyObject *__pyx_r = 0;
11294 __Pyx_RefNannyDeclarations
11295 __Pyx_RefNannySetupContext(
"copy_fortran (wrapper)", 0);
11296 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11299 __Pyx_RefNannyFinishContext();
11303 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self) {
11304 __Pyx_memviewslice __pyx_v_src;
11305 __Pyx_memviewslice __pyx_v_dst;
11307 PyObject *__pyx_r = NULL;
11308 __Pyx_RefNannyDeclarations
11309 __Pyx_memviewslice __pyx_t_1;
11310 PyObject *__pyx_t_2 = NULL;
11311 int __pyx_lineno = 0;
11312 const char *__pyx_filename = NULL;
11313 int __pyx_clineno = 0;
11314 __Pyx_RefNannySetupContext(
"copy_fortran", 0);
11323 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
11332 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
11341 __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(0, 648, __pyx_L1_error)
11342 __pyx_v_dst = __pyx_t_1;
11351 __Pyx_XDECREF(__pyx_r);
11352 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst));
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error)
11353 __Pyx_GOTREF(__pyx_t_2);
11354 __pyx_r = __pyx_t_2;
11368 __Pyx_XDECREF(__pyx_t_2);
11369 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
11372 __Pyx_XGIVEREF(__pyx_r);
11373 __Pyx_RefNannyFinishContext();
11384 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
11385 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11386 PyObject *__pyx_r = 0;
11387 __Pyx_RefNannyDeclarations
11388 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
11389 __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11392 __Pyx_RefNannyFinishContext();
11396 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self) {
11397 PyObject *__pyx_r = NULL;
11398 __Pyx_RefNannyDeclarations
11399 PyObject *__pyx_t_1 = NULL;
11400 int __pyx_lineno = 0;
11401 const char *__pyx_filename = NULL;
11402 int __pyx_clineno = 0;
11403 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
11411 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
11412 __Pyx_GOTREF(__pyx_t_1);
11413 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11414 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11415 __PYX_ERR(0, 2, __pyx_L1_error)
11425 __Pyx_XDECREF(__pyx_t_1);
11426 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11428 __Pyx_XGIVEREF(__pyx_r);
11429 __Pyx_RefNannyFinishContext();
11441 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
11442 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
11443 PyObject *__pyx_r = 0;
11444 __Pyx_RefNannyDeclarations
11445 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
11446 __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
11449 __Pyx_RefNannyFinishContext();
11453 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) {
11454 PyObject *__pyx_r = NULL;
11455 __Pyx_RefNannyDeclarations
11456 PyObject *__pyx_t_1 = NULL;
11457 int __pyx_lineno = 0;
11458 const char *__pyx_filename = NULL;
11459 int __pyx_clineno = 0;
11460 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
11467 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
11468 __Pyx_GOTREF(__pyx_t_1);
11469 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11470 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11471 __PYX_ERR(0, 4, __pyx_L1_error)
11482 __Pyx_XDECREF(__pyx_t_1);
11483 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11485 __Pyx_XGIVEREF(__pyx_r);
11486 __Pyx_RefNannyFinishContext();
11498 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o,
int __pyx_v_flags,
int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
11499 struct __pyx_memoryview_obj *__pyx_v_result = 0;
11500 PyObject *__pyx_r = NULL;
11501 __Pyx_RefNannyDeclarations
11502 PyObject *__pyx_t_1 = NULL;
11503 PyObject *__pyx_t_2 = NULL;
11504 PyObject *__pyx_t_3 = NULL;
11505 int __pyx_lineno = 0;
11506 const char *__pyx_filename = NULL;
11507 int __pyx_clineno = 0;
11508 __Pyx_RefNannySetupContext(
"memoryview_cwrapper", 0);
11517 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error)
11518 __Pyx_GOTREF(__pyx_t_1);
11519 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error)
11520 __Pyx_GOTREF(__pyx_t_2);
11521 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 658, __pyx_L1_error)
11522 __Pyx_GOTREF(__pyx_t_3);
11523 __Pyx_INCREF(__pyx_v_o);
11524 __Pyx_GIVEREF(__pyx_v_o);
11525 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
11526 __Pyx_GIVEREF(__pyx_t_1);
11527 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
11528 __Pyx_GIVEREF(__pyx_t_2);
11529 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
11532 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error)
11533 __Pyx_GOTREF(__pyx_t_2);
11534 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11535 __pyx_v_result = ((
struct __pyx_memoryview_obj *)__pyx_t_2);
11545 __pyx_v_result->typeinfo = __pyx_v_typeinfo;
11554 __Pyx_XDECREF(__pyx_r);
11555 __Pyx_INCREF(((PyObject *)__pyx_v_result));
11556 __pyx_r = ((PyObject *)__pyx_v_result);
11569 __Pyx_XDECREF(__pyx_t_1);
11570 __Pyx_XDECREF(__pyx_t_2);
11571 __Pyx_XDECREF(__pyx_t_3);
11572 __Pyx_AddTraceback(
"View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
11575 __Pyx_XDECREF((PyObject *)__pyx_v_result);
11576 __Pyx_XGIVEREF(__pyx_r);
11577 __Pyx_RefNannyFinishContext();
11589 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *__pyx_v_o) {
11591 __Pyx_RefNannyDeclarations
11593 __Pyx_RefNannySetupContext(
"memoryview_check", 0);
11602 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
11603 __pyx_r = __pyx_t_1;
11616 __Pyx_RefNannyFinishContext();
11628 static PyObject *_unellipsify(PyObject *__pyx_v_index,
int __pyx_v_ndim) {
11629 PyObject *__pyx_v_tup = NULL;
11630 PyObject *__pyx_v_result = NULL;
11631 int __pyx_v_have_slices;
11632 int __pyx_v_seen_ellipsis;
11633 CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
11634 PyObject *__pyx_v_item = NULL;
11635 Py_ssize_t __pyx_v_nslices;
11636 PyObject *__pyx_r = NULL;
11637 __Pyx_RefNannyDeclarations
11640 PyObject *__pyx_t_3 = NULL;
11641 PyObject *__pyx_t_4 = NULL;
11642 Py_ssize_t __pyx_t_5;
11643 PyObject *(*__pyx_t_6)(PyObject *);
11644 PyObject *__pyx_t_7 = NULL;
11645 Py_ssize_t __pyx_t_8;
11648 PyObject *__pyx_t_11 = NULL;
11649 int __pyx_lineno = 0;
11650 const char *__pyx_filename = NULL;
11651 int __pyx_clineno = 0;
11652 __Pyx_RefNannySetupContext(
"_unellipsify", 0);
11661 __pyx_t_1 = PyTuple_Check(__pyx_v_index);
11662 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
11672 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 672, __pyx_L1_error)
11673 __Pyx_GOTREF(__pyx_t_3);
11674 __Pyx_INCREF(__pyx_v_index);
11675 __Pyx_GIVEREF(__pyx_v_index);
11676 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
11677 __pyx_v_tup = __pyx_t_3;
11698 __Pyx_INCREF(__pyx_v_index);
11699 __pyx_v_tup = __pyx_v_index;
11710 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error)
11711 __Pyx_GOTREF(__pyx_t_3);
11712 __pyx_v_result = ((PyObject*)__pyx_t_3);
11722 __pyx_v_have_slices = 0;
11731 __pyx_v_seen_ellipsis = 0;
11740 __Pyx_INCREF(__pyx_int_0);
11741 __pyx_t_3 = __pyx_int_0;
11742 if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
11743 __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
11746 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 679, __pyx_L1_error)
11747 __Pyx_GOTREF(__pyx_t_4);
11748 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 679, __pyx_L1_error)
11751 if (likely(!__pyx_t_6)) {
11752 if (likely(PyList_CheckExact(__pyx_t_4))) {
11753 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4))
break;
11754 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11755 __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(0, 679, __pyx_L1_error)
11757 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 679, __pyx_L1_error)
11758 __Pyx_GOTREF(__pyx_t_7);
11761 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
11762 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11763 __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(0, 679, __pyx_L1_error)
11765 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 679, __pyx_L1_error)
11766 __Pyx_GOTREF(__pyx_t_7);
11770 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
11771 if (unlikely(!__pyx_t_7)) {
11772 PyObject* exc_type = PyErr_Occurred();
11774 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
11775 else __PYX_ERR(0, 679, __pyx_L1_error)
11779 __Pyx_GOTREF(__pyx_t_7);
11781 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
11783 __Pyx_INCREF(__pyx_t_3);
11784 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
11785 __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 679, __pyx_L1_error)
11786 __Pyx_GOTREF(__pyx_t_7);
11787 __Pyx_DECREF(__pyx_t_3);
11788 __pyx_t_3 = __pyx_t_7;
11798 __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
11799 __pyx_t_1 = (__pyx_t_2 != 0);
11809 __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
11819 __pyx_t_8 = PyObject_Length(__pyx_v_tup);
if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 682, __pyx_L1_error)
11820 __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(0, 682, __pyx_L1_error)
11821 __Pyx_GOTREF(__pyx_t_7);
11822 { Py_ssize_t __pyx_temp;
11823 for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
11824 __Pyx_INCREF(__pyx_slice__19);
11825 __Pyx_GIVEREF(__pyx_slice__19);
11826 PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__19);
11829 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(0, 682, __pyx_L1_error)
11830 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11839 __pyx_v_seen_ellipsis = 1;
11859 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__19);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(0, 685, __pyx_L1_error)
11870 __pyx_v_have_slices = 1;
11890 __pyx_t_2 = PySlice_Check(__pyx_v_item);
11891 __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
11894 __pyx_t_1 = __pyx_t_10;
11895 goto __pyx_L9_bool_binop_done;
11897 __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
11898 __pyx_t_1 = __pyx_t_10;
11899 __pyx_L9_bool_binop_done:;
11900 if (unlikely(__pyx_t_1)) {
11909 __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(0, 689, __pyx_L1_error)
11910 __Pyx_GOTREF(__pyx_t_7);
11911 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 689, __pyx_L1_error)
11912 __Pyx_GOTREF(__pyx_t_11);
11913 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11914 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
11915 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
11916 __PYX_ERR(0, 689, __pyx_L1_error)
11934 __pyx_t_10 = (__pyx_v_have_slices != 0);
11937 __pyx_t_1 = __pyx_t_10;
11938 goto __pyx_L11_bool_binop_done;
11940 __pyx_t_10 = PySlice_Check(__pyx_v_item);
11941 __pyx_t_2 = (__pyx_t_10 != 0);
11942 __pyx_t_1 = __pyx_t_2;
11943 __pyx_L11_bool_binop_done:;
11944 __pyx_v_have_slices = __pyx_t_1;
11953 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(0, 692, __pyx_L1_error)
11965 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11966 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11975 __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result);
if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 694, __pyx_L1_error)
11976 __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
11985 __pyx_t_1 = (__pyx_v_nslices != 0);
11995 __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 696, __pyx_L1_error)
11996 __Pyx_GOTREF(__pyx_t_3);
11997 { Py_ssize_t __pyx_temp;
11998 for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
11999 __Pyx_INCREF(__pyx_slice__19);
12000 __Pyx_GIVEREF(__pyx_slice__19);
12001 PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__19);
12004 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(0, 696, __pyx_L1_error)
12005 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12023 __Pyx_XDECREF(__pyx_r);
12024 if (!__pyx_v_have_slices) {
12026 __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
12027 __Pyx_GOTREF(__pyx_t_4);
12028 __pyx_t_3 = __pyx_t_4;
12030 goto __pyx_L14_bool_binop_done;
12032 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
12033 __Pyx_GOTREF(__pyx_t_4);
12034 __pyx_t_3 = __pyx_t_4;
12036 __pyx_L14_bool_binop_done:;
12037 __pyx_t_4 = PyList_AsTuple(__pyx_v_result);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
12038 __Pyx_GOTREF(__pyx_t_4);
12039 __pyx_t_11 = PyTuple_New(2);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 698, __pyx_L1_error)
12040 __Pyx_GOTREF(__pyx_t_11);
12041 __Pyx_GIVEREF(__pyx_t_3);
12042 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
12043 __Pyx_GIVEREF(__pyx_t_4);
12044 PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
12047 __pyx_r = ((PyObject*)__pyx_t_11);
12061 __Pyx_XDECREF(__pyx_t_3);
12062 __Pyx_XDECREF(__pyx_t_4);
12063 __Pyx_XDECREF(__pyx_t_7);
12064 __Pyx_XDECREF(__pyx_t_11);
12065 __Pyx_AddTraceback(
"View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
12068 __Pyx_XDECREF(__pyx_v_tup);
12069 __Pyx_XDECREF(__pyx_v_result);
12070 __Pyx_XDECREF(__pyx_v_idx);
12071 __Pyx_XDECREF(__pyx_v_item);
12072 __Pyx_XGIVEREF(__pyx_r);
12073 __Pyx_RefNannyFinishContext();
12085 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets,
int __pyx_v_ndim) {
12086 Py_ssize_t __pyx_v_suboffset;
12087 PyObject *__pyx_r = NULL;
12088 __Pyx_RefNannyDeclarations
12089 Py_ssize_t *__pyx_t_1;
12090 Py_ssize_t *__pyx_t_2;
12091 Py_ssize_t *__pyx_t_3;
12093 PyObject *__pyx_t_5 = NULL;
12094 int __pyx_lineno = 0;
12095 const char *__pyx_filename = NULL;
12096 int __pyx_clineno = 0;
12097 __Pyx_RefNannySetupContext(
"assert_direct_dimensions", 0);
12106 __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
12107 for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
12108 __pyx_t_1 = __pyx_t_3;
12109 __pyx_v_suboffset = (__pyx_t_1[0]);
12118 __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
12119 if (unlikely(__pyx_t_4)) {
12128 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 703, __pyx_L1_error)
12129 __Pyx_GOTREF(__pyx_t_5);
12130 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
12131 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12132 __PYX_ERR(0, 703, __pyx_L1_error)
12153 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12156 __Pyx_XDECREF(__pyx_t_5);
12157 __Pyx_AddTraceback(
"View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
12160 __Pyx_XGIVEREF(__pyx_r);
12161 __Pyx_RefNannyFinishContext();
12173 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
12174 int __pyx_v_new_ndim;
12175 int __pyx_v_suboffset_dim;
12177 __Pyx_memviewslice __pyx_v_src;
12178 __Pyx_memviewslice __pyx_v_dst;
12179 __Pyx_memviewslice *__pyx_v_p_src;
12180 struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
12181 __Pyx_memviewslice *__pyx_v_p_dst;
12182 int *__pyx_v_p_suboffset_dim;
12183 Py_ssize_t __pyx_v_start;
12184 Py_ssize_t __pyx_v_stop;
12185 Py_ssize_t __pyx_v_step;
12186 int __pyx_v_have_start;
12187 int __pyx_v_have_stop;
12188 int __pyx_v_have_step;
12189 PyObject *__pyx_v_index = NULL;
12190 struct __pyx_memoryview_obj *__pyx_r = NULL;
12191 __Pyx_RefNannyDeclarations
12194 PyObject *__pyx_t_3 = NULL;
12195 struct __pyx_memoryview_obj *__pyx_t_4;
12198 Py_ssize_t __pyx_t_7;
12199 PyObject *(*__pyx_t_8)(PyObject *);
12200 PyObject *__pyx_t_9 = NULL;
12201 Py_ssize_t __pyx_t_10;
12203 Py_ssize_t __pyx_t_12;
12204 int __pyx_lineno = 0;
12205 const char *__pyx_filename = NULL;
12206 int __pyx_clineno = 0;
12207 __Pyx_RefNannySetupContext(
"memview_slice", 0);
12216 __pyx_v_new_ndim = 0;
12217 __pyx_v_suboffset_dim = -1;
12226 (void)(memset((&__pyx_v_dst), 0, (
sizeof(__pyx_v_dst))));
12235 #ifndef CYTHON_WITHOUT_ASSERTIONS
12236 if (unlikely(!Py_OptimizeFlag)) {
12237 if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
12238 PyErr_SetNone(PyExc_AssertionError);
12239 __PYX_ERR(0, 722, __pyx_L1_error)
12251 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
12252 __pyx_t_2 = (__pyx_t_1 != 0);
12262 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(0, 725, __pyx_L1_error)
12263 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
12264 __Pyx_INCREF(__pyx_t_3);
12265 __pyx_v_memviewsliceobj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
12275 __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
12295 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
12304 __pyx_v_p_src = (&__pyx_v_src);
12315 __pyx_t_4 = __pyx_v_p_src->memview;
12316 __pyx_v_dst.memview = __pyx_t_4;
12325 __pyx_t_5 = __pyx_v_p_src->data;
12326 __pyx_v_dst.data = __pyx_t_5;
12335 __pyx_v_p_dst = (&__pyx_v_dst);
12344 __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
12354 if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
12355 __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
12358 __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 746, __pyx_L1_error)
12359 __Pyx_GOTREF(__pyx_t_3);
12360 __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 746, __pyx_L1_error)
12363 if (likely(!__pyx_t_8)) {
12364 if (likely(PyList_CheckExact(__pyx_t_3))) {
12365 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3))
break;
12366 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12367 __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(0, 746, __pyx_L1_error)
12369 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 746, __pyx_L1_error)
12370 __Pyx_GOTREF(__pyx_t_9);
12373 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
12374 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12375 __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(0, 746, __pyx_L1_error)
12377 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 746, __pyx_L1_error)
12378 __Pyx_GOTREF(__pyx_t_9);
12382 __pyx_t_9 = __pyx_t_8(__pyx_t_3);
12383 if (unlikely(!__pyx_t_9)) {
12384 PyObject* exc_type = PyErr_Occurred();
12386 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12387 else __PYX_ERR(0, 746, __pyx_L1_error)
12391 __Pyx_GOTREF(__pyx_t_9);
12393 __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
12395 __pyx_v_dim = __pyx_t_6;
12396 __pyx_t_6 = (__pyx_t_6 + 1);
12405 __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
12415 __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index);
if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 751, __pyx_L1_error)
12424 __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(0, 748, __pyx_L1_error)
12443 __pyx_t_2 = (__pyx_v_index == Py_None);
12444 __pyx_t_1 = (__pyx_t_2 != 0);
12454 (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
12463 (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
12472 (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1
L;
12481 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
12501 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 760, __pyx_L1_error)
12502 __Pyx_GOTREF(__pyx_t_9);
12503 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 760, __pyx_L1_error)
12505 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12507 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 760, __pyx_L1_error)
12508 __pyx_t_10 = __pyx_t_12;
12509 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12510 goto __pyx_L7_bool_binop_done;
12513 __pyx_L7_bool_binop_done:;
12514 __pyx_v_start = __pyx_t_10;
12523 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 761, __pyx_L1_error)
12524 __Pyx_GOTREF(__pyx_t_9);
12525 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 761, __pyx_L1_error)
12527 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12529 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 761, __pyx_L1_error)
12530 __pyx_t_10 = __pyx_t_12;
12531 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12532 goto __pyx_L9_bool_binop_done;
12535 __pyx_L9_bool_binop_done:;
12536 __pyx_v_stop = __pyx_t_10;
12545 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 762, __pyx_L1_error)
12546 __Pyx_GOTREF(__pyx_t_9);
12547 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 762, __pyx_L1_error)
12549 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12551 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 762, __pyx_L1_error)
12552 __pyx_t_10 = __pyx_t_12;
12553 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12554 goto __pyx_L11_bool_binop_done;
12557 __pyx_L11_bool_binop_done:;
12558 __pyx_v_step = __pyx_t_10;
12567 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 764, __pyx_L1_error)
12568 __Pyx_GOTREF(__pyx_t_9);
12569 __pyx_t_1 = (__pyx_t_9 != Py_None);
12570 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12571 __pyx_v_have_start = __pyx_t_1;
12580 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 765, __pyx_L1_error)
12581 __Pyx_GOTREF(__pyx_t_9);
12582 __pyx_t_1 = (__pyx_t_9 != Py_None);
12583 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12584 __pyx_v_have_stop = __pyx_t_1;
12593 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 766, __pyx_L1_error)
12594 __Pyx_GOTREF(__pyx_t_9);
12595 __pyx_t_1 = (__pyx_t_9 != Py_None);
12596 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12597 __pyx_v_have_step = __pyx_t_1;
12606 __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(0, 768, __pyx_L1_error)
12615 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
12627 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12636 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
12637 __pyx_t_2 = (__pyx_t_1 != 0);
12647 __Pyx_XDECREF(((PyObject *)__pyx_r));
12656 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(0, 778, __pyx_L1_error) }
12665 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(0, 779, __pyx_L1_error) }
12674 __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(0, 777, __pyx_L1_error)
12675 __Pyx_GOTREF(__pyx_t_3);
12676 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(0, 777, __pyx_L1_error)
12677 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
12698 __Pyx_XDECREF(((PyObject *)__pyx_r));
12707 __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(0, 782, __pyx_L1_error)
12708 __Pyx_GOTREF(__pyx_t_3);
12717 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(0, 782, __pyx_L1_error)
12718 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
12733 __Pyx_XDECREF(__pyx_t_3);
12734 __Pyx_XDECREF(__pyx_t_9);
12735 __Pyx_AddTraceback(
"View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
12738 __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
12739 __Pyx_XDECREF(__pyx_v_index);
12740 __Pyx_XGIVEREF((PyObject *)__pyx_r);
12741 __Pyx_RefNannyFinishContext();
12753 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) {
12754 Py_ssize_t __pyx_v_new_shape;
12755 int __pyx_v_negative_step;
12760 int __pyx_lineno = 0;
12761 const char *__pyx_filename = NULL;
12762 int __pyx_clineno = 0;
12771 __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
12781 __pyx_t_1 = ((__pyx_v_start < 0) != 0);
12791 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
12809 __pyx_t_1 = (0 <= __pyx_v_start);
12811 __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
12813 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
12823 __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(0, 832, __pyx_L1_error)
12852 __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
12855 __pyx_t_2 = __pyx_t_1;
12856 goto __pyx_L6_bool_binop_done;
12858 __pyx_t_1 = ((__pyx_v_step < 0) != 0);
12859 __pyx_t_2 = __pyx_t_1;
12860 __pyx_L6_bool_binop_done:;
12861 __pyx_v_negative_step = __pyx_t_2;
12870 __pyx_t_1 = (__pyx_v_have_step != 0);
12873 __pyx_t_2 = __pyx_t_1;
12874 goto __pyx_L9_bool_binop_done;
12876 __pyx_t_1 = ((__pyx_v_step == 0) != 0);
12877 __pyx_t_2 = __pyx_t_1;
12878 __pyx_L9_bool_binop_done:;
12888 __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(0, 838, __pyx_L1_error)
12906 __pyx_t_2 = (__pyx_v_have_start != 0);
12916 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
12926 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
12935 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
12973 __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
12983 __pyx_t_2 = (__pyx_v_negative_step != 0);
12993 __pyx_v_start = (__pyx_v_shape - 1);
13013 __pyx_v_start = __pyx_v_shape;
13045 __pyx_t_2 = (__pyx_v_negative_step != 0);
13055 __pyx_v_start = (__pyx_v_shape - 1);
13088 __pyx_t_2 = (__pyx_v_have_stop != 0);
13098 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
13108 __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
13117 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
13155 __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
13165 __pyx_v_stop = __pyx_v_shape;
13195 __pyx_t_2 = (__pyx_v_negative_step != 0);
13205 __pyx_v_stop = -1
L;
13225 __pyx_v_stop = __pyx_v_shape;
13238 __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
13266 __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
13275 __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
13285 __pyx_v_new_shape = (__pyx_v_new_shape + 1);
13303 __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
13313 __pyx_v_new_shape = 0;
13331 (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
13340 (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
13349 (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
13360 __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
13370 __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
13390 __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
13391 (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
13402 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
13412 __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
13422 __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
13432 __pyx_v_dst->data = ((((
char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
13460 __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(0, 899, __pyx_L1_error)
13482 (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
13517 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
13519 __Pyx_AddTraceback(
"View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
13521 __Pyx_PyGILState_Release(__pyx_gilstate_save);
13537 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) {
13538 Py_ssize_t __pyx_v_shape;
13539 Py_ssize_t __pyx_v_stride;
13540 Py_ssize_t __pyx_v_suboffset;
13541 Py_ssize_t __pyx_v_itemsize;
13542 char *__pyx_v_resultp;
13544 __Pyx_RefNannyDeclarations
13545 Py_ssize_t __pyx_t_1;
13547 PyObject *__pyx_t_3 = NULL;
13548 PyObject *__pyx_t_4 = NULL;
13549 int __pyx_lineno = 0;
13550 const char *__pyx_filename = NULL;
13551 int __pyx_clineno = 0;
13552 __Pyx_RefNannySetupContext(
"pybuffer_index", 0);
13561 __pyx_v_suboffset = -1
L;
13570 __pyx_t_1 = __pyx_v_view->itemsize;
13571 __pyx_v_itemsize = __pyx_t_1;
13580 __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
13590 if (unlikely(__pyx_v_itemsize == 0)) {
13591 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
13592 __PYX_ERR(0, 917, __pyx_L1_error)
13594 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))) {
13595 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
13596 __PYX_ERR(0, 917, __pyx_L1_error)
13598 __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
13607 __pyx_v_stride = __pyx_v_itemsize;
13627 __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
13636 __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
13645 __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
13655 __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
13675 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
13685 __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
13694 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
13695 if (unlikely(__pyx_t_2)) {
13704 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 928, __pyx_L1_error)
13705 __Pyx_GOTREF(__pyx_t_3);
13706 __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(0, 928, __pyx_L1_error)
13707 __Pyx_GOTREF(__pyx_t_4);
13708 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13709 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 928, __pyx_L1_error)
13710 __Pyx_GOTREF(__pyx_t_3);
13711 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13712 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
13713 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13714 __PYX_ERR(0, 928, __pyx_L1_error)
13741 __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
13742 if (unlikely(__pyx_t_2)) {
13751 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 931, __pyx_L1_error)
13752 __Pyx_GOTREF(__pyx_t_3);
13753 __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(0, 931, __pyx_L1_error)
13754 __Pyx_GOTREF(__pyx_t_4);
13755 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13756 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 931, __pyx_L1_error)
13757 __Pyx_GOTREF(__pyx_t_3);
13758 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13759 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
13760 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13761 __PYX_ERR(0, 931, __pyx_L1_error)
13779 __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
13788 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
13798 __pyx_v_resultp = ((((
char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
13816 __pyx_r = __pyx_v_resultp;
13829 __Pyx_XDECREF(__pyx_t_3);
13830 __Pyx_XDECREF(__pyx_t_4);
13831 __Pyx_AddTraceback(
"View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
13834 __Pyx_RefNannyFinishContext();
13846 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
13848 Py_ssize_t *__pyx_v_shape;
13849 Py_ssize_t *__pyx_v_strides;
13854 Py_ssize_t *__pyx_t_2;
13857 Py_ssize_t __pyx_t_5;
13858 Py_ssize_t __pyx_t_6;
13862 int __pyx_lineno = 0;
13863 const char *__pyx_filename = NULL;
13864 int __pyx_clineno = 0;
13873 __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
13874 __pyx_v_ndim = __pyx_t_1;
13883 __pyx_t_2 = __pyx_v_memslice->shape;
13884 __pyx_v_shape = __pyx_t_2;
13893 __pyx_t_2 = __pyx_v_memslice->strides;
13894 __pyx_v_strides = __pyx_t_2;
13903 __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
13904 __pyx_t_4 = __pyx_t_3;
13905 for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
13906 __pyx_v_i = __pyx_t_1;
13915 __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
13924 __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
13925 __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
13926 (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
13927 (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
13936 __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
13937 __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
13938 (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
13939 (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
13948 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
13951 __pyx_t_7 = __pyx_t_8;
13952 goto __pyx_L6_bool_binop_done;
13954 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
13955 __pyx_t_7 = __pyx_t_8;
13956 __pyx_L6_bool_binop_done:;
13966 __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(0, 957, __pyx_L1_error)
14000 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
14002 __Pyx_AddTraceback(
"View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14004 __Pyx_PyGILState_Release(__pyx_gilstate_save);
14021 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self);
14022 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
14023 __Pyx_RefNannyDeclarations
14024 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
14025 __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
14028 __Pyx_RefNannyFinishContext();
14031 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
14032 __Pyx_RefNannyDeclarations
14033 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
14042 __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
14053 __Pyx_RefNannyFinishContext();
14064 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp) {
14065 PyObject *__pyx_r = NULL;
14066 __Pyx_RefNannyDeclarations
14068 PyObject *__pyx_t_2 = NULL;
14069 int __pyx_lineno = 0;
14070 const char *__pyx_filename = NULL;
14071 int __pyx_clineno = 0;
14072 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
14081 __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
14091 __Pyx_XDECREF(__pyx_r);
14092 __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 981, __pyx_L1_error)
14093 __Pyx_GOTREF(__pyx_t_2);
14094 __pyx_r = __pyx_t_2;
14115 __Pyx_XDECREF(__pyx_r);
14116 __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(0, 983, __pyx_L1_error)
14117 __Pyx_GOTREF(__pyx_t_2);
14118 __pyx_r = __pyx_t_2;
14133 __Pyx_XDECREF(__pyx_t_2);
14134 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14137 __Pyx_XGIVEREF(__pyx_r);
14138 __Pyx_RefNannyFinishContext();
14150 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
14151 PyObject *__pyx_r = NULL;
14152 __Pyx_RefNannyDeclarations
14155 PyObject *__pyx_t_3 = NULL;
14156 int __pyx_lineno = 0;
14157 const char *__pyx_filename = NULL;
14158 int __pyx_clineno = 0;
14159 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
14168 __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
14178 __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value);
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(0, 987, __pyx_L1_error)
14198 __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(0, 989, __pyx_L1_error)
14199 __Pyx_GOTREF(__pyx_t_3);
14200 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14213 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14216 __Pyx_XDECREF(__pyx_t_3);
14217 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14220 __Pyx_XGIVEREF(__pyx_r);
14221 __Pyx_RefNannyFinishContext();
14234 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self);
14235 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
14236 PyObject *__pyx_r = 0;
14237 __Pyx_RefNannyDeclarations
14238 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
14239 __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
14242 __Pyx_RefNannyFinishContext();
14246 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
14247 PyObject *__pyx_r = NULL;
14248 __Pyx_RefNannyDeclarations
14249 __Pyx_RefNannySetupContext(
"__get__", 0);
14258 __Pyx_XDECREF(__pyx_r);
14259 __Pyx_INCREF(__pyx_v_self->from_object);
14260 __pyx_r = __pyx_v_self->from_object;
14273 __Pyx_XGIVEREF(__pyx_r);
14274 __Pyx_RefNannyFinishContext();
14285 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14286 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14287 PyObject *__pyx_r = 0;
14288 __Pyx_RefNannyDeclarations
14289 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
14290 __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
14293 __Pyx_RefNannyFinishContext();
14297 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
14298 PyObject *__pyx_r = NULL;
14299 __Pyx_RefNannyDeclarations
14300 PyObject *__pyx_t_1 = NULL;
14301 int __pyx_lineno = 0;
14302 const char *__pyx_filename = NULL;
14303 int __pyx_clineno = 0;
14304 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
14312 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
14313 __Pyx_GOTREF(__pyx_t_1);
14314 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14315 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14316 __PYX_ERR(0, 2, __pyx_L1_error)
14326 __Pyx_XDECREF(__pyx_t_1);
14327 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14329 __Pyx_XGIVEREF(__pyx_r);
14330 __Pyx_RefNannyFinishContext();
14342 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
14343 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
14344 PyObject *__pyx_r = 0;
14345 __Pyx_RefNannyDeclarations
14346 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
14347 __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
14350 __Pyx_RefNannyFinishContext();
14354 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) {
14355 PyObject *__pyx_r = NULL;
14356 __Pyx_RefNannyDeclarations
14357 PyObject *__pyx_t_1 = NULL;
14358 int __pyx_lineno = 0;
14359 const char *__pyx_filename = NULL;
14360 int __pyx_clineno = 0;
14361 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
14368 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
14369 __Pyx_GOTREF(__pyx_t_1);
14370 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14371 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14372 __PYX_ERR(0, 4, __pyx_L1_error)
14383 __Pyx_XDECREF(__pyx_t_1);
14384 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14386 __Pyx_XGIVEREF(__pyx_r);
14387 __Pyx_RefNannyFinishContext();
14399 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) {
14400 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
14401 Py_ssize_t __pyx_v_suboffset;
14402 PyObject *__pyx_v_length = NULL;
14403 PyObject *__pyx_r = NULL;
14404 __Pyx_RefNannyDeclarations
14406 PyObject *__pyx_t_2 = NULL;
14407 PyObject *__pyx_t_3 = NULL;
14408 __Pyx_TypeInfo *__pyx_t_4;
14409 Py_buffer __pyx_t_5;
14410 Py_ssize_t *__pyx_t_6;
14411 Py_ssize_t *__pyx_t_7;
14412 Py_ssize_t *__pyx_t_8;
14413 Py_ssize_t __pyx_t_9;
14414 int __pyx_lineno = 0;
14415 const char *__pyx_filename = NULL;
14416 int __pyx_clineno = 0;
14417 __Pyx_RefNannySetupContext(
"memoryview_fromslice", 0);
14426 __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
14436 __Pyx_XDECREF(__pyx_r);
14437 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14456 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error)
14457 __Pyx_GOTREF(__pyx_t_2);
14458 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1013, __pyx_L1_error)
14459 __Pyx_GOTREF(__pyx_t_3);
14460 __Pyx_INCREF(Py_None);
14461 __Pyx_GIVEREF(Py_None);
14462 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
14463 __Pyx_INCREF(__pyx_int_0);
14464 __Pyx_GIVEREF(__pyx_int_0);
14465 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
14466 __Pyx_GIVEREF(__pyx_t_2);
14467 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
14469 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error)
14470 __Pyx_GOTREF(__pyx_t_2);
14471 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14472 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_2);
14482 __pyx_v_result->from_slice = __pyx_v_memviewslice;
14491 __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
14500 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1018, __pyx_L1_error)
14501 __Pyx_GOTREF(__pyx_t_2);
14502 __Pyx_GIVEREF(__pyx_t_2);
14503 __Pyx_GOTREF(__pyx_v_result->from_object);
14504 __Pyx_DECREF(__pyx_v_result->from_object);
14505 __pyx_v_result->from_object = __pyx_t_2;
14515 __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
14516 __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
14525 __pyx_t_5 = __pyx_v_memviewslice.memview->view;
14526 __pyx_v_result->__pyx_base.view = __pyx_t_5;
14535 __pyx_v_result->__pyx_base.view.buf = ((
void *)__pyx_v_memviewslice.data);
14544 __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
14553 ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
14562 Py_INCREF(Py_None);
14571 __pyx_t_1 = ((((
struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
14581 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
14601 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
14612 __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
14621 __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
14630 __pyx_v_result->__pyx_base.view.suboffsets = NULL;
14639 __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
14640 for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
14641 __pyx_t_6 = __pyx_t_8;
14642 __pyx_v_suboffset = (__pyx_t_6[0]);
14651 __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
14661 __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
14670 goto __pyx_L6_break;
14690 __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
14691 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
14700 __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
14701 for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
14702 __pyx_t_6 = __pyx_t_8;
14703 __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0]));
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1043, __pyx_L1_error)
14704 __Pyx_GOTREF(__pyx_t_2);
14705 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
14715 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1044, __pyx_L1_error)
14716 __Pyx_GOTREF(__pyx_t_2);
14717 __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1044, __pyx_L1_error)
14718 __Pyx_GOTREF(__pyx_t_3);
14719 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14720 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1044, __pyx_L1_error)
14721 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14722 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
14732 __pyx_v_result->to_object_func = __pyx_v_to_object_func;
14741 __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
14750 __Pyx_XDECREF(__pyx_r);
14751 __Pyx_INCREF(((PyObject *)__pyx_v_result));
14752 __pyx_r = ((PyObject *)__pyx_v_result);
14765 __Pyx_XDECREF(__pyx_t_2);
14766 __Pyx_XDECREF(__pyx_t_3);
14767 __Pyx_AddTraceback(
"View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14770 __Pyx_XDECREF((PyObject *)__pyx_v_result);
14771 __Pyx_XDECREF(__pyx_v_length);
14772 __Pyx_XGIVEREF(__pyx_r);
14773 __Pyx_RefNannyFinishContext();
14785 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
14786 struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
14787 __Pyx_memviewslice *__pyx_r;
14788 __Pyx_RefNannyDeclarations
14791 PyObject *__pyx_t_3 = NULL;
14792 int __pyx_lineno = 0;
14793 const char *__pyx_filename = NULL;
14794 int __pyx_clineno = 0;
14795 __Pyx_RefNannySetupContext(
"get_slice_from_memview", 0);
14804 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14805 __pyx_t_2 = (__pyx_t_1 != 0);
14815 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(0, 1056, __pyx_L1_error)
14816 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
14817 __Pyx_INCREF(__pyx_t_3);
14818 __pyx_v_obj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
14828 __pyx_r = (&__pyx_v_obj->from_slice);
14848 __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
14857 __pyx_r = __pyx_v_mslice;
14871 __Pyx_XDECREF(__pyx_t_3);
14872 __Pyx_AddTraceback(
"View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
14875 __Pyx_XDECREF((PyObject *)__pyx_v_obj);
14876 __Pyx_RefNannyFinishContext();
14888 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
14890 Py_ssize_t *__pyx_v_shape;
14891 Py_ssize_t *__pyx_v_strides;
14892 Py_ssize_t *__pyx_v_suboffsets;
14893 __Pyx_RefNannyDeclarations
14894 Py_ssize_t *__pyx_t_1;
14898 Py_ssize_t __pyx_t_5;
14899 __Pyx_RefNannySetupContext(
"slice_copy", 0);
14908 __pyx_t_1 = __pyx_v_memview->view.shape;
14909 __pyx_v_shape = __pyx_t_1;
14918 __pyx_t_1 = __pyx_v_memview->view.strides;
14919 __pyx_v_strides = __pyx_t_1;
14928 __pyx_t_1 = __pyx_v_memview->view.suboffsets;
14929 __pyx_v_suboffsets = __pyx_t_1;
14938 __pyx_v_dst->memview = ((
struct __pyx_memoryview_obj *)__pyx_v_memview);
14947 __pyx_v_dst->data = ((
char *)__pyx_v_memview->view.buf);
14956 __pyx_t_2 = __pyx_v_memview->view.ndim;
14957 __pyx_t_3 = __pyx_t_2;
14958 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14959 __pyx_v_dim = __pyx_t_4;
14968 (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
14977 (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
14986 if ((__pyx_v_suboffsets != 0)) {
14987 __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
14991 (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
15003 __Pyx_RefNannyFinishContext();
15014 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *__pyx_v_memview) {
15015 __Pyx_memviewslice __pyx_v_memviewslice;
15016 PyObject *__pyx_r = NULL;
15017 __Pyx_RefNannyDeclarations
15018 PyObject *__pyx_t_1 = NULL;
15019 int __pyx_lineno = 0;
15020 const char *__pyx_filename = NULL;
15021 int __pyx_clineno = 0;
15022 __Pyx_RefNannySetupContext(
"memoryview_copy", 0);
15031 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
15040 __Pyx_XDECREF(__pyx_r);
15041 __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1084, __pyx_L1_error)
15042 __Pyx_GOTREF(__pyx_t_1);
15043 __pyx_r = __pyx_t_1;
15057 __Pyx_XDECREF(__pyx_t_1);
15058 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
15061 __Pyx_XGIVEREF(__pyx_r);
15062 __Pyx_RefNannyFinishContext();
15074 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
15075 PyObject *(*__pyx_v_to_object_func)(
char *);
15076 int (*__pyx_v_to_dtype_func)(
char *, PyObject *);
15077 PyObject *__pyx_r = NULL;
15078 __Pyx_RefNannyDeclarations
15081 PyObject *(*__pyx_t_3)(
char *);
15082 int (*__pyx_t_4)(
char *, PyObject *);
15083 PyObject *__pyx_t_5 = NULL;
15084 int __pyx_lineno = 0;
15085 const char *__pyx_filename = NULL;
15086 int __pyx_clineno = 0;
15087 __Pyx_RefNannySetupContext(
"memoryview_copy_from_slice", 0);
15096 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15097 __pyx_t_2 = (__pyx_t_1 != 0);
15107 __pyx_t_3 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
15108 __pyx_v_to_object_func = __pyx_t_3;
15117 __pyx_t_4 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
15118 __pyx_v_to_dtype_func = __pyx_t_4;
15138 __pyx_v_to_object_func = NULL;
15147 __pyx_v_to_dtype_func = NULL;
15158 __Pyx_XDECREF(__pyx_r);
15167 __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(0, 1101, __pyx_L1_error)
15168 __Pyx_GOTREF(__pyx_t_5);
15169 __pyx_r = __pyx_t_5;
15183 __Pyx_XDECREF(__pyx_t_5);
15184 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15187 __Pyx_XGIVEREF(__pyx_r);
15188 __Pyx_RefNannyFinishContext();
15200 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
15201 Py_ssize_t __pyx_r;
15211 __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
15221 __pyx_r = (-__pyx_v_arg);
15241 __pyx_r = __pyx_v_arg;
15266 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim) {
15268 Py_ssize_t __pyx_v_c_stride;
15269 Py_ssize_t __pyx_v_f_stride;
15283 __pyx_v_c_stride = 0;
15292 __pyx_v_f_stride = 0;
15301 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
15302 __pyx_v_i = __pyx_t_1;
15311 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
15321 __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
15330 goto __pyx_L4_break;
15350 __pyx_t_1 = __pyx_v_ndim;
15351 __pyx_t_3 = __pyx_t_1;
15352 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
15353 __pyx_v_i = __pyx_t_4;
15362 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
15372 __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
15381 goto __pyx_L7_break;
15401 __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
15456 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) {
15457 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
15458 CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
15459 Py_ssize_t __pyx_v_dst_extent;
15460 Py_ssize_t __pyx_v_src_stride;
15461 Py_ssize_t __pyx_v_dst_stride;
15465 Py_ssize_t __pyx_t_4;
15466 Py_ssize_t __pyx_t_5;
15467 Py_ssize_t __pyx_t_6;
15476 __pyx_v_src_extent = (__pyx_v_src_shape[0]);
15485 __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
15494 __pyx_v_src_stride = (__pyx_v_src_strides[0]);
15503 __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
15512 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
15522 __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
15525 __pyx_t_1 = __pyx_t_2;
15526 goto __pyx_L5_bool_binop_done;
15528 __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
15531 __pyx_t_1 = __pyx_t_2;
15532 goto __pyx_L5_bool_binop_done;
15542 __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
15544 __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
15546 __pyx_t_3 = (__pyx_t_2 != 0);
15547 __pyx_t_1 = __pyx_t_3;
15548 __pyx_L5_bool_binop_done:;
15566 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
15586 __pyx_t_4 = __pyx_v_dst_extent;
15587 __pyx_t_5 = __pyx_t_4;
15588 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15589 __pyx_v_i = __pyx_t_6;
15598 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
15607 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
15616 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
15639 __pyx_t_4 = __pyx_v_dst_extent;
15640 __pyx_t_5 = __pyx_t_4;
15641 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15642 __pyx_v_i = __pyx_t_6;
15651 _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);
15660 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
15669 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
15693 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) {
15702 _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);
15723 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src,
int __pyx_v_ndim) {
15724 Py_ssize_t __pyx_v_shape;
15725 Py_ssize_t __pyx_v_size;
15726 Py_ssize_t __pyx_r;
15727 Py_ssize_t __pyx_t_1;
15728 Py_ssize_t *__pyx_t_2;
15729 Py_ssize_t *__pyx_t_3;
15730 Py_ssize_t *__pyx_t_4;
15739 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
15740 __pyx_v_size = __pyx_t_1;
15749 __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
15750 for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
15751 __pyx_t_2 = __pyx_t_4;
15752 __pyx_v_shape = (__pyx_t_2[0]);
15761 __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
15771 __pyx_r = __pyx_v_size;
15795 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) {
15797 Py_ssize_t __pyx_r;
15810 __pyx_t_1 = ((__pyx_v_order ==
'F') != 0);
15820 __pyx_t_2 = __pyx_v_ndim;
15821 __pyx_t_3 = __pyx_t_2;
15822 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
15823 __pyx_v_idx = __pyx_t_4;
15832 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
15841 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
15862 for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
15863 __pyx_v_idx = __pyx_t_2;
15872 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
15881 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
15893 __pyx_r = __pyx_v_stride;
15917 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) {
15919 void *__pyx_v_result;
15920 size_t __pyx_v_itemsize;
15921 size_t __pyx_v_size;
15923 Py_ssize_t __pyx_t_1;
15926 struct __pyx_memoryview_obj *__pyx_t_4;
15929 int __pyx_lineno = 0;
15930 const char *__pyx_filename = NULL;
15931 int __pyx_clineno = 0;
15940 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
15941 __pyx_v_itemsize = __pyx_t_1;
15950 __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
15959 __pyx_v_result = malloc(__pyx_v_size);
15968 __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
15978 __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(0, 1224, __pyx_L1_error)
15996 __pyx_v_tmpslice->data = ((
char *)__pyx_v_result);
16005 __pyx_t_4 = __pyx_v_src->memview;
16006 __pyx_v_tmpslice->memview = __pyx_t_4;
16015 __pyx_t_3 = __pyx_v_ndim;
16016 __pyx_t_5 = __pyx_t_3;
16017 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16018 __pyx_v_i = __pyx_t_6;
16027 (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
16036 (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1
L;
16046 (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));
16055 __pyx_t_3 = __pyx_v_ndim;
16056 __pyx_t_5 = __pyx_t_3;
16057 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16058 __pyx_v_i = __pyx_t_6;
16067 __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
16077 (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
16096 __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
16106 (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
16126 copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
16137 __pyx_r = __pyx_v_result;
16152 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16154 __Pyx_AddTraceback(
"View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
16156 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16172 static int __pyx_memoryview_err_extents(
int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
16174 __Pyx_RefNannyDeclarations
16175 PyObject *__pyx_t_1 = NULL;
16176 PyObject *__pyx_t_2 = NULL;
16177 PyObject *__pyx_t_3 = NULL;
16178 PyObject *__pyx_t_4 = NULL;
16179 int __pyx_lineno = 0;
16180 const char *__pyx_filename = NULL;
16181 int __pyx_clineno = 0;
16183 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16185 __Pyx_RefNannySetupContext(
"_err_extents", 0);
16194 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1254, __pyx_L1_error)
16195 __Pyx_GOTREF(__pyx_t_1);
16196 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1254, __pyx_L1_error)
16197 __Pyx_GOTREF(__pyx_t_2);
16198 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1254, __pyx_L1_error)
16199 __Pyx_GOTREF(__pyx_t_3);
16200 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1254, __pyx_L1_error)
16201 __Pyx_GOTREF(__pyx_t_4);
16202 __Pyx_GIVEREF(__pyx_t_1);
16203 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
16204 __Pyx_GIVEREF(__pyx_t_2);
16205 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
16206 __Pyx_GIVEREF(__pyx_t_3);
16207 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
16219 __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1253, __pyx_L1_error)
16220 __Pyx_GOTREF(__pyx_t_3);
16221 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16222 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1253, __pyx_L1_error)
16223 __Pyx_GOTREF(__pyx_t_4);
16224 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16225 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
16226 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16227 __PYX_ERR(0, 1253, __pyx_L1_error)
16239 __Pyx_XDECREF(__pyx_t_1);
16240 __Pyx_XDECREF(__pyx_t_2);
16241 __Pyx_XDECREF(__pyx_t_3);
16242 __Pyx_XDECREF(__pyx_t_4);
16243 __Pyx_AddTraceback(
"View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
16245 __Pyx_RefNannyFinishContext();
16247 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16260 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error,
char *__pyx_v_msg,
int __pyx_v_dim) {
16262 __Pyx_RefNannyDeclarations
16263 PyObject *__pyx_t_1 = NULL;
16264 PyObject *__pyx_t_2 = NULL;
16265 PyObject *__pyx_t_3 = NULL;
16266 PyObject *__pyx_t_4 = NULL;
16267 int __pyx_lineno = 0;
16268 const char *__pyx_filename = NULL;
16269 int __pyx_clineno = 0;
16271 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16273 __Pyx_RefNannySetupContext(
"_err_dim", 0);
16274 __Pyx_INCREF(__pyx_v_error);
16283 __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(0, 1258, __pyx_L1_error)
16284 __Pyx_GOTREF(__pyx_t_2);
16285 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1258, __pyx_L1_error)
16286 __Pyx_GOTREF(__pyx_t_3);
16287 __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1258, __pyx_L1_error)
16288 __Pyx_GOTREF(__pyx_t_4);
16289 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16290 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16291 __Pyx_INCREF(__pyx_v_error);
16292 __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
16293 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
16294 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
16295 if (likely(__pyx_t_2)) {
16296 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
16297 __Pyx_INCREF(__pyx_t_2);
16298 __Pyx_INCREF(
function);
16299 __Pyx_DECREF_SET(__pyx_t_3,
function);
16302 __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);
16303 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16304 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16305 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1258, __pyx_L1_error)
16306 __Pyx_GOTREF(__pyx_t_1);
16307 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16308 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16309 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16310 __PYX_ERR(0, 1258, __pyx_L1_error)
16322 __Pyx_XDECREF(__pyx_t_1);
16323 __Pyx_XDECREF(__pyx_t_2);
16324 __Pyx_XDECREF(__pyx_t_3);
16325 __Pyx_XDECREF(__pyx_t_4);
16326 __Pyx_AddTraceback(
"View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
16328 __Pyx_XDECREF(__pyx_v_error);
16329 __Pyx_RefNannyFinishContext();
16331 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16344 static int __pyx_memoryview_err(PyObject *__pyx_v_error,
char *__pyx_v_msg) {
16346 __Pyx_RefNannyDeclarations
16348 PyObject *__pyx_t_2 = NULL;
16349 PyObject *__pyx_t_3 = NULL;
16350 PyObject *__pyx_t_4 = NULL;
16351 PyObject *__pyx_t_5 = NULL;
16352 int __pyx_lineno = 0;
16353 const char *__pyx_filename = NULL;
16354 int __pyx_clineno = 0;
16356 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16358 __Pyx_RefNannySetupContext(
"_err", 0);
16359 __Pyx_INCREF(__pyx_v_error);
16368 __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
16369 if (unlikely(__pyx_t_1)) {
16378 __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(0, 1263, __pyx_L1_error)
16379 __Pyx_GOTREF(__pyx_t_3);
16380 __Pyx_INCREF(__pyx_v_error);
16381 __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
16382 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16383 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
16384 if (likely(__pyx_t_5)) {
16385 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
16386 __Pyx_INCREF(__pyx_t_5);
16387 __Pyx_INCREF(
function);
16388 __Pyx_DECREF_SET(__pyx_t_4,
function);
16391 __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);
16392 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16393 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16394 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1263, __pyx_L1_error)
16395 __Pyx_GOTREF(__pyx_t_2);
16396 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16397 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
16398 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16399 __PYX_ERR(0, 1263, __pyx_L1_error)
16418 __Pyx_Raise(__pyx_v_error, 0, 0, 0);
16419 __PYX_ERR(0, 1265, __pyx_L1_error)
16432 __Pyx_XDECREF(__pyx_t_2);
16433 __Pyx_XDECREF(__pyx_t_3);
16434 __Pyx_XDECREF(__pyx_t_4);
16435 __Pyx_XDECREF(__pyx_t_5);
16436 __Pyx_AddTraceback(
"View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
16438 __Pyx_XDECREF(__pyx_v_error);
16439 __Pyx_RefNannyFinishContext();
16441 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16454 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) {
16455 void *__pyx_v_tmpdata;
16456 size_t __pyx_v_itemsize;
16458 char __pyx_v_order;
16459 int __pyx_v_broadcasting;
16460 int __pyx_v_direct_copy;
16461 __Pyx_memviewslice __pyx_v_tmp;
16464 Py_ssize_t __pyx_t_1;
16472 int __pyx_lineno = 0;
16473 const char *__pyx_filename = NULL;
16474 int __pyx_clineno = 0;
16483 __pyx_v_tmpdata = NULL;
16492 __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
16493 __pyx_v_itemsize = __pyx_t_1;
16502 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
16511 __pyx_v_broadcasting = 0;
16520 __pyx_v_direct_copy = 0;
16529 __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
16539 __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
16558 __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
16568 __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
16587 __pyx_t_3 = __pyx_v_dst_ndim;
16588 __pyx_t_4 = __pyx_v_src_ndim;
16589 if (((__pyx_t_3 > __pyx_t_4) != 0)) {
16590 __pyx_t_5 = __pyx_t_3;
16592 __pyx_t_5 = __pyx_t_4;
16594 __pyx_v_ndim = __pyx_t_5;
16603 __pyx_t_5 = __pyx_v_ndim;
16604 __pyx_t_3 = __pyx_t_5;
16605 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
16606 __pyx_v_i = __pyx_t_4;
16615 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
16625 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
16635 __pyx_v_broadcasting = 1;
16644 (__pyx_v_src.strides[__pyx_v_i]) = 0;
16664 __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(0, 1297, __pyx_L1_error)
16684 __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
16694 __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(0, 1300, __pyx_L1_error)
16713 __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
16723 __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
16733 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
16751 __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(0, 1307, __pyx_L1_error)
16752 __pyx_v_tmpdata = __pyx_t_7;
16761 __pyx_v_src = __pyx_v_tmp;
16779 __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
16789 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'C', __pyx_v_ndim) != 0);
16799 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'C', __pyx_v_ndim);
16818 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'F', __pyx_v_ndim) != 0);
16828 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'F', __pyx_v_ndim);
16847 __pyx_t_2 = (__pyx_v_direct_copy != 0);
16857 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
16866 (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
16875 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
16884 free(__pyx_v_tmpdata);
16921 __pyx_t_2 = (__pyx_v_order ==
'F');
16923 __pyx_t_2 = (
'F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
16925 __pyx_t_8 = (__pyx_t_2 != 0);
16935 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(0, 1329, __pyx_L1_error)
16944 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(0, 1330, __pyx_L1_error)
16962 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
16971 copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
16980 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
16989 free(__pyx_v_tmpdata);
17013 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17015 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
17017 __Pyx_PyGILState_Release(__pyx_gilstate_save);
17033 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim,
int __pyx_v_ndim_other) {
17035 int __pyx_v_offset;
17047 __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
17056 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
17057 __pyx_v_i = __pyx_t_1;
17066 (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
17075 (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
17084 (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
17094 __pyx_t_1 = __pyx_v_offset;
17095 __pyx_t_2 = __pyx_t_1;
17096 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17097 __pyx_v_i = __pyx_t_3;
17106 (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
17115 (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
17124 (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1
L;
17146 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) {
17156 __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
17166 __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);
17196 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) {
17197 __Pyx_RefNannyDeclarations
17199 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17201 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice_with_gil", 0);
17210 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
17221 __Pyx_RefNannyFinishContext();
17223 __Pyx_PyGILState_Release(__pyx_gilstate_save);
17235 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) {
17236 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17237 __Pyx_RefNannyDeclarations
17238 Py_ssize_t __pyx_t_1;
17239 Py_ssize_t __pyx_t_2;
17240 Py_ssize_t __pyx_t_3;
17242 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice", 0);
17251 __pyx_t_1 = (__pyx_v_shape[0]);
17252 __pyx_t_2 = __pyx_t_1;
17253 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17254 __pyx_v_i = __pyx_t_3;
17263 __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
17273 __pyx_t_4 = (__pyx_v_inc != 0);
17283 Py_INCREF((((PyObject **)__pyx_v_data)[0]));
17303 Py_DECREF((((PyObject **)__pyx_v_data)[0]));
17333 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
17344 __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
17356 __Pyx_RefNannyFinishContext();
17367 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) {
17376 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
17385 __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);
17394 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
17415 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) {
17416 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17417 Py_ssize_t __pyx_v_stride;
17418 Py_ssize_t __pyx_v_extent;
17420 Py_ssize_t __pyx_t_2;
17421 Py_ssize_t __pyx_t_3;
17422 Py_ssize_t __pyx_t_4;
17431 __pyx_v_stride = (__pyx_v_strides[0]);
17440 __pyx_v_extent = (__pyx_v_shape[0]);
17449 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
17459 __pyx_t_2 = __pyx_v_extent;
17460 __pyx_t_3 = __pyx_t_2;
17461 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17462 __pyx_v_i = __pyx_t_4;
17471 (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
17480 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
17501 __pyx_t_2 = __pyx_v_extent;
17502 __pyx_t_3 = __pyx_t_2;
17503 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17504 __pyx_v_i = __pyx_t_4;
17513 __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);
17522 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
17545 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
17546 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};
17547 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17548 PyObject *__pyx_v___pyx_type = 0;
17549 long __pyx_v___pyx_checksum;
17550 PyObject *__pyx_v___pyx_state = 0;
17551 int __pyx_lineno = 0;
17552 const char *__pyx_filename = NULL;
17553 int __pyx_clineno = 0;
17554 PyObject *__pyx_r = 0;
17555 __Pyx_RefNannyDeclarations
17556 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum (wrapper)", 0);
17558 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
17559 PyObject* values[3] = {0,0,0};
17560 if (unlikely(__pyx_kwds)) {
17561 Py_ssize_t kw_args;
17562 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17563 switch (pos_args) {
17564 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17565 CYTHON_FALLTHROUGH;
17566 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17567 CYTHON_FALLTHROUGH;
17568 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17569 CYTHON_FALLTHROUGH;
17571 default:
goto __pyx_L5_argtuple_error;
17573 kw_args = PyDict_Size(__pyx_kwds);
17574 switch (pos_args) {
17576 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
17577 else goto __pyx_L5_argtuple_error;
17578 CYTHON_FALLTHROUGH;
17580 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
17582 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(0, 1, __pyx_L3_error)
17584 CYTHON_FALLTHROUGH;
17586 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
17588 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(0, 1, __pyx_L3_error)
17591 if (unlikely(kw_args > 0)) {
17592 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__pyx_unpickle_Enum") < 0)) __PYX_ERR(0, 1, __pyx_L3_error)
17594 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
17595 goto __pyx_L5_argtuple_error;
17597 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17598 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17599 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17601 __pyx_v___pyx_type = values[0];
17602 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]);
if (unlikely((__pyx_v___pyx_checksum == (
long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L3_error)
17603 __pyx_v___pyx_state = values[2];
17605 goto __pyx_L4_argument_unpacking_done;
17606 __pyx_L5_argtuple_error:;
17607 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1, __pyx_L3_error)
17609 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
17610 __Pyx_RefNannyFinishContext();
17612 __pyx_L4_argument_unpacking_done:;
17613 __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
17616 __Pyx_RefNannyFinishContext();
17620 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) {
17621 PyObject *__pyx_v___pyx_PickleError = 0;
17622 PyObject *__pyx_v___pyx_result = 0;
17623 PyObject *__pyx_r = NULL;
17624 __Pyx_RefNannyDeclarations
17625 PyObject *__pyx_t_1 = NULL;
17628 PyObject *__pyx_t_4 = NULL;
17629 PyObject *__pyx_t_5 = NULL;
17630 PyObject *__pyx_t_6 = NULL;
17631 int __pyx_lineno = 0;
17632 const char *__pyx_filename = NULL;
17633 int __pyx_clineno = 0;
17634 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum", 0);
17643 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
17644 __Pyx_GOTREF(__pyx_t_1);
17645 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__23, Py_NE));
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 4, __pyx_L1_error)
17646 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17647 __pyx_t_3 = (__pyx_t_2 != 0);
17657 __pyx_t_1 = PyList_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
17658 __Pyx_GOTREF(__pyx_t_1);
17659 __Pyx_INCREF(__pyx_n_s_PickleError);
17660 __Pyx_GIVEREF(__pyx_n_s_PickleError);
17661 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError);
17662 __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5, __pyx_L1_error)
17663 __Pyx_GOTREF(__pyx_t_4);
17664 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17665 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
17666 __Pyx_GOTREF(__pyx_t_1);
17667 __Pyx_INCREF(__pyx_t_1);
17668 __pyx_v___pyx_PickleError = __pyx_t_1;
17669 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17670 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17679 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
17680 __Pyx_GOTREF(__pyx_t_1);
17681 __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 6, __pyx_L1_error)
17682 __Pyx_GOTREF(__pyx_t_5);
17683 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17684 __Pyx_INCREF(__pyx_v___pyx_PickleError);
17685 __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL;
17686 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
17687 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
17688 if (likely(__pyx_t_6)) {
17689 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_1);
17690 __Pyx_INCREF(__pyx_t_6);
17691 __Pyx_INCREF(
function);
17692 __Pyx_DECREF_SET(__pyx_t_1,
function);
17695 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
17696 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
17697 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17698 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 6, __pyx_L1_error)
17699 __Pyx_GOTREF(__pyx_t_4);
17700 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17701 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
17702 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17703 __PYX_ERR(0, 6, __pyx_L1_error)
17721 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
17722 __Pyx_GOTREF(__pyx_t_1);
17724 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
17725 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
17726 if (likely(__pyx_t_5)) {
17727 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_1);
17728 __Pyx_INCREF(__pyx_t_5);
17729 __Pyx_INCREF(
function);
17730 __Pyx_DECREF_SET(__pyx_t_1,
function);
17733 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type);
17734 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
17735 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 7, __pyx_L1_error)
17736 __Pyx_GOTREF(__pyx_t_4);
17737 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17738 __pyx_v___pyx_result = __pyx_t_4;
17748 __pyx_t_3 = (__pyx_v___pyx_state != Py_None);
17749 __pyx_t_2 = (__pyx_t_3 != 0);
17759 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(0, 9, __pyx_L1_error)
17760 __pyx_t_4 = __pyx_unpickle_Enum__set_state(((
struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 9, __pyx_L1_error)
17761 __Pyx_GOTREF(__pyx_t_4);
17762 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17780 __Pyx_XDECREF(__pyx_r);
17781 __Pyx_INCREF(__pyx_v___pyx_result);
17782 __pyx_r = __pyx_v___pyx_result;
17793 __Pyx_XDECREF(__pyx_t_1);
17794 __Pyx_XDECREF(__pyx_t_4);
17795 __Pyx_XDECREF(__pyx_t_5);
17796 __Pyx_XDECREF(__pyx_t_6);
17797 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
17800 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
17801 __Pyx_XDECREF(__pyx_v___pyx_result);
17802 __Pyx_XGIVEREF(__pyx_r);
17803 __Pyx_RefNannyFinishContext();
17815 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
17816 PyObject *__pyx_r = NULL;
17817 __Pyx_RefNannyDeclarations
17818 PyObject *__pyx_t_1 = NULL;
17820 Py_ssize_t __pyx_t_3;
17823 PyObject *__pyx_t_6 = NULL;
17824 PyObject *__pyx_t_7 = NULL;
17825 PyObject *__pyx_t_8 = NULL;
17826 int __pyx_lineno = 0;
17827 const char *__pyx_filename = NULL;
17828 int __pyx_clineno = 0;
17829 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum__set_state", 0);
17838 if (unlikely(__pyx_v___pyx_state == Py_None)) {
17839 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
17840 __PYX_ERR(0, 12, __pyx_L1_error)
17842 __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(0, 12, __pyx_L1_error)
17843 __Pyx_GOTREF(__pyx_t_1);
17844 __Pyx_GIVEREF(__pyx_t_1);
17845 __Pyx_GOTREF(__pyx_v___pyx_result->name);
17846 __Pyx_DECREF(__pyx_v___pyx_result->name);
17847 __pyx_v___pyx_result->name = __pyx_t_1;
17856 if (unlikely(__pyx_v___pyx_state == Py_None)) {
17857 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
17858 __PYX_ERR(0, 13, __pyx_L1_error)
17860 __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state);
if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 13, __pyx_L1_error)
17861 __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
17864 __pyx_t_2 = __pyx_t_4;
17865 goto __pyx_L4_bool_binop_done;
17867 __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(0, 13, __pyx_L1_error)
17868 __pyx_t_5 = (__pyx_t_4 != 0);
17869 __pyx_t_2 = __pyx_t_5;
17870 __pyx_L4_bool_binop_done:;
17878 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 14, __pyx_L1_error)
17879 __Pyx_GOTREF(__pyx_t_6);
17880 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update);
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 14, __pyx_L1_error)
17881 __Pyx_GOTREF(__pyx_t_7);
17882 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17883 if (unlikely(__pyx_v___pyx_state == Py_None)) {
17884 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
17885 __PYX_ERR(0, 14, __pyx_L1_error)
17887 __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(0, 14, __pyx_L1_error)
17888 __Pyx_GOTREF(__pyx_t_6);
17890 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
17891 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
17892 if (likely(__pyx_t_8)) {
17893 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_7);
17894 __Pyx_INCREF(__pyx_t_8);
17895 __Pyx_INCREF(
function);
17896 __Pyx_DECREF_SET(__pyx_t_7,
function);
17899 __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);
17900 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
17901 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17902 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
17903 __Pyx_GOTREF(__pyx_t_1);
17904 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
17905 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17924 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17927 __Pyx_XDECREF(__pyx_t_1);
17928 __Pyx_XDECREF(__pyx_t_6);
17929 __Pyx_XDECREF(__pyx_t_7);
17930 __Pyx_XDECREF(__pyx_t_8);
17931 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
17934 __Pyx_XGIVEREF(__pyx_r);
17935 __Pyx_RefNannyFinishContext();
17947 static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) {
17948 __Pyx_StructField *__pyx_v_field;
17949 struct __pyx_typeinfo_string __pyx_v_fmt;
17950 PyObject *__pyx_v_part = 0;
17951 PyObject *__pyx_v_result = 0;
17952 PyObject *__pyx_v_alignment = NULL;
17953 PyObject *__pyx_v_parts = NULL;
17954 PyObject *__pyx_v_extents = NULL;
17956 PyObject *__pyx_r = NULL;
17957 __Pyx_RefNannyDeclarations
17959 PyObject *__pyx_t_2 = NULL;
17960 __Pyx_StructField *__pyx_t_3;
17961 PyObject *__pyx_t_4 = NULL;
17962 PyObject *__pyx_t_5 = NULL;
17967 int __pyx_lineno = 0;
17968 const char *__pyx_filename = NULL;
17969 int __pyx_clineno = 0;
17970 __Pyx_RefNannySetupContext(
"format_from_typeinfo", 0);
17979 __pyx_t_1 = ((__pyx_v_type->typegroup ==
'S') != 0);
17989 #ifndef CYTHON_WITHOUT_ASSERTIONS
17990 if (unlikely(!Py_OptimizeFlag)) {
17991 if (unlikely(!((__pyx_v_type->fields != NULL) != 0))) {
17992 PyErr_SetNone(PyExc_AssertionError);
17993 __PYX_ERR(0, 1469, __pyx_L1_error)
18005 #ifndef CYTHON_WITHOUT_ASSERTIONS
18006 if (unlikely(!Py_OptimizeFlag)) {
18007 if (unlikely(!((__pyx_v_type->fields->type != NULL) != 0))) {
18008 PyErr_SetNone(PyExc_AssertionError);
18009 __PYX_ERR(0, 1470, __pyx_L1_error)
18021 __pyx_t_1 = ((__pyx_v_type->flags & __PYX_BUF_FLAGS_PACKED_STRUCT) != 0);
18031 __Pyx_INCREF(__pyx_kp_b__24);
18032 __pyx_v_alignment = __pyx_kp_b__24;
18052 __Pyx_INCREF(__pyx_kp_b__25);
18053 __pyx_v_alignment = __pyx_kp_b__25;
18064 __pyx_t_2 = PyList_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1477, __pyx_L1_error)
18065 __Pyx_GOTREF(__pyx_t_2);
18066 __Pyx_INCREF(__pyx_kp_b_T);
18067 __Pyx_GIVEREF(__pyx_kp_b_T);
18068 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_b_T);
18069 __pyx_v_parts = ((PyObject*)__pyx_t_2);
18079 __pyx_t_3 = __pyx_v_type->fields;
18080 __pyx_v_field = __pyx_t_3;
18090 __pyx_t_1 = (__pyx_v_field->type != 0);
18091 if (!__pyx_t_1)
break;
18100 __pyx_t_2 = __pyx_format_from_typeinfo(__pyx_v_field->type);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1481, __pyx_L1_error)
18101 __Pyx_GOTREF(__pyx_t_2);
18102 __Pyx_XDECREF_SET(__pyx_v_part, ((PyObject*)__pyx_t_2));
18112 __pyx_t_2 = PyNumber_Add(__pyx_v_part, __pyx_kp_b__26);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1482, __pyx_L1_error)
18113 __Pyx_GOTREF(__pyx_t_2);
18114 __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_field->name);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1482, __pyx_L1_error)
18115 __Pyx_GOTREF(__pyx_t_4);
18116 __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1482, __pyx_L1_error)
18117 __Pyx_GOTREF(__pyx_t_5);
18118 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18119 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18120 __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_kp_b__26);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1482, __pyx_L1_error)
18121 __Pyx_GOTREF(__pyx_t_4);
18122 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
18123 __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_t_4);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(0, 1482, __pyx_L1_error)
18124 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18133 __pyx_v_field = (__pyx_v_field + 1);
18143 __pyx_t_4 = __Pyx_PyBytes_Join(__pyx_v_alignment, __pyx_v_parts);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1485, __pyx_L1_error)
18144 __Pyx_GOTREF(__pyx_t_4);
18145 __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_kp_b__27);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1485, __pyx_L1_error)
18146 __Pyx_GOTREF(__pyx_t_5);
18147 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18148 if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 1485, __pyx_L1_error)
18149 __pyx_v_result = ((PyObject*)__pyx_t_5);
18170 __pyx_v_fmt = __Pyx_TypeInfoToFormat(__pyx_v_type);
18179 __pyx_t_1 = ((__pyx_v_type->arraysize[0]) != 0);
18189 __pyx_t_5 = PyList_New(0);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1489, __pyx_L1_error)
18190 __Pyx_GOTREF(__pyx_t_5);
18191 __pyx_t_7 = __pyx_v_type->ndim;
18192 __pyx_t_8 = __pyx_t_7;
18193 for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
18194 __pyx_v_i = __pyx_t_9;
18195 __pyx_t_4 = __Pyx_PyInt_FromSize_t((__pyx_v_type->arraysize[__pyx_v_i]));
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1489, __pyx_L1_error)
18196 __Pyx_GOTREF(__pyx_t_4);
18197 __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_t_4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1489, __pyx_L1_error)
18198 __Pyx_GOTREF(__pyx_t_2);
18199 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18200 if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 1489, __pyx_L1_error)
18201 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18203 __pyx_v_extents = ((PyObject*)__pyx_t_5);
18213 __pyx_t_5 = PyUnicode_Join(__pyx_kp_u__28, __pyx_v_extents);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1490, __pyx_L1_error)
18214 __Pyx_GOTREF(__pyx_t_5);
18215 __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_s, __pyx_t_5);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1490, __pyx_L1_error)
18216 __Pyx_GOTREF(__pyx_t_2);
18217 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
18218 __pyx_t_5 = PyUnicode_AsASCIIString(((PyObject*)__pyx_t_2));
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1490, __pyx_L1_error)
18219 __Pyx_GOTREF(__pyx_t_5);
18220 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18221 __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_fmt.string);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1490, __pyx_L1_error)
18222 __Pyx_GOTREF(__pyx_t_2);
18223 __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1490, __pyx_L1_error)
18224 __Pyx_GOTREF(__pyx_t_4);
18225 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
18226 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18227 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 1490, __pyx_L1_error)
18228 __pyx_v_result = ((PyObject*)__pyx_t_4);
18249 __pyx_t_4 = __Pyx_PyObject_FromString(__pyx_v_fmt.string);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1492, __pyx_L1_error)
18250 __Pyx_GOTREF(__pyx_t_4);
18251 __pyx_v_result = ((PyObject*)__pyx_t_4);
18263 __Pyx_XDECREF(__pyx_r);
18264 __Pyx_INCREF(__pyx_v_result);
18265 __pyx_r = __pyx_v_result;
18278 __Pyx_XDECREF(__pyx_t_2);
18279 __Pyx_XDECREF(__pyx_t_4);
18280 __Pyx_XDECREF(__pyx_t_5);
18281 __Pyx_AddTraceback(
"BufferFormatFromTypeInfo.format_from_typeinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
18284 __Pyx_XDECREF(__pyx_v_part);
18285 __Pyx_XDECREF(__pyx_v_result);
18286 __Pyx_XDECREF(__pyx_v_alignment);
18287 __Pyx_XDECREF(__pyx_v_parts);
18288 __Pyx_XDECREF(__pyx_v_extents);
18289 __Pyx_XGIVEREF(__pyx_r);
18290 __Pyx_RefNannyFinishContext();
18294 static PyObject *__pyx_tp_new_9csparsity_PySparsityInfo(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
18295 struct __pyx_obj_9csparsity_PySparsityInfo *p;
18297 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18298 o = (*t->tp_alloc)(t, 0);
18300 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18302 if (unlikely(!o))
return 0;
18303 p = ((
struct __pyx_obj_9csparsity_PySparsityInfo *)o);
18305 if (unlikely(__pyx_pw_9csparsity_14PySparsityInfo_1__cinit__(o, __pyx_empty_tuple, NULL) < 0))
goto bad;
18308 Py_DECREF(o); o = 0;
18312 static void __pyx_tp_dealloc_9csparsity_PySparsityInfo(PyObject *o) {
18313 struct __pyx_obj_9csparsity_PySparsityInfo *p = (
struct __pyx_obj_9csparsity_PySparsityInfo *)o;
18314 #if CYTHON_USE_TP_FINALIZE
18315 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))) {
18316 if (PyObject_CallFinalizerFromDealloc(o))
return;
18320 PyObject *etype, *eval, *etb;
18321 PyErr_Fetch(&etype, &eval, &etb);
18322 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
18323 __pyx_pw_9csparsity_14PySparsityInfo_3__dealloc__(o);
18324 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
18325 PyErr_Restore(etype, eval, etb);
18327 __Pyx_call_destructor(p->cpp);
18328 (*Py_TYPE(o)->tp_free)(o);
18331 static PyMethodDef __pyx_methods_9csparsity_PySparsityInfo[] = {
18332 {
"findNonzeros", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_9csparsity_14PySparsityInfo_5findNonzeros, METH_VARARGS|METH_KEYWORDS, 0},
18333 {
"getOffsets_CSR", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_9csparsity_14PySparsityInfo_7getOffsets_CSR, METH_VARARGS|METH_KEYWORDS, 0},
18334 {
"getCSR", (PyCFunction)__pyx_pw_9csparsity_14PySparsityInfo_9getCSR, METH_NOARGS, 0},
18335 {
"__reduce_cython__", (PyCFunction)__pyx_pw_9csparsity_14PySparsityInfo_11__reduce_cython__, METH_NOARGS, 0},
18336 {
"__setstate_cython__", (PyCFunction)__pyx_pw_9csparsity_14PySparsityInfo_13__setstate_cython__, METH_O, 0},
18340 static PyTypeObject __pyx_type_9csparsity_PySparsityInfo = {
18341 PyVarObject_HEAD_INIT(0, 0)
18342 "csparsity.PySparsityInfo",
18343 sizeof(
struct __pyx_obj_9csparsity_PySparsityInfo),
18345 __pyx_tp_dealloc_9csparsity_PySparsityInfo,
18346 #
if PY_VERSION_HEX < 0x030800b4
18349 #
if PY_VERSION_HEX >= 0x030800b4
18354 #
if PY_MAJOR_VERSION < 3
18357 #
if PY_MAJOR_VERSION >= 3
18370 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
18378 __pyx_methods_9csparsity_PySparsityInfo,
18388 __pyx_tp_new_9csparsity_PySparsityInfo,
18398 #
if PY_VERSION_HEX >= 0x030400a1
18401 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
18404 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18407 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
18411 static struct __pyx_vtabstruct_array __pyx_vtable_array;
18413 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
18414 struct __pyx_array_obj *p;
18416 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18417 o = (*t->tp_alloc)(t, 0);
18419 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18421 if (unlikely(!o))
return 0;
18422 p = ((
struct __pyx_array_obj *)o);
18423 p->__pyx_vtab = __pyx_vtabptr_array;
18424 p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
18425 p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
18426 if (unlikely(__pyx_array___cinit__(o, a, k) < 0))
goto bad;
18429 Py_DECREF(o); o = 0;
18433 static void __pyx_tp_dealloc_array(PyObject *o) {
18434 struct __pyx_array_obj *p = (
struct __pyx_array_obj *)o;
18435 #if CYTHON_USE_TP_FINALIZE
18436 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))) {
18437 if (PyObject_CallFinalizerFromDealloc(o))
return;
18441 PyObject *etype, *eval, *etb;
18442 PyErr_Fetch(&etype, &eval, &etb);
18443 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
18444 __pyx_array___dealloc__(o);
18445 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
18446 PyErr_Restore(etype, eval, etb);
18449 Py_CLEAR(p->_format);
18450 (*Py_TYPE(o)->tp_free)(o);
18452 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
18454 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
18455 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
18460 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *
v) {
18462 return __pyx_array___setitem__(o, i,
v);
18465 PyErr_Format(PyExc_NotImplementedError,
18466 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
18471 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *
n) {
18472 PyObject *
v = __Pyx_PyObject_GenericGetAttr(o,
n);
18473 if (!
v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
18475 v = __pyx_array___getattr__(o,
n);
18480 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED
void *x) {
18481 return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
18484 static PyMethodDef __pyx_methods_array[] = {
18485 {
"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
18486 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
18487 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
18491 static struct PyGetSetDef __pyx_getsets_array[] = {
18492 {(
char *)
"memview", __pyx_getprop___pyx_array_memview, 0, (
char *)0, 0},
18496 static PySequenceMethods __pyx_tp_as_sequence_array = {
18497 __pyx_array___len__,
18500 __pyx_sq_item_array,
18509 static PyMappingMethods __pyx_tp_as_mapping_array = {
18510 __pyx_array___len__,
18511 __pyx_array___getitem__,
18512 __pyx_mp_ass_subscript_array,
18515 static PyBufferProcs __pyx_tp_as_buffer_array = {
18516 #if PY_MAJOR_VERSION < 3
18519 #if PY_MAJOR_VERSION < 3
18522 #if PY_MAJOR_VERSION < 3
18525 #if PY_MAJOR_VERSION < 3
18528 __pyx_array_getbuffer,
18532 static PyTypeObject __pyx_type___pyx_array = {
18533 PyVarObject_HEAD_INIT(0, 0)
18535 sizeof(
struct __pyx_array_obj),
18537 __pyx_tp_dealloc_array,
18538 #
if PY_VERSION_HEX < 0x030800b4
18541 #
if PY_VERSION_HEX >= 0x030800b4
18546 #
if PY_MAJOR_VERSION < 3
18549 #
if PY_MAJOR_VERSION >= 3
18554 &__pyx_tp_as_sequence_array,
18555 &__pyx_tp_as_mapping_array,
18559 __pyx_tp_getattro_array,
18561 &__pyx_tp_as_buffer_array,
18562 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
18570 __pyx_methods_array,
18572 __pyx_getsets_array,
18580 __pyx_tp_new_array,
18590 #
if PY_VERSION_HEX >= 0x030400a1
18593 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
18596 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18599 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
18604 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
18605 struct __pyx_MemviewEnum_obj *p;
18607 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18608 o = (*t->tp_alloc)(t, 0);
18610 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18612 if (unlikely(!o))
return 0;
18613 p = ((
struct __pyx_MemviewEnum_obj *)o);
18614 p->name = Py_None; Py_INCREF(Py_None);
18618 static void __pyx_tp_dealloc_Enum(PyObject *o) {
18619 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
18620 #if CYTHON_USE_TP_FINALIZE
18621 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
18622 if (PyObject_CallFinalizerFromDealloc(o))
return;
18625 PyObject_GC_UnTrack(o);
18627 (*Py_TYPE(o)->tp_free)(o);
18630 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc
v,
void *a) {
18632 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
18634 e = (*v)(p->name, a);
if (e)
return e;
18639 static int __pyx_tp_clear_Enum(PyObject *o) {
18641 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
18642 tmp = ((PyObject*)p->name);
18643 p->name = Py_None; Py_INCREF(Py_None);
18648 static PyMethodDef __pyx_methods_Enum[] = {
18649 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
18650 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
18654 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
18655 PyVarObject_HEAD_INIT(0, 0)
18657 sizeof(
struct __pyx_MemviewEnum_obj),
18659 __pyx_tp_dealloc_Enum,
18660 #
if PY_VERSION_HEX < 0x030800b4
18663 #
if PY_VERSION_HEX >= 0x030800b4
18668 #
if PY_MAJOR_VERSION < 3
18671 #
if PY_MAJOR_VERSION >= 3
18674 __pyx_MemviewEnum___repr__,
18684 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
18686 __pyx_tp_traverse_Enum,
18687 __pyx_tp_clear_Enum,
18692 __pyx_methods_Enum,
18700 __pyx_MemviewEnum___init__,
18712 #
if PY_VERSION_HEX >= 0x030400a1
18715 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
18718 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18721 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
18725 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
18727 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
18728 struct __pyx_memoryview_obj *p;
18730 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18731 o = (*t->tp_alloc)(t, 0);
18733 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18735 if (unlikely(!o))
return 0;
18736 p = ((
struct __pyx_memoryview_obj *)o);
18737 p->__pyx_vtab = __pyx_vtabptr_memoryview;
18738 p->obj = Py_None; Py_INCREF(Py_None);
18739 p->_size = Py_None; Py_INCREF(Py_None);
18740 p->_array_interface = Py_None; Py_INCREF(Py_None);
18741 p->view.obj = NULL;
18742 if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0))
goto bad;
18745 Py_DECREF(o); o = 0;
18749 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
18750 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
18751 #if CYTHON_USE_TP_FINALIZE
18752 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
18753 if (PyObject_CallFinalizerFromDealloc(o))
return;
18756 PyObject_GC_UnTrack(o);
18758 PyObject *etype, *eval, *etb;
18759 PyErr_Fetch(&etype, &eval, &etb);
18760 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
18761 __pyx_memoryview___dealloc__(o);
18762 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
18763 PyErr_Restore(etype, eval, etb);
18766 Py_CLEAR(p->_size);
18767 Py_CLEAR(p->_array_interface);
18768 (*Py_TYPE(o)->tp_free)(o);
18771 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc
v,
void *a) {
18773 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
18775 e = (*v)(p->obj, a);
if (e)
return e;
18778 e = (*v)(p->_size, a);
if (e)
return e;
18780 if (p->_array_interface) {
18781 e = (*v)(p->_array_interface, a);
if (e)
return e;
18784 e = (*v)(p->view.obj, a);
if (e)
return e;
18789 static int __pyx_tp_clear_memoryview(PyObject *o) {
18791 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
18792 tmp = ((PyObject*)p->obj);
18793 p->obj = Py_None; Py_INCREF(Py_None);
18795 tmp = ((PyObject*)p->_size);
18796 p->_size = Py_None; Py_INCREF(Py_None);
18798 tmp = ((PyObject*)p->_array_interface);
18799 p->_array_interface = Py_None; Py_INCREF(Py_None);
18801 Py_CLEAR(p->view.obj);
18804 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
18806 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
18807 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
18812 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *
v) {
18814 return __pyx_memoryview___setitem__(o, i,
v);
18817 PyErr_Format(PyExc_NotImplementedError,
18818 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
18823 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED
void *x) {
18824 return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
18827 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED
void *x) {
18828 return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
18831 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED
void *x) {
18832 return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
18835 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED
void *x) {
18836 return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
18839 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED
void *x) {
18840 return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
18843 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED
void *x) {
18844 return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
18847 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED
void *x) {
18848 return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
18851 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED
void *x) {
18852 return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
18855 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED
void *x) {
18856 return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
18859 static PyMethodDef __pyx_methods_memoryview[] = {
18860 {
"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
18861 {
"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
18862 {
"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
18863 {
"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
18864 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
18865 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
18869 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
18870 {(
char *)
"T", __pyx_getprop___pyx_memoryview_T, 0, (
char *)0, 0},
18871 {(
char *)
"base", __pyx_getprop___pyx_memoryview_base, 0, (
char *)0, 0},
18872 {(
char *)
"shape", __pyx_getprop___pyx_memoryview_shape, 0, (
char *)0, 0},
18873 {(
char *)
"strides", __pyx_getprop___pyx_memoryview_strides, 0, (
char *)0, 0},
18874 {(
char *)
"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (
char *)0, 0},
18875 {(
char *)
"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (
char *)0, 0},
18876 {(
char *)
"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (
char *)0, 0},
18877 {(
char *)
"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (
char *)0, 0},
18878 {(
char *)
"size", __pyx_getprop___pyx_memoryview_size, 0, (
char *)0, 0},
18882 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
18883 __pyx_memoryview___len__,
18886 __pyx_sq_item_memoryview,
18895 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
18896 __pyx_memoryview___len__,
18897 __pyx_memoryview___getitem__,
18898 __pyx_mp_ass_subscript_memoryview,
18901 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
18902 #if PY_MAJOR_VERSION < 3
18905 #if PY_MAJOR_VERSION < 3
18908 #if PY_MAJOR_VERSION < 3
18911 #if PY_MAJOR_VERSION < 3
18914 __pyx_memoryview_getbuffer,
18918 static PyTypeObject __pyx_type___pyx_memoryview = {
18919 PyVarObject_HEAD_INIT(0, 0)
18920 "csparsity.memoryview",
18921 sizeof(
struct __pyx_memoryview_obj),
18923 __pyx_tp_dealloc_memoryview,
18924 #
if PY_VERSION_HEX < 0x030800b4
18927 #
if PY_VERSION_HEX >= 0x030800b4
18932 #
if PY_MAJOR_VERSION < 3
18935 #
if PY_MAJOR_VERSION >= 3
18938 __pyx_memoryview___repr__,
18940 &__pyx_tp_as_sequence_memoryview,
18941 &__pyx_tp_as_mapping_memoryview,
18944 __pyx_memoryview___str__,
18947 &__pyx_tp_as_buffer_memoryview,
18948 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
18950 __pyx_tp_traverse_memoryview,
18951 __pyx_tp_clear_memoryview,
18956 __pyx_methods_memoryview,
18958 __pyx_getsets_memoryview,
18966 __pyx_tp_new_memoryview,
18976 #
if PY_VERSION_HEX >= 0x030400a1
18979 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
18982 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18985 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
18989 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
18991 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
18992 struct __pyx_memoryviewslice_obj *p;
18993 PyObject *o = __pyx_tp_new_memoryview(t, a, k);
18994 if (unlikely(!o))
return 0;
18995 p = ((
struct __pyx_memoryviewslice_obj *)o);
18996 p->__pyx_base.__pyx_vtab = (
struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
18997 p->from_object = Py_None; Py_INCREF(Py_None);
18998 p->from_slice.memview = NULL;
19002 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
19003 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
19004 #if CYTHON_USE_TP_FINALIZE
19005 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
19006 if (PyObject_CallFinalizerFromDealloc(o))
return;
19009 PyObject_GC_UnTrack(o);
19011 PyObject *etype, *eval, *etb;
19012 PyErr_Fetch(&etype, &eval, &etb);
19013 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
19014 __pyx_memoryviewslice___dealloc__(o);
19015 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
19016 PyErr_Restore(etype, eval, etb);
19018 Py_CLEAR(p->from_object);
19019 PyObject_GC_Track(o);
19020 __pyx_tp_dealloc_memoryview(o);
19023 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc
v,
void *a) {
19025 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
19026 e = __pyx_tp_traverse_memoryview(o,
v, a);
if (e)
return e;
19027 if (p->from_object) {
19028 e = (*v)(p->from_object, a);
if (e)
return e;
19033 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
19035 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
19036 __pyx_tp_clear_memoryview(o);
19037 tmp = ((PyObject*)p->from_object);
19038 p->from_object = Py_None; Py_INCREF(Py_None);
19040 __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
19044 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED
void *x) {
19045 return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
19048 static PyMethodDef __pyx_methods__memoryviewslice[] = {
19049 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
19050 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
19054 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
19055 {(
char *)
"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (
char *)0, 0},
19059 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
19060 PyVarObject_HEAD_INIT(0, 0)
19061 "csparsity._memoryviewslice",
19062 sizeof(
struct __pyx_memoryviewslice_obj),
19064 __pyx_tp_dealloc__memoryviewslice,
19065 #
if PY_VERSION_HEX < 0x030800b4
19068 #
if PY_VERSION_HEX >= 0x030800b4
19073 #
if PY_MAJOR_VERSION < 3
19076 #
if PY_MAJOR_VERSION >= 3
19079 #
if CYTHON_COMPILING_IN_PYPY
19080 __pyx_memoryview___repr__,
19089 #
if CYTHON_COMPILING_IN_PYPY
19090 __pyx_memoryview___str__,
19097 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
19098 "Internal class for passing memoryview slices to Python",
19099 __pyx_tp_traverse__memoryviewslice,
19100 __pyx_tp_clear__memoryviewslice,
19105 __pyx_methods__memoryviewslice,
19107 __pyx_getsets__memoryviewslice,
19115 __pyx_tp_new__memoryviewslice,
19125 #
if PY_VERSION_HEX >= 0x030400a1
19128 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
19131 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
19134 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
19139 static PyMethodDef __pyx_methods[] = {
19143 #if PY_MAJOR_VERSION >= 3
19144 #if CYTHON_PEP489_MULTI_PHASE_INIT
19145 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
19146 static int __pyx_pymod_exec_csparsity(PyObject* module);
19147 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
19148 {Py_mod_create, (
void*)__pyx_pymod_create},
19149 {Py_mod_exec, (
void*)__pyx_pymod_exec_csparsity},
19154 static struct PyModuleDef __pyx_moduledef = {
19155 PyModuleDef_HEAD_INIT,
19158 #if CYTHON_PEP489_MULTI_PHASE_INIT
19164 #if CYTHON_PEP489_MULTI_PHASE_INIT
19165 __pyx_moduledef_slots,
19174 #ifndef CYTHON_SMALL_CODE
19175 #if defined(__clang__)
19176 #define CYTHON_SMALL_CODE
19177 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
19178 #define CYTHON_SMALL_CODE __attribute__((cold))
19180 #define CYTHON_SMALL_CODE
19184 static __Pyx_StringTabEntry __pyx_string_tab[] = {
19185 {&__pyx_n_s_ASCII, __pyx_k_ASCII,
sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
19186 {&__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},
19187 {&__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},
19188 {&__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},
19189 {&__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},
19190 {&__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},
19191 {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis,
sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
19192 {&__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},
19193 {&__pyx_n_s_ImportError, __pyx_k_ImportError,
sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
19194 {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0,
sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0},
19195 {&__pyx_n_s_IndexError, __pyx_k_IndexError,
sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
19196 {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte,
sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
19197 {&__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},
19198 {&__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},
19199 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError,
sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
19200 {&__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},
19201 {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object,
sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
19202 {&__pyx_n_b_O, __pyx_k_O,
sizeof(__pyx_k_O), 0, 0, 0, 1},
19203 {&__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},
19204 {&__pyx_n_s_PickleError, __pyx_k_PickleError,
sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
19205 {&__pyx_n_s_PySparsityInfo, __pyx_k_PySparsityInfo,
sizeof(__pyx_k_PySparsityInfo), 0, 0, 1, 1},
19206 {&__pyx_kp_b_T, __pyx_k_T,
sizeof(__pyx_k_T), 0, 0, 0, 0},
19207 {&__pyx_n_s_TypeError, __pyx_k_TypeError,
sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
19208 {&__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},
19209 {&__pyx_n_s_ValueError, __pyx_k_ValueError,
sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
19210 {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView,
sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
19211 {&__pyx_kp_b__24, __pyx_k__24,
sizeof(__pyx_k__24), 0, 0, 0, 0},
19212 {&__pyx_kp_b__25, __pyx_k__25,
sizeof(__pyx_k__25), 0, 0, 0, 0},
19213 {&__pyx_kp_b__26, __pyx_k__26,
sizeof(__pyx_k__26), 0, 0, 0, 0},
19214 {&__pyx_kp_b__27, __pyx_k__27,
sizeof(__pyx_k__27), 0, 0, 0, 0},
19215 {&__pyx_kp_u__28, __pyx_k__28,
sizeof(__pyx_k__28), 0, 1, 0, 0},
19216 {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer,
sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
19217 {&__pyx_n_s_asarray, __pyx_k_asarray,
sizeof(__pyx_k_asarray), 0, 0, 1, 1},
19218 {&__pyx_n_s_base, __pyx_k_base,
sizeof(__pyx_k_base), 0, 0, 1, 1},
19219 {&__pyx_n_s_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 0, 1, 1},
19220 {&__pyx_n_u_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 1, 0, 1},
19221 {&__pyx_n_s_class, __pyx_k_class,
sizeof(__pyx_k_class), 0, 0, 1, 1},
19222 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
19223 {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct,
sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
19224 {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect,
sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
19225 {&__pyx_n_s_csrColumnOffsets, __pyx_k_csrColumnOffsets,
sizeof(__pyx_k_csrColumnOffsets), 0, 0, 1, 1},
19226 {&__pyx_n_s_csrColumnOffsets_eNebN, __pyx_k_csrColumnOffsets_eNebN,
sizeof(__pyx_k_csrColumnOffsets_eNebN), 0, 0, 1, 1},
19227 {&__pyx_n_s_csrColumnOffsets_eb, __pyx_k_csrColumnOffsets_eb,
sizeof(__pyx_k_csrColumnOffsets_eb), 0, 0, 1, 1},
19228 {&__pyx_n_s_csrColumnOffsets_eb_eNebN, __pyx_k_csrColumnOffsets_eb_eNebN,
sizeof(__pyx_k_csrColumnOffsets_eb_eNebN), 0, 0, 1, 1},
19229 {&__pyx_n_s_csrRowIndeces, __pyx_k_csrRowIndeces,
sizeof(__pyx_k_csrRowIndeces), 0, 0, 1, 1},
19230 {&__pyx_n_s_dict, __pyx_k_dict,
sizeof(__pyx_k_dict), 0, 0, 1, 1},
19231 {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object,
sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
19232 {&__pyx_n_s_elementBoundaryElementsArray, __pyx_k_elementBoundaryElementsArray,
sizeof(__pyx_k_elementBoundaryElementsArray), 0, 0, 1, 1},
19233 {&__pyx_n_s_elementBoundaryLocalElementBound, __pyx_k_elementBoundaryLocalElementBound,
sizeof(__pyx_k_elementBoundaryLocalElementBound), 0, 0, 1, 1},
19234 {&__pyx_n_s_elementNeighborsArray, __pyx_k_elementNeighborsArray,
sizeof(__pyx_k_elementNeighborsArray), 0, 0, 1, 1},
19235 {&__pyx_n_s_encode, __pyx_k_encode,
sizeof(__pyx_k_encode), 0, 0, 1, 1},
19236 {&__pyx_n_s_enumerate, __pyx_k_enumerate,
sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
19237 {&__pyx_n_s_error, __pyx_k_error,
sizeof(__pyx_k_error), 0, 0, 1, 1},
19238 {&__pyx_n_s_exteriorElementBoundariesArray, __pyx_k_exteriorElementBoundariesArray,
sizeof(__pyx_k_exteriorElementBoundariesArray), 0, 0, 1, 1},
19239 {&__pyx_n_s_flags, __pyx_k_flags,
sizeof(__pyx_k_flags), 0, 0, 1, 1},
19240 {&__pyx_n_s_format, __pyx_k_format,
sizeof(__pyx_k_format), 0, 0, 1, 1},
19241 {&__pyx_n_s_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 0, 1, 1},
19242 {&__pyx_n_u_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 1, 0, 1},
19243 {&__pyx_n_s_freeGlobal_test, __pyx_k_freeGlobal_test,
sizeof(__pyx_k_freeGlobal_test), 0, 0, 1, 1},
19244 {&__pyx_n_s_freeGlobal_trial, __pyx_k_freeGlobal_trial,
sizeof(__pyx_k_freeGlobal_trial), 0, 0, 1, 1},
19245 {&__pyx_n_s_getstate, __pyx_k_getstate,
sizeof(__pyx_k_getstate), 0, 0, 1, 1},
19246 {&__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},
19247 {&__pyx_n_s_hasDiffusionInMixedForm, __pyx_k_hasDiffusionInMixedForm,
sizeof(__pyx_k_hasDiffusionInMixedForm), 0, 0, 1, 1},
19248 {&__pyx_n_s_hasFluxBoundaryConditions, __pyx_k_hasFluxBoundaryConditions,
sizeof(__pyx_k_hasFluxBoundaryConditions), 0, 0, 1, 1},
19249 {&__pyx_n_s_hasNumericalFlux, __pyx_k_hasNumericalFlux,
sizeof(__pyx_k_hasNumericalFlux), 0, 0, 1, 1},
19250 {&__pyx_n_s_hasOutflowBoundary, __pyx_k_hasOutflowBoundary,
sizeof(__pyx_k_hasOutflowBoundary), 0, 0, 1, 1},
19251 {&__pyx_n_s_id, __pyx_k_id,
sizeof(__pyx_k_id), 0, 0, 1, 1},
19252 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
19253 {&__pyx_n_s_interiorElementBoundariesArray, __pyx_k_interiorElementBoundariesArray,
sizeof(__pyx_k_interiorElementBoundariesArray), 0, 0, 1, 1},
19254 {&__pyx_n_s_itemsize, __pyx_k_itemsize,
sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
19255 {&__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},
19256 {&__pyx_n_s_join, __pyx_k_join,
sizeof(__pyx_k_join), 0, 0, 1, 1},
19257 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
19258 {&__pyx_n_s_memview, __pyx_k_memview,
sizeof(__pyx_k_memview), 0, 0, 1, 1},
19259 {&__pyx_n_s_mode, __pyx_k_mode,
sizeof(__pyx_k_mode), 0, 0, 1, 1},
19260 {&__pyx_n_s_nDOF_test_element, __pyx_k_nDOF_test_element,
sizeof(__pyx_k_nDOF_test_element), 0, 0, 1, 1},
19261 {&__pyx_n_s_nDOF_trial_element, __pyx_k_nDOF_trial_element,
sizeof(__pyx_k_nDOF_trial_element), 0, 0, 1, 1},
19262 {&__pyx_n_s_nElementBoundaries_element, __pyx_k_nElementBoundaries_element,
sizeof(__pyx_k_nElementBoundaries_element), 0, 0, 1, 1},
19263 {&__pyx_n_s_nElements_global, __pyx_k_nElements_global,
sizeof(__pyx_k_nElements_global), 0, 0, 1, 1},
19264 {&__pyx_n_s_nExteriorElementBoundaries_globa, __pyx_k_nExteriorElementBoundaries_globa,
sizeof(__pyx_k_nExteriorElementBoundaries_globa), 0, 0, 1, 1},
19265 {&__pyx_n_s_nFreeDOF_test, __pyx_k_nFreeDOF_test,
sizeof(__pyx_k_nFreeDOF_test), 0, 0, 1, 1},
19266 {&__pyx_n_s_nFreeDOF_trial, __pyx_k_nFreeDOF_trial,
sizeof(__pyx_k_nFreeDOF_trial), 0, 0, 1, 1},
19267 {&__pyx_n_s_nInteriorElementBoundaries_globa, __pyx_k_nInteriorElementBoundaries_globa,
sizeof(__pyx_k_nInteriorElementBoundaries_globa), 0, 0, 1, 1},
19268 {&__pyx_n_s_name, __pyx_k_name,
sizeof(__pyx_k_name), 0, 0, 1, 1},
19269 {&__pyx_n_s_name_2, __pyx_k_name_2,
sizeof(__pyx_k_name_2), 0, 0, 1, 1},
19270 {&__pyx_n_s_ndim, __pyx_k_ndim,
sizeof(__pyx_k_ndim), 0, 0, 1, 1},
19271 {&__pyx_n_s_needNumericalFluxJacobian, __pyx_k_needNumericalFluxJacobian,
sizeof(__pyx_k_needNumericalFluxJacobian), 0, 0, 1, 1},
19272 {&__pyx_n_s_needOutflowJacobian, __pyx_k_needOutflowJacobian,
sizeof(__pyx_k_needOutflowJacobian), 0, 0, 1, 1},
19273 {&__pyx_n_s_new, __pyx_k_new,
sizeof(__pyx_k_new), 0, 0, 1, 1},
19274 {&__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},
19275 {&__pyx_n_s_np, __pyx_k_np,
sizeof(__pyx_k_np), 0, 0, 1, 1},
19276 {&__pyx_n_s_numpy, __pyx_k_numpy,
sizeof(__pyx_k_numpy), 0, 0, 1, 1},
19277 {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to,
sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
19278 {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor,
sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
19279 {&__pyx_n_s_obj, __pyx_k_obj,
sizeof(__pyx_k_obj), 0, 0, 1, 1},
19280 {&__pyx_n_s_offset_test, __pyx_k_offset_test,
sizeof(__pyx_k_offset_test), 0, 0, 1, 1},
19281 {&__pyx_n_s_offset_trial, __pyx_k_offset_trial,
sizeof(__pyx_k_offset_trial), 0, 0, 1, 1},
19282 {&__pyx_n_s_pack, __pyx_k_pack,
sizeof(__pyx_k_pack), 0, 0, 1, 1},
19283 {&__pyx_n_s_pickle, __pyx_k_pickle,
sizeof(__pyx_k_pickle), 0, 0, 1, 1},
19284 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError,
sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
19285 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum,
sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
19286 {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer,
sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
19287 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result,
sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
19288 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state,
sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
19289 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type,
sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
19290 {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum,
sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
19291 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable,
sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
19292 {&__pyx_n_s_range, __pyx_k_range,
sizeof(__pyx_k_range), 0, 0, 1, 1},
19293 {&__pyx_n_s_reduce, __pyx_k_reduce,
sizeof(__pyx_k_reduce), 0, 0, 1, 1},
19294 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython,
sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
19295 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex,
sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
19296 {&__pyx_n_s_rowptr, __pyx_k_rowptr,
sizeof(__pyx_k_rowptr), 0, 0, 1, 1},
19297 {&__pyx_kp_u_s, __pyx_k_s,
sizeof(__pyx_k_s), 0, 1, 0, 0},
19298 {&__pyx_n_s_setstate, __pyx_k_setstate,
sizeof(__pyx_k_setstate), 0, 0, 1, 1},
19299 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython,
sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
19300 {&__pyx_n_s_shape, __pyx_k_shape,
sizeof(__pyx_k_shape), 0, 0, 1, 1},
19301 {&__pyx_n_s_size, __pyx_k_size,
sizeof(__pyx_k_size), 0, 0, 1, 1},
19302 {&__pyx_n_s_start, __pyx_k_start,
sizeof(__pyx_k_start), 0, 0, 1, 1},
19303 {&__pyx_n_s_step, __pyx_k_step,
sizeof(__pyx_k_step), 0, 0, 1, 1},
19304 {&__pyx_n_s_stop, __pyx_k_stop,
sizeof(__pyx_k_stop), 0, 0, 1, 1},
19305 {&__pyx_n_s_stride_test, __pyx_k_stride_test,
sizeof(__pyx_k_stride_test), 0, 0, 1, 1},
19306 {&__pyx_n_s_stride_trial, __pyx_k_stride_trial,
sizeof(__pyx_k_stride_trial), 0, 0, 1, 1},
19307 {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct,
sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
19308 {&__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},
19309 {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect,
sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
19310 {&__pyx_kp_s_stringsource, __pyx_k_stringsource,
sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
19311 {&__pyx_n_s_struct, __pyx_k_struct,
sizeof(__pyx_k_struct), 0, 0, 1, 1},
19312 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
19313 {&__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},
19314 {&__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},
19315 {&__pyx_n_s_unpack, __pyx_k_unpack,
sizeof(__pyx_k_unpack), 0, 0, 1, 1},
19316 {&__pyx_n_s_update, __pyx_k_update,
sizeof(__pyx_k_update), 0, 0, 1, 1},
19317 {0, 0, 0, 0, 0, 0, 0}
19319 static CYTHON_SMALL_CODE
int __Pyx_InitCachedBuiltins(
void) {
19320 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError);
if (!__pyx_builtin_TypeError) __PYX_ERR(0, 2, __pyx_L1_error)
19321 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError);
if (!__pyx_builtin_ImportError) __PYX_ERR(2, 945, __pyx_L1_error)
19322 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError);
if (!__pyx_builtin_ValueError) __PYX_ERR(0, 133, __pyx_L1_error)
19323 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError);
if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 148, __pyx_L1_error)
19324 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate);
if (!__pyx_builtin_enumerate) __PYX_ERR(0, 151, __pyx_L1_error)
19325 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range);
if (!__pyx_builtin_range) __PYX_ERR(0, 180, __pyx_L1_error)
19326 __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis);
if (!__pyx_builtin_Ellipsis) __PYX_ERR(0, 404, __pyx_L1_error)
19327 __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id);
if (!__pyx_builtin_id) __PYX_ERR(0, 613, __pyx_L1_error)
19328 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError);
if (!__pyx_builtin_IndexError) __PYX_ERR(0, 832, __pyx_L1_error)
19334 static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
19335 __Pyx_RefNannyDeclarations
19336 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
19344 __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 2, __pyx_L1_error)
19345 __Pyx_GOTREF(__pyx_tuple_);
19346 __Pyx_GIVEREF(__pyx_tuple_);
19353 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 4, __pyx_L1_error)
19354 __Pyx_GOTREF(__pyx_tuple__2);
19355 __Pyx_GIVEREF(__pyx_tuple__2);
19364 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to);
if (unlikely(!__pyx_tuple__3)) __PYX_ERR(2, 945, __pyx_L1_error)
19365 __Pyx_GOTREF(__pyx_tuple__3);
19366 __Pyx_GIVEREF(__pyx_tuple__3);
19375 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor);
if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 951, __pyx_L1_error)
19376 __Pyx_GOTREF(__pyx_tuple__4);
19377 __Pyx_GIVEREF(__pyx_tuple__4);
19386 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr);
if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 133, __pyx_L1_error)
19387 __Pyx_GOTREF(__pyx_tuple__5);
19388 __Pyx_GIVEREF(__pyx_tuple__5);
19397 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array);
if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 136, __pyx_L1_error)
19398 __Pyx_GOTREF(__pyx_tuple__6);
19399 __Pyx_GIVEREF(__pyx_tuple__6);
19408 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str);
if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 148, __pyx_L1_error)
19409 __Pyx_GOTREF(__pyx_tuple__7);
19410 __Pyx_GIVEREF(__pyx_tuple__7);
19419 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data);
if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 176, __pyx_L1_error)
19420 __Pyx_GOTREF(__pyx_tuple__8);
19421 __Pyx_GIVEREF(__pyx_tuple__8);
19430 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is);
if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 192, __pyx_L1_error)
19431 __Pyx_GOTREF(__pyx_tuple__9);
19432 __Pyx_GIVEREF(__pyx_tuple__9);
19440 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 2, __pyx_L1_error)
19441 __Pyx_GOTREF(__pyx_tuple__10);
19442 __Pyx_GIVEREF(__pyx_tuple__10);
19449 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 4, __pyx_L1_error)
19450 __Pyx_GOTREF(__pyx_tuple__11);
19451 __Pyx_GIVEREF(__pyx_tuple__11);
19460 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor);
if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 418, __pyx_L1_error)
19461 __Pyx_GOTREF(__pyx_tuple__12);
19462 __Pyx_GIVEREF(__pyx_tuple__12);
19471 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object);
if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 495, __pyx_L1_error)
19472 __Pyx_GOTREF(__pyx_tuple__13);
19473 __Pyx_GIVEREF(__pyx_tuple__13);
19482 __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi);
if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 520, __pyx_L1_error)
19483 __Pyx_GOTREF(__pyx_tuple__14);
19484 __Pyx_GIVEREF(__pyx_tuple__14);
19493 __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri);
if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 570, __pyx_L1_error)
19494 __Pyx_GOTREF(__pyx_tuple__15);
19495 __Pyx_GIVEREF(__pyx_tuple__15);
19504 __pyx_tuple__16 = PyTuple_New(1);
if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 577, __pyx_L1_error)
19505 __Pyx_GOTREF(__pyx_tuple__16);
19506 __Pyx_INCREF(__pyx_int_neg_1);
19507 __Pyx_GIVEREF(__pyx_int_neg_1);
19508 PyTuple_SET_ITEM(__pyx_tuple__16, 0, __pyx_int_neg_1);
19509 __Pyx_GIVEREF(__pyx_tuple__16);
19517 __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 2, __pyx_L1_error)
19518 __Pyx_GOTREF(__pyx_tuple__17);
19519 __Pyx_GIVEREF(__pyx_tuple__17);
19526 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 4, __pyx_L1_error)
19527 __Pyx_GOTREF(__pyx_tuple__18);
19528 __Pyx_GIVEREF(__pyx_tuple__18);
19537 __pyx_slice__19 = PySlice_New(Py_None, Py_None, Py_None);
if (unlikely(!__pyx_slice__19)) __PYX_ERR(0, 682, __pyx_L1_error)
19538 __Pyx_GOTREF(__pyx_slice__19);
19539 __Pyx_GIVEREF(__pyx_slice__19);
19548 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte);
if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 703, __pyx_L1_error)
19549 __Pyx_GOTREF(__pyx_tuple__20);
19550 __Pyx_GIVEREF(__pyx_tuple__20);
19558 __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 2, __pyx_L1_error)
19559 __Pyx_GOTREF(__pyx_tuple__21);
19560 __Pyx_GIVEREF(__pyx_tuple__21);
19567 __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 4, __pyx_L1_error)
19568 __Pyx_GOTREF(__pyx_tuple__22);
19569 __Pyx_GIVEREF(__pyx_tuple__22);
19570 __pyx_tuple__23 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877);
if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 4, __pyx_L1_error)
19571 __Pyx_GOTREF(__pyx_tuple__23);
19572 __Pyx_GIVEREF(__pyx_tuple__23);
19581 __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect);
if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 286, __pyx_L1_error)
19582 __Pyx_GOTREF(__pyx_tuple__29);
19583 __Pyx_GIVEREF(__pyx_tuple__29);
19592 __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct);
if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 287, __pyx_L1_error)
19593 __Pyx_GOTREF(__pyx_tuple__30);
19594 __Pyx_GIVEREF(__pyx_tuple__30);
19603 __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect);
if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 288, __pyx_L1_error)
19604 __Pyx_GOTREF(__pyx_tuple__31);
19605 __Pyx_GIVEREF(__pyx_tuple__31);
19614 __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct);
if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 291, __pyx_L1_error)
19615 __Pyx_GOTREF(__pyx_tuple__32);
19616 __Pyx_GIVEREF(__pyx_tuple__32);
19625 __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect);
if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 292, __pyx_L1_error)
19626 __Pyx_GOTREF(__pyx_tuple__33);
19627 __Pyx_GIVEREF(__pyx_tuple__33);
19634 __pyx_tuple__34 = 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__34)) __PYX_ERR(0, 1, __pyx_L1_error)
19635 __Pyx_GOTREF(__pyx_tuple__34);
19636 __Pyx_GIVEREF(__pyx_tuple__34);
19637 __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 1, __pyx_L1_error)
19638 __Pyx_RefNannyFinishContext();
19641 __Pyx_RefNannyFinishContext();
19645 static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
19646 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(1, 1, __pyx_L1_error);
19647 __pyx_int_0 = PyInt_FromLong(0);
if (unlikely(!__pyx_int_0)) __PYX_ERR(1, 1, __pyx_L1_error)
19648 __pyx_int_1 = PyInt_FromLong(1);
if (unlikely(!__pyx_int_1)) __PYX_ERR(1, 1, __pyx_L1_error)
19649 __pyx_int_112105877 = PyInt_FromLong(112105877
L);
if (unlikely(!__pyx_int_112105877)) __PYX_ERR(1, 1, __pyx_L1_error)
19650 __pyx_int_136983863 = PyInt_FromLong(136983863
L);
if (unlikely(!__pyx_int_136983863)) __PYX_ERR(1, 1, __pyx_L1_error)
19651 __pyx_int_184977713 = PyInt_FromLong(184977713
L);
if (unlikely(!__pyx_int_184977713)) __PYX_ERR(1, 1, __pyx_L1_error)
19652 __pyx_int_neg_1 = PyInt_FromLong(-1);
if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(1, 1, __pyx_L1_error)
19658 static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
19659 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
19660 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
19661 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
19662 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
19663 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
19664 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
19666 static int __Pyx_modinit_global_init_code(
void) {
19667 __Pyx_RefNannyDeclarations
19668 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
19670 generic = Py_None; Py_INCREF(Py_None);
19671 strided = Py_None; Py_INCREF(Py_None);
19672 indirect = Py_None; Py_INCREF(Py_None);
19673 contiguous = Py_None; Py_INCREF(Py_None);
19674 indirect_contiguous = Py_None; Py_INCREF(Py_None);
19675 __Pyx_RefNannyFinishContext();
19679 static int __Pyx_modinit_variable_export_code(
void) {
19680 __Pyx_RefNannyDeclarations
19681 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
19683 __Pyx_RefNannyFinishContext();
19687 static int __Pyx_modinit_function_export_code(
void) {
19688 __Pyx_RefNannyDeclarations
19689 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
19691 __Pyx_RefNannyFinishContext();
19695 static int __Pyx_modinit_type_init_code(
void) {
19696 __Pyx_RefNannyDeclarations
19697 int __pyx_lineno = 0;
19698 const char *__pyx_filename = NULL;
19699 int __pyx_clineno = 0;
19700 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
19702 if (PyType_Ready(&__pyx_type_9csparsity_PySparsityInfo) < 0) __PYX_ERR(1, 6, __pyx_L1_error)
19703 #if PY_VERSION_HEX < 0x030800B1
19704 __pyx_type_9csparsity_PySparsityInfo.tp_print = 0;
19706 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_9csparsity_PySparsityInfo.tp_dictoffset && __pyx_type_9csparsity_PySparsityInfo.tp_getattro == PyObject_GenericGetAttr)) {
19707 __pyx_type_9csparsity_PySparsityInfo.tp_getattro = __Pyx_PyObject_GenericGetAttr;
19709 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PySparsityInfo, (PyObject *)&__pyx_type_9csparsity_PySparsityInfo) < 0) __PYX_ERR(1, 6, __pyx_L1_error)
19710 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_9csparsity_PySparsityInfo) < 0) __PYX_ERR(1, 6, __pyx_L1_error)
19711 __pyx_ptype_9csparsity_PySparsityInfo = &__pyx_type_9csparsity_PySparsityInfo;
19712 __pyx_vtabptr_array = &__pyx_vtable_array;
19713 __pyx_vtable_array.get_memview = (PyObject *(*)(
struct __pyx_array_obj *))__pyx_array_get_memview;
19714 if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(0, 105, __pyx_L1_error)
19715 #if PY_VERSION_HEX < 0x030800B1
19716 __pyx_type___pyx_array.tp_print = 0;
19718 if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(0, 105, __pyx_L1_error)
19719 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(0, 105, __pyx_L1_error)
19720 __pyx_array_type = &__pyx_type___pyx_array;
19721 if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(0, 279, __pyx_L1_error)
19722 #if PY_VERSION_HEX < 0x030800B1
19723 __pyx_type___pyx_MemviewEnum.tp_print = 0;
19725 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
19726 __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
19728 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(0, 279, __pyx_L1_error)
19729 __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
19730 __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
19731 __pyx_vtable_memoryview.get_item_pointer = (
char *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
19732 __pyx_vtable_memoryview.is_slice = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
19733 __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
19734 __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
19735 __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
19736 __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryview_convert_item_to_object;
19737 __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryview_assign_item_from_object;
19738 if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(0, 330, __pyx_L1_error)
19739 #if PY_VERSION_HEX < 0x030800B1
19740 __pyx_type___pyx_memoryview.tp_print = 0;
19742 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
19743 __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
19745 if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(0, 330, __pyx_L1_error)
19746 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(0, 330, __pyx_L1_error)
19747 __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
19748 __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
19749 __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
19750 __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryviewslice_convert_item_to_object;
19751 __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
19752 __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
19753 if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(0, 965, __pyx_L1_error)
19754 #if PY_VERSION_HEX < 0x030800B1
19755 __pyx_type___pyx_memoryviewslice.tp_print = 0;
19757 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
19758 __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
19760 if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(0, 965, __pyx_L1_error)
19761 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(0, 965, __pyx_L1_error)
19762 __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
19763 __Pyx_RefNannyFinishContext();
19766 __Pyx_RefNannyFinishContext();
19770 static int __Pyx_modinit_type_import_code(
void) {
19771 __Pyx_RefNannyDeclarations
19772 PyObject *__pyx_t_1 = NULL;
19773 int __pyx_lineno = 0;
19774 const char *__pyx_filename = NULL;
19775 int __pyx_clineno = 0;
19776 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_import_code", 0);
19778 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
19779 __Pyx_GOTREF(__pyx_t_1);
19780 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME,
"type",
19781 #
if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
19782 sizeof(PyTypeObject),
19784 sizeof(PyHeapTypeObject),
19786 __Pyx_ImportType_CheckSize_Warn);
19787 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
19788 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19789 __pyx_t_1 = PyImport_ImportModule(
"numpy");
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 200, __pyx_L1_error)
19790 __Pyx_GOTREF(__pyx_t_1);
19791 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1,
"numpy",
"dtype",
sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
19792 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 200, __pyx_L1_error)
19793 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flatiter",
sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
19794 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 223, __pyx_L1_error)
19795 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1,
"numpy",
"broadcast",
sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
19796 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 227, __pyx_L1_error)
19797 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ndarray",
sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
19798 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 239, __pyx_L1_error)
19799 __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1,
"numpy",
"generic",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19800 if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 771, __pyx_L1_error)
19801 __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1,
"numpy",
"number",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19802 if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 773, __pyx_L1_error)
19803 __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1,
"numpy",
"integer",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19804 if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 775, __pyx_L1_error)
19805 __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1,
"numpy",
"signedinteger",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19806 if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 777, __pyx_L1_error)
19807 __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1,
"numpy",
"unsignedinteger",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19808 if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 779, __pyx_L1_error)
19809 __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1,
"numpy",
"inexact",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19810 if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 781, __pyx_L1_error)
19811 __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1,
"numpy",
"floating",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19812 if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 783, __pyx_L1_error)
19813 __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1,
"numpy",
"complexfloating",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19814 if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 785, __pyx_L1_error)
19815 __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flexible",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19816 if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 787, __pyx_L1_error)
19817 __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1,
"numpy",
"character",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19818 if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 789, __pyx_L1_error)
19819 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ufunc",
sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
19820 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 827, __pyx_L1_error)
19821 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19822 __Pyx_RefNannyFinishContext();
19825 __Pyx_XDECREF(__pyx_t_1);
19826 __Pyx_RefNannyFinishContext();
19830 static int __Pyx_modinit_variable_import_code(
void) {
19831 __Pyx_RefNannyDeclarations
19832 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
19834 __Pyx_RefNannyFinishContext();
19838 static int __Pyx_modinit_function_import_code(
void) {
19839 __Pyx_RefNannyDeclarations
19840 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
19842 __Pyx_RefNannyFinishContext();
19847 #ifndef CYTHON_NO_PYINIT_EXPORT
19848 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
19849 #elif PY_MAJOR_VERSION < 3
19851 #define __Pyx_PyMODINIT_FUNC extern "C" void
19853 #define __Pyx_PyMODINIT_FUNC void
19857 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
19859 #define __Pyx_PyMODINIT_FUNC PyObject *
19864 #if PY_MAJOR_VERSION < 3
19865 __Pyx_PyMODINIT_FUNC initcsparsity(
void) CYTHON_SMALL_CODE;
19866 __Pyx_PyMODINIT_FUNC initcsparsity(
void)
19868 __Pyx_PyMODINIT_FUNC PyInit_csparsity(
void) CYTHON_SMALL_CODE;
19869 __Pyx_PyMODINIT_FUNC PyInit_csparsity(
void)
19870 #if CYTHON_PEP489_MULTI_PHASE_INIT
19872 return PyModuleDef_Init(&__pyx_moduledef);
19874 static CYTHON_SMALL_CODE
int __Pyx_check_single_interpreter(
void) {
19875 #if PY_VERSION_HEX >= 0x030700A1
19876 static PY_INT64_T main_interpreter_id = -1;
19877 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
19878 if (main_interpreter_id == -1) {
19879 main_interpreter_id = current_id;
19880 return (unlikely(current_id == -1)) ? -1 : 0;
19881 }
else if (unlikely(main_interpreter_id != current_id))
19883 static PyInterpreterState *main_interpreter = NULL;
19884 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
19885 if (!main_interpreter) {
19886 main_interpreter = current_interpreter;
19887 }
else if (unlikely(main_interpreter != current_interpreter))
19892 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
19897 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) {
19898 PyObject *value = PyObject_GetAttrString(spec, from_name);
19900 if (likely(value)) {
19901 if (allow_none || value != Py_None) {
19902 result = PyDict_SetItemString(moddict, to_name, value);
19905 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
19912 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
19913 PyObject *module = NULL, *moddict, *modname;
19914 if (__Pyx_check_single_interpreter())
19917 return __Pyx_NewRef(__pyx_m);
19918 modname = PyObject_GetAttrString(spec,
"name");
19919 if (unlikely(!modname))
goto bad;
19920 module = PyModule_NewObject(modname);
19921 Py_DECREF(modname);
19922 if (unlikely(!module))
goto bad;
19923 moddict = PyModule_GetDict(module);
19924 if (unlikely(!moddict))
goto bad;
19925 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"loader",
"__loader__", 1) < 0))
goto bad;
19926 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"origin",
"__file__", 1) < 0))
goto bad;
19927 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"parent",
"__package__", 1) < 0))
goto bad;
19928 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"submodule_search_locations",
"__path__", 0) < 0))
goto bad;
19931 Py_XDECREF(module);
19936 static CYTHON_SMALL_CODE
int __pyx_pymod_exec_csparsity(PyObject *__pyx_pyinit_module)
19940 PyObject *__pyx_t_1 = NULL;
19941 static PyThread_type_lock __pyx_t_2[8];
19942 int __pyx_lineno = 0;
19943 const char *__pyx_filename = NULL;
19944 int __pyx_clineno = 0;
19945 __Pyx_RefNannyDeclarations
19946 #if CYTHON_PEP489_MULTI_PHASE_INIT
19948 if (__pyx_m == __pyx_pyinit_module)
return 0;
19949 PyErr_SetString(PyExc_RuntimeError,
"Module 'csparsity' has already been imported. Re-initialisation is not supported.");
19952 #elif PY_MAJOR_VERSION >= 3
19953 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
19955 #if CYTHON_REFNANNY
19956 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
19957 if (!__Pyx_RefNanny) {
19959 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
19960 if (!__Pyx_RefNanny)
19961 Py_FatalError(
"failed to import 'refnanny' module");
19964 __Pyx_RefNannySetupContext(
"__Pyx_PyMODINIT_FUNC PyInit_csparsity(void)", 0);
19965 if (__Pyx_check_binary_version() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
19966 #ifdef __Pxy_PyFrame_Initialize_Offsets
19967 __Pxy_PyFrame_Initialize_Offsets();
19969 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error)
19970 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error)
19971 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error)
19972 #ifdef __Pyx_CyFunction_USED
19973 if (__pyx_CyFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
19975 #ifdef __Pyx_FusedFunction_USED
19976 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
19978 #ifdef __Pyx_Coroutine_USED
19979 if (__pyx_Coroutine_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
19981 #ifdef __Pyx_Generator_USED
19982 if (__pyx_Generator_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
19984 #ifdef __Pyx_AsyncGen_USED
19985 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
19987 #ifdef __Pyx_StopAsyncIteration_USED
19988 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
19992 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
19993 PyEval_InitThreads();
19996 #if CYTHON_PEP489_MULTI_PHASE_INIT
19997 __pyx_m = __pyx_pyinit_module;
19998 Py_INCREF(__pyx_m);
20000 #if PY_MAJOR_VERSION < 3
20001 __pyx_m = Py_InitModule4(
"csparsity", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
20003 __pyx_m = PyModule_Create(&__pyx_moduledef);
20005 if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error)
20007 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error)
20008 Py_INCREF(__pyx_d);
20009 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error)
20010 Py_INCREF(__pyx_b);
20011 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(1, 1, __pyx_L1_error)
20012 Py_INCREF(__pyx_cython_runtime);
20013 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error);
20015 if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
20016 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
20017 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
20019 if (__pyx_module_is_main_csparsity) {
20020 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
20022 #if PY_MAJOR_VERSION >= 3
20024 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error)
20025 if (!PyDict_GetItemString(modules,
"csparsity")) {
20026 if (unlikely(PyDict_SetItemString(modules,
"csparsity", __pyx_m) < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
20031 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
20033 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
20035 (void)__Pyx_modinit_global_init_code();
20036 (void)__Pyx_modinit_variable_export_code();
20037 (void)__Pyx_modinit_function_export_code();
20038 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
20039 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
20040 (void)__Pyx_modinit_variable_import_code();
20041 (void)__Pyx_modinit_function_import_code();
20043 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
20044 if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
20053 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
20054 __Pyx_GOTREF(__pyx_t_1);
20055 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(1, 2, __pyx_L1_error)
20056 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20063 __pyx_t_1 = __Pyx_PyDict_NewPresized(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
20064 __Pyx_GOTREF(__pyx_t_1);
20065 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
20066 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20075 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_array_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
20076 __Pyx_GOTREF(__pyx_t_1);
20077 if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
20078 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20079 PyType_Modified(__pyx_array_type);
20088 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__29, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error)
20089 __Pyx_GOTREF(__pyx_t_1);
20090 __Pyx_XGOTREF(
generic);
20091 __Pyx_DECREF_SET(
generic, __pyx_t_1);
20092 __Pyx_GIVEREF(__pyx_t_1);
20102 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__30, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
20103 __Pyx_GOTREF(__pyx_t_1);
20104 __Pyx_XGOTREF(strided);
20105 __Pyx_DECREF_SET(strided, __pyx_t_1);
20106 __Pyx_GIVEREF(__pyx_t_1);
20116 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__31, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
20117 __Pyx_GOTREF(__pyx_t_1);
20118 __Pyx_XGOTREF(indirect);
20119 __Pyx_DECREF_SET(indirect, __pyx_t_1);
20120 __Pyx_GIVEREF(__pyx_t_1);
20130 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__32, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
20131 __Pyx_GOTREF(__pyx_t_1);
20132 __Pyx_XGOTREF(contiguous);
20133 __Pyx_DECREF_SET(contiguous, __pyx_t_1);
20134 __Pyx_GIVEREF(__pyx_t_1);
20144 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__33, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
20145 __Pyx_GOTREF(__pyx_t_1);
20146 __Pyx_XGOTREF(indirect_contiguous);
20147 __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
20148 __Pyx_GIVEREF(__pyx_t_1);
20158 __pyx_memoryview_thread_locks_used = 0;
20167 __pyx_t_2[0] = PyThread_allocate_lock();
20168 __pyx_t_2[1] = PyThread_allocate_lock();
20169 __pyx_t_2[2] = PyThread_allocate_lock();
20170 __pyx_t_2[3] = PyThread_allocate_lock();
20171 __pyx_t_2[4] = PyThread_allocate_lock();
20172 __pyx_t_2[5] = PyThread_allocate_lock();
20173 __pyx_t_2[6] = PyThread_allocate_lock();
20174 __pyx_t_2[7] = PyThread_allocate_lock();
20175 memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2,
sizeof(__pyx_memoryview_thread_locks[0]) * (8));
20184 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
20185 __Pyx_GOTREF(__pyx_t_1);
20186 if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
20187 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20188 PyType_Modified(__pyx_memoryview_type);
20197 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 995, __pyx_L1_error)
20198 __Pyx_GOTREF(__pyx_t_1);
20199 if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(0, 995, __pyx_L1_error)
20200 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20201 PyType_Modified(__pyx_memoryviewslice_type);
20208 __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(0, 1, __pyx_L1_error)
20209 __Pyx_GOTREF(__pyx_t_1);
20210 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20211 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20225 __Pyx_XDECREF(__pyx_t_1);
20228 __Pyx_AddTraceback(
"init csparsity", __pyx_clineno, __pyx_lineno, __pyx_filename);
20231 }
else if (!PyErr_Occurred()) {
20232 PyErr_SetString(PyExc_ImportError,
"init csparsity");
20235 __Pyx_RefNannyFinishContext();
20236 #if CYTHON_PEP489_MULTI_PHASE_INIT
20237 return (__pyx_m != NULL) ? 0 : -1;
20238 #elif PY_MAJOR_VERSION >= 3
20247 #if CYTHON_REFNANNY
20248 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
20249 PyObject *m = NULL, *p = NULL;
20251 m = PyImport_ImportModule(modname);
20253 p = PyObject_GetAttrString(m,
"RefNannyAPI");
20255 r = PyLong_AsVoidPtr(p);
20259 return (__Pyx_RefNannyAPIStruct *)
r;
20264 #if CYTHON_USE_TYPE_SLOTS
20265 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
20266 PyTypeObject* tp = Py_TYPE(obj);
20267 if (likely(tp->tp_getattro))
20268 return tp->tp_getattro(obj, attr_name);
20269 #if PY_MAJOR_VERSION < 3
20270 if (likely(tp->tp_getattr))
20271 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
20273 return PyObject_GetAttr(obj, attr_name);
20278 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
20279 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
20280 if (unlikely(!result)) {
20281 PyErr_Format(PyExc_NameError,
20282 #
if PY_MAJOR_VERSION >= 3
20283 "name '%U' is not defined", name);
20285 "name '%.200s' is not defined", PyString_AS_STRING(name));
20292 static void __Pyx_RaiseArgtupleInvalid(
20293 const char* func_name,
20295 Py_ssize_t num_min,
20296 Py_ssize_t num_max,
20297 Py_ssize_t num_found)
20299 Py_ssize_t num_expected;
20300 const char *more_or_less;
20301 if (num_found < num_min) {
20302 num_expected = num_min;
20303 more_or_less =
"at least";
20305 num_expected = num_max;
20306 more_or_less =
"at most";
20309 more_or_less =
"exactly";
20311 PyErr_Format(PyExc_TypeError,
20312 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T
"d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T
"d given)",
20313 func_name, more_or_less, num_expected,
20314 (num_expected == 1) ?
"" :
"s", num_found);
20318 static int __Pyx_CheckKeywordStrings(
20320 const char* function_name,
20324 Py_ssize_t
pos = 0;
20325 #if CYTHON_COMPILING_IN_PYPY
20326 if (!kw_allowed && PyDict_Next(kwdict, &
pos, &key, 0))
20327 goto invalid_keyword;
20330 while (PyDict_Next(kwdict, &
pos, &key, 0)) {
20331 #if PY_MAJOR_VERSION < 3
20332 if (unlikely(!PyString_Check(key)))
20334 if (unlikely(!PyUnicode_Check(key)))
20335 goto invalid_keyword_type;
20337 if ((!kw_allowed) && unlikely(key))
20338 goto invalid_keyword;
20340 invalid_keyword_type:
20341 PyErr_Format(PyExc_TypeError,
20342 "%.200s() keywords must be strings", function_name);
20346 PyErr_Format(PyExc_TypeError,
20347 #
if PY_MAJOR_VERSION < 3
20348 "%.200s() got an unexpected keyword argument '%.200s'",
20349 function_name, PyString_AsString(key));
20351 "%s() got an unexpected keyword argument '%U'",
20352 function_name, key);
20358 static void __Pyx_RaiseDoubleKeywordsError(
20359 const char* func_name,
20362 PyErr_Format(PyExc_TypeError,
20363 #
if PY_MAJOR_VERSION >= 3
20364 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
20366 "%s() got multiple values for keyword argument '%s'", func_name,
20367 PyString_AsString(kw_name));
20372 static int __Pyx_ParseOptionalKeywords(
20374 PyObject **argnames[],
20376 PyObject *values[],
20377 Py_ssize_t num_pos_args,
20378 const char* function_name)
20380 PyObject *key = 0, *value = 0;
20381 Py_ssize_t
pos = 0;
20383 PyObject*** first_kw_arg = argnames + num_pos_args;
20384 while (PyDict_Next(kwds, &
pos, &key, &value)) {
20385 name = first_kw_arg;
20386 while (*name && (**name != key)) name++;
20388 values[name-argnames] = value;
20391 name = first_kw_arg;
20392 #if PY_MAJOR_VERSION < 3
20393 if (likely(PyString_Check(key))) {
20395 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
20396 && _PyString_Eq(**name, key)) {
20397 values[name-argnames] = value;
20402 if (*name)
continue;
20404 PyObject*** argname = argnames;
20405 while (argname != first_kw_arg) {
20406 if ((**argname == key) || (
20407 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
20408 && _PyString_Eq(**argname, key))) {
20409 goto arg_passed_twice;
20416 if (likely(PyUnicode_Check(key))) {
20418 int cmp = (**name == key) ? 0 :
20419 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
20420 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
20422 PyUnicode_Compare(**name, key);
20423 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
20425 values[name-argnames] = value;
20430 if (*name)
continue;
20432 PyObject*** argname = argnames;
20433 while (argname != first_kw_arg) {
20434 int cmp = (**argname == key) ? 0 :
20435 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
20436 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
20438 PyUnicode_Compare(**argname, key);
20439 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
20440 if (cmp == 0)
goto arg_passed_twice;
20445 goto invalid_keyword_type;
20447 if (unlikely(PyDict_SetItem(kwds2, key, value)))
goto bad;
20449 goto invalid_keyword;
20454 __Pyx_RaiseDoubleKeywordsError(function_name, key);
20456 invalid_keyword_type:
20457 PyErr_Format(PyExc_TypeError,
20458 "%.200s() keywords must be strings", function_name);
20461 PyErr_Format(PyExc_TypeError,
20462 #
if PY_MAJOR_VERSION < 3
20463 "%.200s() got an unexpected keyword argument '%.200s'",
20464 function_name, PyString_AsString(key));
20466 "%s() got an unexpected keyword argument '%U'",
20467 function_name, key);
20474 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact)
20476 if (unlikely(!type)) {
20477 PyErr_SetString(PyExc_SystemError,
"Missing type object");
20481 #if PY_MAJOR_VERSION == 2
20482 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj)))
return 1;
20486 if (likely(__Pyx_TypeCheck(obj, type)))
return 1;
20488 PyErr_Format(PyExc_TypeError,
20489 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
20490 name, type->tp_name, Py_TYPE(obj)->tp_name);
20495 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
20496 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
20497 PyObject *dict = Py_TYPE(obj)->tp_dict;
20498 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
20500 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
20501 PyObject **dictptr = NULL;
20502 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
20504 #if CYTHON_COMPILING_IN_CPYTHON
20505 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
20507 dictptr = _PyObject_GetDictPtr(obj);
20510 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
20512 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
20513 PyObject *dict = Py_TYPE(obj)->tp_dict;
20514 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
20516 return obj_dict_version == __Pyx_get_object_dict_version(obj);
20521 #if CYTHON_USE_DICT_VERSIONS
20522 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
20524 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
20528 #if !CYTHON_AVOID_BORROWED_REFS
20529 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
20530 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
20531 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
20532 if (likely(result)) {
20533 return __Pyx_NewRef(result);
20534 }
else if (unlikely(PyErr_Occurred())) {
20538 result = PyDict_GetItem(__pyx_d, name);
20539 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
20540 if (likely(result)) {
20541 return __Pyx_NewRef(result);
20545 result = PyObject_GetItem(__pyx_d, name);
20546 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
20547 if (likely(result)) {
20548 return __Pyx_NewRef(result);
20552 return __Pyx_GetBuiltinName(name);
20556 #if CYTHON_FAST_PYCCALL
20557 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
20558 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
20559 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
20560 PyObject *
self = PyCFunction_GET_SELF(func);
20561 int flags = PyCFunction_GET_FLAGS(func);
20562 assert(PyCFunction_Check(func));
20563 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
20564 assert(nargs >= 0);
20565 assert(nargs == 0 || args != NULL);
20569 assert(!PyErr_Occurred());
20570 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
20571 return (*((__Pyx_PyCFunctionFastWithKeywords)(
void*)meth)) (
self, args, nargs, NULL);
20573 return (*((__Pyx_PyCFunctionFast)(
void*)meth)) (
self, args, nargs);
20579 #if CYTHON_FAST_PYCALL
20580 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
20581 PyObject *globals) {
20583 PyThreadState *tstate = __Pyx_PyThreadState_Current;
20584 PyObject **fastlocals;
20587 assert(globals != NULL);
20592 assert(tstate != NULL);
20593 f = PyFrame_New(tstate, co, globals, NULL);
20597 fastlocals = __Pyx_PyFrame_GetLocalsplus(
f);
20598 for (i = 0; i < na; i++) {
20600 fastlocals[i] = *args++;
20602 result = PyEval_EvalFrameEx(
f,0);
20603 ++tstate->recursion_depth;
20605 --tstate->recursion_depth;
20608 #if 1 || PY_VERSION_HEX < 0x030600B1
20609 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
20610 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
20611 PyObject *globals = PyFunction_GET_GLOBALS(func);
20612 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
20614 #if PY_MAJOR_VERSION >= 3
20617 PyObject *kwtuple, **k;
20622 assert(kwargs == NULL || PyDict_Check(kwargs));
20623 nk = kwargs ? PyDict_Size(kwargs) : 0;
20624 if (Py_EnterRecursiveCall((
char*)
" while calling a Python object")) {
20628 #
if PY_MAJOR_VERSION >= 3
20629 co->co_kwonlyargcount == 0 &&
20631 likely(kwargs == NULL || nk == 0) &&
20632 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
20633 if (argdefs == NULL && co->co_argcount == nargs) {
20634 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
20637 else if (nargs == 0 && argdefs != NULL
20638 && co->co_argcount == Py_SIZE(argdefs)) {
20641 args = &PyTuple_GET_ITEM(argdefs, 0);
20642 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
20646 if (kwargs != NULL) {
20648 kwtuple = PyTuple_New(2 * nk);
20649 if (kwtuple == NULL) {
20653 k = &PyTuple_GET_ITEM(kwtuple, 0);
20655 while (PyDict_Next(kwargs, &
pos, &k[i], &k[i+1])) {
20666 closure = PyFunction_GET_CLOSURE(func);
20667 #if PY_MAJOR_VERSION >= 3
20668 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
20670 if (argdefs != NULL) {
20671 d = &PyTuple_GET_ITEM(argdefs, 0);
20672 nd = Py_SIZE(argdefs);
20678 #if PY_MAJOR_VERSION >= 3
20679 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
20682 d, (
int)nd, kwdefs, closure);
20684 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
20687 d, (
int)nd, closure);
20689 Py_XDECREF(kwtuple);
20691 Py_LeaveRecursiveCall();
20698 #if CYTHON_COMPILING_IN_CPYTHON
20699 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
20701 ternaryfunc call = Py_TYPE(func)->tp_call;
20702 if (unlikely(!call))
20703 return PyObject_Call(func, arg, kw);
20704 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
20706 result = (*call)(func, arg, kw);
20707 Py_LeaveRecursiveCall();
20708 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
20711 "NULL result without error in PyObject_Call");
20718 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2) {
20719 PyObject *args, *result = NULL;
20720 #if CYTHON_FAST_PYCALL
20721 if (PyFunction_Check(
function)) {
20722 PyObject *args[2] = {arg1, arg2};
20723 return __Pyx_PyFunction_FastCall(
function, args, 2);
20726 #if CYTHON_FAST_PYCCALL
20727 if (__Pyx_PyFastCFunction_Check(
function)) {
20728 PyObject *args[2] = {arg1, arg2};
20729 return __Pyx_PyCFunction_FastCall(
function, args, 2);
20732 args = PyTuple_New(2);
20733 if (unlikely(!args))
goto done;
20735 PyTuple_SET_ITEM(args, 0, arg1);
20737 PyTuple_SET_ITEM(args, 1, arg2);
20738 Py_INCREF(
function);
20739 result = __Pyx_PyObject_Call(
function, args, NULL);
20741 Py_DECREF(
function);
20747 #if CYTHON_COMPILING_IN_CPYTHON
20748 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
20749 PyObject *
self, *result;
20751 cfunc = PyCFunction_GET_FUNCTION(func);
20752 self = PyCFunction_GET_SELF(func);
20753 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
20755 result = cfunc(
self, arg);
20756 Py_LeaveRecursiveCall();
20757 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
20760 "NULL result without error in PyObject_Call");
20767 #if CYTHON_COMPILING_IN_CPYTHON
20768 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
20770 PyObject *args = PyTuple_New(1);
20771 if (unlikely(!args))
return NULL;
20773 PyTuple_SET_ITEM(args, 0, arg);
20774 result = __Pyx_PyObject_Call(func, args, NULL);
20778 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
20779 #if CYTHON_FAST_PYCALL
20780 if (PyFunction_Check(func)) {
20781 return __Pyx_PyFunction_FastCall(func, &arg, 1);
20784 if (likely(PyCFunction_Check(func))) {
20785 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
20786 return __Pyx_PyObject_CallMethO(func, arg);
20787 #if CYTHON_FAST_PYCCALL
20788 }
else if (__Pyx_PyFastCFunction_Check(func)) {
20789 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
20793 return __Pyx__PyObject_CallOneArg(func, arg);
20796 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
20798 PyObject *args = PyTuple_Pack(1, arg);
20799 if (unlikely(!args))
return NULL;
20800 result = __Pyx_PyObject_Call(func, args, NULL);
20807 #if CYTHON_FAST_THREAD_STATE
20808 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
20809 PyObject *tmp_type, *tmp_value, *tmp_tb;
20810 tmp_type = tstate->curexc_type;
20811 tmp_value = tstate->curexc_value;
20812 tmp_tb = tstate->curexc_traceback;
20813 tstate->curexc_type = type;
20814 tstate->curexc_value = value;
20815 tstate->curexc_traceback = tb;
20816 Py_XDECREF(tmp_type);
20817 Py_XDECREF(tmp_value);
20818 Py_XDECREF(tmp_tb);
20820 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
20821 *type = tstate->curexc_type;
20822 *value = tstate->curexc_value;
20823 *tb = tstate->curexc_traceback;
20824 tstate->curexc_type = 0;
20825 tstate->curexc_value = 0;
20826 tstate->curexc_traceback = 0;
20831 #if PY_MAJOR_VERSION < 3
20832 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
20833 CYTHON_UNUSED PyObject *cause) {
20834 __Pyx_PyThreadState_declare
20836 if (!value || value == Py_None)
20840 if (!tb || tb == Py_None)
20844 if (!PyTraceBack_Check(tb)) {
20845 PyErr_SetString(PyExc_TypeError,
20846 "raise: arg 3 must be a traceback or None");
20850 if (PyType_Check(type)) {
20851 #if CYTHON_COMPILING_IN_PYPY
20853 Py_INCREF(Py_None);
20857 PyErr_NormalizeException(&type, &value, &tb);
20860 PyErr_SetString(PyExc_TypeError,
20861 "instance exception may not have a separate value");
20865 type = (PyObject*) Py_TYPE(type);
20867 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
20868 PyErr_SetString(PyExc_TypeError,
20869 "raise: exception class must be a subclass of BaseException");
20873 __Pyx_PyThreadState_assign
20874 __Pyx_ErrRestore(type, value, tb);
20883 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
20884 PyObject* owned_instance = NULL;
20885 if (tb == Py_None) {
20887 }
else if (tb && !PyTraceBack_Check(tb)) {
20888 PyErr_SetString(PyExc_TypeError,
20889 "raise: arg 3 must be a traceback or None");
20892 if (value == Py_None)
20894 if (PyExceptionInstance_Check(type)) {
20896 PyErr_SetString(PyExc_TypeError,
20897 "instance exception may not have a separate value");
20901 type = (PyObject*) Py_TYPE(value);
20902 }
else if (PyExceptionClass_Check(type)) {
20903 PyObject *instance_class = NULL;
20904 if (value && PyExceptionInstance_Check(value)) {
20905 instance_class = (PyObject*) Py_TYPE(value);
20906 if (instance_class != type) {
20907 int is_subclass = PyObject_IsSubclass(instance_class, type);
20908 if (!is_subclass) {
20909 instance_class = NULL;
20910 }
else if (unlikely(is_subclass == -1)) {
20913 type = instance_class;
20917 if (!instance_class) {
20920 args = PyTuple_New(0);
20921 else if (PyTuple_Check(value)) {
20925 args = PyTuple_Pack(1, value);
20928 owned_instance = PyObject_Call(type, args, NULL);
20930 if (!owned_instance)
20932 value = owned_instance;
20933 if (!PyExceptionInstance_Check(value)) {
20934 PyErr_Format(PyExc_TypeError,
20935 "calling %R should have returned an instance of "
20936 "BaseException, not %R",
20937 type, Py_TYPE(value));
20942 PyErr_SetString(PyExc_TypeError,
20943 "raise: exception class must be a subclass of BaseException");
20947 PyObject *fixed_cause;
20948 if (cause == Py_None) {
20949 fixed_cause = NULL;
20950 }
else if (PyExceptionClass_Check(cause)) {
20951 fixed_cause = PyObject_CallObject(cause, NULL);
20952 if (fixed_cause == NULL)
20954 }
else if (PyExceptionInstance_Check(cause)) {
20955 fixed_cause = cause;
20956 Py_INCREF(fixed_cause);
20958 PyErr_SetString(PyExc_TypeError,
20959 "exception causes must derive from "
20963 PyException_SetCause(value, fixed_cause);
20965 PyErr_SetObject(type, value);
20967 #if CYTHON_COMPILING_IN_PYPY
20968 PyObject *tmp_type, *tmp_value, *tmp_tb;
20969 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
20971 PyErr_Restore(tmp_type, tmp_value, tb);
20972 Py_XDECREF(tmp_tb);
20974 PyThreadState *tstate = __Pyx_PyThreadState_Current;
20975 PyObject* tmp_tb = tstate->curexc_traceback;
20976 if (tb != tmp_tb) {
20978 tstate->curexc_traceback = tb;
20979 Py_XDECREF(tmp_tb);
20984 Py_XDECREF(owned_instance);
20990 #if CYTHON_USE_EXC_INFO_STACK
20991 static _PyErr_StackItem *
20992 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
20994 _PyErr_StackItem *exc_info = tstate->exc_info;
20995 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
20996 exc_info->previous_item != NULL)
20998 exc_info = exc_info->previous_item;
21005 #if CYTHON_FAST_THREAD_STATE
21006 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
21007 #if CYTHON_USE_EXC_INFO_STACK
21008 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
21009 *type = exc_info->exc_type;
21010 *value = exc_info->exc_value;
21011 *tb = exc_info->exc_traceback;
21013 *type = tstate->exc_type;
21014 *value = tstate->exc_value;
21015 *tb = tstate->exc_traceback;
21018 Py_XINCREF(*value);
21021 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
21022 PyObject *tmp_type, *tmp_value, *tmp_tb;
21023 #if CYTHON_USE_EXC_INFO_STACK
21024 _PyErr_StackItem *exc_info = tstate->exc_info;
21025 tmp_type = exc_info->exc_type;
21026 tmp_value = exc_info->exc_value;
21027 tmp_tb = exc_info->exc_traceback;
21028 exc_info->exc_type = type;
21029 exc_info->exc_value = value;
21030 exc_info->exc_traceback = tb;
21032 tmp_type = tstate->exc_type;
21033 tmp_value = tstate->exc_value;
21034 tmp_tb = tstate->exc_traceback;
21035 tstate->exc_type = type;
21036 tstate->exc_value = value;
21037 tstate->exc_traceback = tb;
21039 Py_XDECREF(tmp_type);
21040 Py_XDECREF(tmp_value);
21041 Py_XDECREF(tmp_tb);
21046 #if CYTHON_FAST_THREAD_STATE
21047 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
21049 n = PyTuple_GET_SIZE(tuple);
21050 #if PY_MAJOR_VERSION >= 3
21051 for (i=0; i<
n; i++) {
21052 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
21055 for (i=0; i<
n; i++) {
21056 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
21060 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
21061 PyObject *exc_type = tstate->curexc_type;
21062 if (exc_type == err)
return 1;
21063 if (unlikely(!exc_type))
return 0;
21064 if (unlikely(PyTuple_Check(err)))
21065 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
21066 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
21071 #if CYTHON_FAST_THREAD_STATE
21072 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
21074 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
21077 PyObject *local_type, *local_value, *local_tb;
21078 #if CYTHON_FAST_THREAD_STATE
21079 PyObject *tmp_type, *tmp_value, *tmp_tb;
21080 local_type = tstate->curexc_type;
21081 local_value = tstate->curexc_value;
21082 local_tb = tstate->curexc_traceback;
21083 tstate->curexc_type = 0;
21084 tstate->curexc_value = 0;
21085 tstate->curexc_traceback = 0;
21087 PyErr_Fetch(&local_type, &local_value, &local_tb);
21089 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
21090 #if CYTHON_FAST_THREAD_STATE
21091 if (unlikely(tstate->curexc_type))
21093 if (unlikely(PyErr_Occurred()))
21096 #if PY_MAJOR_VERSION >= 3
21098 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
21102 Py_XINCREF(local_tb);
21103 Py_XINCREF(local_type);
21104 Py_XINCREF(local_value);
21105 *type = local_type;
21106 *value = local_value;
21108 #if CYTHON_FAST_THREAD_STATE
21109 #if CYTHON_USE_EXC_INFO_STACK
21111 _PyErr_StackItem *exc_info = tstate->exc_info;
21112 tmp_type = exc_info->exc_type;
21113 tmp_value = exc_info->exc_value;
21114 tmp_tb = exc_info->exc_traceback;
21115 exc_info->exc_type = local_type;
21116 exc_info->exc_value = local_value;
21117 exc_info->exc_traceback = local_tb;
21120 tmp_type = tstate->exc_type;
21121 tmp_value = tstate->exc_value;
21122 tmp_tb = tstate->exc_traceback;
21123 tstate->exc_type = local_type;
21124 tstate->exc_value = local_value;
21125 tstate->exc_traceback = local_tb;
21127 Py_XDECREF(tmp_type);
21128 Py_XDECREF(tmp_value);
21129 Py_XDECREF(tmp_tb);
21131 PyErr_SetExcInfo(local_type, local_value, local_tb);
21138 Py_XDECREF(local_type);
21139 Py_XDECREF(local_value);
21140 Py_XDECREF(local_tb);
21145 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals) {
21146 #if CYTHON_COMPILING_IN_PYPY
21147 return PyObject_RichCompareBool(s1, s2, equals);
21150 return (equals == Py_EQ);
21151 }
else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
21152 const char *ps1, *ps2;
21153 Py_ssize_t length = PyBytes_GET_SIZE(s1);
21154 if (length != PyBytes_GET_SIZE(s2))
21155 return (equals == Py_NE);
21156 ps1 = PyBytes_AS_STRING(s1);
21157 ps2 = PyBytes_AS_STRING(s2);
21158 if (ps1[0] != ps2[0]) {
21159 return (equals == Py_NE);
21160 }
else if (length == 1) {
21161 return (equals == Py_EQ);
21164 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
21165 Py_hash_t hash1, hash2;
21166 hash1 = ((PyBytesObject*)s1)->ob_shash;
21167 hash2 = ((PyBytesObject*)s2)->ob_shash;
21168 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
21169 return (equals == Py_NE);
21172 result = memcmp(ps1, ps2, (
size_t)length);
21173 return (equals == Py_EQ) ? (result == 0) : (result != 0);
21175 }
else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
21176 return (equals == Py_NE);
21177 }
else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
21178 return (equals == Py_NE);
21181 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
21184 result = __Pyx_PyObject_IsTrue(py_result);
21185 Py_DECREF(py_result);
21192 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals) {
21193 #if CYTHON_COMPILING_IN_PYPY
21194 return PyObject_RichCompareBool(s1, s2, equals);
21196 #if PY_MAJOR_VERSION < 3
21197 PyObject* owned_ref = NULL;
21199 int s1_is_unicode, s2_is_unicode;
21203 s1_is_unicode = PyUnicode_CheckExact(s1);
21204 s2_is_unicode = PyUnicode_CheckExact(s2);
21205 #if PY_MAJOR_VERSION < 3
21206 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
21207 owned_ref = PyUnicode_FromObject(s2);
21208 if (unlikely(!owned_ref))
21212 }
else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
21213 owned_ref = PyUnicode_FromObject(s1);
21214 if (unlikely(!owned_ref))
21218 }
else if (((!s2_is_unicode) & (!s1_is_unicode))) {
21219 return __Pyx_PyBytes_Equals(s1, s2, equals);
21222 if (s1_is_unicode & s2_is_unicode) {
21225 void *data1, *data2;
21226 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
21228 length = __Pyx_PyUnicode_GET_LENGTH(s1);
21229 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
21232 #if CYTHON_USE_UNICODE_INTERNALS
21234 Py_hash_t hash1, hash2;
21235 #if CYTHON_PEP393_ENABLED
21236 hash1 = ((PyASCIIObject*)s1)->hash;
21237 hash2 = ((PyASCIIObject*)s2)->hash;
21239 hash1 = ((PyUnicodeObject*)s1)->hash;
21240 hash2 = ((PyUnicodeObject*)s2)->hash;
21242 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
21247 kind = __Pyx_PyUnicode_KIND(s1);
21248 if (kind != __Pyx_PyUnicode_KIND(s2)) {
21251 data1 = __Pyx_PyUnicode_DATA(s1);
21252 data2 = __Pyx_PyUnicode_DATA(s2);
21253 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
21255 }
else if (length == 1) {
21258 int result = memcmp(data1, data2, (
size_t)(length * kind));
21259 #if PY_MAJOR_VERSION < 3
21260 Py_XDECREF(owned_ref);
21262 return (equals == Py_EQ) ? (result == 0) : (result != 0);
21264 }
else if ((s1 == Py_None) & s2_is_unicode) {
21266 }
else if ((s2 == Py_None) & s1_is_unicode) {
21270 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
21271 #if PY_MAJOR_VERSION < 3
21272 Py_XDECREF(owned_ref);
21276 result = __Pyx_PyObject_IsTrue(py_result);
21277 Py_DECREF(py_result);
21281 #if PY_MAJOR_VERSION < 3
21282 Py_XDECREF(owned_ref);
21284 return (equals == Py_EQ);
21286 #if PY_MAJOR_VERSION < 3
21287 Py_XDECREF(owned_ref);
21289 return (equals == Py_NE);
21294 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
21295 Py_ssize_t
q = a / b;
21296 Py_ssize_t
r = a -
q*b;
21297 q -= ((
r != 0) & ((
r ^ b) < 0));
21302 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *
n) {
21303 #if CYTHON_USE_TYPE_SLOTS
21304 #if PY_MAJOR_VERSION >= 3
21305 if (likely(PyUnicode_Check(
n)))
21307 if (likely(PyString_Check(
n)))
21309 return __Pyx_PyObject_GetAttrStr(o,
n);
21311 return PyObject_GetAttr(o,
n);
21315 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
21317 if (!j)
return NULL;
21318 r = PyObject_GetItem(o, j);
21322 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
21323 CYTHON_NCP_UNUSED
int wraparound,
21324 CYTHON_NCP_UNUSED
int boundscheck) {
21325 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
21326 Py_ssize_t wrapped_i = i;
21327 if (wraparound & unlikely(i < 0)) {
21328 wrapped_i += PyList_GET_SIZE(o);
21330 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
21331 PyObject *
r = PyList_GET_ITEM(o, wrapped_i);
21335 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
21337 return PySequence_GetItem(o, i);
21340 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
21341 CYTHON_NCP_UNUSED
int wraparound,
21342 CYTHON_NCP_UNUSED
int boundscheck) {
21343 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
21344 Py_ssize_t wrapped_i = i;
21345 if (wraparound & unlikely(i < 0)) {
21346 wrapped_i += PyTuple_GET_SIZE(o);
21348 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
21349 PyObject *
r = PyTuple_GET_ITEM(o, wrapped_i);
21353 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
21355 return PySequence_GetItem(o, i);
21358 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
int is_list,
21359 CYTHON_NCP_UNUSED
int wraparound,
21360 CYTHON_NCP_UNUSED
int boundscheck) {
21361 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
21362 if (is_list || PyList_CheckExact(o)) {
21363 Py_ssize_t
n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
21364 if ((!boundscheck) || (likely(__Pyx_is_valid_index(
n, PyList_GET_SIZE(o))))) {
21365 PyObject *
r = PyList_GET_ITEM(o,
n);
21370 else if (PyTuple_CheckExact(o)) {
21371 Py_ssize_t
n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
21372 if ((!boundscheck) || likely(__Pyx_is_valid_index(
n, PyTuple_GET_SIZE(o)))) {
21373 PyObject *
r = PyTuple_GET_ITEM(o,
n);
21378 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
21379 if (likely(m && m->sq_item)) {
21380 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
21381 Py_ssize_t l = m->sq_length(o);
21382 if (likely(l >= 0)) {
21385 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
21390 return m->sq_item(o, i);
21394 if (is_list || PySequence_Check(o)) {
21395 return PySequence_GetItem(o, i);
21398 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
21402 #if CYTHON_USE_TYPE_SLOTS
21403 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
21405 Py_ssize_t key_value;
21406 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
21407 if (unlikely(!(m && m->sq_item))) {
21408 PyErr_Format(PyExc_TypeError,
"'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
21411 key_value = __Pyx_PyIndex_AsSsize_t(index);
21412 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
21413 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
21415 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
21417 PyErr_Format(PyExc_IndexError,
"cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
21421 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
21422 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
21423 if (likely(m && m->mp_subscript)) {
21424 return m->mp_subscript(obj, key);
21426 return __Pyx_PyObject_GetIndex(obj, key);
21431 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
21432 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
21433 const char* encoding,
const char* errors,
21434 PyObject* (*decode_func)(
const char *
s, Py_ssize_t size,
const char *errors)) {
21436 if (unlikely((start < 0) | (stop < 0))) {
21437 size_t slen = strlen(cstring);
21438 if (unlikely(slen > (
size_t) PY_SSIZE_T_MAX)) {
21439 PyErr_SetString(PyExc_OverflowError,
21440 "c-string too long to convert to Python");
21443 length = (Py_ssize_t) slen;
21452 if (unlikely(stop <= start))
21453 return __Pyx_NewRef(__pyx_empty_unicode);
21454 length = stop - start;
21457 return decode_func(cstring, length, errors);
21459 return PyUnicode_Decode(cstring, length, encoding, errors);
21464 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
21465 __Pyx_PyThreadState_declare
21466 __Pyx_PyThreadState_assign
21467 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
21469 __Pyx_PyErr_Clear();
21473 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *
n, PyObject *d) {
21474 PyObject *
r = __Pyx_GetAttr(o,
n);
21475 return (likely(
r)) ?
r : __Pyx_GetAttr3Default(d);
21479 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
21480 PyErr_Format(PyExc_ValueError,
21481 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T
"d)", expected);
21485 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
21486 PyErr_Format(PyExc_ValueError,
21487 "need more than %" CYTHON_FORMAT_SSIZE_T
"d value%.1s to unpack",
21488 index, (index == 1) ?
"" :
"s");
21492 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void) {
21493 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not iterable");
21497 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
21498 if (unlikely(!type)) {
21499 PyErr_SetString(PyExc_SystemError,
"Missing type object");
21502 if (likely(__Pyx_TypeCheck(obj, type)))
21504 PyErr_Format(PyExc_TypeError,
"Cannot convert %.200s to %.200s",
21505 Py_TYPE(obj)->tp_name, type->tp_name);
21510 #if CYTHON_FAST_THREAD_STATE
21511 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
21512 PyObject *tmp_type, *tmp_value, *tmp_tb;
21513 #if CYTHON_USE_EXC_INFO_STACK
21514 _PyErr_StackItem *exc_info = tstate->exc_info;
21515 tmp_type = exc_info->exc_type;
21516 tmp_value = exc_info->exc_value;
21517 tmp_tb = exc_info->exc_traceback;
21518 exc_info->exc_type = *type;
21519 exc_info->exc_value = *value;
21520 exc_info->exc_traceback = *tb;
21522 tmp_type = tstate->exc_type;
21523 tmp_value = tstate->exc_value;
21524 tmp_tb = tstate->exc_traceback;
21525 tstate->exc_type = *type;
21526 tstate->exc_value = *value;
21527 tstate->exc_traceback = *tb;
21530 *value = tmp_value;
21534 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
21535 PyObject *tmp_type, *tmp_value, *tmp_tb;
21536 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
21537 PyErr_SetExcInfo(*type, *value, *tb);
21539 *value = tmp_value;
21545 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
21546 PyObject *empty_list = 0;
21547 PyObject *module = 0;
21548 PyObject *global_dict = 0;
21549 PyObject *empty_dict = 0;
21551 #if PY_MAJOR_VERSION < 3
21552 PyObject *py_import;
21553 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
21560 empty_list = PyList_New(0);
21565 global_dict = PyModule_GetDict(__pyx_m);
21568 empty_dict = PyDict_New();
21572 #if PY_MAJOR_VERSION >= 3
21574 if ((1) && (strchr(__Pyx_MODULE_NAME,
'.'))) {
21575 module = PyImport_ImportModuleLevelObject(
21576 name, global_dict, empty_dict, list, 1);
21578 if (!PyErr_ExceptionMatches(PyExc_ImportError))
21587 #if PY_MAJOR_VERSION < 3
21588 PyObject *py_level = PyInt_FromLong(level);
21591 module = PyObject_CallFunctionObjArgs(py_import,
21592 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
21593 Py_DECREF(py_level);
21595 module = PyImport_ImportModuleLevelObject(
21596 name, global_dict, empty_dict, list, level);
21601 #if PY_MAJOR_VERSION < 3
21602 Py_XDECREF(py_import);
21604 Py_XDECREF(empty_list);
21605 Py_XDECREF(empty_dict);
21610 #if CYTHON_COMPILING_IN_CPYTHON
21611 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
21617 return b == &PyBaseObject_Type;
21619 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
21621 if (a == b)
return 1;
21625 n = PyTuple_GET_SIZE(mro);
21626 for (i = 0; i <
n; i++) {
21627 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
21632 return __Pyx_InBases(a, b);
21634 #if PY_MAJOR_VERSION == 2
21635 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
21636 PyObject *exception, *value, *tb;
21638 __Pyx_PyThreadState_declare
21639 __Pyx_PyThreadState_assign
21640 __Pyx_ErrFetch(&exception, &value, &tb);
21641 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
21642 if (unlikely(res == -1)) {
21643 PyErr_WriteUnraisable(err);
21647 res = PyObject_IsSubclass(err, exc_type2);
21648 if (unlikely(res == -1)) {
21649 PyErr_WriteUnraisable(err);
21653 __Pyx_ErrRestore(exception, value, tb);
21657 static CYTHON_INLINE
int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
21658 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
21660 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
21665 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
21667 assert(PyExceptionClass_Check(exc_type));
21668 n = PyTuple_GET_SIZE(tuple);
21669 #if PY_MAJOR_VERSION >= 3
21670 for (i=0; i<
n; i++) {
21671 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
21674 for (i=0; i<
n; i++) {
21675 PyObject *t = PyTuple_GET_ITEM(tuple, i);
21676 #if PY_MAJOR_VERSION < 3
21677 if (likely(exc_type == t))
return 1;
21679 if (likely(PyExceptionClass_Check(t))) {
21680 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
21686 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
21687 if (likely(err == exc_type))
return 1;
21688 if (likely(PyExceptionClass_Check(err))) {
21689 if (likely(PyExceptionClass_Check(exc_type))) {
21690 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
21691 }
else if (likely(PyTuple_Check(exc_type))) {
21692 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
21696 return PyErr_GivenExceptionMatches(err, exc_type);
21698 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
21699 assert(PyExceptionClass_Check(exc_type1));
21700 assert(PyExceptionClass_Check(exc_type2));
21701 if (likely(err == exc_type1 || err == exc_type2))
return 1;
21702 if (likely(PyExceptionClass_Check(err))) {
21703 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
21705 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
21710 #if !CYTHON_COMPILING_IN_PYPY
21711 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED
long intval,
int inplace,
int zerodivision_check) {
21713 (void)zerodivision_check;
21714 #if PY_MAJOR_VERSION < 3
21715 if (likely(PyInt_CheckExact(op1))) {
21716 const long b = intval;
21718 long a = PyInt_AS_LONG(op1);
21719 x = (long)((
unsigned long)a + b);
21720 if (likely((x^a) >= 0 || (x^b) >= 0))
21721 return PyInt_FromLong(x);
21722 return PyLong_Type.tp_as_number->nb_add(op1, op2);
21725 #if CYTHON_USE_PYLONG_INTERNALS
21726 if (likely(PyLong_CheckExact(op1))) {
21727 const long b = intval;
21729 #ifdef HAVE_LONG_LONG
21730 const PY_LONG_LONG llb = intval;
21731 PY_LONG_LONG lla, llx;
21733 const digit* digits = ((PyLongObject*)op1)->ob_digit;
21734 const Py_ssize_t size = Py_SIZE(op1);
21735 if (likely(__Pyx_sst_abs(size) <= 1)) {
21736 a = likely(size) ? digits[0] : 0;
21737 if (size == -1) a = -a;
21741 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
21742 a = -(long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
21744 #ifdef HAVE_LONG_LONG
21745 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
21746 lla = -(PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
21750 CYTHON_FALLTHROUGH;
21752 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
21753 a = (long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
21755 #ifdef HAVE_LONG_LONG
21756 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
21757 lla = (PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
21761 CYTHON_FALLTHROUGH;
21763 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
21764 a = -(long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
21766 #ifdef HAVE_LONG_LONG
21767 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
21768 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]));
21772 CYTHON_FALLTHROUGH;
21774 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
21775 a = (long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
21777 #ifdef HAVE_LONG_LONG
21778 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
21779 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]));
21783 CYTHON_FALLTHROUGH;
21785 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
21786 a = -(long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
21788 #ifdef HAVE_LONG_LONG
21789 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
21790 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]));
21794 CYTHON_FALLTHROUGH;
21796 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
21797 a = (long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
21799 #ifdef HAVE_LONG_LONG
21800 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
21801 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]));
21805 CYTHON_FALLTHROUGH;
21806 default:
return PyLong_Type.tp_as_number->nb_add(op1, op2);
21810 return PyLong_FromLong(x);
21811 #ifdef HAVE_LONG_LONG
21814 return PyLong_FromLongLong(llx);
21820 if (PyFloat_CheckExact(op1)) {
21821 const long b = intval;
21822 double a = PyFloat_AS_DOUBLE(op1);
21824 PyFPE_START_PROTECT(
"add",
return NULL)
21825 result = ((double)a) + (double)b;
21826 PyFPE_END_PROTECT(result)
21827 return PyFloat_FromDouble(result);
21829 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
21834 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname) {
21835 PyErr_Format(PyExc_UnboundLocalError,
"local variable '%s' referenced before assignment", varname);
21839 static CYTHON_INLINE
long __Pyx_div_long(
long a,
long b) {
21842 q -= ((
r != 0) & ((
r ^ b) < 0));
21847 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
21848 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
21849 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
21850 PyErr_Format(PyExc_ImportError,
21851 #
if PY_MAJOR_VERSION < 3
21852 "cannot import name %.230s", PyString_AS_STRING(name));
21854 "cannot import name %S", name);
21861 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *o, PyObject *
n) {
21863 if (unlikely(!__Pyx_PyBaseString_Check(
n))) {
21864 PyErr_SetString(PyExc_TypeError,
21865 "hasattr(): attribute name must be string");
21868 r = __Pyx_GetAttr(o,
n);
21869 if (unlikely(!
r)) {
21879 #if !CYTHON_COMPILING_IN_CPYTHON
21880 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
21881 return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
21886 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
21887 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
21888 PyErr_Format(PyExc_AttributeError,
21889 #
if PY_MAJOR_VERSION >= 3
21890 "'%.50s' object has no attribute '%U'",
21891 tp->tp_name, attr_name);
21893 "'%.50s' object has no attribute '%.400s'",
21894 tp->tp_name, PyString_AS_STRING(attr_name));
21898 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
21900 PyTypeObject *tp = Py_TYPE(obj);
21901 if (unlikely(!PyString_Check(attr_name))) {
21902 return PyObject_GenericGetAttr(obj, attr_name);
21904 assert(!tp->tp_dictoffset);
21905 descr = _PyType_Lookup(tp, attr_name);
21906 if (unlikely(!descr)) {
21907 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
21910 #if PY_MAJOR_VERSION < 3
21911 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
21914 descrgetfunc
f = Py_TYPE(descr)->tp_descr_get;
21916 PyObject *res =
f(descr, obj, (PyObject *)tp);
21926 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
21927 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
21928 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
21929 return PyObject_GenericGetAttr(obj, attr_name);
21931 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
21936 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(
void) {
21937 __Pyx_PyThreadState_declare
21938 __Pyx_PyThreadState_assign
21939 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
21940 __Pyx_PyErr_Clear();
21942 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
21944 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
21945 PyTypeObject* tp = Py_TYPE(obj);
21946 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
21947 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
21950 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
21951 if (unlikely(!result)) {
21952 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
21958 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
21960 PyObject *name_attr;
21961 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
21962 if (likely(name_attr)) {
21963 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
21967 if (unlikely(ret < 0)) {
21971 Py_XDECREF(name_attr);
21974 static int __Pyx_setup_reduce(PyObject* type_obj) {
21976 PyObject *object_reduce = NULL;
21977 PyObject *object_getstate = NULL;
21978 PyObject *object_reduce_ex = NULL;
21979 PyObject *reduce = NULL;
21980 PyObject *reduce_ex = NULL;
21981 PyObject *reduce_cython = NULL;
21982 PyObject *setstate = NULL;
21983 PyObject *setstate_cython = NULL;
21984 PyObject *getstate = NULL;
21985 #if CYTHON_USE_PYTYPE_LOOKUP
21986 getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate);
21988 getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate);
21989 if (!getstate && PyErr_Occurred()) {
21994 #if CYTHON_USE_PYTYPE_LOOKUP
21995 object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate);
21997 object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate);
21998 if (!object_getstate && PyErr_Occurred()) {
22002 if (object_getstate != getstate) {
22006 #if CYTHON_USE_PYTYPE_LOOKUP
22007 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
22009 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
22011 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex);
if (unlikely(!reduce_ex))
goto __PYX_BAD;
22012 if (reduce_ex == object_reduce_ex) {
22013 #if CYTHON_USE_PYTYPE_LOOKUP
22014 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
22016 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
22018 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce);
if (unlikely(!reduce))
goto __PYX_BAD;
22019 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
22020 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
22021 if (likely(reduce_cython)) {
22022 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
22023 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
22024 }
else if (reduce == object_reduce || PyErr_Occurred()) {
22027 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
22028 if (!setstate) PyErr_Clear();
22029 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
22030 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
22031 if (likely(setstate_cython)) {
22032 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
22033 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
22034 }
else if (!setstate || PyErr_Occurred()) {
22038 PyType_Modified((PyTypeObject*)type_obj);
22043 if (!PyErr_Occurred())
22044 PyErr_Format(PyExc_RuntimeError,
"Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
22047 #if !CYTHON_USE_PYTYPE_LOOKUP
22048 Py_XDECREF(object_reduce);
22049 Py_XDECREF(object_reduce_ex);
22050 Py_XDECREF(object_getstate);
22051 Py_XDECREF(getstate);
22053 Py_XDECREF(reduce);
22054 Py_XDECREF(reduce_ex);
22055 Py_XDECREF(reduce_cython);
22056 Py_XDECREF(setstate);
22057 Py_XDECREF(setstate_cython);
22062 static int __Pyx_SetVtable(PyObject *dict,
void *vtable) {
22063 #if PY_VERSION_HEX >= 0x02070000
22064 PyObject *ob = PyCapsule_New(vtable, 0, 0);
22066 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
22070 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
22080 #ifndef __PYX_HAVE_RT_ImportType
22081 #define __PYX_HAVE_RT_ImportType
22082 static PyTypeObject *__Pyx_ImportType(PyObject *module,
const char *module_name,
const char *class_name,
22083 size_t size,
enum __Pyx_ImportType_CheckSize check_size)
22085 PyObject *result = 0;
22087 Py_ssize_t basicsize;
22088 #ifdef Py_LIMITED_API
22089 PyObject *py_basicsize;
22091 result = PyObject_GetAttrString(module, class_name);
22094 if (!PyType_Check(result)) {
22095 PyErr_Format(PyExc_TypeError,
22096 "%.200s.%.200s is not a type object",
22097 module_name, class_name);
22100 #ifndef Py_LIMITED_API
22101 basicsize = ((PyTypeObject *)result)->tp_basicsize;
22103 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
22106 basicsize = PyLong_AsSsize_t(py_basicsize);
22107 Py_DECREF(py_basicsize);
22109 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
22112 if ((
size_t)basicsize < size) {
22113 PyErr_Format(PyExc_ValueError,
22114 "%.200s.%.200s size changed, may indicate binary incompatibility. "
22115 "Expected %zd from C header, got %zd from PyObject",
22116 module_name, class_name, size, basicsize);
22119 if (check_size == __Pyx_ImportType_CheckSize_Error && (
size_t)basicsize != size) {
22120 PyErr_Format(PyExc_ValueError,
22121 "%.200s.%.200s size changed, may indicate binary incompatibility. "
22122 "Expected %zd from C header, got %zd from PyObject",
22123 module_name, class_name, size, basicsize);
22126 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (
size_t)basicsize > size) {
22127 PyOS_snprintf(warning,
sizeof(warning),
22128 "%s.%s size changed, may indicate binary incompatibility. "
22129 "Expected %zd from C header, got %zd from PyObject",
22130 module_name, class_name, size, basicsize);
22131 if (PyErr_WarnEx(NULL, warning, 0) < 0)
goto bad;
22133 return (PyTypeObject *)result;
22135 Py_XDECREF(result);
22141 #ifndef CYTHON_CLINE_IN_TRACEBACK
22142 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate,
int c_line) {
22143 PyObject *use_cline;
22144 PyObject *ptype, *pvalue, *ptraceback;
22145 #if CYTHON_COMPILING_IN_CPYTHON
22146 PyObject **cython_runtime_dict;
22148 if (unlikely(!__pyx_cython_runtime)) {
22151 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
22152 #if CYTHON_COMPILING_IN_CPYTHON
22153 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
22154 if (likely(cython_runtime_dict)) {
22155 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
22156 use_cline, *cython_runtime_dict,
22157 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
22161 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
22162 if (use_cline_obj) {
22163 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
22164 Py_DECREF(use_cline_obj);
22172 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
22174 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
22177 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
22183 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
22184 int start = 0, mid = 0, end = count - 1;
22185 if (end >= 0 && code_line > entries[end].code_line) {
22188 while (start < end) {
22189 mid = start + (end - start) / 2;
22190 if (code_line < entries[mid].code_line) {
22192 }
else if (code_line > entries[mid].code_line) {
22198 if (code_line <= entries[mid].code_line) {
22204 static PyCodeObject *__pyx_find_code_object(
int code_line) {
22205 PyCodeObject* code_object;
22207 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
22210 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
22211 if (unlikely(
pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[
pos].code_line != code_line)) {
22214 code_object = __pyx_code_cache.entries[
pos].code_object;
22215 Py_INCREF(code_object);
22216 return code_object;
22218 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
22220 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
22221 if (unlikely(!code_line)) {
22224 if (unlikely(!entries)) {
22225 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
22226 if (likely(entries)) {
22227 __pyx_code_cache.entries = entries;
22228 __pyx_code_cache.max_count = 64;
22229 __pyx_code_cache.count = 1;
22230 entries[0].code_line = code_line;
22231 entries[0].code_object = code_object;
22232 Py_INCREF(code_object);
22236 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
22237 if ((
pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[
pos].code_line == code_line)) {
22238 PyCodeObject* tmp = entries[
pos].code_object;
22239 entries[
pos].code_object = code_object;
22243 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
22244 int new_max = __pyx_code_cache.max_count + 64;
22245 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
22246 __pyx_code_cache.entries, ((
size_t)new_max) *
sizeof(__Pyx_CodeObjectCacheEntry));
22247 if (unlikely(!entries)) {
22250 __pyx_code_cache.entries = entries;
22251 __pyx_code_cache.max_count = new_max;
22253 for (i=__pyx_code_cache.count; i>
pos; i--) {
22254 entries[i] = entries[i-1];
22256 entries[
pos].code_line = code_line;
22257 entries[
pos].code_object = code_object;
22258 __pyx_code_cache.count++;
22259 Py_INCREF(code_object);
22263 #include "compile.h"
22264 #include "frameobject.h"
22265 #include "traceback.h"
22266 #if PY_VERSION_HEX >= 0x030b00a6
22267 #ifndef Py_BUILD_CORE
22268 #define Py_BUILD_CORE 1
22270 #include "internal/pycore_frame.h"
22272 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
22273 const char *funcname,
int c_line,
22274 int py_line,
const char *filename) {
22275 PyCodeObject *py_code = NULL;
22276 PyObject *py_funcname = NULL;
22277 #if PY_MAJOR_VERSION < 3
22278 PyObject *py_srcfile = NULL;
22279 py_srcfile = PyString_FromString(filename);
22280 if (!py_srcfile)
goto bad;
22283 #if PY_MAJOR_VERSION < 3
22284 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
22285 if (!py_funcname)
goto bad;
22287 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
22288 if (!py_funcname)
goto bad;
22289 funcname = PyUnicode_AsUTF8(py_funcname);
22290 if (!funcname)
goto bad;
22294 #if PY_MAJOR_VERSION < 3
22295 py_funcname = PyString_FromString(funcname);
22296 if (!py_funcname)
goto bad;
22299 #if PY_MAJOR_VERSION < 3
22300 py_code = __Pyx_PyCode_New(
22317 Py_DECREF(py_srcfile);
22319 py_code = PyCode_NewEmpty(filename, funcname, py_line);
22321 Py_XDECREF(py_funcname);
22324 Py_XDECREF(py_funcname);
22325 #if PY_MAJOR_VERSION < 3
22326 Py_XDECREF(py_srcfile);
22330 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
22331 int py_line,
const char *filename) {
22332 PyCodeObject *py_code = 0;
22333 PyFrameObject *py_frame = 0;
22334 PyThreadState *tstate = __Pyx_PyThreadState_Current;
22335 PyObject *ptype, *pvalue, *ptraceback;
22337 c_line = __Pyx_CLineForTraceback(tstate, c_line);
22339 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
22341 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
22342 py_code = __Pyx_CreateCodeObjectForTraceback(
22343 funcname, c_line, py_line, filename);
22348 Py_XDECREF(pvalue);
22349 Py_XDECREF(ptraceback);
22352 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
22353 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
22355 py_frame = PyFrame_New(
22361 if (!py_frame)
goto bad;
22362 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
22363 PyTraceBack_Here(py_frame);
22365 Py_XDECREF(py_code);
22366 Py_XDECREF(py_frame);
22370 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
22371 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
22372 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
22373 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
22374 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
22376 func_type value = func_value;\
22377 if (sizeof(target_type) < sizeof(func_type)) {\
22378 if (unlikely(value != (func_type) (target_type) value)) {\
22379 func_type zero = 0;\
22380 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
22381 return (target_type) -1;\
22382 if (is_unsigned && unlikely(value < zero))\
22383 goto raise_neg_overflow;\
22385 goto raise_overflow;\
22388 return (target_type) value;\
22392 static CYTHON_INLINE PyObject *__pyx_memview_get_int(
const char *itemp) {
22393 return (PyObject *) __Pyx_PyInt_From_int(*(
int *) itemp);
22395 static CYTHON_INLINE
int __pyx_memview_set_int(
const char *itemp, PyObject *obj) {
22396 int value = __Pyx_PyInt_As_int(obj);
22397 if ((value == (
int)-1) && PyErr_Occurred())
22399 *(
int *) itemp = value;
22404 static CYTHON_INLINE PyObject *__pyx_memview_get_double(
const char *itemp) {
22405 return (PyObject *) PyFloat_FromDouble(*(
double *) itemp);
22407 static CYTHON_INLINE
int __pyx_memview_set_double(
const char *itemp, PyObject *obj) {
22408 double value = __pyx_PyFloat_AsDouble(obj);
22409 if ((value == (
double)-1) && PyErr_Occurred())
22411 *(
double *) itemp = value;
22416 #if CYTHON_CCOMPLEX
22418 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
22419 return ::std::complex< float >(x, y);
22422 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
22423 return x + y*(__pyx_t_float_complex)_Complex_I;
22427 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
22428 __pyx_t_float_complex
z;
22436 #if CYTHON_CCOMPLEX
22438 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22439 return (a.real == b.real) && (a.imag == b.imag);
22441 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22442 __pyx_t_float_complex
z;
22443 z.real = a.real + b.real;
22444 z.imag = a.imag + b.imag;
22447 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22448 __pyx_t_float_complex
z;
22449 z.real = a.real - b.real;
22450 z.imag = a.imag - b.imag;
22453 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22454 __pyx_t_float_complex
z;
22455 z.real = a.real * b.real - a.imag * b.imag;
22456 z.imag = a.real * b.imag + a.imag * b.real;
22460 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22462 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
22463 }
else if (fabsf(b.real) >= fabsf(b.imag)) {
22464 if (b.real == 0 && b.imag == 0) {
22465 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
22467 float r = b.imag / b.real;
22468 float s = (float)(1.0) / (b.real + b.imag *
r);
22469 return __pyx_t_float_complex_from_parts(
22470 (a.real + a.imag *
r) *
s, (a.imag - a.real *
r) *
s);
22473 float r = b.real / b.imag;
22474 float s = (float)(1.0) / (b.imag + b.real *
r);
22475 return __pyx_t_float_complex_from_parts(
22476 (a.real *
r + a.imag) *
s, (a.imag *
r - a.real) *
s);
22480 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22482 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
22484 float denom = b.real * b.real + b.imag * b.imag;
22485 return __pyx_t_float_complex_from_parts(
22486 (a.real * b.real + a.imag * b.imag) / denom,
22487 (a.imag * b.real - a.real * b.imag) / denom);
22491 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
22492 __pyx_t_float_complex
z;
22497 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
22498 return (a.real == 0) && (a.imag == 0);
22500 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
22501 __pyx_t_float_complex
z;
22507 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex
z) {
22508 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
22509 return sqrtf(
z.real*
z.real +
z.imag*
z.imag);
22511 return hypotf(
z.real,
z.imag);
22514 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
22515 __pyx_t_float_complex
z;
22516 float r, lnr, theta, z_r, z_theta;
22517 if (b.imag == 0 && b.real == (
int)b.real) {
22519 float denom = a.real * a.real + a.imag * a.imag;
22520 a.real = a.real / denom;
22521 a.imag = -a.imag / denom;
22524 switch ((
int)b.real) {
22532 return __Pyx_c_prod_float(a, a);
22534 z = __Pyx_c_prod_float(a, a);
22535 return __Pyx_c_prod_float(
z, a);
22537 z = __Pyx_c_prod_float(a, a);
22538 return __Pyx_c_prod_float(
z,
z);
22544 }
else if (b.imag == 0) {
22545 z.real = powf(a.real, b.real);
22548 }
else if (a.real > 0) {
22553 theta = atan2f(0.0, -1.0);
22556 r = __Pyx_c_abs_float(a);
22557 theta = atan2f(a.imag, a.real);
22560 z_r = expf(lnr * b.real - theta * b.imag);
22561 z_theta = theta * b.real + lnr * b.imag;
22562 z.real = z_r * cosf(z_theta);
22563 z.imag = z_r * sinf(z_theta);
22570 #if CYTHON_CCOMPLEX
22572 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
22573 return ::std::complex< double >(x, y);
22576 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
22577 return x + y*(__pyx_t_double_complex)_Complex_I;
22581 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
22582 __pyx_t_double_complex
z;
22590 #if CYTHON_CCOMPLEX
22592 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22593 return (a.real == b.real) && (a.imag == b.imag);
22595 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22596 __pyx_t_double_complex
z;
22597 z.real = a.real + b.real;
22598 z.imag = a.imag + b.imag;
22601 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22602 __pyx_t_double_complex
z;
22603 z.real = a.real - b.real;
22604 z.imag = a.imag - b.imag;
22607 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22608 __pyx_t_double_complex
z;
22609 z.real = a.real * b.real - a.imag * b.imag;
22610 z.imag = a.real * b.imag + a.imag * b.real;
22614 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22616 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
22617 }
else if (fabs(b.real) >= fabs(b.imag)) {
22618 if (b.real == 0 && b.imag == 0) {
22619 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
22621 double r = b.imag / b.real;
22622 double s = (double)(1.0) / (b.real + b.imag *
r);
22623 return __pyx_t_double_complex_from_parts(
22624 (a.real + a.imag *
r) *
s, (a.imag - a.real *
r) *
s);
22627 double r = b.real / b.imag;
22628 double s = (double)(1.0) / (b.imag + b.real *
r);
22629 return __pyx_t_double_complex_from_parts(
22630 (a.real *
r + a.imag) *
s, (a.imag *
r - a.real) *
s);
22634 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22636 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
22638 double denom = b.real * b.real + b.imag * b.imag;
22639 return __pyx_t_double_complex_from_parts(
22640 (a.real * b.real + a.imag * b.imag) / denom,
22641 (a.imag * b.real - a.real * b.imag) / denom);
22645 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
22646 __pyx_t_double_complex
z;
22651 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
22652 return (a.real == 0) && (a.imag == 0);
22654 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
22655 __pyx_t_double_complex
z;
22661 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex
z) {
22662 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
22663 return sqrt(
z.real*
z.real +
z.imag*
z.imag);
22665 return hypot(
z.real,
z.imag);
22668 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
22669 __pyx_t_double_complex
z;
22670 double r, lnr, theta, z_r, z_theta;
22671 if (b.imag == 0 && b.real == (
int)b.real) {
22673 double denom = a.real * a.real + a.imag * a.imag;
22674 a.real = a.real / denom;
22675 a.imag = -a.imag / denom;
22678 switch ((
int)b.real) {
22686 return __Pyx_c_prod_double(a, a);
22688 z = __Pyx_c_prod_double(a, a);
22689 return __Pyx_c_prod_double(
z, a);
22691 z = __Pyx_c_prod_double(a, a);
22692 return __Pyx_c_prod_double(
z,
z);
22698 }
else if (b.imag == 0) {
22699 z.real = pow(a.real, b.real);
22702 }
else if (a.real > 0) {
22707 theta = atan2(0.0, -1.0);
22710 r = __Pyx_c_abs_double(a);
22711 theta = atan2(a.imag, a.real);
22714 z_r = exp(lnr * b.real - theta * b.imag);
22715 z_theta = theta * b.real + lnr * b.imag;
22716 z.real = z_r * cos(z_theta);
22717 z.imag = z_r * sin(z_theta);
22723 #if PY_MAJOR_VERSION < 3
22724 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags) {
22725 if (PyObject_CheckBuffer(obj))
return PyObject_GetBuffer(obj, view, flags);
22726 if (__Pyx_TypeCheck(obj, __pyx_array_type))
return __pyx_array_getbuffer(obj, view, flags);
22727 if (__Pyx_TypeCheck(obj, __pyx_memoryview_type))
return __pyx_memoryview_getbuffer(obj, view, flags);
22728 PyErr_Format(PyExc_TypeError,
"'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
22731 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
22732 PyObject *obj = view->obj;
22734 if (PyObject_CheckBuffer(obj)) {
22735 PyBuffer_Release(view);
22747 __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim)
22749 int i, index, step, start;
22750 Py_ssize_t itemsize = mvs.memview->view.itemsize;
22751 if (order ==
'F') {
22758 for (i = 0; i < ndim; i++) {
22759 index = start + step * i;
22760 if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
22762 itemsize *= mvs.shape[index];
22769 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
22770 void **out_start,
void **out_end,
22771 int ndim,
size_t itemsize)
22775 start = end = slice->data;
22776 for (i = 0; i < ndim; i++) {
22777 Py_ssize_t stride = slice->strides[i];
22778 Py_ssize_t extent = slice->shape[i];
22780 *out_start = *out_end = start;
22784 end += stride * (extent - 1);
22786 start += stride * (extent - 1);
22789 *out_start = start;
22790 *out_end = end + itemsize;
22793 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
22794 __Pyx_memviewslice *slice2,
22795 int ndim,
size_t itemsize)
22797 void *start1, *end1, *start2, *end2;
22798 __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
22799 __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
22800 return (start1 < end2) && (start2 < end1);
22804 static CYTHON_INLINE PyObject *
22805 __pyx_capsule_create(
void *p, CYTHON_UNUSED
const char *sig)
22808 #if PY_VERSION_HEX >= 0x02070000
22809 cobj = PyCapsule_New(p, sig, NULL);
22811 cobj = PyCObject_FromVoidPtr(p, NULL);
22817 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
22818 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
22819 #pragma GCC diagnostic push
22820 #pragma GCC diagnostic ignored "-Wconversion"
22822 const int neg_one = (int) -1, const_zero = (
int) 0;
22823 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
22824 #pragma GCC diagnostic pop
22826 const int is_unsigned = neg_one > const_zero;
22827 #if PY_MAJOR_VERSION < 3
22828 if (likely(PyInt_Check(x))) {
22829 if (
sizeof(
int) <
sizeof(long)) {
22830 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
22832 long val = PyInt_AS_LONG(x);
22833 if (is_unsigned && unlikely(val < 0)) {
22834 goto raise_neg_overflow;
22840 if (likely(PyLong_Check(x))) {
22842 #if CYTHON_USE_PYLONG_INTERNALS
22843 const digit* digits = ((PyLongObject*)x)->ob_digit;
22844 switch (Py_SIZE(x)) {
22845 case 0:
return (
int) 0;
22846 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
22848 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
22849 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
22850 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
22851 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
22852 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
22857 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
22858 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
22859 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
22860 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
22861 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
22866 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
22867 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
22868 __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])))
22869 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
22870 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
22876 #if CYTHON_COMPILING_IN_CPYTHON
22877 if (unlikely(Py_SIZE(x) < 0)) {
22878 goto raise_neg_overflow;
22882 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
22883 if (unlikely(result < 0))
22885 if (unlikely(result == 1))
22886 goto raise_neg_overflow;
22889 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
22890 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
22891 #ifdef HAVE_LONG_LONG
22892 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
22893 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
22897 #if CYTHON_USE_PYLONG_INTERNALS
22898 const digit* digits = ((PyLongObject*)x)->ob_digit;
22899 switch (Py_SIZE(x)) {
22900 case 0:
return (
int) 0;
22901 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
22902 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
22904 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
22905 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
22906 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
22907 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
22908 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
22913 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
22914 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
22915 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
22916 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
22917 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
22922 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
22923 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
22924 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
22925 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
22926 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
22931 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
22932 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
22933 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
22934 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
22935 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
22940 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
22941 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
22942 __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])))
22943 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
22944 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
22949 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
22950 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
22951 __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])))
22952 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
22953 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
22959 if (
sizeof(
int) <=
sizeof(long)) {
22960 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
22961 #ifdef HAVE_LONG_LONG
22962 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
22963 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
22968 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
22969 PyErr_SetString(PyExc_RuntimeError,
22970 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
22973 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
22974 #if PY_MAJOR_VERSION < 3
22975 if (likely(
v) && !PyLong_Check(
v)) {
22977 v = PyNumber_Long(tmp);
22982 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
22983 unsigned char *bytes = (
unsigned char *)&val;
22984 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
22985 bytes,
sizeof(val),
22986 is_little, !is_unsigned);
22996 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
22997 if (!tmp)
return (
int) -1;
22998 val = __Pyx_PyInt_As_int(tmp);
23003 PyErr_SetString(PyExc_OverflowError,
23004 "value too large to convert to int");
23006 raise_neg_overflow:
23007 PyErr_SetString(PyExc_OverflowError,
23008 "can't convert negative value to int");
23013 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value) {
23014 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23015 #pragma GCC diagnostic push
23016 #pragma GCC diagnostic ignored "-Wconversion"
23018 const int neg_one = (int) -1, const_zero = (
int) 0;
23019 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23020 #pragma GCC diagnostic pop
23022 const int is_unsigned = neg_one > const_zero;
23024 if (
sizeof(
int) <
sizeof(long)) {
23025 return PyInt_FromLong((
long) value);
23026 }
else if (
sizeof(
int) <=
sizeof(
unsigned long)) {
23027 return PyLong_FromUnsignedLong((
unsigned long) value);
23028 #ifdef HAVE_LONG_LONG
23029 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
23030 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
23034 if (
sizeof(
int) <=
sizeof(
long)) {
23035 return PyInt_FromLong((
long) value);
23036 #ifdef HAVE_LONG_LONG
23037 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
23038 return PyLong_FromLongLong((PY_LONG_LONG) value);
23043 int one = 1;
int little = (int)*(
unsigned char *)&one;
23044 unsigned char *bytes = (
unsigned char *)&value;
23045 return _PyLong_FromByteArray(bytes,
sizeof(
int),
23046 little, !is_unsigned);
23051 static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type) {
23052 struct __pyx_typeinfo_string result = { {0} };
23053 char *buf = (
char *) result.string;
23054 size_t size = type->size;
23055 switch (type->typegroup) {
23062 *buf = (type->is_unsigned) ?
'B' :
'b';
23063 else if (size == 2)
23064 *buf = (type->is_unsigned) ?
'H' :
'h';
23065 else if (size == 4)
23066 *buf = (type->is_unsigned) ?
'I' :
'i';
23067 else if (size == 8)
23068 *buf = (type->is_unsigned) ?
'Q' :
'q';
23075 __Pyx_TypeInfo complex_type = *type;
23076 complex_type.typegroup =
'R';
23077 complex_type.size /= 2;
23079 *buf = __Pyx_TypeInfoToFormat(&complex_type).string[0];
23085 else if (size == 8)
23095 static __Pyx_memviewslice
23096 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
23097 const char *mode,
int ndim,
23098 size_t sizeof_dtype,
int contig_flag,
23099 int dtype_is_object)
23101 __Pyx_RefNannyDeclarations
23103 __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
23104 struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
23105 Py_buffer *buf = &from_memview->view;
23106 PyObject *shape_tuple = NULL;
23107 PyObject *temp_int = NULL;
23108 struct __pyx_array_obj *array_obj = NULL;
23109 struct __pyx_memoryview_obj *memview_obj = NULL;
23110 __Pyx_RefNannySetupContext(
"__pyx_memoryview_copy_new_contig", 0);
23111 for (i = 0; i < ndim; i++) {
23112 if (unlikely(from_mvs->suboffsets[i] >= 0)) {
23113 PyErr_Format(PyExc_ValueError,
"Cannot copy memoryview slice with "
23114 "indirect dimensions (axis %d)", i);
23118 shape_tuple = PyTuple_New(ndim);
23119 if (unlikely(!shape_tuple)) {
23122 __Pyx_GOTREF(shape_tuple);
23123 for(i = 0; i < ndim; i++) {
23124 temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
23125 if(unlikely(!temp_int)) {
23128 PyTuple_SET_ITEM(shape_tuple, i, temp_int);
23132 array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (
char *) mode, NULL);
23133 if (unlikely(!array_obj)) {
23136 __Pyx_GOTREF(array_obj);
23137 memview_obj = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
23138 (PyObject *) array_obj, contig_flag,
23140 from_mvs->memview->typeinfo);
23141 if (unlikely(!memview_obj))
23143 if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
23145 if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
23146 dtype_is_object) < 0))
23150 __Pyx_XDECREF(new_mvs.memview);
23151 new_mvs.memview = NULL;
23152 new_mvs.data = NULL;
23154 __Pyx_XDECREF(shape_tuple);
23155 __Pyx_XDECREF(temp_int);
23156 __Pyx_XDECREF(array_obj);
23157 __Pyx_RefNannyFinishContext();
23163 __Pyx_init_memviewslice(
struct __pyx_memoryview_obj *memview,
23165 __Pyx_memviewslice *memviewslice,
23166 int memview_is_new_reference)
23168 __Pyx_RefNannyDeclarations
23170 Py_buffer *buf = &memview->view;
23171 __Pyx_RefNannySetupContext(
"init_memviewslice", 0);
23172 if (unlikely(memviewslice->memview || memviewslice->data)) {
23173 PyErr_SetString(PyExc_ValueError,
23174 "memviewslice is already initialized!");
23177 if (buf->strides) {
23178 for (i = 0; i < ndim; i++) {
23179 memviewslice->strides[i] = buf->strides[i];
23182 Py_ssize_t stride = buf->itemsize;
23183 for (i = ndim - 1; i >= 0; i--) {
23184 memviewslice->strides[i] = stride;
23185 stride *= buf->shape[i];
23188 for (i = 0; i < ndim; i++) {
23189 memviewslice->shape[i] = buf->shape[i];
23190 if (buf->suboffsets) {
23191 memviewslice->suboffsets[i] = buf->suboffsets[i];
23193 memviewslice->suboffsets[i] = -1;
23196 memviewslice->memview = memview;
23197 memviewslice->data = (
char *)buf->buf;
23198 if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
23199 Py_INCREF(memview);
23204 memviewslice->memview = 0;
23205 memviewslice->data = 0;
23208 __Pyx_RefNannyFinishContext();
23211 #ifndef Py_NO_RETURN
23212 #define Py_NO_RETURN
23214 static void __pyx_fatalerror(
const char *fmt, ...) Py_NO_RETURN {
23217 #ifdef HAVE_STDARG_PROTOTYPES
23218 va_start(vargs, fmt);
23222 vsnprintf(msg, 200, fmt, vargs);
23224 Py_FatalError(msg);
23226 static CYTHON_INLINE
int
23227 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
23228 PyThread_type_lock lock)
23231 PyThread_acquire_lock(lock, 1);
23232 result = (*acquisition_count)++;
23233 PyThread_release_lock(lock);
23236 static CYTHON_INLINE
int
23237 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
23238 PyThread_type_lock lock)
23241 PyThread_acquire_lock(lock, 1);
23242 result = (*acquisition_count)--;
23243 PyThread_release_lock(lock);
23246 static CYTHON_INLINE
void
23247 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice,
int have_gil,
int lineno)
23250 struct __pyx_memoryview_obj *memview = memslice->memview;
23251 if (unlikely(!memview || (PyObject *) memview == Py_None))
23253 if (unlikely(__pyx_get_slice_count(memview) < 0))
23254 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
23255 __pyx_get_slice_count(memview), lineno);
23256 first_time = __pyx_add_acquisition_count(memview) == 0;
23257 if (unlikely(first_time)) {
23259 Py_INCREF((PyObject *) memview);
23261 PyGILState_STATE _gilstate = PyGILState_Ensure();
23262 Py_INCREF((PyObject *) memview);
23263 PyGILState_Release(_gilstate);
23267 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
23268 int have_gil,
int lineno) {
23270 struct __pyx_memoryview_obj *memview = memslice->memview;
23271 if (unlikely(!memview || (PyObject *) memview == Py_None)) {
23272 memslice->memview = NULL;
23275 if (unlikely(__pyx_get_slice_count(memview) <= 0))
23276 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
23277 __pyx_get_slice_count(memview), lineno);
23278 last_time = __pyx_sub_acquisition_count(memview) == 1;
23279 memslice->data = NULL;
23280 if (unlikely(last_time)) {
23282 Py_CLEAR(memslice->memview);
23284 PyGILState_STATE _gilstate = PyGILState_Ensure();
23285 Py_CLEAR(memslice->memview);
23286 PyGILState_Release(_gilstate);
23289 memslice->memview = NULL;
23294 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
23295 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23296 #pragma GCC diagnostic push
23297 #pragma GCC diagnostic ignored "-Wconversion"
23299 const long neg_one = (long) -1, const_zero = (
long) 0;
23300 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23301 #pragma GCC diagnostic pop
23303 const int is_unsigned = neg_one > const_zero;
23304 #if PY_MAJOR_VERSION < 3
23305 if (likely(PyInt_Check(x))) {
23306 if (
sizeof(
long) <
sizeof(long)) {
23307 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
23309 long val = PyInt_AS_LONG(x);
23310 if (is_unsigned && unlikely(val < 0)) {
23311 goto raise_neg_overflow;
23317 if (likely(PyLong_Check(x))) {
23319 #if CYTHON_USE_PYLONG_INTERNALS
23320 const digit* digits = ((PyLongObject*)x)->ob_digit;
23321 switch (Py_SIZE(x)) {
23322 case 0:
return (
long) 0;
23323 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
23325 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
23326 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
23327 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23328 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
23329 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
23334 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
23335 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
23336 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23337 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
23338 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
23343 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
23344 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
23345 __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])))
23346 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
23347 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
23353 #if CYTHON_COMPILING_IN_CPYTHON
23354 if (unlikely(Py_SIZE(x) < 0)) {
23355 goto raise_neg_overflow;
23359 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
23360 if (unlikely(result < 0))
23362 if (unlikely(result == 1))
23363 goto raise_neg_overflow;
23366 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
23367 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
23368 #ifdef HAVE_LONG_LONG
23369 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
23370 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
23374 #if CYTHON_USE_PYLONG_INTERNALS
23375 const digit* digits = ((PyLongObject*)x)->ob_digit;
23376 switch (Py_SIZE(x)) {
23377 case 0:
return (
long) 0;
23378 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
23379 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
23381 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
23382 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
23383 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23384 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
23385 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
23390 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
23391 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
23392 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23393 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
23394 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
23399 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
23400 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
23401 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23402 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
23403 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
23408 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
23409 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
23410 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23411 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
23412 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
23417 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
23418 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
23419 __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])))
23420 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
23421 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
23426 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
23427 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
23428 __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])))
23429 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
23430 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
23436 if (
sizeof(
long) <=
sizeof(long)) {
23437 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
23438 #ifdef HAVE_LONG_LONG
23439 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
23440 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
23445 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
23446 PyErr_SetString(PyExc_RuntimeError,
23447 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
23450 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
23451 #if PY_MAJOR_VERSION < 3
23452 if (likely(
v) && !PyLong_Check(
v)) {
23454 v = PyNumber_Long(tmp);
23459 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
23460 unsigned char *bytes = (
unsigned char *)&val;
23461 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
23462 bytes,
sizeof(val),
23463 is_little, !is_unsigned);
23473 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
23474 if (!tmp)
return (
long) -1;
23475 val = __Pyx_PyInt_As_long(tmp);
23480 PyErr_SetString(PyExc_OverflowError,
23481 "value too large to convert to long");
23483 raise_neg_overflow:
23484 PyErr_SetString(PyExc_OverflowError,
23485 "can't convert negative value to long");
23490 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
23491 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23492 #pragma GCC diagnostic push
23493 #pragma GCC diagnostic ignored "-Wconversion"
23495 const long neg_one = (long) -1, const_zero = (
long) 0;
23496 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23497 #pragma GCC diagnostic pop
23499 const int is_unsigned = neg_one > const_zero;
23501 if (
sizeof(
long) <
sizeof(long)) {
23502 return PyInt_FromLong((
long) value);
23503 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
23504 return PyLong_FromUnsignedLong((
unsigned long) value);
23505 #ifdef HAVE_LONG_LONG
23506 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
23507 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
23511 if (
sizeof(
long) <=
sizeof(
long)) {
23512 return PyInt_FromLong((
long) value);
23513 #ifdef HAVE_LONG_LONG
23514 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
23515 return PyLong_FromLongLong((PY_LONG_LONG) value);
23520 int one = 1;
int little = (int)*(
unsigned char *)&one;
23521 unsigned char *bytes = (
unsigned char *)&value;
23522 return _PyLong_FromByteArray(bytes,
sizeof(
long),
23523 little, !is_unsigned);
23528 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *x) {
23529 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23530 #pragma GCC diagnostic push
23531 #pragma GCC diagnostic ignored "-Wconversion"
23533 const char neg_one = (char) -1, const_zero = (
char) 0;
23534 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23535 #pragma GCC diagnostic pop
23537 const int is_unsigned = neg_one > const_zero;
23538 #if PY_MAJOR_VERSION < 3
23539 if (likely(PyInt_Check(x))) {
23540 if (
sizeof(
char) <
sizeof(long)) {
23541 __PYX_VERIFY_RETURN_INT(
char,
long, PyInt_AS_LONG(x))
23543 long val = PyInt_AS_LONG(x);
23544 if (is_unsigned && unlikely(val < 0)) {
23545 goto raise_neg_overflow;
23551 if (likely(PyLong_Check(x))) {
23553 #if CYTHON_USE_PYLONG_INTERNALS
23554 const digit* digits = ((PyLongObject*)x)->ob_digit;
23555 switch (Py_SIZE(x)) {
23556 case 0:
return (
char) 0;
23557 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, digits[0])
23559 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
23560 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
23561 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23562 }
else if (8 *
sizeof(
char) >= 2 * PyLong_SHIFT) {
23563 return (
char) (((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
23568 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
23569 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
23570 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23571 }
else if (8 *
sizeof(
char) >= 3 * PyLong_SHIFT) {
23572 return (
char) (((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
23577 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
23578 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
23579 __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])))
23580 }
else if (8 *
sizeof(
char) >= 4 * PyLong_SHIFT) {
23581 return (
char) (((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
23587 #if CYTHON_COMPILING_IN_CPYTHON
23588 if (unlikely(Py_SIZE(x) < 0)) {
23589 goto raise_neg_overflow;
23593 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
23594 if (unlikely(result < 0))
23596 if (unlikely(result == 1))
23597 goto raise_neg_overflow;
23600 if (
sizeof(
char) <=
sizeof(
unsigned long)) {
23601 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned long, PyLong_AsUnsignedLong(x))
23602 #ifdef HAVE_LONG_LONG
23603 }
else if (
sizeof(
char) <=
sizeof(
unsigned PY_LONG_LONG)) {
23604 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
23608 #if CYTHON_USE_PYLONG_INTERNALS
23609 const digit* digits = ((PyLongObject*)x)->ob_digit;
23610 switch (Py_SIZE(x)) {
23611 case 0:
return (
char) 0;
23612 case -1: __PYX_VERIFY_RETURN_INT(
char, sdigit, (sdigit) (-(sdigit)digits[0]))
23613 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, +digits[0])
23615 if (8 *
sizeof(
char) - 1 > 1 * PyLong_SHIFT) {
23616 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
23617 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23618 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
23619 return (
char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
23624 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
23625 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
23626 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23627 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
23628 return (
char) ((((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
23633 if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
23634 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
23635 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23636 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
23637 return (
char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
23642 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
23643 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
23644 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23645 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
23646 return (
char) ((((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
23651 if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
23652 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
23653 __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])))
23654 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
23655 return (
char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
23660 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
23661 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
23662 __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])))
23663 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
23664 return (
char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
23670 if (
sizeof(
char) <=
sizeof(long)) {
23671 __PYX_VERIFY_RETURN_INT_EXC(
char,
long, PyLong_AsLong(x))
23672 #ifdef HAVE_LONG_LONG
23673 }
else if (
sizeof(
char) <=
sizeof(PY_LONG_LONG)) {
23674 __PYX_VERIFY_RETURN_INT_EXC(
char, PY_LONG_LONG, PyLong_AsLongLong(x))
23679 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
23680 PyErr_SetString(PyExc_RuntimeError,
23681 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
23684 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
23685 #if PY_MAJOR_VERSION < 3
23686 if (likely(
v) && !PyLong_Check(
v)) {
23688 v = PyNumber_Long(tmp);
23693 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
23694 unsigned char *bytes = (
unsigned char *)&val;
23695 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
23696 bytes,
sizeof(val),
23697 is_little, !is_unsigned);
23707 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
23708 if (!tmp)
return (
char) -1;
23709 val = __Pyx_PyInt_As_char(tmp);
23714 PyErr_SetString(PyExc_OverflowError,
23715 "value too large to convert to char");
23717 raise_neg_overflow:
23718 PyErr_SetString(PyExc_OverflowError,
23719 "can't convert negative value to char");
23724 static int __Pyx_check_binary_version(
void) {
23726 int same=1, i, found_dot;
23727 const char* rt_from_call = Py_GetVersion();
23728 PyOS_snprintf(ctversion, 5,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
23730 for (i = 0; i < 4; i++) {
23731 if (!ctversion[i]) {
23732 same = (rt_from_call[i] <
'0' || rt_from_call[i] >
'9');
23735 if (rt_from_call[i] != ctversion[i]) {
23741 char rtversion[5] = {
'\0'};
23743 for (i=0; i<4; ++i) {
23744 if (rt_from_call[i] ==
'.') {
23745 if (found_dot)
break;
23747 }
else if (rt_from_call[i] <
'0' || rt_from_call[i] >
'9') {
23750 rtversion[i] = rt_from_call[i];
23752 PyOS_snprintf(message,
sizeof(message),
23753 "compiletime version %s of module '%.100s' "
23754 "does not match runtime version %s",
23755 ctversion, __Pyx_MODULE_NAME, rtversion);
23756 return PyErr_WarnEx(NULL, message, 1);
23762 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
23764 #if PY_MAJOR_VERSION < 3
23765 if (t->is_unicode) {
23766 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
23767 }
else if (t->intern) {
23768 *t->p = PyString_InternFromString(t->s);
23770 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
23773 if (t->is_unicode | t->is_str) {
23775 *t->p = PyUnicode_InternFromString(t->s);
23776 }
else if (t->encoding) {
23777 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
23779 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
23782 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
23787 if (PyObject_Hash(*t->p) == -1)
23794 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
23795 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
23797 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
23799 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
23801 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
23802 #if !CYTHON_PEP393_ENABLED
23803 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
23805 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
23806 if (!defenc)
return NULL;
23807 defenc_c = PyBytes_AS_STRING(defenc);
23808 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
23810 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
23812 for (
c = defenc_c;
c < end;
c++) {
23813 if ((
unsigned char) (*
c) >= 128) {
23814 PyUnicode_AsASCIIString(o);
23820 *length = PyBytes_GET_SIZE(defenc);
23824 static CYTHON_INLINE
const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
23825 if (unlikely(__Pyx_PyUnicode_READY(o) == -1))
return NULL;
23826 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
23827 if (likely(PyUnicode_IS_ASCII(o))) {
23828 *length = PyUnicode_GET_LENGTH(o);
23829 return PyUnicode_AsUTF8(o);
23831 PyUnicode_AsASCIIString(o);
23835 return PyUnicode_AsUTF8AndSize(o, length);
23840 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
23841 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
23843 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
23844 __Pyx_sys_getdefaultencoding_not_ascii &&
23846 PyUnicode_Check(o)) {
23847 return __Pyx_PyUnicode_AsStringAndSize(o, length);
23850 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
23851 if (PyByteArray_Check(o)) {
23852 *length = PyByteArray_GET_SIZE(o);
23853 return PyByteArray_AS_STRING(o);
23858 int r = PyBytes_AsStringAndSize(o, &result, length);
23859 if (unlikely(
r < 0)) {
23866 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
23867 int is_true = x == Py_True;
23868 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
23869 else return PyObject_IsTrue(x);
23871 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
23873 if (unlikely(!x))
return -1;
23874 retval = __Pyx_PyObject_IsTrue(x);
23878 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result,
const char* type_name) {
23879 #if PY_MAJOR_VERSION >= 3
23880 if (PyLong_Check(result)) {
23881 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
23882 "__int__ returned non-int (type %.200s). "
23883 "The ability to return an instance of a strict subclass of int "
23884 "is deprecated, and may be removed in a future version of Python.",
23885 Py_TYPE(result)->tp_name)) {
23892 PyErr_Format(PyExc_TypeError,
23893 "__%.4s__ returned non-%.4s (type %.200s)",
23894 type_name, type_name, Py_TYPE(result)->tp_name);
23898 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
23899 #if CYTHON_USE_TYPE_SLOTS
23900 PyNumberMethods *m;
23902 const char *name = NULL;
23903 PyObject *res = NULL;
23904 #if PY_MAJOR_VERSION < 3
23905 if (likely(PyInt_Check(x) || PyLong_Check(x)))
23907 if (likely(PyLong_Check(x)))
23909 return __Pyx_NewRef(x);
23910 #if CYTHON_USE_TYPE_SLOTS
23911 m = Py_TYPE(x)->tp_as_number;
23912 #if PY_MAJOR_VERSION < 3
23913 if (m && m->nb_int) {
23915 res = m->nb_int(x);
23917 else if (m && m->nb_long) {
23919 res = m->nb_long(x);
23922 if (likely(m && m->nb_int)) {
23924 res = m->nb_int(x);
23928 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
23929 res = PyNumber_Int(x);
23933 #if PY_MAJOR_VERSION < 3
23934 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
23936 if (unlikely(!PyLong_CheckExact(res))) {
23938 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
23941 else if (!PyErr_Occurred()) {
23942 PyErr_SetString(PyExc_TypeError,
23943 "an integer is required");
23947 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
23950 #if PY_MAJOR_VERSION < 3
23951 if (likely(PyInt_CheckExact(b))) {
23952 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
23953 return PyInt_AS_LONG(b);
23955 return PyInt_AsSsize_t(b);
23958 if (likely(PyLong_CheckExact(b))) {
23959 #if CYTHON_USE_PYLONG_INTERNALS
23960 const digit* digits = ((PyLongObject*)b)->ob_digit;
23961 const Py_ssize_t size = Py_SIZE(b);
23962 if (likely(__Pyx_sst_abs(size) <= 1)) {
23963 ival = likely(size) ? digits[0] : 0;
23964 if (size == -1) ival = -ival;
23969 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
23970 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
23974 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
23975 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
23979 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
23980 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
23984 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
23985 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
23989 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
23990 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]));
23994 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
23995 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]));
24001 return PyLong_AsSsize_t(b);
24003 x = PyNumber_Index(b);
24005 ival = PyInt_AsSsize_t(x);
24009 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
24010 if (
sizeof(Py_hash_t) ==
sizeof(Py_ssize_t)) {
24011 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
24012 #if PY_MAJOR_VERSION < 3
24013 }
else if (likely(PyInt_CheckExact(o))) {
24014 return PyInt_AS_LONG(o);
24019 x = PyNumber_Index(o);
24021 ival = PyInt_AsLong(x);
24026 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
24027 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
24029 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
24030 return PyInt_FromSize_t(ival);