3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
8 #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10 #error Cython requires Python 2.6+ or Python 3.3+.
12 #define CYTHON_ABI "0_29_30"
13 #define CYTHON_HEX_VERSION 0x001D1EF0
14 #define CYTHON_FUTURE_DIVISION 0
17 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
31 #define DL_IMPORT(t) t
34 #define DL_EXPORT(t) t
37 #ifndef HAVE_LONG_LONG
38 #if PY_VERSION_HEX >= 0x02070000
39 #define HAVE_LONG_LONG
43 #define PY_LONG_LONG LONG_LONG
46 #define Py_HUGE_VAL HUGE_VAL
49 #define CYTHON_COMPILING_IN_PYPY 1
50 #define CYTHON_COMPILING_IN_PYSTON 0
51 #define CYTHON_COMPILING_IN_CPYTHON 0
52 #undef CYTHON_USE_TYPE_SLOTS
53 #define CYTHON_USE_TYPE_SLOTS 0
54 #undef CYTHON_USE_PYTYPE_LOOKUP
55 #define CYTHON_USE_PYTYPE_LOOKUP 0
56 #if PY_VERSION_HEX < 0x03050000
57 #undef CYTHON_USE_ASYNC_SLOTS
58 #define CYTHON_USE_ASYNC_SLOTS 0
59 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60 #define CYTHON_USE_ASYNC_SLOTS 1
62 #undef CYTHON_USE_PYLIST_INTERNALS
63 #define CYTHON_USE_PYLIST_INTERNALS 0
64 #undef CYTHON_USE_UNICODE_INTERNALS
65 #define CYTHON_USE_UNICODE_INTERNALS 0
66 #undef CYTHON_USE_UNICODE_WRITER
67 #define CYTHON_USE_UNICODE_WRITER 0
68 #undef CYTHON_USE_PYLONG_INTERNALS
69 #define CYTHON_USE_PYLONG_INTERNALS 0
70 #undef CYTHON_AVOID_BORROWED_REFS
71 #define CYTHON_AVOID_BORROWED_REFS 1
72 #undef CYTHON_ASSUME_SAFE_MACROS
73 #define CYTHON_ASSUME_SAFE_MACROS 0
74 #undef CYTHON_UNPACK_METHODS
75 #define CYTHON_UNPACK_METHODS 0
76 #undef CYTHON_FAST_THREAD_STATE
77 #define CYTHON_FAST_THREAD_STATE 0
78 #undef CYTHON_FAST_PYCALL
79 #define CYTHON_FAST_PYCALL 0
80 #undef CYTHON_PEP489_MULTI_PHASE_INIT
81 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82 #undef CYTHON_USE_TP_FINALIZE
83 #define CYTHON_USE_TP_FINALIZE 0
84 #undef CYTHON_USE_DICT_VERSIONS
85 #define CYTHON_USE_DICT_VERSIONS 0
86 #undef CYTHON_USE_EXC_INFO_STACK
87 #define CYTHON_USE_EXC_INFO_STACK 0
88 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
89 #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900)
91 #elif defined(PYSTON_VERSION)
92 #define CYTHON_COMPILING_IN_PYPY 0
93 #define CYTHON_COMPILING_IN_PYSTON 1
94 #define CYTHON_COMPILING_IN_CPYTHON 0
95 #ifndef CYTHON_USE_TYPE_SLOTS
96 #define CYTHON_USE_TYPE_SLOTS 1
98 #undef CYTHON_USE_PYTYPE_LOOKUP
99 #define CYTHON_USE_PYTYPE_LOOKUP 0
100 #undef CYTHON_USE_ASYNC_SLOTS
101 #define CYTHON_USE_ASYNC_SLOTS 0
102 #undef CYTHON_USE_PYLIST_INTERNALS
103 #define CYTHON_USE_PYLIST_INTERNALS 0
104 #ifndef CYTHON_USE_UNICODE_INTERNALS
105 #define CYTHON_USE_UNICODE_INTERNALS 1
107 #undef CYTHON_USE_UNICODE_WRITER
108 #define CYTHON_USE_UNICODE_WRITER 0
109 #undef CYTHON_USE_PYLONG_INTERNALS
110 #define CYTHON_USE_PYLONG_INTERNALS 0
111 #ifndef CYTHON_AVOID_BORROWED_REFS
112 #define CYTHON_AVOID_BORROWED_REFS 0
114 #ifndef CYTHON_ASSUME_SAFE_MACROS
115 #define CYTHON_ASSUME_SAFE_MACROS 1
117 #ifndef CYTHON_UNPACK_METHODS
118 #define CYTHON_UNPACK_METHODS 1
120 #undef CYTHON_FAST_THREAD_STATE
121 #define CYTHON_FAST_THREAD_STATE 0
122 #undef CYTHON_FAST_PYCALL
123 #define CYTHON_FAST_PYCALL 0
124 #undef CYTHON_PEP489_MULTI_PHASE_INIT
125 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
126 #undef CYTHON_USE_TP_FINALIZE
127 #define CYTHON_USE_TP_FINALIZE 0
128 #undef CYTHON_USE_DICT_VERSIONS
129 #define CYTHON_USE_DICT_VERSIONS 0
130 #undef CYTHON_USE_EXC_INFO_STACK
131 #define CYTHON_USE_EXC_INFO_STACK 0
132 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
133 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
136 #define CYTHON_COMPILING_IN_PYPY 0
137 #define CYTHON_COMPILING_IN_PYSTON 0
138 #define CYTHON_COMPILING_IN_CPYTHON 1
139 #ifndef CYTHON_USE_TYPE_SLOTS
140 #define CYTHON_USE_TYPE_SLOTS 1
142 #if PY_VERSION_HEX < 0x02070000
143 #undef CYTHON_USE_PYTYPE_LOOKUP
144 #define CYTHON_USE_PYTYPE_LOOKUP 0
145 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
146 #define CYTHON_USE_PYTYPE_LOOKUP 1
148 #if PY_MAJOR_VERSION < 3
149 #undef CYTHON_USE_ASYNC_SLOTS
150 #define CYTHON_USE_ASYNC_SLOTS 0
151 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
152 #define CYTHON_USE_ASYNC_SLOTS 1
154 #if PY_VERSION_HEX < 0x02070000
155 #undef CYTHON_USE_PYLONG_INTERNALS
156 #define CYTHON_USE_PYLONG_INTERNALS 0
157 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
158 #define CYTHON_USE_PYLONG_INTERNALS 1
160 #ifndef CYTHON_USE_PYLIST_INTERNALS
161 #define CYTHON_USE_PYLIST_INTERNALS 1
163 #ifndef CYTHON_USE_UNICODE_INTERNALS
164 #define CYTHON_USE_UNICODE_INTERNALS 1
166 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
167 #undef CYTHON_USE_UNICODE_WRITER
168 #define CYTHON_USE_UNICODE_WRITER 0
169 #elif !defined(CYTHON_USE_UNICODE_WRITER)
170 #define CYTHON_USE_UNICODE_WRITER 1
172 #ifndef CYTHON_AVOID_BORROWED_REFS
173 #define CYTHON_AVOID_BORROWED_REFS 0
175 #ifndef CYTHON_ASSUME_SAFE_MACROS
176 #define CYTHON_ASSUME_SAFE_MACROS 1
178 #ifndef CYTHON_UNPACK_METHODS
179 #define CYTHON_UNPACK_METHODS 1
181 #if PY_VERSION_HEX >= 0x030B00A4
182 #undef CYTHON_FAST_THREAD_STATE
183 #define CYTHON_FAST_THREAD_STATE 0
184 #elif !defined(CYTHON_FAST_THREAD_STATE)
185 #define CYTHON_FAST_THREAD_STATE 1
187 #ifndef CYTHON_FAST_PYCALL
188 #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
190 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
191 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
193 #ifndef CYTHON_USE_TP_FINALIZE
194 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
196 #ifndef CYTHON_USE_DICT_VERSIONS
197 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
199 #if PY_VERSION_HEX >= 0x030B00A4
200 #undef CYTHON_USE_EXC_INFO_STACK
201 #define CYTHON_USE_EXC_INFO_STACK 0
202 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
203 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
205 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
206 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
209 #if !defined(CYTHON_FAST_PYCCALL)
210 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
212 #if CYTHON_USE_PYLONG_INTERNALS
213 #if PY_MAJOR_VERSION < 3
214 #include "longintrepr.h"
220 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P ==
sizeof(
void*)) };
223 #ifndef __has_attribute
224 #define __has_attribute(x) 0
226 #ifndef __has_cpp_attribute
227 #define __has_cpp_attribute(x) 0
229 #ifndef CYTHON_RESTRICT
230 #if defined(__GNUC__)
231 #define CYTHON_RESTRICT __restrict__
232 #elif defined(_MSC_VER) && _MSC_VER >= 1400
233 #define CYTHON_RESTRICT __restrict
234 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
235 #define CYTHON_RESTRICT restrict
237 #define CYTHON_RESTRICT
240 #ifndef CYTHON_UNUSED
241 # if defined(__GNUC__)
242 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
243 # define CYTHON_UNUSED __attribute__ ((__unused__))
245 # define CYTHON_UNUSED
247 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
248 # define CYTHON_UNUSED __attribute__ ((__unused__))
250 # define CYTHON_UNUSED
253 #ifndef CYTHON_MAYBE_UNUSED_VAR
254 # if defined(__cplusplus)
255 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
257 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
260 #ifndef CYTHON_NCP_UNUSED
261 # if CYTHON_COMPILING_IN_CPYTHON
262 # define CYTHON_NCP_UNUSED
264 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
267 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
269 #ifndef _MSC_STDINT_H_
271 typedef unsigned char uint8_t;
272 typedef unsigned int uint32_t;
274 typedef unsigned __int8 uint8_t;
275 typedef unsigned __int32 uint32_t;
281 #ifndef CYTHON_FALLTHROUGH
282 #if defined(__cplusplus) && __cplusplus >= 201103L
283 #if __has_cpp_attribute(fallthrough)
284 #define CYTHON_FALLTHROUGH [[fallthrough]]
285 #elif __has_cpp_attribute(clang::fallthrough)
286 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
287 #elif __has_cpp_attribute(gnu::fallthrough)
288 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
291 #ifndef CYTHON_FALLTHROUGH
292 #if __has_attribute(fallthrough)
293 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
295 #define CYTHON_FALLTHROUGH
298 #if defined(__clang__ ) && defined(__apple_build_version__)
299 #if __apple_build_version__ < 7000000
300 #undef CYTHON_FALLTHROUGH
301 #define CYTHON_FALLTHROUGH
307 #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
309 #ifndef CYTHON_INLINE
310 #if defined(__clang__)
311 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
313 #define CYTHON_INLINE inline
317 void __Pyx_call_destructor(
T& x) {
321 class __Pyx_FakeReference {
323 __Pyx_FakeReference() : ptr(NULL) { }
324 __Pyx_FakeReference(
const T& ref) : ptr(const_cast<
T*>(&ref)) { }
325 T *operator->() {
return ptr; }
326 T *operator&() {
return ptr; }
327 operator T&() {
return *ptr; }
328 template<
typename U>
bool operator ==(
U other) {
return *ptr == other; }
329 template<
typename U>
bool operator !=(
U other) {
return *ptr != other; }
334 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
335 #define Py_OptimizeFlag 0
337 #define __PYX_BUILD_PY_SSIZE_T "n"
338 #define CYTHON_FORMAT_SSIZE_T "z"
339 #if PY_MAJOR_VERSION < 3
340 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
341 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
342 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
343 #define __Pyx_DefaultClassType PyClass_Type
345 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
346 #define __Pyx_DefaultClassType PyType_Type
347 #if PY_VERSION_HEX >= 0x030B00A1
348 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(
int a,
int k,
int l,
int s,
int f,
349 PyObject *code, PyObject *
c, PyObject*
n, PyObject *
v,
350 PyObject *fv, PyObject *cell, PyObject* fn,
351 PyObject *name,
int fline, PyObject *lnos) {
352 PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
353 PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
354 const char *fn_cstr=NULL;
355 const char *name_cstr=NULL;
356 PyCodeObject* co=NULL;
357 PyObject *type, *value, *traceback;
358 PyErr_Fetch(&type, &value, &traceback);
359 if (!(kwds=PyDict_New()))
goto end;
360 if (!(argcount=PyLong_FromLong(a)))
goto end;
361 if (PyDict_SetItemString(kwds,
"co_argcount", argcount) != 0)
goto end;
362 if (!(posonlyargcount=PyLong_FromLong(0)))
goto end;
363 if (PyDict_SetItemString(kwds,
"co_posonlyargcount", posonlyargcount) != 0)
goto end;
364 if (!(kwonlyargcount=PyLong_FromLong(k)))
goto end;
365 if (PyDict_SetItemString(kwds,
"co_kwonlyargcount", kwonlyargcount) != 0)
goto end;
366 if (!(nlocals=PyLong_FromLong(l)))
goto end;
367 if (PyDict_SetItemString(kwds,
"co_nlocals", nlocals) != 0)
goto end;
368 if (!(stacksize=PyLong_FromLong(
s)))
goto end;
369 if (PyDict_SetItemString(kwds,
"co_stacksize", stacksize) != 0)
goto end;
370 if (!(flags=PyLong_FromLong(
f)))
goto end;
371 if (PyDict_SetItemString(kwds,
"co_flags", flags) != 0)
goto end;
372 if (PyDict_SetItemString(kwds,
"co_code", code) != 0)
goto end;
373 if (PyDict_SetItemString(kwds,
"co_consts",
c) != 0)
goto end;
374 if (PyDict_SetItemString(kwds,
"co_names",
n) != 0)
goto end;
375 if (PyDict_SetItemString(kwds,
"co_varnames",
v) != 0)
goto end;
376 if (PyDict_SetItemString(kwds,
"co_freevars", fv) != 0)
goto end;
377 if (PyDict_SetItemString(kwds,
"co_cellvars", cell) != 0)
goto end;
378 if (PyDict_SetItemString(kwds,
"co_linetable", lnos) != 0)
goto end;
379 if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL)))
goto end;
380 if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL)))
goto end;
381 if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline)))
goto end;
382 if (!(replace = PyObject_GetAttrString((PyObject*)co,
"replace")))
goto cleanup_code_too;
383 if (!(empty = PyTuple_New(0)))
goto cleanup_code_too;
384 if (!(call_result = PyObject_Call(replace, empty, kwds)))
goto cleanup_code_too;
385 Py_XDECREF((PyObject*)co);
386 co = (PyCodeObject*)call_result;
390 Py_XDECREF((PyObject*)co);
395 Py_XDECREF(argcount);
396 Py_XDECREF(posonlyargcount);
397 Py_XDECREF(kwonlyargcount);
399 Py_XDECREF(stacksize);
401 Py_XDECREF(call_result);
404 PyErr_Restore(type, value, traceback);
409 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
410 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
412 #define __Pyx_DefaultClassType PyType_Type
414 #ifndef Py_TPFLAGS_CHECKTYPES
415 #define Py_TPFLAGS_CHECKTYPES 0
417 #ifndef Py_TPFLAGS_HAVE_INDEX
418 #define Py_TPFLAGS_HAVE_INDEX 0
420 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
421 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
423 #ifndef Py_TPFLAGS_HAVE_FINALIZE
424 #define Py_TPFLAGS_HAVE_FINALIZE 0
426 #ifndef METH_STACKLESS
427 #define METH_STACKLESS 0
429 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
430 #ifndef METH_FASTCALL
431 #define METH_FASTCALL 0x80
433 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *
self, PyObject *
const *args, Py_ssize_t nargs);
434 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *
self, PyObject *
const *args,
435 Py_ssize_t nargs, PyObject *kwnames);
437 #define __Pyx_PyCFunctionFast _PyCFunctionFast
438 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
440 #if CYTHON_FAST_PYCCALL
441 #define __Pyx_PyFastCFunction_Check(func)\
442 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
444 #define __Pyx_PyFastCFunction_Check(func) 0
446 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
447 #define PyObject_Malloc(s) PyMem_Malloc(s)
448 #define PyObject_Free(p) PyMem_Free(p)
449 #define PyObject_Realloc(p) PyMem_Realloc(p)
451 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
452 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
453 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
454 #define PyMem_RawFree(p) PyMem_Free(p)
456 #if CYTHON_COMPILING_IN_PYSTON
457 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
458 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
460 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
461 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
463 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
464 #define __Pyx_PyThreadState_Current PyThreadState_GET()
465 #elif PY_VERSION_HEX >= 0x03060000
466 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
467 #elif PY_VERSION_HEX >= 0x03000000
468 #define __Pyx_PyThreadState_Current PyThreadState_GET()
470 #define __Pyx_PyThreadState_Current _PyThreadState_Current
472 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
473 #include "pythread.h"
474 #define Py_tss_NEEDS_INIT 0
475 typedef int Py_tss_t;
476 static CYTHON_INLINE
int PyThread_tss_create(Py_tss_t *key) {
477 *key = PyThread_create_key();
480 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(
void) {
481 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(
sizeof(Py_tss_t));
482 *key = Py_tss_NEEDS_INIT;
485 static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
488 static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
489 return *key != Py_tss_NEEDS_INIT;
491 static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
492 PyThread_delete_key(*key);
493 *key = Py_tss_NEEDS_INIT;
495 static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
496 return PyThread_set_key_value(*key, value);
498 static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
499 return PyThread_get_key_value(*key);
502 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
503 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
505 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
507 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
508 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
509 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
511 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
512 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
514 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
515 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
517 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
519 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
520 #define CYTHON_PEP393_ENABLED 1
521 #if defined(PyUnicode_IS_READY)
522 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
523 0 : _PyUnicode_Ready((PyObject *)(op)))
525 #define __Pyx_PyUnicode_READY(op) (0)
527 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
528 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
529 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
530 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
531 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
532 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
533 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
534 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
535 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
536 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
538 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
541 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
544 #define CYTHON_PEP393_ENABLED 0
545 #define PyUnicode_1BYTE_KIND 1
546 #define PyUnicode_2BYTE_KIND 2
547 #define PyUnicode_4BYTE_KIND 4
548 #define __Pyx_PyUnicode_READY(op) (0)
549 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
550 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
551 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
552 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
553 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
554 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
555 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
556 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
558 #if CYTHON_COMPILING_IN_PYPY
559 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
560 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
562 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
563 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
564 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
566 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
567 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
569 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
570 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
572 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
573 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
575 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
576 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
577 #if PY_MAJOR_VERSION >= 3
578 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
580 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
582 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
583 #define PyObject_ASCII(o) PyObject_Repr(o)
585 #if PY_MAJOR_VERSION >= 3
586 #define PyBaseString_Type PyUnicode_Type
587 #define PyStringObject PyUnicodeObject
588 #define PyString_Type PyUnicode_Type
589 #define PyString_Check PyUnicode_Check
590 #define PyString_CheckExact PyUnicode_CheckExact
591 #ifndef PyObject_Unicode
592 #define PyObject_Unicode PyObject_Str
595 #if PY_MAJOR_VERSION >= 3
596 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
597 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
599 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
600 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
602 #ifndef PySet_CheckExact
603 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
605 #if PY_VERSION_HEX >= 0x030900A4
606 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
607 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
609 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
610 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
612 #if CYTHON_ASSUME_SAFE_MACROS
613 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
615 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
617 #if PY_MAJOR_VERSION >= 3
618 #define PyIntObject PyLongObject
619 #define PyInt_Type PyLong_Type
620 #define PyInt_Check(op) PyLong_Check(op)
621 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
622 #define PyInt_FromString PyLong_FromString
623 #define PyInt_FromUnicode PyLong_FromUnicode
624 #define PyInt_FromLong PyLong_FromLong
625 #define PyInt_FromSize_t PyLong_FromSize_t
626 #define PyInt_FromSsize_t PyLong_FromSsize_t
627 #define PyInt_AsLong PyLong_AsLong
628 #define PyInt_AS_LONG PyLong_AS_LONG
629 #define PyInt_AsSsize_t PyLong_AsSsize_t
630 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
631 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
632 #define PyNumber_Int PyNumber_Long
634 #if PY_MAJOR_VERSION >= 3
635 #define PyBoolObject PyLongObject
637 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
638 #ifndef PyUnicode_InternFromString
639 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
642 #if PY_VERSION_HEX < 0x030200A4
643 typedef long Py_hash_t;
644 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
645 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
647 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
648 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
650 #if PY_MAJOR_VERSION >= 3
651 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
653 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
655 #if CYTHON_USE_ASYNC_SLOTS
656 #if PY_VERSION_HEX >= 0x030500B1
657 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
658 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
660 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
663 #define __Pyx_PyType_AsAsync(obj) NULL
665 #ifndef __Pyx_PyAsyncMethodsStruct
670 } __Pyx_PyAsyncMethodsStruct;
673 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
674 #if !defined(_USE_MATH_DEFINES)
675 #define _USE_MATH_DEFINES
680 #define __PYX_NAN() ((float) NAN)
682 static CYTHON_INLINE
float __PYX_NAN() {
684 memset(&value, 0xFF,
sizeof(value));
688 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
689 #define __Pyx_truncl trunc
691 #define __Pyx_truncl truncl
694 #define __PYX_MARK_ERR_POS(f_index, lineno) \
695 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
696 #define __PYX_ERR(f_index, lineno, Ln_error) \
697 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
699 #ifndef __PYX_EXTERN_C
701 #define __PYX_EXTERN_C extern "C"
703 #define __PYX_EXTERN_C extern
707 #define __PYX_HAVE__cpskRelations
708 #define __PYX_HAVE_API__cpskRelations
712 #include "numpy/arrayobject.h"
713 #include "numpy/ndarrayobject.h"
714 #include "numpy/ndarraytypes.h"
715 #include "numpy/arrayscalars.h"
716 #include "numpy/ufuncobject.h"
725 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
726 #define CYTHON_WITHOUT_ASSERTIONS
729 typedef struct {PyObject **p;
const char *
s;
const Py_ssize_t
n;
const char* encoding;
730 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
732 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
733 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
734 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
735 #define __PYX_DEFAULT_STRING_ENCODING ""
736 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
737 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
738 #define __Pyx_uchar_cast(c) ((unsigned char)c)
739 #define __Pyx_long_cast(x) ((long)x)
740 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
741 (sizeof(type) < sizeof(Py_ssize_t)) ||\
742 (sizeof(type) > sizeof(Py_ssize_t) &&\
743 likely(v < (type)PY_SSIZE_T_MAX ||\
744 v == (type)PY_SSIZE_T_MAX) &&\
745 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
746 v == (type)PY_SSIZE_T_MIN))) ||\
747 (sizeof(type) == sizeof(Py_ssize_t) &&\
748 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
749 v == (type)PY_SSIZE_T_MAX))) )
750 static CYTHON_INLINE
int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
751 return (
size_t) i < (size_t) limit;
753 #if defined (__cplusplus) && __cplusplus >= 201103L
755 #define __Pyx_sst_abs(value) std::abs(value)
756 #elif SIZEOF_INT >= SIZEOF_SIZE_T
757 #define __Pyx_sst_abs(value) abs(value)
758 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
759 #define __Pyx_sst_abs(value) labs(value)
760 #elif defined (_MSC_VER)
761 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
762 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
763 #define __Pyx_sst_abs(value) llabs(value)
764 #elif defined (__GNUC__)
765 #define __Pyx_sst_abs(value) __builtin_llabs(value)
767 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
769 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
770 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
771 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
772 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
773 #define __Pyx_PyBytes_FromString PyBytes_FromString
774 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
775 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
776 #if PY_MAJOR_VERSION < 3
777 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
778 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
780 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
781 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
783 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
784 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
785 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
786 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
787 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
788 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
789 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
790 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
791 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
792 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
793 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
794 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
795 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
796 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
797 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
798 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
799 static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *
u) {
800 const Py_UNICODE *u_end =
u;
802 return (
size_t)(u_end -
u - 1);
804 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
805 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
806 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
807 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
808 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
809 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b);
810 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
811 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
812 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
813 #define __Pyx_PySequence_Tuple(obj)\
814 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
815 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
816 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
817 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
818 #if CYTHON_ASSUME_SAFE_MACROS
819 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
821 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
823 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
824 #if PY_MAJOR_VERSION >= 3
825 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
827 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
829 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
830 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
831 static int __Pyx_sys_getdefaultencoding_not_ascii;
832 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
834 PyObject* default_encoding = NULL;
835 PyObject* ascii_chars_u = NULL;
836 PyObject* ascii_chars_b = NULL;
837 const char* default_encoding_c;
838 sys = PyImport_ImportModule(
"sys");
840 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
842 if (!default_encoding)
goto bad;
843 default_encoding_c = PyBytes_AsString(default_encoding);
844 if (!default_encoding_c)
goto bad;
845 if (strcmp(default_encoding_c,
"ascii") == 0) {
846 __Pyx_sys_getdefaultencoding_not_ascii = 0;
848 char ascii_chars[128];
850 for (
c = 0;
c < 128;
c++) {
853 __Pyx_sys_getdefaultencoding_not_ascii = 1;
854 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
855 if (!ascii_chars_u)
goto bad;
856 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
857 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
860 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
864 Py_DECREF(ascii_chars_u);
865 Py_DECREF(ascii_chars_b);
867 Py_DECREF(default_encoding);
870 Py_XDECREF(default_encoding);
871 Py_XDECREF(ascii_chars_u);
872 Py_XDECREF(ascii_chars_b);
876 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
877 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
879 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
880 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
881 static char* __PYX_DEFAULT_STRING_ENCODING;
882 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
884 PyObject* default_encoding = NULL;
885 char* default_encoding_c;
886 sys = PyImport_ImportModule(
"sys");
888 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
890 if (!default_encoding)
goto bad;
891 default_encoding_c = PyBytes_AsString(default_encoding);
892 if (!default_encoding_c)
goto bad;
893 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c) + 1);
894 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
895 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
896 Py_DECREF(default_encoding);
899 Py_XDECREF(default_encoding);
907 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
908 #define likely(x) __builtin_expect(!!(x), 1)
909 #define unlikely(x) __builtin_expect(!!(x), 0)
911 #define likely(x) (x)
912 #define unlikely(x) (x)
914 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
916 static PyObject *__pyx_m = NULL;
917 static PyObject *__pyx_d;
918 static PyObject *__pyx_b;
919 static PyObject *__pyx_cython_runtime = NULL;
920 static PyObject *__pyx_empty_tuple;
921 static PyObject *__pyx_empty_bytes;
922 static PyObject *__pyx_empty_unicode;
923 static int __pyx_lineno;
924 static int __pyx_clineno = 0;
925 static const char * __pyx_cfilenm= __FILE__;
926 static const char *__pyx_filename;
929 #if !defined(CYTHON_CCOMPLEX)
930 #if defined(__cplusplus)
931 #define CYTHON_CCOMPLEX 1
932 #elif defined(_Complex_I)
933 #define CYTHON_CCOMPLEX 1
935 #define CYTHON_CCOMPLEX 0
945 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
947 #define _Complex_I 1.0fj
951 static const char *__pyx_f[] = {
952 "proteus/cpskRelations.pyx",
964 typedef npy_int8 __pyx_t_5numpy_int8_t;
973 typedef npy_int16 __pyx_t_5numpy_int16_t;
982 typedef npy_int32 __pyx_t_5numpy_int32_t;
991 typedef npy_int64 __pyx_t_5numpy_int64_t;
1000 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1009 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1018 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1027 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1036 typedef npy_float32 __pyx_t_5numpy_float32_t;
1045 typedef npy_float64 __pyx_t_5numpy_float64_t;
1054 typedef npy_long __pyx_t_5numpy_int_t;
1063 typedef npy_longlong __pyx_t_5numpy_long_t;
1072 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1081 typedef npy_ulong __pyx_t_5numpy_uint_t;
1090 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1099 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1108 typedef npy_intp __pyx_t_5numpy_intp_t;
1117 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1126 typedef npy_double __pyx_t_5numpy_float_t;
1135 typedef npy_double __pyx_t_5numpy_double_t;
1144 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1148 typedef ::std::complex< float > __pyx_t_float_complex;
1150 typedef float _Complex __pyx_t_float_complex;
1153 typedef struct {
float real, imag; } __pyx_t_float_complex;
1155 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float,
float);
1160 typedef ::std::complex< double > __pyx_t_double_complex;
1162 typedef double _Complex __pyx_t_double_complex;
1165 typedef struct {
double real, imag; } __pyx_t_double_complex;
1167 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double,
double);
1179 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1188 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1197 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1206 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1210 #ifndef CYTHON_REFNANNY
1211 #define CYTHON_REFNANNY 0
1215 void (*INCREF)(
void*, PyObject*, int);
1216 void (*DECREF)(
void*, PyObject*, int);
1217 void (*GOTREF)(
void*, PyObject*, int);
1218 void (*GIVEREF)(
void*, PyObject*, int);
1219 void* (*SetupContext)(
const char*, int,
const char*);
1220 void (*FinishContext)(
void**);
1221 } __Pyx_RefNannyAPIStruct;
1222 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1223 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
1224 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1226 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1228 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1229 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1230 PyGILState_Release(__pyx_gilstate_save);\
1232 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1235 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1236 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1238 #define __Pyx_RefNannyFinishContext()\
1239 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1240 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1241 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1242 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1243 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1244 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1245 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1246 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1247 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1249 #define __Pyx_RefNannyDeclarations
1250 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1251 #define __Pyx_RefNannyFinishContext()
1252 #define __Pyx_INCREF(r) Py_INCREF(r)
1253 #define __Pyx_DECREF(r) Py_DECREF(r)
1254 #define __Pyx_GOTREF(r)
1255 #define __Pyx_GIVEREF(r)
1256 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1257 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1258 #define __Pyx_XGOTREF(r)
1259 #define __Pyx_XGIVEREF(r)
1261 #define __Pyx_XDECREF_SET(r, v) do {\
1262 PyObject *tmp = (PyObject *) r;\
1263 r = v; __Pyx_XDECREF(tmp);\
1265 #define __Pyx_DECREF_SET(r, v) do {\
1266 PyObject *tmp = (PyObject *) r;\
1267 r = v; __Pyx_DECREF(tmp);\
1269 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1270 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1273 static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
1274 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1277 static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name);
1280 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1281 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1282 const char* function_name);
1285 #if CYTHON_USE_TYPE_SLOTS
1286 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1288 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1292 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1295 #if CYTHON_USE_EXC_INFO_STACK
1296 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1300 #if CYTHON_FAST_THREAD_STATE
1301 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1302 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1303 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1305 #define __Pyx_PyThreadState_declare
1306 #define __Pyx_PyThreadState_assign
1307 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1311 #if CYTHON_FAST_THREAD_STATE
1312 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1313 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1314 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1315 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1317 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1318 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1322 #if CYTHON_FAST_THREAD_STATE
1323 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1324 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1326 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1330 #if CYTHON_FAST_THREAD_STATE
1331 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1332 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1334 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
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 #if CYTHON_FAST_THREAD_STATE
1346 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1347 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1348 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1349 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1350 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1351 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1352 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1353 #if CYTHON_COMPILING_IN_CPYTHON
1354 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1356 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1359 #define __Pyx_PyErr_Clear() PyErr_Clear()
1360 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1361 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1362 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1363 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1364 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1365 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1366 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1370 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1373 #ifndef __PYX_HAVE_RT_ImportType_proto
1374 #define __PYX_HAVE_RT_ImportType_proto
1375 enum __Pyx_ImportType_CheckSize {
1376 __Pyx_ImportType_CheckSize_Error = 0,
1377 __Pyx_ImportType_CheckSize_Warn = 1,
1378 __Pyx_ImportType_CheckSize_Ignore = 2
1380 static PyTypeObject *__Pyx_ImportType(PyObject* module,
const char *module_name,
const char *class_name,
size_t size,
enum __Pyx_ImportType_CheckSize check_size);
1384 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
1387 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1388 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1389 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1390 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1391 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1392 (cache_var) = (value);
1393 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1394 static PY_UINT64_T __pyx_dict_version = 0;\
1395 static PyObject *__pyx_dict_cached_value = NULL;\
1396 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1397 (VAR) = __pyx_dict_cached_value;\
1399 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1400 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1403 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1404 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1405 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1407 #define __PYX_GET_DICT_VERSION(dict) (0)
1408 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1409 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1413 #ifdef CYTHON_CLINE_IN_TRACEBACK
1414 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1416 static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
1421 PyCodeObject* code_object;
1423 } __Pyx_CodeObjectCacheEntry;
1424 struct __Pyx_CodeObjectCache {
1427 __Pyx_CodeObjectCacheEntry* entries;
1429 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1430 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
1431 static PyCodeObject *__pyx_find_code_object(
int code_line);
1432 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
1435 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
1436 int py_line,
const char *filename);
1441 #define __Pyx_CREAL(z) ((z).real())
1442 #define __Pyx_CIMAG(z) ((z).imag())
1444 #define __Pyx_CREAL(z) (__real__(z))
1445 #define __Pyx_CIMAG(z) (__imag__(z))
1448 #define __Pyx_CREAL(z) ((z).real)
1449 #define __Pyx_CIMAG(z) ((z).imag)
1451 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1452 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1453 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1454 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1456 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1457 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1462 #define __Pyx_c_eq_float(a, b) ((a)==(b))
1463 #define __Pyx_c_sum_float(a, b) ((a)+(b))
1464 #define __Pyx_c_diff_float(a, b) ((a)-(b))
1465 #define __Pyx_c_prod_float(a, b) ((a)*(b))
1466 #define __Pyx_c_quot_float(a, b) ((a)/(b))
1467 #define __Pyx_c_neg_float(a) (-(a))
1469 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1470 #define __Pyx_c_conj_float(z) (::std::conj(z))
1472 #define __Pyx_c_abs_float(z) (::std::abs(z))
1473 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1476 #define __Pyx_c_is_zero_float(z) ((z)==0)
1477 #define __Pyx_c_conj_float(z) (conjf(z))
1479 #define __Pyx_c_abs_float(z) (cabsf(z))
1480 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1484 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1485 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1486 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1487 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1488 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1489 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1490 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1491 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1493 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex);
1494 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1500 #define __Pyx_c_eq_double(a, b) ((a)==(b))
1501 #define __Pyx_c_sum_double(a, b) ((a)+(b))
1502 #define __Pyx_c_diff_double(a, b) ((a)-(b))
1503 #define __Pyx_c_prod_double(a, b) ((a)*(b))
1504 #define __Pyx_c_quot_double(a, b) ((a)/(b))
1505 #define __Pyx_c_neg_double(a) (-(a))
1507 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1508 #define __Pyx_c_conj_double(z) (::std::conj(z))
1510 #define __Pyx_c_abs_double(z) (::std::abs(z))
1511 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1514 #define __Pyx_c_is_zero_double(z) ((z)==0)
1515 #define __Pyx_c_conj_double(z) (conj(z))
1517 #define __Pyx_c_abs_double(z) (cabs(z))
1518 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1522 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1523 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1524 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1525 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1526 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1527 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1528 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1529 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1531 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex);
1532 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1537 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1538 #define __Pyx_HAS_GCC_DIAGNOSTIC
1542 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
1545 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
1548 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
1551 #if CYTHON_COMPILING_IN_CPYTHON
1552 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1553 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1554 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1555 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1557 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1558 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1559 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1561 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1564 static int __Pyx_check_binary_version(
void);
1567 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1579 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1592 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1593 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1594 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1595 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1596 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
1597 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
1598 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
1599 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
1600 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
1601 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
1602 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
1603 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
1604 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
1605 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
1606 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1611 #define __Pyx_MODULE_NAME "cpskRelations"
1612 extern int __pyx_module_is_main_cpskRelations;
1613 int __pyx_module_is_main_cpskRelations = 0;
1616 static PyObject *__pyx_builtin_ImportError;
1617 static const char __pyx_k_m[] =
"m";
1618 static const char __pyx_k_Sw[] =
"Sw";
1619 static const char __pyx_k_np[] =
"np";
1620 static const char __pyx_k_psk[] =
"psk";
1621 static const char __pyx_k_main[] =
"__main__";
1622 static const char __pyx_k_name[] =
"__name__";
1623 static const char __pyx_k_psic[] =
"psic";
1624 static const char __pyx_k_test[] =
"__test__";
1625 static const char __pyx_k_alpha[] =
"alpha";
1626 static const char __pyx_k_numpy[] =
"numpy";
1627 static const char __pyx_k_rwork[] =
"rwork";
1628 static const char __pyx_k_import[] =
"__import__";
1629 static const char __pyx_k_ns_del[] =
"ns_del";
1630 static const char __pyx_k_sw_max[] =
"sw_max";
1631 static const char __pyx_k_sw_min[] =
"sw_min";
1632 static const char __pyx_k_eps_small[] =
"eps_small";
1633 static const char __pyx_k_rwork_tol[] =
"rwork_tol";
1634 static const char __pyx_k_ImportError[] =
"ImportError";
1635 static const char __pyx_k_cpskRelations[] =
"cpskRelations";
1636 static const char __pyx_k_vgm_cal_from_sw[] =
"vgm_cal_from_sw";
1637 static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
1638 static const char __pyx_k_vgm_calc_from_psic[] =
"vgm_calc_from_psic";
1639 static const char __pyx_k_proteus_cpskRelations_pyx[] =
"proteus/cpskRelations.pyx";
1640 static const char __pyx_k_numpy_core_multiarray_failed_to[] =
"numpy.core.multiarray failed to import";
1641 static const char __pyx_k_numpy_core_umath_failed_to_impor[] =
"numpy.core.umath failed to import";
1642 static PyObject *__pyx_n_s_ImportError;
1643 static PyObject *__pyx_n_s_Sw;
1644 static PyObject *__pyx_n_s_alpha;
1645 static PyObject *__pyx_n_s_cline_in_traceback;
1646 static PyObject *__pyx_n_s_cpskRelations;
1647 static PyObject *__pyx_n_s_eps_small;
1648 static PyObject *__pyx_n_s_import;
1649 static PyObject *__pyx_n_s_m;
1650 static PyObject *__pyx_n_s_main;
1651 static PyObject *__pyx_n_s_name;
1652 static PyObject *__pyx_n_s_np;
1653 static PyObject *__pyx_n_s_ns_del;
1654 static PyObject *__pyx_n_s_numpy;
1655 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1656 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1657 static PyObject *__pyx_kp_s_proteus_cpskRelations_pyx;
1658 static PyObject *__pyx_n_s_psic;
1659 static PyObject *__pyx_n_s_psk;
1660 static PyObject *__pyx_n_s_rwork;
1661 static PyObject *__pyx_n_s_rwork_tol;
1662 static PyObject *__pyx_n_s_sw_max;
1663 static PyObject *__pyx_n_s_sw_min;
1664 static PyObject *__pyx_n_s_test;
1665 static PyObject *__pyx_n_s_vgm_cal_from_sw;
1666 static PyObject *__pyx_n_s_vgm_calc_from_psic;
1667 static PyObject *__pyx_pf_13cpskRelations_vgm_cal_from_sw(CYTHON_UNUSED PyObject *__pyx_self,
double __pyx_v_Sw,
double __pyx_v_sw_min,
double __pyx_v_sw_max,
double __pyx_v_alpha,
double __pyx_v_m,
double __pyx_v_eps_small,
double __pyx_v_ns_del);
1668 static PyObject *__pyx_pf_13cpskRelations_2vgm_calc_from_psic(CYTHON_UNUSED PyObject *__pyx_self,
double __pyx_v_psic,
double __pyx_v_sw_min,
double __pyx_v_sw_max,
double __pyx_v_alpha,
double __pyx_v_m,
double __pyx_v_eps_small,
double __pyx_v_ns_del);
1669 static PyObject *__pyx_tuple_;
1670 static PyObject *__pyx_tuple__2;
1671 static PyObject *__pyx_tuple__3;
1672 static PyObject *__pyx_tuple__5;
1673 static PyObject *__pyx_codeobj__4;
1674 static PyObject *__pyx_codeobj__6;
1686 static PyObject *__pyx_pw_13cpskRelations_1vgm_cal_from_sw(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
1687 static PyMethodDef __pyx_mdef_13cpskRelations_1vgm_cal_from_sw = {
"vgm_cal_from_sw", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_13cpskRelations_1vgm_cal_from_sw, METH_VARARGS|METH_KEYWORDS, 0};
1688 static PyObject *__pyx_pw_13cpskRelations_1vgm_cal_from_sw(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1690 double __pyx_v_sw_min;
1691 double __pyx_v_sw_max;
1692 double __pyx_v_alpha;
1694 double __pyx_v_eps_small;
1695 double __pyx_v_ns_del;
1696 int __pyx_lineno = 0;
1697 const char *__pyx_filename = NULL;
1698 int __pyx_clineno = 0;
1699 PyObject *__pyx_r = 0;
1700 __Pyx_RefNannyDeclarations
1701 __Pyx_RefNannySetupContext(
"vgm_cal_from_sw (wrapper)", 0);
1703 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Sw,&__pyx_n_s_sw_min,&__pyx_n_s_sw_max,&__pyx_n_s_alpha,&__pyx_n_s_m,&__pyx_n_s_eps_small,&__pyx_n_s_ns_del,0};
1704 PyObject* values[7] = {0,0,0,0,0,0,0};
1705 if (unlikely(__pyx_kwds)) {
1707 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1709 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
1711 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
1713 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1715 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1717 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1719 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1721 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1724 default:
goto __pyx_L5_argtuple_error;
1726 kw_args = PyDict_Size(__pyx_kwds);
1729 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Sw)) != 0)) kw_args--;
1730 else goto __pyx_L5_argtuple_error;
1733 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sw_min)) != 0)) kw_args--;
1735 __Pyx_RaiseArgtupleInvalid(
"vgm_cal_from_sw", 1, 7, 7, 1); __PYX_ERR(0, 6, __pyx_L3_error)
1739 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sw_max)) != 0)) kw_args--;
1741 __Pyx_RaiseArgtupleInvalid(
"vgm_cal_from_sw", 1, 7, 7, 2); __PYX_ERR(0, 6, __pyx_L3_error)
1745 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
1747 __Pyx_RaiseArgtupleInvalid(
"vgm_cal_from_sw", 1, 7, 7, 3); __PYX_ERR(0, 6, __pyx_L3_error)
1751 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
1753 __Pyx_RaiseArgtupleInvalid(
"vgm_cal_from_sw", 1, 7, 7, 4); __PYX_ERR(0, 6, __pyx_L3_error)
1757 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps_small)) != 0)) kw_args--;
1759 __Pyx_RaiseArgtupleInvalid(
"vgm_cal_from_sw", 1, 7, 7, 5); __PYX_ERR(0, 6, __pyx_L3_error)
1763 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_del)) != 0)) kw_args--;
1765 __Pyx_RaiseArgtupleInvalid(
"vgm_cal_from_sw", 1, 7, 7, 6); __PYX_ERR(0, 6, __pyx_L3_error)
1768 if (unlikely(kw_args > 0)) {
1769 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"vgm_cal_from_sw") < 0)) __PYX_ERR(0, 6, __pyx_L3_error)
1771 }
else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
1772 goto __pyx_L5_argtuple_error;
1774 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1775 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1776 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1777 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1778 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1779 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
1780 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
1782 __pyx_v_Sw = __pyx_PyFloat_AsDouble(values[0]);
if (unlikely((__pyx_v_Sw == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 6, __pyx_L3_error)
1783 __pyx_v_sw_min = __pyx_PyFloat_AsDouble(values[1]);
if (unlikely((__pyx_v_sw_min == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 7, __pyx_L3_error)
1784 __pyx_v_sw_max = __pyx_PyFloat_AsDouble(values[2]);
if (unlikely((__pyx_v_sw_max == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 8, __pyx_L3_error)
1785 __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[3]);
if (unlikely((__pyx_v_alpha == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 9, __pyx_L3_error)
1786 __pyx_v_m = __pyx_PyFloat_AsDouble(values[4]);
if (unlikely((__pyx_v_m == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L3_error)
1787 __pyx_v_eps_small = __pyx_PyFloat_AsDouble(values[5]);
if (unlikely((__pyx_v_eps_small == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 11, __pyx_L3_error)
1788 __pyx_v_ns_del = __pyx_PyFloat_AsDouble(values[6]);
if (unlikely((__pyx_v_ns_del == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error)
1790 goto __pyx_L4_argument_unpacking_done;
1791 __pyx_L5_argtuple_error:;
1792 __Pyx_RaiseArgtupleInvalid(
"vgm_cal_from_sw", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 6, __pyx_L3_error)
1794 __Pyx_AddTraceback(
"cpskRelations.vgm_cal_from_sw", __pyx_clineno, __pyx_lineno, __pyx_filename);
1795 __Pyx_RefNannyFinishContext();
1797 __pyx_L4_argument_unpacking_done:;
1798 __pyx_r = __pyx_pf_13cpskRelations_vgm_cal_from_sw(__pyx_self, __pyx_v_Sw, __pyx_v_sw_min, __pyx_v_sw_max, __pyx_v_alpha, __pyx_v_m, __pyx_v_eps_small, __pyx_v_ns_del);
1801 __Pyx_RefNannyFinishContext();
1805 static PyObject *__pyx_pf_13cpskRelations_vgm_cal_from_sw(CYTHON_UNUSED PyObject *__pyx_self,
double __pyx_v_Sw,
double __pyx_v_sw_min,
double __pyx_v_sw_max,
double __pyx_v_alpha,
double __pyx_v_m,
double __pyx_v_eps_small,
double __pyx_v_ns_del) {
1806 double __pyx_v_rwork[4];
1807 double __pyx_v_rwork_tol[2];
1809 PyObject *__pyx_r = NULL;
1810 __Pyx_RefNannyDeclarations
1811 PyObject *__pyx_t_1 = NULL;
1812 PyObject *__pyx_t_2 = NULL;
1813 PyObject *__pyx_t_3 = NULL;
1814 PyObject *__pyx_t_4 = NULL;
1815 PyObject *__pyx_t_5 = NULL;
1816 PyObject *__pyx_t_6 = NULL;
1817 PyObject *__pyx_t_7 = NULL;
1818 int __pyx_lineno = 0;
1819 const char *__pyx_filename = NULL;
1820 int __pyx_clineno = 0;
1821 __Pyx_RefNannySetupContext(
"vgm_cal_from_sw", 0);
1830 (__pyx_v_rwork[0]) = __pyx_v_sw_min;
1839 (__pyx_v_rwork[1]) = __pyx_v_sw_max;
1848 (__pyx_v_rwork[2]) = __pyx_v_alpha;
1857 (__pyx_v_rwork[3]) = __pyx_v_m;
1866 (__pyx_v_rwork_tol[0]) = __pyx_v_eps_small;
1875 (__pyx_v_rwork_tol[1]) = __pyx_v_ns_del;
1884 __pyx_v_psk =
VGM(__pyx_v_rwork);
1902 __pyx_v_psk.
calc(__pyx_v_Sw);
1911 __Pyx_XDECREF(__pyx_r);
1912 __pyx_t_1 = PyFloat_FromDouble(__pyx_v_psk.
psic);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
1913 __Pyx_GOTREF(__pyx_t_1);
1914 __pyx_t_2 = PyFloat_FromDouble(__pyx_v_psk.
krw);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
1915 __Pyx_GOTREF(__pyx_t_2);
1916 __pyx_t_3 = PyFloat_FromDouble(__pyx_v_psk.
krn);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error)
1917 __Pyx_GOTREF(__pyx_t_3);
1918 __pyx_t_4 = PyFloat_FromDouble(__pyx_v_psk.
dpsic);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error)
1919 __Pyx_GOTREF(__pyx_t_4);
1920 __pyx_t_5 = PyFloat_FromDouble(__pyx_v_psk.
dkrw);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error)
1921 __Pyx_GOTREF(__pyx_t_5);
1922 __pyx_t_6 = PyFloat_FromDouble(__pyx_v_psk.
dkrn);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
1923 __Pyx_GOTREF(__pyx_t_6);
1924 __pyx_t_7 = PyTuple_New(6);
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 23, __pyx_L1_error)
1925 __Pyx_GOTREF(__pyx_t_7);
1926 __Pyx_GIVEREF(__pyx_t_1);
1927 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
1928 __Pyx_GIVEREF(__pyx_t_2);
1929 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
1930 __Pyx_GIVEREF(__pyx_t_3);
1931 PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
1932 __Pyx_GIVEREF(__pyx_t_4);
1933 PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_4);
1934 __Pyx_GIVEREF(__pyx_t_5);
1935 PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_5);
1936 __Pyx_GIVEREF(__pyx_t_6);
1937 PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_6);
1944 __pyx_r = __pyx_t_7;
1958 __Pyx_XDECREF(__pyx_t_1);
1959 __Pyx_XDECREF(__pyx_t_2);
1960 __Pyx_XDECREF(__pyx_t_3);
1961 __Pyx_XDECREF(__pyx_t_4);
1962 __Pyx_XDECREF(__pyx_t_5);
1963 __Pyx_XDECREF(__pyx_t_6);
1964 __Pyx_XDECREF(__pyx_t_7);
1965 __Pyx_AddTraceback(
"cpskRelations.vgm_cal_from_sw", __pyx_clineno, __pyx_lineno, __pyx_filename);
1968 __Pyx_XGIVEREF(__pyx_r);
1969 __Pyx_RefNannyFinishContext();
1982 static PyObject *__pyx_pw_13cpskRelations_3vgm_calc_from_psic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
1983 static PyMethodDef __pyx_mdef_13cpskRelations_3vgm_calc_from_psic = {
"vgm_calc_from_psic", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_13cpskRelations_3vgm_calc_from_psic, METH_VARARGS|METH_KEYWORDS, 0};
1984 static PyObject *__pyx_pw_13cpskRelations_3vgm_calc_from_psic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1985 double __pyx_v_psic;
1986 double __pyx_v_sw_min;
1987 double __pyx_v_sw_max;
1988 double __pyx_v_alpha;
1990 double __pyx_v_eps_small;
1991 double __pyx_v_ns_del;
1992 int __pyx_lineno = 0;
1993 const char *__pyx_filename = NULL;
1994 int __pyx_clineno = 0;
1995 PyObject *__pyx_r = 0;
1996 __Pyx_RefNannyDeclarations
1997 __Pyx_RefNannySetupContext(
"vgm_calc_from_psic (wrapper)", 0);
1999 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_psic,&__pyx_n_s_sw_min,&__pyx_n_s_sw_max,&__pyx_n_s_alpha,&__pyx_n_s_m,&__pyx_n_s_eps_small,&__pyx_n_s_ns_del,0};
2000 PyObject* values[7] = {0,0,0,0,0,0,0};
2001 if (unlikely(__pyx_kwds)) {
2003 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2005 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2007 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2009 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2011 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2013 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2015 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2017 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2020 default:
goto __pyx_L5_argtuple_error;
2022 kw_args = PyDict_Size(__pyx_kwds);
2025 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_psic)) != 0)) kw_args--;
2026 else goto __pyx_L5_argtuple_error;
2029 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sw_min)) != 0)) kw_args--;
2031 __Pyx_RaiseArgtupleInvalid(
"vgm_calc_from_psic", 1, 7, 7, 1); __PYX_ERR(0, 25, __pyx_L3_error)
2035 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sw_max)) != 0)) kw_args--;
2037 __Pyx_RaiseArgtupleInvalid(
"vgm_calc_from_psic", 1, 7, 7, 2); __PYX_ERR(0, 25, __pyx_L3_error)
2041 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
2043 __Pyx_RaiseArgtupleInvalid(
"vgm_calc_from_psic", 1, 7, 7, 3); __PYX_ERR(0, 25, __pyx_L3_error)
2047 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
2049 __Pyx_RaiseArgtupleInvalid(
"vgm_calc_from_psic", 1, 7, 7, 4); __PYX_ERR(0, 25, __pyx_L3_error)
2053 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps_small)) != 0)) kw_args--;
2055 __Pyx_RaiseArgtupleInvalid(
"vgm_calc_from_psic", 1, 7, 7, 5); __PYX_ERR(0, 25, __pyx_L3_error)
2059 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ns_del)) != 0)) kw_args--;
2061 __Pyx_RaiseArgtupleInvalid(
"vgm_calc_from_psic", 1, 7, 7, 6); __PYX_ERR(0, 25, __pyx_L3_error)
2064 if (unlikely(kw_args > 0)) {
2065 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"vgm_calc_from_psic") < 0)) __PYX_ERR(0, 25, __pyx_L3_error)
2067 }
else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
2068 goto __pyx_L5_argtuple_error;
2070 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2071 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2072 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2073 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2074 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2075 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2076 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2078 __pyx_v_psic = __pyx_PyFloat_AsDouble(values[0]);
if (unlikely((__pyx_v_psic == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error)
2079 __pyx_v_sw_min = __pyx_PyFloat_AsDouble(values[1]);
if (unlikely((__pyx_v_sw_min == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L3_error)
2080 __pyx_v_sw_max = __pyx_PyFloat_AsDouble(values[2]);
if (unlikely((__pyx_v_sw_max == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 27, __pyx_L3_error)
2081 __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[3]);
if (unlikely((__pyx_v_alpha == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 28, __pyx_L3_error)
2082 __pyx_v_m = __pyx_PyFloat_AsDouble(values[4]);
if (unlikely((__pyx_v_m == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error)
2083 __pyx_v_eps_small = __pyx_PyFloat_AsDouble(values[5]);
if (unlikely((__pyx_v_eps_small == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 30, __pyx_L3_error)
2084 __pyx_v_ns_del = __pyx_PyFloat_AsDouble(values[6]);
if (unlikely((__pyx_v_ns_del == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 31, __pyx_L3_error)
2086 goto __pyx_L4_argument_unpacking_done;
2087 __pyx_L5_argtuple_error:;
2088 __Pyx_RaiseArgtupleInvalid(
"vgm_calc_from_psic", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 25, __pyx_L3_error)
2090 __Pyx_AddTraceback(
"cpskRelations.vgm_calc_from_psic", __pyx_clineno, __pyx_lineno, __pyx_filename);
2091 __Pyx_RefNannyFinishContext();
2093 __pyx_L4_argument_unpacking_done:;
2094 __pyx_r = __pyx_pf_13cpskRelations_2vgm_calc_from_psic(__pyx_self, __pyx_v_psic, __pyx_v_sw_min, __pyx_v_sw_max, __pyx_v_alpha, __pyx_v_m, __pyx_v_eps_small, __pyx_v_ns_del);
2097 __Pyx_RefNannyFinishContext();
2101 static PyObject *__pyx_pf_13cpskRelations_2vgm_calc_from_psic(CYTHON_UNUSED PyObject *__pyx_self,
double __pyx_v_psic,
double __pyx_v_sw_min,
double __pyx_v_sw_max,
double __pyx_v_alpha,
double __pyx_v_m,
double __pyx_v_eps_small,
double __pyx_v_ns_del) {
2102 double __pyx_v_rwork[4];
2103 double __pyx_v_rwork_tol[2];
2105 PyObject *__pyx_r = NULL;
2106 __Pyx_RefNannyDeclarations
2107 PyObject *__pyx_t_1 = NULL;
2108 PyObject *__pyx_t_2 = NULL;
2109 PyObject *__pyx_t_3 = NULL;
2110 PyObject *__pyx_t_4 = NULL;
2111 PyObject *__pyx_t_5 = NULL;
2112 PyObject *__pyx_t_6 = NULL;
2113 PyObject *__pyx_t_7 = NULL;
2114 int __pyx_lineno = 0;
2115 const char *__pyx_filename = NULL;
2116 int __pyx_clineno = 0;
2117 __Pyx_RefNannySetupContext(
"vgm_calc_from_psic", 0);
2126 (__pyx_v_rwork[0]) = __pyx_v_sw_min;
2135 (__pyx_v_rwork[1]) = __pyx_v_sw_max;
2144 (__pyx_v_rwork[2]) = __pyx_v_alpha;
2153 (__pyx_v_rwork[3]) = __pyx_v_m;
2162 (__pyx_v_rwork_tol[0]) = __pyx_v_eps_small;
2171 (__pyx_v_rwork_tol[1]) = __pyx_v_ns_del;
2180 __pyx_v_psk =
VGM(__pyx_v_rwork);
2204 __Pyx_XDECREF(__pyx_r);
2205 __pyx_t_1 = PyFloat_FromDouble(__pyx_v_psk.
Se);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
2206 __Pyx_GOTREF(__pyx_t_1);
2207 __pyx_t_2 = PyFloat_FromDouble(__pyx_v_psk.
krw);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
2208 __Pyx_GOTREF(__pyx_t_2);
2209 __pyx_t_3 = PyFloat_FromDouble(__pyx_v_psk.
krn);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
2210 __Pyx_GOTREF(__pyx_t_3);
2211 __pyx_t_4 = PyFloat_FromDouble(__pyx_v_psk.
dSe_dpsic);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
2212 __Pyx_GOTREF(__pyx_t_4);
2213 __pyx_t_5 = PyFloat_FromDouble(__pyx_v_psk.
dkrw);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error)
2214 __Pyx_GOTREF(__pyx_t_5);
2215 __pyx_t_6 = PyFloat_FromDouble(__pyx_v_psk.
dkrn);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error)
2216 __Pyx_GOTREF(__pyx_t_6);
2217 __pyx_t_7 = PyTuple_New(6);
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 42, __pyx_L1_error)
2218 __Pyx_GOTREF(__pyx_t_7);
2219 __Pyx_GIVEREF(__pyx_t_1);
2220 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
2221 __Pyx_GIVEREF(__pyx_t_2);
2222 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
2223 __Pyx_GIVEREF(__pyx_t_3);
2224 PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
2225 __Pyx_GIVEREF(__pyx_t_4);
2226 PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_4);
2227 __Pyx_GIVEREF(__pyx_t_5);
2228 PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_5);
2229 __Pyx_GIVEREF(__pyx_t_6);
2230 PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_6);
2237 __pyx_r = __pyx_t_7;
2251 __Pyx_XDECREF(__pyx_t_1);
2252 __Pyx_XDECREF(__pyx_t_2);
2253 __Pyx_XDECREF(__pyx_t_3);
2254 __Pyx_XDECREF(__pyx_t_4);
2255 __Pyx_XDECREF(__pyx_t_5);
2256 __Pyx_XDECREF(__pyx_t_6);
2257 __Pyx_XDECREF(__pyx_t_7);
2258 __Pyx_AddTraceback(
"cpskRelations.vgm_calc_from_psic", __pyx_clineno, __pyx_lineno, __pyx_filename);
2261 __Pyx_XGIVEREF(__pyx_r);
2262 __Pyx_RefNannyFinishContext();
2274 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
2275 PyObject *__pyx_r = NULL;
2276 __Pyx_RefNannyDeclarations
2277 PyObject *__pyx_t_1 = NULL;
2278 int __pyx_lineno = 0;
2279 const char *__pyx_filename = NULL;
2280 int __pyx_clineno = 0;
2281 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew1", 0);
2290 __Pyx_XDECREF(__pyx_r);
2291 __pyx_t_1 = PyArray_MultiIterNew(1, ((
void *)__pyx_v_a));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
2292 __Pyx_GOTREF(__pyx_t_1);
2293 __pyx_r = __pyx_t_1;
2307 __Pyx_XDECREF(__pyx_t_1);
2308 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
2311 __Pyx_XGIVEREF(__pyx_r);
2312 __Pyx_RefNannyFinishContext();
2324 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
2325 PyObject *__pyx_r = NULL;
2326 __Pyx_RefNannyDeclarations
2327 PyObject *__pyx_t_1 = NULL;
2328 int __pyx_lineno = 0;
2329 const char *__pyx_filename = NULL;
2330 int __pyx_clineno = 0;
2331 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew2", 0);
2340 __Pyx_XDECREF(__pyx_r);
2341 __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)
2342 __Pyx_GOTREF(__pyx_t_1);
2343 __pyx_r = __pyx_t_1;
2357 __Pyx_XDECREF(__pyx_t_1);
2358 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
2361 __Pyx_XGIVEREF(__pyx_r);
2362 __Pyx_RefNannyFinishContext();
2374 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
2375 PyObject *__pyx_r = NULL;
2376 __Pyx_RefNannyDeclarations
2377 PyObject *__pyx_t_1 = NULL;
2378 int __pyx_lineno = 0;
2379 const char *__pyx_filename = NULL;
2380 int __pyx_clineno = 0;
2381 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew3", 0);
2390 __Pyx_XDECREF(__pyx_r);
2391 __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)
2392 __Pyx_GOTREF(__pyx_t_1);
2393 __pyx_r = __pyx_t_1;
2407 __Pyx_XDECREF(__pyx_t_1);
2408 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
2411 __Pyx_XGIVEREF(__pyx_r);
2412 __Pyx_RefNannyFinishContext();
2424 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) {
2425 PyObject *__pyx_r = NULL;
2426 __Pyx_RefNannyDeclarations
2427 PyObject *__pyx_t_1 = NULL;
2428 int __pyx_lineno = 0;
2429 const char *__pyx_filename = NULL;
2430 int __pyx_clineno = 0;
2431 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew4", 0);
2440 __Pyx_XDECREF(__pyx_r);
2441 __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)
2442 __Pyx_GOTREF(__pyx_t_1);
2443 __pyx_r = __pyx_t_1;
2457 __Pyx_XDECREF(__pyx_t_1);
2458 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
2461 __Pyx_XGIVEREF(__pyx_r);
2462 __Pyx_RefNannyFinishContext();
2474 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) {
2475 PyObject *__pyx_r = NULL;
2476 __Pyx_RefNannyDeclarations
2477 PyObject *__pyx_t_1 = NULL;
2478 int __pyx_lineno = 0;
2479 const char *__pyx_filename = NULL;
2480 int __pyx_clineno = 0;
2481 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew5", 0);
2490 __Pyx_XDECREF(__pyx_r);
2491 __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)
2492 __Pyx_GOTREF(__pyx_t_1);
2493 __pyx_r = __pyx_t_1;
2507 __Pyx_XDECREF(__pyx_t_1);
2508 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
2511 __Pyx_XGIVEREF(__pyx_r);
2512 __Pyx_RefNannyFinishContext();
2524 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
2525 PyObject *__pyx_r = NULL;
2526 __Pyx_RefNannyDeclarations
2528 __Pyx_RefNannySetupContext(
"PyDataType_SHAPE", 0);
2537 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
2547 __Pyx_XDECREF(__pyx_r);
2548 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
2549 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
2569 __Pyx_XDECREF(__pyx_r);
2570 __Pyx_INCREF(__pyx_empty_tuple);
2571 __pyx_r = __pyx_empty_tuple;
2585 __Pyx_XGIVEREF(__pyx_r);
2586 __Pyx_RefNannyFinishContext();
2598 static CYTHON_INLINE
void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
2599 __Pyx_RefNannyDeclarations
2600 __Pyx_RefNannySetupContext(
"set_array_base", 0);
2609 Py_INCREF(__pyx_v_base);
2618 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
2629 __Pyx_RefNannyFinishContext();
2640 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
2641 PyObject *__pyx_v_base;
2642 PyObject *__pyx_r = NULL;
2643 __Pyx_RefNannyDeclarations
2645 __Pyx_RefNannySetupContext(
"get_array_base", 0);
2654 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
2663 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
2673 __Pyx_XDECREF(__pyx_r);
2674 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2693 __Pyx_XDECREF(__pyx_r);
2694 __Pyx_INCREF(((PyObject *)__pyx_v_base));
2695 __pyx_r = ((PyObject *)__pyx_v_base);
2708 __Pyx_XGIVEREF(__pyx_r);
2709 __Pyx_RefNannyFinishContext();
2721 static CYTHON_INLINE
int __pyx_f_5numpy_import_array(
void) {
2723 __Pyx_RefNannyDeclarations
2724 PyObject *__pyx_t_1 = NULL;
2725 PyObject *__pyx_t_2 = NULL;
2726 PyObject *__pyx_t_3 = NULL;
2728 PyObject *__pyx_t_5 = NULL;
2729 PyObject *__pyx_t_6 = NULL;
2730 PyObject *__pyx_t_7 = NULL;
2731 PyObject *__pyx_t_8 = NULL;
2732 int __pyx_lineno = 0;
2733 const char *__pyx_filename = NULL;
2734 int __pyx_clineno = 0;
2735 __Pyx_RefNannySetupContext(
"import_array", 0);
2745 __Pyx_PyThreadState_declare
2746 __Pyx_PyThreadState_assign
2747 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
2748 __Pyx_XGOTREF(__pyx_t_1);
2749 __Pyx_XGOTREF(__pyx_t_2);
2750 __Pyx_XGOTREF(__pyx_t_3);
2760 __pyx_t_4 = _import_array();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
2770 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2771 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2772 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2773 goto __pyx_L8_try_end;
2783 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
2785 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
2786 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error)
2787 __Pyx_GOTREF(__pyx_t_5);
2788 __Pyx_GOTREF(__pyx_t_6);
2789 __Pyx_GOTREF(__pyx_t_7);
2798 __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)
2799 __Pyx_GOTREF(__pyx_t_8);
2800 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
2801 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2802 __PYX_ERR(1, 945, __pyx_L5_except_error)
2804 goto __pyx_L5_except_error;
2805 __pyx_L5_except_error:;
2814 __Pyx_XGIVEREF(__pyx_t_1);
2815 __Pyx_XGIVEREF(__pyx_t_2);
2816 __Pyx_XGIVEREF(__pyx_t_3);
2817 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
2818 goto __pyx_L1_error;
2834 __Pyx_XDECREF(__pyx_t_5);
2835 __Pyx_XDECREF(__pyx_t_6);
2836 __Pyx_XDECREF(__pyx_t_7);
2837 __Pyx_XDECREF(__pyx_t_8);
2838 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
2841 __Pyx_RefNannyFinishContext();
2853 static CYTHON_INLINE
int __pyx_f_5numpy_import_umath(
void) {
2855 __Pyx_RefNannyDeclarations
2856 PyObject *__pyx_t_1 = NULL;
2857 PyObject *__pyx_t_2 = NULL;
2858 PyObject *__pyx_t_3 = NULL;
2860 PyObject *__pyx_t_5 = NULL;
2861 PyObject *__pyx_t_6 = NULL;
2862 PyObject *__pyx_t_7 = NULL;
2863 PyObject *__pyx_t_8 = NULL;
2864 int __pyx_lineno = 0;
2865 const char *__pyx_filename = NULL;
2866 int __pyx_clineno = 0;
2867 __Pyx_RefNannySetupContext(
"import_umath", 0);
2877 __Pyx_PyThreadState_declare
2878 __Pyx_PyThreadState_assign
2879 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
2880 __Pyx_XGOTREF(__pyx_t_1);
2881 __Pyx_XGOTREF(__pyx_t_2);
2882 __Pyx_XGOTREF(__pyx_t_3);
2892 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
2902 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2903 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2904 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2905 goto __pyx_L8_try_end;
2915 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
2917 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
2918 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error)
2919 __Pyx_GOTREF(__pyx_t_5);
2920 __Pyx_GOTREF(__pyx_t_6);
2921 __Pyx_GOTREF(__pyx_t_7);
2930 __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)
2931 __Pyx_GOTREF(__pyx_t_8);
2932 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
2933 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2934 __PYX_ERR(1, 951, __pyx_L5_except_error)
2936 goto __pyx_L5_except_error;
2937 __pyx_L5_except_error:;
2946 __Pyx_XGIVEREF(__pyx_t_1);
2947 __Pyx_XGIVEREF(__pyx_t_2);
2948 __Pyx_XGIVEREF(__pyx_t_3);
2949 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
2950 goto __pyx_L1_error;
2966 __Pyx_XDECREF(__pyx_t_5);
2967 __Pyx_XDECREF(__pyx_t_6);
2968 __Pyx_XDECREF(__pyx_t_7);
2969 __Pyx_XDECREF(__pyx_t_8);
2970 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
2973 __Pyx_RefNannyFinishContext();
2985 static CYTHON_INLINE
int __pyx_f_5numpy_import_ufunc(
void) {
2987 __Pyx_RefNannyDeclarations
2988 PyObject *__pyx_t_1 = NULL;
2989 PyObject *__pyx_t_2 = NULL;
2990 PyObject *__pyx_t_3 = NULL;
2992 PyObject *__pyx_t_5 = NULL;
2993 PyObject *__pyx_t_6 = NULL;
2994 PyObject *__pyx_t_7 = NULL;
2995 PyObject *__pyx_t_8 = NULL;
2996 int __pyx_lineno = 0;
2997 const char *__pyx_filename = NULL;
2998 int __pyx_clineno = 0;
2999 __Pyx_RefNannySetupContext(
"import_ufunc", 0);
3009 __Pyx_PyThreadState_declare
3010 __Pyx_PyThreadState_assign
3011 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
3012 __Pyx_XGOTREF(__pyx_t_1);
3013 __Pyx_XGOTREF(__pyx_t_2);
3014 __Pyx_XGOTREF(__pyx_t_3);
3024 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
3034 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3035 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3036 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3037 goto __pyx_L8_try_end;
3047 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
3049 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
3050 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error)
3051 __Pyx_GOTREF(__pyx_t_5);
3052 __Pyx_GOTREF(__pyx_t_6);
3053 __Pyx_GOTREF(__pyx_t_7);
3062 __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)
3063 __Pyx_GOTREF(__pyx_t_8);
3064 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
3065 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3066 __PYX_ERR(1, 957, __pyx_L5_except_error)
3068 goto __pyx_L5_except_error;
3069 __pyx_L5_except_error:;
3078 __Pyx_XGIVEREF(__pyx_t_1);
3079 __Pyx_XGIVEREF(__pyx_t_2);
3080 __Pyx_XGIVEREF(__pyx_t_3);
3081 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3082 goto __pyx_L1_error;
3098 __Pyx_XDECREF(__pyx_t_5);
3099 __Pyx_XDECREF(__pyx_t_6);
3100 __Pyx_XDECREF(__pyx_t_7);
3101 __Pyx_XDECREF(__pyx_t_8);
3102 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
3105 __Pyx_RefNannyFinishContext();
3117 static CYTHON_INLINE
int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
3119 __Pyx_RefNannyDeclarations
3120 __Pyx_RefNannySetupContext(
"is_timedelta64_object", 0);
3129 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
3142 __Pyx_RefNannyFinishContext();
3154 static CYTHON_INLINE
int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
3156 __Pyx_RefNannyDeclarations
3157 __Pyx_RefNannySetupContext(
"is_datetime64_object", 0);
3166 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
3179 __Pyx_RefNannyFinishContext();
3191 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
3192 npy_datetime __pyx_r;
3201 __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
3225 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
3226 npy_timedelta __pyx_r;
3235 __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
3259 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
3260 NPY_DATETIMEUNIT __pyx_r;
3267 __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
3283 static PyMethodDef __pyx_methods[] = {
3287 #if PY_MAJOR_VERSION >= 3
3288 #if CYTHON_PEP489_MULTI_PHASE_INIT
3289 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
3290 static int __pyx_pymod_exec_cpskRelations(PyObject* module);
3291 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
3292 {Py_mod_create, (
void*)__pyx_pymod_create},
3293 {Py_mod_exec, (
void*)__pyx_pymod_exec_cpskRelations},
3298 static struct PyModuleDef __pyx_moduledef = {
3299 PyModuleDef_HEAD_INIT,
3302 #if CYTHON_PEP489_MULTI_PHASE_INIT
3308 #if CYTHON_PEP489_MULTI_PHASE_INIT
3309 __pyx_moduledef_slots,
3318 #ifndef CYTHON_SMALL_CODE
3319 #if defined(__clang__)
3320 #define CYTHON_SMALL_CODE
3321 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
3322 #define CYTHON_SMALL_CODE __attribute__((cold))
3324 #define CYTHON_SMALL_CODE
3328 static __Pyx_StringTabEntry __pyx_string_tab[] = {
3329 {&__pyx_n_s_ImportError, __pyx_k_ImportError,
sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
3330 {&__pyx_n_s_Sw, __pyx_k_Sw,
sizeof(__pyx_k_Sw), 0, 0, 1, 1},
3331 {&__pyx_n_s_alpha, __pyx_k_alpha,
sizeof(__pyx_k_alpha), 0, 0, 1, 1},
3332 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
3333 {&__pyx_n_s_cpskRelations, __pyx_k_cpskRelations,
sizeof(__pyx_k_cpskRelations), 0, 0, 1, 1},
3334 {&__pyx_n_s_eps_small, __pyx_k_eps_small,
sizeof(__pyx_k_eps_small), 0, 0, 1, 1},
3335 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
3336 {&__pyx_n_s_m, __pyx_k_m,
sizeof(__pyx_k_m), 0, 0, 1, 1},
3337 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
3338 {&__pyx_n_s_name, __pyx_k_name,
sizeof(__pyx_k_name), 0, 0, 1, 1},
3339 {&__pyx_n_s_np, __pyx_k_np,
sizeof(__pyx_k_np), 0, 0, 1, 1},
3340 {&__pyx_n_s_ns_del, __pyx_k_ns_del,
sizeof(__pyx_k_ns_del), 0, 0, 1, 1},
3341 {&__pyx_n_s_numpy, __pyx_k_numpy,
sizeof(__pyx_k_numpy), 0, 0, 1, 1},
3342 {&__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},
3343 {&__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},
3344 {&__pyx_kp_s_proteus_cpskRelations_pyx, __pyx_k_proteus_cpskRelations_pyx,
sizeof(__pyx_k_proteus_cpskRelations_pyx), 0, 0, 1, 0},
3345 {&__pyx_n_s_psic, __pyx_k_psic,
sizeof(__pyx_k_psic), 0, 0, 1, 1},
3346 {&__pyx_n_s_psk, __pyx_k_psk,
sizeof(__pyx_k_psk), 0, 0, 1, 1},
3347 {&__pyx_n_s_rwork, __pyx_k_rwork,
sizeof(__pyx_k_rwork), 0, 0, 1, 1},
3348 {&__pyx_n_s_rwork_tol, __pyx_k_rwork_tol,
sizeof(__pyx_k_rwork_tol), 0, 0, 1, 1},
3349 {&__pyx_n_s_sw_max, __pyx_k_sw_max,
sizeof(__pyx_k_sw_max), 0, 0, 1, 1},
3350 {&__pyx_n_s_sw_min, __pyx_k_sw_min,
sizeof(__pyx_k_sw_min), 0, 0, 1, 1},
3351 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
3352 {&__pyx_n_s_vgm_cal_from_sw, __pyx_k_vgm_cal_from_sw,
sizeof(__pyx_k_vgm_cal_from_sw), 0, 0, 1, 1},
3353 {&__pyx_n_s_vgm_calc_from_psic, __pyx_k_vgm_calc_from_psic,
sizeof(__pyx_k_vgm_calc_from_psic), 0, 0, 1, 1},
3354 {0, 0, 0, 0, 0, 0, 0}
3356 static CYTHON_SMALL_CODE
int __Pyx_InitCachedBuiltins(
void) {
3357 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError);
if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error)
3363 static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
3364 __Pyx_RefNannyDeclarations
3365 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
3374 __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to);
if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 945, __pyx_L1_error)
3375 __Pyx_GOTREF(__pyx_tuple_);
3376 __Pyx_GIVEREF(__pyx_tuple_);
3385 __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)
3386 __Pyx_GOTREF(__pyx_tuple__2);
3387 __Pyx_GIVEREF(__pyx_tuple__2);
3396 __pyx_tuple__3 = PyTuple_Pack(10, __pyx_n_s_Sw, __pyx_n_s_sw_min, __pyx_n_s_sw_max, __pyx_n_s_alpha, __pyx_n_s_m, __pyx_n_s_eps_small, __pyx_n_s_ns_del, __pyx_n_s_rwork, __pyx_n_s_rwork_tol, __pyx_n_s_psk);
if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 6, __pyx_L1_error)
3397 __Pyx_GOTREF(__pyx_tuple__3);
3398 __Pyx_GIVEREF(__pyx_tuple__3);
3399 __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 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_cpskRelations_pyx, __pyx_n_s_vgm_cal_from_sw, 6, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 6, __pyx_L1_error)
3408 __pyx_tuple__5 = PyTuple_Pack(10, __pyx_n_s_psic, __pyx_n_s_sw_min, __pyx_n_s_sw_max, __pyx_n_s_alpha, __pyx_n_s_m, __pyx_n_s_eps_small, __pyx_n_s_ns_del, __pyx_n_s_rwork, __pyx_n_s_rwork_tol, __pyx_n_s_psk);
if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 25, __pyx_L1_error)
3409 __Pyx_GOTREF(__pyx_tuple__5);
3410 __Pyx_GIVEREF(__pyx_tuple__5);
3411 __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 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_cpskRelations_pyx, __pyx_n_s_vgm_calc_from_psic, 25, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 25, __pyx_L1_error)
3412 __Pyx_RefNannyFinishContext();
3415 __Pyx_RefNannyFinishContext();
3419 static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
3420 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
3426 static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
3427 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
3428 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
3429 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
3430 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
3431 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
3432 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
3434 static int __Pyx_modinit_global_init_code(
void) {
3435 __Pyx_RefNannyDeclarations
3436 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
3438 __Pyx_RefNannyFinishContext();
3442 static int __Pyx_modinit_variable_export_code(
void) {
3443 __Pyx_RefNannyDeclarations
3444 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
3446 __Pyx_RefNannyFinishContext();
3450 static int __Pyx_modinit_function_export_code(
void) {
3451 __Pyx_RefNannyDeclarations
3452 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
3454 __Pyx_RefNannyFinishContext();
3458 static int __Pyx_modinit_type_init_code(
void) {
3459 __Pyx_RefNannyDeclarations
3460 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
3462 __Pyx_RefNannyFinishContext();
3466 static int __Pyx_modinit_type_import_code(
void) {
3467 __Pyx_RefNannyDeclarations
3468 PyObject *__pyx_t_1 = NULL;
3469 int __pyx_lineno = 0;
3470 const char *__pyx_filename = NULL;
3471 int __pyx_clineno = 0;
3472 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_import_code", 0);
3474 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
3475 __Pyx_GOTREF(__pyx_t_1);
3476 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME,
"type",
3477 #
if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
3478 sizeof(PyTypeObject),
3480 sizeof(PyHeapTypeObject),
3482 __Pyx_ImportType_CheckSize_Warn);
3483 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
3484 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3485 __pyx_t_1 = PyImport_ImportModule(
"numpy");
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
3486 __Pyx_GOTREF(__pyx_t_1);
3487 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1,
"numpy",
"dtype",
sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
3488 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
3489 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flatiter",
sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
3490 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
3491 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1,
"numpy",
"broadcast",
sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
3492 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
3493 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ndarray",
sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
3494 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
3495 __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1,
"numpy",
"generic",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
3496 if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
3497 __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1,
"numpy",
"number",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
3498 if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
3499 __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1,
"numpy",
"integer",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
3500 if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
3501 __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1,
"numpy",
"signedinteger",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
3502 if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
3503 __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1,
"numpy",
"unsignedinteger",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
3504 if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
3505 __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1,
"numpy",
"inexact",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
3506 if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
3507 __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1,
"numpy",
"floating",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
3508 if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
3509 __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1,
"numpy",
"complexfloating",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
3510 if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
3511 __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flexible",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
3512 if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
3513 __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1,
"numpy",
"character",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
3514 if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
3515 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ufunc",
sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
3516 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
3517 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3518 __Pyx_RefNannyFinishContext();
3521 __Pyx_XDECREF(__pyx_t_1);
3522 __Pyx_RefNannyFinishContext();
3526 static int __Pyx_modinit_variable_import_code(
void) {
3527 __Pyx_RefNannyDeclarations
3528 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
3530 __Pyx_RefNannyFinishContext();
3534 static int __Pyx_modinit_function_import_code(
void) {
3535 __Pyx_RefNannyDeclarations
3536 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
3538 __Pyx_RefNannyFinishContext();
3543 #ifndef CYTHON_NO_PYINIT_EXPORT
3544 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
3545 #elif PY_MAJOR_VERSION < 3
3547 #define __Pyx_PyMODINIT_FUNC extern "C" void
3549 #define __Pyx_PyMODINIT_FUNC void
3553 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
3555 #define __Pyx_PyMODINIT_FUNC PyObject *
3560 #if PY_MAJOR_VERSION < 3
3561 __Pyx_PyMODINIT_FUNC initcpskRelations(
void) CYTHON_SMALL_CODE;
3562 __Pyx_PyMODINIT_FUNC initcpskRelations(
void)
3564 __Pyx_PyMODINIT_FUNC PyInit_cpskRelations(
void) CYTHON_SMALL_CODE;
3565 __Pyx_PyMODINIT_FUNC PyInit_cpskRelations(
void)
3566 #if CYTHON_PEP489_MULTI_PHASE_INIT
3568 return PyModuleDef_Init(&__pyx_moduledef);
3570 static CYTHON_SMALL_CODE
int __Pyx_check_single_interpreter(
void) {
3571 #if PY_VERSION_HEX >= 0x030700A1
3572 static PY_INT64_T main_interpreter_id = -1;
3573 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
3574 if (main_interpreter_id == -1) {
3575 main_interpreter_id = current_id;
3576 return (unlikely(current_id == -1)) ? -1 : 0;
3577 }
else if (unlikely(main_interpreter_id != current_id))
3579 static PyInterpreterState *main_interpreter = NULL;
3580 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
3581 if (!main_interpreter) {
3582 main_interpreter = current_interpreter;
3583 }
else if (unlikely(main_interpreter != current_interpreter))
3588 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
3593 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) {
3594 PyObject *value = PyObject_GetAttrString(spec, from_name);
3596 if (likely(value)) {
3597 if (allow_none || value != Py_None) {
3598 result = PyDict_SetItemString(moddict, to_name, value);
3601 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
3608 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
3609 PyObject *module = NULL, *moddict, *modname;
3610 if (__Pyx_check_single_interpreter())
3613 return __Pyx_NewRef(__pyx_m);
3614 modname = PyObject_GetAttrString(spec,
"name");
3615 if (unlikely(!modname))
goto bad;
3616 module = PyModule_NewObject(modname);
3618 if (unlikely(!module))
goto bad;
3619 moddict = PyModule_GetDict(module);
3620 if (unlikely(!moddict))
goto bad;
3621 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"loader",
"__loader__", 1) < 0))
goto bad;
3622 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"origin",
"__file__", 1) < 0))
goto bad;
3623 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"parent",
"__package__", 1) < 0))
goto bad;
3624 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"submodule_search_locations",
"__path__", 0) < 0))
goto bad;
3632 static CYTHON_SMALL_CODE
int __pyx_pymod_exec_cpskRelations(PyObject *__pyx_pyinit_module)
3636 PyObject *__pyx_t_1 = NULL;
3637 int __pyx_lineno = 0;
3638 const char *__pyx_filename = NULL;
3639 int __pyx_clineno = 0;
3640 __Pyx_RefNannyDeclarations
3641 #if CYTHON_PEP489_MULTI_PHASE_INIT
3643 if (__pyx_m == __pyx_pyinit_module)
return 0;
3644 PyErr_SetString(PyExc_RuntimeError,
"Module 'cpskRelations' has already been imported. Re-initialisation is not supported.");
3647 #elif PY_MAJOR_VERSION >= 3
3648 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
3651 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
3652 if (!__Pyx_RefNanny) {
3654 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
3655 if (!__Pyx_RefNanny)
3656 Py_FatalError(
"failed to import 'refnanny' module");
3659 __Pyx_RefNannySetupContext(
"__Pyx_PyMODINIT_FUNC PyInit_cpskRelations(void)", 0);
3660 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3661 #ifdef __Pxy_PyFrame_Initialize_Offsets
3662 __Pxy_PyFrame_Initialize_Offsets();
3664 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
3665 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
3666 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
3667 #ifdef __Pyx_CyFunction_USED
3668 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3670 #ifdef __Pyx_FusedFunction_USED
3671 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3673 #ifdef __Pyx_Coroutine_USED
3674 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3676 #ifdef __Pyx_Generator_USED
3677 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3679 #ifdef __Pyx_AsyncGen_USED
3680 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3682 #ifdef __Pyx_StopAsyncIteration_USED
3683 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3687 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
3688 PyEval_InitThreads();
3691 #if CYTHON_PEP489_MULTI_PHASE_INIT
3692 __pyx_m = __pyx_pyinit_module;
3695 #if PY_MAJOR_VERSION < 3
3696 __pyx_m = Py_InitModule4(
"cpskRelations", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
3698 __pyx_m = PyModule_Create(&__pyx_moduledef);
3700 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
3702 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
3704 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
3706 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
3707 Py_INCREF(__pyx_cython_runtime);
3708 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
3710 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3711 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
3712 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3714 if (__pyx_module_is_main_cpskRelations) {
3715 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3717 #if PY_MAJOR_VERSION >= 3
3719 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
3720 if (!PyDict_GetItemString(modules,
"cpskRelations")) {
3721 if (unlikely(PyDict_SetItemString(modules,
"cpskRelations", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
3726 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3728 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3730 (void)__Pyx_modinit_global_init_code();
3731 (void)__Pyx_modinit_variable_export_code();
3732 (void)__Pyx_modinit_function_export_code();
3733 (void)__Pyx_modinit_type_init_code();
3734 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
3735 (void)__Pyx_modinit_variable_import_code();
3736 (void)__Pyx_modinit_function_import_code();
3738 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
3739 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3748 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
3749 __Pyx_GOTREF(__pyx_t_1);
3750 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
3751 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3760 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_13cpskRelations_1vgm_cal_from_sw, NULL, __pyx_n_s_cpskRelations);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
3761 __Pyx_GOTREF(__pyx_t_1);
3762 if (PyDict_SetItem(__pyx_d, __pyx_n_s_vgm_cal_from_sw, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
3763 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3772 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_13cpskRelations_3vgm_calc_from_psic, NULL, __pyx_n_s_cpskRelations);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
3773 __Pyx_GOTREF(__pyx_t_1);
3774 if (PyDict_SetItem(__pyx_d, __pyx_n_s_vgm_calc_from_psic, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
3775 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3782 __pyx_t_1 = __Pyx_PyDict_NewPresized(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
3783 __Pyx_GOTREF(__pyx_t_1);
3784 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3785 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3799 __Pyx_XDECREF(__pyx_t_1);
3802 __Pyx_AddTraceback(
"init cpskRelations", __pyx_clineno, __pyx_lineno, __pyx_filename);
3805 }
else if (!PyErr_Occurred()) {
3806 PyErr_SetString(PyExc_ImportError,
"init cpskRelations");
3809 __Pyx_RefNannyFinishContext();
3810 #if CYTHON_PEP489_MULTI_PHASE_INIT
3811 return (__pyx_m != NULL) ? 0 : -1;
3812 #elif PY_MAJOR_VERSION >= 3
3822 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
3823 PyObject *m = NULL, *p = NULL;
3825 m = PyImport_ImportModule(modname);
3827 p = PyObject_GetAttrString(m,
"RefNannyAPI");
3829 r = PyLong_AsVoidPtr(p);
3833 return (__Pyx_RefNannyAPIStruct *)
r;
3838 static void __Pyx_RaiseArgtupleInvalid(
3839 const char* func_name,
3843 Py_ssize_t num_found)
3845 Py_ssize_t num_expected;
3846 const char *more_or_less;
3847 if (num_found < num_min) {
3848 num_expected = num_min;
3849 more_or_less =
"at least";
3851 num_expected = num_max;
3852 more_or_less =
"at most";
3855 more_or_less =
"exactly";
3857 PyErr_Format(PyExc_TypeError,
3858 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T
"d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T
"d given)",
3859 func_name, more_or_less, num_expected,
3860 (num_expected == 1) ?
"" :
"s", num_found);
3864 static void __Pyx_RaiseDoubleKeywordsError(
3865 const char* func_name,
3868 PyErr_Format(PyExc_TypeError,
3869 #
if PY_MAJOR_VERSION >= 3
3870 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
3872 "%s() got multiple values for keyword argument '%s'", func_name,
3873 PyString_AsString(kw_name));
3878 static int __Pyx_ParseOptionalKeywords(
3880 PyObject **argnames[],
3883 Py_ssize_t num_pos_args,
3884 const char* function_name)
3886 PyObject *key = 0, *value = 0;
3889 PyObject*** first_kw_arg = argnames + num_pos_args;
3890 while (PyDict_Next(kwds, &
pos, &key, &value)) {
3891 name = first_kw_arg;
3892 while (*name && (**name != key)) name++;
3894 values[name-argnames] = value;
3897 name = first_kw_arg;
3898 #if PY_MAJOR_VERSION < 3
3899 if (likely(PyString_Check(key))) {
3901 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
3902 && _PyString_Eq(**name, key)) {
3903 values[name-argnames] = value;
3908 if (*name)
continue;
3910 PyObject*** argname = argnames;
3911 while (argname != first_kw_arg) {
3912 if ((**argname == key) || (
3913 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
3914 && _PyString_Eq(**argname, key))) {
3915 goto arg_passed_twice;
3922 if (likely(PyUnicode_Check(key))) {
3924 int cmp = (**name == key) ? 0 :
3925 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
3926 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
3928 PyUnicode_Compare(**name, key);
3929 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
3931 values[name-argnames] = value;
3936 if (*name)
continue;
3938 PyObject*** argname = argnames;
3939 while (argname != first_kw_arg) {
3940 int cmp = (**argname == key) ? 0 :
3941 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
3942 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
3944 PyUnicode_Compare(**argname, key);
3945 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
3946 if (cmp == 0)
goto arg_passed_twice;
3951 goto invalid_keyword_type;
3953 if (unlikely(PyDict_SetItem(kwds2, key, value)))
goto bad;
3955 goto invalid_keyword;
3960 __Pyx_RaiseDoubleKeywordsError(function_name, key);
3962 invalid_keyword_type:
3963 PyErr_Format(PyExc_TypeError,
3964 "%.200s() keywords must be strings", function_name);
3967 PyErr_Format(PyExc_TypeError,
3968 #
if PY_MAJOR_VERSION < 3
3969 "%.200s() got an unexpected keyword argument '%.200s'",
3970 function_name, PyString_AsString(key));
3972 "%s() got an unexpected keyword argument '%U'",
3973 function_name, key);
3980 #if CYTHON_USE_TYPE_SLOTS
3981 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
3982 PyTypeObject* tp = Py_TYPE(obj);
3983 if (likely(tp->tp_getattro))
3984 return tp->tp_getattro(obj, attr_name);
3985 #if PY_MAJOR_VERSION < 3
3986 if (likely(tp->tp_getattr))
3987 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
3989 return PyObject_GetAttr(obj, attr_name);
3994 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
3995 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
3996 if (unlikely(!result)) {
3997 PyErr_Format(PyExc_NameError,
3998 #
if PY_MAJOR_VERSION >= 3
3999 "name '%U' is not defined", name);
4001 "name '%.200s' is not defined", PyString_AS_STRING(name));
4008 #if CYTHON_USE_EXC_INFO_STACK
4009 static _PyErr_StackItem *
4010 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
4012 _PyErr_StackItem *exc_info = tstate->exc_info;
4013 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
4014 exc_info->previous_item != NULL)
4016 exc_info = exc_info->previous_item;
4023 #if CYTHON_FAST_THREAD_STATE
4024 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
4025 #if CYTHON_USE_EXC_INFO_STACK
4026 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
4027 *type = exc_info->exc_type;
4028 *value = exc_info->exc_value;
4029 *tb = exc_info->exc_traceback;
4031 *type = tstate->exc_type;
4032 *value = tstate->exc_value;
4033 *tb = tstate->exc_traceback;
4039 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
4040 PyObject *tmp_type, *tmp_value, *tmp_tb;
4041 #if CYTHON_USE_EXC_INFO_STACK
4042 _PyErr_StackItem *exc_info = tstate->exc_info;
4043 tmp_type = exc_info->exc_type;
4044 tmp_value = exc_info->exc_value;
4045 tmp_tb = exc_info->exc_traceback;
4046 exc_info->exc_type = type;
4047 exc_info->exc_value = value;
4048 exc_info->exc_traceback = tb;
4050 tmp_type = tstate->exc_type;
4051 tmp_value = tstate->exc_value;
4052 tmp_tb = tstate->exc_traceback;
4053 tstate->exc_type = type;
4054 tstate->exc_value = value;
4055 tstate->exc_traceback = tb;
4057 Py_XDECREF(tmp_type);
4058 Py_XDECREF(tmp_value);
4064 #if CYTHON_FAST_THREAD_STATE
4065 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
4067 n = PyTuple_GET_SIZE(tuple);
4068 #if PY_MAJOR_VERSION >= 3
4069 for (i=0; i<
n; i++) {
4070 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
4073 for (i=0; i<
n; i++) {
4074 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
4078 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
4079 PyObject *exc_type = tstate->curexc_type;
4080 if (exc_type == err)
return 1;
4081 if (unlikely(!exc_type))
return 0;
4082 if (unlikely(PyTuple_Check(err)))
4083 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
4084 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
4089 #if CYTHON_FAST_THREAD_STATE
4090 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
4092 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
4095 PyObject *local_type, *local_value, *local_tb;
4096 #if CYTHON_FAST_THREAD_STATE
4097 PyObject *tmp_type, *tmp_value, *tmp_tb;
4098 local_type = tstate->curexc_type;
4099 local_value = tstate->curexc_value;
4100 local_tb = tstate->curexc_traceback;
4101 tstate->curexc_type = 0;
4102 tstate->curexc_value = 0;
4103 tstate->curexc_traceback = 0;
4105 PyErr_Fetch(&local_type, &local_value, &local_tb);
4107 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
4108 #if CYTHON_FAST_THREAD_STATE
4109 if (unlikely(tstate->curexc_type))
4111 if (unlikely(PyErr_Occurred()))
4114 #if PY_MAJOR_VERSION >= 3
4116 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
4120 Py_XINCREF(local_tb);
4121 Py_XINCREF(local_type);
4122 Py_XINCREF(local_value);
4124 *value = local_value;
4126 #if CYTHON_FAST_THREAD_STATE
4127 #if CYTHON_USE_EXC_INFO_STACK
4129 _PyErr_StackItem *exc_info = tstate->exc_info;
4130 tmp_type = exc_info->exc_type;
4131 tmp_value = exc_info->exc_value;
4132 tmp_tb = exc_info->exc_traceback;
4133 exc_info->exc_type = local_type;
4134 exc_info->exc_value = local_value;
4135 exc_info->exc_traceback = local_tb;
4138 tmp_type = tstate->exc_type;
4139 tmp_value = tstate->exc_value;
4140 tmp_tb = tstate->exc_traceback;
4141 tstate->exc_type = local_type;
4142 tstate->exc_value = local_value;
4143 tstate->exc_traceback = local_tb;
4145 Py_XDECREF(tmp_type);
4146 Py_XDECREF(tmp_value);
4149 PyErr_SetExcInfo(local_type, local_value, local_tb);
4156 Py_XDECREF(local_type);
4157 Py_XDECREF(local_value);
4158 Py_XDECREF(local_tb);
4163 #if CYTHON_COMPILING_IN_CPYTHON
4164 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
4166 ternaryfunc call = Py_TYPE(func)->tp_call;
4167 if (unlikely(!call))
4168 return PyObject_Call(func, arg, kw);
4169 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
4171 result = (*call)(func, arg, kw);
4172 Py_LeaveRecursiveCall();
4173 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
4176 "NULL result without error in PyObject_Call");
4183 #if CYTHON_FAST_THREAD_STATE
4184 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
4185 PyObject *tmp_type, *tmp_value, *tmp_tb;
4186 tmp_type = tstate->curexc_type;
4187 tmp_value = tstate->curexc_value;
4188 tmp_tb = tstate->curexc_traceback;
4189 tstate->curexc_type = type;
4190 tstate->curexc_value = value;
4191 tstate->curexc_traceback = tb;
4192 Py_XDECREF(tmp_type);
4193 Py_XDECREF(tmp_value);
4196 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
4197 *type = tstate->curexc_type;
4198 *value = tstate->curexc_value;
4199 *tb = tstate->curexc_traceback;
4200 tstate->curexc_type = 0;
4201 tstate->curexc_value = 0;
4202 tstate->curexc_traceback = 0;
4207 #if PY_MAJOR_VERSION < 3
4208 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
4209 CYTHON_UNUSED PyObject *cause) {
4210 __Pyx_PyThreadState_declare
4212 if (!value || value == Py_None)
4216 if (!tb || tb == Py_None)
4220 if (!PyTraceBack_Check(tb)) {
4221 PyErr_SetString(PyExc_TypeError,
4222 "raise: arg 3 must be a traceback or None");
4226 if (PyType_Check(type)) {
4227 #if CYTHON_COMPILING_IN_PYPY
4233 PyErr_NormalizeException(&type, &value, &tb);
4236 PyErr_SetString(PyExc_TypeError,
4237 "instance exception may not have a separate value");
4241 type = (PyObject*) Py_TYPE(type);
4243 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
4244 PyErr_SetString(PyExc_TypeError,
4245 "raise: exception class must be a subclass of BaseException");
4249 __Pyx_PyThreadState_assign
4250 __Pyx_ErrRestore(type, value, tb);
4259 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
4260 PyObject* owned_instance = NULL;
4261 if (tb == Py_None) {
4263 }
else if (tb && !PyTraceBack_Check(tb)) {
4264 PyErr_SetString(PyExc_TypeError,
4265 "raise: arg 3 must be a traceback or None");
4268 if (value == Py_None)
4270 if (PyExceptionInstance_Check(type)) {
4272 PyErr_SetString(PyExc_TypeError,
4273 "instance exception may not have a separate value");
4277 type = (PyObject*) Py_TYPE(value);
4278 }
else if (PyExceptionClass_Check(type)) {
4279 PyObject *instance_class = NULL;
4280 if (value && PyExceptionInstance_Check(value)) {
4281 instance_class = (PyObject*) Py_TYPE(value);
4282 if (instance_class != type) {
4283 int is_subclass = PyObject_IsSubclass(instance_class, type);
4285 instance_class = NULL;
4286 }
else if (unlikely(is_subclass == -1)) {
4289 type = instance_class;
4293 if (!instance_class) {
4296 args = PyTuple_New(0);
4297 else if (PyTuple_Check(value)) {
4301 args = PyTuple_Pack(1, value);
4304 owned_instance = PyObject_Call(type, args, NULL);
4306 if (!owned_instance)
4308 value = owned_instance;
4309 if (!PyExceptionInstance_Check(value)) {
4310 PyErr_Format(PyExc_TypeError,
4311 "calling %R should have returned an instance of "
4312 "BaseException, not %R",
4313 type, Py_TYPE(value));
4318 PyErr_SetString(PyExc_TypeError,
4319 "raise: exception class must be a subclass of BaseException");
4323 PyObject *fixed_cause;
4324 if (cause == Py_None) {
4326 }
else if (PyExceptionClass_Check(cause)) {
4327 fixed_cause = PyObject_CallObject(cause, NULL);
4328 if (fixed_cause == NULL)
4330 }
else if (PyExceptionInstance_Check(cause)) {
4331 fixed_cause = cause;
4332 Py_INCREF(fixed_cause);
4334 PyErr_SetString(PyExc_TypeError,
4335 "exception causes must derive from "
4339 PyException_SetCause(value, fixed_cause);
4341 PyErr_SetObject(type, value);
4343 #if CYTHON_COMPILING_IN_PYPY
4344 PyObject *tmp_type, *tmp_value, *tmp_tb;
4345 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
4347 PyErr_Restore(tmp_type, tmp_value, tb);
4350 PyThreadState *tstate = __Pyx_PyThreadState_Current;
4351 PyObject* tmp_tb = tstate->curexc_traceback;
4354 tstate->curexc_traceback = tb;
4360 Py_XDECREF(owned_instance);
4366 #ifndef __PYX_HAVE_RT_ImportType
4367 #define __PYX_HAVE_RT_ImportType
4368 static PyTypeObject *__Pyx_ImportType(PyObject *module,
const char *module_name,
const char *class_name,
4369 size_t size,
enum __Pyx_ImportType_CheckSize check_size)
4371 PyObject *result = 0;
4373 Py_ssize_t basicsize;
4374 #ifdef Py_LIMITED_API
4375 PyObject *py_basicsize;
4377 result = PyObject_GetAttrString(module, class_name);
4380 if (!PyType_Check(result)) {
4381 PyErr_Format(PyExc_TypeError,
4382 "%.200s.%.200s is not a type object",
4383 module_name, class_name);
4386 #ifndef Py_LIMITED_API
4387 basicsize = ((PyTypeObject *)result)->tp_basicsize;
4389 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
4392 basicsize = PyLong_AsSsize_t(py_basicsize);
4393 Py_DECREF(py_basicsize);
4395 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
4398 if ((
size_t)basicsize < size) {
4399 PyErr_Format(PyExc_ValueError,
4400 "%.200s.%.200s size changed, may indicate binary incompatibility. "
4401 "Expected %zd from C header, got %zd from PyObject",
4402 module_name, class_name, size, basicsize);
4405 if (check_size == __Pyx_ImportType_CheckSize_Error && (
size_t)basicsize != size) {
4406 PyErr_Format(PyExc_ValueError,
4407 "%.200s.%.200s size changed, may indicate binary incompatibility. "
4408 "Expected %zd from C header, got %zd from PyObject",
4409 module_name, class_name, size, basicsize);
4412 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (
size_t)basicsize > size) {
4413 PyOS_snprintf(warning,
sizeof(warning),
4414 "%s.%s size changed, may indicate binary incompatibility. "
4415 "Expected %zd from C header, got %zd from PyObject",
4416 module_name, class_name, size, basicsize);
4417 if (PyErr_WarnEx(NULL, warning, 0) < 0)
goto bad;
4419 return (PyTypeObject *)result;
4427 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
4428 PyObject *empty_list = 0;
4429 PyObject *module = 0;
4430 PyObject *global_dict = 0;
4431 PyObject *empty_dict = 0;
4433 #if PY_MAJOR_VERSION < 3
4434 PyObject *py_import;
4435 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
4442 empty_list = PyList_New(0);
4447 global_dict = PyModule_GetDict(__pyx_m);
4450 empty_dict = PyDict_New();
4454 #if PY_MAJOR_VERSION >= 3
4456 if ((1) && (strchr(__Pyx_MODULE_NAME,
'.'))) {
4457 module = PyImport_ImportModuleLevelObject(
4458 name, global_dict, empty_dict, list, 1);
4460 if (!PyErr_ExceptionMatches(PyExc_ImportError))
4469 #if PY_MAJOR_VERSION < 3
4470 PyObject *py_level = PyInt_FromLong(level);
4473 module = PyObject_CallFunctionObjArgs(py_import,
4474 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
4475 Py_DECREF(py_level);
4477 module = PyImport_ImportModuleLevelObject(
4478 name, global_dict, empty_dict, list, level);
4483 #if PY_MAJOR_VERSION < 3
4484 Py_XDECREF(py_import);
4486 Py_XDECREF(empty_list);
4487 Py_XDECREF(empty_dict);
4492 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
4493 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
4494 PyObject *dict = Py_TYPE(obj)->tp_dict;
4495 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
4497 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
4498 PyObject **dictptr = NULL;
4499 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
4501 #if CYTHON_COMPILING_IN_CPYTHON
4502 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
4504 dictptr = _PyObject_GetDictPtr(obj);
4507 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
4509 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
4510 PyObject *dict = Py_TYPE(obj)->tp_dict;
4511 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
4513 return obj_dict_version == __Pyx_get_object_dict_version(obj);
4518 #ifndef CYTHON_CLINE_IN_TRACEBACK
4519 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate,
int c_line) {
4520 PyObject *use_cline;
4521 PyObject *ptype, *pvalue, *ptraceback;
4522 #if CYTHON_COMPILING_IN_CPYTHON
4523 PyObject **cython_runtime_dict;
4525 if (unlikely(!__pyx_cython_runtime)) {
4528 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
4529 #if CYTHON_COMPILING_IN_CPYTHON
4530 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
4531 if (likely(cython_runtime_dict)) {
4532 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
4533 use_cline, *cython_runtime_dict,
4534 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
4538 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
4539 if (use_cline_obj) {
4540 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
4541 Py_DECREF(use_cline_obj);
4549 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
4551 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
4554 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
4560 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
4561 int start = 0, mid = 0, end = count - 1;
4562 if (end >= 0 && code_line > entries[end].code_line) {
4565 while (start < end) {
4566 mid = start + (end - start) / 2;
4567 if (code_line < entries[mid].code_line) {
4569 }
else if (code_line > entries[mid].code_line) {
4575 if (code_line <= entries[mid].code_line) {
4581 static PyCodeObject *__pyx_find_code_object(
int code_line) {
4582 PyCodeObject* code_object;
4584 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
4587 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
4588 if (unlikely(
pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[
pos].code_line != code_line)) {
4591 code_object = __pyx_code_cache.entries[
pos].code_object;
4592 Py_INCREF(code_object);
4595 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
4597 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
4598 if (unlikely(!code_line)) {
4601 if (unlikely(!entries)) {
4602 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
4603 if (likely(entries)) {
4604 __pyx_code_cache.entries = entries;
4605 __pyx_code_cache.max_count = 64;
4606 __pyx_code_cache.count = 1;
4607 entries[0].code_line = code_line;
4608 entries[0].code_object = code_object;
4609 Py_INCREF(code_object);
4613 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
4614 if ((
pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[
pos].code_line == code_line)) {
4615 PyCodeObject* tmp = entries[
pos].code_object;
4616 entries[
pos].code_object = code_object;
4620 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
4621 int new_max = __pyx_code_cache.max_count + 64;
4622 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
4623 __pyx_code_cache.entries, ((
size_t)new_max) *
sizeof(__Pyx_CodeObjectCacheEntry));
4624 if (unlikely(!entries)) {
4627 __pyx_code_cache.entries = entries;
4628 __pyx_code_cache.max_count = new_max;
4630 for (i=__pyx_code_cache.count; i>
pos; i--) {
4631 entries[i] = entries[i-1];
4633 entries[
pos].code_line = code_line;
4634 entries[
pos].code_object = code_object;
4635 __pyx_code_cache.count++;
4636 Py_INCREF(code_object);
4640 #include "compile.h"
4641 #include "frameobject.h"
4642 #include "traceback.h"
4643 #if PY_VERSION_HEX >= 0x030b00a6
4644 #ifndef Py_BUILD_CORE
4645 #define Py_BUILD_CORE 1
4647 #include "internal/pycore_frame.h"
4649 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
4650 const char *funcname,
int c_line,
4651 int py_line,
const char *filename) {
4652 PyCodeObject *py_code = NULL;
4653 PyObject *py_funcname = NULL;
4654 #if PY_MAJOR_VERSION < 3
4655 PyObject *py_srcfile = NULL;
4656 py_srcfile = PyString_FromString(filename);
4657 if (!py_srcfile)
goto bad;
4660 #if PY_MAJOR_VERSION < 3
4661 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
4662 if (!py_funcname)
goto bad;
4664 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
4665 if (!py_funcname)
goto bad;
4666 funcname = PyUnicode_AsUTF8(py_funcname);
4667 if (!funcname)
goto bad;
4671 #if PY_MAJOR_VERSION < 3
4672 py_funcname = PyString_FromString(funcname);
4673 if (!py_funcname)
goto bad;
4676 #if PY_MAJOR_VERSION < 3
4677 py_code = __Pyx_PyCode_New(
4694 Py_DECREF(py_srcfile);
4696 py_code = PyCode_NewEmpty(filename, funcname, py_line);
4698 Py_XDECREF(py_funcname);
4701 Py_XDECREF(py_funcname);
4702 #if PY_MAJOR_VERSION < 3
4703 Py_XDECREF(py_srcfile);
4707 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
4708 int py_line,
const char *filename) {
4709 PyCodeObject *py_code = 0;
4710 PyFrameObject *py_frame = 0;
4711 PyThreadState *tstate = __Pyx_PyThreadState_Current;
4712 PyObject *ptype, *pvalue, *ptraceback;
4714 c_line = __Pyx_CLineForTraceback(tstate, c_line);
4716 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
4718 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
4719 py_code = __Pyx_CreateCodeObjectForTraceback(
4720 funcname, c_line, py_line, filename);
4726 Py_XDECREF(ptraceback);
4729 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
4730 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
4732 py_frame = PyFrame_New(
4738 if (!py_frame)
goto bad;
4739 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
4740 PyTraceBack_Here(py_frame);
4742 Py_XDECREF(py_code);
4743 Py_XDECREF(py_frame);
4749 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
4750 return ::std::complex< float >(x, y);
4753 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
4754 return x + y*(__pyx_t_float_complex)_Complex_I;
4758 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
4759 __pyx_t_float_complex
z;
4769 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
4770 return (a.real == b.real) && (a.imag == b.imag);
4772 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
4773 __pyx_t_float_complex
z;
4774 z.real = a.real + b.real;
4775 z.imag = a.imag + b.imag;
4778 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
4779 __pyx_t_float_complex
z;
4780 z.real = a.real - b.real;
4781 z.imag = a.imag - b.imag;
4784 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
4785 __pyx_t_float_complex
z;
4786 z.real = a.real * b.real - a.imag * b.imag;
4787 z.imag = a.real * b.imag + a.imag * b.real;
4791 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
4793 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
4794 }
else if (fabsf(b.real) >= fabsf(b.imag)) {
4795 if (b.real == 0 && b.imag == 0) {
4796 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
4798 float r = b.imag / b.real;
4799 float s = (float)(1.0) / (b.real + b.imag *
r);
4800 return __pyx_t_float_complex_from_parts(
4801 (a.real + a.imag *
r) *
s, (a.imag - a.real *
r) *
s);
4804 float r = b.real / b.imag;
4805 float s = (float)(1.0) / (b.imag + b.real *
r);
4806 return __pyx_t_float_complex_from_parts(
4807 (a.real *
r + a.imag) *
s, (a.imag *
r - a.real) *
s);
4811 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
4813 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
4815 float denom = b.real * b.real + b.imag * b.imag;
4816 return __pyx_t_float_complex_from_parts(
4817 (a.real * b.real + a.imag * b.imag) / denom,
4818 (a.imag * b.real - a.real * b.imag) / denom);
4822 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
4823 __pyx_t_float_complex
z;
4828 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
4829 return (a.real == 0) && (a.imag == 0);
4831 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
4832 __pyx_t_float_complex
z;
4838 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex
z) {
4839 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
4840 return sqrtf(
z.real*
z.real +
z.imag*
z.imag);
4842 return hypotf(
z.real,
z.imag);
4845 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
4846 __pyx_t_float_complex
z;
4847 float r, lnr, theta, z_r, z_theta;
4848 if (b.imag == 0 && b.real == (
int)b.real) {
4850 float denom = a.real * a.real + a.imag * a.imag;
4851 a.real = a.real / denom;
4852 a.imag = -a.imag / denom;
4855 switch ((
int)b.real) {
4863 return __Pyx_c_prod_float(a, a);
4865 z = __Pyx_c_prod_float(a, a);
4866 return __Pyx_c_prod_float(
z, a);
4868 z = __Pyx_c_prod_float(a, a);
4869 return __Pyx_c_prod_float(
z,
z);
4875 }
else if (b.imag == 0) {
4876 z.real = powf(a.real, b.real);
4879 }
else if (a.real > 0) {
4884 theta = atan2f(0.0, -1.0);
4887 r = __Pyx_c_abs_float(a);
4888 theta = atan2f(a.imag, a.real);
4891 z_r = expf(lnr * b.real - theta * b.imag);
4892 z_theta = theta * b.real + lnr * b.imag;
4893 z.real = z_r * cosf(z_theta);
4894 z.imag = z_r * sinf(z_theta);
4903 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
4904 return ::std::complex< double >(x, y);
4907 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
4908 return x + y*(__pyx_t_double_complex)_Complex_I;
4912 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
4913 __pyx_t_double_complex
z;
4923 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
4924 return (a.real == b.real) && (a.imag == b.imag);
4926 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
4927 __pyx_t_double_complex
z;
4928 z.real = a.real + b.real;
4929 z.imag = a.imag + b.imag;
4932 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
4933 __pyx_t_double_complex
z;
4934 z.real = a.real - b.real;
4935 z.imag = a.imag - b.imag;
4938 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
4939 __pyx_t_double_complex
z;
4940 z.real = a.real * b.real - a.imag * b.imag;
4941 z.imag = a.real * b.imag + a.imag * b.real;
4945 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
4947 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
4948 }
else if (fabs(b.real) >= fabs(b.imag)) {
4949 if (b.real == 0 && b.imag == 0) {
4950 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
4952 double r = b.imag / b.real;
4953 double s = (double)(1.0) / (b.real + b.imag *
r);
4954 return __pyx_t_double_complex_from_parts(
4955 (a.real + a.imag *
r) *
s, (a.imag - a.real *
r) *
s);
4958 double r = b.real / b.imag;
4959 double s = (double)(1.0) / (b.imag + b.real *
r);
4960 return __pyx_t_double_complex_from_parts(
4961 (a.real *
r + a.imag) *
s, (a.imag *
r - a.real) *
s);
4965 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
4967 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
4969 double denom = b.real * b.real + b.imag * b.imag;
4970 return __pyx_t_double_complex_from_parts(
4971 (a.real * b.real + a.imag * b.imag) / denom,
4972 (a.imag * b.real - a.real * b.imag) / denom);
4976 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
4977 __pyx_t_double_complex
z;
4982 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
4983 return (a.real == 0) && (a.imag == 0);
4985 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
4986 __pyx_t_double_complex
z;
4992 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex
z) {
4993 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
4994 return sqrt(
z.real*
z.real +
z.imag*
z.imag);
4996 return hypot(
z.real,
z.imag);
4999 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
5000 __pyx_t_double_complex
z;
5001 double r, lnr, theta, z_r, z_theta;
5002 if (b.imag == 0 && b.real == (
int)b.real) {
5004 double denom = a.real * a.real + a.imag * a.imag;
5005 a.real = a.real / denom;
5006 a.imag = -a.imag / denom;
5009 switch ((
int)b.real) {
5017 return __Pyx_c_prod_double(a, a);
5019 z = __Pyx_c_prod_double(a, a);
5020 return __Pyx_c_prod_double(
z, a);
5022 z = __Pyx_c_prod_double(a, a);
5023 return __Pyx_c_prod_double(
z,
z);
5029 }
else if (b.imag == 0) {
5030 z.real = pow(a.real, b.real);
5033 }
else if (a.real > 0) {
5038 theta = atan2(0.0, -1.0);
5041 r = __Pyx_c_abs_double(a);
5042 theta = atan2(a.imag, a.real);
5045 z_r = exp(lnr * b.real - theta * b.imag);
5046 z_theta = theta * b.real + lnr * b.imag;
5047 z.real = z_r * cos(z_theta);
5048 z.imag = z_r * sin(z_theta);
5055 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
5056 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5057 #pragma GCC diagnostic push
5058 #pragma GCC diagnostic ignored "-Wconversion"
5060 const long neg_one = (long) -1, const_zero = (
long) 0;
5061 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5062 #pragma GCC diagnostic pop
5064 const int is_unsigned = neg_one > const_zero;
5066 if (
sizeof(
long) <
sizeof(long)) {
5067 return PyInt_FromLong((
long) value);
5068 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
5069 return PyLong_FromUnsignedLong((
unsigned long) value);
5070 #ifdef HAVE_LONG_LONG
5071 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
5072 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
5076 if (
sizeof(
long) <=
sizeof(
long)) {
5077 return PyInt_FromLong((
long) value);
5078 #ifdef HAVE_LONG_LONG
5079 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
5080 return PyLong_FromLongLong((PY_LONG_LONG) value);
5085 int one = 1;
int little = (int)*(
unsigned char *)&one;
5086 unsigned char *bytes = (
unsigned char *)&value;
5087 return _PyLong_FromByteArray(bytes,
sizeof(
long),
5088 little, !is_unsigned);
5093 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
5094 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
5095 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
5096 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
5097 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
5099 func_type value = func_value;\
5100 if (sizeof(target_type) < sizeof(func_type)) {\
5101 if (unlikely(value != (func_type) (target_type) value)) {\
5102 func_type zero = 0;\
5103 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
5104 return (target_type) -1;\
5105 if (is_unsigned && unlikely(value < zero))\
5106 goto raise_neg_overflow;\
5108 goto raise_overflow;\
5111 return (target_type) value;\
5115 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
5116 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5117 #pragma GCC diagnostic push
5118 #pragma GCC diagnostic ignored "-Wconversion"
5120 const long neg_one = (long) -1, const_zero = (
long) 0;
5121 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5122 #pragma GCC diagnostic pop
5124 const int is_unsigned = neg_one > const_zero;
5125 #if PY_MAJOR_VERSION < 3
5126 if (likely(PyInt_Check(x))) {
5127 if (
sizeof(
long) <
sizeof(long)) {
5128 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
5130 long val = PyInt_AS_LONG(x);
5131 if (is_unsigned && unlikely(val < 0)) {
5132 goto raise_neg_overflow;
5138 if (likely(PyLong_Check(x))) {
5140 #if CYTHON_USE_PYLONG_INTERNALS
5141 const digit* digits = ((PyLongObject*)x)->ob_digit;
5142 switch (Py_SIZE(x)) {
5143 case 0:
return (
long) 0;
5144 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
5146 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
5147 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
5148 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
5149 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
5150 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
5155 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
5156 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
5157 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
5158 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
5159 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
5164 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
5165 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
5166 __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])))
5167 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
5168 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
5174 #if CYTHON_COMPILING_IN_CPYTHON
5175 if (unlikely(Py_SIZE(x) < 0)) {
5176 goto raise_neg_overflow;
5180 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
5181 if (unlikely(result < 0))
5183 if (unlikely(result == 1))
5184 goto raise_neg_overflow;
5187 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
5188 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
5189 #ifdef HAVE_LONG_LONG
5190 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
5191 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
5195 #if CYTHON_USE_PYLONG_INTERNALS
5196 const digit* digits = ((PyLongObject*)x)->ob_digit;
5197 switch (Py_SIZE(x)) {
5198 case 0:
return (
long) 0;
5199 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
5200 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
5202 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
5203 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
5204 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
5205 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
5206 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
5211 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
5212 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
5213 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
5214 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
5215 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
5220 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
5221 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
5222 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
5223 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
5224 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
5229 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
5230 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
5231 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
5232 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
5233 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
5238 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
5239 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
5240 __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])))
5241 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
5242 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
5247 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
5248 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
5249 __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])))
5250 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
5251 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
5257 if (
sizeof(
long) <=
sizeof(long)) {
5258 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
5259 #ifdef HAVE_LONG_LONG
5260 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
5261 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
5266 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
5267 PyErr_SetString(PyExc_RuntimeError,
5268 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
5271 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
5272 #if PY_MAJOR_VERSION < 3
5273 if (likely(
v) && !PyLong_Check(
v)) {
5275 v = PyNumber_Long(tmp);
5280 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
5281 unsigned char *bytes = (
unsigned char *)&val;
5282 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
5284 is_little, !is_unsigned);
5294 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
5295 if (!tmp)
return (
long) -1;
5296 val = __Pyx_PyInt_As_long(tmp);
5301 PyErr_SetString(PyExc_OverflowError,
5302 "value too large to convert to long");
5305 PyErr_SetString(PyExc_OverflowError,
5306 "can't convert negative value to long");
5311 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
5312 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5313 #pragma GCC diagnostic push
5314 #pragma GCC diagnostic ignored "-Wconversion"
5316 const int neg_one = (int) -1, const_zero = (
int) 0;
5317 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5318 #pragma GCC diagnostic pop
5320 const int is_unsigned = neg_one > const_zero;
5321 #if PY_MAJOR_VERSION < 3
5322 if (likely(PyInt_Check(x))) {
5323 if (
sizeof(
int) <
sizeof(long)) {
5324 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
5326 long val = PyInt_AS_LONG(x);
5327 if (is_unsigned && unlikely(val < 0)) {
5328 goto raise_neg_overflow;
5334 if (likely(PyLong_Check(x))) {
5336 #if CYTHON_USE_PYLONG_INTERNALS
5337 const digit* digits = ((PyLongObject*)x)->ob_digit;
5338 switch (Py_SIZE(x)) {
5339 case 0:
return (
int) 0;
5340 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
5342 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
5343 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
5344 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
5345 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
5346 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
5351 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
5352 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
5353 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
5354 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
5355 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
5360 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
5361 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
5362 __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])))
5363 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
5364 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
5370 #if CYTHON_COMPILING_IN_CPYTHON
5371 if (unlikely(Py_SIZE(x) < 0)) {
5372 goto raise_neg_overflow;
5376 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
5377 if (unlikely(result < 0))
5379 if (unlikely(result == 1))
5380 goto raise_neg_overflow;
5383 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
5384 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
5385 #ifdef HAVE_LONG_LONG
5386 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
5387 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
5391 #if CYTHON_USE_PYLONG_INTERNALS
5392 const digit* digits = ((PyLongObject*)x)->ob_digit;
5393 switch (Py_SIZE(x)) {
5394 case 0:
return (
int) 0;
5395 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
5396 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
5398 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
5399 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
5400 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
5401 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
5402 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
5407 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
5408 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
5409 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
5410 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
5411 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
5416 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
5417 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
5418 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
5419 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
5420 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5425 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
5426 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
5427 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
5428 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
5429 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5434 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
5435 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
5436 __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])))
5437 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
5438 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
5443 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
5444 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
5445 __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])))
5446 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
5447 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
5453 if (
sizeof(
int) <=
sizeof(long)) {
5454 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
5455 #ifdef HAVE_LONG_LONG
5456 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
5457 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
5462 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
5463 PyErr_SetString(PyExc_RuntimeError,
5464 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
5467 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
5468 #if PY_MAJOR_VERSION < 3
5469 if (likely(
v) && !PyLong_Check(
v)) {
5471 v = PyNumber_Long(tmp);
5476 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
5477 unsigned char *bytes = (
unsigned char *)&val;
5478 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
5480 is_little, !is_unsigned);
5490 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
5491 if (!tmp)
return (
int) -1;
5492 val = __Pyx_PyInt_As_int(tmp);
5497 PyErr_SetString(PyExc_OverflowError,
5498 "value too large to convert to int");
5501 PyErr_SetString(PyExc_OverflowError,
5502 "can't convert negative value to int");
5507 #if CYTHON_COMPILING_IN_CPYTHON
5508 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
5514 return b == &PyBaseObject_Type;
5516 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
5518 if (a == b)
return 1;
5522 n = PyTuple_GET_SIZE(mro);
5523 for (i = 0; i <
n; i++) {
5524 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
5529 return __Pyx_InBases(a, b);
5531 #if PY_MAJOR_VERSION == 2
5532 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
5533 PyObject *exception, *value, *tb;
5535 __Pyx_PyThreadState_declare
5536 __Pyx_PyThreadState_assign
5537 __Pyx_ErrFetch(&exception, &value, &tb);
5538 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
5539 if (unlikely(res == -1)) {
5540 PyErr_WriteUnraisable(err);
5544 res = PyObject_IsSubclass(err, exc_type2);
5545 if (unlikely(res == -1)) {
5546 PyErr_WriteUnraisable(err);
5550 __Pyx_ErrRestore(exception, value, tb);
5554 static CYTHON_INLINE
int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
5555 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
5557 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
5562 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
5564 assert(PyExceptionClass_Check(exc_type));
5565 n = PyTuple_GET_SIZE(tuple);
5566 #if PY_MAJOR_VERSION >= 3
5567 for (i=0; i<
n; i++) {
5568 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
5571 for (i=0; i<
n; i++) {
5572 PyObject *t = PyTuple_GET_ITEM(tuple, i);
5573 #if PY_MAJOR_VERSION < 3
5574 if (likely(exc_type == t))
return 1;
5576 if (likely(PyExceptionClass_Check(t))) {
5577 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
5583 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
5584 if (likely(err == exc_type))
return 1;
5585 if (likely(PyExceptionClass_Check(err))) {
5586 if (likely(PyExceptionClass_Check(exc_type))) {
5587 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
5588 }
else if (likely(PyTuple_Check(exc_type))) {
5589 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
5593 return PyErr_GivenExceptionMatches(err, exc_type);
5595 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
5596 assert(PyExceptionClass_Check(exc_type1));
5597 assert(PyExceptionClass_Check(exc_type2));
5598 if (likely(err == exc_type1 || err == exc_type2))
return 1;
5599 if (likely(PyExceptionClass_Check(err))) {
5600 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
5602 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
5607 static int __Pyx_check_binary_version(
void) {
5609 int same=1, i, found_dot;
5610 const char* rt_from_call = Py_GetVersion();
5611 PyOS_snprintf(ctversion, 5,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
5613 for (i = 0; i < 4; i++) {
5614 if (!ctversion[i]) {
5615 same = (rt_from_call[i] <
'0' || rt_from_call[i] >
'9');
5618 if (rt_from_call[i] != ctversion[i]) {
5624 char rtversion[5] = {
'\0'};
5626 for (i=0; i<4; ++i) {
5627 if (rt_from_call[i] ==
'.') {
5628 if (found_dot)
break;
5630 }
else if (rt_from_call[i] <
'0' || rt_from_call[i] >
'9') {
5633 rtversion[i] = rt_from_call[i];
5635 PyOS_snprintf(message,
sizeof(message),
5636 "compiletime version %s of module '%.100s' "
5637 "does not match runtime version %s",
5638 ctversion, __Pyx_MODULE_NAME, rtversion);
5639 return PyErr_WarnEx(NULL, message, 1);
5645 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
5647 #if PY_MAJOR_VERSION < 3
5648 if (t->is_unicode) {
5649 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
5650 }
else if (t->intern) {
5651 *t->p = PyString_InternFromString(t->s);
5653 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
5656 if (t->is_unicode | t->is_str) {
5658 *t->p = PyUnicode_InternFromString(t->s);
5659 }
else if (t->encoding) {
5660 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
5662 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
5665 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
5670 if (PyObject_Hash(*t->p) == -1)
5677 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
5678 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
5680 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
5682 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
5684 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
5685 #if !CYTHON_PEP393_ENABLED
5686 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
5688 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
5689 if (!defenc)
return NULL;
5690 defenc_c = PyBytes_AS_STRING(defenc);
5691 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
5693 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
5695 for (
c = defenc_c;
c < end;
c++) {
5696 if ((
unsigned char) (*
c) >= 128) {
5697 PyUnicode_AsASCIIString(o);
5703 *length = PyBytes_GET_SIZE(defenc);
5707 static CYTHON_INLINE
const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
5708 if (unlikely(__Pyx_PyUnicode_READY(o) == -1))
return NULL;
5709 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
5710 if (likely(PyUnicode_IS_ASCII(o))) {
5711 *length = PyUnicode_GET_LENGTH(o);
5712 return PyUnicode_AsUTF8(o);
5714 PyUnicode_AsASCIIString(o);
5718 return PyUnicode_AsUTF8AndSize(o, length);
5723 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
5724 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
5726 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
5727 __Pyx_sys_getdefaultencoding_not_ascii &&
5729 PyUnicode_Check(o)) {
5730 return __Pyx_PyUnicode_AsStringAndSize(o, length);
5733 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
5734 if (PyByteArray_Check(o)) {
5735 *length = PyByteArray_GET_SIZE(o);
5736 return PyByteArray_AS_STRING(o);
5741 int r = PyBytes_AsStringAndSize(o, &result, length);
5742 if (unlikely(
r < 0)) {
5749 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
5750 int is_true = x == Py_True;
5751 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
5752 else return PyObject_IsTrue(x);
5754 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
5756 if (unlikely(!x))
return -1;
5757 retval = __Pyx_PyObject_IsTrue(x);
5761 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result,
const char* type_name) {
5762 #if PY_MAJOR_VERSION >= 3
5763 if (PyLong_Check(result)) {
5764 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
5765 "__int__ returned non-int (type %.200s). "
5766 "The ability to return an instance of a strict subclass of int "
5767 "is deprecated, and may be removed in a future version of Python.",
5768 Py_TYPE(result)->tp_name)) {
5775 PyErr_Format(PyExc_TypeError,
5776 "__%.4s__ returned non-%.4s (type %.200s)",
5777 type_name, type_name, Py_TYPE(result)->tp_name);
5781 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
5782 #if CYTHON_USE_TYPE_SLOTS
5785 const char *name = NULL;
5786 PyObject *res = NULL;
5787 #if PY_MAJOR_VERSION < 3
5788 if (likely(PyInt_Check(x) || PyLong_Check(x)))
5790 if (likely(PyLong_Check(x)))
5792 return __Pyx_NewRef(x);
5793 #if CYTHON_USE_TYPE_SLOTS
5794 m = Py_TYPE(x)->tp_as_number;
5795 #if PY_MAJOR_VERSION < 3
5796 if (m && m->nb_int) {
5800 else if (m && m->nb_long) {
5802 res = m->nb_long(x);
5805 if (likely(m && m->nb_int)) {
5811 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
5812 res = PyNumber_Int(x);
5816 #if PY_MAJOR_VERSION < 3
5817 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
5819 if (unlikely(!PyLong_CheckExact(res))) {
5821 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
5824 else if (!PyErr_Occurred()) {
5825 PyErr_SetString(PyExc_TypeError,
5826 "an integer is required");
5830 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
5833 #if PY_MAJOR_VERSION < 3
5834 if (likely(PyInt_CheckExact(b))) {
5835 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
5836 return PyInt_AS_LONG(b);
5838 return PyInt_AsSsize_t(b);
5841 if (likely(PyLong_CheckExact(b))) {
5842 #if CYTHON_USE_PYLONG_INTERNALS
5843 const digit* digits = ((PyLongObject*)b)->ob_digit;
5844 const Py_ssize_t size = Py_SIZE(b);
5845 if (likely(__Pyx_sst_abs(size) <= 1)) {
5846 ival = likely(size) ? digits[0] : 0;
5847 if (size == -1) ival = -ival;
5852 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
5853 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
5857 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
5858 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
5862 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
5863 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
5867 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
5868 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
5872 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
5873 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]));
5877 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
5878 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]));
5884 return PyLong_AsSsize_t(b);
5886 x = PyNumber_Index(b);
5888 ival = PyInt_AsSsize_t(x);
5892 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
5893 if (
sizeof(Py_hash_t) ==
sizeof(Py_ssize_t)) {
5894 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
5895 #if PY_MAJOR_VERSION < 3
5896 }
else if (likely(PyInt_CheckExact(o))) {
5897 return PyInt_AS_LONG(o);
5902 x = PyNumber_Index(o);
5904 ival = PyInt_AsLong(x);
5909 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
5910 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
5912 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
5913 return PyInt_FromSize_t(ival);