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
306 #ifndef CYTHON_INLINE
307 #if defined(__clang__)
308 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
309 #elif defined(__GNUC__)
310 #define CYTHON_INLINE __inline__
311 #elif defined(_MSC_VER)
312 #define CYTHON_INLINE __inline
313 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
314 #define CYTHON_INLINE inline
316 #define CYTHON_INLINE
320 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
321 #define Py_OptimizeFlag 0
323 #define __PYX_BUILD_PY_SSIZE_T "n"
324 #define CYTHON_FORMAT_SSIZE_T "z"
325 #if PY_MAJOR_VERSION < 3
326 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
327 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
328 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
329 #define __Pyx_DefaultClassType PyClass_Type
331 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
332 #define __Pyx_DefaultClassType PyType_Type
333 #if PY_VERSION_HEX >= 0x030B00A1
334 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(
int a,
int k,
int l,
int s,
int f,
335 PyObject *code, PyObject *
c, PyObject*
n, PyObject *
v,
336 PyObject *fv, PyObject *cell, PyObject* fn,
337 PyObject *name,
int fline, PyObject *lnos) {
338 PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
339 PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
340 const char *fn_cstr=NULL;
341 const char *name_cstr=NULL;
342 PyCodeObject* co=NULL;
343 PyObject *type, *value, *traceback;
344 PyErr_Fetch(&type, &value, &traceback);
345 if (!(kwds=PyDict_New()))
goto end;
346 if (!(argcount=PyLong_FromLong(a)))
goto end;
347 if (PyDict_SetItemString(kwds,
"co_argcount", argcount) != 0)
goto end;
348 if (!(posonlyargcount=PyLong_FromLong(0)))
goto end;
349 if (PyDict_SetItemString(kwds,
"co_posonlyargcount", posonlyargcount) != 0)
goto end;
350 if (!(kwonlyargcount=PyLong_FromLong(k)))
goto end;
351 if (PyDict_SetItemString(kwds,
"co_kwonlyargcount", kwonlyargcount) != 0)
goto end;
352 if (!(nlocals=PyLong_FromLong(l)))
goto end;
353 if (PyDict_SetItemString(kwds,
"co_nlocals", nlocals) != 0)
goto end;
354 if (!(stacksize=PyLong_FromLong(
s)))
goto end;
355 if (PyDict_SetItemString(kwds,
"co_stacksize", stacksize) != 0)
goto end;
356 if (!(flags=PyLong_FromLong(
f)))
goto end;
357 if (PyDict_SetItemString(kwds,
"co_flags", flags) != 0)
goto end;
358 if (PyDict_SetItemString(kwds,
"co_code", code) != 0)
goto end;
359 if (PyDict_SetItemString(kwds,
"co_consts",
c) != 0)
goto end;
360 if (PyDict_SetItemString(kwds,
"co_names",
n) != 0)
goto end;
361 if (PyDict_SetItemString(kwds,
"co_varnames",
v) != 0)
goto end;
362 if (PyDict_SetItemString(kwds,
"co_freevars", fv) != 0)
goto end;
363 if (PyDict_SetItemString(kwds,
"co_cellvars", cell) != 0)
goto end;
364 if (PyDict_SetItemString(kwds,
"co_linetable", lnos) != 0)
goto end;
365 if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL)))
goto end;
366 if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL)))
goto end;
367 if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline)))
goto end;
368 if (!(replace = PyObject_GetAttrString((PyObject*)co,
"replace")))
goto cleanup_code_too;
369 if (!(empty = PyTuple_New(0)))
goto cleanup_code_too;
370 if (!(call_result = PyObject_Call(replace, empty, kwds)))
goto cleanup_code_too;
371 Py_XDECREF((PyObject*)co);
372 co = (PyCodeObject*)call_result;
376 Py_XDECREF((PyObject*)co);
381 Py_XDECREF(argcount);
382 Py_XDECREF(posonlyargcount);
383 Py_XDECREF(kwonlyargcount);
385 Py_XDECREF(stacksize);
387 Py_XDECREF(call_result);
390 PyErr_Restore(type, value, traceback);
395 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
396 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
398 #define __Pyx_DefaultClassType PyType_Type
400 #ifndef Py_TPFLAGS_CHECKTYPES
401 #define Py_TPFLAGS_CHECKTYPES 0
403 #ifndef Py_TPFLAGS_HAVE_INDEX
404 #define Py_TPFLAGS_HAVE_INDEX 0
406 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
407 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
409 #ifndef Py_TPFLAGS_HAVE_FINALIZE
410 #define Py_TPFLAGS_HAVE_FINALIZE 0
412 #ifndef METH_STACKLESS
413 #define METH_STACKLESS 0
415 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
416 #ifndef METH_FASTCALL
417 #define METH_FASTCALL 0x80
419 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *
self, PyObject *
const *args, Py_ssize_t nargs);
420 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *
self, PyObject *
const *args,
421 Py_ssize_t nargs, PyObject *kwnames);
423 #define __Pyx_PyCFunctionFast _PyCFunctionFast
424 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
426 #if CYTHON_FAST_PYCCALL
427 #define __Pyx_PyFastCFunction_Check(func)\
428 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
430 #define __Pyx_PyFastCFunction_Check(func) 0
432 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
433 #define PyObject_Malloc(s) PyMem_Malloc(s)
434 #define PyObject_Free(p) PyMem_Free(p)
435 #define PyObject_Realloc(p) PyMem_Realloc(p)
437 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
438 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
439 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
440 #define PyMem_RawFree(p) PyMem_Free(p)
442 #if CYTHON_COMPILING_IN_PYSTON
443 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
444 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
446 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
447 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
449 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
450 #define __Pyx_PyThreadState_Current PyThreadState_GET()
451 #elif PY_VERSION_HEX >= 0x03060000
452 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
453 #elif PY_VERSION_HEX >= 0x03000000
454 #define __Pyx_PyThreadState_Current PyThreadState_GET()
456 #define __Pyx_PyThreadState_Current _PyThreadState_Current
458 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
459 #include "pythread.h"
460 #define Py_tss_NEEDS_INIT 0
461 typedef int Py_tss_t;
462 static CYTHON_INLINE
int PyThread_tss_create(Py_tss_t *key) {
463 *key = PyThread_create_key();
466 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(
void) {
467 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(
sizeof(Py_tss_t));
468 *key = Py_tss_NEEDS_INIT;
471 static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
474 static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
475 return *key != Py_tss_NEEDS_INIT;
477 static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
478 PyThread_delete_key(*key);
479 *key = Py_tss_NEEDS_INIT;
481 static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
482 return PyThread_set_key_value(*key, value);
484 static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
485 return PyThread_get_key_value(*key);
488 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
489 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
491 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
493 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
494 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
495 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
497 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
498 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
500 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
501 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
503 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
505 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
506 #define CYTHON_PEP393_ENABLED 1
507 #if defined(PyUnicode_IS_READY)
508 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
509 0 : _PyUnicode_Ready((PyObject *)(op)))
511 #define __Pyx_PyUnicode_READY(op) (0)
513 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
514 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
515 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
516 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
517 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
518 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
519 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
520 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
521 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
522 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
524 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
527 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
530 #define CYTHON_PEP393_ENABLED 0
531 #define PyUnicode_1BYTE_KIND 1
532 #define PyUnicode_2BYTE_KIND 2
533 #define PyUnicode_4BYTE_KIND 4
534 #define __Pyx_PyUnicode_READY(op) (0)
535 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
536 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
537 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
538 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
539 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
540 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
541 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
542 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
544 #if CYTHON_COMPILING_IN_PYPY
545 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
546 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
548 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
549 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
550 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
552 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
553 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
555 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
556 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
558 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
559 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
561 #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))
562 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
563 #if PY_MAJOR_VERSION >= 3
564 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
566 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
568 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
569 #define PyObject_ASCII(o) PyObject_Repr(o)
571 #if PY_MAJOR_VERSION >= 3
572 #define PyBaseString_Type PyUnicode_Type
573 #define PyStringObject PyUnicodeObject
574 #define PyString_Type PyUnicode_Type
575 #define PyString_Check PyUnicode_Check
576 #define PyString_CheckExact PyUnicode_CheckExact
577 #ifndef PyObject_Unicode
578 #define PyObject_Unicode PyObject_Str
581 #if PY_MAJOR_VERSION >= 3
582 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
583 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
585 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
586 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
588 #ifndef PySet_CheckExact
589 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
591 #if PY_VERSION_HEX >= 0x030900A4
592 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
593 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
595 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
596 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
598 #if CYTHON_ASSUME_SAFE_MACROS
599 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
601 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
603 #if PY_MAJOR_VERSION >= 3
604 #define PyIntObject PyLongObject
605 #define PyInt_Type PyLong_Type
606 #define PyInt_Check(op) PyLong_Check(op)
607 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
608 #define PyInt_FromString PyLong_FromString
609 #define PyInt_FromUnicode PyLong_FromUnicode
610 #define PyInt_FromLong PyLong_FromLong
611 #define PyInt_FromSize_t PyLong_FromSize_t
612 #define PyInt_FromSsize_t PyLong_FromSsize_t
613 #define PyInt_AsLong PyLong_AsLong
614 #define PyInt_AS_LONG PyLong_AS_LONG
615 #define PyInt_AsSsize_t PyLong_AsSsize_t
616 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
617 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
618 #define PyNumber_Int PyNumber_Long
620 #if PY_MAJOR_VERSION >= 3
621 #define PyBoolObject PyLongObject
623 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
624 #ifndef PyUnicode_InternFromString
625 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
628 #if PY_VERSION_HEX < 0x030200A4
629 typedef long Py_hash_t;
630 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
631 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
633 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
634 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
636 #if PY_MAJOR_VERSION >= 3
637 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
639 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
641 #if CYTHON_USE_ASYNC_SLOTS
642 #if PY_VERSION_HEX >= 0x030500B1
643 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
644 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
646 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
649 #define __Pyx_PyType_AsAsync(obj) NULL
651 #ifndef __Pyx_PyAsyncMethodsStruct
656 } __Pyx_PyAsyncMethodsStruct;
659 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
660 #if !defined(_USE_MATH_DEFINES)
661 #define _USE_MATH_DEFINES
666 #define __PYX_NAN() ((float) NAN)
668 static CYTHON_INLINE
float __PYX_NAN() {
670 memset(&value, 0xFF,
sizeof(value));
674 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
675 #define __Pyx_truncl trunc
677 #define __Pyx_truncl truncl
680 #define __PYX_MARK_ERR_POS(f_index, lineno) \
681 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
682 #define __PYX_ERR(f_index, lineno, Ln_error) \
683 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
685 #ifndef __PYX_EXTERN_C
687 #define __PYX_EXTERN_C extern "C"
689 #define __PYX_EXTERN_C extern
693 #define __PYX_HAVE__clapack
694 #define __PYX_HAVE_API__clapack
698 #include "numpy/arrayobject.h"
699 #include "numpy/ndarrayobject.h"
700 #include "numpy/ndarraytypes.h"
701 #include "numpy/arrayscalars.h"
702 #include "numpy/ufuncobject.h"
712 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
713 #define CYTHON_WITHOUT_ASSERTIONS
716 typedef struct {PyObject **p;
const char *
s;
const Py_ssize_t
n;
const char* encoding;
717 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
719 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
720 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
721 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
722 #define __PYX_DEFAULT_STRING_ENCODING ""
723 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
724 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
725 #define __Pyx_uchar_cast(c) ((unsigned char)c)
726 #define __Pyx_long_cast(x) ((long)x)
727 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
728 (sizeof(type) < sizeof(Py_ssize_t)) ||\
729 (sizeof(type) > sizeof(Py_ssize_t) &&\
730 likely(v < (type)PY_SSIZE_T_MAX ||\
731 v == (type)PY_SSIZE_T_MAX) &&\
732 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
733 v == (type)PY_SSIZE_T_MIN))) ||\
734 (sizeof(type) == sizeof(Py_ssize_t) &&\
735 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
736 v == (type)PY_SSIZE_T_MAX))) )
737 static CYTHON_INLINE
int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
738 return (
size_t) i < (size_t) limit;
740 #if defined (__cplusplus) && __cplusplus >= 201103L
742 #define __Pyx_sst_abs(value) std::abs(value)
743 #elif SIZEOF_INT >= SIZEOF_SIZE_T
744 #define __Pyx_sst_abs(value) abs(value)
745 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
746 #define __Pyx_sst_abs(value) labs(value)
747 #elif defined (_MSC_VER)
748 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
749 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
750 #define __Pyx_sst_abs(value) llabs(value)
751 #elif defined (__GNUC__)
752 #define __Pyx_sst_abs(value) __builtin_llabs(value)
754 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
756 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
757 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
758 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
759 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
760 #define __Pyx_PyBytes_FromString PyBytes_FromString
761 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
762 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
763 #if PY_MAJOR_VERSION < 3
764 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
765 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
767 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
768 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
770 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
771 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
772 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
773 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
774 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
775 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
776 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
777 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
778 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
779 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
780 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
781 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
782 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
783 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
784 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
785 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
786 static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *
u) {
787 const Py_UNICODE *u_end =
u;
789 return (
size_t)(u_end -
u - 1);
791 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
792 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
793 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
794 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
795 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
796 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b);
797 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
798 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
799 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
800 #define __Pyx_PySequence_Tuple(obj)\
801 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
802 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
803 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
804 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
805 #if CYTHON_ASSUME_SAFE_MACROS
806 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
808 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
810 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
811 #if PY_MAJOR_VERSION >= 3
812 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
814 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
816 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
817 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
818 static int __Pyx_sys_getdefaultencoding_not_ascii;
819 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
821 PyObject* default_encoding = NULL;
822 PyObject* ascii_chars_u = NULL;
823 PyObject* ascii_chars_b = NULL;
824 const char* default_encoding_c;
825 sys = PyImport_ImportModule(
"sys");
827 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
829 if (!default_encoding)
goto bad;
830 default_encoding_c = PyBytes_AsString(default_encoding);
831 if (!default_encoding_c)
goto bad;
832 if (strcmp(default_encoding_c,
"ascii") == 0) {
833 __Pyx_sys_getdefaultencoding_not_ascii = 0;
835 char ascii_chars[128];
837 for (
c = 0;
c < 128;
c++) {
840 __Pyx_sys_getdefaultencoding_not_ascii = 1;
841 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
842 if (!ascii_chars_u)
goto bad;
843 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
844 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
847 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
851 Py_DECREF(ascii_chars_u);
852 Py_DECREF(ascii_chars_b);
854 Py_DECREF(default_encoding);
857 Py_XDECREF(default_encoding);
858 Py_XDECREF(ascii_chars_u);
859 Py_XDECREF(ascii_chars_b);
863 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
864 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
866 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
867 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
868 static char* __PYX_DEFAULT_STRING_ENCODING;
869 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
871 PyObject* default_encoding = NULL;
872 char* default_encoding_c;
873 sys = PyImport_ImportModule(
"sys");
875 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
877 if (!default_encoding)
goto bad;
878 default_encoding_c = PyBytes_AsString(default_encoding);
879 if (!default_encoding_c)
goto bad;
880 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c) + 1);
881 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
882 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
883 Py_DECREF(default_encoding);
886 Py_XDECREF(default_encoding);
894 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
895 #define likely(x) __builtin_expect(!!(x), 1)
896 #define unlikely(x) __builtin_expect(!!(x), 0)
898 #define likely(x) (x)
899 #define unlikely(x) (x)
901 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
903 static PyObject *__pyx_m = NULL;
904 static PyObject *__pyx_d;
905 static PyObject *__pyx_b;
906 static PyObject *__pyx_cython_runtime = NULL;
907 static PyObject *__pyx_empty_tuple;
908 static PyObject *__pyx_empty_bytes;
909 static PyObject *__pyx_empty_unicode;
910 static int __pyx_lineno;
911 static int __pyx_clineno = 0;
912 static const char * __pyx_cfilenm= __FILE__;
913 static const char *__pyx_filename;
916 #if !defined(CYTHON_CCOMPLEX)
917 #if defined(__cplusplus)
918 #define CYTHON_CCOMPLEX 1
919 #elif defined(_Complex_I)
920 #define CYTHON_CCOMPLEX 1
922 #define CYTHON_CCOMPLEX 0
932 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
934 #define _Complex_I 1.0fj
938 static const char *__pyx_f[] = {
939 "proteus/clapack.pyx",
951 typedef npy_int8 __pyx_t_5numpy_int8_t;
960 typedef npy_int16 __pyx_t_5numpy_int16_t;
969 typedef npy_int32 __pyx_t_5numpy_int32_t;
978 typedef npy_int64 __pyx_t_5numpy_int64_t;
987 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
996 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1005 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1014 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1023 typedef npy_float32 __pyx_t_5numpy_float32_t;
1032 typedef npy_float64 __pyx_t_5numpy_float64_t;
1041 typedef npy_long __pyx_t_5numpy_int_t;
1050 typedef npy_longlong __pyx_t_5numpy_long_t;
1059 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1068 typedef npy_ulong __pyx_t_5numpy_uint_t;
1077 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1086 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1095 typedef npy_intp __pyx_t_5numpy_intp_t;
1104 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1113 typedef npy_double __pyx_t_5numpy_float_t;
1122 typedef npy_double __pyx_t_5numpy_double_t;
1131 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1135 typedef ::std::complex< float > __pyx_t_float_complex;
1137 typedef float _Complex __pyx_t_float_complex;
1140 typedef struct {
float real, imag; } __pyx_t_float_complex;
1142 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float,
float);
1147 typedef ::std::complex< double > __pyx_t_double_complex;
1149 typedef double _Complex __pyx_t_double_complex;
1152 typedef struct {
double real, imag; } __pyx_t_double_complex;
1154 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double,
double);
1166 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1175 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1184 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1193 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1197 #ifndef CYTHON_REFNANNY
1198 #define CYTHON_REFNANNY 0
1202 void (*INCREF)(
void*, PyObject*, int);
1203 void (*DECREF)(
void*, PyObject*, int);
1204 void (*GOTREF)(
void*, PyObject*, int);
1205 void (*GIVEREF)(
void*, PyObject*, int);
1206 void* (*SetupContext)(
const char*, int,
const char*);
1207 void (*FinishContext)(
void**);
1208 } __Pyx_RefNannyAPIStruct;
1209 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1210 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
1211 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1213 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1215 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1216 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1217 PyGILState_Release(__pyx_gilstate_save);\
1219 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1222 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1223 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1225 #define __Pyx_RefNannyFinishContext()\
1226 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1227 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1228 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1229 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1230 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1231 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1232 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1233 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1234 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1236 #define __Pyx_RefNannyDeclarations
1237 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1238 #define __Pyx_RefNannyFinishContext()
1239 #define __Pyx_INCREF(r) Py_INCREF(r)
1240 #define __Pyx_DECREF(r) Py_DECREF(r)
1241 #define __Pyx_GOTREF(r)
1242 #define __Pyx_GIVEREF(r)
1243 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1244 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1245 #define __Pyx_XGOTREF(r)
1246 #define __Pyx_XGIVEREF(r)
1248 #define __Pyx_XDECREF_SET(r, v) do {\
1249 PyObject *tmp = (PyObject *) r;\
1250 r = v; __Pyx_XDECREF(tmp);\
1252 #define __Pyx_DECREF_SET(r, v) do {\
1253 PyObject *tmp = (PyObject *) r;\
1254 r = v; __Pyx_DECREF(tmp);\
1256 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1257 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1260 static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
1261 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1264 static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name);
1267 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1268 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1269 const char* function_name);
1272 #if CYTHON_USE_TYPE_SLOTS
1273 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1274 static CYTHON_INLINE
int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1276 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
1277 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1281 #if CYTHON_USE_TYPE_SLOTS
1282 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1284 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1288 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1291 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1292 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1293 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1294 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1295 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1296 (cache_var) = (value);
1297 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1298 static PY_UINT64_T __pyx_dict_version = 0;\
1299 static PyObject *__pyx_dict_cached_value = NULL;\
1300 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1301 (VAR) = __pyx_dict_cached_value;\
1303 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1304 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1307 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1308 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1309 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1311 #define __PYX_GET_DICT_VERSION(dict) (0)
1312 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1313 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1317 #if CYTHON_USE_DICT_VERSIONS
1318 #define __Pyx_GetModuleGlobalName(var, name) {\
1319 static PY_UINT64_T __pyx_dict_version = 0;\
1320 static PyObject *__pyx_dict_cached_value = NULL;\
1321 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1322 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1323 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1325 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1326 PY_UINT64_T __pyx_dict_version;\
1327 PyObject *__pyx_dict_cached_value;\
1328 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1330 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1332 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1333 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1334 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1338 #if CYTHON_COMPILING_IN_CPYTHON
1339 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1341 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1345 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1348 #if CYTHON_USE_EXC_INFO_STACK
1349 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1353 #if CYTHON_FAST_THREAD_STATE
1354 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1355 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1356 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1358 #define __Pyx_PyThreadState_declare
1359 #define __Pyx_PyThreadState_assign
1360 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1364 #if CYTHON_FAST_THREAD_STATE
1365 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1366 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1367 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1368 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1370 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1371 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1375 #if CYTHON_FAST_THREAD_STATE
1376 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1377 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1379 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1383 #if CYTHON_FAST_THREAD_STATE
1384 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1385 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1387 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1391 #if CYTHON_FAST_THREAD_STATE
1392 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1393 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1394 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1395 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1396 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1397 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1398 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1399 #if CYTHON_COMPILING_IN_CPYTHON
1400 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1402 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1405 #define __Pyx_PyErr_Clear() PyErr_Clear()
1406 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1407 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1408 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1409 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1410 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1411 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1412 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1416 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1419 #ifndef __PYX_HAVE_RT_ImportType_proto
1420 #define __PYX_HAVE_RT_ImportType_proto
1421 enum __Pyx_ImportType_CheckSize {
1422 __Pyx_ImportType_CheckSize_Error = 0,
1423 __Pyx_ImportType_CheckSize_Warn = 1,
1424 __Pyx_ImportType_CheckSize_Ignore = 2
1426 static PyTypeObject *__Pyx_ImportType(PyObject* module,
const char *module_name,
const char *class_name,
size_t size,
enum __Pyx_ImportType_CheckSize check_size);
1430 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
1433 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1436 #define __Pyx_CyFunction_USED 1
1437 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
1438 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
1439 #define __Pyx_CYFUNCTION_CCLASS 0x04
1440 #define __Pyx_CyFunction_GetClosure(f)\
1441 (((__pyx_CyFunctionObject *) (f))->func_closure)
1442 #define __Pyx_CyFunction_GetClassObj(f)\
1443 (((__pyx_CyFunctionObject *) (f))->func_classobj)
1444 #define __Pyx_CyFunction_Defaults(type, f)\
1445 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1446 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1447 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1449 PyCFunctionObject func;
1450 #if PY_VERSION_HEX < 0x030500A0
1451 PyObject *func_weakreflist;
1453 PyObject *func_dict;
1454 PyObject *func_name;
1455 PyObject *func_qualname;
1457 PyObject *func_globals;
1458 PyObject *func_code;
1459 PyObject *func_closure;
1460 PyObject *func_classobj;
1462 int defaults_pyobjects;
1463 size_t defaults_size;
1465 PyObject *defaults_tuple;
1466 PyObject *defaults_kwdict;
1467 PyObject *(*defaults_getter)(PyObject *);
1468 PyObject *func_annotations;
1469 } __pyx_CyFunctionObject;
1470 static PyTypeObject *__pyx_CyFunctionType = 0;
1471 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1472 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1473 int flags, PyObject* qualname,
1475 PyObject *module, PyObject *globals,
1477 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1480 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1482 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1484 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1486 static int __pyx_CyFunction_init(
void);
1489 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1490 int flags, PyObject* qualname,
1492 PyObject *module, PyObject *globals,
1496 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1497 #define __Pyx_SetNameInClass(ns, name, value)\
1498 (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1499 #elif CYTHON_COMPILING_IN_CPYTHON
1500 #define __Pyx_SetNameInClass(ns, name, value)\
1501 (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1503 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
1507 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1510 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1511 PyObject *mkw, PyObject *modname, PyObject *doc);
1512 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1513 PyObject *mkw,
int calculate_metaclass,
int allow_py2_metaclass);
1516 #ifdef CYTHON_CLINE_IN_TRACEBACK
1517 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1519 static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
1524 PyCodeObject* code_object;
1526 } __Pyx_CodeObjectCacheEntry;
1527 struct __Pyx_CodeObjectCache {
1530 __Pyx_CodeObjectCacheEntry* entries;
1532 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1533 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
1534 static PyCodeObject *__pyx_find_code_object(
int code_line);
1535 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
1538 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
1539 int py_line,
const char *filename);
1542 static CYTHON_INLINE
long __Pyx_pow_long(
long,
long);
1545 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1546 #define __Pyx_HAS_GCC_DIAGNOSTIC
1552 #define __Pyx_CREAL(z) ((z).real())
1553 #define __Pyx_CIMAG(z) ((z).imag())
1555 #define __Pyx_CREAL(z) (__real__(z))
1556 #define __Pyx_CIMAG(z) (__imag__(z))
1559 #define __Pyx_CREAL(z) ((z).real)
1560 #define __Pyx_CIMAG(z) ((z).imag)
1562 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1563 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1564 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1565 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1567 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1568 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1573 #define __Pyx_c_eq_float(a, b) ((a)==(b))
1574 #define __Pyx_c_sum_float(a, b) ((a)+(b))
1575 #define __Pyx_c_diff_float(a, b) ((a)-(b))
1576 #define __Pyx_c_prod_float(a, b) ((a)*(b))
1577 #define __Pyx_c_quot_float(a, b) ((a)/(b))
1578 #define __Pyx_c_neg_float(a) (-(a))
1580 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1581 #define __Pyx_c_conj_float(z) (::std::conj(z))
1583 #define __Pyx_c_abs_float(z) (::std::abs(z))
1584 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1587 #define __Pyx_c_is_zero_float(z) ((z)==0)
1588 #define __Pyx_c_conj_float(z) (conjf(z))
1590 #define __Pyx_c_abs_float(z) (cabsf(z))
1591 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1595 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1596 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1597 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1598 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1599 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1600 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1601 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1602 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1604 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex);
1605 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1611 #define __Pyx_c_eq_double(a, b) ((a)==(b))
1612 #define __Pyx_c_sum_double(a, b) ((a)+(b))
1613 #define __Pyx_c_diff_double(a, b) ((a)-(b))
1614 #define __Pyx_c_prod_double(a, b) ((a)*(b))
1615 #define __Pyx_c_quot_double(a, b) ((a)/(b))
1616 #define __Pyx_c_neg_double(a) (-(a))
1618 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1619 #define __Pyx_c_conj_double(z) (::std::conj(z))
1621 #define __Pyx_c_abs_double(z) (::std::abs(z))
1622 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1625 #define __Pyx_c_is_zero_double(z) ((z)==0)
1626 #define __Pyx_c_conj_double(z) (conj(z))
1628 #define __Pyx_c_abs_double(z) (cabs(z))
1629 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1633 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1634 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1635 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1636 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1637 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1638 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1639 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1640 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1642 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex);
1643 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1648 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
1651 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
1654 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
1657 #if CYTHON_COMPILING_IN_CPYTHON
1658 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1659 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1660 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1661 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1663 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1664 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1665 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1667 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1670 static int __Pyx_check_binary_version(
void);
1673 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1685 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1698 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1699 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1700 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1701 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1702 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
1703 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
1704 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
1705 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
1706 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
1707 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
1708 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
1709 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
1710 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
1711 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
1712 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1715 static PyObject *__pyx_f_7clapack_lapackWrappersDCopy(
int, PyArrayObject *, PyArrayObject *);
1716 static PyObject *__pyx_f_7clapack_lapackWrappersDenseFactorPrepare(
int, PyArrayObject *, PyArrayObject *);
1717 static PyObject *__pyx_f_7clapack_lapackWrappersDenseFactorSolve(
int, PyArrayObject *, PyArrayObject *, PyArrayObject *);
1718 static PyObject *__pyx_f_7clapack_lapackWrappersDenseCalculateEigenvalues(
char *,
char *,
int, PyArrayObject *,
int, PyArrayObject *, PyArrayObject *, PyArrayObject *,
int, PyArrayObject *,
int, PyArrayObject *,
int);
1719 #define __Pyx_MODULE_NAME "clapack"
1720 extern int __pyx_module_is_main_clapack;
1721 int __pyx_module_is_main_clapack = 0;
1724 static PyObject *__pyx_builtin_ImportError;
1725 static const char __pyx_k_b[] =
"b";
1726 static const char __pyx_k_n[] =
"n";
1727 static const char __pyx_k_lu[] =
"lu";
1728 static const char __pyx_k_np[] =
"np";
1729 static const char __pyx_k_doc[] =
"__doc__";
1730 static const char __pyx_k_lda[] =
"lda";
1731 static const char __pyx_k_mat[] =
"mat";
1732 static const char __pyx_k_init[] =
"__init__";
1733 static const char __pyx_k_ldvl[] =
"ldvl";
1734 static const char __pyx_k_ldvr[] =
"ldvr";
1735 static const char __pyx_k_leig[] =
"leig";
1736 static const char __pyx_k_main[] =
"__main__";
1737 static const char __pyx_k_name[] =
"__name__";
1738 static const char __pyx_k_self[] =
"self";
1739 static const char __pyx_k_test[] =
"__test__";
1740 static const char __pyx_k_work[] =
"work";
1741 static const char __pyx_k_DF_lu[] =
"DF_lu";
1742 static const char __pyx_k_dtype[] =
"dtype";
1743 static const char __pyx_k_int32[] =
"int32";
1744 static const char __pyx_k_jobvl[] =
"jobvl";
1745 static const char __pyx_k_jobvr[] =
"jobvr";
1746 static const char __pyx_k_lwork[] =
"lwork";
1747 static const char __pyx_k_numpy[] =
"numpy";
1748 static const char __pyx_k_shape[] =
"shape";
1749 static const char __pyx_k_zeros[] =
"zeros";
1750 static const char __pyx_k_import[] =
"__import__";
1751 static const char __pyx_k_module[] =
"__module__";
1752 static const char __pyx_k_pivots[] =
"pivots";
1753 static const char __pyx_k_clapack[] =
"clapack";
1754 static const char __pyx_k_prepare[] =
"__prepare__";
1755 static const char __pyx_k_blasCopy[] =
"blasCopy";
1756 static const char __pyx_k_qualname[] =
"__qualname__";
1757 static const char __pyx_k_DF_pivots[] =
"DF_pivots";
1758 static const char __pyx_k_metaclass[] =
"__metaclass__";
1759 static const char __pyx_k_DenseFactor[] =
"DenseFactor";
1760 static const char __pyx_k_ImportError[] =
"ImportError";
1761 static const char __pyx_k_denseFactor[] =
"denseFactor";
1762 static const char __pyx_k_eigenvalues_i[] =
"eigenvalues_i";
1763 static const char __pyx_k_eigenvalues_r[] =
"eigenvalues_r";
1764 static const char __pyx_k_denseFactorSolve[] =
"denseFactorSolve";
1765 static const char __pyx_k_leftEigenvectors[] =
"leftEigenvectors";
1766 static const char __pyx_k_rightEigenvectors[] =
"rightEigenvectors";
1767 static const char __pyx_k_DenseFactor___init[] =
"DenseFactor.__init__";
1768 static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
1769 static const char __pyx_k_denseFactorPrepare[] =
"denseFactorPrepare";
1770 static const char __pyx_k_proteus_clapack_pyx[] =
"proteus/clapack.pyx";
1771 static const char __pyx_k_denseCalculateEigenvalues[] =
"denseCalculateEigenvalues";
1772 static const char __pyx_k_numpy_core_multiarray_failed_to[] =
"numpy.core.multiarray failed to import";
1773 static const char __pyx_k_numpy_core_umath_failed_to_impor[] =
"numpy.core.umath failed to import";
1774 static PyObject *__pyx_n_s_DF_lu;
1775 static PyObject *__pyx_n_s_DF_pivots;
1776 static PyObject *__pyx_n_s_DenseFactor;
1777 static PyObject *__pyx_n_s_DenseFactor___init;
1778 static PyObject *__pyx_n_s_ImportError;
1779 static PyObject *__pyx_n_s_b;
1780 static PyObject *__pyx_n_s_blasCopy;
1781 static PyObject *__pyx_n_s_clapack;
1782 static PyObject *__pyx_n_s_cline_in_traceback;
1783 static PyObject *__pyx_n_s_denseCalculateEigenvalues;
1784 static PyObject *__pyx_n_s_denseFactor;
1785 static PyObject *__pyx_n_s_denseFactorPrepare;
1786 static PyObject *__pyx_n_s_denseFactorSolve;
1787 static PyObject *__pyx_n_s_doc;
1788 static PyObject *__pyx_n_s_dtype;
1789 static PyObject *__pyx_n_s_eigenvalues_i;
1790 static PyObject *__pyx_n_s_eigenvalues_r;
1791 static PyObject *__pyx_n_s_import;
1792 static PyObject *__pyx_n_s_init;
1793 static PyObject *__pyx_n_s_int32;
1794 static PyObject *__pyx_n_s_jobvl;
1795 static PyObject *__pyx_n_s_jobvr;
1796 static PyObject *__pyx_n_s_lda;
1797 static PyObject *__pyx_n_s_ldvl;
1798 static PyObject *__pyx_n_s_ldvr;
1799 static PyObject *__pyx_n_s_leftEigenvectors;
1800 static PyObject *__pyx_n_s_leig;
1801 static PyObject *__pyx_n_s_lu;
1802 static PyObject *__pyx_n_s_lwork;
1803 static PyObject *__pyx_n_s_main;
1804 static PyObject *__pyx_n_s_mat;
1805 static PyObject *__pyx_n_s_metaclass;
1806 static PyObject *__pyx_n_s_module;
1807 static PyObject *__pyx_n_s_n;
1808 static PyObject *__pyx_n_s_name;
1809 static PyObject *__pyx_n_s_np;
1810 static PyObject *__pyx_n_s_numpy;
1811 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1812 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1813 static PyObject *__pyx_n_s_pivots;
1814 static PyObject *__pyx_n_s_prepare;
1815 static PyObject *__pyx_kp_s_proteus_clapack_pyx;
1816 static PyObject *__pyx_n_s_qualname;
1817 static PyObject *__pyx_n_s_rightEigenvectors;
1818 static PyObject *__pyx_n_s_self;
1819 static PyObject *__pyx_n_s_shape;
1820 static PyObject *__pyx_n_s_test;
1821 static PyObject *__pyx_n_s_work;
1822 static PyObject *__pyx_n_s_zeros;
1823 static PyObject *__pyx_pf_7clapack_11DenseFactor___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n);
1824 static PyObject *__pyx_pf_7clapack_blasCopy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n, PyObject *__pyx_v_mat, PyObject *__pyx_v_denseFactor);
1825 static PyObject *__pyx_pf_7clapack_2denseFactorPrepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n, PyObject *__pyx_v_mat, PyObject *__pyx_v_denseFactor);
1826 static PyObject *__pyx_pf_7clapack_4denseFactorSolve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *__pyx_v_mat, PyObject *__pyx_v_denseFactor, PyObject *__pyx_v_b);
1827 static PyObject *__pyx_pf_7clapack_6denseCalculateEigenvalues(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_jobvl, PyObject *__pyx_v_jobvr, PyObject *__pyx_v_n, PyObject *__pyx_v_leig, PyObject *__pyx_v_lda, PyObject *__pyx_v_eigenvalues_r, PyObject *__pyx_v_eigenvalues_i, PyObject *__pyx_v_leftEigenvectors, PyObject *__pyx_v_ldvl, PyObject *__pyx_v_rightEigenvectors, PyObject *__pyx_v_ldvr, PyObject *__pyx_v_work, PyObject *__pyx_v_lwork);
1828 static PyObject *__pyx_tuple_;
1829 static PyObject *__pyx_tuple__2;
1830 static PyObject *__pyx_tuple__3;
1831 static PyObject *__pyx_tuple__5;
1832 static PyObject *__pyx_tuple__7;
1833 static PyObject *__pyx_tuple__9;
1834 static PyObject *__pyx_tuple__11;
1835 static PyObject *__pyx_codeobj__4;
1836 static PyObject *__pyx_codeobj__6;
1837 static PyObject *__pyx_codeobj__8;
1838 static PyObject *__pyx_codeobj__10;
1839 static PyObject *__pyx_codeobj__12;
1851 static PyObject *__pyx_pw_7clapack_11DenseFactor_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
1852 static PyMethodDef __pyx_mdef_7clapack_11DenseFactor_1__init__ = {
"__init__", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_7clapack_11DenseFactor_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
1853 static PyObject *__pyx_pw_7clapack_11DenseFactor_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1854 PyObject *__pyx_v_self = 0;
1855 PyObject *__pyx_v_n = 0;
1856 int __pyx_lineno = 0;
1857 const char *__pyx_filename = NULL;
1858 int __pyx_clineno = 0;
1859 PyObject *__pyx_r = 0;
1860 __Pyx_RefNannyDeclarations
1861 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
1863 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,0};
1864 PyObject* values[2] = {0,0};
1865 if (unlikely(__pyx_kwds)) {
1867 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1869 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1871 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1874 default:
goto __pyx_L5_argtuple_error;
1876 kw_args = PyDict_Size(__pyx_kwds);
1879 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
1880 else goto __pyx_L5_argtuple_error;
1883 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
1885 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 2, 2, 1); __PYX_ERR(0, 17, __pyx_L3_error)
1888 if (unlikely(kw_args > 0)) {
1889 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(0, 17, __pyx_L3_error)
1891 }
else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
1892 goto __pyx_L5_argtuple_error;
1894 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1895 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1897 __pyx_v_self = values[0];
1898 __pyx_v_n = values[1];
1900 goto __pyx_L4_argument_unpacking_done;
1901 __pyx_L5_argtuple_error:;
1902 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 17, __pyx_L3_error)
1904 __Pyx_AddTraceback(
"clapack.DenseFactor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1905 __Pyx_RefNannyFinishContext();
1907 __pyx_L4_argument_unpacking_done:;
1908 __pyx_r = __pyx_pf_7clapack_11DenseFactor___init__(__pyx_self, __pyx_v_self, __pyx_v_n);
1911 __Pyx_RefNannyFinishContext();
1915 static PyObject *__pyx_pf_7clapack_11DenseFactor___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
1916 PyObject *__pyx_r = NULL;
1917 __Pyx_RefNannyDeclarations
1918 PyObject *__pyx_t_1 = NULL;
1919 PyObject *__pyx_t_2 = NULL;
1920 PyObject *__pyx_t_3 = NULL;
1921 int __pyx_lineno = 0;
1922 const char *__pyx_filename = NULL;
1923 int __pyx_clineno = 0;
1924 __Pyx_RefNannySetupContext(
"__init__", 0);
1933 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n, __pyx_v_n) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
1942 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
1943 __Pyx_GOTREF(__pyx_t_1);
1944 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
1945 __Pyx_GOTREF(__pyx_t_2);
1946 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1947 __pyx_t_1 = __Pyx_PyDict_NewPresized(2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
1948 __Pyx_GOTREF(__pyx_t_1);
1949 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error)
1950 __Pyx_GOTREF(__pyx_t_3);
1951 __Pyx_INCREF(__pyx_v_n);
1952 __Pyx_GIVEREF(__pyx_v_n);
1953 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_n);
1954 __Pyx_INCREF(__pyx_v_n);
1955 __Pyx_GIVEREF(__pyx_v_n);
1956 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_n);
1957 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
1958 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1959 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
1960 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error)
1961 __Pyx_GOTREF(__pyx_t_3);
1962 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1963 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1964 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_lu, __pyx_t_3) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
1965 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1974 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error)
1975 __Pyx_GOTREF(__pyx_t_3);
1976 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
1977 __Pyx_GOTREF(__pyx_t_1);
1978 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1979 __pyx_t_3 = __Pyx_PyDict_NewPresized(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error)
1980 __Pyx_GOTREF(__pyx_t_3);
1981 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_shape, __pyx_v_n) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
1982 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_int32) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
1983 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
1984 __Pyx_GOTREF(__pyx_t_2);
1985 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1986 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1987 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pivots, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
1988 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1999 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2002 __Pyx_XDECREF(__pyx_t_1);
2003 __Pyx_XDECREF(__pyx_t_2);
2004 __Pyx_XDECREF(__pyx_t_3);
2005 __Pyx_AddTraceback(
"clapack.DenseFactor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2008 __Pyx_XGIVEREF(__pyx_r);
2009 __Pyx_RefNannyFinishContext();
2021 static PyObject *__pyx_f_7clapack_lapackWrappersDCopy(
int __pyx_v_n, PyArrayObject *__pyx_v_mat, PyArrayObject *__pyx_v_lu) {
2022 CYTHON_UNUSED
int __pyx_v_dim;
2026 PyObject *__pyx_r = NULL;
2027 __Pyx_RefNannyDeclarations
2028 __Pyx_RefNannySetupContext(
"lapackWrappersDCopy", 0);
2037 __pyx_v_dim = __pyx_v_n;
2040 __pyx_v_dim2 = __Pyx_pow_long(((
long)__pyx_v_n), 2);
2049 dcopy_((&__pyx_v_dim2), ((
double *)__pyx_v_mat->data), (&__pyx_v_incr1), ((
double *)__pyx_v_lu->data), (&__pyx_v_incr2));
2060 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2061 __Pyx_XGIVEREF(__pyx_r);
2062 __Pyx_RefNannyFinishContext();
2074 static PyObject *__pyx_f_7clapack_lapackWrappersDenseFactorPrepare(
int __pyx_v_dim, PyArrayObject *__pyx_v_lu, PyArrayObject *__pyx_v_pivot) {
2077 PyObject *__pyx_r = NULL;
2078 __Pyx_RefNannyDeclarations
2079 __Pyx_RefNannySetupContext(
"lapackWrappersDenseFactorPrepare", 0);
2089 __pyx_v_N = __pyx_v_dim;
2098 (void)(
dgetrf_((&__pyx_v_N), (&__pyx_v_N), ((
double *)__pyx_v_lu->data), (&__pyx_v_N), ((
int *)__pyx_v_pivot->data), (&__pyx_v_info)));
2109 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2110 __Pyx_XGIVEREF(__pyx_r);
2111 __Pyx_RefNannyFinishContext();
2123 static PyObject *__pyx_f_7clapack_lapackWrappersDenseFactorSolve(
int __pyx_v_dim, PyArrayObject *__pyx_v_lu, PyArrayObject *__pyx_v_pivots, PyArrayObject *__pyx_v_b) {
2128 PyObject *__pyx_r = NULL;
2129 __Pyx_RefNannyDeclarations
2130 __Pyx_RefNannySetupContext(
"lapackWrappersDenseFactorSolve", 0);
2139 __pyx_v_trans =
'T';
2148 __pyx_v_N = __pyx_v_dim;
2159 (void)(
dgetrs_((&__pyx_v_trans), (&__pyx_v_N), (&__pyx_v_nrhs), ((
double *)__pyx_v_lu->data), (&__pyx_v_N), ((
int *)__pyx_v_pivots->data), ((
double *)__pyx_v_b->data), (&__pyx_v_N), (&__pyx_v_info)));
2170 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2171 __Pyx_XGIVEREF(__pyx_r);
2172 __Pyx_RefNannyFinishContext();
2184 static PyObject *__pyx_f_7clapack_lapackWrappersDenseCalculateEigenvalues(
char *__pyx_v_jobvl,
char *__pyx_v_jobvr,
int __pyx_v_n, PyArrayObject *__pyx_v_A,
int __pyx_v_lda, PyArrayObject *__pyx_v_wr, PyArrayObject *__pyx_v_wi, PyArrayObject *__pyx_v_vl,
int __pyx_v_ldvl, PyArrayObject *__pyx_v_vr,
int __pyx_v_ldvr, PyArrayObject *__pyx_v_work,
int __pyx_v_nwork) {
2186 PyObject *__pyx_r = NULL;
2187 __Pyx_RefNannyDeclarations
2188 __Pyx_RefNannySetupContext(
"lapackWrappersDenseCalculateEigenvalues", 0);
2206 (void)(
dgeev_(__pyx_v_jobvl, __pyx_v_jobvr, (&__pyx_v_n), ((
double *)__pyx_v_A->data), (&__pyx_v_lda), ((
double *)__pyx_v_wr->data), ((
double *)__pyx_v_wi->data), ((
double *)__pyx_v_vl->data), (&__pyx_v_ldvl), ((
double *)__pyx_v_vr->data), (&__pyx_v_ldvr), ((
double *)__pyx_v_work->data), (&__pyx_v_nwork), (&__pyx_v_info)));
2217 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2218 __Pyx_XGIVEREF(__pyx_r);
2219 __Pyx_RefNannyFinishContext();
2232 static PyObject *__pyx_pw_7clapack_1blasCopy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
2233 static PyMethodDef __pyx_mdef_7clapack_1blasCopy = {
"blasCopy", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_7clapack_1blasCopy, METH_VARARGS|METH_KEYWORDS, 0};
2234 static PyObject *__pyx_pw_7clapack_1blasCopy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2235 PyObject *__pyx_v_n = 0;
2236 PyObject *__pyx_v_mat = 0;
2237 PyObject *__pyx_v_denseFactor = 0;
2238 int __pyx_lineno = 0;
2239 const char *__pyx_filename = NULL;
2240 int __pyx_clineno = 0;
2241 PyObject *__pyx_r = 0;
2242 __Pyx_RefNannyDeclarations
2243 __Pyx_RefNannySetupContext(
"blasCopy (wrapper)", 0);
2245 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_mat,&__pyx_n_s_denseFactor,0};
2246 PyObject* values[3] = {0,0,0};
2247 if (unlikely(__pyx_kwds)) {
2249 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2251 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2253 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2255 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2258 default:
goto __pyx_L5_argtuple_error;
2260 kw_args = PyDict_Size(__pyx_kwds);
2263 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
2264 else goto __pyx_L5_argtuple_error;
2267 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mat)) != 0)) kw_args--;
2269 __Pyx_RaiseArgtupleInvalid(
"blasCopy", 1, 3, 3, 1); __PYX_ERR(0, 91, __pyx_L3_error)
2273 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_denseFactor)) != 0)) kw_args--;
2275 __Pyx_RaiseArgtupleInvalid(
"blasCopy", 1, 3, 3, 2); __PYX_ERR(0, 91, __pyx_L3_error)
2278 if (unlikely(kw_args > 0)) {
2279 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"blasCopy") < 0)) __PYX_ERR(0, 91, __pyx_L3_error)
2281 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2282 goto __pyx_L5_argtuple_error;
2284 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2285 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2286 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2288 __pyx_v_n = values[0];
2289 __pyx_v_mat = values[1];
2290 __pyx_v_denseFactor = values[2];
2292 goto __pyx_L4_argument_unpacking_done;
2293 __pyx_L5_argtuple_error:;
2294 __Pyx_RaiseArgtupleInvalid(
"blasCopy", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error)
2296 __Pyx_AddTraceback(
"clapack.blasCopy", __pyx_clineno, __pyx_lineno, __pyx_filename);
2297 __Pyx_RefNannyFinishContext();
2299 __pyx_L4_argument_unpacking_done:;
2300 __pyx_r = __pyx_pf_7clapack_blasCopy(__pyx_self, __pyx_v_n, __pyx_v_mat, __pyx_v_denseFactor);
2303 __Pyx_RefNannyFinishContext();
2307 static PyObject *__pyx_pf_7clapack_blasCopy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n, PyObject *__pyx_v_mat, PyObject *__pyx_v_denseFactor) {
2308 PyObject *__pyx_v_DF_lu = NULL;
2309 PyObject *__pyx_r = NULL;
2310 __Pyx_RefNannyDeclarations
2311 PyObject *__pyx_t_1 = NULL;
2313 int __pyx_lineno = 0;
2314 const char *__pyx_filename = NULL;
2315 int __pyx_clineno = 0;
2316 __Pyx_RefNannySetupContext(
"blasCopy", 0);
2325 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_denseFactor, __pyx_n_s_lu);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
2326 __Pyx_GOTREF(__pyx_t_1);
2327 __pyx_v_DF_lu = __pyx_t_1;
2337 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_n);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error)
2346 if (!(likely(((__pyx_v_mat) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_mat, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 97, __pyx_L1_error)
2355 if (!(likely(((__pyx_v_DF_lu) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_DF_lu, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 98, __pyx_L1_error)
2364 __pyx_t_1 = __pyx_f_7clapack_lapackWrappersDCopy(__pyx_t_2, ((PyArrayObject *)__pyx_v_mat), ((PyArrayObject *)__pyx_v_DF_lu));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
2365 __Pyx_GOTREF(__pyx_t_1);
2366 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2377 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2380 __Pyx_XDECREF(__pyx_t_1);
2381 __Pyx_AddTraceback(
"clapack.blasCopy", __pyx_clineno, __pyx_lineno, __pyx_filename);
2384 __Pyx_XDECREF(__pyx_v_DF_lu);
2385 __Pyx_XGIVEREF(__pyx_r);
2386 __Pyx_RefNannyFinishContext();
2399 static PyObject *__pyx_pw_7clapack_3denseFactorPrepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
2400 static PyMethodDef __pyx_mdef_7clapack_3denseFactorPrepare = {
"denseFactorPrepare", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_7clapack_3denseFactorPrepare, METH_VARARGS|METH_KEYWORDS, 0};
2401 static PyObject *__pyx_pw_7clapack_3denseFactorPrepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2402 PyObject *__pyx_v_n = 0;
2403 PyObject *__pyx_v_mat = 0;
2404 PyObject *__pyx_v_denseFactor = 0;
2405 int __pyx_lineno = 0;
2406 const char *__pyx_filename = NULL;
2407 int __pyx_clineno = 0;
2408 PyObject *__pyx_r = 0;
2409 __Pyx_RefNannyDeclarations
2410 __Pyx_RefNannySetupContext(
"denseFactorPrepare (wrapper)", 0);
2412 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_mat,&__pyx_n_s_denseFactor,0};
2413 PyObject* values[3] = {0,0,0};
2414 if (unlikely(__pyx_kwds)) {
2416 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2418 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2420 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2422 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2425 default:
goto __pyx_L5_argtuple_error;
2427 kw_args = PyDict_Size(__pyx_kwds);
2430 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
2431 else goto __pyx_L5_argtuple_error;
2434 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mat)) != 0)) kw_args--;
2436 __Pyx_RaiseArgtupleInvalid(
"denseFactorPrepare", 1, 3, 3, 1); __PYX_ERR(0, 100, __pyx_L3_error)
2440 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_denseFactor)) != 0)) kw_args--;
2442 __Pyx_RaiseArgtupleInvalid(
"denseFactorPrepare", 1, 3, 3, 2); __PYX_ERR(0, 100, __pyx_L3_error)
2445 if (unlikely(kw_args > 0)) {
2446 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"denseFactorPrepare") < 0)) __PYX_ERR(0, 100, __pyx_L3_error)
2448 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2449 goto __pyx_L5_argtuple_error;
2451 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2452 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2453 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2455 __pyx_v_n = values[0];
2456 __pyx_v_mat = values[1];
2457 __pyx_v_denseFactor = values[2];
2459 goto __pyx_L4_argument_unpacking_done;
2460 __pyx_L5_argtuple_error:;
2461 __Pyx_RaiseArgtupleInvalid(
"denseFactorPrepare", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 100, __pyx_L3_error)
2463 __Pyx_AddTraceback(
"clapack.denseFactorPrepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
2464 __Pyx_RefNannyFinishContext();
2466 __pyx_L4_argument_unpacking_done:;
2467 __pyx_r = __pyx_pf_7clapack_2denseFactorPrepare(__pyx_self, __pyx_v_n, __pyx_v_mat, __pyx_v_denseFactor);
2470 __Pyx_RefNannyFinishContext();
2474 static PyObject *__pyx_pf_7clapack_2denseFactorPrepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n, PyObject *__pyx_v_mat, PyObject *__pyx_v_denseFactor) {
2475 PyObject *__pyx_v_DF_pivots = NULL;
2476 PyObject *__pyx_v_DF_lu = NULL;
2477 PyObject *__pyx_r = NULL;
2478 __Pyx_RefNannyDeclarations
2479 PyObject *__pyx_t_1 = NULL;
2481 int __pyx_lineno = 0;
2482 const char *__pyx_filename = NULL;
2483 int __pyx_clineno = 0;
2484 __Pyx_RefNannySetupContext(
"denseFactorPrepare", 0);
2493 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_denseFactor, __pyx_n_s_pivots);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
2494 __Pyx_GOTREF(__pyx_t_1);
2495 __pyx_v_DF_pivots = __pyx_t_1;
2505 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_denseFactor, __pyx_n_s_lu);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
2506 __Pyx_GOTREF(__pyx_t_1);
2507 __pyx_v_DF_lu = __pyx_t_1;
2517 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_n);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error)
2526 if (!(likely(((__pyx_v_mat) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_mat, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 107, __pyx_L1_error)
2535 if (!(likely(((__pyx_v_DF_lu) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_DF_lu, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 108, __pyx_L1_error)
2544 __pyx_t_1 = __pyx_f_7clapack_lapackWrappersDCopy(__pyx_t_2, ((PyArrayObject *)__pyx_v_mat), ((PyArrayObject *)__pyx_v_DF_lu));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
2545 __Pyx_GOTREF(__pyx_t_1);
2546 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2555 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_n);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L1_error)
2564 if (!(likely(((__pyx_v_DF_lu) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_DF_lu, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 111, __pyx_L1_error)
2573 if (!(likely(((__pyx_v_DF_pivots) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_DF_pivots, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 112, __pyx_L1_error)
2582 __pyx_t_1 = __pyx_f_7clapack_lapackWrappersDenseFactorPrepare(__pyx_t_2, ((PyArrayObject *)__pyx_v_DF_lu), ((PyArrayObject *)__pyx_v_DF_pivots));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
2583 __Pyx_GOTREF(__pyx_t_1);
2584 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2595 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2598 __Pyx_XDECREF(__pyx_t_1);
2599 __Pyx_AddTraceback(
"clapack.denseFactorPrepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
2602 __Pyx_XDECREF(__pyx_v_DF_pivots);
2603 __Pyx_XDECREF(__pyx_v_DF_lu);
2604 __Pyx_XGIVEREF(__pyx_r);
2605 __Pyx_RefNannyFinishContext();
2618 static PyObject *__pyx_pw_7clapack_5denseFactorSolve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
2619 static PyMethodDef __pyx_mdef_7clapack_5denseFactorSolve = {
"denseFactorSolve", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_7clapack_5denseFactorSolve, METH_VARARGS|METH_KEYWORDS, 0};
2620 static PyObject *__pyx_pw_7clapack_5denseFactorSolve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2621 PyObject *__pyx_v_n = 0;
2622 CYTHON_UNUSED PyObject *__pyx_v_mat = 0;
2623 PyObject *__pyx_v_denseFactor = 0;
2624 PyObject *__pyx_v_b = 0;
2625 int __pyx_lineno = 0;
2626 const char *__pyx_filename = NULL;
2627 int __pyx_clineno = 0;
2628 PyObject *__pyx_r = 0;
2629 __Pyx_RefNannyDeclarations
2630 __Pyx_RefNannySetupContext(
"denseFactorSolve (wrapper)", 0);
2632 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_mat,&__pyx_n_s_denseFactor,&__pyx_n_s_b,0};
2633 PyObject* values[4] = {0,0,0,0};
2634 if (unlikely(__pyx_kwds)) {
2636 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2638 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2640 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2642 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2644 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2647 default:
goto __pyx_L5_argtuple_error;
2649 kw_args = PyDict_Size(__pyx_kwds);
2652 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
2653 else goto __pyx_L5_argtuple_error;
2656 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mat)) != 0)) kw_args--;
2658 __Pyx_RaiseArgtupleInvalid(
"denseFactorSolve", 1, 4, 4, 1); __PYX_ERR(0, 114, __pyx_L3_error)
2662 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_denseFactor)) != 0)) kw_args--;
2664 __Pyx_RaiseArgtupleInvalid(
"denseFactorSolve", 1, 4, 4, 2); __PYX_ERR(0, 114, __pyx_L3_error)
2668 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
2670 __Pyx_RaiseArgtupleInvalid(
"denseFactorSolve", 1, 4, 4, 3); __PYX_ERR(0, 114, __pyx_L3_error)
2673 if (unlikely(kw_args > 0)) {
2674 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"denseFactorSolve") < 0)) __PYX_ERR(0, 114, __pyx_L3_error)
2676 }
else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
2677 goto __pyx_L5_argtuple_error;
2679 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2680 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2681 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2682 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2684 __pyx_v_n = values[0];
2685 __pyx_v_mat = values[1];
2686 __pyx_v_denseFactor = values[2];
2687 __pyx_v_b = values[3];
2689 goto __pyx_L4_argument_unpacking_done;
2690 __pyx_L5_argtuple_error:;
2691 __Pyx_RaiseArgtupleInvalid(
"denseFactorSolve", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 114, __pyx_L3_error)
2693 __Pyx_AddTraceback(
"clapack.denseFactorSolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
2694 __Pyx_RefNannyFinishContext();
2696 __pyx_L4_argument_unpacking_done:;
2697 __pyx_r = __pyx_pf_7clapack_4denseFactorSolve(__pyx_self, __pyx_v_n, __pyx_v_mat, __pyx_v_denseFactor, __pyx_v_b);
2700 __Pyx_RefNannyFinishContext();
2704 static PyObject *__pyx_pf_7clapack_4denseFactorSolve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *__pyx_v_mat, PyObject *__pyx_v_denseFactor, PyObject *__pyx_v_b) {
2705 PyObject *__pyx_v_DF_pivots = NULL;
2706 PyObject *__pyx_v_DF_lu = NULL;
2707 PyObject *__pyx_r = NULL;
2708 __Pyx_RefNannyDeclarations
2709 PyObject *__pyx_t_1 = NULL;
2711 int __pyx_lineno = 0;
2712 const char *__pyx_filename = NULL;
2713 int __pyx_clineno = 0;
2714 __Pyx_RefNannySetupContext(
"denseFactorSolve", 0);
2723 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_denseFactor, __pyx_n_s_pivots);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
2724 __Pyx_GOTREF(__pyx_t_1);
2725 __pyx_v_DF_pivots = __pyx_t_1;
2735 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_denseFactor, __pyx_n_s_lu);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error)
2736 __Pyx_GOTREF(__pyx_t_1);
2737 __pyx_v_DF_lu = __pyx_t_1;
2747 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_n);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L1_error)
2756 if (!(likely(((__pyx_v_DF_lu) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_DF_lu, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 122, __pyx_L1_error)
2765 if (!(likely(((__pyx_v_DF_pivots) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_DF_pivots, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 123, __pyx_L1_error)
2774 if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 124, __pyx_L1_error)
2783 __pyx_t_1 = __pyx_f_7clapack_lapackWrappersDenseFactorSolve(__pyx_t_2, ((PyArrayObject *)__pyx_v_DF_lu), ((PyArrayObject *)__pyx_v_DF_pivots), ((PyArrayObject *)__pyx_v_b));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
2784 __Pyx_GOTREF(__pyx_t_1);
2785 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2796 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2799 __Pyx_XDECREF(__pyx_t_1);
2800 __Pyx_AddTraceback(
"clapack.denseFactorSolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
2803 __Pyx_XDECREF(__pyx_v_DF_pivots);
2804 __Pyx_XDECREF(__pyx_v_DF_lu);
2805 __Pyx_XGIVEREF(__pyx_r);
2806 __Pyx_RefNannyFinishContext();
2819 static PyObject *__pyx_pw_7clapack_7denseCalculateEigenvalues(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
2820 static char __pyx_doc_7clapack_6denseCalculateEigenvalues[] =
"\n Parameters\n ----------\n jobvl (input) : str\n 'N' indicates left eigenvectors are not computed\n 'V' indicates left eigenvectors are computed\n jobvr (input) : str\n 'N' indicates right eigenvectors are not computed\n 'V' indicates right eigenvectors are computed\n n (input) : int\n order of matrix A\n leig (input / output) : np array\n on entry matrix A, on exit overwritten\n lda (input) : int\n leading dimension of the array A\n eigenvalues_r (output) : array\n real part of computed eigenvalues\n eigenvalues_i (output) : array\n imaginary part of computed eigenvalues\n vl (output) : array\n storage container for left eigenvectors\n ldvl (input) : int\n leading dimension of the array vl\n vr (output) : array\n storage container for right eigenvectos\n ldvr (input) : int\n leading dimension of array vr\n work (workspace / output) : array\n lwork (input) : int\n ";
2821 static PyMethodDef __pyx_mdef_7clapack_7denseCalculateEigenvalues = {
"denseCalculateEigenvalues", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_7clapack_7denseCalculateEigenvalues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7clapack_6denseCalculateEigenvalues};
2822 static PyObject *__pyx_pw_7clapack_7denseCalculateEigenvalues(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2823 PyObject *__pyx_v_jobvl = 0;
2824 PyObject *__pyx_v_jobvr = 0;
2825 PyObject *__pyx_v_n = 0;
2826 PyObject *__pyx_v_leig = 0;
2827 PyObject *__pyx_v_lda = 0;
2828 PyObject *__pyx_v_eigenvalues_r = 0;
2829 PyObject *__pyx_v_eigenvalues_i = 0;
2830 PyObject *__pyx_v_leftEigenvectors = 0;
2831 PyObject *__pyx_v_ldvl = 0;
2832 PyObject *__pyx_v_rightEigenvectors = 0;
2833 PyObject *__pyx_v_ldvr = 0;
2834 PyObject *__pyx_v_work = 0;
2835 PyObject *__pyx_v_lwork = 0;
2836 int __pyx_lineno = 0;
2837 const char *__pyx_filename = NULL;
2838 int __pyx_clineno = 0;
2839 PyObject *__pyx_r = 0;
2840 __Pyx_RefNannyDeclarations
2841 __Pyx_RefNannySetupContext(
"denseCalculateEigenvalues (wrapper)", 0);
2843 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_jobvl,&__pyx_n_s_jobvr,&__pyx_n_s_n,&__pyx_n_s_leig,&__pyx_n_s_lda,&__pyx_n_s_eigenvalues_r,&__pyx_n_s_eigenvalues_i,&__pyx_n_s_leftEigenvectors,&__pyx_n_s_ldvl,&__pyx_n_s_rightEigenvectors,&__pyx_n_s_ldvr,&__pyx_n_s_work,&__pyx_n_s_lwork,0};
2844 PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
2845 if (unlikely(__pyx_kwds)) {
2847 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2849 case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
2851 case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
2853 case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
2855 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
2857 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
2859 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
2861 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2863 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2865 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2867 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2869 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2871 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2873 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2876 default:
goto __pyx_L5_argtuple_error;
2878 kw_args = PyDict_Size(__pyx_kwds);
2881 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_jobvl)) != 0)) kw_args--;
2882 else goto __pyx_L5_argtuple_error;
2885 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_jobvr)) != 0)) kw_args--;
2887 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, 1); __PYX_ERR(0, 126, __pyx_L3_error)
2891 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
2893 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, 2); __PYX_ERR(0, 126, __pyx_L3_error)
2897 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_leig)) != 0)) kw_args--;
2899 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, 3); __PYX_ERR(0, 126, __pyx_L3_error)
2903 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lda)) != 0)) kw_args--;
2905 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, 4); __PYX_ERR(0, 126, __pyx_L3_error)
2909 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eigenvalues_r)) != 0)) kw_args--;
2911 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, 5); __PYX_ERR(0, 126, __pyx_L3_error)
2915 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eigenvalues_i)) != 0)) kw_args--;
2917 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, 6); __PYX_ERR(0, 126, __pyx_L3_error)
2921 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_leftEigenvectors)) != 0)) kw_args--;
2923 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, 7); __PYX_ERR(0, 126, __pyx_L3_error)
2927 if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ldvl)) != 0)) kw_args--;
2929 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, 8); __PYX_ERR(0, 126, __pyx_L3_error)
2933 if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rightEigenvectors)) != 0)) kw_args--;
2935 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, 9); __PYX_ERR(0, 126, __pyx_L3_error)
2939 if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ldvr)) != 0)) kw_args--;
2941 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, 10); __PYX_ERR(0, 126, __pyx_L3_error)
2945 if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--;
2947 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, 11); __PYX_ERR(0, 126, __pyx_L3_error)
2951 if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lwork)) != 0)) kw_args--;
2953 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, 12); __PYX_ERR(0, 126, __pyx_L3_error)
2956 if (unlikely(kw_args > 0)) {
2957 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"denseCalculateEigenvalues") < 0)) __PYX_ERR(0, 126, __pyx_L3_error)
2959 }
else if (PyTuple_GET_SIZE(__pyx_args) != 13) {
2960 goto __pyx_L5_argtuple_error;
2962 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2963 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2964 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2965 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2966 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2967 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2968 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2969 values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
2970 values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
2971 values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
2972 values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
2973 values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
2974 values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
2976 __pyx_v_jobvl = values[0];
2977 __pyx_v_jobvr = values[1];
2978 __pyx_v_n = values[2];
2979 __pyx_v_leig = values[3];
2980 __pyx_v_lda = values[4];
2981 __pyx_v_eigenvalues_r = values[5];
2982 __pyx_v_eigenvalues_i = values[6];
2983 __pyx_v_leftEigenvectors = values[7];
2984 __pyx_v_ldvl = values[8];
2985 __pyx_v_rightEigenvectors = values[9];
2986 __pyx_v_ldvr = values[10];
2987 __pyx_v_work = values[11];
2988 __pyx_v_lwork = values[12];
2990 goto __pyx_L4_argument_unpacking_done;
2991 __pyx_L5_argtuple_error:;
2992 __Pyx_RaiseArgtupleInvalid(
"denseCalculateEigenvalues", 1, 13, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 126, __pyx_L3_error)
2994 __Pyx_AddTraceback(
"clapack.denseCalculateEigenvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
2995 __Pyx_RefNannyFinishContext();
2997 __pyx_L4_argument_unpacking_done:;
2998 __pyx_r = __pyx_pf_7clapack_6denseCalculateEigenvalues(__pyx_self, __pyx_v_jobvl, __pyx_v_jobvr, __pyx_v_n, __pyx_v_leig, __pyx_v_lda, __pyx_v_eigenvalues_r, __pyx_v_eigenvalues_i, __pyx_v_leftEigenvectors, __pyx_v_ldvl, __pyx_v_rightEigenvectors, __pyx_v_ldvr, __pyx_v_work, __pyx_v_lwork);
3001 __Pyx_RefNannyFinishContext();
3005 static PyObject *__pyx_pf_7clapack_6denseCalculateEigenvalues(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_jobvl, PyObject *__pyx_v_jobvr, PyObject *__pyx_v_n, PyObject *__pyx_v_leig, PyObject *__pyx_v_lda, PyObject *__pyx_v_eigenvalues_r, PyObject *__pyx_v_eigenvalues_i, PyObject *__pyx_v_leftEigenvectors, PyObject *__pyx_v_ldvl, PyObject *__pyx_v_rightEigenvectors, PyObject *__pyx_v_ldvr, PyObject *__pyx_v_work, PyObject *__pyx_v_lwork) {
3006 PyObject *__pyx_r = NULL;
3007 __Pyx_RefNannyDeclarations
3015 PyObject *__pyx_t_8 = NULL;
3016 int __pyx_lineno = 0;
3017 const char *__pyx_filename = NULL;
3018 int __pyx_clineno = 0;
3019 __Pyx_RefNannySetupContext(
"denseCalculateEigenvalues", 0);
3028 __pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_jobvl);
if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L1_error)
3037 __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_jobvr);
if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L1_error)
3046 __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_n);
if (unlikely((__pyx_t_3 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L1_error)
3055 if (!(likely(((__pyx_v_leig) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_leig, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 173, __pyx_L1_error)
3064 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_lda);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error)
3073 if (!(likely(((__pyx_v_eigenvalues_r) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_eigenvalues_r, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 175, __pyx_L1_error)
3082 if (!(likely(((__pyx_v_eigenvalues_i) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_eigenvalues_i, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 176, __pyx_L1_error)
3091 if (!(likely(((__pyx_v_leftEigenvectors) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_leftEigenvectors, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 177, __pyx_L1_error)
3100 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_ldvl);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error)
3109 if (!(likely(((__pyx_v_rightEigenvectors) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_rightEigenvectors, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 179, __pyx_L1_error)
3118 __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_ldvr);
if (unlikely((__pyx_t_6 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error)
3127 if (!(likely(((__pyx_v_work) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_work, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 181, __pyx_L1_error)
3135 __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_lwork);
if (unlikely((__pyx_t_7 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error)
3144 __pyx_t_8 = __pyx_f_7clapack_lapackWrappersDenseCalculateEigenvalues(__pyx_t_1, __pyx_t_2, __pyx_t_3, ((PyArrayObject *)__pyx_v_leig), __pyx_t_4, ((PyArrayObject *)__pyx_v_eigenvalues_r), ((PyArrayObject *)__pyx_v_eigenvalues_i), ((PyArrayObject *)__pyx_v_leftEigenvectors), __pyx_t_5, ((PyArrayObject *)__pyx_v_rightEigenvectors), __pyx_t_6, ((PyArrayObject *)__pyx_v_work), __pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 170, __pyx_L1_error)
3145 __Pyx_GOTREF(__pyx_t_8);
3146 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3157 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3160 __Pyx_XDECREF(__pyx_t_8);
3161 __Pyx_AddTraceback(
"clapack.denseCalculateEigenvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
3164 __Pyx_XGIVEREF(__pyx_r);
3165 __Pyx_RefNannyFinishContext();
3177 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
3178 PyObject *__pyx_r = NULL;
3179 __Pyx_RefNannyDeclarations
3180 PyObject *__pyx_t_1 = NULL;
3181 int __pyx_lineno = 0;
3182 const char *__pyx_filename = NULL;
3183 int __pyx_clineno = 0;
3184 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew1", 0);
3193 __Pyx_XDECREF(__pyx_r);
3194 __pyx_t_1 = PyArray_MultiIterNew(1, ((
void *)__pyx_v_a));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
3195 __Pyx_GOTREF(__pyx_t_1);
3196 __pyx_r = __pyx_t_1;
3210 __Pyx_XDECREF(__pyx_t_1);
3211 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
3214 __Pyx_XGIVEREF(__pyx_r);
3215 __Pyx_RefNannyFinishContext();
3227 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
3228 PyObject *__pyx_r = NULL;
3229 __Pyx_RefNannyDeclarations
3230 PyObject *__pyx_t_1 = NULL;
3231 int __pyx_lineno = 0;
3232 const char *__pyx_filename = NULL;
3233 int __pyx_clineno = 0;
3234 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew2", 0);
3243 __Pyx_XDECREF(__pyx_r);
3244 __pyx_t_1 = PyArray_MultiIterNew(2, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
3245 __Pyx_GOTREF(__pyx_t_1);
3246 __pyx_r = __pyx_t_1;
3260 __Pyx_XDECREF(__pyx_t_1);
3261 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
3264 __Pyx_XGIVEREF(__pyx_r);
3265 __Pyx_RefNannyFinishContext();
3277 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
3278 PyObject *__pyx_r = NULL;
3279 __Pyx_RefNannyDeclarations
3280 PyObject *__pyx_t_1 = NULL;
3281 int __pyx_lineno = 0;
3282 const char *__pyx_filename = NULL;
3283 int __pyx_clineno = 0;
3284 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew3", 0);
3293 __Pyx_XDECREF(__pyx_r);
3294 __pyx_t_1 = PyArray_MultiIterNew(3, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 742, __pyx_L1_error)
3295 __Pyx_GOTREF(__pyx_t_1);
3296 __pyx_r = __pyx_t_1;
3310 __Pyx_XDECREF(__pyx_t_1);
3311 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
3314 __Pyx_XGIVEREF(__pyx_r);
3315 __Pyx_RefNannyFinishContext();
3327 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) {
3328 PyObject *__pyx_r = NULL;
3329 __Pyx_RefNannyDeclarations
3330 PyObject *__pyx_t_1 = NULL;
3331 int __pyx_lineno = 0;
3332 const char *__pyx_filename = NULL;
3333 int __pyx_clineno = 0;
3334 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew4", 0);
3343 __Pyx_XDECREF(__pyx_r);
3344 __pyx_t_1 = PyArray_MultiIterNew(4, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c), ((
void *)__pyx_v_d));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 745, __pyx_L1_error)
3345 __Pyx_GOTREF(__pyx_t_1);
3346 __pyx_r = __pyx_t_1;
3360 __Pyx_XDECREF(__pyx_t_1);
3361 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
3364 __Pyx_XGIVEREF(__pyx_r);
3365 __Pyx_RefNannyFinishContext();
3377 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) {
3378 PyObject *__pyx_r = NULL;
3379 __Pyx_RefNannyDeclarations
3380 PyObject *__pyx_t_1 = NULL;
3381 int __pyx_lineno = 0;
3382 const char *__pyx_filename = NULL;
3383 int __pyx_clineno = 0;
3384 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew5", 0);
3393 __Pyx_XDECREF(__pyx_r);
3394 __pyx_t_1 = PyArray_MultiIterNew(5, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c), ((
void *)__pyx_v_d), ((
void *)__pyx_v_e));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 748, __pyx_L1_error)
3395 __Pyx_GOTREF(__pyx_t_1);
3396 __pyx_r = __pyx_t_1;
3410 __Pyx_XDECREF(__pyx_t_1);
3411 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
3414 __Pyx_XGIVEREF(__pyx_r);
3415 __Pyx_RefNannyFinishContext();
3427 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
3428 PyObject *__pyx_r = NULL;
3429 __Pyx_RefNannyDeclarations
3431 __Pyx_RefNannySetupContext(
"PyDataType_SHAPE", 0);
3440 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
3450 __Pyx_XDECREF(__pyx_r);
3451 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
3452 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
3472 __Pyx_XDECREF(__pyx_r);
3473 __Pyx_INCREF(__pyx_empty_tuple);
3474 __pyx_r = __pyx_empty_tuple;
3488 __Pyx_XGIVEREF(__pyx_r);
3489 __Pyx_RefNannyFinishContext();
3501 static CYTHON_INLINE
void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
3502 __Pyx_RefNannyDeclarations
3503 __Pyx_RefNannySetupContext(
"set_array_base", 0);
3512 Py_INCREF(__pyx_v_base);
3521 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
3532 __Pyx_RefNannyFinishContext();
3543 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
3544 PyObject *__pyx_v_base;
3545 PyObject *__pyx_r = NULL;
3546 __Pyx_RefNannyDeclarations
3548 __Pyx_RefNannySetupContext(
"get_array_base", 0);
3557 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
3566 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
3576 __Pyx_XDECREF(__pyx_r);
3577 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3596 __Pyx_XDECREF(__pyx_r);
3597 __Pyx_INCREF(((PyObject *)__pyx_v_base));
3598 __pyx_r = ((PyObject *)__pyx_v_base);
3611 __Pyx_XGIVEREF(__pyx_r);
3612 __Pyx_RefNannyFinishContext();
3624 static CYTHON_INLINE
int __pyx_f_5numpy_import_array(
void) {
3626 __Pyx_RefNannyDeclarations
3627 PyObject *__pyx_t_1 = NULL;
3628 PyObject *__pyx_t_2 = NULL;
3629 PyObject *__pyx_t_3 = NULL;
3631 PyObject *__pyx_t_5 = NULL;
3632 PyObject *__pyx_t_6 = NULL;
3633 PyObject *__pyx_t_7 = NULL;
3634 PyObject *__pyx_t_8 = NULL;
3635 int __pyx_lineno = 0;
3636 const char *__pyx_filename = NULL;
3637 int __pyx_clineno = 0;
3638 __Pyx_RefNannySetupContext(
"import_array", 0);
3648 __Pyx_PyThreadState_declare
3649 __Pyx_PyThreadState_assign
3650 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
3651 __Pyx_XGOTREF(__pyx_t_1);
3652 __Pyx_XGOTREF(__pyx_t_2);
3653 __Pyx_XGOTREF(__pyx_t_3);
3663 __pyx_t_4 = _import_array();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
3673 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3674 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3675 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3676 goto __pyx_L8_try_end;
3686 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
3688 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
3689 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error)
3690 __Pyx_GOTREF(__pyx_t_5);
3691 __Pyx_GOTREF(__pyx_t_6);
3692 __Pyx_GOTREF(__pyx_t_7);
3701 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple_, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 945, __pyx_L5_except_error)
3702 __Pyx_GOTREF(__pyx_t_8);
3703 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
3704 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3705 __PYX_ERR(1, 945, __pyx_L5_except_error)
3707 goto __pyx_L5_except_error;
3708 __pyx_L5_except_error:;
3717 __Pyx_XGIVEREF(__pyx_t_1);
3718 __Pyx_XGIVEREF(__pyx_t_2);
3719 __Pyx_XGIVEREF(__pyx_t_3);
3720 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3721 goto __pyx_L1_error;
3737 __Pyx_XDECREF(__pyx_t_5);
3738 __Pyx_XDECREF(__pyx_t_6);
3739 __Pyx_XDECREF(__pyx_t_7);
3740 __Pyx_XDECREF(__pyx_t_8);
3741 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
3744 __Pyx_RefNannyFinishContext();
3756 static CYTHON_INLINE
int __pyx_f_5numpy_import_umath(
void) {
3758 __Pyx_RefNannyDeclarations
3759 PyObject *__pyx_t_1 = NULL;
3760 PyObject *__pyx_t_2 = NULL;
3761 PyObject *__pyx_t_3 = NULL;
3763 PyObject *__pyx_t_5 = NULL;
3764 PyObject *__pyx_t_6 = NULL;
3765 PyObject *__pyx_t_7 = NULL;
3766 PyObject *__pyx_t_8 = NULL;
3767 int __pyx_lineno = 0;
3768 const char *__pyx_filename = NULL;
3769 int __pyx_clineno = 0;
3770 __Pyx_RefNannySetupContext(
"import_umath", 0);
3780 __Pyx_PyThreadState_declare
3781 __Pyx_PyThreadState_assign
3782 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
3783 __Pyx_XGOTREF(__pyx_t_1);
3784 __Pyx_XGOTREF(__pyx_t_2);
3785 __Pyx_XGOTREF(__pyx_t_3);
3795 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
3805 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3806 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3807 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3808 goto __pyx_L8_try_end;
3818 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
3820 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
3821 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error)
3822 __Pyx_GOTREF(__pyx_t_5);
3823 __Pyx_GOTREF(__pyx_t_6);
3824 __Pyx_GOTREF(__pyx_t_7);
3833 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 951, __pyx_L5_except_error)
3834 __Pyx_GOTREF(__pyx_t_8);
3835 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
3836 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3837 __PYX_ERR(1, 951, __pyx_L5_except_error)
3839 goto __pyx_L5_except_error;
3840 __pyx_L5_except_error:;
3849 __Pyx_XGIVEREF(__pyx_t_1);
3850 __Pyx_XGIVEREF(__pyx_t_2);
3851 __Pyx_XGIVEREF(__pyx_t_3);
3852 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3853 goto __pyx_L1_error;
3869 __Pyx_XDECREF(__pyx_t_5);
3870 __Pyx_XDECREF(__pyx_t_6);
3871 __Pyx_XDECREF(__pyx_t_7);
3872 __Pyx_XDECREF(__pyx_t_8);
3873 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
3876 __Pyx_RefNannyFinishContext();
3888 static CYTHON_INLINE
int __pyx_f_5numpy_import_ufunc(
void) {
3890 __Pyx_RefNannyDeclarations
3891 PyObject *__pyx_t_1 = NULL;
3892 PyObject *__pyx_t_2 = NULL;
3893 PyObject *__pyx_t_3 = NULL;
3895 PyObject *__pyx_t_5 = NULL;
3896 PyObject *__pyx_t_6 = NULL;
3897 PyObject *__pyx_t_7 = NULL;
3898 PyObject *__pyx_t_8 = NULL;
3899 int __pyx_lineno = 0;
3900 const char *__pyx_filename = NULL;
3901 int __pyx_clineno = 0;
3902 __Pyx_RefNannySetupContext(
"import_ufunc", 0);
3912 __Pyx_PyThreadState_declare
3913 __Pyx_PyThreadState_assign
3914 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
3915 __Pyx_XGOTREF(__pyx_t_1);
3916 __Pyx_XGOTREF(__pyx_t_2);
3917 __Pyx_XGOTREF(__pyx_t_3);
3927 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
3937 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3938 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3939 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3940 goto __pyx_L8_try_end;
3950 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
3952 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
3953 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error)
3954 __Pyx_GOTREF(__pyx_t_5);
3955 __Pyx_GOTREF(__pyx_t_6);
3956 __Pyx_GOTREF(__pyx_t_7);
3965 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 957, __pyx_L5_except_error)
3966 __Pyx_GOTREF(__pyx_t_8);
3967 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
3968 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3969 __PYX_ERR(1, 957, __pyx_L5_except_error)
3971 goto __pyx_L5_except_error;
3972 __pyx_L5_except_error:;
3981 __Pyx_XGIVEREF(__pyx_t_1);
3982 __Pyx_XGIVEREF(__pyx_t_2);
3983 __Pyx_XGIVEREF(__pyx_t_3);
3984 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3985 goto __pyx_L1_error;
4001 __Pyx_XDECREF(__pyx_t_5);
4002 __Pyx_XDECREF(__pyx_t_6);
4003 __Pyx_XDECREF(__pyx_t_7);
4004 __Pyx_XDECREF(__pyx_t_8);
4005 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
4008 __Pyx_RefNannyFinishContext();
4020 static CYTHON_INLINE
int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
4022 __Pyx_RefNannyDeclarations
4023 __Pyx_RefNannySetupContext(
"is_timedelta64_object", 0);
4032 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
4045 __Pyx_RefNannyFinishContext();
4057 static CYTHON_INLINE
int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
4059 __Pyx_RefNannyDeclarations
4060 __Pyx_RefNannySetupContext(
"is_datetime64_object", 0);
4069 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
4082 __Pyx_RefNannyFinishContext();
4094 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
4095 npy_datetime __pyx_r;
4104 __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
4128 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
4129 npy_timedelta __pyx_r;
4138 __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
4162 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
4163 NPY_DATETIMEUNIT __pyx_r;
4170 __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
4186 static PyMethodDef __pyx_methods[] = {
4190 #if PY_MAJOR_VERSION >= 3
4191 #if CYTHON_PEP489_MULTI_PHASE_INIT
4192 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
4193 static int __pyx_pymod_exec_clapack(PyObject* module);
4194 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
4195 {Py_mod_create, (
void*)__pyx_pymod_create},
4196 {Py_mod_exec, (
void*)__pyx_pymod_exec_clapack},
4201 static struct PyModuleDef __pyx_moduledef = {
4202 PyModuleDef_HEAD_INIT,
4205 #if CYTHON_PEP489_MULTI_PHASE_INIT
4211 #if CYTHON_PEP489_MULTI_PHASE_INIT
4212 __pyx_moduledef_slots,
4221 #ifndef CYTHON_SMALL_CODE
4222 #if defined(__clang__)
4223 #define CYTHON_SMALL_CODE
4224 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
4225 #define CYTHON_SMALL_CODE __attribute__((cold))
4227 #define CYTHON_SMALL_CODE
4231 static __Pyx_StringTabEntry __pyx_string_tab[] = {
4232 {&__pyx_n_s_DF_lu, __pyx_k_DF_lu,
sizeof(__pyx_k_DF_lu), 0, 0, 1, 1},
4233 {&__pyx_n_s_DF_pivots, __pyx_k_DF_pivots,
sizeof(__pyx_k_DF_pivots), 0, 0, 1, 1},
4234 {&__pyx_n_s_DenseFactor, __pyx_k_DenseFactor,
sizeof(__pyx_k_DenseFactor), 0, 0, 1, 1},
4235 {&__pyx_n_s_DenseFactor___init, __pyx_k_DenseFactor___init,
sizeof(__pyx_k_DenseFactor___init), 0, 0, 1, 1},
4236 {&__pyx_n_s_ImportError, __pyx_k_ImportError,
sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
4237 {&__pyx_n_s_b, __pyx_k_b,
sizeof(__pyx_k_b), 0, 0, 1, 1},
4238 {&__pyx_n_s_blasCopy, __pyx_k_blasCopy,
sizeof(__pyx_k_blasCopy), 0, 0, 1, 1},
4239 {&__pyx_n_s_clapack, __pyx_k_clapack,
sizeof(__pyx_k_clapack), 0, 0, 1, 1},
4240 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
4241 {&__pyx_n_s_denseCalculateEigenvalues, __pyx_k_denseCalculateEigenvalues,
sizeof(__pyx_k_denseCalculateEigenvalues), 0, 0, 1, 1},
4242 {&__pyx_n_s_denseFactor, __pyx_k_denseFactor,
sizeof(__pyx_k_denseFactor), 0, 0, 1, 1},
4243 {&__pyx_n_s_denseFactorPrepare, __pyx_k_denseFactorPrepare,
sizeof(__pyx_k_denseFactorPrepare), 0, 0, 1, 1},
4244 {&__pyx_n_s_denseFactorSolve, __pyx_k_denseFactorSolve,
sizeof(__pyx_k_denseFactorSolve), 0, 0, 1, 1},
4245 {&__pyx_n_s_doc, __pyx_k_doc,
sizeof(__pyx_k_doc), 0, 0, 1, 1},
4246 {&__pyx_n_s_dtype, __pyx_k_dtype,
sizeof(__pyx_k_dtype), 0, 0, 1, 1},
4247 {&__pyx_n_s_eigenvalues_i, __pyx_k_eigenvalues_i,
sizeof(__pyx_k_eigenvalues_i), 0, 0, 1, 1},
4248 {&__pyx_n_s_eigenvalues_r, __pyx_k_eigenvalues_r,
sizeof(__pyx_k_eigenvalues_r), 0, 0, 1, 1},
4249 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
4250 {&__pyx_n_s_init, __pyx_k_init,
sizeof(__pyx_k_init), 0, 0, 1, 1},
4251 {&__pyx_n_s_int32, __pyx_k_int32,
sizeof(__pyx_k_int32), 0, 0, 1, 1},
4252 {&__pyx_n_s_jobvl, __pyx_k_jobvl,
sizeof(__pyx_k_jobvl), 0, 0, 1, 1},
4253 {&__pyx_n_s_jobvr, __pyx_k_jobvr,
sizeof(__pyx_k_jobvr), 0, 0, 1, 1},
4254 {&__pyx_n_s_lda, __pyx_k_lda,
sizeof(__pyx_k_lda), 0, 0, 1, 1},
4255 {&__pyx_n_s_ldvl, __pyx_k_ldvl,
sizeof(__pyx_k_ldvl), 0, 0, 1, 1},
4256 {&__pyx_n_s_ldvr, __pyx_k_ldvr,
sizeof(__pyx_k_ldvr), 0, 0, 1, 1},
4257 {&__pyx_n_s_leftEigenvectors, __pyx_k_leftEigenvectors,
sizeof(__pyx_k_leftEigenvectors), 0, 0, 1, 1},
4258 {&__pyx_n_s_leig, __pyx_k_leig,
sizeof(__pyx_k_leig), 0, 0, 1, 1},
4259 {&__pyx_n_s_lu, __pyx_k_lu,
sizeof(__pyx_k_lu), 0, 0, 1, 1},
4260 {&__pyx_n_s_lwork, __pyx_k_lwork,
sizeof(__pyx_k_lwork), 0, 0, 1, 1},
4261 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
4262 {&__pyx_n_s_mat, __pyx_k_mat,
sizeof(__pyx_k_mat), 0, 0, 1, 1},
4263 {&__pyx_n_s_metaclass, __pyx_k_metaclass,
sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
4264 {&__pyx_n_s_module, __pyx_k_module,
sizeof(__pyx_k_module), 0, 0, 1, 1},
4265 {&__pyx_n_s_n, __pyx_k_n,
sizeof(__pyx_k_n), 0, 0, 1, 1},
4266 {&__pyx_n_s_name, __pyx_k_name,
sizeof(__pyx_k_name), 0, 0, 1, 1},
4267 {&__pyx_n_s_np, __pyx_k_np,
sizeof(__pyx_k_np), 0, 0, 1, 1},
4268 {&__pyx_n_s_numpy, __pyx_k_numpy,
sizeof(__pyx_k_numpy), 0, 0, 1, 1},
4269 {&__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},
4270 {&__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},
4271 {&__pyx_n_s_pivots, __pyx_k_pivots,
sizeof(__pyx_k_pivots), 0, 0, 1, 1},
4272 {&__pyx_n_s_prepare, __pyx_k_prepare,
sizeof(__pyx_k_prepare), 0, 0, 1, 1},
4273 {&__pyx_kp_s_proteus_clapack_pyx, __pyx_k_proteus_clapack_pyx,
sizeof(__pyx_k_proteus_clapack_pyx), 0, 0, 1, 0},
4274 {&__pyx_n_s_qualname, __pyx_k_qualname,
sizeof(__pyx_k_qualname), 0, 0, 1, 1},
4275 {&__pyx_n_s_rightEigenvectors, __pyx_k_rightEigenvectors,
sizeof(__pyx_k_rightEigenvectors), 0, 0, 1, 1},
4276 {&__pyx_n_s_self, __pyx_k_self,
sizeof(__pyx_k_self), 0, 0, 1, 1},
4277 {&__pyx_n_s_shape, __pyx_k_shape,
sizeof(__pyx_k_shape), 0, 0, 1, 1},
4278 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
4279 {&__pyx_n_s_work, __pyx_k_work,
sizeof(__pyx_k_work), 0, 0, 1, 1},
4280 {&__pyx_n_s_zeros, __pyx_k_zeros,
sizeof(__pyx_k_zeros), 0, 0, 1, 1},
4281 {0, 0, 0, 0, 0, 0, 0}
4283 static CYTHON_SMALL_CODE
int __Pyx_InitCachedBuiltins(
void) {
4284 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError);
if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error)
4290 static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
4291 __Pyx_RefNannyDeclarations
4292 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
4301 __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to);
if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 945, __pyx_L1_error)
4302 __Pyx_GOTREF(__pyx_tuple_);
4303 __Pyx_GIVEREF(__pyx_tuple_);
4312 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor);
if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 951, __pyx_L1_error)
4313 __Pyx_GOTREF(__pyx_tuple__2);
4314 __Pyx_GIVEREF(__pyx_tuple__2);
4323 __pyx_tuple__3 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_n);
if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 17, __pyx_L1_error)
4324 __Pyx_GOTREF(__pyx_tuple__3);
4325 __Pyx_GIVEREF(__pyx_tuple__3);
4326 __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_clapack_pyx, __pyx_n_s_init, 17, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 17, __pyx_L1_error)
4335 __pyx_tuple__5 = PyTuple_Pack(4, __pyx_n_s_n, __pyx_n_s_mat, __pyx_n_s_denseFactor, __pyx_n_s_DF_lu);
if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 91, __pyx_L1_error)
4336 __Pyx_GOTREF(__pyx_tuple__5);
4337 __Pyx_GIVEREF(__pyx_tuple__5);
4338 __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_clapack_pyx, __pyx_n_s_blasCopy, 91, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 91, __pyx_L1_error)
4347 __pyx_tuple__7 = PyTuple_Pack(5, __pyx_n_s_n, __pyx_n_s_mat, __pyx_n_s_denseFactor, __pyx_n_s_DF_pivots, __pyx_n_s_DF_lu);
if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 100, __pyx_L1_error)
4348 __Pyx_GOTREF(__pyx_tuple__7);
4349 __Pyx_GIVEREF(__pyx_tuple__7);
4350 __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_clapack_pyx, __pyx_n_s_denseFactorPrepare, 100, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 100, __pyx_L1_error)
4359 __pyx_tuple__9 = PyTuple_Pack(6, __pyx_n_s_n, __pyx_n_s_mat, __pyx_n_s_denseFactor, __pyx_n_s_b, __pyx_n_s_DF_pivots, __pyx_n_s_DF_lu);
if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 114, __pyx_L1_error)
4360 __Pyx_GOTREF(__pyx_tuple__9);
4361 __Pyx_GIVEREF(__pyx_tuple__9);
4362 __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_clapack_pyx, __pyx_n_s_denseFactorSolve, 114, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 114, __pyx_L1_error)
4371 __pyx_tuple__11 = PyTuple_Pack(13, __pyx_n_s_jobvl, __pyx_n_s_jobvr, __pyx_n_s_n, __pyx_n_s_leig, __pyx_n_s_lda, __pyx_n_s_eigenvalues_r, __pyx_n_s_eigenvalues_i, __pyx_n_s_leftEigenvectors, __pyx_n_s_ldvl, __pyx_n_s_rightEigenvectors, __pyx_n_s_ldvr, __pyx_n_s_work, __pyx_n_s_lwork);
if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 126, __pyx_L1_error)
4372 __Pyx_GOTREF(__pyx_tuple__11);
4373 __Pyx_GIVEREF(__pyx_tuple__11);
4374 __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(13, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_clapack_pyx, __pyx_n_s_denseCalculateEigenvalues, 126, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 126, __pyx_L1_error)
4375 __Pyx_RefNannyFinishContext();
4378 __Pyx_RefNannyFinishContext();
4382 static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
4383 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4389 static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
4390 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
4391 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
4392 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
4393 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
4394 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
4395 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
4397 static int __Pyx_modinit_global_init_code(
void) {
4398 __Pyx_RefNannyDeclarations
4399 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
4401 __Pyx_RefNannyFinishContext();
4405 static int __Pyx_modinit_variable_export_code(
void) {
4406 __Pyx_RefNannyDeclarations
4407 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
4409 __Pyx_RefNannyFinishContext();
4413 static int __Pyx_modinit_function_export_code(
void) {
4414 __Pyx_RefNannyDeclarations
4415 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
4417 __Pyx_RefNannyFinishContext();
4421 static int __Pyx_modinit_type_init_code(
void) {
4422 __Pyx_RefNannyDeclarations
4423 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
4425 __Pyx_RefNannyFinishContext();
4429 static int __Pyx_modinit_type_import_code(
void) {
4430 __Pyx_RefNannyDeclarations
4431 PyObject *__pyx_t_1 = NULL;
4432 int __pyx_lineno = 0;
4433 const char *__pyx_filename = NULL;
4434 int __pyx_clineno = 0;
4435 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_import_code", 0);
4437 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
4438 __Pyx_GOTREF(__pyx_t_1);
4439 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME,
"type",
4440 #
if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
4441 sizeof(PyTypeObject),
4443 sizeof(PyHeapTypeObject),
4445 __Pyx_ImportType_CheckSize_Warn);
4446 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
4447 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4448 __pyx_t_1 = PyImport_ImportModule(
"numpy");
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
4449 __Pyx_GOTREF(__pyx_t_1);
4450 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1,
"numpy",
"dtype",
sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
4451 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
4452 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flatiter",
sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
4453 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
4454 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1,
"numpy",
"broadcast",
sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
4455 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
4456 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ndarray",
sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
4457 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
4458 __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1,
"numpy",
"generic",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4459 if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
4460 __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1,
"numpy",
"number",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4461 if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
4462 __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1,
"numpy",
"integer",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4463 if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
4464 __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1,
"numpy",
"signedinteger",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4465 if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
4466 __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1,
"numpy",
"unsignedinteger",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4467 if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
4468 __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1,
"numpy",
"inexact",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4469 if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
4470 __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1,
"numpy",
"floating",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4471 if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
4472 __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1,
"numpy",
"complexfloating",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4473 if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
4474 __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flexible",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4475 if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
4476 __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1,
"numpy",
"character",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4477 if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
4478 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ufunc",
sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
4479 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
4480 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4481 __Pyx_RefNannyFinishContext();
4484 __Pyx_XDECREF(__pyx_t_1);
4485 __Pyx_RefNannyFinishContext();
4489 static int __Pyx_modinit_variable_import_code(
void) {
4490 __Pyx_RefNannyDeclarations
4491 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
4493 __Pyx_RefNannyFinishContext();
4497 static int __Pyx_modinit_function_import_code(
void) {
4498 __Pyx_RefNannyDeclarations
4499 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
4501 __Pyx_RefNannyFinishContext();
4506 #ifndef CYTHON_NO_PYINIT_EXPORT
4507 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
4508 #elif PY_MAJOR_VERSION < 3
4510 #define __Pyx_PyMODINIT_FUNC extern "C" void
4512 #define __Pyx_PyMODINIT_FUNC void
4516 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
4518 #define __Pyx_PyMODINIT_FUNC PyObject *
4523 #if PY_MAJOR_VERSION < 3
4524 __Pyx_PyMODINIT_FUNC initclapack(
void) CYTHON_SMALL_CODE;
4525 __Pyx_PyMODINIT_FUNC initclapack(
void)
4527 __Pyx_PyMODINIT_FUNC PyInit_clapack(
void) CYTHON_SMALL_CODE;
4528 __Pyx_PyMODINIT_FUNC PyInit_clapack(
void)
4529 #if CYTHON_PEP489_MULTI_PHASE_INIT
4531 return PyModuleDef_Init(&__pyx_moduledef);
4533 static CYTHON_SMALL_CODE
int __Pyx_check_single_interpreter(
void) {
4534 #if PY_VERSION_HEX >= 0x030700A1
4535 static PY_INT64_T main_interpreter_id = -1;
4536 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
4537 if (main_interpreter_id == -1) {
4538 main_interpreter_id = current_id;
4539 return (unlikely(current_id == -1)) ? -1 : 0;
4540 }
else if (unlikely(main_interpreter_id != current_id))
4542 static PyInterpreterState *main_interpreter = NULL;
4543 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
4544 if (!main_interpreter) {
4545 main_interpreter = current_interpreter;
4546 }
else if (unlikely(main_interpreter != current_interpreter))
4551 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
4556 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) {
4557 PyObject *value = PyObject_GetAttrString(spec, from_name);
4559 if (likely(value)) {
4560 if (allow_none || value != Py_None) {
4561 result = PyDict_SetItemString(moddict, to_name, value);
4564 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
4571 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
4572 PyObject *module = NULL, *moddict, *modname;
4573 if (__Pyx_check_single_interpreter())
4576 return __Pyx_NewRef(__pyx_m);
4577 modname = PyObject_GetAttrString(spec,
"name");
4578 if (unlikely(!modname))
goto bad;
4579 module = PyModule_NewObject(modname);
4581 if (unlikely(!module))
goto bad;
4582 moddict = PyModule_GetDict(module);
4583 if (unlikely(!moddict))
goto bad;
4584 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"loader",
"__loader__", 1) < 0))
goto bad;
4585 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"origin",
"__file__", 1) < 0))
goto bad;
4586 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"parent",
"__package__", 1) < 0))
goto bad;
4587 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"submodule_search_locations",
"__path__", 0) < 0))
goto bad;
4595 static CYTHON_SMALL_CODE
int __pyx_pymod_exec_clapack(PyObject *__pyx_pyinit_module)
4599 PyObject *__pyx_t_1 = NULL;
4600 PyObject *__pyx_t_2 = NULL;
4601 int __pyx_lineno = 0;
4602 const char *__pyx_filename = NULL;
4603 int __pyx_clineno = 0;
4604 __Pyx_RefNannyDeclarations
4605 #if CYTHON_PEP489_MULTI_PHASE_INIT
4607 if (__pyx_m == __pyx_pyinit_module)
return 0;
4608 PyErr_SetString(PyExc_RuntimeError,
"Module 'clapack' has already been imported. Re-initialisation is not supported.");
4611 #elif PY_MAJOR_VERSION >= 3
4612 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
4615 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
4616 if (!__Pyx_RefNanny) {
4618 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
4619 if (!__Pyx_RefNanny)
4620 Py_FatalError(
"failed to import 'refnanny' module");
4623 __Pyx_RefNannySetupContext(
"__Pyx_PyMODINIT_FUNC PyInit_clapack(void)", 0);
4624 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4625 #ifdef __Pxy_PyFrame_Initialize_Offsets
4626 __Pxy_PyFrame_Initialize_Offsets();
4628 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
4629 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
4630 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
4631 #ifdef __Pyx_CyFunction_USED
4632 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4634 #ifdef __Pyx_FusedFunction_USED
4635 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4637 #ifdef __Pyx_Coroutine_USED
4638 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4640 #ifdef __Pyx_Generator_USED
4641 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4643 #ifdef __Pyx_AsyncGen_USED
4644 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4646 #ifdef __Pyx_StopAsyncIteration_USED
4647 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4651 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
4652 PyEval_InitThreads();
4655 #if CYTHON_PEP489_MULTI_PHASE_INIT
4656 __pyx_m = __pyx_pyinit_module;
4659 #if PY_MAJOR_VERSION < 3
4660 __pyx_m = Py_InitModule4(
"clapack", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
4662 __pyx_m = PyModule_Create(&__pyx_moduledef);
4664 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
4666 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
4668 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
4670 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
4671 Py_INCREF(__pyx_cython_runtime);
4672 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4674 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4675 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
4676 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4678 if (__pyx_module_is_main_clapack) {
4679 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4681 #if PY_MAJOR_VERSION >= 3
4683 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
4684 if (!PyDict_GetItemString(modules,
"clapack")) {
4685 if (unlikely(PyDict_SetItemString(modules,
"clapack", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
4690 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4692 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4694 (void)__Pyx_modinit_global_init_code();
4695 (void)__Pyx_modinit_variable_export_code();
4696 (void)__Pyx_modinit_function_export_code();
4697 (void)__Pyx_modinit_type_init_code();
4698 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
4699 (void)__Pyx_modinit_variable_import_code();
4700 (void)__Pyx_modinit_function_import_code();
4702 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
4703 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4711 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
4712 __Pyx_GOTREF(__pyx_t_1);
4713 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4714 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4723 __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_DenseFactor, __pyx_n_s_DenseFactor, (PyObject *) NULL, __pyx_n_s_clapack, (PyObject *) NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
4724 __Pyx_GOTREF(__pyx_t_1);
4733 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7clapack_11DenseFactor_1__init__, 0, __pyx_n_s_DenseFactor___init, NULL, __pyx_n_s_clapack, __pyx_d, ((PyObject *)__pyx_codeobj__4));
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
4734 __Pyx_GOTREF(__pyx_t_2);
4735 if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
4736 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4745 __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_DenseFactor, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
4746 __Pyx_GOTREF(__pyx_t_2);
4747 if (PyDict_SetItem(__pyx_d, __pyx_n_s_DenseFactor, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
4748 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4749 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4758 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7clapack_1blasCopy, NULL, __pyx_n_s_clapack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
4759 __Pyx_GOTREF(__pyx_t_1);
4760 if (PyDict_SetItem(__pyx_d, __pyx_n_s_blasCopy, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
4761 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4770 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7clapack_3denseFactorPrepare, NULL, __pyx_n_s_clapack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
4771 __Pyx_GOTREF(__pyx_t_1);
4772 if (PyDict_SetItem(__pyx_d, __pyx_n_s_denseFactorPrepare, __pyx_t_1) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
4773 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4782 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7clapack_5denseFactorSolve, NULL, __pyx_n_s_clapack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error)
4783 __Pyx_GOTREF(__pyx_t_1);
4784 if (PyDict_SetItem(__pyx_d, __pyx_n_s_denseFactorSolve, __pyx_t_1) < 0) __PYX_ERR(0, 114, __pyx_L1_error)
4785 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4794 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7clapack_7denseCalculateEigenvalues, NULL, __pyx_n_s_clapack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
4795 __Pyx_GOTREF(__pyx_t_1);
4796 if (PyDict_SetItem(__pyx_d, __pyx_n_s_denseCalculateEigenvalues, __pyx_t_1) < 0) __PYX_ERR(0, 126, __pyx_L1_error)
4797 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4804 __pyx_t_1 = __Pyx_PyDict_NewPresized(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
4805 __Pyx_GOTREF(__pyx_t_1);
4806 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4807 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4821 __Pyx_XDECREF(__pyx_t_1);
4822 __Pyx_XDECREF(__pyx_t_2);
4825 __Pyx_AddTraceback(
"init clapack", __pyx_clineno, __pyx_lineno, __pyx_filename);
4828 }
else if (!PyErr_Occurred()) {
4829 PyErr_SetString(PyExc_ImportError,
"init clapack");
4832 __Pyx_RefNannyFinishContext();
4833 #if CYTHON_PEP489_MULTI_PHASE_INIT
4834 return (__pyx_m != NULL) ? 0 : -1;
4835 #elif PY_MAJOR_VERSION >= 3
4845 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
4846 PyObject *m = NULL, *p = NULL;
4848 m = PyImport_ImportModule(modname);
4850 p = PyObject_GetAttrString(m,
"RefNannyAPI");
4852 r = PyLong_AsVoidPtr(p);
4856 return (__Pyx_RefNannyAPIStruct *)
r;
4861 static void __Pyx_RaiseArgtupleInvalid(
4862 const char* func_name,
4866 Py_ssize_t num_found)
4868 Py_ssize_t num_expected;
4869 const char *more_or_less;
4870 if (num_found < num_min) {
4871 num_expected = num_min;
4872 more_or_less =
"at least";
4874 num_expected = num_max;
4875 more_or_less =
"at most";
4878 more_or_less =
"exactly";
4880 PyErr_Format(PyExc_TypeError,
4881 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T
"d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T
"d given)",
4882 func_name, more_or_less, num_expected,
4883 (num_expected == 1) ?
"" :
"s", num_found);
4887 static void __Pyx_RaiseDoubleKeywordsError(
4888 const char* func_name,
4891 PyErr_Format(PyExc_TypeError,
4892 #
if PY_MAJOR_VERSION >= 3
4893 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
4895 "%s() got multiple values for keyword argument '%s'", func_name,
4896 PyString_AsString(kw_name));
4901 static int __Pyx_ParseOptionalKeywords(
4903 PyObject **argnames[],
4906 Py_ssize_t num_pos_args,
4907 const char* function_name)
4909 PyObject *key = 0, *value = 0;
4912 PyObject*** first_kw_arg = argnames + num_pos_args;
4913 while (PyDict_Next(kwds, &
pos, &key, &value)) {
4914 name = first_kw_arg;
4915 while (*name && (**name != key)) name++;
4917 values[name-argnames] = value;
4920 name = first_kw_arg;
4921 #if PY_MAJOR_VERSION < 3
4922 if (likely(PyString_Check(key))) {
4924 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
4925 && _PyString_Eq(**name, key)) {
4926 values[name-argnames] = value;
4931 if (*name)
continue;
4933 PyObject*** argname = argnames;
4934 while (argname != first_kw_arg) {
4935 if ((**argname == key) || (
4936 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
4937 && _PyString_Eq(**argname, key))) {
4938 goto arg_passed_twice;
4945 if (likely(PyUnicode_Check(key))) {
4947 int cmp = (**name == key) ? 0 :
4948 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
4949 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
4951 PyUnicode_Compare(**name, key);
4952 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
4954 values[name-argnames] = value;
4959 if (*name)
continue;
4961 PyObject*** argname = argnames;
4962 while (argname != first_kw_arg) {
4963 int cmp = (**argname == key) ? 0 :
4964 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
4965 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
4967 PyUnicode_Compare(**argname, key);
4968 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
4969 if (cmp == 0)
goto arg_passed_twice;
4974 goto invalid_keyword_type;
4976 if (unlikely(PyDict_SetItem(kwds2, key, value)))
goto bad;
4978 goto invalid_keyword;
4983 __Pyx_RaiseDoubleKeywordsError(function_name, key);
4985 invalid_keyword_type:
4986 PyErr_Format(PyExc_TypeError,
4987 "%.200s() keywords must be strings", function_name);
4990 PyErr_Format(PyExc_TypeError,
4991 #
if PY_MAJOR_VERSION < 3
4992 "%.200s() got an unexpected keyword argument '%.200s'",
4993 function_name, PyString_AsString(key));
4995 "%s() got an unexpected keyword argument '%U'",
4996 function_name, key);
5003 #if CYTHON_USE_TYPE_SLOTS
5004 static CYTHON_INLINE
int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
5005 PyTypeObject* tp = Py_TYPE(obj);
5006 if (likely(tp->tp_setattro))
5007 return tp->tp_setattro(obj, attr_name, value);
5008 #if PY_MAJOR_VERSION < 3
5009 if (likely(tp->tp_setattr))
5010 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
5012 return PyObject_SetAttr(obj, attr_name, value);
5017 #if CYTHON_USE_TYPE_SLOTS
5018 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
5019 PyTypeObject* tp = Py_TYPE(obj);
5020 if (likely(tp->tp_getattro))
5021 return tp->tp_getattro(obj, attr_name);
5022 #if PY_MAJOR_VERSION < 3
5023 if (likely(tp->tp_getattr))
5024 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
5026 return PyObject_GetAttr(obj, attr_name);
5031 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
5032 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
5033 if (unlikely(!result)) {
5034 PyErr_Format(PyExc_NameError,
5035 #
if PY_MAJOR_VERSION >= 3
5036 "name '%U' is not defined", name);
5038 "name '%.200s' is not defined", PyString_AS_STRING(name));
5045 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
5046 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
5047 PyObject *dict = Py_TYPE(obj)->tp_dict;
5048 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
5050 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
5051 PyObject **dictptr = NULL;
5052 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
5054 #if CYTHON_COMPILING_IN_CPYTHON
5055 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
5057 dictptr = _PyObject_GetDictPtr(obj);
5060 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
5062 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
5063 PyObject *dict = Py_TYPE(obj)->tp_dict;
5064 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
5066 return obj_dict_version == __Pyx_get_object_dict_version(obj);
5071 #if CYTHON_USE_DICT_VERSIONS
5072 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
5074 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
5078 #if !CYTHON_AVOID_BORROWED_REFS
5079 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
5080 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
5081 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5082 if (likely(result)) {
5083 return __Pyx_NewRef(result);
5084 }
else if (unlikely(PyErr_Occurred())) {
5088 result = PyDict_GetItem(__pyx_d, name);
5089 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5090 if (likely(result)) {
5091 return __Pyx_NewRef(result);
5095 result = PyObject_GetItem(__pyx_d, name);
5096 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5097 if (likely(result)) {
5098 return __Pyx_NewRef(result);
5102 return __Pyx_GetBuiltinName(name);
5106 #if CYTHON_COMPILING_IN_CPYTHON
5107 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
5109 ternaryfunc call = Py_TYPE(func)->tp_call;
5110 if (unlikely(!call))
5111 return PyObject_Call(func, arg, kw);
5112 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
5114 result = (*call)(func, arg, kw);
5115 Py_LeaveRecursiveCall();
5116 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
5119 "NULL result without error in PyObject_Call");
5126 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
5127 if (unlikely(!type)) {
5128 PyErr_SetString(PyExc_SystemError,
"Missing type object");
5131 if (likely(__Pyx_TypeCheck(obj, type)))
5133 PyErr_Format(PyExc_TypeError,
"Cannot convert %.200s to %.200s",
5134 Py_TYPE(obj)->tp_name, type->tp_name);
5139 #if CYTHON_USE_EXC_INFO_STACK
5140 static _PyErr_StackItem *
5141 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
5143 _PyErr_StackItem *exc_info = tstate->exc_info;
5144 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
5145 exc_info->previous_item != NULL)
5147 exc_info = exc_info->previous_item;
5154 #if CYTHON_FAST_THREAD_STATE
5155 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
5156 #if CYTHON_USE_EXC_INFO_STACK
5157 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
5158 *type = exc_info->exc_type;
5159 *value = exc_info->exc_value;
5160 *tb = exc_info->exc_traceback;
5162 *type = tstate->exc_type;
5163 *value = tstate->exc_value;
5164 *tb = tstate->exc_traceback;
5170 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
5171 PyObject *tmp_type, *tmp_value, *tmp_tb;
5172 #if CYTHON_USE_EXC_INFO_STACK
5173 _PyErr_StackItem *exc_info = tstate->exc_info;
5174 tmp_type = exc_info->exc_type;
5175 tmp_value = exc_info->exc_value;
5176 tmp_tb = exc_info->exc_traceback;
5177 exc_info->exc_type = type;
5178 exc_info->exc_value = value;
5179 exc_info->exc_traceback = tb;
5181 tmp_type = tstate->exc_type;
5182 tmp_value = tstate->exc_value;
5183 tmp_tb = tstate->exc_traceback;
5184 tstate->exc_type = type;
5185 tstate->exc_value = value;
5186 tstate->exc_traceback = tb;
5188 Py_XDECREF(tmp_type);
5189 Py_XDECREF(tmp_value);
5195 #if CYTHON_FAST_THREAD_STATE
5196 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
5198 n = PyTuple_GET_SIZE(tuple);
5199 #if PY_MAJOR_VERSION >= 3
5200 for (i=0; i<
n; i++) {
5201 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
5204 for (i=0; i<
n; i++) {
5205 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
5209 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
5210 PyObject *exc_type = tstate->curexc_type;
5211 if (exc_type == err)
return 1;
5212 if (unlikely(!exc_type))
return 0;
5213 if (unlikely(PyTuple_Check(err)))
5214 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
5215 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
5220 #if CYTHON_FAST_THREAD_STATE
5221 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
5223 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
5226 PyObject *local_type, *local_value, *local_tb;
5227 #if CYTHON_FAST_THREAD_STATE
5228 PyObject *tmp_type, *tmp_value, *tmp_tb;
5229 local_type = tstate->curexc_type;
5230 local_value = tstate->curexc_value;
5231 local_tb = tstate->curexc_traceback;
5232 tstate->curexc_type = 0;
5233 tstate->curexc_value = 0;
5234 tstate->curexc_traceback = 0;
5236 PyErr_Fetch(&local_type, &local_value, &local_tb);
5238 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
5239 #if CYTHON_FAST_THREAD_STATE
5240 if (unlikely(tstate->curexc_type))
5242 if (unlikely(PyErr_Occurred()))
5245 #if PY_MAJOR_VERSION >= 3
5247 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
5251 Py_XINCREF(local_tb);
5252 Py_XINCREF(local_type);
5253 Py_XINCREF(local_value);
5255 *value = local_value;
5257 #if CYTHON_FAST_THREAD_STATE
5258 #if CYTHON_USE_EXC_INFO_STACK
5260 _PyErr_StackItem *exc_info = tstate->exc_info;
5261 tmp_type = exc_info->exc_type;
5262 tmp_value = exc_info->exc_value;
5263 tmp_tb = exc_info->exc_traceback;
5264 exc_info->exc_type = local_type;
5265 exc_info->exc_value = local_value;
5266 exc_info->exc_traceback = local_tb;
5269 tmp_type = tstate->exc_type;
5270 tmp_value = tstate->exc_value;
5271 tmp_tb = tstate->exc_traceback;
5272 tstate->exc_type = local_type;
5273 tstate->exc_value = local_value;
5274 tstate->exc_traceback = local_tb;
5276 Py_XDECREF(tmp_type);
5277 Py_XDECREF(tmp_value);
5280 PyErr_SetExcInfo(local_type, local_value, local_tb);
5287 Py_XDECREF(local_type);
5288 Py_XDECREF(local_value);
5289 Py_XDECREF(local_tb);
5294 #if CYTHON_FAST_THREAD_STATE
5295 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
5296 PyObject *tmp_type, *tmp_value, *tmp_tb;
5297 tmp_type = tstate->curexc_type;
5298 tmp_value = tstate->curexc_value;
5299 tmp_tb = tstate->curexc_traceback;
5300 tstate->curexc_type = type;
5301 tstate->curexc_value = value;
5302 tstate->curexc_traceback = tb;
5303 Py_XDECREF(tmp_type);
5304 Py_XDECREF(tmp_value);
5307 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
5308 *type = tstate->curexc_type;
5309 *value = tstate->curexc_value;
5310 *tb = tstate->curexc_traceback;
5311 tstate->curexc_type = 0;
5312 tstate->curexc_value = 0;
5313 tstate->curexc_traceback = 0;
5318 #if PY_MAJOR_VERSION < 3
5319 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
5320 CYTHON_UNUSED PyObject *cause) {
5321 __Pyx_PyThreadState_declare
5323 if (!value || value == Py_None)
5327 if (!tb || tb == Py_None)
5331 if (!PyTraceBack_Check(tb)) {
5332 PyErr_SetString(PyExc_TypeError,
5333 "raise: arg 3 must be a traceback or None");
5337 if (PyType_Check(type)) {
5338 #if CYTHON_COMPILING_IN_PYPY
5344 PyErr_NormalizeException(&type, &value, &tb);
5347 PyErr_SetString(PyExc_TypeError,
5348 "instance exception may not have a separate value");
5352 type = (PyObject*) Py_TYPE(type);
5354 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
5355 PyErr_SetString(PyExc_TypeError,
5356 "raise: exception class must be a subclass of BaseException");
5360 __Pyx_PyThreadState_assign
5361 __Pyx_ErrRestore(type, value, tb);
5370 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
5371 PyObject* owned_instance = NULL;
5372 if (tb == Py_None) {
5374 }
else if (tb && !PyTraceBack_Check(tb)) {
5375 PyErr_SetString(PyExc_TypeError,
5376 "raise: arg 3 must be a traceback or None");
5379 if (value == Py_None)
5381 if (PyExceptionInstance_Check(type)) {
5383 PyErr_SetString(PyExc_TypeError,
5384 "instance exception may not have a separate value");
5388 type = (PyObject*) Py_TYPE(value);
5389 }
else if (PyExceptionClass_Check(type)) {
5390 PyObject *instance_class = NULL;
5391 if (value && PyExceptionInstance_Check(value)) {
5392 instance_class = (PyObject*) Py_TYPE(value);
5393 if (instance_class != type) {
5394 int is_subclass = PyObject_IsSubclass(instance_class, type);
5396 instance_class = NULL;
5397 }
else if (unlikely(is_subclass == -1)) {
5400 type = instance_class;
5404 if (!instance_class) {
5407 args = PyTuple_New(0);
5408 else if (PyTuple_Check(value)) {
5412 args = PyTuple_Pack(1, value);
5415 owned_instance = PyObject_Call(type, args, NULL);
5417 if (!owned_instance)
5419 value = owned_instance;
5420 if (!PyExceptionInstance_Check(value)) {
5421 PyErr_Format(PyExc_TypeError,
5422 "calling %R should have returned an instance of "
5423 "BaseException, not %R",
5424 type, Py_TYPE(value));
5429 PyErr_SetString(PyExc_TypeError,
5430 "raise: exception class must be a subclass of BaseException");
5434 PyObject *fixed_cause;
5435 if (cause == Py_None) {
5437 }
else if (PyExceptionClass_Check(cause)) {
5438 fixed_cause = PyObject_CallObject(cause, NULL);
5439 if (fixed_cause == NULL)
5441 }
else if (PyExceptionInstance_Check(cause)) {
5442 fixed_cause = cause;
5443 Py_INCREF(fixed_cause);
5445 PyErr_SetString(PyExc_TypeError,
5446 "exception causes must derive from "
5450 PyException_SetCause(value, fixed_cause);
5452 PyErr_SetObject(type, value);
5454 #if CYTHON_COMPILING_IN_PYPY
5455 PyObject *tmp_type, *tmp_value, *tmp_tb;
5456 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
5458 PyErr_Restore(tmp_type, tmp_value, tb);
5461 PyThreadState *tstate = __Pyx_PyThreadState_Current;
5462 PyObject* tmp_tb = tstate->curexc_traceback;
5465 tstate->curexc_traceback = tb;
5471 Py_XDECREF(owned_instance);
5477 #ifndef __PYX_HAVE_RT_ImportType
5478 #define __PYX_HAVE_RT_ImportType
5479 static PyTypeObject *__Pyx_ImportType(PyObject *module,
const char *module_name,
const char *class_name,
5480 size_t size,
enum __Pyx_ImportType_CheckSize check_size)
5482 PyObject *result = 0;
5484 Py_ssize_t basicsize;
5485 #ifdef Py_LIMITED_API
5486 PyObject *py_basicsize;
5488 result = PyObject_GetAttrString(module, class_name);
5491 if (!PyType_Check(result)) {
5492 PyErr_Format(PyExc_TypeError,
5493 "%.200s.%.200s is not a type object",
5494 module_name, class_name);
5497 #ifndef Py_LIMITED_API
5498 basicsize = ((PyTypeObject *)result)->tp_basicsize;
5500 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
5503 basicsize = PyLong_AsSsize_t(py_basicsize);
5504 Py_DECREF(py_basicsize);
5506 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
5509 if ((
size_t)basicsize < size) {
5510 PyErr_Format(PyExc_ValueError,
5511 "%.200s.%.200s size changed, may indicate binary incompatibility. "
5512 "Expected %zd from C header, got %zd from PyObject",
5513 module_name, class_name, size, basicsize);
5516 if (check_size == __Pyx_ImportType_CheckSize_Error && (
size_t)basicsize != size) {
5517 PyErr_Format(PyExc_ValueError,
5518 "%.200s.%.200s size changed, may indicate binary incompatibility. "
5519 "Expected %zd from C header, got %zd from PyObject",
5520 module_name, class_name, size, basicsize);
5523 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (
size_t)basicsize > size) {
5524 PyOS_snprintf(warning,
sizeof(warning),
5525 "%s.%s size changed, may indicate binary incompatibility. "
5526 "Expected %zd from C header, got %zd from PyObject",
5527 module_name, class_name, size, basicsize);
5528 if (PyErr_WarnEx(NULL, warning, 0) < 0)
goto bad;
5530 return (PyTypeObject *)result;
5538 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
5539 PyObject *empty_list = 0;
5540 PyObject *module = 0;
5541 PyObject *global_dict = 0;
5542 PyObject *empty_dict = 0;
5544 #if PY_MAJOR_VERSION < 3
5545 PyObject *py_import;
5546 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
5553 empty_list = PyList_New(0);
5558 global_dict = PyModule_GetDict(__pyx_m);
5561 empty_dict = PyDict_New();
5565 #if PY_MAJOR_VERSION >= 3
5567 if ((1) && (strchr(__Pyx_MODULE_NAME,
'.'))) {
5568 module = PyImport_ImportModuleLevelObject(
5569 name, global_dict, empty_dict, list, 1);
5571 if (!PyErr_ExceptionMatches(PyExc_ImportError))
5580 #if PY_MAJOR_VERSION < 3
5581 PyObject *py_level = PyInt_FromLong(level);
5584 module = PyObject_CallFunctionObjArgs(py_import,
5585 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
5586 Py_DECREF(py_level);
5588 module = PyImport_ImportModuleLevelObject(
5589 name, global_dict, empty_dict, list, level);
5594 #if PY_MAJOR_VERSION < 3
5595 Py_XDECREF(py_import);
5597 Py_XDECREF(empty_list);
5598 Py_XDECREF(empty_dict);
5603 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
5604 PyObject* fake_module;
5605 PyTypeObject* cached_type = NULL;
5606 fake_module = PyImport_AddModule((
char*)
"_cython_" CYTHON_ABI);
5607 if (!fake_module)
return NULL;
5608 Py_INCREF(fake_module);
5609 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
5611 if (!PyType_Check((PyObject*)cached_type)) {
5612 PyErr_Format(PyExc_TypeError,
5613 "Shared Cython type %.200s is not a type object",
5617 if (cached_type->tp_basicsize != type->tp_basicsize) {
5618 PyErr_Format(PyExc_TypeError,
5619 "Shared Cython type %.200s has the wrong size, try recompiling",
5624 if (!PyErr_ExceptionMatches(PyExc_AttributeError))
goto bad;
5626 if (PyType_Ready(type) < 0)
goto bad;
5627 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
5633 Py_DECREF(fake_module);
5636 Py_XDECREF(cached_type);
5642 #include <structmember.h>
5644 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *closure)
5646 if (unlikely(op->func_doc == NULL)) {
5647 if (op->func.m_ml->ml_doc) {
5648 #if PY_MAJOR_VERSION >= 3
5649 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
5651 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
5653 if (unlikely(op->func_doc == NULL))
5660 Py_INCREF(op->func_doc);
5661 return op->func_doc;
5664 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
5666 PyObject *tmp = op->func_doc;
5667 if (value == NULL) {
5671 op->func_doc = value;
5676 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
5678 if (unlikely(op->func_name == NULL)) {
5679 #if PY_MAJOR_VERSION >= 3
5680 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
5682 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
5684 if (unlikely(op->func_name == NULL))
5687 Py_INCREF(op->func_name);
5688 return op->func_name;
5691 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
5694 #if PY_MAJOR_VERSION >= 3
5695 if (unlikely(value == NULL || !PyUnicode_Check(value)))
5697 if (unlikely(value == NULL || !PyString_Check(value)))
5700 PyErr_SetString(PyExc_TypeError,
5701 "__name__ must be set to a string object");
5704 tmp = op->func_name;
5706 op->func_name = value;
5711 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
5713 Py_INCREF(op->func_qualname);
5714 return op->func_qualname;
5717 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
5720 #if PY_MAJOR_VERSION >= 3
5721 if (unlikely(value == NULL || !PyUnicode_Check(value)))
5723 if (unlikely(value == NULL || !PyString_Check(value)))
5726 PyErr_SetString(PyExc_TypeError,
5727 "__qualname__ must be set to a string object");
5730 tmp = op->func_qualname;
5732 op->func_qualname = value;
5737 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED
void *closure)
5740 self = m->func_closure;
5747 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
5749 if (unlikely(op->func_dict == NULL)) {
5750 op->func_dict = PyDict_New();
5751 if (unlikely(op->func_dict == NULL))
5754 Py_INCREF(op->func_dict);
5755 return op->func_dict;
5758 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
5761 if (unlikely(value == NULL)) {
5762 PyErr_SetString(PyExc_TypeError,
5763 "function's dictionary may not be deleted");
5766 if (unlikely(!PyDict_Check(value))) {
5767 PyErr_SetString(PyExc_TypeError,
5768 "setting function's dictionary to a non-dict");
5771 tmp = op->func_dict;
5773 op->func_dict = value;
5778 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
5780 Py_INCREF(op->func_globals);
5781 return op->func_globals;
5784 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
5790 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
5792 PyObject* result = (op->func_code) ? op->func_code : Py_None;
5797 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
5799 PyObject *res = op->defaults_getter((PyObject *) op);
5802 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5803 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
5804 Py_INCREF(op->defaults_tuple);
5805 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
5806 Py_INCREF(op->defaults_kwdict);
5808 op->defaults_tuple = PySequence_ITEM(res, 0);
5809 if (unlikely(!op->defaults_tuple)) result = -1;
5811 op->defaults_kwdict = PySequence_ITEM(res, 1);
5812 if (unlikely(!op->defaults_kwdict)) result = -1;
5819 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
5823 }
else if (value != Py_None && !PyTuple_Check(value)) {
5824 PyErr_SetString(PyExc_TypeError,
5825 "__defaults__ must be set to a tuple object");
5829 tmp = op->defaults_tuple;
5830 op->defaults_tuple = value;
5835 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
5836 PyObject* result = op->defaults_tuple;
5837 if (unlikely(!result)) {
5838 if (op->defaults_getter) {
5839 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
5840 result = op->defaults_tuple;
5849 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
5853 }
else if (value != Py_None && !PyDict_Check(value)) {
5854 PyErr_SetString(PyExc_TypeError,
5855 "__kwdefaults__ must be set to a dict object");
5859 tmp = op->defaults_kwdict;
5860 op->defaults_kwdict = value;
5865 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
5866 PyObject* result = op->defaults_kwdict;
5867 if (unlikely(!result)) {
5868 if (op->defaults_getter) {
5869 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
5870 result = op->defaults_kwdict;
5879 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
5881 if (!value || value == Py_None) {
5883 }
else if (!PyDict_Check(value)) {
5884 PyErr_SetString(PyExc_TypeError,
5885 "__annotations__ must be set to a dict object");
5889 tmp = op->func_annotations;
5890 op->func_annotations = value;
5895 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
5896 PyObject* result = op->func_annotations;
5897 if (unlikely(!result)) {
5898 result = PyDict_New();
5899 if (unlikely(!result))
return NULL;
5900 op->func_annotations = result;
5905 static PyGetSetDef __pyx_CyFunction_getsets[] = {
5906 {(
char *)
"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
5907 {(
char *)
"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
5908 {(
char *)
"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
5909 {(
char *)
"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
5910 {(
char *)
"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
5911 {(
char *)
"__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
5912 {(
char *)
"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
5913 {(
char *)
"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
5914 {(
char *)
"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
5915 {(
char *)
"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
5916 {(
char *)
"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
5917 {(
char *)
"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
5918 {(
char *)
"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
5919 {(
char *)
"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
5920 {(
char *)
"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
5921 {(
char *)
"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
5922 {(
char *)
"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
5923 {(
char *)
"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
5926 static PyMemberDef __pyx_CyFunction_members[] = {
5927 {(
char *)
"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
5931 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
5933 #if PY_MAJOR_VERSION >= 3
5934 Py_INCREF(m->func_qualname);
5935 return m->func_qualname;
5937 return PyString_FromString(m->func.m_ml->ml_name);
5940 static PyMethodDef __pyx_CyFunction_methods[] = {
5941 {
"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
5944 #if PY_VERSION_HEX < 0x030500A0
5945 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
5947 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
5949 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml,
int flags, PyObject* qualname,
5950 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
5951 if (unlikely(op == NULL))
5954 __Pyx_CyFunction_weakreflist(op) = NULL;
5956 op->func.m_self = (PyObject *) op;
5957 Py_XINCREF(closure);
5958 op->func_closure = closure;
5960 op->func.m_module = module;
5961 op->func_dict = NULL;
5962 op->func_name = NULL;
5963 Py_INCREF(qualname);
5964 op->func_qualname = qualname;
5965 op->func_doc = NULL;
5966 op->func_classobj = NULL;
5967 op->func_globals = globals;
5968 Py_INCREF(op->func_globals);
5970 op->func_code = code;
5971 op->defaults_pyobjects = 0;
5972 op->defaults_size = 0;
5973 op->defaults = NULL;
5974 op->defaults_tuple = NULL;
5975 op->defaults_kwdict = NULL;
5976 op->defaults_getter = NULL;
5977 op->func_annotations = NULL;
5978 return (PyObject *) op;
5981 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
5983 Py_CLEAR(m->func_closure);
5984 Py_CLEAR(m->func.m_module);
5985 Py_CLEAR(m->func_dict);
5986 Py_CLEAR(m->func_name);
5987 Py_CLEAR(m->func_qualname);
5988 Py_CLEAR(m->func_doc);
5989 Py_CLEAR(m->func_globals);
5990 Py_CLEAR(m->func_code);
5991 Py_CLEAR(m->func_classobj);
5992 Py_CLEAR(m->defaults_tuple);
5993 Py_CLEAR(m->defaults_kwdict);
5994 Py_CLEAR(m->func_annotations);
5996 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
5998 for (i = 0; i < m->defaults_pyobjects; i++)
5999 Py_XDECREF(pydefaults[i]);
6000 PyObject_Free(m->defaults);
6005 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
6007 if (__Pyx_CyFunction_weakreflist(m) != NULL)
6008 PyObject_ClearWeakRefs((PyObject *) m);
6009 __Pyx_CyFunction_clear(m);
6012 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
6014 PyObject_GC_UnTrack(m);
6015 __Pyx__CyFunction_dealloc(m);
6017 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
void *arg)
6019 Py_VISIT(m->func_closure);
6020 Py_VISIT(m->func.m_module);
6021 Py_VISIT(m->func_dict);
6022 Py_VISIT(m->func_name);
6023 Py_VISIT(m->func_qualname);
6024 Py_VISIT(m->func_doc);
6025 Py_VISIT(m->func_globals);
6026 Py_VISIT(m->func_code);
6027 Py_VISIT(m->func_classobj);
6028 Py_VISIT(m->defaults_tuple);
6029 Py_VISIT(m->defaults_kwdict);
6031 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
6033 for (i = 0; i < m->defaults_pyobjects; i++)
6034 Py_VISIT(pydefaults[i]);
6038 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
6040 #if PY_MAJOR_VERSION < 3
6041 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
6042 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
6046 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
6048 type = (PyObject *)(Py_TYPE(obj));
6049 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
6054 return __Pyx_PyMethod_New(func, obj, type);
6057 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
6059 #if PY_MAJOR_VERSION >= 3
6060 return PyUnicode_FromFormat(
"<cyfunction %U at %p>",
6061 op->func_qualname, (
void *)op);
6063 return PyString_FromFormat(
"<cyfunction %s at %p>",
6064 PyString_AsString(op->func_qualname), (
void *)op);
6067 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *
self, PyObject *arg, PyObject *kw) {
6068 PyCFunctionObject*
f = (PyCFunctionObject*)func;
6069 PyCFunction meth =
f->m_ml->ml_meth;
6071 switch (
f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
6073 if (likely(kw == NULL || PyDict_Size(kw) == 0))
6074 return (*meth)(
self, arg);
6076 case METH_VARARGS | METH_KEYWORDS:
6077 return (*(PyCFunctionWithKeywords)(
void*)meth)(
self, arg, kw);
6079 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
6080 size = PyTuple_GET_SIZE(arg);
6081 if (likely(size == 0))
6082 return (*meth)(
self, NULL);
6083 PyErr_Format(PyExc_TypeError,
6084 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T
"d given)",
6085 f->m_ml->ml_name, size);
6090 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
6091 size = PyTuple_GET_SIZE(arg);
6092 if (likely(size == 1)) {
6093 PyObject *result, *arg0;
6094 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6095 arg0 = PyTuple_GET_ITEM(arg, 0);
6097 arg0 = PySequence_ITEM(arg, 0);
if (unlikely(!arg0))
return NULL;
6099 result = (*meth)(
self, arg0);
6100 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
6105 PyErr_Format(PyExc_TypeError,
6106 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T
"d given)",
6107 f->m_ml->ml_name, size);
6112 PyErr_SetString(PyExc_SystemError,
"Bad call flags in "
6113 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
6114 "longer supported!");
6117 PyErr_Format(PyExc_TypeError,
"%.200s() takes no keyword arguments",
6121 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
6122 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
6124 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
6126 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
6127 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
6131 argc = PyTuple_GET_SIZE(args);
6132 new_args = PyTuple_GetSlice(args, 1, argc);
6133 if (unlikely(!new_args))
6135 self = PyTuple_GetItem(args, 0);
6136 if (unlikely(!
self)) {
6137 Py_DECREF(new_args);
6138 PyErr_Format(PyExc_TypeError,
6139 "unbound method %.200S() needs an argument",
6140 cyfunc->func_qualname);
6143 result = __Pyx_CyFunction_CallMethod(func,
self, new_args, kw);
6144 Py_DECREF(new_args);
6146 result = __Pyx_CyFunction_Call(func, args, kw);
6150 static PyTypeObject __pyx_CyFunctionType_type = {
6151 PyVarObject_HEAD_INIT(0, 0)
6152 "cython_function_or_method",
6153 sizeof(__pyx_CyFunctionObject),
6155 (destructor) __Pyx_CyFunction_dealloc,
6159 #if PY_MAJOR_VERSION < 3
6164 (reprfunc) __Pyx_CyFunction_repr,
6169 __Pyx_CyFunction_CallAsMethod,
6174 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
6176 (traverseproc) __Pyx_CyFunction_traverse,
6177 (inquiry) __Pyx_CyFunction_clear,
6179 #
if PY_VERSION_HEX < 0x030500A0
6180 offsetof(__pyx_CyFunctionObject, func_weakreflist),
6182 offsetof(PyCFunctionObject, m_weakreflist),
6186 __pyx_CyFunction_methods,
6187 __pyx_CyFunction_members,
6188 __pyx_CyFunction_getsets,
6191 __Pyx_CyFunction_descr_get,
6193 offsetof(__pyx_CyFunctionObject, func_dict),
6206 #if PY_VERSION_HEX >= 0x030400a1
6209 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
6212 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
6215 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
6219 static int __pyx_CyFunction_init(
void) {
6220 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
6221 if (unlikely(__pyx_CyFunctionType == NULL)) {
6226 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *func,
size_t size,
int pyobjects) {
6227 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
6228 m->defaults = PyObject_Malloc(size);
6229 if (unlikely(!m->defaults))
6230 return PyErr_NoMemory();
6231 memset(m->defaults, 0, size);
6232 m->defaults_pyobjects = pyobjects;
6233 m->defaults_size = size;
6236 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
6237 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
6238 m->defaults_tuple = tuple;
6241 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
6242 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
6243 m->defaults_kwdict = dict;
6246 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
6247 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
6248 m->func_annotations = dict;
6253 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
int flags, PyObject* qualname,
6254 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
6255 PyObject *op = __Pyx_CyFunction_Init(
6256 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
6257 ml, flags, qualname, closure, module, globals, code
6260 PyObject_GC_Track(op);
6266 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
6267 Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
6268 for (i=0; i < nbases; i++) {
6269 PyTypeObject *tmptype;
6270 PyObject *tmp = PyTuple_GET_ITEM(bases, i);
6271 tmptype = Py_TYPE(tmp);
6272 #if PY_MAJOR_VERSION < 3
6273 if (tmptype == &PyClass_Type)
6277 metaclass = tmptype;
6280 if (PyType_IsSubtype(metaclass, tmptype))
6282 if (PyType_IsSubtype(tmptype, metaclass)) {
6283 metaclass = tmptype;
6286 PyErr_SetString(PyExc_TypeError,
6287 "metaclass conflict: "
6288 "the metaclass of a derived class "
6289 "must be a (non-strict) subclass "
6290 "of the metaclasses of all its bases");
6294 #if PY_MAJOR_VERSION < 3
6295 metaclass = &PyClass_Type;
6297 metaclass = &PyType_Type;
6300 Py_INCREF((PyObject*) metaclass);
6301 return (PyObject*) metaclass;
6305 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
6306 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
6309 PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
6311 PyObject *pargs = PyTuple_Pack(2, name, bases);
6312 if (unlikely(!pargs)) {
6316 ns = PyObject_Call(prep, pargs, mkw);
6320 if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
6330 if (unlikely(PyObject_SetItem(
ns, __pyx_n_s_module, modname) < 0))
goto bad;
6331 if (unlikely(PyObject_SetItem(
ns, __pyx_n_s_qualname, qualname) < 0))
goto bad;
6332 if (unlikely(doc && PyObject_SetItem(
ns, __pyx_n_s_doc, doc) < 0))
goto bad;
6338 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
6339 PyObject *dict, PyObject *mkw,
6340 int calculate_metaclass,
int allow_py2_metaclass) {
6341 PyObject *result, *margs;
6342 PyObject *owned_metaclass = NULL;
6343 if (allow_py2_metaclass) {
6344 owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
6345 if (owned_metaclass) {
6346 metaclass = owned_metaclass;
6347 }
else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
6353 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
6354 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
6355 Py_XDECREF(owned_metaclass);
6356 if (unlikely(!metaclass))
6358 owned_metaclass = metaclass;
6360 margs = PyTuple_Pack(3, name, bases, dict);
6361 if (unlikely(!margs)) {
6364 result = PyObject_Call(metaclass, margs, mkw);
6367 Py_XDECREF(owned_metaclass);
6372 #ifndef CYTHON_CLINE_IN_TRACEBACK
6373 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate,
int c_line) {
6374 PyObject *use_cline;
6375 PyObject *ptype, *pvalue, *ptraceback;
6376 #if CYTHON_COMPILING_IN_CPYTHON
6377 PyObject **cython_runtime_dict;
6379 if (unlikely(!__pyx_cython_runtime)) {
6382 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
6383 #if CYTHON_COMPILING_IN_CPYTHON
6384 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
6385 if (likely(cython_runtime_dict)) {
6386 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
6387 use_cline, *cython_runtime_dict,
6388 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
6392 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
6393 if (use_cline_obj) {
6394 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
6395 Py_DECREF(use_cline_obj);
6403 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
6405 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
6408 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
6414 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
6415 int start = 0, mid = 0, end = count - 1;
6416 if (end >= 0 && code_line > entries[end].code_line) {
6419 while (start < end) {
6420 mid = start + (end - start) / 2;
6421 if (code_line < entries[mid].code_line) {
6423 }
else if (code_line > entries[mid].code_line) {
6429 if (code_line <= entries[mid].code_line) {
6435 static PyCodeObject *__pyx_find_code_object(
int code_line) {
6436 PyCodeObject* code_object;
6438 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
6441 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
6442 if (unlikely(
pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[
pos].code_line != code_line)) {
6445 code_object = __pyx_code_cache.entries[
pos].code_object;
6446 Py_INCREF(code_object);
6449 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
6451 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
6452 if (unlikely(!code_line)) {
6455 if (unlikely(!entries)) {
6456 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
6457 if (likely(entries)) {
6458 __pyx_code_cache.entries = entries;
6459 __pyx_code_cache.max_count = 64;
6460 __pyx_code_cache.count = 1;
6461 entries[0].code_line = code_line;
6462 entries[0].code_object = code_object;
6463 Py_INCREF(code_object);
6467 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
6468 if ((
pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[
pos].code_line == code_line)) {
6469 PyCodeObject* tmp = entries[
pos].code_object;
6470 entries[
pos].code_object = code_object;
6474 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
6475 int new_max = __pyx_code_cache.max_count + 64;
6476 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
6477 __pyx_code_cache.entries, ((
size_t)new_max) *
sizeof(__Pyx_CodeObjectCacheEntry));
6478 if (unlikely(!entries)) {
6481 __pyx_code_cache.entries = entries;
6482 __pyx_code_cache.max_count = new_max;
6484 for (i=__pyx_code_cache.count; i>
pos; i--) {
6485 entries[i] = entries[i-1];
6487 entries[
pos].code_line = code_line;
6488 entries[
pos].code_object = code_object;
6489 __pyx_code_cache.count++;
6490 Py_INCREF(code_object);
6494 #include "compile.h"
6495 #include "frameobject.h"
6496 #include "traceback.h"
6497 #if PY_VERSION_HEX >= 0x030b00a6
6498 #ifndef Py_BUILD_CORE
6499 #define Py_BUILD_CORE 1
6501 #include "internal/pycore_frame.h"
6503 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
6504 const char *funcname,
int c_line,
6505 int py_line,
const char *filename) {
6506 PyCodeObject *py_code = NULL;
6507 PyObject *py_funcname = NULL;
6508 #if PY_MAJOR_VERSION < 3
6509 PyObject *py_srcfile = NULL;
6510 py_srcfile = PyString_FromString(filename);
6511 if (!py_srcfile)
goto bad;
6514 #if PY_MAJOR_VERSION < 3
6515 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
6516 if (!py_funcname)
goto bad;
6518 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
6519 if (!py_funcname)
goto bad;
6520 funcname = PyUnicode_AsUTF8(py_funcname);
6521 if (!funcname)
goto bad;
6525 #if PY_MAJOR_VERSION < 3
6526 py_funcname = PyString_FromString(funcname);
6527 if (!py_funcname)
goto bad;
6530 #if PY_MAJOR_VERSION < 3
6531 py_code = __Pyx_PyCode_New(
6548 Py_DECREF(py_srcfile);
6550 py_code = PyCode_NewEmpty(filename, funcname, py_line);
6552 Py_XDECREF(py_funcname);
6555 Py_XDECREF(py_funcname);
6556 #if PY_MAJOR_VERSION < 3
6557 Py_XDECREF(py_srcfile);
6561 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
6562 int py_line,
const char *filename) {
6563 PyCodeObject *py_code = 0;
6564 PyFrameObject *py_frame = 0;
6565 PyThreadState *tstate = __Pyx_PyThreadState_Current;
6566 PyObject *ptype, *pvalue, *ptraceback;
6568 c_line = __Pyx_CLineForTraceback(tstate, c_line);
6570 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
6572 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
6573 py_code = __Pyx_CreateCodeObjectForTraceback(
6574 funcname, c_line, py_line, filename);
6580 Py_XDECREF(ptraceback);
6583 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
6584 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
6586 py_frame = PyFrame_New(
6592 if (!py_frame)
goto bad;
6593 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
6594 PyTraceBack_Here(py_frame);
6596 Py_XDECREF(py_code);
6597 Py_XDECREF(py_frame);
6601 static CYTHON_INLINE
long __Pyx_pow_long(
long b,
long e) {
6616 if (unlikely(e<0))
return 0;
6620 t *= (b * (e&1)) | ((~e)&1);
6628 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
6629 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
6630 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
6631 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
6632 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
6634 func_type value = func_value;\
6635 if (sizeof(target_type) < sizeof(func_type)) {\
6636 if (unlikely(value != (func_type) (target_type) value)) {\
6637 func_type zero = 0;\
6638 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
6639 return (target_type) -1;\
6640 if (is_unsigned && unlikely(value < zero))\
6641 goto raise_neg_overflow;\
6643 goto raise_overflow;\
6646 return (target_type) value;\
6652 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
6653 return ::std::complex< float >(x, y);
6656 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
6657 return x + y*(__pyx_t_float_complex)_Complex_I;
6661 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
6662 __pyx_t_float_complex
z;
6672 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6673 return (a.real == b.real) && (a.imag == b.imag);
6675 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6676 __pyx_t_float_complex
z;
6677 z.real = a.real + b.real;
6678 z.imag = a.imag + b.imag;
6681 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6682 __pyx_t_float_complex
z;
6683 z.real = a.real - b.real;
6684 z.imag = a.imag - b.imag;
6687 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6688 __pyx_t_float_complex
z;
6689 z.real = a.real * b.real - a.imag * b.imag;
6690 z.imag = a.real * b.imag + a.imag * b.real;
6694 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6696 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
6697 }
else if (fabsf(b.real) >= fabsf(b.imag)) {
6698 if (b.real == 0 && b.imag == 0) {
6699 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
6701 float r = b.imag / b.real;
6702 float s = (float)(1.0) / (b.real + b.imag *
r);
6703 return __pyx_t_float_complex_from_parts(
6704 (a.real + a.imag *
r) *
s, (a.imag - a.real *
r) *
s);
6707 float r = b.real / b.imag;
6708 float s = (float)(1.0) / (b.imag + b.real *
r);
6709 return __pyx_t_float_complex_from_parts(
6710 (a.real *
r + a.imag) *
s, (a.imag *
r - a.real) *
s);
6714 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6716 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
6718 float denom = b.real * b.real + b.imag * b.imag;
6719 return __pyx_t_float_complex_from_parts(
6720 (a.real * b.real + a.imag * b.imag) / denom,
6721 (a.imag * b.real - a.real * b.imag) / denom);
6725 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
6726 __pyx_t_float_complex
z;
6731 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
6732 return (a.real == 0) && (a.imag == 0);
6734 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
6735 __pyx_t_float_complex
z;
6741 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex
z) {
6742 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
6743 return sqrtf(
z.real*
z.real +
z.imag*
z.imag);
6745 return hypotf(
z.real,
z.imag);
6748 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6749 __pyx_t_float_complex
z;
6750 float r, lnr, theta, z_r, z_theta;
6751 if (b.imag == 0 && b.real == (
int)b.real) {
6753 float denom = a.real * a.real + a.imag * a.imag;
6754 a.real = a.real / denom;
6755 a.imag = -a.imag / denom;
6758 switch ((
int)b.real) {
6766 return __Pyx_c_prod_float(a, a);
6768 z = __Pyx_c_prod_float(a, a);
6769 return __Pyx_c_prod_float(
z, a);
6771 z = __Pyx_c_prod_float(a, a);
6772 return __Pyx_c_prod_float(
z,
z);
6778 }
else if (b.imag == 0) {
6779 z.real = powf(a.real, b.real);
6782 }
else if (a.real > 0) {
6787 theta = atan2f(0.0, -1.0);
6790 r = __Pyx_c_abs_float(a);
6791 theta = atan2f(a.imag, a.real);
6794 z_r = expf(lnr * b.real - theta * b.imag);
6795 z_theta = theta * b.real + lnr * b.imag;
6796 z.real = z_r * cosf(z_theta);
6797 z.imag = z_r * sinf(z_theta);
6806 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
6807 return ::std::complex< double >(x, y);
6810 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
6811 return x + y*(__pyx_t_double_complex)_Complex_I;
6815 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
6816 __pyx_t_double_complex
z;
6826 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
6827 return (a.real == b.real) && (a.imag == b.imag);
6829 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
6830 __pyx_t_double_complex
z;
6831 z.real = a.real + b.real;
6832 z.imag = a.imag + b.imag;
6835 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
6836 __pyx_t_double_complex
z;
6837 z.real = a.real - b.real;
6838 z.imag = a.imag - b.imag;
6841 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
6842 __pyx_t_double_complex
z;
6843 z.real = a.real * b.real - a.imag * b.imag;
6844 z.imag = a.real * b.imag + a.imag * b.real;
6848 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
6850 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
6851 }
else if (fabs(b.real) >= fabs(b.imag)) {
6852 if (b.real == 0 && b.imag == 0) {
6853 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
6855 double r = b.imag / b.real;
6856 double s = (double)(1.0) / (b.real + b.imag *
r);
6857 return __pyx_t_double_complex_from_parts(
6858 (a.real + a.imag *
r) *
s, (a.imag - a.real *
r) *
s);
6861 double r = b.real / b.imag;
6862 double s = (double)(1.0) / (b.imag + b.real *
r);
6863 return __pyx_t_double_complex_from_parts(
6864 (a.real *
r + a.imag) *
s, (a.imag *
r - a.real) *
s);
6868 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
6870 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
6872 double denom = b.real * b.real + b.imag * b.imag;
6873 return __pyx_t_double_complex_from_parts(
6874 (a.real * b.real + a.imag * b.imag) / denom,
6875 (a.imag * b.real - a.real * b.imag) / denom);
6879 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
6880 __pyx_t_double_complex
z;
6885 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
6886 return (a.real == 0) && (a.imag == 0);
6888 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
6889 __pyx_t_double_complex
z;
6895 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex
z) {
6896 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
6897 return sqrt(
z.real*
z.real +
z.imag*
z.imag);
6899 return hypot(
z.real,
z.imag);
6902 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
6903 __pyx_t_double_complex
z;
6904 double r, lnr, theta, z_r, z_theta;
6905 if (b.imag == 0 && b.real == (
int)b.real) {
6907 double denom = a.real * a.real + a.imag * a.imag;
6908 a.real = a.real / denom;
6909 a.imag = -a.imag / denom;
6912 switch ((
int)b.real) {
6920 return __Pyx_c_prod_double(a, a);
6922 z = __Pyx_c_prod_double(a, a);
6923 return __Pyx_c_prod_double(
z, a);
6925 z = __Pyx_c_prod_double(a, a);
6926 return __Pyx_c_prod_double(
z,
z);
6932 }
else if (b.imag == 0) {
6933 z.real = pow(a.real, b.real);
6936 }
else if (a.real > 0) {
6941 theta = atan2(0.0, -1.0);
6944 r = __Pyx_c_abs_double(a);
6945 theta = atan2(a.imag, a.real);
6948 z_r = exp(lnr * b.real - theta * b.imag);
6949 z_theta = theta * b.real + lnr * b.imag;
6950 z.real = z_r * cos(z_theta);
6951 z.imag = z_r * sin(z_theta);
6958 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
6959 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6960 #pragma GCC diagnostic push
6961 #pragma GCC diagnostic ignored "-Wconversion"
6963 const int neg_one = (int) -1, const_zero = (
int) 0;
6964 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6965 #pragma GCC diagnostic pop
6967 const int is_unsigned = neg_one > const_zero;
6968 #if PY_MAJOR_VERSION < 3
6969 if (likely(PyInt_Check(x))) {
6970 if (
sizeof(
int) <
sizeof(long)) {
6971 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
6973 long val = PyInt_AS_LONG(x);
6974 if (is_unsigned && unlikely(val < 0)) {
6975 goto raise_neg_overflow;
6981 if (likely(PyLong_Check(x))) {
6983 #if CYTHON_USE_PYLONG_INTERNALS
6984 const digit* digits = ((PyLongObject*)x)->ob_digit;
6985 switch (Py_SIZE(x)) {
6986 case 0:
return (
int) 0;
6987 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
6989 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
6990 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
6991 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
6992 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
6993 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
6998 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
6999 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
7000 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
7001 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
7002 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7007 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
7008 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
7009 __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])))
7010 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
7011 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
7017 #if CYTHON_COMPILING_IN_CPYTHON
7018 if (unlikely(Py_SIZE(x) < 0)) {
7019 goto raise_neg_overflow;
7023 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7024 if (unlikely(result < 0))
7026 if (unlikely(result == 1))
7027 goto raise_neg_overflow;
7030 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
7031 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
7032 #ifdef HAVE_LONG_LONG
7033 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
7034 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7038 #if CYTHON_USE_PYLONG_INTERNALS
7039 const digit* digits = ((PyLongObject*)x)->ob_digit;
7040 switch (Py_SIZE(x)) {
7041 case 0:
return (
int) 0;
7042 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
7043 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
7045 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
7046 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
7047 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
7048 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
7049 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
7054 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
7055 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
7056 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
7057 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
7058 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
7063 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
7064 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
7065 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
7066 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
7067 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7072 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
7073 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
7074 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
7075 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
7076 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7081 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
7082 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
7083 __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])))
7084 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
7085 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
7090 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
7091 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
7092 __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])))
7093 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
7094 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
7100 if (
sizeof(
int) <=
sizeof(long)) {
7101 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
7102 #ifdef HAVE_LONG_LONG
7103 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
7104 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
7109 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7110 PyErr_SetString(PyExc_RuntimeError,
7111 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7114 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
7115 #if PY_MAJOR_VERSION < 3
7116 if (likely(
v) && !PyLong_Check(
v)) {
7118 v = PyNumber_Long(tmp);
7123 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
7124 unsigned char *bytes = (
unsigned char *)&val;
7125 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
7127 is_little, !is_unsigned);
7137 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7138 if (!tmp)
return (
int) -1;
7139 val = __Pyx_PyInt_As_int(tmp);
7144 PyErr_SetString(PyExc_OverflowError,
7145 "value too large to convert to int");
7148 PyErr_SetString(PyExc_OverflowError,
7149 "can't convert negative value to int");
7154 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
7155 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
7156 #pragma GCC diagnostic push
7157 #pragma GCC diagnostic ignored "-Wconversion"
7159 const long neg_one = (long) -1, const_zero = (
long) 0;
7160 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
7161 #pragma GCC diagnostic pop
7163 const int is_unsigned = neg_one > const_zero;
7165 if (
sizeof(
long) <
sizeof(long)) {
7166 return PyInt_FromLong((
long) value);
7167 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
7168 return PyLong_FromUnsignedLong((
unsigned long) value);
7169 #ifdef HAVE_LONG_LONG
7170 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
7171 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
7175 if (
sizeof(
long) <=
sizeof(
long)) {
7176 return PyInt_FromLong((
long) value);
7177 #ifdef HAVE_LONG_LONG
7178 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
7179 return PyLong_FromLongLong((PY_LONG_LONG) value);
7184 int one = 1;
int little = (int)*(
unsigned char *)&one;
7185 unsigned char *bytes = (
unsigned char *)&value;
7186 return _PyLong_FromByteArray(bytes,
sizeof(
long),
7187 little, !is_unsigned);
7192 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
7193 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
7194 #pragma GCC diagnostic push
7195 #pragma GCC diagnostic ignored "-Wconversion"
7197 const long neg_one = (long) -1, const_zero = (
long) 0;
7198 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
7199 #pragma GCC diagnostic pop
7201 const int is_unsigned = neg_one > const_zero;
7202 #if PY_MAJOR_VERSION < 3
7203 if (likely(PyInt_Check(x))) {
7204 if (
sizeof(
long) <
sizeof(long)) {
7205 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
7207 long val = PyInt_AS_LONG(x);
7208 if (is_unsigned && unlikely(val < 0)) {
7209 goto raise_neg_overflow;
7215 if (likely(PyLong_Check(x))) {
7217 #if CYTHON_USE_PYLONG_INTERNALS
7218 const digit* digits = ((PyLongObject*)x)->ob_digit;
7219 switch (Py_SIZE(x)) {
7220 case 0:
return (
long) 0;
7221 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
7223 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
7224 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
7225 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
7226 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
7227 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
7232 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
7233 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
7234 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
7235 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
7236 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7241 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
7242 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
7243 __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])))
7244 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
7245 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
7251 #if CYTHON_COMPILING_IN_CPYTHON
7252 if (unlikely(Py_SIZE(x) < 0)) {
7253 goto raise_neg_overflow;
7257 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7258 if (unlikely(result < 0))
7260 if (unlikely(result == 1))
7261 goto raise_neg_overflow;
7264 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
7265 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
7266 #ifdef HAVE_LONG_LONG
7267 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
7268 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7272 #if CYTHON_USE_PYLONG_INTERNALS
7273 const digit* digits = ((PyLongObject*)x)->ob_digit;
7274 switch (Py_SIZE(x)) {
7275 case 0:
return (
long) 0;
7276 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
7277 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
7279 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
7280 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
7281 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
7282 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
7283 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
7288 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
7289 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
7290 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
7291 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
7292 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
7297 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
7298 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
7299 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
7300 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
7301 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7306 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
7307 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
7308 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
7309 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
7310 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7315 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
7316 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
7317 __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])))
7318 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
7319 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
7324 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
7325 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
7326 __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])))
7327 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
7328 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
7334 if (
sizeof(
long) <=
sizeof(long)) {
7335 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
7336 #ifdef HAVE_LONG_LONG
7337 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
7338 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
7343 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7344 PyErr_SetString(PyExc_RuntimeError,
7345 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7348 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
7349 #if PY_MAJOR_VERSION < 3
7350 if (likely(
v) && !PyLong_Check(
v)) {
7352 v = PyNumber_Long(tmp);
7357 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
7358 unsigned char *bytes = (
unsigned char *)&val;
7359 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
7361 is_little, !is_unsigned);
7371 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7372 if (!tmp)
return (
long) -1;
7373 val = __Pyx_PyInt_As_long(tmp);
7378 PyErr_SetString(PyExc_OverflowError,
7379 "value too large to convert to long");
7382 PyErr_SetString(PyExc_OverflowError,
7383 "can't convert negative value to long");
7388 #if CYTHON_COMPILING_IN_CPYTHON
7389 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
7395 return b == &PyBaseObject_Type;
7397 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
7399 if (a == b)
return 1;
7403 n = PyTuple_GET_SIZE(mro);
7404 for (i = 0; i <
n; i++) {
7405 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
7410 return __Pyx_InBases(a, b);
7412 #if PY_MAJOR_VERSION == 2
7413 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
7414 PyObject *exception, *value, *tb;
7416 __Pyx_PyThreadState_declare
7417 __Pyx_PyThreadState_assign
7418 __Pyx_ErrFetch(&exception, &value, &tb);
7419 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
7420 if (unlikely(res == -1)) {
7421 PyErr_WriteUnraisable(err);
7425 res = PyObject_IsSubclass(err, exc_type2);
7426 if (unlikely(res == -1)) {
7427 PyErr_WriteUnraisable(err);
7431 __Pyx_ErrRestore(exception, value, tb);
7435 static CYTHON_INLINE
int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
7436 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
7438 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
7443 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
7445 assert(PyExceptionClass_Check(exc_type));
7446 n = PyTuple_GET_SIZE(tuple);
7447 #if PY_MAJOR_VERSION >= 3
7448 for (i=0; i<
n; i++) {
7449 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
7452 for (i=0; i<
n; i++) {
7453 PyObject *t = PyTuple_GET_ITEM(tuple, i);
7454 #if PY_MAJOR_VERSION < 3
7455 if (likely(exc_type == t))
return 1;
7457 if (likely(PyExceptionClass_Check(t))) {
7458 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
7464 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
7465 if (likely(err == exc_type))
return 1;
7466 if (likely(PyExceptionClass_Check(err))) {
7467 if (likely(PyExceptionClass_Check(exc_type))) {
7468 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
7469 }
else if (likely(PyTuple_Check(exc_type))) {
7470 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
7474 return PyErr_GivenExceptionMatches(err, exc_type);
7476 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
7477 assert(PyExceptionClass_Check(exc_type1));
7478 assert(PyExceptionClass_Check(exc_type2));
7479 if (likely(err == exc_type1 || err == exc_type2))
return 1;
7480 if (likely(PyExceptionClass_Check(err))) {
7481 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
7483 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
7488 static int __Pyx_check_binary_version(
void) {
7490 int same=1, i, found_dot;
7491 const char* rt_from_call = Py_GetVersion();
7492 PyOS_snprintf(ctversion, 5,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
7494 for (i = 0; i < 4; i++) {
7495 if (!ctversion[i]) {
7496 same = (rt_from_call[i] <
'0' || rt_from_call[i] >
'9');
7499 if (rt_from_call[i] != ctversion[i]) {
7505 char rtversion[5] = {
'\0'};
7507 for (i=0; i<4; ++i) {
7508 if (rt_from_call[i] ==
'.') {
7509 if (found_dot)
break;
7511 }
else if (rt_from_call[i] <
'0' || rt_from_call[i] >
'9') {
7514 rtversion[i] = rt_from_call[i];
7516 PyOS_snprintf(message,
sizeof(message),
7517 "compiletime version %s of module '%.100s' "
7518 "does not match runtime version %s",
7519 ctversion, __Pyx_MODULE_NAME, rtversion);
7520 return PyErr_WarnEx(NULL, message, 1);
7526 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
7528 #if PY_MAJOR_VERSION < 3
7529 if (t->is_unicode) {
7530 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
7531 }
else if (t->intern) {
7532 *t->p = PyString_InternFromString(t->s);
7534 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
7537 if (t->is_unicode | t->is_str) {
7539 *t->p = PyUnicode_InternFromString(t->s);
7540 }
else if (t->encoding) {
7541 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
7543 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
7546 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
7551 if (PyObject_Hash(*t->p) == -1)
7558 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
7559 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
7561 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
7563 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
7565 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
7566 #if !CYTHON_PEP393_ENABLED
7567 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
7569 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
7570 if (!defenc)
return NULL;
7571 defenc_c = PyBytes_AS_STRING(defenc);
7572 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
7574 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
7576 for (
c = defenc_c;
c < end;
c++) {
7577 if ((
unsigned char) (*
c) >= 128) {
7578 PyUnicode_AsASCIIString(o);
7584 *length = PyBytes_GET_SIZE(defenc);
7588 static CYTHON_INLINE
const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
7589 if (unlikely(__Pyx_PyUnicode_READY(o) == -1))
return NULL;
7590 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
7591 if (likely(PyUnicode_IS_ASCII(o))) {
7592 *length = PyUnicode_GET_LENGTH(o);
7593 return PyUnicode_AsUTF8(o);
7595 PyUnicode_AsASCIIString(o);
7599 return PyUnicode_AsUTF8AndSize(o, length);
7604 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
7605 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
7607 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
7608 __Pyx_sys_getdefaultencoding_not_ascii &&
7610 PyUnicode_Check(o)) {
7611 return __Pyx_PyUnicode_AsStringAndSize(o, length);
7614 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
7615 if (PyByteArray_Check(o)) {
7616 *length = PyByteArray_GET_SIZE(o);
7617 return PyByteArray_AS_STRING(o);
7622 int r = PyBytes_AsStringAndSize(o, &result, length);
7623 if (unlikely(
r < 0)) {
7630 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
7631 int is_true = x == Py_True;
7632 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
7633 else return PyObject_IsTrue(x);
7635 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
7637 if (unlikely(!x))
return -1;
7638 retval = __Pyx_PyObject_IsTrue(x);
7642 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result,
const char* type_name) {
7643 #if PY_MAJOR_VERSION >= 3
7644 if (PyLong_Check(result)) {
7645 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
7646 "__int__ returned non-int (type %.200s). "
7647 "The ability to return an instance of a strict subclass of int "
7648 "is deprecated, and may be removed in a future version of Python.",
7649 Py_TYPE(result)->tp_name)) {
7656 PyErr_Format(PyExc_TypeError,
7657 "__%.4s__ returned non-%.4s (type %.200s)",
7658 type_name, type_name, Py_TYPE(result)->tp_name);
7662 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
7663 #if CYTHON_USE_TYPE_SLOTS
7666 const char *name = NULL;
7667 PyObject *res = NULL;
7668 #if PY_MAJOR_VERSION < 3
7669 if (likely(PyInt_Check(x) || PyLong_Check(x)))
7671 if (likely(PyLong_Check(x)))
7673 return __Pyx_NewRef(x);
7674 #if CYTHON_USE_TYPE_SLOTS
7675 m = Py_TYPE(x)->tp_as_number;
7676 #if PY_MAJOR_VERSION < 3
7677 if (m && m->nb_int) {
7681 else if (m && m->nb_long) {
7683 res = m->nb_long(x);
7686 if (likely(m && m->nb_int)) {
7692 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
7693 res = PyNumber_Int(x);
7697 #if PY_MAJOR_VERSION < 3
7698 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
7700 if (unlikely(!PyLong_CheckExact(res))) {
7702 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
7705 else if (!PyErr_Occurred()) {
7706 PyErr_SetString(PyExc_TypeError,
7707 "an integer is required");
7711 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
7714 #if PY_MAJOR_VERSION < 3
7715 if (likely(PyInt_CheckExact(b))) {
7716 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
7717 return PyInt_AS_LONG(b);
7719 return PyInt_AsSsize_t(b);
7722 if (likely(PyLong_CheckExact(b))) {
7723 #if CYTHON_USE_PYLONG_INTERNALS
7724 const digit* digits = ((PyLongObject*)b)->ob_digit;
7725 const Py_ssize_t size = Py_SIZE(b);
7726 if (likely(__Pyx_sst_abs(size) <= 1)) {
7727 ival = likely(size) ? digits[0] : 0;
7728 if (size == -1) ival = -ival;
7733 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
7734 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
7738 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
7739 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7743 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
7744 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7748 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
7749 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
7753 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
7754 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]));
7758 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
7759 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]));
7765 return PyLong_AsSsize_t(b);
7767 x = PyNumber_Index(b);
7769 ival = PyInt_AsSsize_t(x);
7773 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
7774 if (
sizeof(Py_hash_t) ==
sizeof(Py_ssize_t)) {
7775 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
7776 #if PY_MAJOR_VERSION < 3
7777 }
else if (likely(PyInt_CheckExact(o))) {
7778 return PyInt_AS_LONG(o);
7783 x = PyNumber_Index(o);
7785 ival = PyInt_AsLong(x);
7790 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
7791 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
7793 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
7794 return PyInt_FromSize_t(ival);