1 /* Generated by Cython 0.29.12 */
2
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6 #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8 #error Cython requires Python 2.6+ or Python 3.3+.
9 #else
10 #define CYTHON_ABI "0_29_12"
11 #define CYTHON_HEX_VERSION 0x001D0CF0
12 #define CYTHON_FUTURE_DIVISION 0
13 #include <stddef.h>
14 #ifndef offsetof
15 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
16 #endif
17 #if !defined(WIN32) && !defined(MS_WINDOWS)
18 #ifndef __stdcall
19 #define __stdcall
20 #endif
21 #ifndef __cdecl
22 #define __cdecl
23 #endif
24 #ifndef __fastcall
25 #define __fastcall
26 #endif
27 #endif
28 #ifndef DL_IMPORT
29 #define DL_IMPORT(t) t
30 #endif
31 #ifndef DL_EXPORT
32 #define DL_EXPORT(t) t
33 #endif
34 #define __PYX_COMMA ,
35 #ifndef HAVE_LONG_LONG
36 #if PY_VERSION_HEX >= 0x02070000
37 #define HAVE_LONG_LONG
38 #endif
39 #endif
40 #ifndef PY_LONG_LONG
41 #define PY_LONG_LONG LONG_LONG
42 #endif
43 #ifndef Py_HUGE_VAL
44 #define Py_HUGE_VAL HUGE_VAL
45 #endif
46 #ifdef PYPY_VERSION
47 #define CYTHON_COMPILING_IN_PYPY 1
48 #define CYTHON_COMPILING_IN_PYSTON 0
49 #define CYTHON_COMPILING_IN_CPYTHON 0
50 #undef CYTHON_USE_TYPE_SLOTS
51 #define CYTHON_USE_TYPE_SLOTS 0
52 #undef CYTHON_USE_PYTYPE_LOOKUP
53 #define CYTHON_USE_PYTYPE_LOOKUP 0
54 #if PY_VERSION_HEX < 0x03050000
55 #undef CYTHON_USE_ASYNC_SLOTS
56 #define CYTHON_USE_ASYNC_SLOTS 0
57 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
58 #define CYTHON_USE_ASYNC_SLOTS 1
59 #endif
60 #undef CYTHON_USE_PYLIST_INTERNALS
61 #define CYTHON_USE_PYLIST_INTERNALS 0
62 #undef CYTHON_USE_UNICODE_INTERNALS
63 #define CYTHON_USE_UNICODE_INTERNALS 0
64 #undef CYTHON_USE_UNICODE_WRITER
65 #define CYTHON_USE_UNICODE_WRITER 0
66 #undef CYTHON_USE_PYLONG_INTERNALS
67 #define CYTHON_USE_PYLONG_INTERNALS 0
68 #undef CYTHON_AVOID_BORROWED_REFS
69 #define CYTHON_AVOID_BORROWED_REFS 1
70 #undef CYTHON_ASSUME_SAFE_MACROS
71 #define CYTHON_ASSUME_SAFE_MACROS 0
72 #undef CYTHON_UNPACK_METHODS
73 #define CYTHON_UNPACK_METHODS 0
74 #undef CYTHON_FAST_THREAD_STATE
75 #define CYTHON_FAST_THREAD_STATE 0
76 #undef CYTHON_FAST_PYCALL
77 #define CYTHON_FAST_PYCALL 0
78 #undef CYTHON_PEP489_MULTI_PHASE_INIT
79 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
80 #undef CYTHON_USE_TP_FINALIZE
81 #define CYTHON_USE_TP_FINALIZE 0
82 #undef CYTHON_USE_DICT_VERSIONS
83 #define CYTHON_USE_DICT_VERSIONS 0
84 #undef CYTHON_USE_EXC_INFO_STACK
85 #define CYTHON_USE_EXC_INFO_STACK 0
86 #elif defined(PYSTON_VERSION)
87 #define CYTHON_COMPILING_IN_PYPY 0
88 #define CYTHON_COMPILING_IN_PYSTON 1
89 #define CYTHON_COMPILING_IN_CPYTHON 0
90 #ifndef CYTHON_USE_TYPE_SLOTS
91 #define CYTHON_USE_TYPE_SLOTS 1
92 #endif
93 #undef CYTHON_USE_PYTYPE_LOOKUP
94 #define CYTHON_USE_PYTYPE_LOOKUP 0
95 #undef CYTHON_USE_ASYNC_SLOTS
96 #define CYTHON_USE_ASYNC_SLOTS 0
97 #undef CYTHON_USE_PYLIST_INTERNALS
98 #define CYTHON_USE_PYLIST_INTERNALS 0
99 #ifndef CYTHON_USE_UNICODE_INTERNALS
100 #define CYTHON_USE_UNICODE_INTERNALS 1
101 #endif
102 #undef CYTHON_USE_UNICODE_WRITER
103 #define CYTHON_USE_UNICODE_WRITER 0
104 #undef CYTHON_USE_PYLONG_INTERNALS
105 #define CYTHON_USE_PYLONG_INTERNALS 0
106 #ifndef CYTHON_AVOID_BORROWED_REFS
107 #define CYTHON_AVOID_BORROWED_REFS 0
108 #endif
109 #ifndef CYTHON_ASSUME_SAFE_MACROS
110 #define CYTHON_ASSUME_SAFE_MACROS 1
111 #endif
112 #ifndef CYTHON_UNPACK_METHODS
113 #define CYTHON_UNPACK_METHODS 1
114 #endif
115 #undef CYTHON_FAST_THREAD_STATE
116 #define CYTHON_FAST_THREAD_STATE 0
117 #undef CYTHON_FAST_PYCALL
118 #define CYTHON_FAST_PYCALL 0
119 #undef CYTHON_PEP489_MULTI_PHASE_INIT
120 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
121 #undef CYTHON_USE_TP_FINALIZE
122 #define CYTHON_USE_TP_FINALIZE 0
123 #undef CYTHON_USE_DICT_VERSIONS
124 #define CYTHON_USE_DICT_VERSIONS 0
125 #undef CYTHON_USE_EXC_INFO_STACK
126 #define CYTHON_USE_EXC_INFO_STACK 0
127 #else
128 #define CYTHON_COMPILING_IN_PYPY 0
129 #define CYTHON_COMPILING_IN_PYSTON 0
130 #define CYTHON_COMPILING_IN_CPYTHON 1
131 #ifndef CYTHON_USE_TYPE_SLOTS
132 #define CYTHON_USE_TYPE_SLOTS 1
133 #endif
134 #if PY_VERSION_HEX < 0x02070000
135 #undef CYTHON_USE_PYTYPE_LOOKUP
136 #define CYTHON_USE_PYTYPE_LOOKUP 0
137 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
138 #define CYTHON_USE_PYTYPE_LOOKUP 1
139 #endif
140 #if PY_MAJOR_VERSION < 3
141 #undef CYTHON_USE_ASYNC_SLOTS
142 #define CYTHON_USE_ASYNC_SLOTS 0
143 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
144 #define CYTHON_USE_ASYNC_SLOTS 1
145 #endif
146 #if PY_VERSION_HEX < 0x02070000
147 #undef CYTHON_USE_PYLONG_INTERNALS
148 #define CYTHON_USE_PYLONG_INTERNALS 0
149 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
150 #define CYTHON_USE_PYLONG_INTERNALS 1
151 #endif
152 #ifndef CYTHON_USE_PYLIST_INTERNALS
153 #define CYTHON_USE_PYLIST_INTERNALS 1
154 #endif
155 #ifndef CYTHON_USE_UNICODE_INTERNALS
156 #define CYTHON_USE_UNICODE_INTERNALS 1
157 #endif
158 #if PY_VERSION_HEX < 0x030300F0
159 #undef CYTHON_USE_UNICODE_WRITER
160 #define CYTHON_USE_UNICODE_WRITER 0
161 #elif !defined(CYTHON_USE_UNICODE_WRITER)
162 #define CYTHON_USE_UNICODE_WRITER 1
163 #endif
164 #ifndef CYTHON_AVOID_BORROWED_REFS
165 #define CYTHON_AVOID_BORROWED_REFS 0
166 #endif
167 #ifndef CYTHON_ASSUME_SAFE_MACROS
168 #define CYTHON_ASSUME_SAFE_MACROS 1
169 #endif
170 #ifndef CYTHON_UNPACK_METHODS
171 #define CYTHON_UNPACK_METHODS 1
172 #endif
173 #ifndef CYTHON_FAST_THREAD_STATE
174 #define CYTHON_FAST_THREAD_STATE 1
175 #endif
176 #ifndef CYTHON_FAST_PYCALL
177 #define CYTHON_FAST_PYCALL 1
178 #endif
179 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
180 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
181 #endif
182 #ifndef CYTHON_USE_TP_FINALIZE
183 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
184 #endif
185 #ifndef CYTHON_USE_DICT_VERSIONS
186 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
187 #endif
188 #ifndef CYTHON_USE_EXC_INFO_STACK
189 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
190 #endif
191 #endif
192 #if !defined(CYTHON_FAST_PYCCALL)
193 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
194 #endif
195 #if CYTHON_USE_PYLONG_INTERNALS
196 #include "longintrepr.h"
197 #undef SHIFT
198 #undef BASE
199 #undef MASK
200 #ifdef SIZEOF_VOID_P
201 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
202 #endif
203 #endif
204 #ifndef __has_attribute
205 #define __has_attribute(x) 0
206 #endif
207 #ifndef __has_cpp_attribute
208 #define __has_cpp_attribute(x) 0
209 #endif
210 #ifndef CYTHON_RESTRICT
211 #if defined(__GNUC__)
212 #define CYTHON_RESTRICT __restrict__
213 #elif defined(_MSC_VER) && _MSC_VER >= 1400
214 #define CYTHON_RESTRICT __restrict
215 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
216 #define CYTHON_RESTRICT restrict
217 #else
218 #define CYTHON_RESTRICT
219 #endif
220 #endif
221 #ifndef CYTHON_UNUSED
222 # if defined(__GNUC__)
223 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
224 # define CYTHON_UNUSED __attribute__ ((__unused__))
225 # else
226 # define CYTHON_UNUSED
227 # endif
228 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
229 # define CYTHON_UNUSED __attribute__ ((__unused__))
230 # else
231 # define CYTHON_UNUSED
232 # endif
233 #endif
234 #ifndef CYTHON_MAYBE_UNUSED_VAR
235 # if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)236 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
237 # else
238 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
239 # endif
240 #endif
241 #ifndef CYTHON_NCP_UNUSED
242 # if CYTHON_COMPILING_IN_CPYTHON
243 # define CYTHON_NCP_UNUSED
244 # else
245 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
246 # endif
247 #endif
248 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
249 #ifdef _MSC_VER
250 #ifndef _MSC_STDINT_H_
251 #if _MSC_VER < 1300
252 typedef unsigned char uint8_t;
253 typedef unsigned int uint32_t;
254 #else
255 typedef unsigned __int8 uint8_t;
256 typedef unsigned __int32 uint32_t;
257 #endif
258 #endif
259 #else
260 #include <stdint.h>
261 #endif
262 #ifndef CYTHON_FALLTHROUGH
263 #if defined(__cplusplus) && __cplusplus >= 201103L
264 #if __has_cpp_attribute(fallthrough)
265 #define CYTHON_FALLTHROUGH [[fallthrough]]
266 #elif __has_cpp_attribute(clang::fallthrough)
267 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
268 #elif __has_cpp_attribute(gnu::fallthrough)
269 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
270 #endif
271 #endif
272 #ifndef CYTHON_FALLTHROUGH
273 #if __has_attribute(fallthrough)
274 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
275 #else
276 #define CYTHON_FALLTHROUGH
277 #endif
278 #endif
279 #if defined(__clang__ ) && defined(__apple_build_version__)
280 #if __apple_build_version__ < 7000000
281 #undef CYTHON_FALLTHROUGH
282 #define CYTHON_FALLTHROUGH
283 #endif
284 #endif
285 #endif
286
287 #ifndef __cplusplus
288 #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
289 #endif
290 #ifndef CYTHON_INLINE
291 #if defined(__clang__)
292 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
293 #else
294 #define CYTHON_INLINE inline
295 #endif
296 #endif
297 template<typename T>
__Pyx_call_destructor(T & x)298 void __Pyx_call_destructor(T& x) {
299 x.~T();
300 }
301 template<typename T>
302 class __Pyx_FakeReference {
303 public:
__Pyx_FakeReference()304 __Pyx_FakeReference() : ptr(NULL) { }
__Pyx_FakeReference(const T & ref)305 __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
operator ->()306 T *operator->() { return ptr; }
operator &()307 T *operator&() { return ptr; }
operator T&()308 operator T&() { return *ptr; }
operator ==(U other)309 template<typename U> bool operator ==(U other) { return *ptr == other; }
operator !=(U other)310 template<typename U> bool operator !=(U other) { return *ptr != other; }
311 private:
312 T *ptr;
313 };
314
315 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
316 #define Py_OptimizeFlag 0
317 #endif
318 #define __PYX_BUILD_PY_SSIZE_T "n"
319 #define CYTHON_FORMAT_SSIZE_T "z"
320 #if PY_MAJOR_VERSION < 3
321 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
322 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
323 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
324 #define __Pyx_DefaultClassType PyClass_Type
325 #else
326 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
327 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
328 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
329 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
330 #else
331 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
332 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
333 #endif
334 #define __Pyx_DefaultClassType PyType_Type
335 #endif
336 #ifndef Py_TPFLAGS_CHECKTYPES
337 #define Py_TPFLAGS_CHECKTYPES 0
338 #endif
339 #ifndef Py_TPFLAGS_HAVE_INDEX
340 #define Py_TPFLAGS_HAVE_INDEX 0
341 #endif
342 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
343 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
344 #endif
345 #ifndef Py_TPFLAGS_HAVE_FINALIZE
346 #define Py_TPFLAGS_HAVE_FINALIZE 0
347 #endif
348 #ifndef METH_STACKLESS
349 #define METH_STACKLESS 0
350 #endif
351 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
352 #ifndef METH_FASTCALL
353 #define METH_FASTCALL 0x80
354 #endif
355 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
356 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
357 Py_ssize_t nargs, PyObject *kwnames);
358 #else
359 #define __Pyx_PyCFunctionFast _PyCFunctionFast
360 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
361 #endif
362 #if CYTHON_FAST_PYCCALL
363 #define __Pyx_PyFastCFunction_Check(func)\
364 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
365 #else
366 #define __Pyx_PyFastCFunction_Check(func) 0
367 #endif
368 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
369 #define PyObject_Malloc(s) PyMem_Malloc(s)
370 #define PyObject_Free(p) PyMem_Free(p)
371 #define PyObject_Realloc(p) PyMem_Realloc(p)
372 #endif
373 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
374 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
375 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
376 #define PyMem_RawFree(p) PyMem_Free(p)
377 #endif
378 #if CYTHON_COMPILING_IN_PYSTON
379 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
380 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
381 #else
382 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
383 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
384 #endif
385 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
386 #define __Pyx_PyThreadState_Current PyThreadState_GET()
387 #elif PY_VERSION_HEX >= 0x03060000
388 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
389 #elif PY_VERSION_HEX >= 0x03000000
390 #define __Pyx_PyThreadState_Current PyThreadState_GET()
391 #else
392 #define __Pyx_PyThreadState_Current _PyThreadState_Current
393 #endif
394 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
395 #include "pythread.h"
396 #define Py_tss_NEEDS_INIT 0
397 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)398 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
399 *key = PyThread_create_key();
400 return 0;
401 }
PyThread_tss_alloc(void)402 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
403 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
404 *key = Py_tss_NEEDS_INIT;
405 return key;
406 }
PyThread_tss_free(Py_tss_t * key)407 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
408 PyObject_Free(key);
409 }
PyThread_tss_is_created(Py_tss_t * key)410 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
411 return *key != Py_tss_NEEDS_INIT;
412 }
PyThread_tss_delete(Py_tss_t * key)413 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
414 PyThread_delete_key(*key);
415 *key = Py_tss_NEEDS_INIT;
416 }
PyThread_tss_set(Py_tss_t * key,void * value)417 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
418 return PyThread_set_key_value(*key, value);
419 }
PyThread_tss_get(Py_tss_t * key)420 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
421 return PyThread_get_key_value(*key);
422 }
423 #endif
424 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
425 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
426 #else
427 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
428 #endif
429 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
430 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
431 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
432 #else
433 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
434 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
435 #endif
436 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
437 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
438 #else
439 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
440 #endif
441 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
442 #define CYTHON_PEP393_ENABLED 1
443 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
444 0 : _PyUnicode_Ready((PyObject *)(op)))
445 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
446 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
447 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
448 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
449 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
450 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
451 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
452 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
453 #else
454 #define CYTHON_PEP393_ENABLED 0
455 #define PyUnicode_1BYTE_KIND 1
456 #define PyUnicode_2BYTE_KIND 2
457 #define PyUnicode_4BYTE_KIND 4
458 #define __Pyx_PyUnicode_READY(op) (0)
459 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
460 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
461 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
462 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
463 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
464 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
465 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
466 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
467 #endif
468 #if CYTHON_COMPILING_IN_PYPY
469 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
470 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
471 #else
472 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
473 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
474 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
475 #endif
476 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
477 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
478 #endif
479 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
480 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
481 #endif
482 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
483 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
484 #endif
485 #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))
486 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
487 #if PY_MAJOR_VERSION >= 3
488 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
489 #else
490 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
491 #endif
492 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
493 #define PyObject_ASCII(o) PyObject_Repr(o)
494 #endif
495 #if PY_MAJOR_VERSION >= 3
496 #define PyBaseString_Type PyUnicode_Type
497 #define PyStringObject PyUnicodeObject
498 #define PyString_Type PyUnicode_Type
499 #define PyString_Check PyUnicode_Check
500 #define PyString_CheckExact PyUnicode_CheckExact
501 #define PyObject_Unicode PyObject_Str
502 #endif
503 #if PY_MAJOR_VERSION >= 3
504 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
505 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
506 #else
507 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
508 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
509 #endif
510 #ifndef PySet_CheckExact
511 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
512 #endif
513 #if CYTHON_ASSUME_SAFE_MACROS
514 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
515 #else
516 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
517 #endif
518 #if PY_MAJOR_VERSION >= 3
519 #define PyIntObject PyLongObject
520 #define PyInt_Type PyLong_Type
521 #define PyInt_Check(op) PyLong_Check(op)
522 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
523 #define PyInt_FromString PyLong_FromString
524 #define PyInt_FromUnicode PyLong_FromUnicode
525 #define PyInt_FromLong PyLong_FromLong
526 #define PyInt_FromSize_t PyLong_FromSize_t
527 #define PyInt_FromSsize_t PyLong_FromSsize_t
528 #define PyInt_AsLong PyLong_AsLong
529 #define PyInt_AS_LONG PyLong_AS_LONG
530 #define PyInt_AsSsize_t PyLong_AsSsize_t
531 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
532 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
533 #define PyNumber_Int PyNumber_Long
534 #endif
535 #if PY_MAJOR_VERSION >= 3
536 #define PyBoolObject PyLongObject
537 #endif
538 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
539 #ifndef PyUnicode_InternFromString
540 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
541 #endif
542 #endif
543 #if PY_VERSION_HEX < 0x030200A4
544 typedef long Py_hash_t;
545 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
546 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
547 #else
548 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
549 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
550 #endif
551 #if PY_MAJOR_VERSION >= 3
552 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
553 #else
554 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
555 #endif
556 #if CYTHON_USE_ASYNC_SLOTS
557 #if PY_VERSION_HEX >= 0x030500B1
558 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
559 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
560 #else
561 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
562 #endif
563 #else
564 #define __Pyx_PyType_AsAsync(obj) NULL
565 #endif
566 #ifndef __Pyx_PyAsyncMethodsStruct
567 typedef struct {
568 unaryfunc am_await;
569 unaryfunc am_aiter;
570 unaryfunc am_anext;
571 } __Pyx_PyAsyncMethodsStruct;
572 #endif
573
574 #if defined(WIN32) || defined(MS_WINDOWS)
575 #define _USE_MATH_DEFINES
576 #endif
577 #include <math.h>
578 #ifdef NAN
579 #define __PYX_NAN() ((float) NAN)
580 #else
__PYX_NAN()581 static CYTHON_INLINE float __PYX_NAN() {
582 float value;
583 memset(&value, 0xFF, sizeof(value));
584 return value;
585 }
586 #endif
587 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
588 #define __Pyx_truncl trunc
589 #else
590 #define __Pyx_truncl truncl
591 #endif
592
593
594 #define __PYX_ERR(f_index, lineno, Ln_error) \
595 { \
596 __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
597 }
598
599 #ifndef __PYX_EXTERN_C
600 #ifdef __cplusplus
601 #define __PYX_EXTERN_C extern "C"
602 #else
603 #define __PYX_EXTERN_C extern
604 #endif
605 #endif
606
607 #define __PYX_HAVE__cylp__cy__CyOsiCuts
608 #define __PYX_HAVE_API__cylp__cy__CyOsiCuts
609 /* Early includes */
610 #include <string.h>
611 #include <stdio.h>
612 #include "numpy/arrayobject.h"
613 #include "numpy/ufuncobject.h"
614 #include "IOsiCuts.hpp"
615 #ifdef _OPENMP
616 #include <omp.h>
617 #endif /* _OPENMP */
618
619 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
620 #define CYTHON_WITHOUT_ASSERTIONS
621 #endif
622
623 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
624 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
625
626 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
627 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
628 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
629 #define __PYX_DEFAULT_STRING_ENCODING ""
630 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
631 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
632 #define __Pyx_uchar_cast(c) ((unsigned char)c)
633 #define __Pyx_long_cast(x) ((long)x)
634 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
635 (sizeof(type) < sizeof(Py_ssize_t)) ||\
636 (sizeof(type) > sizeof(Py_ssize_t) &&\
637 likely(v < (type)PY_SSIZE_T_MAX ||\
638 v == (type)PY_SSIZE_T_MAX) &&\
639 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
640 v == (type)PY_SSIZE_T_MIN))) ||\
641 (sizeof(type) == sizeof(Py_ssize_t) &&\
642 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
643 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)644 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
645 return (size_t) i < (size_t) limit;
646 }
647 #if defined (__cplusplus) && __cplusplus >= 201103L
648 #include <cstdlib>
649 #define __Pyx_sst_abs(value) std::abs(value)
650 #elif SIZEOF_INT >= SIZEOF_SIZE_T
651 #define __Pyx_sst_abs(value) abs(value)
652 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
653 #define __Pyx_sst_abs(value) labs(value)
654 #elif defined (_MSC_VER)
655 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
656 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
657 #define __Pyx_sst_abs(value) llabs(value)
658 #elif defined (__GNUC__)
659 #define __Pyx_sst_abs(value) __builtin_llabs(value)
660 #else
661 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
662 #endif
663 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
664 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
665 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
666 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
667 #define __Pyx_PyBytes_FromString PyBytes_FromString
668 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
669 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
670 #if PY_MAJOR_VERSION < 3
671 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
672 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
673 #else
674 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
675 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
676 #endif
677 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
678 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
679 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
680 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
681 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
682 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
683 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
684 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
685 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
686 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
687 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
688 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
689 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
690 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
691 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
692 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)693 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
694 const Py_UNICODE *u_end = u;
695 while (*u_end++) ;
696 return (size_t)(u_end - u - 1);
697 }
698 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
699 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
700 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
701 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
702 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
703 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
704 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
705 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
706 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
707 #define __Pyx_PySequence_Tuple(obj)\
708 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
709 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
710 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
711 #if CYTHON_ASSUME_SAFE_MACROS
712 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
713 #else
714 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
715 #endif
716 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
717 #if PY_MAJOR_VERSION >= 3
718 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
719 #else
720 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
721 #endif
722 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
723 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
724 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)725 static int __Pyx_init_sys_getdefaultencoding_params(void) {
726 PyObject* sys;
727 PyObject* default_encoding = NULL;
728 PyObject* ascii_chars_u = NULL;
729 PyObject* ascii_chars_b = NULL;
730 const char* default_encoding_c;
731 sys = PyImport_ImportModule("sys");
732 if (!sys) goto bad;
733 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
734 Py_DECREF(sys);
735 if (!default_encoding) goto bad;
736 default_encoding_c = PyBytes_AsString(default_encoding);
737 if (!default_encoding_c) goto bad;
738 if (strcmp(default_encoding_c, "ascii") == 0) {
739 __Pyx_sys_getdefaultencoding_not_ascii = 0;
740 } else {
741 char ascii_chars[128];
742 int c;
743 for (c = 0; c < 128; c++) {
744 ascii_chars[c] = c;
745 }
746 __Pyx_sys_getdefaultencoding_not_ascii = 1;
747 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
748 if (!ascii_chars_u) goto bad;
749 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
750 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
751 PyErr_Format(
752 PyExc_ValueError,
753 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
754 default_encoding_c);
755 goto bad;
756 }
757 Py_DECREF(ascii_chars_u);
758 Py_DECREF(ascii_chars_b);
759 }
760 Py_DECREF(default_encoding);
761 return 0;
762 bad:
763 Py_XDECREF(default_encoding);
764 Py_XDECREF(ascii_chars_u);
765 Py_XDECREF(ascii_chars_b);
766 return -1;
767 }
768 #endif
769 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
770 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
771 #else
772 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
773 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
774 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)775 static int __Pyx_init_sys_getdefaultencoding_params(void) {
776 PyObject* sys;
777 PyObject* default_encoding = NULL;
778 char* default_encoding_c;
779 sys = PyImport_ImportModule("sys");
780 if (!sys) goto bad;
781 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
782 Py_DECREF(sys);
783 if (!default_encoding) goto bad;
784 default_encoding_c = PyBytes_AsString(default_encoding);
785 if (!default_encoding_c) goto bad;
786 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
787 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
788 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
789 Py_DECREF(default_encoding);
790 return 0;
791 bad:
792 Py_XDECREF(default_encoding);
793 return -1;
794 }
795 #endif
796 #endif
797
798
799 /* Test for GCC > 2.95 */
800 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
801 #define likely(x) __builtin_expect(!!(x), 1)
802 #define unlikely(x) __builtin_expect(!!(x), 0)
803 #else /* !__GNUC__ or GCC < 2.95 */
804 #define likely(x) (x)
805 #define unlikely(x) (x)
806 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)807 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
808
809 static PyObject *__pyx_m = NULL;
810 static PyObject *__pyx_d;
811 static PyObject *__pyx_b;
812 static PyObject *__pyx_cython_runtime = NULL;
813 static PyObject *__pyx_empty_tuple;
814 static PyObject *__pyx_empty_bytes;
815 static PyObject *__pyx_empty_unicode;
816 static int __pyx_lineno;
817 static int __pyx_clineno = 0;
818 static const char * __pyx_cfilenm= __FILE__;
819 static const char *__pyx_filename;
820
821 /* Header.proto */
822 #if !defined(CYTHON_CCOMPLEX)
823 #if defined(__cplusplus)
824 #define CYTHON_CCOMPLEX 1
825 #elif defined(_Complex_I)
826 #define CYTHON_CCOMPLEX 1
827 #else
828 #define CYTHON_CCOMPLEX 0
829 #endif
830 #endif
831 #if CYTHON_CCOMPLEX
832 #ifdef __cplusplus
833 #include <complex>
834 #else
835 #include <complex.h>
836 #endif
837 #endif
838 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
839 #undef _Complex_I
840 #define _Complex_I 1.0fj
841 #endif
842
843
844 static const char *__pyx_f[] = {
845 "cylp\\cy\\CyOsiCuts.pyx",
846 "stringsource",
847 "__init__.pxd",
848 "type.pxd",
849 };
850 /* BufferFormatStructs.proto */
851 #define IS_UNSIGNED(type) (((type) -1) > 0)
852 struct __Pyx_StructField_;
853 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
854 typedef struct {
855 const char* name;
856 struct __Pyx_StructField_* fields;
857 size_t size;
858 size_t arraysize[8];
859 int ndim;
860 char typegroup;
861 char is_unsigned;
862 int flags;
863 } __Pyx_TypeInfo;
864 typedef struct __Pyx_StructField_ {
865 __Pyx_TypeInfo* type;
866 const char* name;
867 size_t offset;
868 } __Pyx_StructField;
869 typedef struct {
870 __Pyx_StructField* field;
871 size_t parent_offset;
872 } __Pyx_BufFmt_StackElem;
873 typedef struct {
874 __Pyx_StructField root;
875 __Pyx_BufFmt_StackElem* head;
876 size_t fmt_offset;
877 size_t new_count, enc_count;
878 size_t struct_alignment;
879 int is_complex;
880 char enc_type;
881 char new_packmode;
882 char enc_packmode;
883 char is_valid_array;
884 } __Pyx_BufFmt_Context;
885
886
887 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":776
888 * # in Cython to enable them only on the right systems.
889 *
890 * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
891 * ctypedef npy_int16 int16_t
892 * ctypedef npy_int32 int32_t
893 */
894 typedef npy_int8 __pyx_t_5numpy_int8_t;
895
896 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":777
897 *
898 * ctypedef npy_int8 int8_t
899 * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
900 * ctypedef npy_int32 int32_t
901 * ctypedef npy_int64 int64_t
902 */
903 typedef npy_int16 __pyx_t_5numpy_int16_t;
904
905 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":778
906 * ctypedef npy_int8 int8_t
907 * ctypedef npy_int16 int16_t
908 * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
909 * ctypedef npy_int64 int64_t
910 * #ctypedef npy_int96 int96_t
911 */
912 typedef npy_int32 __pyx_t_5numpy_int32_t;
913
914 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":779
915 * ctypedef npy_int16 int16_t
916 * ctypedef npy_int32 int32_t
917 * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
918 * #ctypedef npy_int96 int96_t
919 * #ctypedef npy_int128 int128_t
920 */
921 typedef npy_int64 __pyx_t_5numpy_int64_t;
922
923 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":783
924 * #ctypedef npy_int128 int128_t
925 *
926 * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
927 * ctypedef npy_uint16 uint16_t
928 * ctypedef npy_uint32 uint32_t
929 */
930 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
931
932 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":784
933 *
934 * ctypedef npy_uint8 uint8_t
935 * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
936 * ctypedef npy_uint32 uint32_t
937 * ctypedef npy_uint64 uint64_t
938 */
939 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
940
941 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":785
942 * ctypedef npy_uint8 uint8_t
943 * ctypedef npy_uint16 uint16_t
944 * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
945 * ctypedef npy_uint64 uint64_t
946 * #ctypedef npy_uint96 uint96_t
947 */
948 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
949
950 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":786
951 * ctypedef npy_uint16 uint16_t
952 * ctypedef npy_uint32 uint32_t
953 * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
954 * #ctypedef npy_uint96 uint96_t
955 * #ctypedef npy_uint128 uint128_t
956 */
957 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
958
959 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":790
960 * #ctypedef npy_uint128 uint128_t
961 *
962 * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
963 * ctypedef npy_float64 float64_t
964 * #ctypedef npy_float80 float80_t
965 */
966 typedef npy_float32 __pyx_t_5numpy_float32_t;
967
968 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":791
969 *
970 * ctypedef npy_float32 float32_t
971 * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
972 * #ctypedef npy_float80 float80_t
973 * #ctypedef npy_float128 float128_t
974 */
975 typedef npy_float64 __pyx_t_5numpy_float64_t;
976
977 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":800
978 * # The int types are mapped a bit surprising --
979 * # numpy.int corresponds to 'l' and numpy.long to 'q'
980 * ctypedef npy_long int_t # <<<<<<<<<<<<<<
981 * ctypedef npy_longlong long_t
982 * ctypedef npy_longlong longlong_t
983 */
984 typedef npy_long __pyx_t_5numpy_int_t;
985
986 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":801
987 * # numpy.int corresponds to 'l' and numpy.long to 'q'
988 * ctypedef npy_long int_t
989 * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
990 * ctypedef npy_longlong longlong_t
991 *
992 */
993 typedef npy_longlong __pyx_t_5numpy_long_t;
994
995 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":802
996 * ctypedef npy_long int_t
997 * ctypedef npy_longlong long_t
998 * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
999 *
1000 * ctypedef npy_ulong uint_t
1001 */
1002 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1003
1004 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":804
1005 * ctypedef npy_longlong longlong_t
1006 *
1007 * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1008 * ctypedef npy_ulonglong ulong_t
1009 * ctypedef npy_ulonglong ulonglong_t
1010 */
1011 typedef npy_ulong __pyx_t_5numpy_uint_t;
1012
1013 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":805
1014 *
1015 * ctypedef npy_ulong uint_t
1016 * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1017 * ctypedef npy_ulonglong ulonglong_t
1018 *
1019 */
1020 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1021
1022 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":806
1023 * ctypedef npy_ulong uint_t
1024 * ctypedef npy_ulonglong ulong_t
1025 * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1026 *
1027 * ctypedef npy_intp intp_t
1028 */
1029 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1030
1031 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":808
1032 * ctypedef npy_ulonglong ulonglong_t
1033 *
1034 * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1035 * ctypedef npy_uintp uintp_t
1036 *
1037 */
1038 typedef npy_intp __pyx_t_5numpy_intp_t;
1039
1040 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":809
1041 *
1042 * ctypedef npy_intp intp_t
1043 * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1044 *
1045 * ctypedef npy_double float_t
1046 */
1047 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1048
1049 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":811
1050 * ctypedef npy_uintp uintp_t
1051 *
1052 * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1053 * ctypedef npy_double double_t
1054 * ctypedef npy_longdouble longdouble_t
1055 */
1056 typedef npy_double __pyx_t_5numpy_float_t;
1057
1058 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":812
1059 *
1060 * ctypedef npy_double float_t
1061 * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1062 * ctypedef npy_longdouble longdouble_t
1063 *
1064 */
1065 typedef npy_double __pyx_t_5numpy_double_t;
1066
1067 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":813
1068 * ctypedef npy_double float_t
1069 * ctypedef npy_double double_t
1070 * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1071 *
1072 * ctypedef npy_cfloat cfloat_t
1073 */
1074 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1075 /* Declarations.proto */
1076 #if CYTHON_CCOMPLEX
1077 #ifdef __cplusplus
1078 typedef ::std::complex< float > __pyx_t_float_complex;
1079 #else
1080 typedef float _Complex __pyx_t_float_complex;
1081 #endif
1082 #else
1083 typedef struct { float real, imag; } __pyx_t_float_complex;
1084 #endif
1085 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1086
1087 /* Declarations.proto */
1088 #if CYTHON_CCOMPLEX
1089 #ifdef __cplusplus
1090 typedef ::std::complex< double > __pyx_t_double_complex;
1091 #else
1092 typedef double _Complex __pyx_t_double_complex;
1093 #endif
1094 #else
1095 typedef struct { double real, imag; } __pyx_t_double_complex;
1096 #endif
1097 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1098
1099
1100 /*--- Type declarations ---*/
1101 struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts;
1102
1103 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":815
1104 * ctypedef npy_longdouble longdouble_t
1105 *
1106 * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1107 * ctypedef npy_cdouble cdouble_t
1108 * ctypedef npy_clongdouble clongdouble_t
1109 */
1110 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1111
1112 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":816
1113 *
1114 * ctypedef npy_cfloat cfloat_t
1115 * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1116 * ctypedef npy_clongdouble clongdouble_t
1117 *
1118 */
1119 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1120
1121 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":817
1122 * ctypedef npy_cfloat cfloat_t
1123 * ctypedef npy_cdouble cdouble_t
1124 * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1125 *
1126 * ctypedef npy_cdouble complex_t
1127 */
1128 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1129
1130 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":819
1131 * ctypedef npy_clongdouble clongdouble_t
1132 *
1133 * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1134 *
1135 * cdef inline object PyArray_MultiIterNew1(a):
1136 */
1137 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1138
1139 /* "cylp/cy/CyOsiCuts.pxd":19
1140 *
1141 *
1142 * cdef class CyOsiCuts: # <<<<<<<<<<<<<<
1143 * cdef CppOsiCuts* CppSelf
1144 * cdef setCppSelf(self, CppOsiCuts* s)
1145 */
1146 struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts {
1147 PyObject_HEAD
1148 struct __pyx_vtabstruct_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_vtab;
1149 CppOsiCuts *CppSelf;
1150 };
1151
1152
1153
1154 /* "cylp/cy/CyOsiCuts.pyx":8
1155 * import numpy as np
1156 *
1157 * cdef class CyOsiCuts: # <<<<<<<<<<<<<<
1158 * 'CyOsiCuts documentation'
1159 * def __cinit__(self):
1160 */
1161
1162 struct __pyx_vtabstruct_4cylp_2cy_9CyOsiCuts_CyOsiCuts {
1163 PyObject *(*setCppSelf)(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *, CppOsiCuts *);
1164 };
1165 static struct __pyx_vtabstruct_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_vtabptr_4cylp_2cy_9CyOsiCuts_CyOsiCuts;
1166
1167 /* --- Runtime support code (head) --- */
1168 /* Refnanny.proto */
1169 #ifndef CYTHON_REFNANNY
1170 #define CYTHON_REFNANNY 0
1171 #endif
1172 #if CYTHON_REFNANNY
1173 typedef struct {
1174 void (*INCREF)(void*, PyObject*, int);
1175 void (*DECREF)(void*, PyObject*, int);
1176 void (*GOTREF)(void*, PyObject*, int);
1177 void (*GIVEREF)(void*, PyObject*, int);
1178 void* (*SetupContext)(const char*, int, const char*);
1179 void (*FinishContext)(void**);
1180 } __Pyx_RefNannyAPIStruct;
1181 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1182 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1183 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1184 #ifdef WITH_THREAD
1185 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1186 if (acquire_gil) {\
1187 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1188 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1189 PyGILState_Release(__pyx_gilstate_save);\
1190 } else {\
1191 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1192 }
1193 #else
1194 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1195 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1196 #endif
1197 #define __Pyx_RefNannyFinishContext()\
1198 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1199 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1200 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1201 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1202 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1203 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1204 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1205 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1206 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1207 #else
1208 #define __Pyx_RefNannyDeclarations
1209 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1210 #define __Pyx_RefNannyFinishContext()
1211 #define __Pyx_INCREF(r) Py_INCREF(r)
1212 #define __Pyx_DECREF(r) Py_DECREF(r)
1213 #define __Pyx_GOTREF(r)
1214 #define __Pyx_GIVEREF(r)
1215 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1216 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1217 #define __Pyx_XGOTREF(r)
1218 #define __Pyx_XGIVEREF(r)
1219 #endif
1220 #define __Pyx_XDECREF_SET(r, v) do {\
1221 PyObject *tmp = (PyObject *) r;\
1222 r = v; __Pyx_XDECREF(tmp);\
1223 } while (0)
1224 #define __Pyx_DECREF_SET(r, v) do {\
1225 PyObject *tmp = (PyObject *) r;\
1226 r = v; __Pyx_DECREF(tmp);\
1227 } while (0)
1228 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1229 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1230
1231 /* PyObjectGetAttrStr.proto */
1232 #if CYTHON_USE_TYPE_SLOTS
1233 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1234 #else
1235 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1236 #endif
1237
1238 /* GetBuiltinName.proto */
1239 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1240
1241 /* RaiseArgTupleInvalid.proto */
1242 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1243 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1244
1245 /* KeywordStringCheck.proto */
1246 static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
1247
1248 /* RaiseDoubleKeywords.proto */
1249 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1250
1251 /* ParseKeywords.proto */
1252 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1253 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1254 const char* function_name);
1255
1256 /* PyDictVersioning.proto */
1257 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1258 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1259 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1260 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1261 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1262 (cache_var) = (value);
1263 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1264 static PY_UINT64_T __pyx_dict_version = 0;\
1265 static PyObject *__pyx_dict_cached_value = NULL;\
1266 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1267 (VAR) = __pyx_dict_cached_value;\
1268 } else {\
1269 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1270 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1271 }\
1272 }
1273 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1274 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1275 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1276 #else
1277 #define __PYX_GET_DICT_VERSION(dict) (0)
1278 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1279 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1280 #endif
1281
1282 /* GetModuleGlobalName.proto */
1283 #if CYTHON_USE_DICT_VERSIONS
1284 #define __Pyx_GetModuleGlobalName(var, name) {\
1285 static PY_UINT64_T __pyx_dict_version = 0;\
1286 static PyObject *__pyx_dict_cached_value = NULL;\
1287 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1288 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1289 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1290 }
1291 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1292 PY_UINT64_T __pyx_dict_version;\
1293 PyObject *__pyx_dict_cached_value;\
1294 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1295 }
1296 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1297 #else
1298 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1299 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1300 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1301 #endif
1302
1303 /* PyFunctionFastCall.proto */
1304 #if CYTHON_FAST_PYCALL
1305 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1306 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1307 #if 1 || PY_VERSION_HEX < 0x030600B1
1308 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1309 #else
1310 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1311 #endif
1312 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1313 (sizeof(char [1 - 2*!(cond)]) - 1)
1314 #ifndef Py_MEMBER_SIZE
1315 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1316 #endif
1317 static size_t __pyx_pyframe_localsplus_offset = 0;
1318 #include "frameobject.h"
1319 #define __Pxy_PyFrame_Initialize_Offsets()\
1320 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1321 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1322 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1323 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1324 #endif
1325
1326 /* PyObjectCall.proto */
1327 #if CYTHON_COMPILING_IN_CPYTHON
1328 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1329 #else
1330 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1331 #endif
1332
1333 /* PyObjectCallMethO.proto */
1334 #if CYTHON_COMPILING_IN_CPYTHON
1335 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1336 #endif
1337
1338 /* PyObjectCallNoArg.proto */
1339 #if CYTHON_COMPILING_IN_CPYTHON
1340 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1341 #else
1342 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1343 #endif
1344
1345 /* PyCFunctionFastCall.proto */
1346 #if CYTHON_FAST_PYCCALL
1347 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1348 #else
1349 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1350 #endif
1351
1352 /* PyObjectCallOneArg.proto */
1353 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1354
1355 /* PyObjectCall2Args.proto */
1356 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1357
1358 /* RaiseTooManyValuesToUnpack.proto */
1359 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1360
1361 /* RaiseNeedMoreValuesToUnpack.proto */
1362 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1363
1364 /* IterFinish.proto */
1365 static CYTHON_INLINE int __Pyx_IterFinish(void);
1366
1367 /* UnpackItemEndCheck.proto */
1368 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1369
1370 /* ExtTypeTest.proto */
1371 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1372
1373 /* IsLittleEndian.proto */
1374 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1375
1376 /* BufferFormatCheck.proto */
1377 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1378 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1379 __Pyx_BufFmt_StackElem* stack,
1380 __Pyx_TypeInfo* type);
1381
1382 /* BufferGetAndValidate.proto */
1383 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1384 ((obj == Py_None || obj == NULL) ?\
1385 (__Pyx_ZeroBuffer(buf), 0) :\
1386 __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1387 static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1388 __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1389 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1390 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1391 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1392 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1393
1394 /* PyThreadStateGet.proto */
1395 #if CYTHON_FAST_THREAD_STATE
1396 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1397 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1398 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1399 #else
1400 #define __Pyx_PyThreadState_declare
1401 #define __Pyx_PyThreadState_assign
1402 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1403 #endif
1404
1405 /* PyErrFetchRestore.proto */
1406 #if CYTHON_FAST_THREAD_STATE
1407 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1408 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1409 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1410 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1411 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1412 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1413 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1414 #if CYTHON_COMPILING_IN_CPYTHON
1415 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1416 #else
1417 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1418 #endif
1419 #else
1420 #define __Pyx_PyErr_Clear() PyErr_Clear()
1421 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1422 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1423 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1424 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1425 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1426 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1427 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1428 #endif
1429
1430 /* GetItemInt.proto */
1431 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1432 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1433 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1434 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1435 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1436 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1437 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1438 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1439 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1440 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1441 int wraparound, int boundscheck);
1442 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1443 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1444 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1445 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1446 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1447 int wraparound, int boundscheck);
1448 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1449 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1450 int is_list, int wraparound, int boundscheck);
1451
1452 /* ObjectGetItem.proto */
1453 #if CYTHON_USE_TYPE_SLOTS
1454 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1455 #else
1456 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1457 #endif
1458
1459 /* BufferFallbackError.proto */
1460 static void __Pyx_RaiseBufferFallbackError(void);
1461
1462 /* RaiseException.proto */
1463 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1464
1465 /* DictGetItem.proto */
1466 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1467 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1468 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1469 (likely(PyDict_CheckExact(obj)) ?\
1470 __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1471 #else
1472 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1473 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1474 #endif
1475
1476 /* RaiseNoneIterError.proto */
1477 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1478
1479 /* GetTopmostException.proto */
1480 #if CYTHON_USE_EXC_INFO_STACK
1481 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1482 #endif
1483
1484 /* SaveResetException.proto */
1485 #if CYTHON_FAST_THREAD_STATE
1486 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1487 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1488 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1489 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1490 #else
1491 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1492 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1493 #endif
1494
1495 /* PyErrExceptionMatches.proto */
1496 #if CYTHON_FAST_THREAD_STATE
1497 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1498 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1499 #else
1500 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1501 #endif
1502
1503 /* GetException.proto */
1504 #if CYTHON_FAST_THREAD_STATE
1505 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1506 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1507 #else
1508 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1509 #endif
1510
1511 /* PyObject_GenericGetAttrNoDict.proto */
1512 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1513 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1514 #else
1515 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1516 #endif
1517
1518 /* PyObject_GenericGetAttr.proto */
1519 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1520 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1521 #else
1522 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1523 #endif
1524
1525 /* SetVTable.proto */
1526 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1527
1528 /* SetupReduce.proto */
1529 static int __Pyx_setup_reduce(PyObject* type_obj);
1530
1531 /* TypeImport.proto */
1532 #ifndef __PYX_HAVE_RT_ImportType_proto
1533 #define __PYX_HAVE_RT_ImportType_proto
1534 enum __Pyx_ImportType_CheckSize {
1535 __Pyx_ImportType_CheckSize_Error = 0,
1536 __Pyx_ImportType_CheckSize_Warn = 1,
1537 __Pyx_ImportType_CheckSize_Ignore = 2
1538 };
1539 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1540 #endif
1541
1542 /* Import.proto */
1543 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1544
1545 /* ImportFrom.proto */
1546 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1547
1548 /* CLineInTraceback.proto */
1549 #ifdef CYTHON_CLINE_IN_TRACEBACK
1550 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1551 #else
1552 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1553 #endif
1554
1555 /* CodeObjectCache.proto */
1556 typedef struct {
1557 PyCodeObject* code_object;
1558 int code_line;
1559 } __Pyx_CodeObjectCacheEntry;
1560 struct __Pyx_CodeObjectCache {
1561 int count;
1562 int max_count;
1563 __Pyx_CodeObjectCacheEntry* entries;
1564 };
1565 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1566 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1567 static PyCodeObject *__pyx_find_code_object(int code_line);
1568 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1569
1570 /* AddTraceback.proto */
1571 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1572 int py_line, const char *filename);
1573
1574 /* BufferStructDeclare.proto */
1575 typedef struct {
1576 Py_ssize_t shape, strides, suboffsets;
1577 } __Pyx_Buf_DimInfo;
1578 typedef struct {
1579 size_t refcount;
1580 Py_buffer pybuffer;
1581 } __Pyx_Buffer;
1582 typedef struct {
1583 __Pyx_Buffer *rcbuffer;
1584 char *data;
1585 __Pyx_Buf_DimInfo diminfo[8];
1586 } __Pyx_LocalBuf_ND;
1587
1588 #if PY_MAJOR_VERSION < 3
1589 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1590 static void __Pyx_ReleaseBuffer(Py_buffer *view);
1591 #else
1592 #define __Pyx_GetBuffer PyObject_GetBuffer
1593 #define __Pyx_ReleaseBuffer PyBuffer_Release
1594 #endif
1595
1596
1597 /* CppExceptionConversion.proto */
1598 #ifndef __Pyx_CppExn2PyErr
1599 #include <new>
1600 #include <typeinfo>
1601 #include <stdexcept>
1602 #include <ios>
__Pyx_CppExn2PyErr()1603 static void __Pyx_CppExn2PyErr() {
1604 try {
1605 if (PyErr_Occurred())
1606 ; // let the latest Python exn pass through and ignore the current one
1607 else
1608 throw;
1609 } catch (const std::bad_alloc& exn) {
1610 PyErr_SetString(PyExc_MemoryError, exn.what());
1611 } catch (const std::bad_cast& exn) {
1612 PyErr_SetString(PyExc_TypeError, exn.what());
1613 } catch (const std::bad_typeid& exn) {
1614 PyErr_SetString(PyExc_TypeError, exn.what());
1615 } catch (const std::domain_error& exn) {
1616 PyErr_SetString(PyExc_ValueError, exn.what());
1617 } catch (const std::invalid_argument& exn) {
1618 PyErr_SetString(PyExc_ValueError, exn.what());
1619 } catch (const std::ios_base::failure& exn) {
1620 PyErr_SetString(PyExc_IOError, exn.what());
1621 } catch (const std::out_of_range& exn) {
1622 PyErr_SetString(PyExc_IndexError, exn.what());
1623 } catch (const std::overflow_error& exn) {
1624 PyErr_SetString(PyExc_OverflowError, exn.what());
1625 } catch (const std::range_error& exn) {
1626 PyErr_SetString(PyExc_ArithmeticError, exn.what());
1627 } catch (const std::underflow_error& exn) {
1628 PyErr_SetString(PyExc_ArithmeticError, exn.what());
1629 } catch (const std::exception& exn) {
1630 PyErr_SetString(PyExc_RuntimeError, exn.what());
1631 }
1632 catch (...)
1633 {
1634 PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
1635 }
1636 }
1637 #endif
1638
1639 /* CIntToPy.proto */
1640 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1641
1642 /* CIntToPy.proto */
1643 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1644
1645 /* RealImag.proto */
1646 #if CYTHON_CCOMPLEX
1647 #ifdef __cplusplus
1648 #define __Pyx_CREAL(z) ((z).real())
1649 #define __Pyx_CIMAG(z) ((z).imag())
1650 #else
1651 #define __Pyx_CREAL(z) (__real__(z))
1652 #define __Pyx_CIMAG(z) (__imag__(z))
1653 #endif
1654 #else
1655 #define __Pyx_CREAL(z) ((z).real)
1656 #define __Pyx_CIMAG(z) ((z).imag)
1657 #endif
1658 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1659 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1660 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1661 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1662 #else
1663 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1664 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1665 #endif
1666
1667 /* Arithmetic.proto */
1668 #if CYTHON_CCOMPLEX
1669 #define __Pyx_c_eq_float(a, b) ((a)==(b))
1670 #define __Pyx_c_sum_float(a, b) ((a)+(b))
1671 #define __Pyx_c_diff_float(a, b) ((a)-(b))
1672 #define __Pyx_c_prod_float(a, b) ((a)*(b))
1673 #define __Pyx_c_quot_float(a, b) ((a)/(b))
1674 #define __Pyx_c_neg_float(a) (-(a))
1675 #ifdef __cplusplus
1676 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1677 #define __Pyx_c_conj_float(z) (::std::conj(z))
1678 #if 1
1679 #define __Pyx_c_abs_float(z) (::std::abs(z))
1680 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1681 #endif
1682 #else
1683 #define __Pyx_c_is_zero_float(z) ((z)==0)
1684 #define __Pyx_c_conj_float(z) (conjf(z))
1685 #if 1
1686 #define __Pyx_c_abs_float(z) (cabsf(z))
1687 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1688 #endif
1689 #endif
1690 #else
1691 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1692 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1693 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1694 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1695 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1696 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1697 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1698 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1699 #if 1
1700 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1701 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1702 #endif
1703 #endif
1704
1705 /* Arithmetic.proto */
1706 #if CYTHON_CCOMPLEX
1707 #define __Pyx_c_eq_double(a, b) ((a)==(b))
1708 #define __Pyx_c_sum_double(a, b) ((a)+(b))
1709 #define __Pyx_c_diff_double(a, b) ((a)-(b))
1710 #define __Pyx_c_prod_double(a, b) ((a)*(b))
1711 #define __Pyx_c_quot_double(a, b) ((a)/(b))
1712 #define __Pyx_c_neg_double(a) (-(a))
1713 #ifdef __cplusplus
1714 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1715 #define __Pyx_c_conj_double(z) (::std::conj(z))
1716 #if 1
1717 #define __Pyx_c_abs_double(z) (::std::abs(z))
1718 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1719 #endif
1720 #else
1721 #define __Pyx_c_is_zero_double(z) ((z)==0)
1722 #define __Pyx_c_conj_double(z) (conj(z))
1723 #if 1
1724 #define __Pyx_c_abs_double(z) (cabs(z))
1725 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1726 #endif
1727 #endif
1728 #else
1729 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1730 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1731 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1732 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1733 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1734 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1735 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1736 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1737 #if 1
1738 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1739 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1740 #endif
1741 #endif
1742
1743 /* CIntToPy.proto */
1744 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1745
1746 /* CIntFromPy.proto */
1747 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1748
1749 /* CIntFromPy.proto */
1750 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1751
1752 /* FastTypeChecks.proto */
1753 #if CYTHON_COMPILING_IN_CPYTHON
1754 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1755 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1756 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1757 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1758 #else
1759 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1760 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1761 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1762 #endif
1763 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1764
1765 /* CheckBinaryVersion.proto */
1766 static int __Pyx_check_binary_version(void);
1767
1768 /* InitStrings.proto */
1769 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1770
1771 static PyObject *__pyx_f_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_setCppSelf(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self, CppOsiCuts *__pyx_v_s); /* proto*/
1772
1773 /* Module declarations from 'cpython.buffer' */
1774
1775 /* Module declarations from 'libc.string' */
1776
1777 /* Module declarations from 'libc.stdio' */
1778
1779 /* Module declarations from '__builtin__' */
1780
1781 /* Module declarations from 'cpython.type' */
1782 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1783
1784 /* Module declarations from 'cpython' */
1785
1786 /* Module declarations from 'cpython.object' */
1787
1788 /* Module declarations from 'cpython.ref' */
1789
1790 /* Module declarations from 'cpython.mem' */
1791
1792 /* Module declarations from 'numpy' */
1793
1794 /* Module declarations from 'numpy' */
1795 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1796 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1797 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1798 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1799 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1800 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1801
1802 /* Module declarations from 'cylp.cy.CyOsiCuts' */
1803 static PyTypeObject *__pyx_ptype_4cylp_2cy_9CyOsiCuts_CyOsiCuts = 0;
1804 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 };
1805 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_double_t = { "double_t", NULL, sizeof(__pyx_t_5numpy_double_t), { 0 }, 0, 'R', 0, 0 };
1806 #define __Pyx_MODULE_NAME "cylp.cy.CyOsiCuts"
1807 extern int __pyx_module_is_main_cylp__cy__CyOsiCuts;
1808 int __pyx_module_is_main_cylp__cy__CyOsiCuts = 0;
1809
1810 /* Implementation of 'cylp.cy.CyOsiCuts' */
1811 static PyObject *__pyx_builtin_xrange;
1812 static PyObject *__pyx_builtin_TypeError;
1813 static PyObject *__pyx_builtin_ValueError;
1814 static PyObject *__pyx_builtin_range;
1815 static PyObject *__pyx_builtin_RuntimeError;
1816 static PyObject *__pyx_builtin_ImportError;
1817 static const char __pyx_k_x[] = "x";
1818 static const char __pyx_k_np[] = "np";
1819 static const char __pyx_k_cut[] = "cut";
1820 static const char __pyx_k_dim[] = "dim";
1821 static const char __pyx_k_data[] = "data";
1822 static const char __pyx_k_main[] = "__main__";
1823 static const char __pyx_k_name[] = "name";
1824 static const char __pyx_k_test[] = "__test__";
1825 static const char __pyx_k_dtype[] = "dtype";
1826 static const char __pyx_k_int32[] = "int32";
1827 static const char __pyx_k_isInt[] = "isInt";
1828 static const char __pyx_k_numpy[] = "numpy";
1829 static const char __pyx_k_range[] = "range";
1830 static const char __pyx_k_scipy[] = "scipy";
1831 static const char __pyx_k_shape[] = "shape";
1832 static const char __pyx_k_arange[] = "arange";
1833 static const char __pyx_k_import[] = "__import__";
1834 static const char __pyx_k_name_2[] = "__name__";
1835 static const char __pyx_k_reduce[] = "__reduce__";
1836 static const char __pyx_k_xrange[] = "xrange";
1837 static const char __pyx_k_indices[] = "indices";
1838 static const char __pyx_k_getstate[] = "__getstate__";
1839 static const char __pyx_k_setstate[] = "__setstate__";
1840 static const char __pyx_k_CyLPModel[] = "CyLPModel";
1841 static const char __pyx_k_CyOsiCuts[] = "CyOsiCuts";
1842 static const char __pyx_k_TypeError[] = "TypeError";
1843 static const char __pyx_k_cyLpModel[] = "cyLpModel";
1844 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1845 static const char __pyx_k_variables[] = "variables";
1846 static const char __pyx_k_ValueError[] = "ValueError";
1847 static const char __pyx_k_csr_matrix[] = "csr_matrix";
1848 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1849 static const char __pyx_k_ImportError[] = "ImportError";
1850 static const char __pyx_k_addVariable[] = "addVariable";
1851 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1852 static const char __pyx_k_getVarByName[] = "getVarByName";
1853 static const char __pyx_k_makeMatrices[] = "makeMatrices";
1854 static const char __pyx_k_scipy_sparse[] = "scipy.sparse";
1855 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1856 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1857 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1858 static const char __pyx_k_cylp_py_modeling_CyLPModel[] = "cylp.py.modeling.CyLPModel";
1859 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1860 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1861 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1862 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1863 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1864 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1865 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
1866 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1867 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1868 static PyObject *__pyx_n_s_CyLPModel;
1869 static PyObject *__pyx_n_s_CyOsiCuts;
1870 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1871 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1872 static PyObject *__pyx_n_s_ImportError;
1873 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1874 static PyObject *__pyx_n_s_RuntimeError;
1875 static PyObject *__pyx_n_s_TypeError;
1876 static PyObject *__pyx_n_s_ValueError;
1877 static PyObject *__pyx_n_s_addVariable;
1878 static PyObject *__pyx_n_s_arange;
1879 static PyObject *__pyx_n_s_cline_in_traceback;
1880 static PyObject *__pyx_n_s_csr_matrix;
1881 static PyObject *__pyx_n_s_cut;
1882 static PyObject *__pyx_n_s_cyLpModel;
1883 static PyObject *__pyx_n_s_cylp_py_modeling_CyLPModel;
1884 static PyObject *__pyx_n_s_data;
1885 static PyObject *__pyx_n_s_dim;
1886 static PyObject *__pyx_n_s_dtype;
1887 static PyObject *__pyx_n_s_getVarByName;
1888 static PyObject *__pyx_n_s_getstate;
1889 static PyObject *__pyx_n_s_import;
1890 static PyObject *__pyx_n_s_indices;
1891 static PyObject *__pyx_n_s_int32;
1892 static PyObject *__pyx_n_s_isInt;
1893 static PyObject *__pyx_n_s_main;
1894 static PyObject *__pyx_n_s_makeMatrices;
1895 static PyObject *__pyx_n_s_name;
1896 static PyObject *__pyx_n_s_name_2;
1897 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
1898 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
1899 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
1900 static PyObject *__pyx_n_s_np;
1901 static PyObject *__pyx_n_s_numpy;
1902 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1903 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1904 static PyObject *__pyx_n_s_pyx_vtable;
1905 static PyObject *__pyx_n_s_range;
1906 static PyObject *__pyx_n_s_reduce;
1907 static PyObject *__pyx_n_s_reduce_cython;
1908 static PyObject *__pyx_n_s_reduce_ex;
1909 static PyObject *__pyx_n_s_scipy;
1910 static PyObject *__pyx_n_s_scipy_sparse;
1911 static PyObject *__pyx_n_s_setstate;
1912 static PyObject *__pyx_n_s_setstate_cython;
1913 static PyObject *__pyx_n_s_shape;
1914 static PyObject *__pyx_n_s_test;
1915 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
1916 static PyObject *__pyx_n_s_variables;
1917 static PyObject *__pyx_n_s_x;
1918 static PyObject *__pyx_n_s_xrange;
1919 static int __pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts___cinit__(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self); /* proto */
1920 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_2printCuts(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self); /* proto */
1921 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_15numberOfRowCuts___get__(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self); /* proto */
1922 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_18numberOfColumnCuts___get__(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self); /* proto */
1923 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_12numberOfCuts___get__(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self); /* proto */
1924 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_4addColumnCut(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self, PyObject *__pyx_v_cut, PyObject *__pyx_v_cyLpModel); /* proto */
1925 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_6addRowCut(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self, PyObject *__pyx_v_cut, PyObject *__pyx_v_cyLpModel); /* proto */
1926 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self); /* proto */
1927 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1928 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
1929 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
1930 static PyObject *__pyx_tp_new_4cylp_2cy_9CyOsiCuts_CyOsiCuts(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1931 static PyObject *__pyx_slice_;
1932 static PyObject *__pyx_tuple__2;
1933 static PyObject *__pyx_tuple__3;
1934 static PyObject *__pyx_tuple__4;
1935 static PyObject *__pyx_tuple__5;
1936 static PyObject *__pyx_tuple__6;
1937 static PyObject *__pyx_tuple__7;
1938 static PyObject *__pyx_tuple__8;
1939 static PyObject *__pyx_tuple__9;
1940 static PyObject *__pyx_tuple__10;
1941 /* Late includes */
1942
1943 /* "cylp/cy/CyOsiCuts.pyx":10
1944 * cdef class CyOsiCuts:
1945 * 'CyOsiCuts documentation'
1946 * def __cinit__(self): # <<<<<<<<<<<<<<
1947 * self.CppSelf = new CppOsiCuts()
1948 *
1949 */
1950
1951 /* Python wrapper */
1952 static int __pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)1953 static int __pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1954 int __pyx_r;
1955 __Pyx_RefNannyDeclarations
1956 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
1957 if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
1958 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
1959 if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
1960 __pyx_r = __pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts___cinit__(((struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *)__pyx_v_self));
1961
1962 /* function exit code */
1963 __Pyx_RefNannyFinishContext();
1964 return __pyx_r;
1965 }
1966
__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts___cinit__(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts * __pyx_v_self)1967 static int __pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts___cinit__(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self) {
1968 int __pyx_r;
1969 __Pyx_RefNannyDeclarations
1970 CppOsiCuts *__pyx_t_1;
1971 __Pyx_RefNannySetupContext("__cinit__", 0);
1972
1973 /* "cylp/cy/CyOsiCuts.pyx":11
1974 * 'CyOsiCuts documentation'
1975 * def __cinit__(self):
1976 * self.CppSelf = new CppOsiCuts() # <<<<<<<<<<<<<<
1977 *
1978 * cdef setCppSelf(self, CppOsiCuts* s):
1979 */
1980 try {
1981 __pyx_t_1 = new CppOsiCuts();
1982 } catch(...) {
1983 __Pyx_CppExn2PyErr();
1984 __PYX_ERR(0, 11, __pyx_L1_error)
1985 }
1986 __pyx_v_self->CppSelf = __pyx_t_1;
1987
1988 /* "cylp/cy/CyOsiCuts.pyx":10
1989 * cdef class CyOsiCuts:
1990 * 'CyOsiCuts documentation'
1991 * def __cinit__(self): # <<<<<<<<<<<<<<
1992 * self.CppSelf = new CppOsiCuts()
1993 *
1994 */
1995
1996 /* function exit code */
1997 __pyx_r = 0;
1998 goto __pyx_L0;
1999 __pyx_L1_error:;
2000 __Pyx_AddTraceback("cylp.cy.CyOsiCuts.CyOsiCuts.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2001 __pyx_r = -1;
2002 __pyx_L0:;
2003 __Pyx_RefNannyFinishContext();
2004 return __pyx_r;
2005 }
2006
2007 /* "cylp/cy/CyOsiCuts.pyx":13
2008 * self.CppSelf = new CppOsiCuts()
2009 *
2010 * cdef setCppSelf(self, CppOsiCuts* s): # <<<<<<<<<<<<<<
2011 * del self.CppSelf
2012 * self.CppSelf = s
2013 */
2014
__pyx_f_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_setCppSelf(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts * __pyx_v_self,CppOsiCuts * __pyx_v_s)2015 static PyObject *__pyx_f_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_setCppSelf(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self, CppOsiCuts *__pyx_v_s) {
2016 PyObject *__pyx_r = NULL;
2017 __Pyx_RefNannyDeclarations
2018 __Pyx_RefNannySetupContext("setCppSelf", 0);
2019
2020 /* "cylp/cy/CyOsiCuts.pyx":14
2021 *
2022 * cdef setCppSelf(self, CppOsiCuts* s):
2023 * del self.CppSelf # <<<<<<<<<<<<<<
2024 * self.CppSelf = s
2025 *
2026 */
2027 delete __pyx_v_self->CppSelf;
2028
2029 /* "cylp/cy/CyOsiCuts.pyx":15
2030 * cdef setCppSelf(self, CppOsiCuts* s):
2031 * del self.CppSelf
2032 * self.CppSelf = s # <<<<<<<<<<<<<<
2033 *
2034 * def printCuts(self):
2035 */
2036 __pyx_v_self->CppSelf = __pyx_v_s;
2037
2038 /* "cylp/cy/CyOsiCuts.pyx":13
2039 * self.CppSelf = new CppOsiCuts()
2040 *
2041 * cdef setCppSelf(self, CppOsiCuts* s): # <<<<<<<<<<<<<<
2042 * del self.CppSelf
2043 * self.CppSelf = s
2044 */
2045
2046 /* function exit code */
2047 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2048 __Pyx_XGIVEREF(__pyx_r);
2049 __Pyx_RefNannyFinishContext();
2050 return __pyx_r;
2051 }
2052
2053 /* "cylp/cy/CyOsiCuts.pyx":17
2054 * self.CppSelf = s
2055 *
2056 * def printCuts(self): # <<<<<<<<<<<<<<
2057 * self.CppSelf.printCuts()
2058 *
2059 */
2060
2061 /* Python wrapper */
2062 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_3printCuts(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_3printCuts(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)2063 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_3printCuts(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2064 PyObject *__pyx_r = 0;
2065 __Pyx_RefNannyDeclarations
2066 __Pyx_RefNannySetupContext("printCuts (wrapper)", 0);
2067 __pyx_r = __pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_2printCuts(((struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *)__pyx_v_self));
2068
2069 /* function exit code */
2070 __Pyx_RefNannyFinishContext();
2071 return __pyx_r;
2072 }
2073
__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_2printCuts(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts * __pyx_v_self)2074 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_2printCuts(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self) {
2075 PyObject *__pyx_r = NULL;
2076 __Pyx_RefNannyDeclarations
2077 __Pyx_RefNannySetupContext("printCuts", 0);
2078
2079 /* "cylp/cy/CyOsiCuts.pyx":18
2080 *
2081 * def printCuts(self):
2082 * self.CppSelf.printCuts() # <<<<<<<<<<<<<<
2083 *
2084 * property numberOfRowCuts:
2085 */
2086 __pyx_v_self->CppSelf->printCuts();
2087
2088 /* "cylp/cy/CyOsiCuts.pyx":17
2089 * self.CppSelf = s
2090 *
2091 * def printCuts(self): # <<<<<<<<<<<<<<
2092 * self.CppSelf.printCuts()
2093 *
2094 */
2095
2096 /* function exit code */
2097 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2098 __Pyx_XGIVEREF(__pyx_r);
2099 __Pyx_RefNannyFinishContext();
2100 return __pyx_r;
2101 }
2102
2103 /* "cylp/cy/CyOsiCuts.pyx":21
2104 *
2105 * property numberOfRowCuts:
2106 * def __get__(self): # <<<<<<<<<<<<<<
2107 * return self.CppSelf.sizeRowCuts()
2108 *
2109 */
2110
2111 /* Python wrapper */
2112 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_15numberOfRowCuts_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_15numberOfRowCuts_1__get__(PyObject * __pyx_v_self)2113 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_15numberOfRowCuts_1__get__(PyObject *__pyx_v_self) {
2114 PyObject *__pyx_r = 0;
2115 __Pyx_RefNannyDeclarations
2116 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
2117 __pyx_r = __pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_15numberOfRowCuts___get__(((struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *)__pyx_v_self));
2118
2119 /* function exit code */
2120 __Pyx_RefNannyFinishContext();
2121 return __pyx_r;
2122 }
2123
__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_15numberOfRowCuts___get__(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts * __pyx_v_self)2124 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_15numberOfRowCuts___get__(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self) {
2125 PyObject *__pyx_r = NULL;
2126 __Pyx_RefNannyDeclarations
2127 PyObject *__pyx_t_1 = NULL;
2128 __Pyx_RefNannySetupContext("__get__", 0);
2129
2130 /* "cylp/cy/CyOsiCuts.pyx":22
2131 * property numberOfRowCuts:
2132 * def __get__(self):
2133 * return self.CppSelf.sizeRowCuts() # <<<<<<<<<<<<<<
2134 *
2135 * property numberOfColumnCuts:
2136 */
2137 __Pyx_XDECREF(__pyx_r);
2138 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->CppSelf->sizeRowCuts()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
2139 __Pyx_GOTREF(__pyx_t_1);
2140 __pyx_r = __pyx_t_1;
2141 __pyx_t_1 = 0;
2142 goto __pyx_L0;
2143
2144 /* "cylp/cy/CyOsiCuts.pyx":21
2145 *
2146 * property numberOfRowCuts:
2147 * def __get__(self): # <<<<<<<<<<<<<<
2148 * return self.CppSelf.sizeRowCuts()
2149 *
2150 */
2151
2152 /* function exit code */
2153 __pyx_L1_error:;
2154 __Pyx_XDECREF(__pyx_t_1);
2155 __Pyx_AddTraceback("cylp.cy.CyOsiCuts.CyOsiCuts.numberOfRowCuts.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2156 __pyx_r = NULL;
2157 __pyx_L0:;
2158 __Pyx_XGIVEREF(__pyx_r);
2159 __Pyx_RefNannyFinishContext();
2160 return __pyx_r;
2161 }
2162
2163 /* "cylp/cy/CyOsiCuts.pyx":25
2164 *
2165 * property numberOfColumnCuts:
2166 * def __get__(self): # <<<<<<<<<<<<<<
2167 * return self.CppSelf.sizeColCuts()
2168 *
2169 */
2170
2171 /* Python wrapper */
2172 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_18numberOfColumnCuts_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_18numberOfColumnCuts_1__get__(PyObject * __pyx_v_self)2173 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_18numberOfColumnCuts_1__get__(PyObject *__pyx_v_self) {
2174 PyObject *__pyx_r = 0;
2175 __Pyx_RefNannyDeclarations
2176 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
2177 __pyx_r = __pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_18numberOfColumnCuts___get__(((struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *)__pyx_v_self));
2178
2179 /* function exit code */
2180 __Pyx_RefNannyFinishContext();
2181 return __pyx_r;
2182 }
2183
__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_18numberOfColumnCuts___get__(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts * __pyx_v_self)2184 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_18numberOfColumnCuts___get__(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self) {
2185 PyObject *__pyx_r = NULL;
2186 __Pyx_RefNannyDeclarations
2187 PyObject *__pyx_t_1 = NULL;
2188 __Pyx_RefNannySetupContext("__get__", 0);
2189
2190 /* "cylp/cy/CyOsiCuts.pyx":26
2191 * property numberOfColumnCuts:
2192 * def __get__(self):
2193 * return self.CppSelf.sizeColCuts() # <<<<<<<<<<<<<<
2194 *
2195 * property numberOfCuts:
2196 */
2197 __Pyx_XDECREF(__pyx_r);
2198 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->CppSelf->sizeColCuts()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
2199 __Pyx_GOTREF(__pyx_t_1);
2200 __pyx_r = __pyx_t_1;
2201 __pyx_t_1 = 0;
2202 goto __pyx_L0;
2203
2204 /* "cylp/cy/CyOsiCuts.pyx":25
2205 *
2206 * property numberOfColumnCuts:
2207 * def __get__(self): # <<<<<<<<<<<<<<
2208 * return self.CppSelf.sizeColCuts()
2209 *
2210 */
2211
2212 /* function exit code */
2213 __pyx_L1_error:;
2214 __Pyx_XDECREF(__pyx_t_1);
2215 __Pyx_AddTraceback("cylp.cy.CyOsiCuts.CyOsiCuts.numberOfColumnCuts.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2216 __pyx_r = NULL;
2217 __pyx_L0:;
2218 __Pyx_XGIVEREF(__pyx_r);
2219 __Pyx_RefNannyFinishContext();
2220 return __pyx_r;
2221 }
2222
2223 /* "cylp/cy/CyOsiCuts.pyx":29
2224 *
2225 * property numberOfCuts:
2226 * def __get__(self): # <<<<<<<<<<<<<<
2227 * return self.CppSelf.sizeCuts()
2228 *
2229 */
2230
2231 /* Python wrapper */
2232 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_12numberOfCuts_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_12numberOfCuts_1__get__(PyObject * __pyx_v_self)2233 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_12numberOfCuts_1__get__(PyObject *__pyx_v_self) {
2234 PyObject *__pyx_r = 0;
2235 __Pyx_RefNannyDeclarations
2236 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
2237 __pyx_r = __pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_12numberOfCuts___get__(((struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *)__pyx_v_self));
2238
2239 /* function exit code */
2240 __Pyx_RefNannyFinishContext();
2241 return __pyx_r;
2242 }
2243
__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_12numberOfCuts___get__(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts * __pyx_v_self)2244 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_12numberOfCuts___get__(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self) {
2245 PyObject *__pyx_r = NULL;
2246 __Pyx_RefNannyDeclarations
2247 PyObject *__pyx_t_1 = NULL;
2248 __Pyx_RefNannySetupContext("__get__", 0);
2249
2250 /* "cylp/cy/CyOsiCuts.pyx":30
2251 * property numberOfCuts:
2252 * def __get__(self):
2253 * return self.CppSelf.sizeCuts() # <<<<<<<<<<<<<<
2254 *
2255 * def addColumnCut(self, cut, cyLpModel):
2256 */
2257 __Pyx_XDECREF(__pyx_r);
2258 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->CppSelf->sizeCuts()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
2259 __Pyx_GOTREF(__pyx_t_1);
2260 __pyx_r = __pyx_t_1;
2261 __pyx_t_1 = 0;
2262 goto __pyx_L0;
2263
2264 /* "cylp/cy/CyOsiCuts.pyx":29
2265 *
2266 * property numberOfCuts:
2267 * def __get__(self): # <<<<<<<<<<<<<<
2268 * return self.CppSelf.sizeCuts()
2269 *
2270 */
2271
2272 /* function exit code */
2273 __pyx_L1_error:;
2274 __Pyx_XDECREF(__pyx_t_1);
2275 __Pyx_AddTraceback("cylp.cy.CyOsiCuts.CyOsiCuts.numberOfCuts.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2276 __pyx_r = NULL;
2277 __pyx_L0:;
2278 __Pyx_XGIVEREF(__pyx_r);
2279 __Pyx_RefNannyFinishContext();
2280 return __pyx_r;
2281 }
2282
2283 /* "cylp/cy/CyOsiCuts.pyx":32
2284 * return self.CppSelf.sizeCuts()
2285 *
2286 * def addColumnCut(self, cut, cyLpModel): # <<<<<<<<<<<<<<
2287 * '''
2288 * Add ``cut`` to cuts. ``cut`` is a CyLPExpr
2289 */
2290
2291 /* Python wrapper */
2292 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_5addColumnCut(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2293 static char __pyx_doc_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_4addColumnCut[] = "\n Add ``cut`` to cuts. ``cut`` is a CyLPExpr\n and ``cut.isRange`` is ``True``.\n ";
__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_5addColumnCut(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2294 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_5addColumnCut(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2295 PyObject *__pyx_v_cut = 0;
2296 PyObject *__pyx_v_cyLpModel = 0;
2297 PyObject *__pyx_r = 0;
2298 __Pyx_RefNannyDeclarations
2299 __Pyx_RefNannySetupContext("addColumnCut (wrapper)", 0);
2300 {
2301 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cut,&__pyx_n_s_cyLpModel,0};
2302 PyObject* values[2] = {0,0};
2303 if (unlikely(__pyx_kwds)) {
2304 Py_ssize_t kw_args;
2305 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2306 switch (pos_args) {
2307 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2308 CYTHON_FALLTHROUGH;
2309 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2310 CYTHON_FALLTHROUGH;
2311 case 0: break;
2312 default: goto __pyx_L5_argtuple_error;
2313 }
2314 kw_args = PyDict_Size(__pyx_kwds);
2315 switch (pos_args) {
2316 case 0:
2317 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cut)) != 0)) kw_args--;
2318 else goto __pyx_L5_argtuple_error;
2319 CYTHON_FALLTHROUGH;
2320 case 1:
2321 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cyLpModel)) != 0)) kw_args--;
2322 else {
2323 __Pyx_RaiseArgtupleInvalid("addColumnCut", 1, 2, 2, 1); __PYX_ERR(0, 32, __pyx_L3_error)
2324 }
2325 }
2326 if (unlikely(kw_args > 0)) {
2327 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "addColumnCut") < 0)) __PYX_ERR(0, 32, __pyx_L3_error)
2328 }
2329 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2330 goto __pyx_L5_argtuple_error;
2331 } else {
2332 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2333 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2334 }
2335 __pyx_v_cut = values[0];
2336 __pyx_v_cyLpModel = values[1];
2337 }
2338 goto __pyx_L4_argument_unpacking_done;
2339 __pyx_L5_argtuple_error:;
2340 __Pyx_RaiseArgtupleInvalid("addColumnCut", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 32, __pyx_L3_error)
2341 __pyx_L3_error:;
2342 __Pyx_AddTraceback("cylp.cy.CyOsiCuts.CyOsiCuts.addColumnCut", __pyx_clineno, __pyx_lineno, __pyx_filename);
2343 __Pyx_RefNannyFinishContext();
2344 return NULL;
2345 __pyx_L4_argument_unpacking_done:;
2346 __pyx_r = __pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_4addColumnCut(((struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *)__pyx_v_self), __pyx_v_cut, __pyx_v_cyLpModel);
2347
2348 /* function exit code */
2349 __Pyx_RefNannyFinishContext();
2350 return __pyx_r;
2351 }
2352
__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_4addColumnCut(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts * __pyx_v_self,PyObject * __pyx_v_cut,PyObject * __pyx_v_cyLpModel)2353 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_4addColumnCut(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self, PyObject *__pyx_v_cut, PyObject *__pyx_v_cyLpModel) {
2354 PyObject *__pyx_v_m = NULL;
2355 PyObject *__pyx_v_var = NULL;
2356 CYTHON_UNUSED PyObject *__pyx_v_x = NULL;
2357 CYTHON_UNUSED PyObject *__pyx_v_mat = NULL;
2358 CYTHON_UNUSED PyObject *__pyx_v_cl = NULL;
2359 CYTHON_UNUSED PyObject *__pyx_v_cu = NULL;
2360 PyObject *__pyx_v_vl = NULL;
2361 PyObject *__pyx_v_vu = NULL;
2362 PyObject *__pyx_v_inds = NULL;
2363 PyArrayObject *__pyx_v_vl_inds = 0;
2364 PyArrayObject *__pyx_v_vl_data = 0;
2365 PyArrayObject *__pyx_v_vu_inds = 0;
2366 PyArrayObject *__pyx_v_vu_data = 0;
2367 __Pyx_LocalBuf_ND __pyx_pybuffernd_vl_data;
2368 __Pyx_Buffer __pyx_pybuffer_vl_data;
2369 __Pyx_LocalBuf_ND __pyx_pybuffernd_vl_inds;
2370 __Pyx_Buffer __pyx_pybuffer_vl_inds;
2371 __Pyx_LocalBuf_ND __pyx_pybuffernd_vu_data;
2372 __Pyx_Buffer __pyx_pybuffer_vu_data;
2373 __Pyx_LocalBuf_ND __pyx_pybuffernd_vu_inds;
2374 __Pyx_Buffer __pyx_pybuffer_vu_inds;
2375 PyObject *__pyx_r = NULL;
2376 __Pyx_RefNannyDeclarations
2377 PyObject *__pyx_t_1 = NULL;
2378 PyObject *__pyx_t_2 = NULL;
2379 PyObject *__pyx_t_3 = NULL;
2380 Py_ssize_t __pyx_t_4;
2381 PyObject *(*__pyx_t_5)(PyObject *);
2382 PyObject *__pyx_t_6 = NULL;
2383 PyObject *__pyx_t_7 = NULL;
2384 PyObject *__pyx_t_8 = NULL;
2385 PyObject *__pyx_t_9 = NULL;
2386 int __pyx_t_10;
2387 PyObject *__pyx_t_11 = NULL;
2388 PyObject *(*__pyx_t_12)(PyObject *);
2389 __Pyx_RefNannySetupContext("addColumnCut", 0);
2390 __pyx_pybuffer_vl_inds.pybuffer.buf = NULL;
2391 __pyx_pybuffer_vl_inds.refcount = 0;
2392 __pyx_pybuffernd_vl_inds.data = NULL;
2393 __pyx_pybuffernd_vl_inds.rcbuffer = &__pyx_pybuffer_vl_inds;
2394 __pyx_pybuffer_vl_data.pybuffer.buf = NULL;
2395 __pyx_pybuffer_vl_data.refcount = 0;
2396 __pyx_pybuffernd_vl_data.data = NULL;
2397 __pyx_pybuffernd_vl_data.rcbuffer = &__pyx_pybuffer_vl_data;
2398 __pyx_pybuffer_vu_inds.pybuffer.buf = NULL;
2399 __pyx_pybuffer_vu_inds.refcount = 0;
2400 __pyx_pybuffernd_vu_inds.data = NULL;
2401 __pyx_pybuffernd_vu_inds.rcbuffer = &__pyx_pybuffer_vu_inds;
2402 __pyx_pybuffer_vu_data.pybuffer.buf = NULL;
2403 __pyx_pybuffer_vu_data.refcount = 0;
2404 __pyx_pybuffernd_vu_data.data = NULL;
2405 __pyx_pybuffernd_vu_data.rcbuffer = &__pyx_pybuffer_vu_data;
2406
2407 /* "cylp/cy/CyOsiCuts.pyx":37
2408 * and ``cut.isRange`` is ``True``.
2409 * '''
2410 * m = CyLPModel() # <<<<<<<<<<<<<<
2411 * for var in cyLpModel.variables:
2412 * m.addVariable(var.name, var.dim, var.isInt)
2413 */
2414 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CyLPModel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
2415 __Pyx_GOTREF(__pyx_t_2);
2416 __pyx_t_3 = NULL;
2417 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
2418 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2419 if (likely(__pyx_t_3)) {
2420 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2421 __Pyx_INCREF(__pyx_t_3);
2422 __Pyx_INCREF(function);
2423 __Pyx_DECREF_SET(__pyx_t_2, function);
2424 }
2425 }
2426 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
2427 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2428 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
2429 __Pyx_GOTREF(__pyx_t_1);
2430 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2431 __pyx_v_m = __pyx_t_1;
2432 __pyx_t_1 = 0;
2433
2434 /* "cylp/cy/CyOsiCuts.pyx":38
2435 * '''
2436 * m = CyLPModel()
2437 * for var in cyLpModel.variables: # <<<<<<<<<<<<<<
2438 * m.addVariable(var.name, var.dim, var.isInt)
2439 * x = m.getVarByName('x')
2440 */
2441 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cyLpModel, __pyx_n_s_variables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
2442 __Pyx_GOTREF(__pyx_t_1);
2443 if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
2444 __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
2445 __pyx_t_5 = NULL;
2446 } else {
2447 __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
2448 __Pyx_GOTREF(__pyx_t_2);
2449 __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error)
2450 }
2451 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2452 for (;;) {
2453 if (likely(!__pyx_t_5)) {
2454 if (likely(PyList_CheckExact(__pyx_t_2))) {
2455 if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
2456 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2457 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 38, __pyx_L1_error)
2458 #else
2459 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
2460 __Pyx_GOTREF(__pyx_t_1);
2461 #endif
2462 } else {
2463 if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
2464 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2465 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 38, __pyx_L1_error)
2466 #else
2467 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
2468 __Pyx_GOTREF(__pyx_t_1);
2469 #endif
2470 }
2471 } else {
2472 __pyx_t_1 = __pyx_t_5(__pyx_t_2);
2473 if (unlikely(!__pyx_t_1)) {
2474 PyObject* exc_type = PyErr_Occurred();
2475 if (exc_type) {
2476 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
2477 else __PYX_ERR(0, 38, __pyx_L1_error)
2478 }
2479 break;
2480 }
2481 __Pyx_GOTREF(__pyx_t_1);
2482 }
2483 __Pyx_XDECREF_SET(__pyx_v_var, __pyx_t_1);
2484 __pyx_t_1 = 0;
2485
2486 /* "cylp/cy/CyOsiCuts.pyx":39
2487 * m = CyLPModel()
2488 * for var in cyLpModel.variables:
2489 * m.addVariable(var.name, var.dim, var.isInt) # <<<<<<<<<<<<<<
2490 * x = m.getVarByName('x')
2491 * m += cut
2492 */
2493 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_addVariable); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error)
2494 __Pyx_GOTREF(__pyx_t_3);
2495 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_var, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error)
2496 __Pyx_GOTREF(__pyx_t_6);
2497 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_var, __pyx_n_s_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 39, __pyx_L1_error)
2498 __Pyx_GOTREF(__pyx_t_7);
2499 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_var, __pyx_n_s_isInt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 39, __pyx_L1_error)
2500 __Pyx_GOTREF(__pyx_t_8);
2501 __pyx_t_9 = NULL;
2502 __pyx_t_10 = 0;
2503 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
2504 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
2505 if (likely(__pyx_t_9)) {
2506 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2507 __Pyx_INCREF(__pyx_t_9);
2508 __Pyx_INCREF(function);
2509 __Pyx_DECREF_SET(__pyx_t_3, function);
2510 __pyx_t_10 = 1;
2511 }
2512 }
2513 #if CYTHON_FAST_PYCALL
2514 if (PyFunction_Check(__pyx_t_3)) {
2515 PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_6, __pyx_t_7, __pyx_t_8};
2516 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
2517 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
2518 __Pyx_GOTREF(__pyx_t_1);
2519 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2520 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2521 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2522 } else
2523 #endif
2524 #if CYTHON_FAST_PYCCALL
2525 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
2526 PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_6, __pyx_t_7, __pyx_t_8};
2527 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
2528 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
2529 __Pyx_GOTREF(__pyx_t_1);
2530 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2531 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2532 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2533 } else
2534 #endif
2535 {
2536 __pyx_t_11 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 39, __pyx_L1_error)
2537 __Pyx_GOTREF(__pyx_t_11);
2538 if (__pyx_t_9) {
2539 __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
2540 }
2541 __Pyx_GIVEREF(__pyx_t_6);
2542 PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_6);
2543 __Pyx_GIVEREF(__pyx_t_7);
2544 PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_7);
2545 __Pyx_GIVEREF(__pyx_t_8);
2546 PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_8);
2547 __pyx_t_6 = 0;
2548 __pyx_t_7 = 0;
2549 __pyx_t_8 = 0;
2550 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
2551 __Pyx_GOTREF(__pyx_t_1);
2552 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
2553 }
2554 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2555 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2556
2557 /* "cylp/cy/CyOsiCuts.pyx":38
2558 * '''
2559 * m = CyLPModel()
2560 * for var in cyLpModel.variables: # <<<<<<<<<<<<<<
2561 * m.addVariable(var.name, var.dim, var.isInt)
2562 * x = m.getVarByName('x')
2563 */
2564 }
2565 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2566
2567 /* "cylp/cy/CyOsiCuts.pyx":40
2568 * for var in cyLpModel.variables:
2569 * m.addVariable(var.name, var.dim, var.isInt)
2570 * x = m.getVarByName('x') # <<<<<<<<<<<<<<
2571 * m += cut
2572 * mat, cl, cu, vl, vu = cyLpModel.makeMatrices()
2573 */
2574 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_getVarByName); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
2575 __Pyx_GOTREF(__pyx_t_1);
2576 __pyx_t_3 = NULL;
2577 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
2578 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
2579 if (likely(__pyx_t_3)) {
2580 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2581 __Pyx_INCREF(__pyx_t_3);
2582 __Pyx_INCREF(function);
2583 __Pyx_DECREF_SET(__pyx_t_1, function);
2584 }
2585 }
2586 __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_n_s_x) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_s_x);
2587 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2588 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error)
2589 __Pyx_GOTREF(__pyx_t_2);
2590 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2591 __pyx_v_x = __pyx_t_2;
2592 __pyx_t_2 = 0;
2593
2594 /* "cylp/cy/CyOsiCuts.pyx":41
2595 * m.addVariable(var.name, var.dim, var.isInt)
2596 * x = m.getVarByName('x')
2597 * m += cut # <<<<<<<<<<<<<<
2598 * mat, cl, cu, vl, vu = cyLpModel.makeMatrices()
2599 *
2600 */
2601 __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_m, __pyx_v_cut); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error)
2602 __Pyx_GOTREF(__pyx_t_2);
2603 __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_2);
2604 __pyx_t_2 = 0;
2605
2606 /* "cylp/cy/CyOsiCuts.pyx":42
2607 * x = m.getVarByName('x')
2608 * m += cut
2609 * mat, cl, cu, vl, vu = cyLpModel.makeMatrices() # <<<<<<<<<<<<<<
2610 *
2611 * inds = np.arange(len(vl), dtype=np.int32)
2612 */
2613 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cyLpModel, __pyx_n_s_makeMatrices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
2614 __Pyx_GOTREF(__pyx_t_1);
2615 __pyx_t_3 = NULL;
2616 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
2617 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
2618 if (likely(__pyx_t_3)) {
2619 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2620 __Pyx_INCREF(__pyx_t_3);
2621 __Pyx_INCREF(function);
2622 __Pyx_DECREF_SET(__pyx_t_1, function);
2623 }
2624 }
2625 __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
2626 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2627 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
2628 __Pyx_GOTREF(__pyx_t_2);
2629 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2630 if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
2631 PyObject* sequence = __pyx_t_2;
2632 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
2633 if (unlikely(size != 5)) {
2634 if (size > 5) __Pyx_RaiseTooManyValuesError(5);
2635 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
2636 __PYX_ERR(0, 42, __pyx_L1_error)
2637 }
2638 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2639 if (likely(PyTuple_CheckExact(sequence))) {
2640 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
2641 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
2642 __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
2643 __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3);
2644 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 4);
2645 } else {
2646 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
2647 __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
2648 __pyx_t_11 = PyList_GET_ITEM(sequence, 2);
2649 __pyx_t_8 = PyList_GET_ITEM(sequence, 3);
2650 __pyx_t_7 = PyList_GET_ITEM(sequence, 4);
2651 }
2652 __Pyx_INCREF(__pyx_t_1);
2653 __Pyx_INCREF(__pyx_t_3);
2654 __Pyx_INCREF(__pyx_t_11);
2655 __Pyx_INCREF(__pyx_t_8);
2656 __Pyx_INCREF(__pyx_t_7);
2657 #else
2658 {
2659 Py_ssize_t i;
2660 PyObject** temps[5] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_11,&__pyx_t_8,&__pyx_t_7};
2661 for (i=0; i < 5; i++) {
2662 PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 42, __pyx_L1_error)
2663 __Pyx_GOTREF(item);
2664 *(temps[i]) = item;
2665 }
2666 }
2667 #endif
2668 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2669 } else {
2670 Py_ssize_t index = -1;
2671 PyObject** temps[5] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_11,&__pyx_t_8,&__pyx_t_7};
2672 __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error)
2673 __Pyx_GOTREF(__pyx_t_6);
2674 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2675 __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext;
2676 for (index=0; index < 5; index++) {
2677 PyObject* item = __pyx_t_12(__pyx_t_6); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
2678 __Pyx_GOTREF(item);
2679 *(temps[index]) = item;
2680 }
2681 if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_6), 5) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
2682 __pyx_t_12 = NULL;
2683 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2684 goto __pyx_L6_unpacking_done;
2685 __pyx_L5_unpacking_failed:;
2686 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2687 __pyx_t_12 = NULL;
2688 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
2689 __PYX_ERR(0, 42, __pyx_L1_error)
2690 __pyx_L6_unpacking_done:;
2691 }
2692 __pyx_v_mat = __pyx_t_1;
2693 __pyx_t_1 = 0;
2694 __pyx_v_cl = __pyx_t_3;
2695 __pyx_t_3 = 0;
2696 __pyx_v_cu = __pyx_t_11;
2697 __pyx_t_11 = 0;
2698 __pyx_v_vl = __pyx_t_8;
2699 __pyx_t_8 = 0;
2700 __pyx_v_vu = __pyx_t_7;
2701 __pyx_t_7 = 0;
2702
2703 /* "cylp/cy/CyOsiCuts.pyx":44
2704 * mat, cl, cu, vl, vu = cyLpModel.makeMatrices()
2705 *
2706 * inds = np.arange(len(vl), dtype=np.int32) # <<<<<<<<<<<<<<
2707 * cdef np.ndarray[np.int32_t, ndim=1] vl_inds = inds
2708 * cdef np.ndarray[np.double_t, ndim=1] vl_data = vl
2709 */
2710 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
2711 __Pyx_GOTREF(__pyx_t_2);
2712 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_arange); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error)
2713 __Pyx_GOTREF(__pyx_t_7);
2714 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2715 __pyx_t_4 = PyObject_Length(__pyx_v_vl); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 44, __pyx_L1_error)
2716 __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
2717 __Pyx_GOTREF(__pyx_t_2);
2718 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 44, __pyx_L1_error)
2719 __Pyx_GOTREF(__pyx_t_8);
2720 __Pyx_GIVEREF(__pyx_t_2);
2721 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
2722 __pyx_t_2 = 0;
2723 __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
2724 __Pyx_GOTREF(__pyx_t_2);
2725 __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 44, __pyx_L1_error)
2726 __Pyx_GOTREF(__pyx_t_11);
2727 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_int32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
2728 __Pyx_GOTREF(__pyx_t_3);
2729 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
2730 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
2731 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2732 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
2733 __Pyx_GOTREF(__pyx_t_3);
2734 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2735 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2736 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2737 __pyx_v_inds = __pyx_t_3;
2738 __pyx_t_3 = 0;
2739
2740 /* "cylp/cy/CyOsiCuts.pyx":45
2741 *
2742 * inds = np.arange(len(vl), dtype=np.int32)
2743 * cdef np.ndarray[np.int32_t, ndim=1] vl_inds = inds # <<<<<<<<<<<<<<
2744 * cdef np.ndarray[np.double_t, ndim=1] vl_data = vl
2745 * cdef np.ndarray[np.int32_t, ndim=1] vu_inds = inds
2746 */
2747 if (!(likely(((__pyx_v_inds) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_inds, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 45, __pyx_L1_error)
2748 __pyx_t_3 = __pyx_v_inds;
2749 __Pyx_INCREF(__pyx_t_3);
2750 {
2751 __Pyx_BufFmt_StackElem __pyx_stack[1];
2752 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vl_inds.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
2753 __pyx_v_vl_inds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_vl_inds.rcbuffer->pybuffer.buf = NULL;
2754 __PYX_ERR(0, 45, __pyx_L1_error)
2755 } else {__pyx_pybuffernd_vl_inds.diminfo[0].strides = __pyx_pybuffernd_vl_inds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vl_inds.diminfo[0].shape = __pyx_pybuffernd_vl_inds.rcbuffer->pybuffer.shape[0];
2756 }
2757 }
2758 __pyx_v_vl_inds = ((PyArrayObject *)__pyx_t_3);
2759 __pyx_t_3 = 0;
2760
2761 /* "cylp/cy/CyOsiCuts.pyx":46
2762 * inds = np.arange(len(vl), dtype=np.int32)
2763 * cdef np.ndarray[np.int32_t, ndim=1] vl_inds = inds
2764 * cdef np.ndarray[np.double_t, ndim=1] vl_data = vl # <<<<<<<<<<<<<<
2765 * cdef np.ndarray[np.int32_t, ndim=1] vu_inds = inds
2766 * cdef np.ndarray[np.double_t, ndim=1] vu_data = vu
2767 */
2768 if (!(likely(((__pyx_v_vl) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_vl, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 46, __pyx_L1_error)
2769 __pyx_t_3 = __pyx_v_vl;
2770 __Pyx_INCREF(__pyx_t_3);
2771 {
2772 __Pyx_BufFmt_StackElem __pyx_stack[1];
2773 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vl_data.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
2774 __pyx_v_vl_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_vl_data.rcbuffer->pybuffer.buf = NULL;
2775 __PYX_ERR(0, 46, __pyx_L1_error)
2776 } else {__pyx_pybuffernd_vl_data.diminfo[0].strides = __pyx_pybuffernd_vl_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vl_data.diminfo[0].shape = __pyx_pybuffernd_vl_data.rcbuffer->pybuffer.shape[0];
2777 }
2778 }
2779 __pyx_v_vl_data = ((PyArrayObject *)__pyx_t_3);
2780 __pyx_t_3 = 0;
2781
2782 /* "cylp/cy/CyOsiCuts.pyx":47
2783 * cdef np.ndarray[np.int32_t, ndim=1] vl_inds = inds
2784 * cdef np.ndarray[np.double_t, ndim=1] vl_data = vl
2785 * cdef np.ndarray[np.int32_t, ndim=1] vu_inds = inds # <<<<<<<<<<<<<<
2786 * cdef np.ndarray[np.double_t, ndim=1] vu_data = vu
2787 *
2788 */
2789 if (!(likely(((__pyx_v_inds) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_inds, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 47, __pyx_L1_error)
2790 __pyx_t_3 = __pyx_v_inds;
2791 __Pyx_INCREF(__pyx_t_3);
2792 {
2793 __Pyx_BufFmt_StackElem __pyx_stack[1];
2794 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vu_inds.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
2795 __pyx_v_vu_inds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_vu_inds.rcbuffer->pybuffer.buf = NULL;
2796 __PYX_ERR(0, 47, __pyx_L1_error)
2797 } else {__pyx_pybuffernd_vu_inds.diminfo[0].strides = __pyx_pybuffernd_vu_inds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vu_inds.diminfo[0].shape = __pyx_pybuffernd_vu_inds.rcbuffer->pybuffer.shape[0];
2798 }
2799 }
2800 __pyx_v_vu_inds = ((PyArrayObject *)__pyx_t_3);
2801 __pyx_t_3 = 0;
2802
2803 /* "cylp/cy/CyOsiCuts.pyx":48
2804 * cdef np.ndarray[np.double_t, ndim=1] vl_data = vl
2805 * cdef np.ndarray[np.int32_t, ndim=1] vu_inds = inds
2806 * cdef np.ndarray[np.double_t, ndim=1] vu_data = vu # <<<<<<<<<<<<<<
2807 *
2808 * self.CppSelf.addColumnCut(len(vl),
2809 */
2810 if (!(likely(((__pyx_v_vu) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_vu, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 48, __pyx_L1_error)
2811 __pyx_t_3 = __pyx_v_vu;
2812 __Pyx_INCREF(__pyx_t_3);
2813 {
2814 __Pyx_BufFmt_StackElem __pyx_stack[1];
2815 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vu_data.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
2816 __pyx_v_vu_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_vu_data.rcbuffer->pybuffer.buf = NULL;
2817 __PYX_ERR(0, 48, __pyx_L1_error)
2818 } else {__pyx_pybuffernd_vu_data.diminfo[0].strides = __pyx_pybuffernd_vu_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vu_data.diminfo[0].shape = __pyx_pybuffernd_vu_data.rcbuffer->pybuffer.shape[0];
2819 }
2820 }
2821 __pyx_v_vu_data = ((PyArrayObject *)__pyx_t_3);
2822 __pyx_t_3 = 0;
2823
2824 /* "cylp/cy/CyOsiCuts.pyx":50
2825 * cdef np.ndarray[np.double_t, ndim=1] vu_data = vu
2826 *
2827 * self.CppSelf.addColumnCut(len(vl), # <<<<<<<<<<<<<<
2828 * <int*>vl_inds.data,
2829 * <double*>vl_data.data,
2830 */
2831 __pyx_t_4 = PyObject_Length(__pyx_v_vl); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 50, __pyx_L1_error)
2832
2833 /* "cylp/cy/CyOsiCuts.pyx":54
2834 * <double*>vl_data.data,
2835 * <int*>vu_inds.data,
2836 * <double*>vu_data.data) # <<<<<<<<<<<<<<
2837 *
2838 * def addRowCut(self, cut, cyLpModel):
2839 */
2840 __pyx_v_self->CppSelf->addColumnCut(__pyx_t_4, ((int *)__pyx_v_vl_inds->data), ((double *)__pyx_v_vl_data->data), ((int *)__pyx_v_vu_inds->data), ((double *)__pyx_v_vu_data->data));
2841
2842 /* "cylp/cy/CyOsiCuts.pyx":32
2843 * return self.CppSelf.sizeCuts()
2844 *
2845 * def addColumnCut(self, cut, cyLpModel): # <<<<<<<<<<<<<<
2846 * '''
2847 * Add ``cut`` to cuts. ``cut`` is a CyLPExpr
2848 */
2849
2850 /* function exit code */
2851 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2852 goto __pyx_L0;
2853 __pyx_L1_error:;
2854 __Pyx_XDECREF(__pyx_t_1);
2855 __Pyx_XDECREF(__pyx_t_2);
2856 __Pyx_XDECREF(__pyx_t_3);
2857 __Pyx_XDECREF(__pyx_t_6);
2858 __Pyx_XDECREF(__pyx_t_7);
2859 __Pyx_XDECREF(__pyx_t_8);
2860 __Pyx_XDECREF(__pyx_t_9);
2861 __Pyx_XDECREF(__pyx_t_11);
2862 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2863 __Pyx_PyThreadState_declare
2864 __Pyx_PyThreadState_assign
2865 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2866 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vl_data.rcbuffer->pybuffer);
2867 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vl_inds.rcbuffer->pybuffer);
2868 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vu_data.rcbuffer->pybuffer);
2869 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vu_inds.rcbuffer->pybuffer);
2870 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2871 __Pyx_AddTraceback("cylp.cy.CyOsiCuts.CyOsiCuts.addColumnCut", __pyx_clineno, __pyx_lineno, __pyx_filename);
2872 __pyx_r = NULL;
2873 goto __pyx_L2;
2874 __pyx_L0:;
2875 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vl_data.rcbuffer->pybuffer);
2876 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vl_inds.rcbuffer->pybuffer);
2877 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vu_data.rcbuffer->pybuffer);
2878 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vu_inds.rcbuffer->pybuffer);
2879 __pyx_L2:;
2880 __Pyx_XDECREF(__pyx_v_m);
2881 __Pyx_XDECREF(__pyx_v_var);
2882 __Pyx_XDECREF(__pyx_v_x);
2883 __Pyx_XDECREF(__pyx_v_mat);
2884 __Pyx_XDECREF(__pyx_v_cl);
2885 __Pyx_XDECREF(__pyx_v_cu);
2886 __Pyx_XDECREF(__pyx_v_vl);
2887 __Pyx_XDECREF(__pyx_v_vu);
2888 __Pyx_XDECREF(__pyx_v_inds);
2889 __Pyx_XDECREF((PyObject *)__pyx_v_vl_inds);
2890 __Pyx_XDECREF((PyObject *)__pyx_v_vl_data);
2891 __Pyx_XDECREF((PyObject *)__pyx_v_vu_inds);
2892 __Pyx_XDECREF((PyObject *)__pyx_v_vu_data);
2893 __Pyx_XGIVEREF(__pyx_r);
2894 __Pyx_RefNannyFinishContext();
2895 return __pyx_r;
2896 }
2897
2898 /* "cylp/cy/CyOsiCuts.pyx":56
2899 * <double*>vu_data.data)
2900 *
2901 * def addRowCut(self, cut, cyLpModel): # <<<<<<<<<<<<<<
2902 * '''
2903 * Add ``cut`` to cuts. ``cut`` is a CyLPExpr
2904 */
2905
2906 /* Python wrapper */
2907 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_7addRowCut(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2908 static char __pyx_doc_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_6addRowCut[] = "\n Add ``cut`` to cuts. ``cut`` is a CyLPExpr\n and ``cut.isRange`` is ``False``.\n ";
__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_7addRowCut(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2909 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_7addRowCut(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2910 PyObject *__pyx_v_cut = 0;
2911 PyObject *__pyx_v_cyLpModel = 0;
2912 PyObject *__pyx_r = 0;
2913 __Pyx_RefNannyDeclarations
2914 __Pyx_RefNannySetupContext("addRowCut (wrapper)", 0);
2915 {
2916 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cut,&__pyx_n_s_cyLpModel,0};
2917 PyObject* values[2] = {0,0};
2918 if (unlikely(__pyx_kwds)) {
2919 Py_ssize_t kw_args;
2920 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2921 switch (pos_args) {
2922 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2923 CYTHON_FALLTHROUGH;
2924 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2925 CYTHON_FALLTHROUGH;
2926 case 0: break;
2927 default: goto __pyx_L5_argtuple_error;
2928 }
2929 kw_args = PyDict_Size(__pyx_kwds);
2930 switch (pos_args) {
2931 case 0:
2932 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cut)) != 0)) kw_args--;
2933 else goto __pyx_L5_argtuple_error;
2934 CYTHON_FALLTHROUGH;
2935 case 1:
2936 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cyLpModel)) != 0)) kw_args--;
2937 else {
2938 __Pyx_RaiseArgtupleInvalid("addRowCut", 1, 2, 2, 1); __PYX_ERR(0, 56, __pyx_L3_error)
2939 }
2940 }
2941 if (unlikely(kw_args > 0)) {
2942 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "addRowCut") < 0)) __PYX_ERR(0, 56, __pyx_L3_error)
2943 }
2944 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2945 goto __pyx_L5_argtuple_error;
2946 } else {
2947 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2948 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2949 }
2950 __pyx_v_cut = values[0];
2951 __pyx_v_cyLpModel = values[1];
2952 }
2953 goto __pyx_L4_argument_unpacking_done;
2954 __pyx_L5_argtuple_error:;
2955 __Pyx_RaiseArgtupleInvalid("addRowCut", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error)
2956 __pyx_L3_error:;
2957 __Pyx_AddTraceback("cylp.cy.CyOsiCuts.CyOsiCuts.addRowCut", __pyx_clineno, __pyx_lineno, __pyx_filename);
2958 __Pyx_RefNannyFinishContext();
2959 return NULL;
2960 __pyx_L4_argument_unpacking_done:;
2961 __pyx_r = __pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_6addRowCut(((struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *)__pyx_v_self), __pyx_v_cut, __pyx_v_cyLpModel);
2962
2963 /* function exit code */
2964 __Pyx_RefNannyFinishContext();
2965 return __pyx_r;
2966 }
2967
__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_6addRowCut(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts * __pyx_v_self,PyObject * __pyx_v_cut,PyObject * __pyx_v_cyLpModel)2968 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_6addRowCut(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self, PyObject *__pyx_v_cut, PyObject *__pyx_v_cyLpModel) {
2969 PyObject *__pyx_v_m = NULL;
2970 PyObject *__pyx_v_var = NULL;
2971 PyObject *__pyx_v_mat = NULL;
2972 PyObject *__pyx_v_cl = NULL;
2973 PyObject *__pyx_v_cu = NULL;
2974 CYTHON_UNUSED PyObject *__pyx_v_vl = NULL;
2975 CYTHON_UNUSED PyObject *__pyx_v_vu = NULL;
2976 PyArrayObject *__pyx_v_row_inds = 0;
2977 PyArrayObject *__pyx_v_row_data = 0;
2978 PyObject *__pyx_v_nr = NULL;
2979 PyObject *__pyx_v_row = NULL;
2980 __Pyx_LocalBuf_ND __pyx_pybuffernd_row_data;
2981 __Pyx_Buffer __pyx_pybuffer_row_data;
2982 __Pyx_LocalBuf_ND __pyx_pybuffernd_row_inds;
2983 __Pyx_Buffer __pyx_pybuffer_row_inds;
2984 PyObject *__pyx_r = NULL;
2985 __Pyx_RefNannyDeclarations
2986 PyObject *__pyx_t_1 = NULL;
2987 PyObject *__pyx_t_2 = NULL;
2988 PyObject *__pyx_t_3 = NULL;
2989 Py_ssize_t __pyx_t_4;
2990 PyObject *(*__pyx_t_5)(PyObject *);
2991 PyObject *__pyx_t_6 = NULL;
2992 PyObject *__pyx_t_7 = NULL;
2993 PyObject *__pyx_t_8 = NULL;
2994 PyObject *__pyx_t_9 = NULL;
2995 int __pyx_t_10;
2996 PyObject *__pyx_t_11 = NULL;
2997 PyObject *(*__pyx_t_12)(PyObject *);
2998 PyArrayObject *__pyx_t_13 = NULL;
2999 PyObject *__pyx_t_14 = NULL;
3000 PyObject *__pyx_t_15 = NULL;
3001 PyObject *__pyx_t_16 = NULL;
3002 PyArrayObject *__pyx_t_17 = NULL;
3003 Py_ssize_t __pyx_t_18;
3004 Py_ssize_t __pyx_t_19;
3005 double __pyx_t_20;
3006 double __pyx_t_21;
3007 __Pyx_RefNannySetupContext("addRowCut", 0);
3008 __pyx_pybuffer_row_inds.pybuffer.buf = NULL;
3009 __pyx_pybuffer_row_inds.refcount = 0;
3010 __pyx_pybuffernd_row_inds.data = NULL;
3011 __pyx_pybuffernd_row_inds.rcbuffer = &__pyx_pybuffer_row_inds;
3012 __pyx_pybuffer_row_data.pybuffer.buf = NULL;
3013 __pyx_pybuffer_row_data.refcount = 0;
3014 __pyx_pybuffernd_row_data.data = NULL;
3015 __pyx_pybuffernd_row_data.rcbuffer = &__pyx_pybuffer_row_data;
3016
3017 /* "cylp/cy/CyOsiCuts.pyx":61
3018 * and ``cut.isRange`` is ``False``.
3019 * '''
3020 * m = CyLPModel() # <<<<<<<<<<<<<<
3021 * for var in cyLpModel.variables:
3022 * m.addVariable(var.name, var.dim, var.isInt)
3023 */
3024 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CyLPModel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error)
3025 __Pyx_GOTREF(__pyx_t_2);
3026 __pyx_t_3 = NULL;
3027 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3028 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3029 if (likely(__pyx_t_3)) {
3030 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3031 __Pyx_INCREF(__pyx_t_3);
3032 __Pyx_INCREF(function);
3033 __Pyx_DECREF_SET(__pyx_t_2, function);
3034 }
3035 }
3036 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
3037 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3038 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
3039 __Pyx_GOTREF(__pyx_t_1);
3040 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3041 __pyx_v_m = __pyx_t_1;
3042 __pyx_t_1 = 0;
3043
3044 /* "cylp/cy/CyOsiCuts.pyx":62
3045 * '''
3046 * m = CyLPModel()
3047 * for var in cyLpModel.variables: # <<<<<<<<<<<<<<
3048 * m.addVariable(var.name, var.dim, var.isInt)
3049 * m += cut
3050 */
3051 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cyLpModel, __pyx_n_s_variables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
3052 __Pyx_GOTREF(__pyx_t_1);
3053 if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
3054 __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
3055 __pyx_t_5 = NULL;
3056 } else {
3057 __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
3058 __Pyx_GOTREF(__pyx_t_2);
3059 __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error)
3060 }
3061 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3062 for (;;) {
3063 if (likely(!__pyx_t_5)) {
3064 if (likely(PyList_CheckExact(__pyx_t_2))) {
3065 if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
3066 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3067 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 62, __pyx_L1_error)
3068 #else
3069 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
3070 __Pyx_GOTREF(__pyx_t_1);
3071 #endif
3072 } else {
3073 if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
3074 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3075 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 62, __pyx_L1_error)
3076 #else
3077 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
3078 __Pyx_GOTREF(__pyx_t_1);
3079 #endif
3080 }
3081 } else {
3082 __pyx_t_1 = __pyx_t_5(__pyx_t_2);
3083 if (unlikely(!__pyx_t_1)) {
3084 PyObject* exc_type = PyErr_Occurred();
3085 if (exc_type) {
3086 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3087 else __PYX_ERR(0, 62, __pyx_L1_error)
3088 }
3089 break;
3090 }
3091 __Pyx_GOTREF(__pyx_t_1);
3092 }
3093 __Pyx_XDECREF_SET(__pyx_v_var, __pyx_t_1);
3094 __pyx_t_1 = 0;
3095
3096 /* "cylp/cy/CyOsiCuts.pyx":63
3097 * m = CyLPModel()
3098 * for var in cyLpModel.variables:
3099 * m.addVariable(var.name, var.dim, var.isInt) # <<<<<<<<<<<<<<
3100 * m += cut
3101 * mat, cl, cu, vl, vu = m.makeMatrices()
3102 */
3103 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_addVariable); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error)
3104 __Pyx_GOTREF(__pyx_t_3);
3105 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_var, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 63, __pyx_L1_error)
3106 __Pyx_GOTREF(__pyx_t_6);
3107 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_var, __pyx_n_s_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 63, __pyx_L1_error)
3108 __Pyx_GOTREF(__pyx_t_7);
3109 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_var, __pyx_n_s_isInt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 63, __pyx_L1_error)
3110 __Pyx_GOTREF(__pyx_t_8);
3111 __pyx_t_9 = NULL;
3112 __pyx_t_10 = 0;
3113 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
3114 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
3115 if (likely(__pyx_t_9)) {
3116 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3117 __Pyx_INCREF(__pyx_t_9);
3118 __Pyx_INCREF(function);
3119 __Pyx_DECREF_SET(__pyx_t_3, function);
3120 __pyx_t_10 = 1;
3121 }
3122 }
3123 #if CYTHON_FAST_PYCALL
3124 if (PyFunction_Check(__pyx_t_3)) {
3125 PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_6, __pyx_t_7, __pyx_t_8};
3126 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
3127 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3128 __Pyx_GOTREF(__pyx_t_1);
3129 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3130 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3131 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3132 } else
3133 #endif
3134 #if CYTHON_FAST_PYCCALL
3135 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
3136 PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_6, __pyx_t_7, __pyx_t_8};
3137 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
3138 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3139 __Pyx_GOTREF(__pyx_t_1);
3140 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3141 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3142 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3143 } else
3144 #endif
3145 {
3146 __pyx_t_11 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 63, __pyx_L1_error)
3147 __Pyx_GOTREF(__pyx_t_11);
3148 if (__pyx_t_9) {
3149 __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
3150 }
3151 __Pyx_GIVEREF(__pyx_t_6);
3152 PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_6);
3153 __Pyx_GIVEREF(__pyx_t_7);
3154 PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_7);
3155 __Pyx_GIVEREF(__pyx_t_8);
3156 PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_8);
3157 __pyx_t_6 = 0;
3158 __pyx_t_7 = 0;
3159 __pyx_t_8 = 0;
3160 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
3161 __Pyx_GOTREF(__pyx_t_1);
3162 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3163 }
3164 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3165 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3166
3167 /* "cylp/cy/CyOsiCuts.pyx":62
3168 * '''
3169 * m = CyLPModel()
3170 * for var in cyLpModel.variables: # <<<<<<<<<<<<<<
3171 * m.addVariable(var.name, var.dim, var.isInt)
3172 * m += cut
3173 */
3174 }
3175 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3176
3177 /* "cylp/cy/CyOsiCuts.pyx":64
3178 * for var in cyLpModel.variables:
3179 * m.addVariable(var.name, var.dim, var.isInt)
3180 * m += cut # <<<<<<<<<<<<<<
3181 * mat, cl, cu, vl, vu = m.makeMatrices()
3182 *
3183 */
3184 __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_m, __pyx_v_cut); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
3185 __Pyx_GOTREF(__pyx_t_2);
3186 __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_2);
3187 __pyx_t_2 = 0;
3188
3189 /* "cylp/cy/CyOsiCuts.pyx":65
3190 * m.addVariable(var.name, var.dim, var.isInt)
3191 * m += cut
3192 * mat, cl, cu, vl, vu = m.makeMatrices() # <<<<<<<<<<<<<<
3193 *
3194 * cdef np.ndarray[np.int32_t, ndim=1] row_inds
3195 */
3196 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_makeMatrices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
3197 __Pyx_GOTREF(__pyx_t_1);
3198 __pyx_t_3 = NULL;
3199 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
3200 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
3201 if (likely(__pyx_t_3)) {
3202 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3203 __Pyx_INCREF(__pyx_t_3);
3204 __Pyx_INCREF(function);
3205 __Pyx_DECREF_SET(__pyx_t_1, function);
3206 }
3207 }
3208 __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
3209 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3210 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error)
3211 __Pyx_GOTREF(__pyx_t_2);
3212 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3213 if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
3214 PyObject* sequence = __pyx_t_2;
3215 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3216 if (unlikely(size != 5)) {
3217 if (size > 5) __Pyx_RaiseTooManyValuesError(5);
3218 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3219 __PYX_ERR(0, 65, __pyx_L1_error)
3220 }
3221 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3222 if (likely(PyTuple_CheckExact(sequence))) {
3223 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
3224 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
3225 __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
3226 __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3);
3227 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 4);
3228 } else {
3229 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
3230 __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
3231 __pyx_t_11 = PyList_GET_ITEM(sequence, 2);
3232 __pyx_t_8 = PyList_GET_ITEM(sequence, 3);
3233 __pyx_t_7 = PyList_GET_ITEM(sequence, 4);
3234 }
3235 __Pyx_INCREF(__pyx_t_1);
3236 __Pyx_INCREF(__pyx_t_3);
3237 __Pyx_INCREF(__pyx_t_11);
3238 __Pyx_INCREF(__pyx_t_8);
3239 __Pyx_INCREF(__pyx_t_7);
3240 #else
3241 {
3242 Py_ssize_t i;
3243 PyObject** temps[5] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_11,&__pyx_t_8,&__pyx_t_7};
3244 for (i=0; i < 5; i++) {
3245 PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 65, __pyx_L1_error)
3246 __Pyx_GOTREF(item);
3247 *(temps[i]) = item;
3248 }
3249 }
3250 #endif
3251 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3252 } else {
3253 Py_ssize_t index = -1;
3254 PyObject** temps[5] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_11,&__pyx_t_8,&__pyx_t_7};
3255 __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L1_error)
3256 __Pyx_GOTREF(__pyx_t_6);
3257 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3258 __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext;
3259 for (index=0; index < 5; index++) {
3260 PyObject* item = __pyx_t_12(__pyx_t_6); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
3261 __Pyx_GOTREF(item);
3262 *(temps[index]) = item;
3263 }
3264 if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_6), 5) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
3265 __pyx_t_12 = NULL;
3266 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3267 goto __pyx_L6_unpacking_done;
3268 __pyx_L5_unpacking_failed:;
3269 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3270 __pyx_t_12 = NULL;
3271 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3272 __PYX_ERR(0, 65, __pyx_L1_error)
3273 __pyx_L6_unpacking_done:;
3274 }
3275 __pyx_v_mat = __pyx_t_1;
3276 __pyx_t_1 = 0;
3277 __pyx_v_cl = __pyx_t_3;
3278 __pyx_t_3 = 0;
3279 __pyx_v_cu = __pyx_t_11;
3280 __pyx_t_11 = 0;
3281 __pyx_v_vl = __pyx_t_8;
3282 __pyx_t_8 = 0;
3283 __pyx_v_vu = __pyx_t_7;
3284 __pyx_t_7 = 0;
3285
3286 /* "cylp/cy/CyOsiCuts.pyx":70
3287 * cdef np.ndarray[np.double_t, ndim=1] row_data
3288 *
3289 * for nr in xrange(mat.shape[0]): # <<<<<<<<<<<<<<
3290 * row = mat[nr, :]
3291 * row_inds = row.indices
3292 */
3293 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_mat, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
3294 __Pyx_GOTREF(__pyx_t_2);
3295 __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 70, __pyx_L1_error)
3296 __Pyx_GOTREF(__pyx_t_7);
3297 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3298 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_xrange, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
3299 __Pyx_GOTREF(__pyx_t_2);
3300 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3301 if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
3302 __pyx_t_7 = __pyx_t_2; __Pyx_INCREF(__pyx_t_7); __pyx_t_4 = 0;
3303 __pyx_t_5 = NULL;
3304 } else {
3305 __pyx_t_4 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 70, __pyx_L1_error)
3306 __Pyx_GOTREF(__pyx_t_7);
3307 __pyx_t_5 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error)
3308 }
3309 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3310 for (;;) {
3311 if (likely(!__pyx_t_5)) {
3312 if (likely(PyList_CheckExact(__pyx_t_7))) {
3313 if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_7)) break;
3314 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3315 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 70, __pyx_L1_error)
3316 #else
3317 __pyx_t_2 = PySequence_ITEM(__pyx_t_7, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
3318 __Pyx_GOTREF(__pyx_t_2);
3319 #endif
3320 } else {
3321 if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
3322 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3323 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 70, __pyx_L1_error)
3324 #else
3325 __pyx_t_2 = PySequence_ITEM(__pyx_t_7, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
3326 __Pyx_GOTREF(__pyx_t_2);
3327 #endif
3328 }
3329 } else {
3330 __pyx_t_2 = __pyx_t_5(__pyx_t_7);
3331 if (unlikely(!__pyx_t_2)) {
3332 PyObject* exc_type = PyErr_Occurred();
3333 if (exc_type) {
3334 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3335 else __PYX_ERR(0, 70, __pyx_L1_error)
3336 }
3337 break;
3338 }
3339 __Pyx_GOTREF(__pyx_t_2);
3340 }
3341 __Pyx_XDECREF_SET(__pyx_v_nr, __pyx_t_2);
3342 __pyx_t_2 = 0;
3343
3344 /* "cylp/cy/CyOsiCuts.pyx":71
3345 *
3346 * for nr in xrange(mat.shape[0]):
3347 * row = mat[nr, :] # <<<<<<<<<<<<<<
3348 * row_inds = row.indices
3349 * row_data = row.data
3350 */
3351 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error)
3352 __Pyx_GOTREF(__pyx_t_2);
3353 __Pyx_INCREF(__pyx_v_nr);
3354 __Pyx_GIVEREF(__pyx_v_nr);
3355 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_nr);
3356 __Pyx_INCREF(__pyx_slice_);
3357 __Pyx_GIVEREF(__pyx_slice_);
3358 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice_);
3359 __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_mat, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 71, __pyx_L1_error)
3360 __Pyx_GOTREF(__pyx_t_8);
3361 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3362 __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_8);
3363 __pyx_t_8 = 0;
3364
3365 /* "cylp/cy/CyOsiCuts.pyx":72
3366 * for nr in xrange(mat.shape[0]):
3367 * row = mat[nr, :]
3368 * row_inds = row.indices # <<<<<<<<<<<<<<
3369 * row_data = row.data
3370 * assert len(row_inds) == len(row_data)
3371 */
3372 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_indices); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 72, __pyx_L1_error)
3373 __Pyx_GOTREF(__pyx_t_8);
3374 if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 72, __pyx_L1_error)
3375 __pyx_t_13 = ((PyArrayObject *)__pyx_t_8);
3376 {
3377 __Pyx_BufFmt_StackElem __pyx_stack[1];
3378 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_row_inds.rcbuffer->pybuffer);
3379 __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_row_inds.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
3380 if (unlikely(__pyx_t_10 < 0)) {
3381 PyErr_Fetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
3382 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_row_inds.rcbuffer->pybuffer, (PyObject*)__pyx_v_row_inds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
3383 Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16);
3384 __Pyx_RaiseBufferFallbackError();
3385 } else {
3386 PyErr_Restore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
3387 }
3388 __pyx_t_14 = __pyx_t_15 = __pyx_t_16 = 0;
3389 }
3390 __pyx_pybuffernd_row_inds.diminfo[0].strides = __pyx_pybuffernd_row_inds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_row_inds.diminfo[0].shape = __pyx_pybuffernd_row_inds.rcbuffer->pybuffer.shape[0];
3391 if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 72, __pyx_L1_error)
3392 }
3393 __pyx_t_13 = 0;
3394 __Pyx_XDECREF_SET(__pyx_v_row_inds, ((PyArrayObject *)__pyx_t_8));
3395 __pyx_t_8 = 0;
3396
3397 /* "cylp/cy/CyOsiCuts.pyx":73
3398 * row = mat[nr, :]
3399 * row_inds = row.indices
3400 * row_data = row.data # <<<<<<<<<<<<<<
3401 * assert len(row_inds) == len(row_data)
3402 * self.CppSelf.addRowCut(len(row_inds),
3403 */
3404 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_data); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 73, __pyx_L1_error)
3405 __Pyx_GOTREF(__pyx_t_8);
3406 if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 73, __pyx_L1_error)
3407 __pyx_t_17 = ((PyArrayObject *)__pyx_t_8);
3408 {
3409 __Pyx_BufFmt_StackElem __pyx_stack[1];
3410 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_row_data.rcbuffer->pybuffer);
3411 __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_row_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
3412 if (unlikely(__pyx_t_10 < 0)) {
3413 PyErr_Fetch(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
3414 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_row_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_row_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
3415 Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14);
3416 __Pyx_RaiseBufferFallbackError();
3417 } else {
3418 PyErr_Restore(__pyx_t_16, __pyx_t_15, __pyx_t_14);
3419 }
3420 __pyx_t_16 = __pyx_t_15 = __pyx_t_14 = 0;
3421 }
3422 __pyx_pybuffernd_row_data.diminfo[0].strides = __pyx_pybuffernd_row_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_row_data.diminfo[0].shape = __pyx_pybuffernd_row_data.rcbuffer->pybuffer.shape[0];
3423 if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 73, __pyx_L1_error)
3424 }
3425 __pyx_t_17 = 0;
3426 __Pyx_XDECREF_SET(__pyx_v_row_data, ((PyArrayObject *)__pyx_t_8));
3427 __pyx_t_8 = 0;
3428
3429 /* "cylp/cy/CyOsiCuts.pyx":74
3430 * row_inds = row.indices
3431 * row_data = row.data
3432 * assert len(row_inds) == len(row_data) # <<<<<<<<<<<<<<
3433 * self.CppSelf.addRowCut(len(row_inds),
3434 * <int*>row_inds.data,
3435 */
3436 #ifndef CYTHON_WITHOUT_ASSERTIONS
3437 if (unlikely(!Py_OptimizeFlag)) {
3438 __pyx_t_18 = PyObject_Length(((PyObject *)__pyx_v_row_inds)); if (unlikely(__pyx_t_18 == ((Py_ssize_t)-1))) __PYX_ERR(0, 74, __pyx_L1_error)
3439 __pyx_t_19 = PyObject_Length(((PyObject *)__pyx_v_row_data)); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 74, __pyx_L1_error)
3440 if (unlikely(!((__pyx_t_18 == __pyx_t_19) != 0))) {
3441 PyErr_SetNone(PyExc_AssertionError);
3442 __PYX_ERR(0, 74, __pyx_L1_error)
3443 }
3444 }
3445 #endif
3446
3447 /* "cylp/cy/CyOsiCuts.pyx":75
3448 * row_data = row.data
3449 * assert len(row_inds) == len(row_data)
3450 * self.CppSelf.addRowCut(len(row_inds), # <<<<<<<<<<<<<<
3451 * <int*>row_inds.data,
3452 * <double*>row_data.data,
3453 */
3454 __pyx_t_19 = PyObject_Length(((PyObject *)__pyx_v_row_inds)); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 75, __pyx_L1_error)
3455
3456 /* "cylp/cy/CyOsiCuts.pyx":78
3457 * <int*>row_inds.data,
3458 * <double*>row_data.data,
3459 * cl[nr], cu[nr]) # <<<<<<<<<<<<<<
3460 *
3461 *
3462 */
3463 __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_cl, __pyx_v_nr); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __pyx_L1_error)
3464 __Pyx_GOTREF(__pyx_t_8);
3465 __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error)
3466 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3467 __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_cu, __pyx_v_nr); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __pyx_L1_error)
3468 __Pyx_GOTREF(__pyx_t_8);
3469 __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error)
3470 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3471
3472 /* "cylp/cy/CyOsiCuts.pyx":75
3473 * row_data = row.data
3474 * assert len(row_inds) == len(row_data)
3475 * self.CppSelf.addRowCut(len(row_inds), # <<<<<<<<<<<<<<
3476 * <int*>row_inds.data,
3477 * <double*>row_data.data,
3478 */
3479 __pyx_v_self->CppSelf->addRowCut(__pyx_t_19, ((int *)__pyx_v_row_inds->data), ((double *)__pyx_v_row_data->data), __pyx_t_20, __pyx_t_21);
3480
3481 /* "cylp/cy/CyOsiCuts.pyx":70
3482 * cdef np.ndarray[np.double_t, ndim=1] row_data
3483 *
3484 * for nr in xrange(mat.shape[0]): # <<<<<<<<<<<<<<
3485 * row = mat[nr, :]
3486 * row_inds = row.indices
3487 */
3488 }
3489 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3490
3491 /* "cylp/cy/CyOsiCuts.pyx":56
3492 * <double*>vu_data.data)
3493 *
3494 * def addRowCut(self, cut, cyLpModel): # <<<<<<<<<<<<<<
3495 * '''
3496 * Add ``cut`` to cuts. ``cut`` is a CyLPExpr
3497 */
3498
3499 /* function exit code */
3500 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3501 goto __pyx_L0;
3502 __pyx_L1_error:;
3503 __Pyx_XDECREF(__pyx_t_1);
3504 __Pyx_XDECREF(__pyx_t_2);
3505 __Pyx_XDECREF(__pyx_t_3);
3506 __Pyx_XDECREF(__pyx_t_6);
3507 __Pyx_XDECREF(__pyx_t_7);
3508 __Pyx_XDECREF(__pyx_t_8);
3509 __Pyx_XDECREF(__pyx_t_9);
3510 __Pyx_XDECREF(__pyx_t_11);
3511 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3512 __Pyx_PyThreadState_declare
3513 __Pyx_PyThreadState_assign
3514 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3515 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_row_data.rcbuffer->pybuffer);
3516 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_row_inds.rcbuffer->pybuffer);
3517 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3518 __Pyx_AddTraceback("cylp.cy.CyOsiCuts.CyOsiCuts.addRowCut", __pyx_clineno, __pyx_lineno, __pyx_filename);
3519 __pyx_r = NULL;
3520 goto __pyx_L2;
3521 __pyx_L0:;
3522 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_row_data.rcbuffer->pybuffer);
3523 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_row_inds.rcbuffer->pybuffer);
3524 __pyx_L2:;
3525 __Pyx_XDECREF(__pyx_v_m);
3526 __Pyx_XDECREF(__pyx_v_var);
3527 __Pyx_XDECREF(__pyx_v_mat);
3528 __Pyx_XDECREF(__pyx_v_cl);
3529 __Pyx_XDECREF(__pyx_v_cu);
3530 __Pyx_XDECREF(__pyx_v_vl);
3531 __Pyx_XDECREF(__pyx_v_vu);
3532 __Pyx_XDECREF((PyObject *)__pyx_v_row_inds);
3533 __Pyx_XDECREF((PyObject *)__pyx_v_row_data);
3534 __Pyx_XDECREF(__pyx_v_nr);
3535 __Pyx_XDECREF(__pyx_v_row);
3536 __Pyx_XGIVEREF(__pyx_r);
3537 __Pyx_RefNannyFinishContext();
3538 return __pyx_r;
3539 }
3540
3541 /* "(tree fragment)":1
3542 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
3543 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3544 * def __setstate_cython__(self, __pyx_state):
3545 */
3546
3547 /* Python wrapper */
3548 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_9__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3549 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3550 PyObject *__pyx_r = 0;
3551 __Pyx_RefNannyDeclarations
3552 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
3553 __pyx_r = __pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_8__reduce_cython__(((struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *)__pyx_v_self));
3554
3555 /* function exit code */
3556 __Pyx_RefNannyFinishContext();
3557 return __pyx_r;
3558 }
3559
__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts * __pyx_v_self)3560 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self) {
3561 PyObject *__pyx_r = NULL;
3562 __Pyx_RefNannyDeclarations
3563 PyObject *__pyx_t_1 = NULL;
3564 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
3565
3566 /* "(tree fragment)":2
3567 * def __reduce_cython__(self):
3568 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
3569 * def __setstate_cython__(self, __pyx_state):
3570 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3571 */
3572 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
3573 __Pyx_GOTREF(__pyx_t_1);
3574 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3575 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3576 __PYX_ERR(1, 2, __pyx_L1_error)
3577
3578 /* "(tree fragment)":1
3579 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
3580 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3581 * def __setstate_cython__(self, __pyx_state):
3582 */
3583
3584 /* function exit code */
3585 __pyx_L1_error:;
3586 __Pyx_XDECREF(__pyx_t_1);
3587 __Pyx_AddTraceback("cylp.cy.CyOsiCuts.CyOsiCuts.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3588 __pyx_r = NULL;
3589 __Pyx_XGIVEREF(__pyx_r);
3590 __Pyx_RefNannyFinishContext();
3591 return __pyx_r;
3592 }
3593
3594 /* "(tree fragment)":3
3595 * def __reduce_cython__(self):
3596 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3597 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
3598 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3599 */
3600
3601 /* Python wrapper */
3602 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_11__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)3603 static PyObject *__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3604 PyObject *__pyx_r = 0;
3605 __Pyx_RefNannyDeclarations
3606 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
3607 __pyx_r = __pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_10__setstate_cython__(((struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3608
3609 /* function exit code */
3610 __Pyx_RefNannyFinishContext();
3611 return __pyx_r;
3612 }
3613
__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)3614 static PyObject *__pyx_pf_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
3615 PyObject *__pyx_r = NULL;
3616 __Pyx_RefNannyDeclarations
3617 PyObject *__pyx_t_1 = NULL;
3618 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
3619
3620 /* "(tree fragment)":4
3621 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3622 * def __setstate_cython__(self, __pyx_state):
3623 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
3624 */
3625 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
3626 __Pyx_GOTREF(__pyx_t_1);
3627 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3628 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3629 __PYX_ERR(1, 4, __pyx_L1_error)
3630
3631 /* "(tree fragment)":3
3632 * def __reduce_cython__(self):
3633 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3634 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
3635 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3636 */
3637
3638 /* function exit code */
3639 __pyx_L1_error:;
3640 __Pyx_XDECREF(__pyx_t_1);
3641 __Pyx_AddTraceback("cylp.cy.CyOsiCuts.CyOsiCuts.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3642 __pyx_r = NULL;
3643 __Pyx_XGIVEREF(__pyx_r);
3644 __Pyx_RefNannyFinishContext();
3645 return __pyx_r;
3646 }
3647
3648 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":258
3649 * # experimental exception made for __getbuffer__ and __releasebuffer__
3650 * # -- the details of this may change.
3651 * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
3652 * # This implementation of getbuffer is geared towards Cython
3653 * # requirements, and does not yet fulfill the PEP.
3654 */
3655
3656 /* Python wrapper */
3657 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)3658 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
3659 int __pyx_r;
3660 __Pyx_RefNannyDeclarations
3661 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
3662 __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
3663
3664 /* function exit code */
3665 __Pyx_RefNannyFinishContext();
3666 return __pyx_r;
3667 }
3668
__pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)3669 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
3670 int __pyx_v_i;
3671 int __pyx_v_ndim;
3672 int __pyx_v_endian_detector;
3673 int __pyx_v_little_endian;
3674 int __pyx_v_t;
3675 char *__pyx_v_f;
3676 PyArray_Descr *__pyx_v_descr = 0;
3677 int __pyx_v_offset;
3678 int __pyx_r;
3679 __Pyx_RefNannyDeclarations
3680 int __pyx_t_1;
3681 int __pyx_t_2;
3682 PyObject *__pyx_t_3 = NULL;
3683 int __pyx_t_4;
3684 int __pyx_t_5;
3685 int __pyx_t_6;
3686 PyArray_Descr *__pyx_t_7;
3687 PyObject *__pyx_t_8 = NULL;
3688 char *__pyx_t_9;
3689 if (__pyx_v_info == NULL) {
3690 PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
3691 return -1;
3692 }
3693 __Pyx_RefNannySetupContext("__getbuffer__", 0);
3694 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
3695 __Pyx_GIVEREF(__pyx_v_info->obj);
3696
3697 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":265
3698 *
3699 * cdef int i, ndim
3700 * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
3701 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
3702 *
3703 */
3704 __pyx_v_endian_detector = 1;
3705
3706 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":266
3707 * cdef int i, ndim
3708 * cdef int endian_detector = 1
3709 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
3710 *
3711 * ndim = PyArray_NDIM(self)
3712 */
3713 __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
3714
3715 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":268
3716 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
3717 *
3718 * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
3719 *
3720 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
3721 */
3722 __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
3723
3724 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":270
3725 * ndim = PyArray_NDIM(self)
3726 *
3727 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
3728 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
3729 * raise ValueError(u"ndarray is not C contiguous")
3730 */
3731 __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
3732 if (__pyx_t_2) {
3733 } else {
3734 __pyx_t_1 = __pyx_t_2;
3735 goto __pyx_L4_bool_binop_done;
3736 }
3737
3738 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":271
3739 *
3740 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
3741 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
3742 * raise ValueError(u"ndarray is not C contiguous")
3743 *
3744 */
3745 __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
3746 __pyx_t_1 = __pyx_t_2;
3747 __pyx_L4_bool_binop_done:;
3748
3749 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":270
3750 * ndim = PyArray_NDIM(self)
3751 *
3752 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
3753 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
3754 * raise ValueError(u"ndarray is not C contiguous")
3755 */
3756 if (unlikely(__pyx_t_1)) {
3757
3758 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":272
3759 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
3760 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
3761 * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
3762 *
3763 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
3764 */
3765 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 272, __pyx_L1_error)
3766 __Pyx_GOTREF(__pyx_t_3);
3767 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
3768 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3769 __PYX_ERR(2, 272, __pyx_L1_error)
3770
3771 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":270
3772 * ndim = PyArray_NDIM(self)
3773 *
3774 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
3775 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
3776 * raise ValueError(u"ndarray is not C contiguous")
3777 */
3778 }
3779
3780 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":274
3781 * raise ValueError(u"ndarray is not C contiguous")
3782 *
3783 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
3784 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
3785 * raise ValueError(u"ndarray is not Fortran contiguous")
3786 */
3787 __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
3788 if (__pyx_t_2) {
3789 } else {
3790 __pyx_t_1 = __pyx_t_2;
3791 goto __pyx_L7_bool_binop_done;
3792 }
3793
3794 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":275
3795 *
3796 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
3797 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
3798 * raise ValueError(u"ndarray is not Fortran contiguous")
3799 *
3800 */
3801 __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
3802 __pyx_t_1 = __pyx_t_2;
3803 __pyx_L7_bool_binop_done:;
3804
3805 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":274
3806 * raise ValueError(u"ndarray is not C contiguous")
3807 *
3808 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
3809 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
3810 * raise ValueError(u"ndarray is not Fortran contiguous")
3811 */
3812 if (unlikely(__pyx_t_1)) {
3813
3814 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":276
3815 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
3816 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
3817 * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
3818 *
3819 * info.buf = PyArray_DATA(self)
3820 */
3821 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 276, __pyx_L1_error)
3822 __Pyx_GOTREF(__pyx_t_3);
3823 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
3824 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3825 __PYX_ERR(2, 276, __pyx_L1_error)
3826
3827 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":274
3828 * raise ValueError(u"ndarray is not C contiguous")
3829 *
3830 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
3831 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
3832 * raise ValueError(u"ndarray is not Fortran contiguous")
3833 */
3834 }
3835
3836 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":278
3837 * raise ValueError(u"ndarray is not Fortran contiguous")
3838 *
3839 * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
3840 * info.ndim = ndim
3841 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
3842 */
3843 __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
3844
3845 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":279
3846 *
3847 * info.buf = PyArray_DATA(self)
3848 * info.ndim = ndim # <<<<<<<<<<<<<<
3849 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
3850 * # Allocate new buffer for strides and shape info.
3851 */
3852 __pyx_v_info->ndim = __pyx_v_ndim;
3853
3854 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":280
3855 * info.buf = PyArray_DATA(self)
3856 * info.ndim = ndim
3857 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
3858 * # Allocate new buffer for strides and shape info.
3859 * # This is allocated as one block, strides first.
3860 */
3861 __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
3862 if (__pyx_t_1) {
3863
3864 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":283
3865 * # Allocate new buffer for strides and shape info.
3866 * # This is allocated as one block, strides first.
3867 * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim) # <<<<<<<<<<<<<<
3868 * info.shape = info.strides + ndim
3869 * for i in range(ndim):
3870 */
3871 __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
3872
3873 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":284
3874 * # This is allocated as one block, strides first.
3875 * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
3876 * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
3877 * for i in range(ndim):
3878 * info.strides[i] = PyArray_STRIDES(self)[i]
3879 */
3880 __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
3881
3882 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":285
3883 * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
3884 * info.shape = info.strides + ndim
3885 * for i in range(ndim): # <<<<<<<<<<<<<<
3886 * info.strides[i] = PyArray_STRIDES(self)[i]
3887 * info.shape[i] = PyArray_DIMS(self)[i]
3888 */
3889 __pyx_t_4 = __pyx_v_ndim;
3890 __pyx_t_5 = __pyx_t_4;
3891 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
3892 __pyx_v_i = __pyx_t_6;
3893
3894 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":286
3895 * info.shape = info.strides + ndim
3896 * for i in range(ndim):
3897 * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
3898 * info.shape[i] = PyArray_DIMS(self)[i]
3899 * else:
3900 */
3901 (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
3902
3903 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":287
3904 * for i in range(ndim):
3905 * info.strides[i] = PyArray_STRIDES(self)[i]
3906 * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
3907 * else:
3908 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
3909 */
3910 (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
3911 }
3912
3913 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":280
3914 * info.buf = PyArray_DATA(self)
3915 * info.ndim = ndim
3916 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
3917 * # Allocate new buffer for strides and shape info.
3918 * # This is allocated as one block, strides first.
3919 */
3920 goto __pyx_L9;
3921 }
3922
3923 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":289
3924 * info.shape[i] = PyArray_DIMS(self)[i]
3925 * else:
3926 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
3927 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
3928 * info.suboffsets = NULL
3929 */
3930 /*else*/ {
3931 __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
3932
3933 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":290
3934 * else:
3935 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
3936 * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
3937 * info.suboffsets = NULL
3938 * info.itemsize = PyArray_ITEMSIZE(self)
3939 */
3940 __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
3941 }
3942 __pyx_L9:;
3943
3944 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":291
3945 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
3946 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
3947 * info.suboffsets = NULL # <<<<<<<<<<<<<<
3948 * info.itemsize = PyArray_ITEMSIZE(self)
3949 * info.readonly = not PyArray_ISWRITEABLE(self)
3950 */
3951 __pyx_v_info->suboffsets = NULL;
3952
3953 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":292
3954 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
3955 * info.suboffsets = NULL
3956 * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
3957 * info.readonly = not PyArray_ISWRITEABLE(self)
3958 *
3959 */
3960 __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
3961
3962 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":293
3963 * info.suboffsets = NULL
3964 * info.itemsize = PyArray_ITEMSIZE(self)
3965 * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
3966 *
3967 * cdef int t
3968 */
3969 __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
3970
3971 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":296
3972 *
3973 * cdef int t
3974 * cdef char* f = NULL # <<<<<<<<<<<<<<
3975 * cdef dtype descr = <dtype>PyArray_DESCR(self)
3976 * cdef int offset
3977 */
3978 __pyx_v_f = NULL;
3979
3980 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":297
3981 * cdef int t
3982 * cdef char* f = NULL
3983 * cdef dtype descr = <dtype>PyArray_DESCR(self) # <<<<<<<<<<<<<<
3984 * cdef int offset
3985 *
3986 */
3987 __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
3988 __pyx_t_3 = ((PyObject *)__pyx_t_7);
3989 __Pyx_INCREF(__pyx_t_3);
3990 __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
3991 __pyx_t_3 = 0;
3992
3993 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":300
3994 * cdef int offset
3995 *
3996 * info.obj = self # <<<<<<<<<<<<<<
3997 *
3998 * if not PyDataType_HASFIELDS(descr):
3999 */
4000 __Pyx_INCREF(((PyObject *)__pyx_v_self));
4001 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
4002 __Pyx_GOTREF(__pyx_v_info->obj);
4003 __Pyx_DECREF(__pyx_v_info->obj);
4004 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
4005
4006 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":302
4007 * info.obj = self
4008 *
4009 * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
4010 * t = descr.type_num
4011 * if ((descr.byteorder == c'>' and little_endian) or
4012 */
4013 __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
4014 if (__pyx_t_1) {
4015
4016 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":303
4017 *
4018 * if not PyDataType_HASFIELDS(descr):
4019 * t = descr.type_num # <<<<<<<<<<<<<<
4020 * if ((descr.byteorder == c'>' and little_endian) or
4021 * (descr.byteorder == c'<' and not little_endian)):
4022 */
4023 __pyx_t_4 = __pyx_v_descr->type_num;
4024 __pyx_v_t = __pyx_t_4;
4025
4026 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":304
4027 * if not PyDataType_HASFIELDS(descr):
4028 * t = descr.type_num
4029 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
4030 * (descr.byteorder == c'<' and not little_endian)):
4031 * raise ValueError(u"Non-native byte order not supported")
4032 */
4033 __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
4034 if (!__pyx_t_2) {
4035 goto __pyx_L15_next_or;
4036 } else {
4037 }
4038 __pyx_t_2 = (__pyx_v_little_endian != 0);
4039 if (!__pyx_t_2) {
4040 } else {
4041 __pyx_t_1 = __pyx_t_2;
4042 goto __pyx_L14_bool_binop_done;
4043 }
4044 __pyx_L15_next_or:;
4045
4046 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":305
4047 * t = descr.type_num
4048 * if ((descr.byteorder == c'>' and little_endian) or
4049 * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
4050 * raise ValueError(u"Non-native byte order not supported")
4051 * if t == NPY_BYTE: f = "b"
4052 */
4053 __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
4054 if (__pyx_t_2) {
4055 } else {
4056 __pyx_t_1 = __pyx_t_2;
4057 goto __pyx_L14_bool_binop_done;
4058 }
4059 __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
4060 __pyx_t_1 = __pyx_t_2;
4061 __pyx_L14_bool_binop_done:;
4062
4063 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":304
4064 * if not PyDataType_HASFIELDS(descr):
4065 * t = descr.type_num
4066 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
4067 * (descr.byteorder == c'<' and not little_endian)):
4068 * raise ValueError(u"Non-native byte order not supported")
4069 */
4070 if (unlikely(__pyx_t_1)) {
4071
4072 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":306
4073 * if ((descr.byteorder == c'>' and little_endian) or
4074 * (descr.byteorder == c'<' and not little_endian)):
4075 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
4076 * if t == NPY_BYTE: f = "b"
4077 * elif t == NPY_UBYTE: f = "B"
4078 */
4079 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 306, __pyx_L1_error)
4080 __Pyx_GOTREF(__pyx_t_3);
4081 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4082 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4083 __PYX_ERR(2, 306, __pyx_L1_error)
4084
4085 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":304
4086 * if not PyDataType_HASFIELDS(descr):
4087 * t = descr.type_num
4088 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
4089 * (descr.byteorder == c'<' and not little_endian)):
4090 * raise ValueError(u"Non-native byte order not supported")
4091 */
4092 }
4093
4094 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":307
4095 * (descr.byteorder == c'<' and not little_endian)):
4096 * raise ValueError(u"Non-native byte order not supported")
4097 * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
4098 * elif t == NPY_UBYTE: f = "B"
4099 * elif t == NPY_SHORT: f = "h"
4100 */
4101 switch (__pyx_v_t) {
4102 case NPY_BYTE:
4103 __pyx_v_f = ((char *)"b");
4104 break;
4105 case NPY_UBYTE:
4106
4107 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":308
4108 * raise ValueError(u"Non-native byte order not supported")
4109 * if t == NPY_BYTE: f = "b"
4110 * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
4111 * elif t == NPY_SHORT: f = "h"
4112 * elif t == NPY_USHORT: f = "H"
4113 */
4114 __pyx_v_f = ((char *)"B");
4115 break;
4116 case NPY_SHORT:
4117
4118 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":309
4119 * if t == NPY_BYTE: f = "b"
4120 * elif t == NPY_UBYTE: f = "B"
4121 * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
4122 * elif t == NPY_USHORT: f = "H"
4123 * elif t == NPY_INT: f = "i"
4124 */
4125 __pyx_v_f = ((char *)"h");
4126 break;
4127 case NPY_USHORT:
4128
4129 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":310
4130 * elif t == NPY_UBYTE: f = "B"
4131 * elif t == NPY_SHORT: f = "h"
4132 * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
4133 * elif t == NPY_INT: f = "i"
4134 * elif t == NPY_UINT: f = "I"
4135 */
4136 __pyx_v_f = ((char *)"H");
4137 break;
4138 case NPY_INT:
4139
4140 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":311
4141 * elif t == NPY_SHORT: f = "h"
4142 * elif t == NPY_USHORT: f = "H"
4143 * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
4144 * elif t == NPY_UINT: f = "I"
4145 * elif t == NPY_LONG: f = "l"
4146 */
4147 __pyx_v_f = ((char *)"i");
4148 break;
4149 case NPY_UINT:
4150
4151 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":312
4152 * elif t == NPY_USHORT: f = "H"
4153 * elif t == NPY_INT: f = "i"
4154 * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
4155 * elif t == NPY_LONG: f = "l"
4156 * elif t == NPY_ULONG: f = "L"
4157 */
4158 __pyx_v_f = ((char *)"I");
4159 break;
4160 case NPY_LONG:
4161
4162 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":313
4163 * elif t == NPY_INT: f = "i"
4164 * elif t == NPY_UINT: f = "I"
4165 * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
4166 * elif t == NPY_ULONG: f = "L"
4167 * elif t == NPY_LONGLONG: f = "q"
4168 */
4169 __pyx_v_f = ((char *)"l");
4170 break;
4171 case NPY_ULONG:
4172
4173 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":314
4174 * elif t == NPY_UINT: f = "I"
4175 * elif t == NPY_LONG: f = "l"
4176 * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
4177 * elif t == NPY_LONGLONG: f = "q"
4178 * elif t == NPY_ULONGLONG: f = "Q"
4179 */
4180 __pyx_v_f = ((char *)"L");
4181 break;
4182 case NPY_LONGLONG:
4183
4184 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":315
4185 * elif t == NPY_LONG: f = "l"
4186 * elif t == NPY_ULONG: f = "L"
4187 * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
4188 * elif t == NPY_ULONGLONG: f = "Q"
4189 * elif t == NPY_FLOAT: f = "f"
4190 */
4191 __pyx_v_f = ((char *)"q");
4192 break;
4193 case NPY_ULONGLONG:
4194
4195 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":316
4196 * elif t == NPY_ULONG: f = "L"
4197 * elif t == NPY_LONGLONG: f = "q"
4198 * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
4199 * elif t == NPY_FLOAT: f = "f"
4200 * elif t == NPY_DOUBLE: f = "d"
4201 */
4202 __pyx_v_f = ((char *)"Q");
4203 break;
4204 case NPY_FLOAT:
4205
4206 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":317
4207 * elif t == NPY_LONGLONG: f = "q"
4208 * elif t == NPY_ULONGLONG: f = "Q"
4209 * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
4210 * elif t == NPY_DOUBLE: f = "d"
4211 * elif t == NPY_LONGDOUBLE: f = "g"
4212 */
4213 __pyx_v_f = ((char *)"f");
4214 break;
4215 case NPY_DOUBLE:
4216
4217 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":318
4218 * elif t == NPY_ULONGLONG: f = "Q"
4219 * elif t == NPY_FLOAT: f = "f"
4220 * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
4221 * elif t == NPY_LONGDOUBLE: f = "g"
4222 * elif t == NPY_CFLOAT: f = "Zf"
4223 */
4224 __pyx_v_f = ((char *)"d");
4225 break;
4226 case NPY_LONGDOUBLE:
4227
4228 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":319
4229 * elif t == NPY_FLOAT: f = "f"
4230 * elif t == NPY_DOUBLE: f = "d"
4231 * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
4232 * elif t == NPY_CFLOAT: f = "Zf"
4233 * elif t == NPY_CDOUBLE: f = "Zd"
4234 */
4235 __pyx_v_f = ((char *)"g");
4236 break;
4237 case NPY_CFLOAT:
4238
4239 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":320
4240 * elif t == NPY_DOUBLE: f = "d"
4241 * elif t == NPY_LONGDOUBLE: f = "g"
4242 * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
4243 * elif t == NPY_CDOUBLE: f = "Zd"
4244 * elif t == NPY_CLONGDOUBLE: f = "Zg"
4245 */
4246 __pyx_v_f = ((char *)"Zf");
4247 break;
4248 case NPY_CDOUBLE:
4249
4250 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":321
4251 * elif t == NPY_LONGDOUBLE: f = "g"
4252 * elif t == NPY_CFLOAT: f = "Zf"
4253 * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
4254 * elif t == NPY_CLONGDOUBLE: f = "Zg"
4255 * elif t == NPY_OBJECT: f = "O"
4256 */
4257 __pyx_v_f = ((char *)"Zd");
4258 break;
4259 case NPY_CLONGDOUBLE:
4260
4261 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":322
4262 * elif t == NPY_CFLOAT: f = "Zf"
4263 * elif t == NPY_CDOUBLE: f = "Zd"
4264 * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
4265 * elif t == NPY_OBJECT: f = "O"
4266 * else:
4267 */
4268 __pyx_v_f = ((char *)"Zg");
4269 break;
4270 case NPY_OBJECT:
4271
4272 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":323
4273 * elif t == NPY_CDOUBLE: f = "Zd"
4274 * elif t == NPY_CLONGDOUBLE: f = "Zg"
4275 * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
4276 * else:
4277 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
4278 */
4279 __pyx_v_f = ((char *)"O");
4280 break;
4281 default:
4282
4283 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":325
4284 * elif t == NPY_OBJECT: f = "O"
4285 * else:
4286 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
4287 * info.format = f
4288 * return
4289 */
4290 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
4291 __Pyx_GOTREF(__pyx_t_3);
4292 __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 325, __pyx_L1_error)
4293 __Pyx_GOTREF(__pyx_t_8);
4294 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4295 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
4296 __Pyx_GOTREF(__pyx_t_3);
4297 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4298 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4299 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4300 __PYX_ERR(2, 325, __pyx_L1_error)
4301 break;
4302 }
4303
4304 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":326
4305 * else:
4306 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
4307 * info.format = f # <<<<<<<<<<<<<<
4308 * return
4309 * else:
4310 */
4311 __pyx_v_info->format = __pyx_v_f;
4312
4313 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":327
4314 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
4315 * info.format = f
4316 * return # <<<<<<<<<<<<<<
4317 * else:
4318 * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
4319 */
4320 __pyx_r = 0;
4321 goto __pyx_L0;
4322
4323 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":302
4324 * info.obj = self
4325 *
4326 * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
4327 * t = descr.type_num
4328 * if ((descr.byteorder == c'>' and little_endian) or
4329 */
4330 }
4331
4332 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":329
4333 * return
4334 * else:
4335 * info.format = <char*>PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
4336 * info.format[0] = c'^' # Native data types, manual alignment
4337 * offset = 0
4338 */
4339 /*else*/ {
4340 __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
4341
4342 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":330
4343 * else:
4344 * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
4345 * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
4346 * offset = 0
4347 * f = _util_dtypestring(descr, info.format + 1,
4348 */
4349 (__pyx_v_info->format[0]) = '^';
4350
4351 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":331
4352 * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
4353 * info.format[0] = c'^' # Native data types, manual alignment
4354 * offset = 0 # <<<<<<<<<<<<<<
4355 * f = _util_dtypestring(descr, info.format + 1,
4356 * info.format + _buffer_format_string_len,
4357 */
4358 __pyx_v_offset = 0;
4359
4360 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":332
4361 * info.format[0] = c'^' # Native data types, manual alignment
4362 * offset = 0
4363 * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
4364 * info.format + _buffer_format_string_len,
4365 * &offset)
4366 */
4367 __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(2, 332, __pyx_L1_error)
4368 __pyx_v_f = __pyx_t_9;
4369
4370 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":335
4371 * info.format + _buffer_format_string_len,
4372 * &offset)
4373 * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
4374 *
4375 * def __releasebuffer__(ndarray self, Py_buffer* info):
4376 */
4377 (__pyx_v_f[0]) = '\x00';
4378 }
4379
4380 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":258
4381 * # experimental exception made for __getbuffer__ and __releasebuffer__
4382 * # -- the details of this may change.
4383 * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
4384 * # This implementation of getbuffer is geared towards Cython
4385 * # requirements, and does not yet fulfill the PEP.
4386 */
4387
4388 /* function exit code */
4389 __pyx_r = 0;
4390 goto __pyx_L0;
4391 __pyx_L1_error:;
4392 __Pyx_XDECREF(__pyx_t_3);
4393 __Pyx_XDECREF(__pyx_t_8);
4394 __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4395 __pyx_r = -1;
4396 if (__pyx_v_info->obj != NULL) {
4397 __Pyx_GOTREF(__pyx_v_info->obj);
4398 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
4399 }
4400 goto __pyx_L2;
4401 __pyx_L0:;
4402 if (__pyx_v_info->obj == Py_None) {
4403 __Pyx_GOTREF(__pyx_v_info->obj);
4404 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
4405 }
4406 __pyx_L2:;
4407 __Pyx_XDECREF((PyObject *)__pyx_v_descr);
4408 __Pyx_RefNannyFinishContext();
4409 return __pyx_r;
4410 }
4411
4412 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":337
4413 * f[0] = c'\0' # Terminate format string
4414 *
4415 * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
4416 * if PyArray_HASFIELDS(self):
4417 * PyObject_Free(info.format)
4418 */
4419
4420 /* Python wrapper */
4421 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
__pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info)4422 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
4423 __Pyx_RefNannyDeclarations
4424 __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
4425 __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
4426
4427 /* function exit code */
4428 __Pyx_RefNannyFinishContext();
4429 }
4430
__pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info)4431 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
4432 __Pyx_RefNannyDeclarations
4433 int __pyx_t_1;
4434 __Pyx_RefNannySetupContext("__releasebuffer__", 0);
4435
4436 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":338
4437 *
4438 * def __releasebuffer__(ndarray self, Py_buffer* info):
4439 * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
4440 * PyObject_Free(info.format)
4441 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
4442 */
4443 __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
4444 if (__pyx_t_1) {
4445
4446 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":339
4447 * def __releasebuffer__(ndarray self, Py_buffer* info):
4448 * if PyArray_HASFIELDS(self):
4449 * PyObject_Free(info.format) # <<<<<<<<<<<<<<
4450 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
4451 * PyObject_Free(info.strides)
4452 */
4453 PyObject_Free(__pyx_v_info->format);
4454
4455 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":338
4456 *
4457 * def __releasebuffer__(ndarray self, Py_buffer* info):
4458 * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
4459 * PyObject_Free(info.format)
4460 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
4461 */
4462 }
4463
4464 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":340
4465 * if PyArray_HASFIELDS(self):
4466 * PyObject_Free(info.format)
4467 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
4468 * PyObject_Free(info.strides)
4469 * # info.shape was stored after info.strides in the same block
4470 */
4471 __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
4472 if (__pyx_t_1) {
4473
4474 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":341
4475 * PyObject_Free(info.format)
4476 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
4477 * PyObject_Free(info.strides) # <<<<<<<<<<<<<<
4478 * # info.shape was stored after info.strides in the same block
4479 *
4480 */
4481 PyObject_Free(__pyx_v_info->strides);
4482
4483 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":340
4484 * if PyArray_HASFIELDS(self):
4485 * PyObject_Free(info.format)
4486 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
4487 * PyObject_Free(info.strides)
4488 * # info.shape was stored after info.strides in the same block
4489 */
4490 }
4491
4492 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":337
4493 * f[0] = c'\0' # Terminate format string
4494 *
4495 * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
4496 * if PyArray_HASFIELDS(self):
4497 * PyObject_Free(info.format)
4498 */
4499
4500 /* function exit code */
4501 __Pyx_RefNannyFinishContext();
4502 }
4503
4504 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":821
4505 * ctypedef npy_cdouble complex_t
4506 *
4507 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
4508 * return PyArray_MultiIterNew(1, <void*>a)
4509 *
4510 */
4511
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)4512 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
4513 PyObject *__pyx_r = NULL;
4514 __Pyx_RefNannyDeclarations
4515 PyObject *__pyx_t_1 = NULL;
4516 __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
4517
4518 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":822
4519 *
4520 * cdef inline object PyArray_MultiIterNew1(a):
4521 * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
4522 *
4523 * cdef inline object PyArray_MultiIterNew2(a, b):
4524 */
4525 __Pyx_XDECREF(__pyx_r);
4526 __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 822, __pyx_L1_error)
4527 __Pyx_GOTREF(__pyx_t_1);
4528 __pyx_r = __pyx_t_1;
4529 __pyx_t_1 = 0;
4530 goto __pyx_L0;
4531
4532 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":821
4533 * ctypedef npy_cdouble complex_t
4534 *
4535 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
4536 * return PyArray_MultiIterNew(1, <void*>a)
4537 *
4538 */
4539
4540 /* function exit code */
4541 __pyx_L1_error:;
4542 __Pyx_XDECREF(__pyx_t_1);
4543 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
4544 __pyx_r = 0;
4545 __pyx_L0:;
4546 __Pyx_XGIVEREF(__pyx_r);
4547 __Pyx_RefNannyFinishContext();
4548 return __pyx_r;
4549 }
4550
4551 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":824
4552 * return PyArray_MultiIterNew(1, <void*>a)
4553 *
4554 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
4555 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4556 *
4557 */
4558
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)4559 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
4560 PyObject *__pyx_r = NULL;
4561 __Pyx_RefNannyDeclarations
4562 PyObject *__pyx_t_1 = NULL;
4563 __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
4564
4565 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":825
4566 *
4567 * cdef inline object PyArray_MultiIterNew2(a, b):
4568 * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
4569 *
4570 * cdef inline object PyArray_MultiIterNew3(a, b, c):
4571 */
4572 __Pyx_XDECREF(__pyx_r);
4573 __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 825, __pyx_L1_error)
4574 __Pyx_GOTREF(__pyx_t_1);
4575 __pyx_r = __pyx_t_1;
4576 __pyx_t_1 = 0;
4577 goto __pyx_L0;
4578
4579 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":824
4580 * return PyArray_MultiIterNew(1, <void*>a)
4581 *
4582 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
4583 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4584 *
4585 */
4586
4587 /* function exit code */
4588 __pyx_L1_error:;
4589 __Pyx_XDECREF(__pyx_t_1);
4590 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
4591 __pyx_r = 0;
4592 __pyx_L0:;
4593 __Pyx_XGIVEREF(__pyx_r);
4594 __Pyx_RefNannyFinishContext();
4595 return __pyx_r;
4596 }
4597
4598 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":827
4599 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4600 *
4601 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
4602 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4603 *
4604 */
4605
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)4606 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
4607 PyObject *__pyx_r = NULL;
4608 __Pyx_RefNannyDeclarations
4609 PyObject *__pyx_t_1 = NULL;
4610 __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
4611
4612 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":828
4613 *
4614 * cdef inline object PyArray_MultiIterNew3(a, b, c):
4615 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
4616 *
4617 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
4618 */
4619 __Pyx_XDECREF(__pyx_r);
4620 __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 828, __pyx_L1_error)
4621 __Pyx_GOTREF(__pyx_t_1);
4622 __pyx_r = __pyx_t_1;
4623 __pyx_t_1 = 0;
4624 goto __pyx_L0;
4625
4626 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":827
4627 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4628 *
4629 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
4630 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4631 *
4632 */
4633
4634 /* function exit code */
4635 __pyx_L1_error:;
4636 __Pyx_XDECREF(__pyx_t_1);
4637 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
4638 __pyx_r = 0;
4639 __pyx_L0:;
4640 __Pyx_XGIVEREF(__pyx_r);
4641 __Pyx_RefNannyFinishContext();
4642 return __pyx_r;
4643 }
4644
4645 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":830
4646 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4647 *
4648 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
4649 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4650 *
4651 */
4652
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)4653 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) {
4654 PyObject *__pyx_r = NULL;
4655 __Pyx_RefNannyDeclarations
4656 PyObject *__pyx_t_1 = NULL;
4657 __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
4658
4659 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":831
4660 *
4661 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
4662 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
4663 *
4664 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
4665 */
4666 __Pyx_XDECREF(__pyx_r);
4667 __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 831, __pyx_L1_error)
4668 __Pyx_GOTREF(__pyx_t_1);
4669 __pyx_r = __pyx_t_1;
4670 __pyx_t_1 = 0;
4671 goto __pyx_L0;
4672
4673 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":830
4674 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4675 *
4676 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
4677 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4678 *
4679 */
4680
4681 /* function exit code */
4682 __pyx_L1_error:;
4683 __Pyx_XDECREF(__pyx_t_1);
4684 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
4685 __pyx_r = 0;
4686 __pyx_L0:;
4687 __Pyx_XGIVEREF(__pyx_r);
4688 __Pyx_RefNannyFinishContext();
4689 return __pyx_r;
4690 }
4691
4692 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":833
4693 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4694 *
4695 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
4696 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4697 *
4698 */
4699
__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)4700 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) {
4701 PyObject *__pyx_r = NULL;
4702 __Pyx_RefNannyDeclarations
4703 PyObject *__pyx_t_1 = NULL;
4704 __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
4705
4706 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":834
4707 *
4708 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
4709 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
4710 *
4711 * cdef inline tuple PyDataType_SHAPE(dtype d):
4712 */
4713 __Pyx_XDECREF(__pyx_r);
4714 __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 834, __pyx_L1_error)
4715 __Pyx_GOTREF(__pyx_t_1);
4716 __pyx_r = __pyx_t_1;
4717 __pyx_t_1 = 0;
4718 goto __pyx_L0;
4719
4720 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":833
4721 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4722 *
4723 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
4724 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4725 *
4726 */
4727
4728 /* function exit code */
4729 __pyx_L1_error:;
4730 __Pyx_XDECREF(__pyx_t_1);
4731 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
4732 __pyx_r = 0;
4733 __pyx_L0:;
4734 __Pyx_XGIVEREF(__pyx_r);
4735 __Pyx_RefNannyFinishContext();
4736 return __pyx_r;
4737 }
4738
4739 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":836
4740 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4741 *
4742 * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
4743 * if PyDataType_HASSUBARRAY(d):
4744 * return <tuple>d.subarray.shape
4745 */
4746
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)4747 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
4748 PyObject *__pyx_r = NULL;
4749 __Pyx_RefNannyDeclarations
4750 int __pyx_t_1;
4751 __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
4752
4753 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":837
4754 *
4755 * cdef inline tuple PyDataType_SHAPE(dtype d):
4756 * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
4757 * return <tuple>d.subarray.shape
4758 * else:
4759 */
4760 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
4761 if (__pyx_t_1) {
4762
4763 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":838
4764 * cdef inline tuple PyDataType_SHAPE(dtype d):
4765 * if PyDataType_HASSUBARRAY(d):
4766 * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
4767 * else:
4768 * return ()
4769 */
4770 __Pyx_XDECREF(__pyx_r);
4771 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
4772 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
4773 goto __pyx_L0;
4774
4775 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":837
4776 *
4777 * cdef inline tuple PyDataType_SHAPE(dtype d):
4778 * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
4779 * return <tuple>d.subarray.shape
4780 * else:
4781 */
4782 }
4783
4784 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":840
4785 * return <tuple>d.subarray.shape
4786 * else:
4787 * return () # <<<<<<<<<<<<<<
4788 *
4789 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
4790 */
4791 /*else*/ {
4792 __Pyx_XDECREF(__pyx_r);
4793 __Pyx_INCREF(__pyx_empty_tuple);
4794 __pyx_r = __pyx_empty_tuple;
4795 goto __pyx_L0;
4796 }
4797
4798 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":836
4799 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4800 *
4801 * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
4802 * if PyDataType_HASSUBARRAY(d):
4803 * return <tuple>d.subarray.shape
4804 */
4805
4806 /* function exit code */
4807 __pyx_L0:;
4808 __Pyx_XGIVEREF(__pyx_r);
4809 __Pyx_RefNannyFinishContext();
4810 return __pyx_r;
4811 }
4812
4813 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":842
4814 * return ()
4815 *
4816 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
4817 * # Recursive utility function used in __getbuffer__ to get format
4818 * # string. The new location in the format string is returned.
4819 */
4820
__pyx_f_5numpy__util_dtypestring(PyArray_Descr * __pyx_v_descr,char * __pyx_v_f,char * __pyx_v_end,int * __pyx_v_offset)4821 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
4822 PyArray_Descr *__pyx_v_child = 0;
4823 int __pyx_v_endian_detector;
4824 int __pyx_v_little_endian;
4825 PyObject *__pyx_v_fields = 0;
4826 PyObject *__pyx_v_childname = NULL;
4827 PyObject *__pyx_v_new_offset = NULL;
4828 PyObject *__pyx_v_t = NULL;
4829 char *__pyx_r;
4830 __Pyx_RefNannyDeclarations
4831 PyObject *__pyx_t_1 = NULL;
4832 Py_ssize_t __pyx_t_2;
4833 PyObject *__pyx_t_3 = NULL;
4834 PyObject *__pyx_t_4 = NULL;
4835 int __pyx_t_5;
4836 int __pyx_t_6;
4837 int __pyx_t_7;
4838 long __pyx_t_8;
4839 char *__pyx_t_9;
4840 __Pyx_RefNannySetupContext("_util_dtypestring", 0);
4841
4842 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":847
4843 *
4844 * cdef dtype child
4845 * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
4846 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
4847 * cdef tuple fields
4848 */
4849 __pyx_v_endian_detector = 1;
4850
4851 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":848
4852 * cdef dtype child
4853 * cdef int endian_detector = 1
4854 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
4855 * cdef tuple fields
4856 *
4857 */
4858 __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
4859
4860 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":851
4861 * cdef tuple fields
4862 *
4863 * for childname in descr.names: # <<<<<<<<<<<<<<
4864 * fields = descr.fields[childname]
4865 * child, new_offset = fields
4866 */
4867 if (unlikely(__pyx_v_descr->names == Py_None)) {
4868 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
4869 __PYX_ERR(2, 851, __pyx_L1_error)
4870 }
4871 __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
4872 for (;;) {
4873 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
4874 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4875 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 851, __pyx_L1_error)
4876 #else
4877 __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 851, __pyx_L1_error)
4878 __Pyx_GOTREF(__pyx_t_3);
4879 #endif
4880 __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
4881 __pyx_t_3 = 0;
4882
4883 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":852
4884 *
4885 * for childname in descr.names:
4886 * fields = descr.fields[childname] # <<<<<<<<<<<<<<
4887 * child, new_offset = fields
4888 *
4889 */
4890 if (unlikely(__pyx_v_descr->fields == Py_None)) {
4891 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4892 __PYX_ERR(2, 852, __pyx_L1_error)
4893 }
4894 __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 852, __pyx_L1_error)
4895 __Pyx_GOTREF(__pyx_t_3);
4896 if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(2, 852, __pyx_L1_error)
4897 __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
4898 __pyx_t_3 = 0;
4899
4900 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":853
4901 * for childname in descr.names:
4902 * fields = descr.fields[childname]
4903 * child, new_offset = fields # <<<<<<<<<<<<<<
4904 *
4905 * if (end - f) - <int>(new_offset - offset[0]) < 15:
4906 */
4907 if (likely(__pyx_v_fields != Py_None)) {
4908 PyObject* sequence = __pyx_v_fields;
4909 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4910 if (unlikely(size != 2)) {
4911 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4912 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4913 __PYX_ERR(2, 853, __pyx_L1_error)
4914 }
4915 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4916 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
4917 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
4918 __Pyx_INCREF(__pyx_t_3);
4919 __Pyx_INCREF(__pyx_t_4);
4920 #else
4921 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 853, __pyx_L1_error)
4922 __Pyx_GOTREF(__pyx_t_3);
4923 __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 853, __pyx_L1_error)
4924 __Pyx_GOTREF(__pyx_t_4);
4925 #endif
4926 } else {
4927 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 853, __pyx_L1_error)
4928 }
4929 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(2, 853, __pyx_L1_error)
4930 __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
4931 __pyx_t_3 = 0;
4932 __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
4933 __pyx_t_4 = 0;
4934
4935 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":855
4936 * child, new_offset = fields
4937 *
4938 * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
4939 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
4940 *
4941 */
4942 __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 855, __pyx_L1_error)
4943 __Pyx_GOTREF(__pyx_t_4);
4944 __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 855, __pyx_L1_error)
4945 __Pyx_GOTREF(__pyx_t_3);
4946 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4947 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 855, __pyx_L1_error)
4948 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4949 __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
4950 if (unlikely(__pyx_t_6)) {
4951
4952 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":856
4953 *
4954 * if (end - f) - <int>(new_offset - offset[0]) < 15:
4955 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
4956 *
4957 * if ((child.byteorder == c'>' and little_endian) or
4958 */
4959 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 856, __pyx_L1_error)
4960 __Pyx_GOTREF(__pyx_t_3);
4961 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4962 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4963 __PYX_ERR(2, 856, __pyx_L1_error)
4964
4965 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":855
4966 * child, new_offset = fields
4967 *
4968 * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
4969 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
4970 *
4971 */
4972 }
4973
4974 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":858
4975 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
4976 *
4977 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
4978 * (child.byteorder == c'<' and not little_endian)):
4979 * raise ValueError(u"Non-native byte order not supported")
4980 */
4981 __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
4982 if (!__pyx_t_7) {
4983 goto __pyx_L8_next_or;
4984 } else {
4985 }
4986 __pyx_t_7 = (__pyx_v_little_endian != 0);
4987 if (!__pyx_t_7) {
4988 } else {
4989 __pyx_t_6 = __pyx_t_7;
4990 goto __pyx_L7_bool_binop_done;
4991 }
4992 __pyx_L8_next_or:;
4993
4994 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":859
4995 *
4996 * if ((child.byteorder == c'>' and little_endian) or
4997 * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
4998 * raise ValueError(u"Non-native byte order not supported")
4999 * # One could encode it in the format string and have Cython
5000 */
5001 __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
5002 if (__pyx_t_7) {
5003 } else {
5004 __pyx_t_6 = __pyx_t_7;
5005 goto __pyx_L7_bool_binop_done;
5006 }
5007 __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
5008 __pyx_t_6 = __pyx_t_7;
5009 __pyx_L7_bool_binop_done:;
5010
5011 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":858
5012 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
5013 *
5014 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
5015 * (child.byteorder == c'<' and not little_endian)):
5016 * raise ValueError(u"Non-native byte order not supported")
5017 */
5018 if (unlikely(__pyx_t_6)) {
5019
5020 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":860
5021 * if ((child.byteorder == c'>' and little_endian) or
5022 * (child.byteorder == c'<' and not little_endian)):
5023 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
5024 * # One could encode it in the format string and have Cython
5025 * # complain instead, BUT: < and > in format strings also imply
5026 */
5027 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 860, __pyx_L1_error)
5028 __Pyx_GOTREF(__pyx_t_3);
5029 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5030 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5031 __PYX_ERR(2, 860, __pyx_L1_error)
5032
5033 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":858
5034 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
5035 *
5036 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
5037 * (child.byteorder == c'<' and not little_endian)):
5038 * raise ValueError(u"Non-native byte order not supported")
5039 */
5040 }
5041
5042 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":870
5043 *
5044 * # Output padding bytes
5045 * while offset[0] < new_offset: # <<<<<<<<<<<<<<
5046 * f[0] = 120 # "x"; pad byte
5047 * f += 1
5048 */
5049 while (1) {
5050 __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 870, __pyx_L1_error)
5051 __Pyx_GOTREF(__pyx_t_3);
5052 __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 870, __pyx_L1_error)
5053 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5054 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 870, __pyx_L1_error)
5055 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5056 if (!__pyx_t_6) break;
5057
5058 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":871
5059 * # Output padding bytes
5060 * while offset[0] < new_offset:
5061 * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
5062 * f += 1
5063 * offset[0] += 1
5064 */
5065 (__pyx_v_f[0]) = 0x78;
5066
5067 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":872
5068 * while offset[0] < new_offset:
5069 * f[0] = 120 # "x"; pad byte
5070 * f += 1 # <<<<<<<<<<<<<<
5071 * offset[0] += 1
5072 *
5073 */
5074 __pyx_v_f = (__pyx_v_f + 1);
5075
5076 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":873
5077 * f[0] = 120 # "x"; pad byte
5078 * f += 1
5079 * offset[0] += 1 # <<<<<<<<<<<<<<
5080 *
5081 * offset[0] += child.itemsize
5082 */
5083 __pyx_t_8 = 0;
5084 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
5085 }
5086
5087 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":875
5088 * offset[0] += 1
5089 *
5090 * offset[0] += child.itemsize # <<<<<<<<<<<<<<
5091 *
5092 * if not PyDataType_HASFIELDS(child):
5093 */
5094 __pyx_t_8 = 0;
5095 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
5096
5097 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":877
5098 * offset[0] += child.itemsize
5099 *
5100 * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
5101 * t = child.type_num
5102 * if end - f < 5:
5103 */
5104 __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
5105 if (__pyx_t_6) {
5106
5107 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":878
5108 *
5109 * if not PyDataType_HASFIELDS(child):
5110 * t = child.type_num # <<<<<<<<<<<<<<
5111 * if end - f < 5:
5112 * raise RuntimeError(u"Format string allocated too short.")
5113 */
5114 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 878, __pyx_L1_error)
5115 __Pyx_GOTREF(__pyx_t_4);
5116 __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
5117 __pyx_t_4 = 0;
5118
5119 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":879
5120 * if not PyDataType_HASFIELDS(child):
5121 * t = child.type_num
5122 * if end - f < 5: # <<<<<<<<<<<<<<
5123 * raise RuntimeError(u"Format string allocated too short.")
5124 *
5125 */
5126 __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
5127 if (unlikely(__pyx_t_6)) {
5128
5129 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":880
5130 * t = child.type_num
5131 * if end - f < 5:
5132 * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
5133 *
5134 * # Until ticket #99 is fixed, use integers to avoid warnings
5135 */
5136 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 880, __pyx_L1_error)
5137 __Pyx_GOTREF(__pyx_t_4);
5138 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5139 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5140 __PYX_ERR(2, 880, __pyx_L1_error)
5141
5142 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":879
5143 * if not PyDataType_HASFIELDS(child):
5144 * t = child.type_num
5145 * if end - f < 5: # <<<<<<<<<<<<<<
5146 * raise RuntimeError(u"Format string allocated too short.")
5147 *
5148 */
5149 }
5150
5151 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":883
5152 *
5153 * # Until ticket #99 is fixed, use integers to avoid warnings
5154 * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
5155 * elif t == NPY_UBYTE: f[0] = 66 #"B"
5156 * elif t == NPY_SHORT: f[0] = 104 #"h"
5157 */
5158 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 883, __pyx_L1_error)
5159 __Pyx_GOTREF(__pyx_t_4);
5160 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 883, __pyx_L1_error)
5161 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5162 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 883, __pyx_L1_error)
5163 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5164 if (__pyx_t_6) {
5165 (__pyx_v_f[0]) = 98;
5166 goto __pyx_L15;
5167 }
5168
5169 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":884
5170 * # Until ticket #99 is fixed, use integers to avoid warnings
5171 * if t == NPY_BYTE: f[0] = 98 #"b"
5172 * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
5173 * elif t == NPY_SHORT: f[0] = 104 #"h"
5174 * elif t == NPY_USHORT: f[0] = 72 #"H"
5175 */
5176 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 884, __pyx_L1_error)
5177 __Pyx_GOTREF(__pyx_t_3);
5178 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 884, __pyx_L1_error)
5179 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5180 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 884, __pyx_L1_error)
5181 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5182 if (__pyx_t_6) {
5183 (__pyx_v_f[0]) = 66;
5184 goto __pyx_L15;
5185 }
5186
5187 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":885
5188 * if t == NPY_BYTE: f[0] = 98 #"b"
5189 * elif t == NPY_UBYTE: f[0] = 66 #"B"
5190 * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
5191 * elif t == NPY_USHORT: f[0] = 72 #"H"
5192 * elif t == NPY_INT: f[0] = 105 #"i"
5193 */
5194 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 885, __pyx_L1_error)
5195 __Pyx_GOTREF(__pyx_t_4);
5196 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 885, __pyx_L1_error)
5197 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5198 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 885, __pyx_L1_error)
5199 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5200 if (__pyx_t_6) {
5201 (__pyx_v_f[0]) = 0x68;
5202 goto __pyx_L15;
5203 }
5204
5205 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":886
5206 * elif t == NPY_UBYTE: f[0] = 66 #"B"
5207 * elif t == NPY_SHORT: f[0] = 104 #"h"
5208 * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
5209 * elif t == NPY_INT: f[0] = 105 #"i"
5210 * elif t == NPY_UINT: f[0] = 73 #"I"
5211 */
5212 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 886, __pyx_L1_error)
5213 __Pyx_GOTREF(__pyx_t_3);
5214 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 886, __pyx_L1_error)
5215 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5216 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 886, __pyx_L1_error)
5217 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5218 if (__pyx_t_6) {
5219 (__pyx_v_f[0]) = 72;
5220 goto __pyx_L15;
5221 }
5222
5223 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":887
5224 * elif t == NPY_SHORT: f[0] = 104 #"h"
5225 * elif t == NPY_USHORT: f[0] = 72 #"H"
5226 * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
5227 * elif t == NPY_UINT: f[0] = 73 #"I"
5228 * elif t == NPY_LONG: f[0] = 108 #"l"
5229 */
5230 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 887, __pyx_L1_error)
5231 __Pyx_GOTREF(__pyx_t_4);
5232 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 887, __pyx_L1_error)
5233 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5234 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 887, __pyx_L1_error)
5235 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5236 if (__pyx_t_6) {
5237 (__pyx_v_f[0]) = 0x69;
5238 goto __pyx_L15;
5239 }
5240
5241 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":888
5242 * elif t == NPY_USHORT: f[0] = 72 #"H"
5243 * elif t == NPY_INT: f[0] = 105 #"i"
5244 * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
5245 * elif t == NPY_LONG: f[0] = 108 #"l"
5246 * elif t == NPY_ULONG: f[0] = 76 #"L"
5247 */
5248 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 888, __pyx_L1_error)
5249 __Pyx_GOTREF(__pyx_t_3);
5250 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 888, __pyx_L1_error)
5251 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5252 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 888, __pyx_L1_error)
5253 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5254 if (__pyx_t_6) {
5255 (__pyx_v_f[0]) = 73;
5256 goto __pyx_L15;
5257 }
5258
5259 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":889
5260 * elif t == NPY_INT: f[0] = 105 #"i"
5261 * elif t == NPY_UINT: f[0] = 73 #"I"
5262 * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
5263 * elif t == NPY_ULONG: f[0] = 76 #"L"
5264 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
5265 */
5266 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 889, __pyx_L1_error)
5267 __Pyx_GOTREF(__pyx_t_4);
5268 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 889, __pyx_L1_error)
5269 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5270 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 889, __pyx_L1_error)
5271 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5272 if (__pyx_t_6) {
5273 (__pyx_v_f[0]) = 0x6C;
5274 goto __pyx_L15;
5275 }
5276
5277 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":890
5278 * elif t == NPY_UINT: f[0] = 73 #"I"
5279 * elif t == NPY_LONG: f[0] = 108 #"l"
5280 * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
5281 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
5282 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
5283 */
5284 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 890, __pyx_L1_error)
5285 __Pyx_GOTREF(__pyx_t_3);
5286 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 890, __pyx_L1_error)
5287 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5288 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 890, __pyx_L1_error)
5289 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5290 if (__pyx_t_6) {
5291 (__pyx_v_f[0]) = 76;
5292 goto __pyx_L15;
5293 }
5294
5295 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":891
5296 * elif t == NPY_LONG: f[0] = 108 #"l"
5297 * elif t == NPY_ULONG: f[0] = 76 #"L"
5298 * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
5299 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
5300 * elif t == NPY_FLOAT: f[0] = 102 #"f"
5301 */
5302 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 891, __pyx_L1_error)
5303 __Pyx_GOTREF(__pyx_t_4);
5304 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 891, __pyx_L1_error)
5305 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5306 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 891, __pyx_L1_error)
5307 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5308 if (__pyx_t_6) {
5309 (__pyx_v_f[0]) = 0x71;
5310 goto __pyx_L15;
5311 }
5312
5313 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":892
5314 * elif t == NPY_ULONG: f[0] = 76 #"L"
5315 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
5316 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
5317 * elif t == NPY_FLOAT: f[0] = 102 #"f"
5318 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
5319 */
5320 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 892, __pyx_L1_error)
5321 __Pyx_GOTREF(__pyx_t_3);
5322 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 892, __pyx_L1_error)
5323 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5324 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 892, __pyx_L1_error)
5325 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5326 if (__pyx_t_6) {
5327 (__pyx_v_f[0]) = 81;
5328 goto __pyx_L15;
5329 }
5330
5331 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":893
5332 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
5333 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
5334 * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
5335 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
5336 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
5337 */
5338 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 893, __pyx_L1_error)
5339 __Pyx_GOTREF(__pyx_t_4);
5340 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 893, __pyx_L1_error)
5341 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5342 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 893, __pyx_L1_error)
5343 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5344 if (__pyx_t_6) {
5345 (__pyx_v_f[0]) = 0x66;
5346 goto __pyx_L15;
5347 }
5348
5349 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":894
5350 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
5351 * elif t == NPY_FLOAT: f[0] = 102 #"f"
5352 * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
5353 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
5354 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
5355 */
5356 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 894, __pyx_L1_error)
5357 __Pyx_GOTREF(__pyx_t_3);
5358 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 894, __pyx_L1_error)
5359 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5360 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 894, __pyx_L1_error)
5361 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5362 if (__pyx_t_6) {
5363 (__pyx_v_f[0]) = 0x64;
5364 goto __pyx_L15;
5365 }
5366
5367 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":895
5368 * elif t == NPY_FLOAT: f[0] = 102 #"f"
5369 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
5370 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
5371 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
5372 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
5373 */
5374 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 895, __pyx_L1_error)
5375 __Pyx_GOTREF(__pyx_t_4);
5376 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 895, __pyx_L1_error)
5377 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5378 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 895, __pyx_L1_error)
5379 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5380 if (__pyx_t_6) {
5381 (__pyx_v_f[0]) = 0x67;
5382 goto __pyx_L15;
5383 }
5384
5385 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":896
5386 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
5387 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
5388 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
5389 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
5390 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
5391 */
5392 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 896, __pyx_L1_error)
5393 __Pyx_GOTREF(__pyx_t_3);
5394 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 896, __pyx_L1_error)
5395 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5396 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 896, __pyx_L1_error)
5397 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5398 if (__pyx_t_6) {
5399 (__pyx_v_f[0]) = 90;
5400 (__pyx_v_f[1]) = 0x66;
5401 __pyx_v_f = (__pyx_v_f + 1);
5402 goto __pyx_L15;
5403 }
5404
5405 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":897
5406 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
5407 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
5408 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
5409 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
5410 * elif t == NPY_OBJECT: f[0] = 79 #"O"
5411 */
5412 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 897, __pyx_L1_error)
5413 __Pyx_GOTREF(__pyx_t_4);
5414 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 897, __pyx_L1_error)
5415 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5416 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 897, __pyx_L1_error)
5417 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5418 if (__pyx_t_6) {
5419 (__pyx_v_f[0]) = 90;
5420 (__pyx_v_f[1]) = 0x64;
5421 __pyx_v_f = (__pyx_v_f + 1);
5422 goto __pyx_L15;
5423 }
5424
5425 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":898
5426 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
5427 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
5428 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
5429 * elif t == NPY_OBJECT: f[0] = 79 #"O"
5430 * else:
5431 */
5432 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 898, __pyx_L1_error)
5433 __Pyx_GOTREF(__pyx_t_3);
5434 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 898, __pyx_L1_error)
5435 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5436 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 898, __pyx_L1_error)
5437 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5438 if (__pyx_t_6) {
5439 (__pyx_v_f[0]) = 90;
5440 (__pyx_v_f[1]) = 0x67;
5441 __pyx_v_f = (__pyx_v_f + 1);
5442 goto __pyx_L15;
5443 }
5444
5445 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":899
5446 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
5447 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
5448 * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
5449 * else:
5450 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
5451 */
5452 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 899, __pyx_L1_error)
5453 __Pyx_GOTREF(__pyx_t_4);
5454 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 899, __pyx_L1_error)
5455 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5456 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 899, __pyx_L1_error)
5457 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5458 if (likely(__pyx_t_6)) {
5459 (__pyx_v_f[0]) = 79;
5460 goto __pyx_L15;
5461 }
5462
5463 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":901
5464 * elif t == NPY_OBJECT: f[0] = 79 #"O"
5465 * else:
5466 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
5467 * f += 1
5468 * else:
5469 */
5470 /*else*/ {
5471 __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 901, __pyx_L1_error)
5472 __Pyx_GOTREF(__pyx_t_3);
5473 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 901, __pyx_L1_error)
5474 __Pyx_GOTREF(__pyx_t_4);
5475 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5476 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5477 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5478 __PYX_ERR(2, 901, __pyx_L1_error)
5479 }
5480 __pyx_L15:;
5481
5482 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":902
5483 * else:
5484 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
5485 * f += 1 # <<<<<<<<<<<<<<
5486 * else:
5487 * # Cython ignores struct boundary information ("T{...}"),
5488 */
5489 __pyx_v_f = (__pyx_v_f + 1);
5490
5491 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":877
5492 * offset[0] += child.itemsize
5493 *
5494 * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
5495 * t = child.type_num
5496 * if end - f < 5:
5497 */
5498 goto __pyx_L13;
5499 }
5500
5501 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":906
5502 * # Cython ignores struct boundary information ("T{...}"),
5503 * # so don't output it
5504 * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
5505 * return f
5506 *
5507 */
5508 /*else*/ {
5509 __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(2, 906, __pyx_L1_error)
5510 __pyx_v_f = __pyx_t_9;
5511 }
5512 __pyx_L13:;
5513
5514 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":851
5515 * cdef tuple fields
5516 *
5517 * for childname in descr.names: # <<<<<<<<<<<<<<
5518 * fields = descr.fields[childname]
5519 * child, new_offset = fields
5520 */
5521 }
5522 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5523
5524 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":907
5525 * # so don't output it
5526 * f = _util_dtypestring(child, f, end, offset)
5527 * return f # <<<<<<<<<<<<<<
5528 *
5529 *
5530 */
5531 __pyx_r = __pyx_v_f;
5532 goto __pyx_L0;
5533
5534 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":842
5535 * return ()
5536 *
5537 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
5538 * # Recursive utility function used in __getbuffer__ to get format
5539 * # string. The new location in the format string is returned.
5540 */
5541
5542 /* function exit code */
5543 __pyx_L1_error:;
5544 __Pyx_XDECREF(__pyx_t_1);
5545 __Pyx_XDECREF(__pyx_t_3);
5546 __Pyx_XDECREF(__pyx_t_4);
5547 __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
5548 __pyx_r = NULL;
5549 __pyx_L0:;
5550 __Pyx_XDECREF((PyObject *)__pyx_v_child);
5551 __Pyx_XDECREF(__pyx_v_fields);
5552 __Pyx_XDECREF(__pyx_v_childname);
5553 __Pyx_XDECREF(__pyx_v_new_offset);
5554 __Pyx_XDECREF(__pyx_v_t);
5555 __Pyx_RefNannyFinishContext();
5556 return __pyx_r;
5557 }
5558
5559 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1022
5560 * int _import_umath() except -1
5561 *
5562 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
5563 * Py_INCREF(base) # important to do this before stealing the reference below!
5564 * PyArray_SetBaseObject(arr, base)
5565 */
5566
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)5567 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
5568 __Pyx_RefNannyDeclarations
5569 __Pyx_RefNannySetupContext("set_array_base", 0);
5570
5571 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1023
5572 *
5573 * cdef inline void set_array_base(ndarray arr, object base):
5574 * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
5575 * PyArray_SetBaseObject(arr, base)
5576 *
5577 */
5578 Py_INCREF(__pyx_v_base);
5579
5580 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1024
5581 * cdef inline void set_array_base(ndarray arr, object base):
5582 * Py_INCREF(base) # important to do this before stealing the reference below!
5583 * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
5584 *
5585 * cdef inline object get_array_base(ndarray arr):
5586 */
5587 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
5588
5589 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1022
5590 * int _import_umath() except -1
5591 *
5592 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
5593 * Py_INCREF(base) # important to do this before stealing the reference below!
5594 * PyArray_SetBaseObject(arr, base)
5595 */
5596
5597 /* function exit code */
5598 __Pyx_RefNannyFinishContext();
5599 }
5600
5601 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1026
5602 * PyArray_SetBaseObject(arr, base)
5603 *
5604 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
5605 * base = PyArray_BASE(arr)
5606 * if base is NULL:
5607 */
5608
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)5609 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
5610 PyObject *__pyx_v_base;
5611 PyObject *__pyx_r = NULL;
5612 __Pyx_RefNannyDeclarations
5613 int __pyx_t_1;
5614 __Pyx_RefNannySetupContext("get_array_base", 0);
5615
5616 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1027
5617 *
5618 * cdef inline object get_array_base(ndarray arr):
5619 * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
5620 * if base is NULL:
5621 * return None
5622 */
5623 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
5624
5625 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1028
5626 * cdef inline object get_array_base(ndarray arr):
5627 * base = PyArray_BASE(arr)
5628 * if base is NULL: # <<<<<<<<<<<<<<
5629 * return None
5630 * return <object>base
5631 */
5632 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
5633 if (__pyx_t_1) {
5634
5635 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1029
5636 * base = PyArray_BASE(arr)
5637 * if base is NULL:
5638 * return None # <<<<<<<<<<<<<<
5639 * return <object>base
5640 *
5641 */
5642 __Pyx_XDECREF(__pyx_r);
5643 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5644 goto __pyx_L0;
5645
5646 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1028
5647 * cdef inline object get_array_base(ndarray arr):
5648 * base = PyArray_BASE(arr)
5649 * if base is NULL: # <<<<<<<<<<<<<<
5650 * return None
5651 * return <object>base
5652 */
5653 }
5654
5655 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1030
5656 * if base is NULL:
5657 * return None
5658 * return <object>base # <<<<<<<<<<<<<<
5659 *
5660 * # Versions of the import_* functions which are more suitable for
5661 */
5662 __Pyx_XDECREF(__pyx_r);
5663 __Pyx_INCREF(((PyObject *)__pyx_v_base));
5664 __pyx_r = ((PyObject *)__pyx_v_base);
5665 goto __pyx_L0;
5666
5667 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1026
5668 * PyArray_SetBaseObject(arr, base)
5669 *
5670 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
5671 * base = PyArray_BASE(arr)
5672 * if base is NULL:
5673 */
5674
5675 /* function exit code */
5676 __pyx_L0:;
5677 __Pyx_XGIVEREF(__pyx_r);
5678 __Pyx_RefNannyFinishContext();
5679 return __pyx_r;
5680 }
5681
5682 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1034
5683 * # Versions of the import_* functions which are more suitable for
5684 * # Cython code.
5685 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
5686 * try:
5687 * _import_array()
5688 */
5689
__pyx_f_5numpy_import_array(void)5690 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
5691 int __pyx_r;
5692 __Pyx_RefNannyDeclarations
5693 PyObject *__pyx_t_1 = NULL;
5694 PyObject *__pyx_t_2 = NULL;
5695 PyObject *__pyx_t_3 = NULL;
5696 int __pyx_t_4;
5697 PyObject *__pyx_t_5 = NULL;
5698 PyObject *__pyx_t_6 = NULL;
5699 PyObject *__pyx_t_7 = NULL;
5700 PyObject *__pyx_t_8 = NULL;
5701 __Pyx_RefNannySetupContext("import_array", 0);
5702
5703 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1035
5704 * # Cython code.
5705 * cdef inline int import_array() except -1:
5706 * try: # <<<<<<<<<<<<<<
5707 * _import_array()
5708 * except Exception:
5709 */
5710 {
5711 __Pyx_PyThreadState_declare
5712 __Pyx_PyThreadState_assign
5713 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
5714 __Pyx_XGOTREF(__pyx_t_1);
5715 __Pyx_XGOTREF(__pyx_t_2);
5716 __Pyx_XGOTREF(__pyx_t_3);
5717 /*try:*/ {
5718
5719 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1036
5720 * cdef inline int import_array() except -1:
5721 * try:
5722 * _import_array() # <<<<<<<<<<<<<<
5723 * except Exception:
5724 * raise ImportError("numpy.core.multiarray failed to import")
5725 */
5726 __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1036, __pyx_L3_error)
5727
5728 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1035
5729 * # Cython code.
5730 * cdef inline int import_array() except -1:
5731 * try: # <<<<<<<<<<<<<<
5732 * _import_array()
5733 * except Exception:
5734 */
5735 }
5736 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5737 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5738 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5739 goto __pyx_L8_try_end;
5740 __pyx_L3_error:;
5741
5742 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1037
5743 * try:
5744 * _import_array()
5745 * except Exception: # <<<<<<<<<<<<<<
5746 * raise ImportError("numpy.core.multiarray failed to import")
5747 *
5748 */
5749 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
5750 if (__pyx_t_4) {
5751 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
5752 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1037, __pyx_L5_except_error)
5753 __Pyx_GOTREF(__pyx_t_5);
5754 __Pyx_GOTREF(__pyx_t_6);
5755 __Pyx_GOTREF(__pyx_t_7);
5756
5757 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1038
5758 * _import_array()
5759 * except Exception:
5760 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
5761 *
5762 * cdef inline int import_umath() except -1:
5763 */
5764 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1038, __pyx_L5_except_error)
5765 __Pyx_GOTREF(__pyx_t_8);
5766 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
5767 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5768 __PYX_ERR(2, 1038, __pyx_L5_except_error)
5769 }
5770 goto __pyx_L5_except_error;
5771 __pyx_L5_except_error:;
5772
5773 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1035
5774 * # Cython code.
5775 * cdef inline int import_array() except -1:
5776 * try: # <<<<<<<<<<<<<<
5777 * _import_array()
5778 * except Exception:
5779 */
5780 __Pyx_XGIVEREF(__pyx_t_1);
5781 __Pyx_XGIVEREF(__pyx_t_2);
5782 __Pyx_XGIVEREF(__pyx_t_3);
5783 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5784 goto __pyx_L1_error;
5785 __pyx_L8_try_end:;
5786 }
5787
5788 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1034
5789 * # Versions of the import_* functions which are more suitable for
5790 * # Cython code.
5791 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
5792 * try:
5793 * _import_array()
5794 */
5795
5796 /* function exit code */
5797 __pyx_r = 0;
5798 goto __pyx_L0;
5799 __pyx_L1_error:;
5800 __Pyx_XDECREF(__pyx_t_5);
5801 __Pyx_XDECREF(__pyx_t_6);
5802 __Pyx_XDECREF(__pyx_t_7);
5803 __Pyx_XDECREF(__pyx_t_8);
5804 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
5805 __pyx_r = -1;
5806 __pyx_L0:;
5807 __Pyx_RefNannyFinishContext();
5808 return __pyx_r;
5809 }
5810
5811 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1040
5812 * raise ImportError("numpy.core.multiarray failed to import")
5813 *
5814 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
5815 * try:
5816 * _import_umath()
5817 */
5818
__pyx_f_5numpy_import_umath(void)5819 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
5820 int __pyx_r;
5821 __Pyx_RefNannyDeclarations
5822 PyObject *__pyx_t_1 = NULL;
5823 PyObject *__pyx_t_2 = NULL;
5824 PyObject *__pyx_t_3 = NULL;
5825 int __pyx_t_4;
5826 PyObject *__pyx_t_5 = NULL;
5827 PyObject *__pyx_t_6 = NULL;
5828 PyObject *__pyx_t_7 = NULL;
5829 PyObject *__pyx_t_8 = NULL;
5830 __Pyx_RefNannySetupContext("import_umath", 0);
5831
5832 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1041
5833 *
5834 * cdef inline int import_umath() except -1:
5835 * try: # <<<<<<<<<<<<<<
5836 * _import_umath()
5837 * except Exception:
5838 */
5839 {
5840 __Pyx_PyThreadState_declare
5841 __Pyx_PyThreadState_assign
5842 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
5843 __Pyx_XGOTREF(__pyx_t_1);
5844 __Pyx_XGOTREF(__pyx_t_2);
5845 __Pyx_XGOTREF(__pyx_t_3);
5846 /*try:*/ {
5847
5848 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1042
5849 * cdef inline int import_umath() except -1:
5850 * try:
5851 * _import_umath() # <<<<<<<<<<<<<<
5852 * except Exception:
5853 * raise ImportError("numpy.core.umath failed to import")
5854 */
5855 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1042, __pyx_L3_error)
5856
5857 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1041
5858 *
5859 * cdef inline int import_umath() except -1:
5860 * try: # <<<<<<<<<<<<<<
5861 * _import_umath()
5862 * except Exception:
5863 */
5864 }
5865 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5866 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5867 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5868 goto __pyx_L8_try_end;
5869 __pyx_L3_error:;
5870
5871 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1043
5872 * try:
5873 * _import_umath()
5874 * except Exception: # <<<<<<<<<<<<<<
5875 * raise ImportError("numpy.core.umath failed to import")
5876 *
5877 */
5878 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
5879 if (__pyx_t_4) {
5880 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
5881 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1043, __pyx_L5_except_error)
5882 __Pyx_GOTREF(__pyx_t_5);
5883 __Pyx_GOTREF(__pyx_t_6);
5884 __Pyx_GOTREF(__pyx_t_7);
5885
5886 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1044
5887 * _import_umath()
5888 * except Exception:
5889 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
5890 *
5891 * cdef inline int import_ufunc() except -1:
5892 */
5893 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1044, __pyx_L5_except_error)
5894 __Pyx_GOTREF(__pyx_t_8);
5895 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
5896 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5897 __PYX_ERR(2, 1044, __pyx_L5_except_error)
5898 }
5899 goto __pyx_L5_except_error;
5900 __pyx_L5_except_error:;
5901
5902 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1041
5903 *
5904 * cdef inline int import_umath() except -1:
5905 * try: # <<<<<<<<<<<<<<
5906 * _import_umath()
5907 * except Exception:
5908 */
5909 __Pyx_XGIVEREF(__pyx_t_1);
5910 __Pyx_XGIVEREF(__pyx_t_2);
5911 __Pyx_XGIVEREF(__pyx_t_3);
5912 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5913 goto __pyx_L1_error;
5914 __pyx_L8_try_end:;
5915 }
5916
5917 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1040
5918 * raise ImportError("numpy.core.multiarray failed to import")
5919 *
5920 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
5921 * try:
5922 * _import_umath()
5923 */
5924
5925 /* function exit code */
5926 __pyx_r = 0;
5927 goto __pyx_L0;
5928 __pyx_L1_error:;
5929 __Pyx_XDECREF(__pyx_t_5);
5930 __Pyx_XDECREF(__pyx_t_6);
5931 __Pyx_XDECREF(__pyx_t_7);
5932 __Pyx_XDECREF(__pyx_t_8);
5933 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
5934 __pyx_r = -1;
5935 __pyx_L0:;
5936 __Pyx_RefNannyFinishContext();
5937 return __pyx_r;
5938 }
5939
5940 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1046
5941 * raise ImportError("numpy.core.umath failed to import")
5942 *
5943 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
5944 * try:
5945 * _import_umath()
5946 */
5947
__pyx_f_5numpy_import_ufunc(void)5948 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
5949 int __pyx_r;
5950 __Pyx_RefNannyDeclarations
5951 PyObject *__pyx_t_1 = NULL;
5952 PyObject *__pyx_t_2 = NULL;
5953 PyObject *__pyx_t_3 = NULL;
5954 int __pyx_t_4;
5955 PyObject *__pyx_t_5 = NULL;
5956 PyObject *__pyx_t_6 = NULL;
5957 PyObject *__pyx_t_7 = NULL;
5958 PyObject *__pyx_t_8 = NULL;
5959 __Pyx_RefNannySetupContext("import_ufunc", 0);
5960
5961 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1047
5962 *
5963 * cdef inline int import_ufunc() except -1:
5964 * try: # <<<<<<<<<<<<<<
5965 * _import_umath()
5966 * except Exception:
5967 */
5968 {
5969 __Pyx_PyThreadState_declare
5970 __Pyx_PyThreadState_assign
5971 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
5972 __Pyx_XGOTREF(__pyx_t_1);
5973 __Pyx_XGOTREF(__pyx_t_2);
5974 __Pyx_XGOTREF(__pyx_t_3);
5975 /*try:*/ {
5976
5977 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1048
5978 * cdef inline int import_ufunc() except -1:
5979 * try:
5980 * _import_umath() # <<<<<<<<<<<<<<
5981 * except Exception:
5982 * raise ImportError("numpy.core.umath failed to import")
5983 */
5984 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1048, __pyx_L3_error)
5985
5986 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1047
5987 *
5988 * cdef inline int import_ufunc() except -1:
5989 * try: # <<<<<<<<<<<<<<
5990 * _import_umath()
5991 * except Exception:
5992 */
5993 }
5994 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5995 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5996 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5997 goto __pyx_L8_try_end;
5998 __pyx_L3_error:;
5999
6000 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1049
6001 * try:
6002 * _import_umath()
6003 * except Exception: # <<<<<<<<<<<<<<
6004 * raise ImportError("numpy.core.umath failed to import")
6005 */
6006 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6007 if (__pyx_t_4) {
6008 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
6009 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1049, __pyx_L5_except_error)
6010 __Pyx_GOTREF(__pyx_t_5);
6011 __Pyx_GOTREF(__pyx_t_6);
6012 __Pyx_GOTREF(__pyx_t_7);
6013
6014 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1050
6015 * _import_umath()
6016 * except Exception:
6017 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
6018 */
6019 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1050, __pyx_L5_except_error)
6020 __Pyx_GOTREF(__pyx_t_8);
6021 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6022 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6023 __PYX_ERR(2, 1050, __pyx_L5_except_error)
6024 }
6025 goto __pyx_L5_except_error;
6026 __pyx_L5_except_error:;
6027
6028 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1047
6029 *
6030 * cdef inline int import_ufunc() except -1:
6031 * try: # <<<<<<<<<<<<<<
6032 * _import_umath()
6033 * except Exception:
6034 */
6035 __Pyx_XGIVEREF(__pyx_t_1);
6036 __Pyx_XGIVEREF(__pyx_t_2);
6037 __Pyx_XGIVEREF(__pyx_t_3);
6038 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6039 goto __pyx_L1_error;
6040 __pyx_L8_try_end:;
6041 }
6042
6043 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1046
6044 * raise ImportError("numpy.core.umath failed to import")
6045 *
6046 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
6047 * try:
6048 * _import_umath()
6049 */
6050
6051 /* function exit code */
6052 __pyx_r = 0;
6053 goto __pyx_L0;
6054 __pyx_L1_error:;
6055 __Pyx_XDECREF(__pyx_t_5);
6056 __Pyx_XDECREF(__pyx_t_6);
6057 __Pyx_XDECREF(__pyx_t_7);
6058 __Pyx_XDECREF(__pyx_t_8);
6059 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
6060 __pyx_r = -1;
6061 __pyx_L0:;
6062 __Pyx_RefNannyFinishContext();
6063 return __pyx_r;
6064 }
6065 static struct __pyx_vtabstruct_4cylp_2cy_9CyOsiCuts_CyOsiCuts __pyx_vtable_4cylp_2cy_9CyOsiCuts_CyOsiCuts;
6066
__pyx_tp_new_4cylp_2cy_9CyOsiCuts_CyOsiCuts(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)6067 static PyObject *__pyx_tp_new_4cylp_2cy_9CyOsiCuts_CyOsiCuts(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
6068 struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *p;
6069 PyObject *o;
6070 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
6071 o = (*t->tp_alloc)(t, 0);
6072 } else {
6073 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
6074 }
6075 if (unlikely(!o)) return 0;
6076 p = ((struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *)o);
6077 p->__pyx_vtab = __pyx_vtabptr_4cylp_2cy_9CyOsiCuts_CyOsiCuts;
6078 if (unlikely(__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
6079 return o;
6080 bad:
6081 Py_DECREF(o); o = 0;
6082 return NULL;
6083 }
6084
__pyx_tp_dealloc_4cylp_2cy_9CyOsiCuts_CyOsiCuts(PyObject * o)6085 static void __pyx_tp_dealloc_4cylp_2cy_9CyOsiCuts_CyOsiCuts(PyObject *o) {
6086 #if CYTHON_USE_TP_FINALIZE
6087 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
6088 if (PyObject_CallFinalizerFromDealloc(o)) return;
6089 }
6090 #endif
6091 (*Py_TYPE(o)->tp_free)(o);
6092 }
6093
__pyx_getprop_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_numberOfRowCuts(PyObject * o,CYTHON_UNUSED void * x)6094 static PyObject *__pyx_getprop_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_numberOfRowCuts(PyObject *o, CYTHON_UNUSED void *x) {
6095 return __pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_15numberOfRowCuts_1__get__(o);
6096 }
6097
__pyx_getprop_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_numberOfColumnCuts(PyObject * o,CYTHON_UNUSED void * x)6098 static PyObject *__pyx_getprop_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_numberOfColumnCuts(PyObject *o, CYTHON_UNUSED void *x) {
6099 return __pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_18numberOfColumnCuts_1__get__(o);
6100 }
6101
__pyx_getprop_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_numberOfCuts(PyObject * o,CYTHON_UNUSED void * x)6102 static PyObject *__pyx_getprop_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_numberOfCuts(PyObject *o, CYTHON_UNUSED void *x) {
6103 return __pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_12numberOfCuts_1__get__(o);
6104 }
6105
6106 static PyMethodDef __pyx_methods_4cylp_2cy_9CyOsiCuts_CyOsiCuts[] = {
6107 {"printCuts", (PyCFunction)__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_3printCuts, METH_NOARGS, 0},
6108 {"addColumnCut", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_5addColumnCut, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_4addColumnCut},
6109 {"addRowCut", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_7addRowCut, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_6addRowCut},
6110 {"__reduce_cython__", (PyCFunction)__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_9__reduce_cython__, METH_NOARGS, 0},
6111 {"__setstate_cython__", (PyCFunction)__pyx_pw_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_11__setstate_cython__, METH_O, 0},
6112 {0, 0, 0, 0}
6113 };
6114
6115 static struct PyGetSetDef __pyx_getsets_4cylp_2cy_9CyOsiCuts_CyOsiCuts[] = {
6116 {(char *)"numberOfRowCuts", __pyx_getprop_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_numberOfRowCuts, 0, (char *)0, 0},
6117 {(char *)"numberOfColumnCuts", __pyx_getprop_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_numberOfColumnCuts, 0, (char *)0, 0},
6118 {(char *)"numberOfCuts", __pyx_getprop_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_numberOfCuts, 0, (char *)0, 0},
6119 {0, 0, 0, 0, 0}
6120 };
6121
6122 static PyTypeObject __pyx_type_4cylp_2cy_9CyOsiCuts_CyOsiCuts = {
6123 PyVarObject_HEAD_INIT(0, 0)
6124 "cylp.cy.CyOsiCuts.CyOsiCuts", /*tp_name*/
6125 sizeof(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts), /*tp_basicsize*/
6126 0, /*tp_itemsize*/
6127 __pyx_tp_dealloc_4cylp_2cy_9CyOsiCuts_CyOsiCuts, /*tp_dealloc*/
6128 0, /*tp_print*/
6129 0, /*tp_getattr*/
6130 0, /*tp_setattr*/
6131 #if PY_MAJOR_VERSION < 3
6132 0, /*tp_compare*/
6133 #endif
6134 #if PY_MAJOR_VERSION >= 3
6135 0, /*tp_as_async*/
6136 #endif
6137 0, /*tp_repr*/
6138 0, /*tp_as_number*/
6139 0, /*tp_as_sequence*/
6140 0, /*tp_as_mapping*/
6141 0, /*tp_hash*/
6142 0, /*tp_call*/
6143 0, /*tp_str*/
6144 0, /*tp_getattro*/
6145 0, /*tp_setattro*/
6146 0, /*tp_as_buffer*/
6147 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
6148 "CyOsiCuts documentation", /*tp_doc*/
6149 0, /*tp_traverse*/
6150 0, /*tp_clear*/
6151 0, /*tp_richcompare*/
6152 0, /*tp_weaklistoffset*/
6153 0, /*tp_iter*/
6154 0, /*tp_iternext*/
6155 __pyx_methods_4cylp_2cy_9CyOsiCuts_CyOsiCuts, /*tp_methods*/
6156 0, /*tp_members*/
6157 __pyx_getsets_4cylp_2cy_9CyOsiCuts_CyOsiCuts, /*tp_getset*/
6158 0, /*tp_base*/
6159 0, /*tp_dict*/
6160 0, /*tp_descr_get*/
6161 0, /*tp_descr_set*/
6162 0, /*tp_dictoffset*/
6163 0, /*tp_init*/
6164 0, /*tp_alloc*/
6165 __pyx_tp_new_4cylp_2cy_9CyOsiCuts_CyOsiCuts, /*tp_new*/
6166 0, /*tp_free*/
6167 0, /*tp_is_gc*/
6168 0, /*tp_bases*/
6169 0, /*tp_mro*/
6170 0, /*tp_cache*/
6171 0, /*tp_subclasses*/
6172 0, /*tp_weaklist*/
6173 0, /*tp_del*/
6174 0, /*tp_version_tag*/
6175 #if PY_VERSION_HEX >= 0x030400a1
6176 0, /*tp_finalize*/
6177 #endif
6178 #if PY_VERSION_HEX >= 0x030800b1
6179 0, /*tp_vectorcall*/
6180 #endif
6181 };
6182
6183 static PyMethodDef __pyx_methods[] = {
6184 {0, 0, 0, 0}
6185 };
6186
6187 #if PY_MAJOR_VERSION >= 3
6188 #if CYTHON_PEP489_MULTI_PHASE_INIT
6189 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
6190 static int __pyx_pymod_exec_CyOsiCuts(PyObject* module); /*proto*/
6191 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
6192 {Py_mod_create, (void*)__pyx_pymod_create},
6193 {Py_mod_exec, (void*)__pyx_pymod_exec_CyOsiCuts},
6194 {0, NULL}
6195 };
6196 #endif
6197
6198 static struct PyModuleDef __pyx_moduledef = {
6199 PyModuleDef_HEAD_INIT,
6200 "CyOsiCuts",
6201 0, /* m_doc */
6202 #if CYTHON_PEP489_MULTI_PHASE_INIT
6203 0, /* m_size */
6204 #else
6205 -1, /* m_size */
6206 #endif
6207 __pyx_methods /* m_methods */,
6208 #if CYTHON_PEP489_MULTI_PHASE_INIT
6209 __pyx_moduledef_slots, /* m_slots */
6210 #else
6211 NULL, /* m_reload */
6212 #endif
6213 NULL, /* m_traverse */
6214 NULL, /* m_clear */
6215 NULL /* m_free */
6216 };
6217 #endif
6218 #ifndef CYTHON_SMALL_CODE
6219 #if defined(__clang__)
6220 #define CYTHON_SMALL_CODE
6221 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
6222 #define CYTHON_SMALL_CODE __attribute__((cold))
6223 #else
6224 #define CYTHON_SMALL_CODE
6225 #endif
6226 #endif
6227
6228 static __Pyx_StringTabEntry __pyx_string_tab[] = {
6229 {&__pyx_n_s_CyLPModel, __pyx_k_CyLPModel, sizeof(__pyx_k_CyLPModel), 0, 0, 1, 1},
6230 {&__pyx_n_s_CyOsiCuts, __pyx_k_CyOsiCuts, sizeof(__pyx_k_CyOsiCuts), 0, 0, 1, 1},
6231 {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
6232 {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
6233 {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
6234 {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
6235 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
6236 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
6237 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
6238 {&__pyx_n_s_addVariable, __pyx_k_addVariable, sizeof(__pyx_k_addVariable), 0, 0, 1, 1},
6239 {&__pyx_n_s_arange, __pyx_k_arange, sizeof(__pyx_k_arange), 0, 0, 1, 1},
6240 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
6241 {&__pyx_n_s_csr_matrix, __pyx_k_csr_matrix, sizeof(__pyx_k_csr_matrix), 0, 0, 1, 1},
6242 {&__pyx_n_s_cut, __pyx_k_cut, sizeof(__pyx_k_cut), 0, 0, 1, 1},
6243 {&__pyx_n_s_cyLpModel, __pyx_k_cyLpModel, sizeof(__pyx_k_cyLpModel), 0, 0, 1, 1},
6244 {&__pyx_n_s_cylp_py_modeling_CyLPModel, __pyx_k_cylp_py_modeling_CyLPModel, sizeof(__pyx_k_cylp_py_modeling_CyLPModel), 0, 0, 1, 1},
6245 {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
6246 {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 0, 0, 1, 1},
6247 {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
6248 {&__pyx_n_s_getVarByName, __pyx_k_getVarByName, sizeof(__pyx_k_getVarByName), 0, 0, 1, 1},
6249 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
6250 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
6251 {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1},
6252 {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
6253 {&__pyx_n_s_isInt, __pyx_k_isInt, sizeof(__pyx_k_isInt), 0, 0, 1, 1},
6254 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
6255 {&__pyx_n_s_makeMatrices, __pyx_k_makeMatrices, sizeof(__pyx_k_makeMatrices), 0, 0, 1, 1},
6256 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
6257 {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
6258 {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
6259 {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
6260 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
6261 {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
6262 {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
6263 {&__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},
6264 {&__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},
6265 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
6266 {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
6267 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
6268 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
6269 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
6270 {&__pyx_n_s_scipy, __pyx_k_scipy, sizeof(__pyx_k_scipy), 0, 0, 1, 1},
6271 {&__pyx_n_s_scipy_sparse, __pyx_k_scipy_sparse, sizeof(__pyx_k_scipy_sparse), 0, 0, 1, 1},
6272 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
6273 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
6274 {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
6275 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
6276 {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
6277 {&__pyx_n_s_variables, __pyx_k_variables, sizeof(__pyx_k_variables), 0, 0, 1, 1},
6278 {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
6279 {&__pyx_n_s_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1},
6280 {0, 0, 0, 0, 0, 0, 0}
6281 };
__Pyx_InitCachedBuiltins(void)6282 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
6283 #if PY_MAJOR_VERSION >= 3
6284 __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) __PYX_ERR(0, 70, __pyx_L1_error)
6285 #else
6286 __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) __PYX_ERR(0, 70, __pyx_L1_error)
6287 #endif
6288 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
6289 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 272, __pyx_L1_error)
6290 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(2, 285, __pyx_L1_error)
6291 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(2, 856, __pyx_L1_error)
6292 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 1038, __pyx_L1_error)
6293 return 0;
6294 __pyx_L1_error:;
6295 return -1;
6296 }
6297
__Pyx_InitCachedConstants(void)6298 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
6299 __Pyx_RefNannyDeclarations
6300 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
6301
6302 /* "cylp/cy/CyOsiCuts.pyx":71
6303 *
6304 * for nr in xrange(mat.shape[0]):
6305 * row = mat[nr, :] # <<<<<<<<<<<<<<
6306 * row_inds = row.indices
6307 * row_data = row.data
6308 */
6309 __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 71, __pyx_L1_error)
6310 __Pyx_GOTREF(__pyx_slice_);
6311 __Pyx_GIVEREF(__pyx_slice_);
6312
6313 /* "(tree fragment)":2
6314 * def __reduce_cython__(self):
6315 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
6316 * def __setstate_cython__(self, __pyx_state):
6317 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6318 */
6319 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 2, __pyx_L1_error)
6320 __Pyx_GOTREF(__pyx_tuple__2);
6321 __Pyx_GIVEREF(__pyx_tuple__2);
6322
6323 /* "(tree fragment)":4
6324 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6325 * def __setstate_cython__(self, __pyx_state):
6326 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
6327 */
6328 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 4, __pyx_L1_error)
6329 __Pyx_GOTREF(__pyx_tuple__3);
6330 __Pyx_GIVEREF(__pyx_tuple__3);
6331
6332 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":272
6333 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
6334 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
6335 * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
6336 *
6337 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
6338 */
6339 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 272, __pyx_L1_error)
6340 __Pyx_GOTREF(__pyx_tuple__4);
6341 __Pyx_GIVEREF(__pyx_tuple__4);
6342
6343 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":276
6344 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
6345 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
6346 * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
6347 *
6348 * info.buf = PyArray_DATA(self)
6349 */
6350 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 276, __pyx_L1_error)
6351 __Pyx_GOTREF(__pyx_tuple__5);
6352 __Pyx_GIVEREF(__pyx_tuple__5);
6353
6354 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":306
6355 * if ((descr.byteorder == c'>' and little_endian) or
6356 * (descr.byteorder == c'<' and not little_endian)):
6357 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
6358 * if t == NPY_BYTE: f = "b"
6359 * elif t == NPY_UBYTE: f = "B"
6360 */
6361 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 306, __pyx_L1_error)
6362 __Pyx_GOTREF(__pyx_tuple__6);
6363 __Pyx_GIVEREF(__pyx_tuple__6);
6364
6365 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":856
6366 *
6367 * if (end - f) - <int>(new_offset - offset[0]) < 15:
6368 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
6369 *
6370 * if ((child.byteorder == c'>' and little_endian) or
6371 */
6372 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 856, __pyx_L1_error)
6373 __Pyx_GOTREF(__pyx_tuple__7);
6374 __Pyx_GIVEREF(__pyx_tuple__7);
6375
6376 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":880
6377 * t = child.type_num
6378 * if end - f < 5:
6379 * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
6380 *
6381 * # Until ticket #99 is fixed, use integers to avoid warnings
6382 */
6383 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 880, __pyx_L1_error)
6384 __Pyx_GOTREF(__pyx_tuple__8);
6385 __Pyx_GIVEREF(__pyx_tuple__8);
6386
6387 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1038
6388 * _import_array()
6389 * except Exception:
6390 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
6391 *
6392 * cdef inline int import_umath() except -1:
6393 */
6394 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 1038, __pyx_L1_error)
6395 __Pyx_GOTREF(__pyx_tuple__9);
6396 __Pyx_GIVEREF(__pyx_tuple__9);
6397
6398 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1044
6399 * _import_umath()
6400 * except Exception:
6401 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
6402 *
6403 * cdef inline int import_ufunc() except -1:
6404 */
6405 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 1044, __pyx_L1_error)
6406 __Pyx_GOTREF(__pyx_tuple__10);
6407 __Pyx_GIVEREF(__pyx_tuple__10);
6408 __Pyx_RefNannyFinishContext();
6409 return 0;
6410 __pyx_L1_error:;
6411 __Pyx_RefNannyFinishContext();
6412 return -1;
6413 }
6414
__Pyx_InitGlobals(void)6415 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
6416 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
6417 return 0;
6418 __pyx_L1_error:;
6419 return -1;
6420 }
6421
6422 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
6423 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
6424 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
6425 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
6426 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
6427 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
6428 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
6429
__Pyx_modinit_global_init_code(void)6430 static int __Pyx_modinit_global_init_code(void) {
6431 __Pyx_RefNannyDeclarations
6432 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
6433 /*--- Global init code ---*/
6434 __Pyx_RefNannyFinishContext();
6435 return 0;
6436 }
6437
__Pyx_modinit_variable_export_code(void)6438 static int __Pyx_modinit_variable_export_code(void) {
6439 __Pyx_RefNannyDeclarations
6440 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
6441 /*--- Variable export code ---*/
6442 __Pyx_RefNannyFinishContext();
6443 return 0;
6444 }
6445
__Pyx_modinit_function_export_code(void)6446 static int __Pyx_modinit_function_export_code(void) {
6447 __Pyx_RefNannyDeclarations
6448 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
6449 /*--- Function export code ---*/
6450 __Pyx_RefNannyFinishContext();
6451 return 0;
6452 }
6453
__Pyx_modinit_type_init_code(void)6454 static int __Pyx_modinit_type_init_code(void) {
6455 __Pyx_RefNannyDeclarations
6456 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
6457 /*--- Type init code ---*/
6458 __pyx_vtabptr_4cylp_2cy_9CyOsiCuts_CyOsiCuts = &__pyx_vtable_4cylp_2cy_9CyOsiCuts_CyOsiCuts;
6459 __pyx_vtable_4cylp_2cy_9CyOsiCuts_CyOsiCuts.setCppSelf = (PyObject *(*)(struct __pyx_obj_4cylp_2cy_9CyOsiCuts_CyOsiCuts *, CppOsiCuts *))__pyx_f_4cylp_2cy_9CyOsiCuts_9CyOsiCuts_setCppSelf;
6460 if (PyType_Ready(&__pyx_type_4cylp_2cy_9CyOsiCuts_CyOsiCuts) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
6461 #if PY_VERSION_HEX < 0x030800B1
6462 __pyx_type_4cylp_2cy_9CyOsiCuts_CyOsiCuts.tp_print = 0;
6463 #endif
6464 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4cylp_2cy_9CyOsiCuts_CyOsiCuts.tp_dictoffset && __pyx_type_4cylp_2cy_9CyOsiCuts_CyOsiCuts.tp_getattro == PyObject_GenericGetAttr)) {
6465 __pyx_type_4cylp_2cy_9CyOsiCuts_CyOsiCuts.tp_getattro = __Pyx_PyObject_GenericGetAttr;
6466 }
6467 if (__Pyx_SetVtable(__pyx_type_4cylp_2cy_9CyOsiCuts_CyOsiCuts.tp_dict, __pyx_vtabptr_4cylp_2cy_9CyOsiCuts_CyOsiCuts) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
6468 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CyOsiCuts, (PyObject *)&__pyx_type_4cylp_2cy_9CyOsiCuts_CyOsiCuts) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
6469 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4cylp_2cy_9CyOsiCuts_CyOsiCuts) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
6470 __pyx_ptype_4cylp_2cy_9CyOsiCuts_CyOsiCuts = &__pyx_type_4cylp_2cy_9CyOsiCuts_CyOsiCuts;
6471 __Pyx_RefNannyFinishContext();
6472 return 0;
6473 __pyx_L1_error:;
6474 __Pyx_RefNannyFinishContext();
6475 return -1;
6476 }
6477
__Pyx_modinit_type_import_code(void)6478 static int __Pyx_modinit_type_import_code(void) {
6479 __Pyx_RefNannyDeclarations
6480 PyObject *__pyx_t_1 = NULL;
6481 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
6482 /*--- Type import code ---*/
6483 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
6484 __Pyx_GOTREF(__pyx_t_1);
6485 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
6486 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
6487 sizeof(PyTypeObject),
6488 #else
6489 sizeof(PyHeapTypeObject),
6490 #endif
6491 __Pyx_ImportType_CheckSize_Warn);
6492 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
6493 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6494 __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 206, __pyx_L1_error)
6495 __Pyx_GOTREF(__pyx_t_1);
6496 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
6497 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 206, __pyx_L1_error)
6498 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
6499 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 229, __pyx_L1_error)
6500 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
6501 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 233, __pyx_L1_error)
6502 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
6503 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 242, __pyx_L1_error)
6504 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
6505 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 918, __pyx_L1_error)
6506 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6507 __Pyx_RefNannyFinishContext();
6508 return 0;
6509 __pyx_L1_error:;
6510 __Pyx_XDECREF(__pyx_t_1);
6511 __Pyx_RefNannyFinishContext();
6512 return -1;
6513 }
6514
__Pyx_modinit_variable_import_code(void)6515 static int __Pyx_modinit_variable_import_code(void) {
6516 __Pyx_RefNannyDeclarations
6517 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
6518 /*--- Variable import code ---*/
6519 __Pyx_RefNannyFinishContext();
6520 return 0;
6521 }
6522
__Pyx_modinit_function_import_code(void)6523 static int __Pyx_modinit_function_import_code(void) {
6524 __Pyx_RefNannyDeclarations
6525 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
6526 /*--- Function import code ---*/
6527 __Pyx_RefNannyFinishContext();
6528 return 0;
6529 }
6530
6531
6532 #if PY_MAJOR_VERSION < 3
6533 #ifdef CYTHON_NO_PYINIT_EXPORT
6534 #define __Pyx_PyMODINIT_FUNC void
6535 #else
6536 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
6537 #endif
6538 #else
6539 #ifdef CYTHON_NO_PYINIT_EXPORT
6540 #define __Pyx_PyMODINIT_FUNC PyObject *
6541 #else
6542 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
6543 #endif
6544 #endif
6545
6546
6547 #if PY_MAJOR_VERSION < 3
6548 __Pyx_PyMODINIT_FUNC initCyOsiCuts(void) CYTHON_SMALL_CODE; /*proto*/
initCyOsiCuts(void)6549 __Pyx_PyMODINIT_FUNC initCyOsiCuts(void)
6550 #else
6551 __Pyx_PyMODINIT_FUNC PyInit_CyOsiCuts(void) CYTHON_SMALL_CODE; /*proto*/
6552 __Pyx_PyMODINIT_FUNC PyInit_CyOsiCuts(void)
6553 #if CYTHON_PEP489_MULTI_PHASE_INIT
6554 {
6555 return PyModuleDef_Init(&__pyx_moduledef);
6556 }
6557 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
6558 #if PY_VERSION_HEX >= 0x030700A1
6559 static PY_INT64_T main_interpreter_id = -1;
6560 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
6561 if (main_interpreter_id == -1) {
6562 main_interpreter_id = current_id;
6563 return (unlikely(current_id == -1)) ? -1 : 0;
6564 } else if (unlikely(main_interpreter_id != current_id))
6565 #else
6566 static PyInterpreterState *main_interpreter = NULL;
6567 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
6568 if (!main_interpreter) {
6569 main_interpreter = current_interpreter;
6570 } else if (unlikely(main_interpreter != current_interpreter))
6571 #endif
6572 {
6573 PyErr_SetString(
6574 PyExc_ImportError,
6575 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
6576 return -1;
6577 }
6578 return 0;
6579 }
6580 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) {
6581 PyObject *value = PyObject_GetAttrString(spec, from_name);
6582 int result = 0;
6583 if (likely(value)) {
6584 if (allow_none || value != Py_None) {
6585 result = PyDict_SetItemString(moddict, to_name, value);
6586 }
6587 Py_DECREF(value);
6588 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
6589 PyErr_Clear();
6590 } else {
6591 result = -1;
6592 }
6593 return result;
6594 }
6595 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
6596 PyObject *module = NULL, *moddict, *modname;
6597 if (__Pyx_check_single_interpreter())
6598 return NULL;
6599 if (__pyx_m)
6600 return __Pyx_NewRef(__pyx_m);
6601 modname = PyObject_GetAttrString(spec, "name");
6602 if (unlikely(!modname)) goto bad;
6603 module = PyModule_NewObject(modname);
6604 Py_DECREF(modname);
6605 if (unlikely(!module)) goto bad;
6606 moddict = PyModule_GetDict(module);
6607 if (unlikely(!moddict)) goto bad;
6608 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
6609 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
6610 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
6611 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
6612 return module;
6613 bad:
6614 Py_XDECREF(module);
6615 return NULL;
6616 }
6617
6618
6619 static CYTHON_SMALL_CODE int __pyx_pymod_exec_CyOsiCuts(PyObject *__pyx_pyinit_module)
6620 #endif
6621 #endif
6622 {
6623 PyObject *__pyx_t_1 = NULL;
6624 PyObject *__pyx_t_2 = NULL;
6625 __Pyx_RefNannyDeclarations
6626 #if CYTHON_PEP489_MULTI_PHASE_INIT
6627 if (__pyx_m) {
6628 if (__pyx_m == __pyx_pyinit_module) return 0;
6629 PyErr_SetString(PyExc_RuntimeError, "Module 'CyOsiCuts' has already been imported. Re-initialisation is not supported.");
6630 return -1;
6631 }
6632 #elif PY_MAJOR_VERSION >= 3
6633 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
6634 #endif
6635 #if CYTHON_REFNANNY
6636 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
6637 if (!__Pyx_RefNanny) {
6638 PyErr_Clear();
6639 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
6640 if (!__Pyx_RefNanny)
6641 Py_FatalError("failed to import 'refnanny' module");
6642 }
6643 #endif
6644 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_CyOsiCuts(void)", 0);
6645 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6646 #ifdef __Pxy_PyFrame_Initialize_Offsets
6647 __Pxy_PyFrame_Initialize_Offsets();
6648 #endif
6649 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
6650 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
6651 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
6652 #ifdef __Pyx_CyFunction_USED
6653 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6654 #endif
6655 #ifdef __Pyx_FusedFunction_USED
6656 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6657 #endif
6658 #ifdef __Pyx_Coroutine_USED
6659 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6660 #endif
6661 #ifdef __Pyx_Generator_USED
6662 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6663 #endif
6664 #ifdef __Pyx_AsyncGen_USED
6665 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6666 #endif
6667 #ifdef __Pyx_StopAsyncIteration_USED
6668 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6669 #endif
6670 /*--- Library function declarations ---*/
6671 /*--- Threads initialization code ---*/
6672 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
6673 #ifdef WITH_THREAD /* Python build with threading support? */
6674 PyEval_InitThreads();
6675 #endif
6676 #endif
6677 /*--- Module creation code ---*/
6678 #if CYTHON_PEP489_MULTI_PHASE_INIT
6679 __pyx_m = __pyx_pyinit_module;
6680 Py_INCREF(__pyx_m);
6681 #else
6682 #if PY_MAJOR_VERSION < 3
6683 __pyx_m = Py_InitModule4("CyOsiCuts", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
6684 #else
6685 __pyx_m = PyModule_Create(&__pyx_moduledef);
6686 #endif
6687 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
6688 #endif
6689 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
6690 Py_INCREF(__pyx_d);
6691 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
6692 Py_INCREF(__pyx_b);
6693 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
6694 Py_INCREF(__pyx_cython_runtime);
6695 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
6696 /*--- Initialize various global constants etc. ---*/
6697 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6698 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
6699 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6700 #endif
6701 if (__pyx_module_is_main_cylp__cy__CyOsiCuts) {
6702 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6703 }
6704 #if PY_MAJOR_VERSION >= 3
6705 {
6706 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
6707 if (!PyDict_GetItemString(modules, "cylp.cy.CyOsiCuts")) {
6708 if (unlikely(PyDict_SetItemString(modules, "cylp.cy.CyOsiCuts", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
6709 }
6710 }
6711 #endif
6712 /*--- Builtin init code ---*/
6713 if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
6714 /*--- Constants init code ---*/
6715 if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
6716 /*--- Global type/function init code ---*/
6717 (void)__Pyx_modinit_global_init_code();
6718 (void)__Pyx_modinit_variable_export_code();
6719 (void)__Pyx_modinit_function_export_code();
6720 if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
6721 if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
6722 (void)__Pyx_modinit_variable_import_code();
6723 (void)__Pyx_modinit_function_import_code();
6724 /*--- Execution code ---*/
6725 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
6726 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6727 #endif
6728
6729 /* "cylp/cy/CyOsiCuts.pyx":1
6730 * import scipy # <<<<<<<<<<<<<<
6731 * from scipy.sparse import csr_matrix
6732 * cimport CyOsiCuts
6733 */
6734 __pyx_t_1 = __Pyx_Import(__pyx_n_s_scipy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
6735 __Pyx_GOTREF(__pyx_t_1);
6736 if (PyDict_SetItem(__pyx_d, __pyx_n_s_scipy, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6737 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6738
6739 /* "cylp/cy/CyOsiCuts.pyx":2
6740 * import scipy
6741 * from scipy.sparse import csr_matrix # <<<<<<<<<<<<<<
6742 * cimport CyOsiCuts
6743 * from cylp.py.modeling.CyLPModel import CyLPModel
6744 */
6745 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
6746 __Pyx_GOTREF(__pyx_t_1);
6747 __Pyx_INCREF(__pyx_n_s_csr_matrix);
6748 __Pyx_GIVEREF(__pyx_n_s_csr_matrix);
6749 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_csr_matrix);
6750 __pyx_t_2 = __Pyx_Import(__pyx_n_s_scipy_sparse, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)
6751 __Pyx_GOTREF(__pyx_t_2);
6752 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6753 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_csr_matrix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
6754 __Pyx_GOTREF(__pyx_t_1);
6755 if (PyDict_SetItem(__pyx_d, __pyx_n_s_csr_matrix, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
6756 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6757 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6758
6759 /* "cylp/cy/CyOsiCuts.pyx":4
6760 * from scipy.sparse import csr_matrix
6761 * cimport CyOsiCuts
6762 * from cylp.py.modeling.CyLPModel import CyLPModel # <<<<<<<<<<<<<<
6763 * cimport numpy as np
6764 * import numpy as np
6765 */
6766 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
6767 __Pyx_GOTREF(__pyx_t_2);
6768 __Pyx_INCREF(__pyx_n_s_CyLPModel);
6769 __Pyx_GIVEREF(__pyx_n_s_CyLPModel);
6770 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_CyLPModel);
6771 __pyx_t_1 = __Pyx_Import(__pyx_n_s_cylp_py_modeling_CyLPModel, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
6772 __Pyx_GOTREF(__pyx_t_1);
6773 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6774 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CyLPModel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
6775 __Pyx_GOTREF(__pyx_t_2);
6776 if (PyDict_SetItem(__pyx_d, __pyx_n_s_CyLPModel, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
6777 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6778 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6779
6780 /* "cylp/cy/CyOsiCuts.pyx":6
6781 * from cylp.py.modeling.CyLPModel import CyLPModel
6782 * cimport numpy as np
6783 * import numpy as np # <<<<<<<<<<<<<<
6784 *
6785 * cdef class CyOsiCuts:
6786 */
6787 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
6788 __Pyx_GOTREF(__pyx_t_1);
6789 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
6790 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6791
6792 /* "cylp/cy/CyOsiCuts.pyx":1
6793 * import scipy # <<<<<<<<<<<<<<
6794 * from scipy.sparse import csr_matrix
6795 * cimport CyOsiCuts
6796 */
6797 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
6798 __Pyx_GOTREF(__pyx_t_1);
6799 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6800 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6801
6802 /* "../../../../Users/tkral/Anaconda3/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1046
6803 * raise ImportError("numpy.core.umath failed to import")
6804 *
6805 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
6806 * try:
6807 * _import_umath()
6808 */
6809
6810 /*--- Wrapped vars code ---*/
6811
6812 goto __pyx_L0;
6813 __pyx_L1_error:;
6814 __Pyx_XDECREF(__pyx_t_1);
6815 __Pyx_XDECREF(__pyx_t_2);
6816 if (__pyx_m) {
6817 if (__pyx_d) {
6818 __Pyx_AddTraceback("init cylp.cy.CyOsiCuts", __pyx_clineno, __pyx_lineno, __pyx_filename);
6819 }
6820 Py_CLEAR(__pyx_m);
6821 } else if (!PyErr_Occurred()) {
6822 PyErr_SetString(PyExc_ImportError, "init cylp.cy.CyOsiCuts");
6823 }
6824 __pyx_L0:;
6825 __Pyx_RefNannyFinishContext();
6826 #if CYTHON_PEP489_MULTI_PHASE_INIT
6827 return (__pyx_m != NULL) ? 0 : -1;
6828 #elif PY_MAJOR_VERSION >= 3
6829 return __pyx_m;
6830 #else
6831 return;
6832 #endif
6833 }
6834
6835 /* --- Runtime support code --- */
6836 /* Refnanny */
6837 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)6838 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
6839 PyObject *m = NULL, *p = NULL;
6840 void *r = NULL;
6841 m = PyImport_ImportModule(modname);
6842 if (!m) goto end;
6843 p = PyObject_GetAttrString(m, "RefNannyAPI");
6844 if (!p) goto end;
6845 r = PyLong_AsVoidPtr(p);
6846 end:
6847 Py_XDECREF(p);
6848 Py_XDECREF(m);
6849 return (__Pyx_RefNannyAPIStruct *)r;
6850 }
6851 #endif
6852
6853 /* PyObjectGetAttrStr */
6854 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)6855 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
6856 PyTypeObject* tp = Py_TYPE(obj);
6857 if (likely(tp->tp_getattro))
6858 return tp->tp_getattro(obj, attr_name);
6859 #if PY_MAJOR_VERSION < 3
6860 if (likely(tp->tp_getattr))
6861 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
6862 #endif
6863 return PyObject_GetAttr(obj, attr_name);
6864 }
6865 #endif
6866
6867 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)6868 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
6869 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
6870 if (unlikely(!result)) {
6871 PyErr_Format(PyExc_NameError,
6872 #if PY_MAJOR_VERSION >= 3
6873 "name '%U' is not defined", name);
6874 #else
6875 "name '%.200s' is not defined", PyString_AS_STRING(name));
6876 #endif
6877 }
6878 return result;
6879 }
6880
6881 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)6882 static void __Pyx_RaiseArgtupleInvalid(
6883 const char* func_name,
6884 int exact,
6885 Py_ssize_t num_min,
6886 Py_ssize_t num_max,
6887 Py_ssize_t num_found)
6888 {
6889 Py_ssize_t num_expected;
6890 const char *more_or_less;
6891 if (num_found < num_min) {
6892 num_expected = num_min;
6893 more_or_less = "at least";
6894 } else {
6895 num_expected = num_max;
6896 more_or_less = "at most";
6897 }
6898 if (exact) {
6899 more_or_less = "exactly";
6900 }
6901 PyErr_Format(PyExc_TypeError,
6902 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
6903 func_name, more_or_less, num_expected,
6904 (num_expected == 1) ? "" : "s", num_found);
6905 }
6906
6907 /* KeywordStringCheck */
__Pyx_CheckKeywordStrings(PyObject * kwdict,const char * function_name,int kw_allowed)6908 static int __Pyx_CheckKeywordStrings(
6909 PyObject *kwdict,
6910 const char* function_name,
6911 int kw_allowed)
6912 {
6913 PyObject* key = 0;
6914 Py_ssize_t pos = 0;
6915 #if CYTHON_COMPILING_IN_PYPY
6916 if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
6917 goto invalid_keyword;
6918 return 1;
6919 #else
6920 while (PyDict_Next(kwdict, &pos, &key, 0)) {
6921 #if PY_MAJOR_VERSION < 3
6922 if (unlikely(!PyString_Check(key)))
6923 #endif
6924 if (unlikely(!PyUnicode_Check(key)))
6925 goto invalid_keyword_type;
6926 }
6927 if ((!kw_allowed) && unlikely(key))
6928 goto invalid_keyword;
6929 return 1;
6930 invalid_keyword_type:
6931 PyErr_Format(PyExc_TypeError,
6932 "%.200s() keywords must be strings", function_name);
6933 return 0;
6934 #endif
6935 invalid_keyword:
6936 PyErr_Format(PyExc_TypeError,
6937 #if PY_MAJOR_VERSION < 3
6938 "%.200s() got an unexpected keyword argument '%.200s'",
6939 function_name, PyString_AsString(key));
6940 #else
6941 "%s() got an unexpected keyword argument '%U'",
6942 function_name, key);
6943 #endif
6944 return 0;
6945 }
6946
6947 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)6948 static void __Pyx_RaiseDoubleKeywordsError(
6949 const char* func_name,
6950 PyObject* kw_name)
6951 {
6952 PyErr_Format(PyExc_TypeError,
6953 #if PY_MAJOR_VERSION >= 3
6954 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
6955 #else
6956 "%s() got multiple values for keyword argument '%s'", func_name,
6957 PyString_AsString(kw_name));
6958 #endif
6959 }
6960
6961 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)6962 static int __Pyx_ParseOptionalKeywords(
6963 PyObject *kwds,
6964 PyObject **argnames[],
6965 PyObject *kwds2,
6966 PyObject *values[],
6967 Py_ssize_t num_pos_args,
6968 const char* function_name)
6969 {
6970 PyObject *key = 0, *value = 0;
6971 Py_ssize_t pos = 0;
6972 PyObject*** name;
6973 PyObject*** first_kw_arg = argnames + num_pos_args;
6974 while (PyDict_Next(kwds, &pos, &key, &value)) {
6975 name = first_kw_arg;
6976 while (*name && (**name != key)) name++;
6977 if (*name) {
6978 values[name-argnames] = value;
6979 continue;
6980 }
6981 name = first_kw_arg;
6982 #if PY_MAJOR_VERSION < 3
6983 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
6984 while (*name) {
6985 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
6986 && _PyString_Eq(**name, key)) {
6987 values[name-argnames] = value;
6988 break;
6989 }
6990 name++;
6991 }
6992 if (*name) continue;
6993 else {
6994 PyObject*** argname = argnames;
6995 while (argname != first_kw_arg) {
6996 if ((**argname == key) || (
6997 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
6998 && _PyString_Eq(**argname, key))) {
6999 goto arg_passed_twice;
7000 }
7001 argname++;
7002 }
7003 }
7004 } else
7005 #endif
7006 if (likely(PyUnicode_Check(key))) {
7007 while (*name) {
7008 int cmp = (**name == key) ? 0 :
7009 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
7010 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
7011 #endif
7012 PyUnicode_Compare(**name, key);
7013 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
7014 if (cmp == 0) {
7015 values[name-argnames] = value;
7016 break;
7017 }
7018 name++;
7019 }
7020 if (*name) continue;
7021 else {
7022 PyObject*** argname = argnames;
7023 while (argname != first_kw_arg) {
7024 int cmp = (**argname == key) ? 0 :
7025 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
7026 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
7027 #endif
7028 PyUnicode_Compare(**argname, key);
7029 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
7030 if (cmp == 0) goto arg_passed_twice;
7031 argname++;
7032 }
7033 }
7034 } else
7035 goto invalid_keyword_type;
7036 if (kwds2) {
7037 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
7038 } else {
7039 goto invalid_keyword;
7040 }
7041 }
7042 return 0;
7043 arg_passed_twice:
7044 __Pyx_RaiseDoubleKeywordsError(function_name, key);
7045 goto bad;
7046 invalid_keyword_type:
7047 PyErr_Format(PyExc_TypeError,
7048 "%.200s() keywords must be strings", function_name);
7049 goto bad;
7050 invalid_keyword:
7051 PyErr_Format(PyExc_TypeError,
7052 #if PY_MAJOR_VERSION < 3
7053 "%.200s() got an unexpected keyword argument '%.200s'",
7054 function_name, PyString_AsString(key));
7055 #else
7056 "%s() got an unexpected keyword argument '%U'",
7057 function_name, key);
7058 #endif
7059 bad:
7060 return -1;
7061 }
7062
7063 /* PyDictVersioning */
7064 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)7065 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
7066 PyObject *dict = Py_TYPE(obj)->tp_dict;
7067 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
7068 }
__Pyx_get_object_dict_version(PyObject * obj)7069 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
7070 PyObject **dictptr = NULL;
7071 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
7072 if (offset) {
7073 #if CYTHON_COMPILING_IN_CPYTHON
7074 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
7075 #else
7076 dictptr = _PyObject_GetDictPtr(obj);
7077 #endif
7078 }
7079 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
7080 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)7081 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
7082 PyObject *dict = Py_TYPE(obj)->tp_dict;
7083 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
7084 return 0;
7085 return obj_dict_version == __Pyx_get_object_dict_version(obj);
7086 }
7087 #endif
7088
7089 /* GetModuleGlobalName */
7090 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)7091 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
7092 #else
7093 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
7094 #endif
7095 {
7096 PyObject *result;
7097 #if !CYTHON_AVOID_BORROWED_REFS
7098 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
7099 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
7100 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
7101 if (likely(result)) {
7102 return __Pyx_NewRef(result);
7103 } else if (unlikely(PyErr_Occurred())) {
7104 return NULL;
7105 }
7106 #else
7107 result = PyDict_GetItem(__pyx_d, name);
7108 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
7109 if (likely(result)) {
7110 return __Pyx_NewRef(result);
7111 }
7112 #endif
7113 #else
7114 result = PyObject_GetItem(__pyx_d, name);
7115 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
7116 if (likely(result)) {
7117 return __Pyx_NewRef(result);
7118 }
7119 PyErr_Clear();
7120 #endif
7121 return __Pyx_GetBuiltinName(name);
7122 }
7123
7124 /* PyFunctionFastCall */
7125 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)7126 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
7127 PyObject *globals) {
7128 PyFrameObject *f;
7129 PyThreadState *tstate = __Pyx_PyThreadState_Current;
7130 PyObject **fastlocals;
7131 Py_ssize_t i;
7132 PyObject *result;
7133 assert(globals != NULL);
7134 /* XXX Perhaps we should create a specialized
7135 PyFrame_New() that doesn't take locals, but does
7136 take builtins without sanity checking them.
7137 */
7138 assert(tstate != NULL);
7139 f = PyFrame_New(tstate, co, globals, NULL);
7140 if (f == NULL) {
7141 return NULL;
7142 }
7143 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
7144 for (i = 0; i < na; i++) {
7145 Py_INCREF(*args);
7146 fastlocals[i] = *args++;
7147 }
7148 result = PyEval_EvalFrameEx(f,0);
7149 ++tstate->recursion_depth;
7150 Py_DECREF(f);
7151 --tstate->recursion_depth;
7152 return result;
7153 }
7154 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)7155 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
7156 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
7157 PyObject *globals = PyFunction_GET_GLOBALS(func);
7158 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
7159 PyObject *closure;
7160 #if PY_MAJOR_VERSION >= 3
7161 PyObject *kwdefs;
7162 #endif
7163 PyObject *kwtuple, **k;
7164 PyObject **d;
7165 Py_ssize_t nd;
7166 Py_ssize_t nk;
7167 PyObject *result;
7168 assert(kwargs == NULL || PyDict_Check(kwargs));
7169 nk = kwargs ? PyDict_Size(kwargs) : 0;
7170 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
7171 return NULL;
7172 }
7173 if (
7174 #if PY_MAJOR_VERSION >= 3
7175 co->co_kwonlyargcount == 0 &&
7176 #endif
7177 likely(kwargs == NULL || nk == 0) &&
7178 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
7179 if (argdefs == NULL && co->co_argcount == nargs) {
7180 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
7181 goto done;
7182 }
7183 else if (nargs == 0 && argdefs != NULL
7184 && co->co_argcount == Py_SIZE(argdefs)) {
7185 /* function called with no arguments, but all parameters have
7186 a default value: use default values as arguments .*/
7187 args = &PyTuple_GET_ITEM(argdefs, 0);
7188 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
7189 goto done;
7190 }
7191 }
7192 if (kwargs != NULL) {
7193 Py_ssize_t pos, i;
7194 kwtuple = PyTuple_New(2 * nk);
7195 if (kwtuple == NULL) {
7196 result = NULL;
7197 goto done;
7198 }
7199 k = &PyTuple_GET_ITEM(kwtuple, 0);
7200 pos = i = 0;
7201 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
7202 Py_INCREF(k[i]);
7203 Py_INCREF(k[i+1]);
7204 i += 2;
7205 }
7206 nk = i / 2;
7207 }
7208 else {
7209 kwtuple = NULL;
7210 k = NULL;
7211 }
7212 closure = PyFunction_GET_CLOSURE(func);
7213 #if PY_MAJOR_VERSION >= 3
7214 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
7215 #endif
7216 if (argdefs != NULL) {
7217 d = &PyTuple_GET_ITEM(argdefs, 0);
7218 nd = Py_SIZE(argdefs);
7219 }
7220 else {
7221 d = NULL;
7222 nd = 0;
7223 }
7224 #if PY_MAJOR_VERSION >= 3
7225 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
7226 args, (int)nargs,
7227 k, (int)nk,
7228 d, (int)nd, kwdefs, closure);
7229 #else
7230 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
7231 args, (int)nargs,
7232 k, (int)nk,
7233 d, (int)nd, closure);
7234 #endif
7235 Py_XDECREF(kwtuple);
7236 done:
7237 Py_LeaveRecursiveCall();
7238 return result;
7239 }
7240 #endif
7241 #endif
7242
7243 /* PyObjectCall */
7244 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)7245 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
7246 PyObject *result;
7247 ternaryfunc call = func->ob_type->tp_call;
7248 if (unlikely(!call))
7249 return PyObject_Call(func, arg, kw);
7250 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
7251 return NULL;
7252 result = (*call)(func, arg, kw);
7253 Py_LeaveRecursiveCall();
7254 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
7255 PyErr_SetString(
7256 PyExc_SystemError,
7257 "NULL result without error in PyObject_Call");
7258 }
7259 return result;
7260 }
7261 #endif
7262
7263 /* PyObjectCallMethO */
7264 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)7265 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
7266 PyObject *self, *result;
7267 PyCFunction cfunc;
7268 cfunc = PyCFunction_GET_FUNCTION(func);
7269 self = PyCFunction_GET_SELF(func);
7270 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
7271 return NULL;
7272 result = cfunc(self, arg);
7273 Py_LeaveRecursiveCall();
7274 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
7275 PyErr_SetString(
7276 PyExc_SystemError,
7277 "NULL result without error in PyObject_Call");
7278 }
7279 return result;
7280 }
7281 #endif
7282
7283 /* PyObjectCallNoArg */
7284 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)7285 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
7286 #if CYTHON_FAST_PYCALL
7287 if (PyFunction_Check(func)) {
7288 return __Pyx_PyFunction_FastCall(func, NULL, 0);
7289 }
7290 #endif
7291 #ifdef __Pyx_CyFunction_USED
7292 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
7293 #else
7294 if (likely(PyCFunction_Check(func)))
7295 #endif
7296 {
7297 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
7298 return __Pyx_PyObject_CallMethO(func, NULL);
7299 }
7300 }
7301 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
7302 }
7303 #endif
7304
7305 /* PyCFunctionFastCall */
7306 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)7307 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
7308 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
7309 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
7310 PyObject *self = PyCFunction_GET_SELF(func);
7311 int flags = PyCFunction_GET_FLAGS(func);
7312 assert(PyCFunction_Check(func));
7313 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
7314 assert(nargs >= 0);
7315 assert(nargs == 0 || args != NULL);
7316 /* _PyCFunction_FastCallDict() must not be called with an exception set,
7317 because it may clear it (directly or indirectly) and so the
7318 caller loses its exception */
7319 assert(!PyErr_Occurred());
7320 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
7321 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
7322 } else {
7323 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
7324 }
7325 }
7326 #endif
7327
7328 /* PyObjectCallOneArg */
7329 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)7330 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
7331 PyObject *result;
7332 PyObject *args = PyTuple_New(1);
7333 if (unlikely(!args)) return NULL;
7334 Py_INCREF(arg);
7335 PyTuple_SET_ITEM(args, 0, arg);
7336 result = __Pyx_PyObject_Call(func, args, NULL);
7337 Py_DECREF(args);
7338 return result;
7339 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)7340 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
7341 #if CYTHON_FAST_PYCALL
7342 if (PyFunction_Check(func)) {
7343 return __Pyx_PyFunction_FastCall(func, &arg, 1);
7344 }
7345 #endif
7346 if (likely(PyCFunction_Check(func))) {
7347 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
7348 return __Pyx_PyObject_CallMethO(func, arg);
7349 #if CYTHON_FAST_PYCCALL
7350 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
7351 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
7352 #endif
7353 }
7354 }
7355 return __Pyx__PyObject_CallOneArg(func, arg);
7356 }
7357 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)7358 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
7359 PyObject *result;
7360 PyObject *args = PyTuple_Pack(1, arg);
7361 if (unlikely(!args)) return NULL;
7362 result = __Pyx_PyObject_Call(func, args, NULL);
7363 Py_DECREF(args);
7364 return result;
7365 }
7366 #endif
7367
7368 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)7369 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
7370 PyObject *args, *result = NULL;
7371 #if CYTHON_FAST_PYCALL
7372 if (PyFunction_Check(function)) {
7373 PyObject *args[2] = {arg1, arg2};
7374 return __Pyx_PyFunction_FastCall(function, args, 2);
7375 }
7376 #endif
7377 #if CYTHON_FAST_PYCCALL
7378 if (__Pyx_PyFastCFunction_Check(function)) {
7379 PyObject *args[2] = {arg1, arg2};
7380 return __Pyx_PyCFunction_FastCall(function, args, 2);
7381 }
7382 #endif
7383 args = PyTuple_New(2);
7384 if (unlikely(!args)) goto done;
7385 Py_INCREF(arg1);
7386 PyTuple_SET_ITEM(args, 0, arg1);
7387 Py_INCREF(arg2);
7388 PyTuple_SET_ITEM(args, 1, arg2);
7389 Py_INCREF(function);
7390 result = __Pyx_PyObject_Call(function, args, NULL);
7391 Py_DECREF(args);
7392 Py_DECREF(function);
7393 done:
7394 return result;
7395 }
7396
7397 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)7398 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
7399 PyErr_Format(PyExc_ValueError,
7400 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
7401 }
7402
7403 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)7404 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
7405 PyErr_Format(PyExc_ValueError,
7406 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
7407 index, (index == 1) ? "" : "s");
7408 }
7409
7410 /* IterFinish */
__Pyx_IterFinish(void)7411 static CYTHON_INLINE int __Pyx_IterFinish(void) {
7412 #if CYTHON_FAST_THREAD_STATE
7413 PyThreadState *tstate = __Pyx_PyThreadState_Current;
7414 PyObject* exc_type = tstate->curexc_type;
7415 if (unlikely(exc_type)) {
7416 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
7417 PyObject *exc_value, *exc_tb;
7418 exc_value = tstate->curexc_value;
7419 exc_tb = tstate->curexc_traceback;
7420 tstate->curexc_type = 0;
7421 tstate->curexc_value = 0;
7422 tstate->curexc_traceback = 0;
7423 Py_DECREF(exc_type);
7424 Py_XDECREF(exc_value);
7425 Py_XDECREF(exc_tb);
7426 return 0;
7427 } else {
7428 return -1;
7429 }
7430 }
7431 return 0;
7432 #else
7433 if (unlikely(PyErr_Occurred())) {
7434 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
7435 PyErr_Clear();
7436 return 0;
7437 } else {
7438 return -1;
7439 }
7440 }
7441 return 0;
7442 #endif
7443 }
7444
7445 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)7446 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
7447 if (unlikely(retval)) {
7448 Py_DECREF(retval);
7449 __Pyx_RaiseTooManyValuesError(expected);
7450 return -1;
7451 } else {
7452 return __Pyx_IterFinish();
7453 }
7454 return 0;
7455 }
7456
7457 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)7458 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
7459 if (unlikely(!type)) {
7460 PyErr_SetString(PyExc_SystemError, "Missing type object");
7461 return 0;
7462 }
7463 if (likely(__Pyx_TypeCheck(obj, type)))
7464 return 1;
7465 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
7466 Py_TYPE(obj)->tp_name, type->tp_name);
7467 return 0;
7468 }
7469
7470 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)7471 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
7472 {
7473 union {
7474 uint32_t u32;
7475 uint8_t u8[4];
7476 } S;
7477 S.u32 = 0x01020304;
7478 return S.u8[0] == 4;
7479 }
7480
7481 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)7482 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
7483 __Pyx_BufFmt_StackElem* stack,
7484 __Pyx_TypeInfo* type) {
7485 stack[0].field = &ctx->root;
7486 stack[0].parent_offset = 0;
7487 ctx->root.type = type;
7488 ctx->root.name = "buffer dtype";
7489 ctx->root.offset = 0;
7490 ctx->head = stack;
7491 ctx->head->field = &ctx->root;
7492 ctx->fmt_offset = 0;
7493 ctx->head->parent_offset = 0;
7494 ctx->new_packmode = '@';
7495 ctx->enc_packmode = '@';
7496 ctx->new_count = 1;
7497 ctx->enc_count = 0;
7498 ctx->enc_type = 0;
7499 ctx->is_complex = 0;
7500 ctx->is_valid_array = 0;
7501 ctx->struct_alignment = 0;
7502 while (type->typegroup == 'S') {
7503 ++ctx->head;
7504 ctx->head->field = type->fields;
7505 ctx->head->parent_offset = 0;
7506 type = type->fields->type;
7507 }
7508 }
__Pyx_BufFmt_ParseNumber(const char ** ts)7509 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
7510 int count;
7511 const char* t = *ts;
7512 if (*t < '0' || *t > '9') {
7513 return -1;
7514 } else {
7515 count = *t++ - '0';
7516 while (*t >= '0' && *t <= '9') {
7517 count *= 10;
7518 count += *t++ - '0';
7519 }
7520 }
7521 *ts = t;
7522 return count;
7523 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)7524 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
7525 int number = __Pyx_BufFmt_ParseNumber(ts);
7526 if (number == -1)
7527 PyErr_Format(PyExc_ValueError,\
7528 "Does not understand character buffer dtype format string ('%c')", **ts);
7529 return number;
7530 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)7531 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
7532 PyErr_Format(PyExc_ValueError,
7533 "Unexpected format string character: '%c'", ch);
7534 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)7535 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
7536 switch (ch) {
7537 case 'c': return "'char'";
7538 case 'b': return "'signed char'";
7539 case 'B': return "'unsigned char'";
7540 case 'h': return "'short'";
7541 case 'H': return "'unsigned short'";
7542 case 'i': return "'int'";
7543 case 'I': return "'unsigned int'";
7544 case 'l': return "'long'";
7545 case 'L': return "'unsigned long'";
7546 case 'q': return "'long long'";
7547 case 'Q': return "'unsigned long long'";
7548 case 'f': return (is_complex ? "'complex float'" : "'float'");
7549 case 'd': return (is_complex ? "'complex double'" : "'double'");
7550 case 'g': return (is_complex ? "'complex long double'" : "'long double'");
7551 case 'T': return "a struct";
7552 case 'O': return "Python object";
7553 case 'P': return "a pointer";
7554 case 's': case 'p': return "a string";
7555 case 0: return "end";
7556 default: return "unparseable format string";
7557 }
7558 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)7559 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
7560 switch (ch) {
7561 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
7562 case 'h': case 'H': return 2;
7563 case 'i': case 'I': case 'l': case 'L': return 4;
7564 case 'q': case 'Q': return 8;
7565 case 'f': return (is_complex ? 8 : 4);
7566 case 'd': return (is_complex ? 16 : 8);
7567 case 'g': {
7568 PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
7569 return 0;
7570 }
7571 case 'O': case 'P': return sizeof(void*);
7572 default:
7573 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
7574 return 0;
7575 }
7576 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)7577 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
7578 switch (ch) {
7579 case 'c': case 'b': case 'B': case 's': case 'p': return 1;
7580 case 'h': case 'H': return sizeof(short);
7581 case 'i': case 'I': return sizeof(int);
7582 case 'l': case 'L': return sizeof(long);
7583 #ifdef HAVE_LONG_LONG
7584 case 'q': case 'Q': return sizeof(PY_LONG_LONG);
7585 #endif
7586 case 'f': return sizeof(float) * (is_complex ? 2 : 1);
7587 case 'd': return sizeof(double) * (is_complex ? 2 : 1);
7588 case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
7589 case 'O': case 'P': return sizeof(void*);
7590 default: {
7591 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
7592 return 0;
7593 }
7594 }
7595 }
7596 typedef struct { char c; short x; } __Pyx_st_short;
7597 typedef struct { char c; int x; } __Pyx_st_int;
7598 typedef struct { char c; long x; } __Pyx_st_long;
7599 typedef struct { char c; float x; } __Pyx_st_float;
7600 typedef struct { char c; double x; } __Pyx_st_double;
7601 typedef struct { char c; long double x; } __Pyx_st_longdouble;
7602 typedef struct { char c; void *x; } __Pyx_st_void_p;
7603 #ifdef HAVE_LONG_LONG
7604 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
7605 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)7606 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
7607 switch (ch) {
7608 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
7609 case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
7610 case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
7611 case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
7612 #ifdef HAVE_LONG_LONG
7613 case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
7614 #endif
7615 case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
7616 case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
7617 case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
7618 case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
7619 default:
7620 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
7621 return 0;
7622 }
7623 }
7624 /* These are for computing the padding at the end of the struct to align
7625 on the first member of the struct. This will probably the same as above,
7626 but we don't have any guarantees.
7627 */
7628 typedef struct { short x; char c; } __Pyx_pad_short;
7629 typedef struct { int x; char c; } __Pyx_pad_int;
7630 typedef struct { long x; char c; } __Pyx_pad_long;
7631 typedef struct { float x; char c; } __Pyx_pad_float;
7632 typedef struct { double x; char c; } __Pyx_pad_double;
7633 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
7634 typedef struct { void *x; char c; } __Pyx_pad_void_p;
7635 #ifdef HAVE_LONG_LONG
7636 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
7637 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)7638 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
7639 switch (ch) {
7640 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
7641 case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
7642 case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
7643 case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
7644 #ifdef HAVE_LONG_LONG
7645 case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
7646 #endif
7647 case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
7648 case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
7649 case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
7650 case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
7651 default:
7652 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
7653 return 0;
7654 }
7655 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)7656 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
7657 switch (ch) {
7658 case 'c':
7659 return 'H';
7660 case 'b': case 'h': case 'i':
7661 case 'l': case 'q': case 's': case 'p':
7662 return 'I';
7663 case 'B': case 'H': case 'I': case 'L': case 'Q':
7664 return 'U';
7665 case 'f': case 'd': case 'g':
7666 return (is_complex ? 'C' : 'R');
7667 case 'O':
7668 return 'O';
7669 case 'P':
7670 return 'P';
7671 default: {
7672 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
7673 return 0;
7674 }
7675 }
7676 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)7677 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
7678 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
7679 const char* expected;
7680 const char* quote;
7681 if (ctx->head == NULL) {
7682 expected = "end";
7683 quote = "";
7684 } else {
7685 expected = ctx->head->field->type->name;
7686 quote = "'";
7687 }
7688 PyErr_Format(PyExc_ValueError,
7689 "Buffer dtype mismatch, expected %s%s%s but got %s",
7690 quote, expected, quote,
7691 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
7692 } else {
7693 __Pyx_StructField* field = ctx->head->field;
7694 __Pyx_StructField* parent = (ctx->head - 1)->field;
7695 PyErr_Format(PyExc_ValueError,
7696 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
7697 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
7698 parent->type->name, field->name);
7699 }
7700 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)7701 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
7702 char group;
7703 size_t size, offset, arraysize = 1;
7704 if (ctx->enc_type == 0) return 0;
7705 if (ctx->head->field->type->arraysize[0]) {
7706 int i, ndim = 0;
7707 if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
7708 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
7709 ndim = 1;
7710 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
7711 PyErr_Format(PyExc_ValueError,
7712 "Expected a dimension of size %zu, got %zu",
7713 ctx->head->field->type->arraysize[0], ctx->enc_count);
7714 return -1;
7715 }
7716 }
7717 if (!ctx->is_valid_array) {
7718 PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
7719 ctx->head->field->type->ndim, ndim);
7720 return -1;
7721 }
7722 for (i = 0; i < ctx->head->field->type->ndim; i++) {
7723 arraysize *= ctx->head->field->type->arraysize[i];
7724 }
7725 ctx->is_valid_array = 0;
7726 ctx->enc_count = 1;
7727 }
7728 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
7729 do {
7730 __Pyx_StructField* field = ctx->head->field;
7731 __Pyx_TypeInfo* type = field->type;
7732 if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
7733 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
7734 } else {
7735 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
7736 }
7737 if (ctx->enc_packmode == '@') {
7738 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
7739 size_t align_mod_offset;
7740 if (align_at == 0) return -1;
7741 align_mod_offset = ctx->fmt_offset % align_at;
7742 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
7743 if (ctx->struct_alignment == 0)
7744 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
7745 ctx->is_complex);
7746 }
7747 if (type->size != size || type->typegroup != group) {
7748 if (type->typegroup == 'C' && type->fields != NULL) {
7749 size_t parent_offset = ctx->head->parent_offset + field->offset;
7750 ++ctx->head;
7751 ctx->head->field = type->fields;
7752 ctx->head->parent_offset = parent_offset;
7753 continue;
7754 }
7755 if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
7756 } else {
7757 __Pyx_BufFmt_RaiseExpected(ctx);
7758 return -1;
7759 }
7760 }
7761 offset = ctx->head->parent_offset + field->offset;
7762 if (ctx->fmt_offset != offset) {
7763 PyErr_Format(PyExc_ValueError,
7764 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
7765 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
7766 return -1;
7767 }
7768 ctx->fmt_offset += size;
7769 if (arraysize)
7770 ctx->fmt_offset += (arraysize - 1) * size;
7771 --ctx->enc_count;
7772 while (1) {
7773 if (field == &ctx->root) {
7774 ctx->head = NULL;
7775 if (ctx->enc_count != 0) {
7776 __Pyx_BufFmt_RaiseExpected(ctx);
7777 return -1;
7778 }
7779 break;
7780 }
7781 ctx->head->field = ++field;
7782 if (field->type == NULL) {
7783 --ctx->head;
7784 field = ctx->head->field;
7785 continue;
7786 } else if (field->type->typegroup == 'S') {
7787 size_t parent_offset = ctx->head->parent_offset + field->offset;
7788 if (field->type->fields->type == NULL) continue;
7789 field = field->type->fields;
7790 ++ctx->head;
7791 ctx->head->field = field;
7792 ctx->head->parent_offset = parent_offset;
7793 break;
7794 } else {
7795 break;
7796 }
7797 }
7798 } while (ctx->enc_count);
7799 ctx->enc_type = 0;
7800 ctx->is_complex = 0;
7801 return 0;
7802 }
7803 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)7804 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
7805 {
7806 const char *ts = *tsp;
7807 int i = 0, number;
7808 int ndim = ctx->head->field->type->ndim;
7809 ;
7810 ++ts;
7811 if (ctx->new_count != 1) {
7812 PyErr_SetString(PyExc_ValueError,
7813 "Cannot handle repeated arrays in format string");
7814 return NULL;
7815 }
7816 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
7817 while (*ts && *ts != ')') {
7818 switch (*ts) {
7819 case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
7820 default: break;
7821 }
7822 number = __Pyx_BufFmt_ExpectNumber(&ts);
7823 if (number == -1) return NULL;
7824 if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
7825 return PyErr_Format(PyExc_ValueError,
7826 "Expected a dimension of size %zu, got %d",
7827 ctx->head->field->type->arraysize[i], number);
7828 if (*ts != ',' && *ts != ')')
7829 return PyErr_Format(PyExc_ValueError,
7830 "Expected a comma in format string, got '%c'", *ts);
7831 if (*ts == ',') ts++;
7832 i++;
7833 }
7834 if (i != ndim)
7835 return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
7836 ctx->head->field->type->ndim, i);
7837 if (!*ts) {
7838 PyErr_SetString(PyExc_ValueError,
7839 "Unexpected end of format string, expected ')'");
7840 return NULL;
7841 }
7842 ctx->is_valid_array = 1;
7843 ctx->new_count = 1;
7844 *tsp = ++ts;
7845 return Py_None;
7846 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)7847 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
7848 int got_Z = 0;
7849 while (1) {
7850 switch(*ts) {
7851 case 0:
7852 if (ctx->enc_type != 0 && ctx->head == NULL) {
7853 __Pyx_BufFmt_RaiseExpected(ctx);
7854 return NULL;
7855 }
7856 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
7857 if (ctx->head != NULL) {
7858 __Pyx_BufFmt_RaiseExpected(ctx);
7859 return NULL;
7860 }
7861 return ts;
7862 case ' ':
7863 case '\r':
7864 case '\n':
7865 ++ts;
7866 break;
7867 case '<':
7868 if (!__Pyx_Is_Little_Endian()) {
7869 PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
7870 return NULL;
7871 }
7872 ctx->new_packmode = '=';
7873 ++ts;
7874 break;
7875 case '>':
7876 case '!':
7877 if (__Pyx_Is_Little_Endian()) {
7878 PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
7879 return NULL;
7880 }
7881 ctx->new_packmode = '=';
7882 ++ts;
7883 break;
7884 case '=':
7885 case '@':
7886 case '^':
7887 ctx->new_packmode = *ts++;
7888 break;
7889 case 'T':
7890 {
7891 const char* ts_after_sub;
7892 size_t i, struct_count = ctx->new_count;
7893 size_t struct_alignment = ctx->struct_alignment;
7894 ctx->new_count = 1;
7895 ++ts;
7896 if (*ts != '{') {
7897 PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
7898 return NULL;
7899 }
7900 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
7901 ctx->enc_type = 0;
7902 ctx->enc_count = 0;
7903 ctx->struct_alignment = 0;
7904 ++ts;
7905 ts_after_sub = ts;
7906 for (i = 0; i != struct_count; ++i) {
7907 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
7908 if (!ts_after_sub) return NULL;
7909 }
7910 ts = ts_after_sub;
7911 if (struct_alignment) ctx->struct_alignment = struct_alignment;
7912 }
7913 break;
7914 case '}':
7915 {
7916 size_t alignment = ctx->struct_alignment;
7917 ++ts;
7918 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
7919 ctx->enc_type = 0;
7920 if (alignment && ctx->fmt_offset % alignment) {
7921 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
7922 }
7923 }
7924 return ts;
7925 case 'x':
7926 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
7927 ctx->fmt_offset += ctx->new_count;
7928 ctx->new_count = 1;
7929 ctx->enc_count = 0;
7930 ctx->enc_type = 0;
7931 ctx->enc_packmode = ctx->new_packmode;
7932 ++ts;
7933 break;
7934 case 'Z':
7935 got_Z = 1;
7936 ++ts;
7937 if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
7938 __Pyx_BufFmt_RaiseUnexpectedChar('Z');
7939 return NULL;
7940 }
7941 CYTHON_FALLTHROUGH;
7942 case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
7943 case 'l': case 'L': case 'q': case 'Q':
7944 case 'f': case 'd': case 'g':
7945 case 'O': case 'p':
7946 if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
7947 ctx->enc_packmode == ctx->new_packmode) {
7948 ctx->enc_count += ctx->new_count;
7949 ctx->new_count = 1;
7950 got_Z = 0;
7951 ++ts;
7952 break;
7953 }
7954 CYTHON_FALLTHROUGH;
7955 case 's':
7956 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
7957 ctx->enc_count = ctx->new_count;
7958 ctx->enc_packmode = ctx->new_packmode;
7959 ctx->enc_type = *ts;
7960 ctx->is_complex = got_Z;
7961 ++ts;
7962 ctx->new_count = 1;
7963 got_Z = 0;
7964 break;
7965 case ':':
7966 ++ts;
7967 while(*ts != ':') ++ts;
7968 ++ts;
7969 break;
7970 case '(':
7971 if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
7972 break;
7973 default:
7974 {
7975 int number = __Pyx_BufFmt_ExpectNumber(&ts);
7976 if (number == -1) return NULL;
7977 ctx->new_count = (size_t)number;
7978 }
7979 }
7980 }
7981 }
7982
7983 /* BufferGetAndValidate */
__Pyx_SafeReleaseBuffer(Py_buffer * info)7984 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
7985 if (unlikely(info->buf == NULL)) return;
7986 if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
7987 __Pyx_ReleaseBuffer(info);
7988 }
__Pyx_ZeroBuffer(Py_buffer * buf)7989 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
7990 buf->buf = NULL;
7991 buf->obj = NULL;
7992 buf->strides = __Pyx_zeros;
7993 buf->shape = __Pyx_zeros;
7994 buf->suboffsets = __Pyx_minusones;
7995 }
__Pyx__GetBufferAndValidate(Py_buffer * buf,PyObject * obj,__Pyx_TypeInfo * dtype,int flags,int nd,int cast,__Pyx_BufFmt_StackElem * stack)7996 static int __Pyx__GetBufferAndValidate(
7997 Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
7998 int nd, int cast, __Pyx_BufFmt_StackElem* stack)
7999 {
8000 buf->buf = NULL;
8001 if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
8002 __Pyx_ZeroBuffer(buf);
8003 return -1;
8004 }
8005 if (unlikely(buf->ndim != nd)) {
8006 PyErr_Format(PyExc_ValueError,
8007 "Buffer has wrong number of dimensions (expected %d, got %d)",
8008 nd, buf->ndim);
8009 goto fail;
8010 }
8011 if (!cast) {
8012 __Pyx_BufFmt_Context ctx;
8013 __Pyx_BufFmt_Init(&ctx, stack, dtype);
8014 if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
8015 }
8016 if (unlikely((size_t)buf->itemsize != dtype->size)) {
8017 PyErr_Format(PyExc_ValueError,
8018 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
8019 buf->itemsize, (buf->itemsize > 1) ? "s" : "",
8020 dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
8021 goto fail;
8022 }
8023 if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
8024 return 0;
8025 fail:;
8026 __Pyx_SafeReleaseBuffer(buf);
8027 return -1;
8028 }
8029
8030 /* PyErrFetchRestore */
8031 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)8032 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
8033 PyObject *tmp_type, *tmp_value, *tmp_tb;
8034 tmp_type = tstate->curexc_type;
8035 tmp_value = tstate->curexc_value;
8036 tmp_tb = tstate->curexc_traceback;
8037 tstate->curexc_type = type;
8038 tstate->curexc_value = value;
8039 tstate->curexc_traceback = tb;
8040 Py_XDECREF(tmp_type);
8041 Py_XDECREF(tmp_value);
8042 Py_XDECREF(tmp_tb);
8043 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)8044 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
8045 *type = tstate->curexc_type;
8046 *value = tstate->curexc_value;
8047 *tb = tstate->curexc_traceback;
8048 tstate->curexc_type = 0;
8049 tstate->curexc_value = 0;
8050 tstate->curexc_traceback = 0;
8051 }
8052 #endif
8053
8054 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)8055 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
8056 PyObject *r;
8057 if (!j) return NULL;
8058 r = PyObject_GetItem(o, j);
8059 Py_DECREF(j);
8060 return r;
8061 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)8062 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
8063 CYTHON_NCP_UNUSED int wraparound,
8064 CYTHON_NCP_UNUSED int boundscheck) {
8065 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8066 Py_ssize_t wrapped_i = i;
8067 if (wraparound & unlikely(i < 0)) {
8068 wrapped_i += PyList_GET_SIZE(o);
8069 }
8070 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
8071 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
8072 Py_INCREF(r);
8073 return r;
8074 }
8075 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
8076 #else
8077 return PySequence_GetItem(o, i);
8078 #endif
8079 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)8080 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
8081 CYTHON_NCP_UNUSED int wraparound,
8082 CYTHON_NCP_UNUSED int boundscheck) {
8083 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8084 Py_ssize_t wrapped_i = i;
8085 if (wraparound & unlikely(i < 0)) {
8086 wrapped_i += PyTuple_GET_SIZE(o);
8087 }
8088 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
8089 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
8090 Py_INCREF(r);
8091 return r;
8092 }
8093 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
8094 #else
8095 return PySequence_GetItem(o, i);
8096 #endif
8097 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)8098 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
8099 CYTHON_NCP_UNUSED int wraparound,
8100 CYTHON_NCP_UNUSED int boundscheck) {
8101 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
8102 if (is_list || PyList_CheckExact(o)) {
8103 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
8104 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
8105 PyObject *r = PyList_GET_ITEM(o, n);
8106 Py_INCREF(r);
8107 return r;
8108 }
8109 }
8110 else if (PyTuple_CheckExact(o)) {
8111 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
8112 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
8113 PyObject *r = PyTuple_GET_ITEM(o, n);
8114 Py_INCREF(r);
8115 return r;
8116 }
8117 } else {
8118 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
8119 if (likely(m && m->sq_item)) {
8120 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
8121 Py_ssize_t l = m->sq_length(o);
8122 if (likely(l >= 0)) {
8123 i += l;
8124 } else {
8125 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
8126 return NULL;
8127 PyErr_Clear();
8128 }
8129 }
8130 return m->sq_item(o, i);
8131 }
8132 }
8133 #else
8134 if (is_list || PySequence_Check(o)) {
8135 return PySequence_GetItem(o, i);
8136 }
8137 #endif
8138 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
8139 }
8140
8141 /* ObjectGetItem */
8142 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)8143 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
8144 PyObject *runerr;
8145 Py_ssize_t key_value;
8146 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
8147 if (unlikely(!(m && m->sq_item))) {
8148 PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
8149 return NULL;
8150 }
8151 key_value = __Pyx_PyIndex_AsSsize_t(index);
8152 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
8153 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
8154 }
8155 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
8156 PyErr_Clear();
8157 PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
8158 }
8159 return NULL;
8160 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)8161 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
8162 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
8163 if (likely(m && m->mp_subscript)) {
8164 return m->mp_subscript(obj, key);
8165 }
8166 return __Pyx_PyObject_GetIndex(obj, key);
8167 }
8168 #endif
8169
8170 /* BufferFallbackError */
__Pyx_RaiseBufferFallbackError(void)8171 static void __Pyx_RaiseBufferFallbackError(void) {
8172 PyErr_SetString(PyExc_ValueError,
8173 "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
8174 }
8175
8176 /* RaiseException */
8177 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)8178 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
8179 CYTHON_UNUSED PyObject *cause) {
8180 __Pyx_PyThreadState_declare
8181 Py_XINCREF(type);
8182 if (!value || value == Py_None)
8183 value = NULL;
8184 else
8185 Py_INCREF(value);
8186 if (!tb || tb == Py_None)
8187 tb = NULL;
8188 else {
8189 Py_INCREF(tb);
8190 if (!PyTraceBack_Check(tb)) {
8191 PyErr_SetString(PyExc_TypeError,
8192 "raise: arg 3 must be a traceback or None");
8193 goto raise_error;
8194 }
8195 }
8196 if (PyType_Check(type)) {
8197 #if CYTHON_COMPILING_IN_PYPY
8198 if (!value) {
8199 Py_INCREF(Py_None);
8200 value = Py_None;
8201 }
8202 #endif
8203 PyErr_NormalizeException(&type, &value, &tb);
8204 } else {
8205 if (value) {
8206 PyErr_SetString(PyExc_TypeError,
8207 "instance exception may not have a separate value");
8208 goto raise_error;
8209 }
8210 value = type;
8211 type = (PyObject*) Py_TYPE(type);
8212 Py_INCREF(type);
8213 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
8214 PyErr_SetString(PyExc_TypeError,
8215 "raise: exception class must be a subclass of BaseException");
8216 goto raise_error;
8217 }
8218 }
8219 __Pyx_PyThreadState_assign
8220 __Pyx_ErrRestore(type, value, tb);
8221 return;
8222 raise_error:
8223 Py_XDECREF(value);
8224 Py_XDECREF(type);
8225 Py_XDECREF(tb);
8226 return;
8227 }
8228 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)8229 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
8230 PyObject* owned_instance = NULL;
8231 if (tb == Py_None) {
8232 tb = 0;
8233 } else if (tb && !PyTraceBack_Check(tb)) {
8234 PyErr_SetString(PyExc_TypeError,
8235 "raise: arg 3 must be a traceback or None");
8236 goto bad;
8237 }
8238 if (value == Py_None)
8239 value = 0;
8240 if (PyExceptionInstance_Check(type)) {
8241 if (value) {
8242 PyErr_SetString(PyExc_TypeError,
8243 "instance exception may not have a separate value");
8244 goto bad;
8245 }
8246 value = type;
8247 type = (PyObject*) Py_TYPE(value);
8248 } else if (PyExceptionClass_Check(type)) {
8249 PyObject *instance_class = NULL;
8250 if (value && PyExceptionInstance_Check(value)) {
8251 instance_class = (PyObject*) Py_TYPE(value);
8252 if (instance_class != type) {
8253 int is_subclass = PyObject_IsSubclass(instance_class, type);
8254 if (!is_subclass) {
8255 instance_class = NULL;
8256 } else if (unlikely(is_subclass == -1)) {
8257 goto bad;
8258 } else {
8259 type = instance_class;
8260 }
8261 }
8262 }
8263 if (!instance_class) {
8264 PyObject *args;
8265 if (!value)
8266 args = PyTuple_New(0);
8267 else if (PyTuple_Check(value)) {
8268 Py_INCREF(value);
8269 args = value;
8270 } else
8271 args = PyTuple_Pack(1, value);
8272 if (!args)
8273 goto bad;
8274 owned_instance = PyObject_Call(type, args, NULL);
8275 Py_DECREF(args);
8276 if (!owned_instance)
8277 goto bad;
8278 value = owned_instance;
8279 if (!PyExceptionInstance_Check(value)) {
8280 PyErr_Format(PyExc_TypeError,
8281 "calling %R should have returned an instance of "
8282 "BaseException, not %R",
8283 type, Py_TYPE(value));
8284 goto bad;
8285 }
8286 }
8287 } else {
8288 PyErr_SetString(PyExc_TypeError,
8289 "raise: exception class must be a subclass of BaseException");
8290 goto bad;
8291 }
8292 if (cause) {
8293 PyObject *fixed_cause;
8294 if (cause == Py_None) {
8295 fixed_cause = NULL;
8296 } else if (PyExceptionClass_Check(cause)) {
8297 fixed_cause = PyObject_CallObject(cause, NULL);
8298 if (fixed_cause == NULL)
8299 goto bad;
8300 } else if (PyExceptionInstance_Check(cause)) {
8301 fixed_cause = cause;
8302 Py_INCREF(fixed_cause);
8303 } else {
8304 PyErr_SetString(PyExc_TypeError,
8305 "exception causes must derive from "
8306 "BaseException");
8307 goto bad;
8308 }
8309 PyException_SetCause(value, fixed_cause);
8310 }
8311 PyErr_SetObject(type, value);
8312 if (tb) {
8313 #if CYTHON_COMPILING_IN_PYPY
8314 PyObject *tmp_type, *tmp_value, *tmp_tb;
8315 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
8316 Py_INCREF(tb);
8317 PyErr_Restore(tmp_type, tmp_value, tb);
8318 Py_XDECREF(tmp_tb);
8319 #else
8320 PyThreadState *tstate = __Pyx_PyThreadState_Current;
8321 PyObject* tmp_tb = tstate->curexc_traceback;
8322 if (tb != tmp_tb) {
8323 Py_INCREF(tb);
8324 tstate->curexc_traceback = tb;
8325 Py_XDECREF(tmp_tb);
8326 }
8327 #endif
8328 }
8329 bad:
8330 Py_XDECREF(owned_instance);
8331 return;
8332 }
8333 #endif
8334
8335 /* DictGetItem */
8336 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)8337 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
8338 PyObject *value;
8339 value = PyDict_GetItemWithError(d, key);
8340 if (unlikely(!value)) {
8341 if (!PyErr_Occurred()) {
8342 if (unlikely(PyTuple_Check(key))) {
8343 PyObject* args = PyTuple_Pack(1, key);
8344 if (likely(args)) {
8345 PyErr_SetObject(PyExc_KeyError, args);
8346 Py_DECREF(args);
8347 }
8348 } else {
8349 PyErr_SetObject(PyExc_KeyError, key);
8350 }
8351 }
8352 return NULL;
8353 }
8354 Py_INCREF(value);
8355 return value;
8356 }
8357 #endif
8358
8359 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)8360 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
8361 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
8362 }
8363
8364 /* GetTopmostException */
8365 #if CYTHON_USE_EXC_INFO_STACK
8366 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)8367 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
8368 {
8369 _PyErr_StackItem *exc_info = tstate->exc_info;
8370 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
8371 exc_info->previous_item != NULL)
8372 {
8373 exc_info = exc_info->previous_item;
8374 }
8375 return exc_info;
8376 }
8377 #endif
8378
8379 /* SaveResetException */
8380 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)8381 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
8382 #if CYTHON_USE_EXC_INFO_STACK
8383 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
8384 *type = exc_info->exc_type;
8385 *value = exc_info->exc_value;
8386 *tb = exc_info->exc_traceback;
8387 #else
8388 *type = tstate->exc_type;
8389 *value = tstate->exc_value;
8390 *tb = tstate->exc_traceback;
8391 #endif
8392 Py_XINCREF(*type);
8393 Py_XINCREF(*value);
8394 Py_XINCREF(*tb);
8395 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)8396 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
8397 PyObject *tmp_type, *tmp_value, *tmp_tb;
8398 #if CYTHON_USE_EXC_INFO_STACK
8399 _PyErr_StackItem *exc_info = tstate->exc_info;
8400 tmp_type = exc_info->exc_type;
8401 tmp_value = exc_info->exc_value;
8402 tmp_tb = exc_info->exc_traceback;
8403 exc_info->exc_type = type;
8404 exc_info->exc_value = value;
8405 exc_info->exc_traceback = tb;
8406 #else
8407 tmp_type = tstate->exc_type;
8408 tmp_value = tstate->exc_value;
8409 tmp_tb = tstate->exc_traceback;
8410 tstate->exc_type = type;
8411 tstate->exc_value = value;
8412 tstate->exc_traceback = tb;
8413 #endif
8414 Py_XDECREF(tmp_type);
8415 Py_XDECREF(tmp_value);
8416 Py_XDECREF(tmp_tb);
8417 }
8418 #endif
8419
8420 /* PyErrExceptionMatches */
8421 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)8422 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
8423 Py_ssize_t i, n;
8424 n = PyTuple_GET_SIZE(tuple);
8425 #if PY_MAJOR_VERSION >= 3
8426 for (i=0; i<n; i++) {
8427 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
8428 }
8429 #endif
8430 for (i=0; i<n; i++) {
8431 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
8432 }
8433 return 0;
8434 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)8435 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
8436 PyObject *exc_type = tstate->curexc_type;
8437 if (exc_type == err) return 1;
8438 if (unlikely(!exc_type)) return 0;
8439 if (unlikely(PyTuple_Check(err)))
8440 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
8441 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
8442 }
8443 #endif
8444
8445 /* GetException */
8446 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)8447 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
8448 #else
8449 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
8450 #endif
8451 {
8452 PyObject *local_type, *local_value, *local_tb;
8453 #if CYTHON_FAST_THREAD_STATE
8454 PyObject *tmp_type, *tmp_value, *tmp_tb;
8455 local_type = tstate->curexc_type;
8456 local_value = tstate->curexc_value;
8457 local_tb = tstate->curexc_traceback;
8458 tstate->curexc_type = 0;
8459 tstate->curexc_value = 0;
8460 tstate->curexc_traceback = 0;
8461 #else
8462 PyErr_Fetch(&local_type, &local_value, &local_tb);
8463 #endif
8464 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
8465 #if CYTHON_FAST_THREAD_STATE
8466 if (unlikely(tstate->curexc_type))
8467 #else
8468 if (unlikely(PyErr_Occurred()))
8469 #endif
8470 goto bad;
8471 #if PY_MAJOR_VERSION >= 3
8472 if (local_tb) {
8473 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
8474 goto bad;
8475 }
8476 #endif
8477 Py_XINCREF(local_tb);
8478 Py_XINCREF(local_type);
8479 Py_XINCREF(local_value);
8480 *type = local_type;
8481 *value = local_value;
8482 *tb = local_tb;
8483 #if CYTHON_FAST_THREAD_STATE
8484 #if CYTHON_USE_EXC_INFO_STACK
8485 {
8486 _PyErr_StackItem *exc_info = tstate->exc_info;
8487 tmp_type = exc_info->exc_type;
8488 tmp_value = exc_info->exc_value;
8489 tmp_tb = exc_info->exc_traceback;
8490 exc_info->exc_type = local_type;
8491 exc_info->exc_value = local_value;
8492 exc_info->exc_traceback = local_tb;
8493 }
8494 #else
8495 tmp_type = tstate->exc_type;
8496 tmp_value = tstate->exc_value;
8497 tmp_tb = tstate->exc_traceback;
8498 tstate->exc_type = local_type;
8499 tstate->exc_value = local_value;
8500 tstate->exc_traceback = local_tb;
8501 #endif
8502 Py_XDECREF(tmp_type);
8503 Py_XDECREF(tmp_value);
8504 Py_XDECREF(tmp_tb);
8505 #else
8506 PyErr_SetExcInfo(local_type, local_value, local_tb);
8507 #endif
8508 return 0;
8509 bad:
8510 *type = 0;
8511 *value = 0;
8512 *tb = 0;
8513 Py_XDECREF(local_type);
8514 Py_XDECREF(local_value);
8515 Py_XDECREF(local_tb);
8516 return -1;
8517 }
8518
8519 /* PyObject_GenericGetAttrNoDict */
8520 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)8521 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
8522 PyErr_Format(PyExc_AttributeError,
8523 #if PY_MAJOR_VERSION >= 3
8524 "'%.50s' object has no attribute '%U'",
8525 tp->tp_name, attr_name);
8526 #else
8527 "'%.50s' object has no attribute '%.400s'",
8528 tp->tp_name, PyString_AS_STRING(attr_name));
8529 #endif
8530 return NULL;
8531 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)8532 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
8533 PyObject *descr;
8534 PyTypeObject *tp = Py_TYPE(obj);
8535 if (unlikely(!PyString_Check(attr_name))) {
8536 return PyObject_GenericGetAttr(obj, attr_name);
8537 }
8538 assert(!tp->tp_dictoffset);
8539 descr = _PyType_Lookup(tp, attr_name);
8540 if (unlikely(!descr)) {
8541 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
8542 }
8543 Py_INCREF(descr);
8544 #if PY_MAJOR_VERSION < 3
8545 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
8546 #endif
8547 {
8548 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
8549 if (unlikely(f)) {
8550 PyObject *res = f(descr, obj, (PyObject *)tp);
8551 Py_DECREF(descr);
8552 return res;
8553 }
8554 }
8555 return descr;
8556 }
8557 #endif
8558
8559 /* PyObject_GenericGetAttr */
8560 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)8561 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
8562 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
8563 return PyObject_GenericGetAttr(obj, attr_name);
8564 }
8565 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
8566 }
8567 #endif
8568
8569 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)8570 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
8571 #if PY_VERSION_HEX >= 0x02070000
8572 PyObject *ob = PyCapsule_New(vtable, 0, 0);
8573 #else
8574 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
8575 #endif
8576 if (!ob)
8577 goto bad;
8578 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
8579 goto bad;
8580 Py_DECREF(ob);
8581 return 0;
8582 bad:
8583 Py_XDECREF(ob);
8584 return -1;
8585 }
8586
8587 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)8588 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
8589 int ret;
8590 PyObject *name_attr;
8591 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
8592 if (likely(name_attr)) {
8593 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
8594 } else {
8595 ret = -1;
8596 }
8597 if (unlikely(ret < 0)) {
8598 PyErr_Clear();
8599 ret = 0;
8600 }
8601 Py_XDECREF(name_attr);
8602 return ret;
8603 }
__Pyx_setup_reduce(PyObject * type_obj)8604 static int __Pyx_setup_reduce(PyObject* type_obj) {
8605 int ret = 0;
8606 PyObject *object_reduce = NULL;
8607 PyObject *object_reduce_ex = NULL;
8608 PyObject *reduce = NULL;
8609 PyObject *reduce_ex = NULL;
8610 PyObject *reduce_cython = NULL;
8611 PyObject *setstate = NULL;
8612 PyObject *setstate_cython = NULL;
8613 #if CYTHON_USE_PYTYPE_LOOKUP
8614 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
8615 #else
8616 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
8617 #endif
8618 #if CYTHON_USE_PYTYPE_LOOKUP
8619 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
8620 #else
8621 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
8622 #endif
8623 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
8624 if (reduce_ex == object_reduce_ex) {
8625 #if CYTHON_USE_PYTYPE_LOOKUP
8626 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
8627 #else
8628 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
8629 #endif
8630 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
8631 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
8632 reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
8633 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
8634 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
8635 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
8636 if (!setstate) PyErr_Clear();
8637 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
8638 setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
8639 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
8640 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
8641 }
8642 PyType_Modified((PyTypeObject*)type_obj);
8643 }
8644 }
8645 goto GOOD;
8646 BAD:
8647 if (!PyErr_Occurred())
8648 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
8649 ret = -1;
8650 GOOD:
8651 #if !CYTHON_USE_PYTYPE_LOOKUP
8652 Py_XDECREF(object_reduce);
8653 Py_XDECREF(object_reduce_ex);
8654 #endif
8655 Py_XDECREF(reduce);
8656 Py_XDECREF(reduce_ex);
8657 Py_XDECREF(reduce_cython);
8658 Py_XDECREF(setstate);
8659 Py_XDECREF(setstate_cython);
8660 return ret;
8661 }
8662
8663 /* TypeImport */
8664 #ifndef __PYX_HAVE_RT_ImportType
8665 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)8666 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
8667 size_t size, enum __Pyx_ImportType_CheckSize check_size)
8668 {
8669 PyObject *result = 0;
8670 char warning[200];
8671 Py_ssize_t basicsize;
8672 #ifdef Py_LIMITED_API
8673 PyObject *py_basicsize;
8674 #endif
8675 result = PyObject_GetAttrString(module, class_name);
8676 if (!result)
8677 goto bad;
8678 if (!PyType_Check(result)) {
8679 PyErr_Format(PyExc_TypeError,
8680 "%.200s.%.200s is not a type object",
8681 module_name, class_name);
8682 goto bad;
8683 }
8684 #ifndef Py_LIMITED_API
8685 basicsize = ((PyTypeObject *)result)->tp_basicsize;
8686 #else
8687 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
8688 if (!py_basicsize)
8689 goto bad;
8690 basicsize = PyLong_AsSsize_t(py_basicsize);
8691 Py_DECREF(py_basicsize);
8692 py_basicsize = 0;
8693 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
8694 goto bad;
8695 #endif
8696 if ((size_t)basicsize < size) {
8697 PyErr_Format(PyExc_ValueError,
8698 "%.200s.%.200s size changed, may indicate binary incompatibility. "
8699 "Expected %zd from C header, got %zd from PyObject",
8700 module_name, class_name, size, basicsize);
8701 goto bad;
8702 }
8703 if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
8704 PyErr_Format(PyExc_ValueError,
8705 "%.200s.%.200s size changed, may indicate binary incompatibility. "
8706 "Expected %zd from C header, got %zd from PyObject",
8707 module_name, class_name, size, basicsize);
8708 goto bad;
8709 }
8710 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
8711 PyOS_snprintf(warning, sizeof(warning),
8712 "%s.%s size changed, may indicate binary incompatibility. "
8713 "Expected %zd from C header, got %zd from PyObject",
8714 module_name, class_name, size, basicsize);
8715 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
8716 }
8717 return (PyTypeObject *)result;
8718 bad:
8719 Py_XDECREF(result);
8720 return NULL;
8721 }
8722 #endif
8723
8724 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)8725 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
8726 PyObject *empty_list = 0;
8727 PyObject *module = 0;
8728 PyObject *global_dict = 0;
8729 PyObject *empty_dict = 0;
8730 PyObject *list;
8731 #if PY_MAJOR_VERSION < 3
8732 PyObject *py_import;
8733 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
8734 if (!py_import)
8735 goto bad;
8736 #endif
8737 if (from_list)
8738 list = from_list;
8739 else {
8740 empty_list = PyList_New(0);
8741 if (!empty_list)
8742 goto bad;
8743 list = empty_list;
8744 }
8745 global_dict = PyModule_GetDict(__pyx_m);
8746 if (!global_dict)
8747 goto bad;
8748 empty_dict = PyDict_New();
8749 if (!empty_dict)
8750 goto bad;
8751 {
8752 #if PY_MAJOR_VERSION >= 3
8753 if (level == -1) {
8754 if (strchr(__Pyx_MODULE_NAME, '.')) {
8755 module = PyImport_ImportModuleLevelObject(
8756 name, global_dict, empty_dict, list, 1);
8757 if (!module) {
8758 if (!PyErr_ExceptionMatches(PyExc_ImportError))
8759 goto bad;
8760 PyErr_Clear();
8761 }
8762 }
8763 level = 0;
8764 }
8765 #endif
8766 if (!module) {
8767 #if PY_MAJOR_VERSION < 3
8768 PyObject *py_level = PyInt_FromLong(level);
8769 if (!py_level)
8770 goto bad;
8771 module = PyObject_CallFunctionObjArgs(py_import,
8772 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
8773 Py_DECREF(py_level);
8774 #else
8775 module = PyImport_ImportModuleLevelObject(
8776 name, global_dict, empty_dict, list, level);
8777 #endif
8778 }
8779 }
8780 bad:
8781 #if PY_MAJOR_VERSION < 3
8782 Py_XDECREF(py_import);
8783 #endif
8784 Py_XDECREF(empty_list);
8785 Py_XDECREF(empty_dict);
8786 return module;
8787 }
8788
8789 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)8790 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
8791 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
8792 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
8793 PyErr_Format(PyExc_ImportError,
8794 #if PY_MAJOR_VERSION < 3
8795 "cannot import name %.230s", PyString_AS_STRING(name));
8796 #else
8797 "cannot import name %S", name);
8798 #endif
8799 }
8800 return value;
8801 }
8802
8803 /* CLineInTraceback */
8804 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(PyThreadState * tstate,int c_line)8805 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
8806 PyObject *use_cline;
8807 PyObject *ptype, *pvalue, *ptraceback;
8808 #if CYTHON_COMPILING_IN_CPYTHON
8809 PyObject **cython_runtime_dict;
8810 #endif
8811 if (unlikely(!__pyx_cython_runtime)) {
8812 return c_line;
8813 }
8814 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
8815 #if CYTHON_COMPILING_IN_CPYTHON
8816 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
8817 if (likely(cython_runtime_dict)) {
8818 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
8819 use_cline, *cython_runtime_dict,
8820 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
8821 } else
8822 #endif
8823 {
8824 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
8825 if (use_cline_obj) {
8826 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
8827 Py_DECREF(use_cline_obj);
8828 } else {
8829 PyErr_Clear();
8830 use_cline = NULL;
8831 }
8832 }
8833 if (!use_cline) {
8834 c_line = 0;
8835 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
8836 }
8837 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
8838 c_line = 0;
8839 }
8840 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
8841 return c_line;
8842 }
8843 #endif
8844
8845 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)8846 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
8847 int start = 0, mid = 0, end = count - 1;
8848 if (end >= 0 && code_line > entries[end].code_line) {
8849 return count;
8850 }
8851 while (start < end) {
8852 mid = start + (end - start) / 2;
8853 if (code_line < entries[mid].code_line) {
8854 end = mid;
8855 } else if (code_line > entries[mid].code_line) {
8856 start = mid + 1;
8857 } else {
8858 return mid;
8859 }
8860 }
8861 if (code_line <= entries[mid].code_line) {
8862 return mid;
8863 } else {
8864 return mid + 1;
8865 }
8866 }
__pyx_find_code_object(int code_line)8867 static PyCodeObject *__pyx_find_code_object(int code_line) {
8868 PyCodeObject* code_object;
8869 int pos;
8870 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
8871 return NULL;
8872 }
8873 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8874 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
8875 return NULL;
8876 }
8877 code_object = __pyx_code_cache.entries[pos].code_object;
8878 Py_INCREF(code_object);
8879 return code_object;
8880 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)8881 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
8882 int pos, i;
8883 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
8884 if (unlikely(!code_line)) {
8885 return;
8886 }
8887 if (unlikely(!entries)) {
8888 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
8889 if (likely(entries)) {
8890 __pyx_code_cache.entries = entries;
8891 __pyx_code_cache.max_count = 64;
8892 __pyx_code_cache.count = 1;
8893 entries[0].code_line = code_line;
8894 entries[0].code_object = code_object;
8895 Py_INCREF(code_object);
8896 }
8897 return;
8898 }
8899 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8900 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
8901 PyCodeObject* tmp = entries[pos].code_object;
8902 entries[pos].code_object = code_object;
8903 Py_DECREF(tmp);
8904 return;
8905 }
8906 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
8907 int new_max = __pyx_code_cache.max_count + 64;
8908 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
8909 __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
8910 if (unlikely(!entries)) {
8911 return;
8912 }
8913 __pyx_code_cache.entries = entries;
8914 __pyx_code_cache.max_count = new_max;
8915 }
8916 for (i=__pyx_code_cache.count; i>pos; i--) {
8917 entries[i] = entries[i-1];
8918 }
8919 entries[pos].code_line = code_line;
8920 entries[pos].code_object = code_object;
8921 __pyx_code_cache.count++;
8922 Py_INCREF(code_object);
8923 }
8924
8925 /* AddTraceback */
8926 #include "compile.h"
8927 #include "frameobject.h"
8928 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)8929 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
8930 const char *funcname, int c_line,
8931 int py_line, const char *filename) {
8932 PyCodeObject *py_code = 0;
8933 PyObject *py_srcfile = 0;
8934 PyObject *py_funcname = 0;
8935 #if PY_MAJOR_VERSION < 3
8936 py_srcfile = PyString_FromString(filename);
8937 #else
8938 py_srcfile = PyUnicode_FromString(filename);
8939 #endif
8940 if (!py_srcfile) goto bad;
8941 if (c_line) {
8942 #if PY_MAJOR_VERSION < 3
8943 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
8944 #else
8945 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
8946 #endif
8947 }
8948 else {
8949 #if PY_MAJOR_VERSION < 3
8950 py_funcname = PyString_FromString(funcname);
8951 #else
8952 py_funcname = PyUnicode_FromString(funcname);
8953 #endif
8954 }
8955 if (!py_funcname) goto bad;
8956 py_code = __Pyx_PyCode_New(
8957 0,
8958 0,
8959 0,
8960 0,
8961 0,
8962 __pyx_empty_bytes, /*PyObject *code,*/
8963 __pyx_empty_tuple, /*PyObject *consts,*/
8964 __pyx_empty_tuple, /*PyObject *names,*/
8965 __pyx_empty_tuple, /*PyObject *varnames,*/
8966 __pyx_empty_tuple, /*PyObject *freevars,*/
8967 __pyx_empty_tuple, /*PyObject *cellvars,*/
8968 py_srcfile, /*PyObject *filename,*/
8969 py_funcname, /*PyObject *name,*/
8970 py_line,
8971 __pyx_empty_bytes /*PyObject *lnotab*/
8972 );
8973 Py_DECREF(py_srcfile);
8974 Py_DECREF(py_funcname);
8975 return py_code;
8976 bad:
8977 Py_XDECREF(py_srcfile);
8978 Py_XDECREF(py_funcname);
8979 return NULL;
8980 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)8981 static void __Pyx_AddTraceback(const char *funcname, int c_line,
8982 int py_line, const char *filename) {
8983 PyCodeObject *py_code = 0;
8984 PyFrameObject *py_frame = 0;
8985 PyThreadState *tstate = __Pyx_PyThreadState_Current;
8986 if (c_line) {
8987 c_line = __Pyx_CLineForTraceback(tstate, c_line);
8988 }
8989 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
8990 if (!py_code) {
8991 py_code = __Pyx_CreateCodeObjectForTraceback(
8992 funcname, c_line, py_line, filename);
8993 if (!py_code) goto bad;
8994 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
8995 }
8996 py_frame = PyFrame_New(
8997 tstate, /*PyThreadState *tstate,*/
8998 py_code, /*PyCodeObject *code,*/
8999 __pyx_d, /*PyObject *globals,*/
9000 0 /*PyObject *locals*/
9001 );
9002 if (!py_frame) goto bad;
9003 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
9004 PyTraceBack_Here(py_frame);
9005 bad:
9006 Py_XDECREF(py_code);
9007 Py_XDECREF(py_frame);
9008 }
9009
9010 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)9011 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
9012 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
9013 if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
9014 PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
9015 return -1;
9016 }
__Pyx_ReleaseBuffer(Py_buffer * view)9017 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
9018 PyObject *obj = view->obj;
9019 if (!obj) return;
9020 if (PyObject_CheckBuffer(obj)) {
9021 PyBuffer_Release(view);
9022 return;
9023 }
9024 if ((0)) {}
9025 else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
9026 view->obj = NULL;
9027 Py_DECREF(obj);
9028 }
9029 #endif
9030
9031
9032 /* CIntToPy */
__Pyx_PyInt_From_int(int value)9033 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
9034 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
9035 const int is_unsigned = neg_one > const_zero;
9036 if (is_unsigned) {
9037 if (sizeof(int) < sizeof(long)) {
9038 return PyInt_FromLong((long) value);
9039 } else if (sizeof(int) <= sizeof(unsigned long)) {
9040 return PyLong_FromUnsignedLong((unsigned long) value);
9041 #ifdef HAVE_LONG_LONG
9042 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
9043 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9044 #endif
9045 }
9046 } else {
9047 if (sizeof(int) <= sizeof(long)) {
9048 return PyInt_FromLong((long) value);
9049 #ifdef HAVE_LONG_LONG
9050 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
9051 return PyLong_FromLongLong((PY_LONG_LONG) value);
9052 #endif
9053 }
9054 }
9055 {
9056 int one = 1; int little = (int)*(unsigned char *)&one;
9057 unsigned char *bytes = (unsigned char *)&value;
9058 return _PyLong_FromByteArray(bytes, sizeof(int),
9059 little, !is_unsigned);
9060 }
9061 }
9062
9063 /* CIntToPy */
__Pyx_PyInt_From_long(long value)9064 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
9065 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
9066 const int is_unsigned = neg_one > const_zero;
9067 if (is_unsigned) {
9068 if (sizeof(long) < sizeof(long)) {
9069 return PyInt_FromLong((long) value);
9070 } else if (sizeof(long) <= sizeof(unsigned long)) {
9071 return PyLong_FromUnsignedLong((unsigned long) value);
9072 #ifdef HAVE_LONG_LONG
9073 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
9074 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9075 #endif
9076 }
9077 } else {
9078 if (sizeof(long) <= sizeof(long)) {
9079 return PyInt_FromLong((long) value);
9080 #ifdef HAVE_LONG_LONG
9081 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
9082 return PyLong_FromLongLong((PY_LONG_LONG) value);
9083 #endif
9084 }
9085 }
9086 {
9087 int one = 1; int little = (int)*(unsigned char *)&one;
9088 unsigned char *bytes = (unsigned char *)&value;
9089 return _PyLong_FromByteArray(bytes, sizeof(long),
9090 little, !is_unsigned);
9091 }
9092 }
9093
9094 /* Declarations */
9095 #if CYTHON_CCOMPLEX
9096 #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)9097 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
9098 return ::std::complex< float >(x, y);
9099 }
9100 #else
__pyx_t_float_complex_from_parts(float x,float y)9101 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
9102 return x + y*(__pyx_t_float_complex)_Complex_I;
9103 }
9104 #endif
9105 #else
__pyx_t_float_complex_from_parts(float x,float y)9106 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
9107 __pyx_t_float_complex z;
9108 z.real = x;
9109 z.imag = y;
9110 return z;
9111 }
9112 #endif
9113
9114 /* Arithmetic */
9115 #if CYTHON_CCOMPLEX
9116 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9117 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9118 return (a.real == b.real) && (a.imag == b.imag);
9119 }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9120 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9121 __pyx_t_float_complex z;
9122 z.real = a.real + b.real;
9123 z.imag = a.imag + b.imag;
9124 return z;
9125 }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9126 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9127 __pyx_t_float_complex z;
9128 z.real = a.real - b.real;
9129 z.imag = a.imag - b.imag;
9130 return z;
9131 }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9132 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9133 __pyx_t_float_complex z;
9134 z.real = a.real * b.real - a.imag * b.imag;
9135 z.imag = a.real * b.imag + a.imag * b.real;
9136 return z;
9137 }
9138 #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9139 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9140 if (b.imag == 0) {
9141 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
9142 } else if (fabsf(b.real) >= fabsf(b.imag)) {
9143 if (b.real == 0 && b.imag == 0) {
9144 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
9145 } else {
9146 float r = b.imag / b.real;
9147 float s = (float)(1.0) / (b.real + b.imag * r);
9148 return __pyx_t_float_complex_from_parts(
9149 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
9150 }
9151 } else {
9152 float r = b.real / b.imag;
9153 float s = (float)(1.0) / (b.imag + b.real * r);
9154 return __pyx_t_float_complex_from_parts(
9155 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
9156 }
9157 }
9158 #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9159 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9160 if (b.imag == 0) {
9161 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
9162 } else {
9163 float denom = b.real * b.real + b.imag * b.imag;
9164 return __pyx_t_float_complex_from_parts(
9165 (a.real * b.real + a.imag * b.imag) / denom,
9166 (a.imag * b.real - a.real * b.imag) / denom);
9167 }
9168 }
9169 #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)9170 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
9171 __pyx_t_float_complex z;
9172 z.real = -a.real;
9173 z.imag = -a.imag;
9174 return z;
9175 }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)9176 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
9177 return (a.real == 0) && (a.imag == 0);
9178 }
__Pyx_c_conj_float(__pyx_t_float_complex a)9179 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
9180 __pyx_t_float_complex z;
9181 z.real = a.real;
9182 z.imag = -a.imag;
9183 return z;
9184 }
9185 #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)9186 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
9187 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
9188 return sqrtf(z.real*z.real + z.imag*z.imag);
9189 #else
9190 return hypotf(z.real, z.imag);
9191 #endif
9192 }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9193 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9194 __pyx_t_float_complex z;
9195 float r, lnr, theta, z_r, z_theta;
9196 if (b.imag == 0 && b.real == (int)b.real) {
9197 if (b.real < 0) {
9198 float denom = a.real * a.real + a.imag * a.imag;
9199 a.real = a.real / denom;
9200 a.imag = -a.imag / denom;
9201 b.real = -b.real;
9202 }
9203 switch ((int)b.real) {
9204 case 0:
9205 z.real = 1;
9206 z.imag = 0;
9207 return z;
9208 case 1:
9209 return a;
9210 case 2:
9211 z = __Pyx_c_prod_float(a, a);
9212 return __Pyx_c_prod_float(a, a);
9213 case 3:
9214 z = __Pyx_c_prod_float(a, a);
9215 return __Pyx_c_prod_float(z, a);
9216 case 4:
9217 z = __Pyx_c_prod_float(a, a);
9218 return __Pyx_c_prod_float(z, z);
9219 }
9220 }
9221 if (a.imag == 0) {
9222 if (a.real == 0) {
9223 return a;
9224 } else if (b.imag == 0) {
9225 z.real = powf(a.real, b.real);
9226 z.imag = 0;
9227 return z;
9228 } else if (a.real > 0) {
9229 r = a.real;
9230 theta = 0;
9231 } else {
9232 r = -a.real;
9233 theta = atan2f(0.0, -1.0);
9234 }
9235 } else {
9236 r = __Pyx_c_abs_float(a);
9237 theta = atan2f(a.imag, a.real);
9238 }
9239 lnr = logf(r);
9240 z_r = expf(lnr * b.real - theta * b.imag);
9241 z_theta = theta * b.real + lnr * b.imag;
9242 z.real = z_r * cosf(z_theta);
9243 z.imag = z_r * sinf(z_theta);
9244 return z;
9245 }
9246 #endif
9247 #endif
9248
9249 /* Declarations */
9250 #if CYTHON_CCOMPLEX
9251 #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)9252 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
9253 return ::std::complex< double >(x, y);
9254 }
9255 #else
__pyx_t_double_complex_from_parts(double x,double y)9256 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
9257 return x + y*(__pyx_t_double_complex)_Complex_I;
9258 }
9259 #endif
9260 #else
__pyx_t_double_complex_from_parts(double x,double y)9261 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
9262 __pyx_t_double_complex z;
9263 z.real = x;
9264 z.imag = y;
9265 return z;
9266 }
9267 #endif
9268
9269 /* Arithmetic */
9270 #if CYTHON_CCOMPLEX
9271 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)9272 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
9273 return (a.real == b.real) && (a.imag == b.imag);
9274 }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)9275 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
9276 __pyx_t_double_complex z;
9277 z.real = a.real + b.real;
9278 z.imag = a.imag + b.imag;
9279 return z;
9280 }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)9281 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
9282 __pyx_t_double_complex z;
9283 z.real = a.real - b.real;
9284 z.imag = a.imag - b.imag;
9285 return z;
9286 }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)9287 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
9288 __pyx_t_double_complex z;
9289 z.real = a.real * b.real - a.imag * b.imag;
9290 z.imag = a.real * b.imag + a.imag * b.real;
9291 return z;
9292 }
9293 #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)9294 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
9295 if (b.imag == 0) {
9296 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
9297 } else if (fabs(b.real) >= fabs(b.imag)) {
9298 if (b.real == 0 && b.imag == 0) {
9299 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
9300 } else {
9301 double r = b.imag / b.real;
9302 double s = (double)(1.0) / (b.real + b.imag * r);
9303 return __pyx_t_double_complex_from_parts(
9304 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
9305 }
9306 } else {
9307 double r = b.real / b.imag;
9308 double s = (double)(1.0) / (b.imag + b.real * r);
9309 return __pyx_t_double_complex_from_parts(
9310 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
9311 }
9312 }
9313 #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)9314 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
9315 if (b.imag == 0) {
9316 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
9317 } else {
9318 double denom = b.real * b.real + b.imag * b.imag;
9319 return __pyx_t_double_complex_from_parts(
9320 (a.real * b.real + a.imag * b.imag) / denom,
9321 (a.imag * b.real - a.real * b.imag) / denom);
9322 }
9323 }
9324 #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)9325 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
9326 __pyx_t_double_complex z;
9327 z.real = -a.real;
9328 z.imag = -a.imag;
9329 return z;
9330 }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)9331 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
9332 return (a.real == 0) && (a.imag == 0);
9333 }
__Pyx_c_conj_double(__pyx_t_double_complex a)9334 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
9335 __pyx_t_double_complex z;
9336 z.real = a.real;
9337 z.imag = -a.imag;
9338 return z;
9339 }
9340 #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)9341 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
9342 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
9343 return sqrt(z.real*z.real + z.imag*z.imag);
9344 #else
9345 return hypot(z.real, z.imag);
9346 #endif
9347 }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)9348 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
9349 __pyx_t_double_complex z;
9350 double r, lnr, theta, z_r, z_theta;
9351 if (b.imag == 0 && b.real == (int)b.real) {
9352 if (b.real < 0) {
9353 double denom = a.real * a.real + a.imag * a.imag;
9354 a.real = a.real / denom;
9355 a.imag = -a.imag / denom;
9356 b.real = -b.real;
9357 }
9358 switch ((int)b.real) {
9359 case 0:
9360 z.real = 1;
9361 z.imag = 0;
9362 return z;
9363 case 1:
9364 return a;
9365 case 2:
9366 z = __Pyx_c_prod_double(a, a);
9367 return __Pyx_c_prod_double(a, a);
9368 case 3:
9369 z = __Pyx_c_prod_double(a, a);
9370 return __Pyx_c_prod_double(z, a);
9371 case 4:
9372 z = __Pyx_c_prod_double(a, a);
9373 return __Pyx_c_prod_double(z, z);
9374 }
9375 }
9376 if (a.imag == 0) {
9377 if (a.real == 0) {
9378 return a;
9379 } else if (b.imag == 0) {
9380 z.real = pow(a.real, b.real);
9381 z.imag = 0;
9382 return z;
9383 } else if (a.real > 0) {
9384 r = a.real;
9385 theta = 0;
9386 } else {
9387 r = -a.real;
9388 theta = atan2(0.0, -1.0);
9389 }
9390 } else {
9391 r = __Pyx_c_abs_double(a);
9392 theta = atan2(a.imag, a.real);
9393 }
9394 lnr = log(r);
9395 z_r = exp(lnr * b.real - theta * b.imag);
9396 z_theta = theta * b.real + lnr * b.imag;
9397 z.real = z_r * cos(z_theta);
9398 z.imag = z_r * sin(z_theta);
9399 return z;
9400 }
9401 #endif
9402 #endif
9403
9404 /* CIntFromPyVerify */
9405 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
9406 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
9407 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
9408 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
9409 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
9410 {\
9411 func_type value = func_value;\
9412 if (sizeof(target_type) < sizeof(func_type)) {\
9413 if (unlikely(value != (func_type) (target_type) value)) {\
9414 func_type zero = 0;\
9415 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
9416 return (target_type) -1;\
9417 if (is_unsigned && unlikely(value < zero))\
9418 goto raise_neg_overflow;\
9419 else\
9420 goto raise_overflow;\
9421 }\
9422 }\
9423 return (target_type) value;\
9424 }
9425
9426 /* CIntToPy */
__Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value)9427 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
9428 const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
9429 const int is_unsigned = neg_one > const_zero;
9430 if (is_unsigned) {
9431 if (sizeof(enum NPY_TYPES) < sizeof(long)) {
9432 return PyInt_FromLong((long) value);
9433 } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
9434 return PyLong_FromUnsignedLong((unsigned long) value);
9435 #ifdef HAVE_LONG_LONG
9436 } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
9437 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9438 #endif
9439 }
9440 } else {
9441 if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
9442 return PyInt_FromLong((long) value);
9443 #ifdef HAVE_LONG_LONG
9444 } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
9445 return PyLong_FromLongLong((PY_LONG_LONG) value);
9446 #endif
9447 }
9448 }
9449 {
9450 int one = 1; int little = (int)*(unsigned char *)&one;
9451 unsigned char *bytes = (unsigned char *)&value;
9452 return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
9453 little, !is_unsigned);
9454 }
9455 }
9456
9457 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)9458 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
9459 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
9460 const int is_unsigned = neg_one > const_zero;
9461 #if PY_MAJOR_VERSION < 3
9462 if (likely(PyInt_Check(x))) {
9463 if (sizeof(int) < sizeof(long)) {
9464 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
9465 } else {
9466 long val = PyInt_AS_LONG(x);
9467 if (is_unsigned && unlikely(val < 0)) {
9468 goto raise_neg_overflow;
9469 }
9470 return (int) val;
9471 }
9472 } else
9473 #endif
9474 if (likely(PyLong_Check(x))) {
9475 if (is_unsigned) {
9476 #if CYTHON_USE_PYLONG_INTERNALS
9477 const digit* digits = ((PyLongObject*)x)->ob_digit;
9478 switch (Py_SIZE(x)) {
9479 case 0: return (int) 0;
9480 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
9481 case 2:
9482 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
9483 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9484 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9485 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
9486 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
9487 }
9488 }
9489 break;
9490 case 3:
9491 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
9492 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9493 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9494 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
9495 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
9496 }
9497 }
9498 break;
9499 case 4:
9500 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
9501 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9502 __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])))
9503 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
9504 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
9505 }
9506 }
9507 break;
9508 }
9509 #endif
9510 #if CYTHON_COMPILING_IN_CPYTHON
9511 if (unlikely(Py_SIZE(x) < 0)) {
9512 goto raise_neg_overflow;
9513 }
9514 #else
9515 {
9516 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
9517 if (unlikely(result < 0))
9518 return (int) -1;
9519 if (unlikely(result == 1))
9520 goto raise_neg_overflow;
9521 }
9522 #endif
9523 if (sizeof(int) <= sizeof(unsigned long)) {
9524 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
9525 #ifdef HAVE_LONG_LONG
9526 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
9527 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
9528 #endif
9529 }
9530 } else {
9531 #if CYTHON_USE_PYLONG_INTERNALS
9532 const digit* digits = ((PyLongObject*)x)->ob_digit;
9533 switch (Py_SIZE(x)) {
9534 case 0: return (int) 0;
9535 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
9536 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
9537 case -2:
9538 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
9539 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9540 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9541 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9542 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9543 }
9544 }
9545 break;
9546 case 2:
9547 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
9548 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9549 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9550 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9551 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9552 }
9553 }
9554 break;
9555 case -3:
9556 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9557 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9558 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9559 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9560 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9561 }
9562 }
9563 break;
9564 case 3:
9565 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
9566 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9567 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9568 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9569 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9570 }
9571 }
9572 break;
9573 case -4:
9574 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9575 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9576 __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])))
9577 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
9578 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9579 }
9580 }
9581 break;
9582 case 4:
9583 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
9584 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9585 __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])))
9586 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
9587 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9588 }
9589 }
9590 break;
9591 }
9592 #endif
9593 if (sizeof(int) <= sizeof(long)) {
9594 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
9595 #ifdef HAVE_LONG_LONG
9596 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
9597 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
9598 #endif
9599 }
9600 }
9601 {
9602 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
9603 PyErr_SetString(PyExc_RuntimeError,
9604 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
9605 #else
9606 int val;
9607 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
9608 #if PY_MAJOR_VERSION < 3
9609 if (likely(v) && !PyLong_Check(v)) {
9610 PyObject *tmp = v;
9611 v = PyNumber_Long(tmp);
9612 Py_DECREF(tmp);
9613 }
9614 #endif
9615 if (likely(v)) {
9616 int one = 1; int is_little = (int)*(unsigned char *)&one;
9617 unsigned char *bytes = (unsigned char *)&val;
9618 int ret = _PyLong_AsByteArray((PyLongObject *)v,
9619 bytes, sizeof(val),
9620 is_little, !is_unsigned);
9621 Py_DECREF(v);
9622 if (likely(!ret))
9623 return val;
9624 }
9625 #endif
9626 return (int) -1;
9627 }
9628 } else {
9629 int val;
9630 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
9631 if (!tmp) return (int) -1;
9632 val = __Pyx_PyInt_As_int(tmp);
9633 Py_DECREF(tmp);
9634 return val;
9635 }
9636 raise_overflow:
9637 PyErr_SetString(PyExc_OverflowError,
9638 "value too large to convert to int");
9639 return (int) -1;
9640 raise_neg_overflow:
9641 PyErr_SetString(PyExc_OverflowError,
9642 "can't convert negative value to int");
9643 return (int) -1;
9644 }
9645
9646 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)9647 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
9648 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
9649 const int is_unsigned = neg_one > const_zero;
9650 #if PY_MAJOR_VERSION < 3
9651 if (likely(PyInt_Check(x))) {
9652 if (sizeof(long) < sizeof(long)) {
9653 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
9654 } else {
9655 long val = PyInt_AS_LONG(x);
9656 if (is_unsigned && unlikely(val < 0)) {
9657 goto raise_neg_overflow;
9658 }
9659 return (long) val;
9660 }
9661 } else
9662 #endif
9663 if (likely(PyLong_Check(x))) {
9664 if (is_unsigned) {
9665 #if CYTHON_USE_PYLONG_INTERNALS
9666 const digit* digits = ((PyLongObject*)x)->ob_digit;
9667 switch (Py_SIZE(x)) {
9668 case 0: return (long) 0;
9669 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
9670 case 2:
9671 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
9672 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9673 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9674 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
9675 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
9676 }
9677 }
9678 break;
9679 case 3:
9680 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
9681 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9682 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9683 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
9684 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
9685 }
9686 }
9687 break;
9688 case 4:
9689 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
9690 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9691 __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])))
9692 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
9693 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
9694 }
9695 }
9696 break;
9697 }
9698 #endif
9699 #if CYTHON_COMPILING_IN_CPYTHON
9700 if (unlikely(Py_SIZE(x) < 0)) {
9701 goto raise_neg_overflow;
9702 }
9703 #else
9704 {
9705 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
9706 if (unlikely(result < 0))
9707 return (long) -1;
9708 if (unlikely(result == 1))
9709 goto raise_neg_overflow;
9710 }
9711 #endif
9712 if (sizeof(long) <= sizeof(unsigned long)) {
9713 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
9714 #ifdef HAVE_LONG_LONG
9715 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
9716 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
9717 #endif
9718 }
9719 } else {
9720 #if CYTHON_USE_PYLONG_INTERNALS
9721 const digit* digits = ((PyLongObject*)x)->ob_digit;
9722 switch (Py_SIZE(x)) {
9723 case 0: return (long) 0;
9724 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
9725 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
9726 case -2:
9727 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
9728 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9729 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9730 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9731 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9732 }
9733 }
9734 break;
9735 case 2:
9736 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
9737 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9738 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9739 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9740 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9741 }
9742 }
9743 break;
9744 case -3:
9745 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9746 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9747 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9748 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9749 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9750 }
9751 }
9752 break;
9753 case 3:
9754 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
9755 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9756 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9757 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9758 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9759 }
9760 }
9761 break;
9762 case -4:
9763 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9764 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9765 __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])))
9766 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9767 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9768 }
9769 }
9770 break;
9771 case 4:
9772 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
9773 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9774 __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])))
9775 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9776 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9777 }
9778 }
9779 break;
9780 }
9781 #endif
9782 if (sizeof(long) <= sizeof(long)) {
9783 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
9784 #ifdef HAVE_LONG_LONG
9785 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
9786 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
9787 #endif
9788 }
9789 }
9790 {
9791 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
9792 PyErr_SetString(PyExc_RuntimeError,
9793 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
9794 #else
9795 long val;
9796 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
9797 #if PY_MAJOR_VERSION < 3
9798 if (likely(v) && !PyLong_Check(v)) {
9799 PyObject *tmp = v;
9800 v = PyNumber_Long(tmp);
9801 Py_DECREF(tmp);
9802 }
9803 #endif
9804 if (likely(v)) {
9805 int one = 1; int is_little = (int)*(unsigned char *)&one;
9806 unsigned char *bytes = (unsigned char *)&val;
9807 int ret = _PyLong_AsByteArray((PyLongObject *)v,
9808 bytes, sizeof(val),
9809 is_little, !is_unsigned);
9810 Py_DECREF(v);
9811 if (likely(!ret))
9812 return val;
9813 }
9814 #endif
9815 return (long) -1;
9816 }
9817 } else {
9818 long val;
9819 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
9820 if (!tmp) return (long) -1;
9821 val = __Pyx_PyInt_As_long(tmp);
9822 Py_DECREF(tmp);
9823 return val;
9824 }
9825 raise_overflow:
9826 PyErr_SetString(PyExc_OverflowError,
9827 "value too large to convert to long");
9828 return (long) -1;
9829 raise_neg_overflow:
9830 PyErr_SetString(PyExc_OverflowError,
9831 "can't convert negative value to long");
9832 return (long) -1;
9833 }
9834
9835 /* FastTypeChecks */
9836 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)9837 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
9838 while (a) {
9839 a = a->tp_base;
9840 if (a == b)
9841 return 1;
9842 }
9843 return b == &PyBaseObject_Type;
9844 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)9845 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
9846 PyObject *mro;
9847 if (a == b) return 1;
9848 mro = a->tp_mro;
9849 if (likely(mro)) {
9850 Py_ssize_t i, n;
9851 n = PyTuple_GET_SIZE(mro);
9852 for (i = 0; i < n; i++) {
9853 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
9854 return 1;
9855 }
9856 return 0;
9857 }
9858 return __Pyx_InBases(a, b);
9859 }
9860 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)9861 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
9862 PyObject *exception, *value, *tb;
9863 int res;
9864 __Pyx_PyThreadState_declare
9865 __Pyx_PyThreadState_assign
9866 __Pyx_ErrFetch(&exception, &value, &tb);
9867 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
9868 if (unlikely(res == -1)) {
9869 PyErr_WriteUnraisable(err);
9870 res = 0;
9871 }
9872 if (!res) {
9873 res = PyObject_IsSubclass(err, exc_type2);
9874 if (unlikely(res == -1)) {
9875 PyErr_WriteUnraisable(err);
9876 res = 0;
9877 }
9878 }
9879 __Pyx_ErrRestore(exception, value, tb);
9880 return res;
9881 }
9882 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)9883 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
9884 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
9885 if (!res) {
9886 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
9887 }
9888 return res;
9889 }
9890 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)9891 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
9892 Py_ssize_t i, n;
9893 assert(PyExceptionClass_Check(exc_type));
9894 n = PyTuple_GET_SIZE(tuple);
9895 #if PY_MAJOR_VERSION >= 3
9896 for (i=0; i<n; i++) {
9897 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
9898 }
9899 #endif
9900 for (i=0; i<n; i++) {
9901 PyObject *t = PyTuple_GET_ITEM(tuple, i);
9902 #if PY_MAJOR_VERSION < 3
9903 if (likely(exc_type == t)) return 1;
9904 #endif
9905 if (likely(PyExceptionClass_Check(t))) {
9906 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
9907 } else {
9908 }
9909 }
9910 return 0;
9911 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)9912 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
9913 if (likely(err == exc_type)) return 1;
9914 if (likely(PyExceptionClass_Check(err))) {
9915 if (likely(PyExceptionClass_Check(exc_type))) {
9916 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
9917 } else if (likely(PyTuple_Check(exc_type))) {
9918 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
9919 } else {
9920 }
9921 }
9922 return PyErr_GivenExceptionMatches(err, exc_type);
9923 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)9924 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
9925 assert(PyExceptionClass_Check(exc_type1));
9926 assert(PyExceptionClass_Check(exc_type2));
9927 if (likely(err == exc_type1 || err == exc_type2)) return 1;
9928 if (likely(PyExceptionClass_Check(err))) {
9929 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
9930 }
9931 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
9932 }
9933 #endif
9934
9935 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)9936 static int __Pyx_check_binary_version(void) {
9937 char ctversion[4], rtversion[4];
9938 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
9939 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
9940 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
9941 char message[200];
9942 PyOS_snprintf(message, sizeof(message),
9943 "compiletime version %s of module '%.100s' "
9944 "does not match runtime version %s",
9945 ctversion, __Pyx_MODULE_NAME, rtversion);
9946 return PyErr_WarnEx(NULL, message, 1);
9947 }
9948 return 0;
9949 }
9950
9951 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)9952 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
9953 while (t->p) {
9954 #if PY_MAJOR_VERSION < 3
9955 if (t->is_unicode) {
9956 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
9957 } else if (t->intern) {
9958 *t->p = PyString_InternFromString(t->s);
9959 } else {
9960 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
9961 }
9962 #else
9963 if (t->is_unicode | t->is_str) {
9964 if (t->intern) {
9965 *t->p = PyUnicode_InternFromString(t->s);
9966 } else if (t->encoding) {
9967 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
9968 } else {
9969 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
9970 }
9971 } else {
9972 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
9973 }
9974 #endif
9975 if (!*t->p)
9976 return -1;
9977 if (PyObject_Hash(*t->p) == -1)
9978 return -1;
9979 ++t;
9980 }
9981 return 0;
9982 }
9983
__Pyx_PyUnicode_FromString(const char * c_str)9984 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
9985 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
9986 }
__Pyx_PyObject_AsString(PyObject * o)9987 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
9988 Py_ssize_t ignore;
9989 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
9990 }
9991 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
9992 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)9993 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9994 char* defenc_c;
9995 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
9996 if (!defenc) return NULL;
9997 defenc_c = PyBytes_AS_STRING(defenc);
9998 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9999 {
10000 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
10001 char* c;
10002 for (c = defenc_c; c < end; c++) {
10003 if ((unsigned char) (*c) >= 128) {
10004 PyUnicode_AsASCIIString(o);
10005 return NULL;
10006 }
10007 }
10008 }
10009 #endif
10010 *length = PyBytes_GET_SIZE(defenc);
10011 return defenc_c;
10012 }
10013 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)10014 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
10015 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
10016 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
10017 if (likely(PyUnicode_IS_ASCII(o))) {
10018 *length = PyUnicode_GET_LENGTH(o);
10019 return PyUnicode_AsUTF8(o);
10020 } else {
10021 PyUnicode_AsASCIIString(o);
10022 return NULL;
10023 }
10024 #else
10025 return PyUnicode_AsUTF8AndSize(o, length);
10026 #endif
10027 }
10028 #endif
10029 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)10030 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
10031 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
10032 if (
10033 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
10034 __Pyx_sys_getdefaultencoding_not_ascii &&
10035 #endif
10036 PyUnicode_Check(o)) {
10037 return __Pyx_PyUnicode_AsStringAndSize(o, length);
10038 } else
10039 #endif
10040 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
10041 if (PyByteArray_Check(o)) {
10042 *length = PyByteArray_GET_SIZE(o);
10043 return PyByteArray_AS_STRING(o);
10044 } else
10045 #endif
10046 {
10047 char* result;
10048 int r = PyBytes_AsStringAndSize(o, &result, length);
10049 if (unlikely(r < 0)) {
10050 return NULL;
10051 } else {
10052 return result;
10053 }
10054 }
10055 }
__Pyx_PyObject_IsTrue(PyObject * x)10056 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
10057 int is_true = x == Py_True;
10058 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
10059 else return PyObject_IsTrue(x);
10060 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)10061 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
10062 int retval;
10063 if (unlikely(!x)) return -1;
10064 retval = __Pyx_PyObject_IsTrue(x);
10065 Py_DECREF(x);
10066 return retval;
10067 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)10068 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
10069 #if PY_MAJOR_VERSION >= 3
10070 if (PyLong_Check(result)) {
10071 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
10072 "__int__ returned non-int (type %.200s). "
10073 "The ability to return an instance of a strict subclass of int "
10074 "is deprecated, and may be removed in a future version of Python.",
10075 Py_TYPE(result)->tp_name)) {
10076 Py_DECREF(result);
10077 return NULL;
10078 }
10079 return result;
10080 }
10081 #endif
10082 PyErr_Format(PyExc_TypeError,
10083 "__%.4s__ returned non-%.4s (type %.200s)",
10084 type_name, type_name, Py_TYPE(result)->tp_name);
10085 Py_DECREF(result);
10086 return NULL;
10087 }
__Pyx_PyNumber_IntOrLong(PyObject * x)10088 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
10089 #if CYTHON_USE_TYPE_SLOTS
10090 PyNumberMethods *m;
10091 #endif
10092 const char *name = NULL;
10093 PyObject *res = NULL;
10094 #if PY_MAJOR_VERSION < 3
10095 if (likely(PyInt_Check(x) || PyLong_Check(x)))
10096 #else
10097 if (likely(PyLong_Check(x)))
10098 #endif
10099 return __Pyx_NewRef(x);
10100 #if CYTHON_USE_TYPE_SLOTS
10101 m = Py_TYPE(x)->tp_as_number;
10102 #if PY_MAJOR_VERSION < 3
10103 if (m && m->nb_int) {
10104 name = "int";
10105 res = m->nb_int(x);
10106 }
10107 else if (m && m->nb_long) {
10108 name = "long";
10109 res = m->nb_long(x);
10110 }
10111 #else
10112 if (likely(m && m->nb_int)) {
10113 name = "int";
10114 res = m->nb_int(x);
10115 }
10116 #endif
10117 #else
10118 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
10119 res = PyNumber_Int(x);
10120 }
10121 #endif
10122 if (likely(res)) {
10123 #if PY_MAJOR_VERSION < 3
10124 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
10125 #else
10126 if (unlikely(!PyLong_CheckExact(res))) {
10127 #endif
10128 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
10129 }
10130 }
10131 else if (!PyErr_Occurred()) {
10132 PyErr_SetString(PyExc_TypeError,
10133 "an integer is required");
10134 }
10135 return res;
10136 }
10137 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
10138 Py_ssize_t ival;
10139 PyObject *x;
10140 #if PY_MAJOR_VERSION < 3
10141 if (likely(PyInt_CheckExact(b))) {
10142 if (sizeof(Py_ssize_t) >= sizeof(long))
10143 return PyInt_AS_LONG(b);
10144 else
10145 return PyInt_AsSsize_t(b);
10146 }
10147 #endif
10148 if (likely(PyLong_CheckExact(b))) {
10149 #if CYTHON_USE_PYLONG_INTERNALS
10150 const digit* digits = ((PyLongObject*)b)->ob_digit;
10151 const Py_ssize_t size = Py_SIZE(b);
10152 if (likely(__Pyx_sst_abs(size) <= 1)) {
10153 ival = likely(size) ? digits[0] : 0;
10154 if (size == -1) ival = -ival;
10155 return ival;
10156 } else {
10157 switch (size) {
10158 case 2:
10159 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
10160 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
10161 }
10162 break;
10163 case -2:
10164 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
10165 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
10166 }
10167 break;
10168 case 3:
10169 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
10170 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
10171 }
10172 break;
10173 case -3:
10174 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
10175 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
10176 }
10177 break;
10178 case 4:
10179 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
10180 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]));
10181 }
10182 break;
10183 case -4:
10184 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
10185 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]));
10186 }
10187 break;
10188 }
10189 }
10190 #endif
10191 return PyLong_AsSsize_t(b);
10192 }
10193 x = PyNumber_Index(b);
10194 if (!x) return -1;
10195 ival = PyInt_AsSsize_t(x);
10196 Py_DECREF(x);
10197 return ival;
10198 }
10199 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
10200 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
10201 }
10202 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
10203 return PyInt_FromSize_t(ival);
10204 }
10205
10206
10207 #endif /* Py_PYTHON_H */
10208