CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hukaixuan19970627

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: hukaixuan19970627/yolov5_obb
Path: blob/master/DOTA_devkit/poly_nms_gpu/poly_overlaps.cpp
Views: 475
1
/* Generated by Cython 0.29.14 */
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_14"
11
#define CYTHON_HEX_VERSION 0x001D0EF0
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)
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>
298
void __Pyx_call_destructor(T& x) {
299
x.~T();
300
}
301
template<typename T>
302
class __Pyx_FakeReference {
303
public:
304
__Pyx_FakeReference() : ptr(NULL) { }
305
__Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
306
T *operator->() { return ptr; }
307
T *operator&() { return ptr; }
308
operator T&() { return *ptr; }
309
template<typename U> bool operator ==(U other) { return *ptr == 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;
398
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
399
*key = PyThread_create_key();
400
return 0;
401
}
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
}
407
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
408
PyObject_Free(key);
409
}
410
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
411
return *key != Py_tss_NEEDS_INIT;
412
}
413
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
414
PyThread_delete_key(*key);
415
*key = Py_tss_NEEDS_INIT;
416
}
417
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
418
return PyThread_set_key_value(*key, value);
419
}
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
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__poly_overlaps
608
#define __PYX_HAVE_API__poly_overlaps
609
/* Early includes */
610
#include <string.h>
611
#include <stdio.h>
612
#include "numpy/arrayobject.h"
613
#include "numpy/ufuncobject.h"
614
#include "poly_overlaps.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))) )
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)
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;
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;
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__ */
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
"poly_overlaps.pyx",
846
"__init__.pxd",
847
"type.pxd",
848
};
849
/* BufferFormatStructs.proto */
850
#define IS_UNSIGNED(type) (((type) -1) > 0)
851
struct __Pyx_StructField_;
852
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
853
typedef struct {
854
const char* name;
855
struct __Pyx_StructField_* fields;
856
size_t size;
857
size_t arraysize[8];
858
int ndim;
859
char typegroup;
860
char is_unsigned;
861
int flags;
862
} __Pyx_TypeInfo;
863
typedef struct __Pyx_StructField_ {
864
__Pyx_TypeInfo* type;
865
const char* name;
866
size_t offset;
867
} __Pyx_StructField;
868
typedef struct {
869
__Pyx_StructField* field;
870
size_t parent_offset;
871
} __Pyx_BufFmt_StackElem;
872
typedef struct {
873
__Pyx_StructField root;
874
__Pyx_BufFmt_StackElem* head;
875
size_t fmt_offset;
876
size_t new_count, enc_count;
877
size_t struct_alignment;
878
int is_complex;
879
char enc_type;
880
char new_packmode;
881
char enc_packmode;
882
char is_valid_array;
883
} __Pyx_BufFmt_Context;
884
885
886
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
887
* # in Cython to enable them only on the right systems.
888
*
889
* ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
890
* ctypedef npy_int16 int16_t
891
* ctypedef npy_int32 int32_t
892
*/
893
typedef npy_int8 __pyx_t_5numpy_int8_t;
894
895
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
896
*
897
* ctypedef npy_int8 int8_t
898
* ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
899
* ctypedef npy_int32 int32_t
900
* ctypedef npy_int64 int64_t
901
*/
902
typedef npy_int16 __pyx_t_5numpy_int16_t;
903
904
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":778
905
* ctypedef npy_int8 int8_t
906
* ctypedef npy_int16 int16_t
907
* ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
908
* ctypedef npy_int64 int64_t
909
* #ctypedef npy_int96 int96_t
910
*/
911
typedef npy_int32 __pyx_t_5numpy_int32_t;
912
913
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
914
* ctypedef npy_int16 int16_t
915
* ctypedef npy_int32 int32_t
916
* ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
917
* #ctypedef npy_int96 int96_t
918
* #ctypedef npy_int128 int128_t
919
*/
920
typedef npy_int64 __pyx_t_5numpy_int64_t;
921
922
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
923
* #ctypedef npy_int128 int128_t
924
*
925
* ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
926
* ctypedef npy_uint16 uint16_t
927
* ctypedef npy_uint32 uint32_t
928
*/
929
typedef npy_uint8 __pyx_t_5numpy_uint8_t;
930
931
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":784
932
*
933
* ctypedef npy_uint8 uint8_t
934
* ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
935
* ctypedef npy_uint32 uint32_t
936
* ctypedef npy_uint64 uint64_t
937
*/
938
typedef npy_uint16 __pyx_t_5numpy_uint16_t;
939
940
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
941
* ctypedef npy_uint8 uint8_t
942
* ctypedef npy_uint16 uint16_t
943
* ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
944
* ctypedef npy_uint64 uint64_t
945
* #ctypedef npy_uint96 uint96_t
946
*/
947
typedef npy_uint32 __pyx_t_5numpy_uint32_t;
948
949
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":786
950
* ctypedef npy_uint16 uint16_t
951
* ctypedef npy_uint32 uint32_t
952
* ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
953
* #ctypedef npy_uint96 uint96_t
954
* #ctypedef npy_uint128 uint128_t
955
*/
956
typedef npy_uint64 __pyx_t_5numpy_uint64_t;
957
958
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
959
* #ctypedef npy_uint128 uint128_t
960
*
961
* ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
962
* ctypedef npy_float64 float64_t
963
* #ctypedef npy_float80 float80_t
964
*/
965
typedef npy_float32 __pyx_t_5numpy_float32_t;
966
967
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
968
*
969
* ctypedef npy_float32 float32_t
970
* ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
971
* #ctypedef npy_float80 float80_t
972
* #ctypedef npy_float128 float128_t
973
*/
974
typedef npy_float64 __pyx_t_5numpy_float64_t;
975
976
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":800
977
* # The int types are mapped a bit surprising --
978
* # numpy.int corresponds to 'l' and numpy.long to 'q'
979
* ctypedef npy_long int_t # <<<<<<<<<<<<<<
980
* ctypedef npy_longlong long_t
981
* ctypedef npy_longlong longlong_t
982
*/
983
typedef npy_long __pyx_t_5numpy_int_t;
984
985
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
986
* # numpy.int corresponds to 'l' and numpy.long to 'q'
987
* ctypedef npy_long int_t
988
* ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
989
* ctypedef npy_longlong longlong_t
990
*
991
*/
992
typedef npy_longlong __pyx_t_5numpy_long_t;
993
994
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
995
* ctypedef npy_long int_t
996
* ctypedef npy_longlong long_t
997
* ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
998
*
999
* ctypedef npy_ulong uint_t
1000
*/
1001
typedef npy_longlong __pyx_t_5numpy_longlong_t;
1002
1003
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":804
1004
* ctypedef npy_longlong longlong_t
1005
*
1006
* ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1007
* ctypedef npy_ulonglong ulong_t
1008
* ctypedef npy_ulonglong ulonglong_t
1009
*/
1010
typedef npy_ulong __pyx_t_5numpy_uint_t;
1011
1012
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":805
1013
*
1014
* ctypedef npy_ulong uint_t
1015
* ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1016
* ctypedef npy_ulonglong ulonglong_t
1017
*
1018
*/
1019
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1020
1021
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":806
1022
* ctypedef npy_ulong uint_t
1023
* ctypedef npy_ulonglong ulong_t
1024
* ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1025
*
1026
* ctypedef npy_intp intp_t
1027
*/
1028
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1029
1030
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":808
1031
* ctypedef npy_ulonglong ulonglong_t
1032
*
1033
* ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1034
* ctypedef npy_uintp uintp_t
1035
*
1036
*/
1037
typedef npy_intp __pyx_t_5numpy_intp_t;
1038
1039
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":809
1040
*
1041
* ctypedef npy_intp intp_t
1042
* ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1043
*
1044
* ctypedef npy_double float_t
1045
*/
1046
typedef npy_uintp __pyx_t_5numpy_uintp_t;
1047
1048
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":811
1049
* ctypedef npy_uintp uintp_t
1050
*
1051
* ctypedef npy_double float_t # <<<<<<<<<<<<<<
1052
* ctypedef npy_double double_t
1053
* ctypedef npy_longdouble longdouble_t
1054
*/
1055
typedef npy_double __pyx_t_5numpy_float_t;
1056
1057
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":812
1058
*
1059
* ctypedef npy_double float_t
1060
* ctypedef npy_double double_t # <<<<<<<<<<<<<<
1061
* ctypedef npy_longdouble longdouble_t
1062
*
1063
*/
1064
typedef npy_double __pyx_t_5numpy_double_t;
1065
1066
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
1067
* ctypedef npy_double float_t
1068
* ctypedef npy_double double_t
1069
* ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1070
*
1071
* ctypedef npy_cfloat cfloat_t
1072
*/
1073
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1074
/* Declarations.proto */
1075
#if CYTHON_CCOMPLEX
1076
#ifdef __cplusplus
1077
typedef ::std::complex< float > __pyx_t_float_complex;
1078
#else
1079
typedef float _Complex __pyx_t_float_complex;
1080
#endif
1081
#else
1082
typedef struct { float real, imag; } __pyx_t_float_complex;
1083
#endif
1084
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1085
1086
/* Declarations.proto */
1087
#if CYTHON_CCOMPLEX
1088
#ifdef __cplusplus
1089
typedef ::std::complex< double > __pyx_t_double_complex;
1090
#else
1091
typedef double _Complex __pyx_t_double_complex;
1092
#endif
1093
#else
1094
typedef struct { double real, imag; } __pyx_t_double_complex;
1095
#endif
1096
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1097
1098
1099
/*--- Type declarations ---*/
1100
1101
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":815
1102
* ctypedef npy_longdouble longdouble_t
1103
*
1104
* ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1105
* ctypedef npy_cdouble cdouble_t
1106
* ctypedef npy_clongdouble clongdouble_t
1107
*/
1108
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1109
1110
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
1111
*
1112
* ctypedef npy_cfloat cfloat_t
1113
* ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1114
* ctypedef npy_clongdouble clongdouble_t
1115
*
1116
*/
1117
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1118
1119
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":817
1120
* ctypedef npy_cfloat cfloat_t
1121
* ctypedef npy_cdouble cdouble_t
1122
* ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1123
*
1124
* ctypedef npy_cdouble complex_t
1125
*/
1126
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1127
1128
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":819
1129
* ctypedef npy_clongdouble clongdouble_t
1130
*
1131
* ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1132
*
1133
* cdef inline object PyArray_MultiIterNew1(a):
1134
*/
1135
typedef npy_cdouble __pyx_t_5numpy_complex_t;
1136
1137
/* --- Runtime support code (head) --- */
1138
/* Refnanny.proto */
1139
#ifndef CYTHON_REFNANNY
1140
#define CYTHON_REFNANNY 0
1141
#endif
1142
#if CYTHON_REFNANNY
1143
typedef struct {
1144
void (*INCREF)(void*, PyObject*, int);
1145
void (*DECREF)(void*, PyObject*, int);
1146
void (*GOTREF)(void*, PyObject*, int);
1147
void (*GIVEREF)(void*, PyObject*, int);
1148
void* (*SetupContext)(const char*, int, const char*);
1149
void (*FinishContext)(void**);
1150
} __Pyx_RefNannyAPIStruct;
1151
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1152
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1153
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1154
#ifdef WITH_THREAD
1155
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
1156
if (acquire_gil) {\
1157
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1158
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1159
PyGILState_Release(__pyx_gilstate_save);\
1160
} else {\
1161
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1162
}
1163
#else
1164
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
1165
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1166
#endif
1167
#define __Pyx_RefNannyFinishContext()\
1168
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1169
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1170
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1171
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1172
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1173
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1174
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1175
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1176
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1177
#else
1178
#define __Pyx_RefNannyDeclarations
1179
#define __Pyx_RefNannySetupContext(name, acquire_gil)
1180
#define __Pyx_RefNannyFinishContext()
1181
#define __Pyx_INCREF(r) Py_INCREF(r)
1182
#define __Pyx_DECREF(r) Py_DECREF(r)
1183
#define __Pyx_GOTREF(r)
1184
#define __Pyx_GIVEREF(r)
1185
#define __Pyx_XINCREF(r) Py_XINCREF(r)
1186
#define __Pyx_XDECREF(r) Py_XDECREF(r)
1187
#define __Pyx_XGOTREF(r)
1188
#define __Pyx_XGIVEREF(r)
1189
#endif
1190
#define __Pyx_XDECREF_SET(r, v) do {\
1191
PyObject *tmp = (PyObject *) r;\
1192
r = v; __Pyx_XDECREF(tmp);\
1193
} while (0)
1194
#define __Pyx_DECREF_SET(r, v) do {\
1195
PyObject *tmp = (PyObject *) r;\
1196
r = v; __Pyx_DECREF(tmp);\
1197
} while (0)
1198
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1199
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1200
1201
/* RaiseArgTupleInvalid.proto */
1202
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1203
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1204
1205
/* RaiseDoubleKeywords.proto */
1206
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1207
1208
/* ParseKeywords.proto */
1209
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1210
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1211
const char* function_name);
1212
1213
/* ArgTypeTest.proto */
1214
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1215
((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1216
__Pyx__ArgTypeTest(obj, type, name, exact))
1217
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1218
1219
/* IsLittleEndian.proto */
1220
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1221
1222
/* BufferFormatCheck.proto */
1223
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1224
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1225
__Pyx_BufFmt_StackElem* stack,
1226
__Pyx_TypeInfo* type);
1227
1228
/* BufferGetAndValidate.proto */
1229
#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1230
((obj == Py_None || obj == NULL) ?\
1231
(__Pyx_ZeroBuffer(buf), 0) :\
1232
__Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1233
static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1234
__Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1235
static void __Pyx_ZeroBuffer(Py_buffer* buf);
1236
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1237
static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1238
static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1239
1240
/* PyObjectGetAttrStr.proto */
1241
#if CYTHON_USE_TYPE_SLOTS
1242
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1243
#else
1244
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1245
#endif
1246
1247
/* GetBuiltinName.proto */
1248
static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1249
1250
/* PyDictVersioning.proto */
1251
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1252
#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1253
#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1254
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1255
(version_var) = __PYX_GET_DICT_VERSION(dict);\
1256
(cache_var) = (value);
1257
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1258
static PY_UINT64_T __pyx_dict_version = 0;\
1259
static PyObject *__pyx_dict_cached_value = NULL;\
1260
if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1261
(VAR) = __pyx_dict_cached_value;\
1262
} else {\
1263
(VAR) = __pyx_dict_cached_value = (LOOKUP);\
1264
__pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1265
}\
1266
}
1267
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1268
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1269
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1270
#else
1271
#define __PYX_GET_DICT_VERSION(dict) (0)
1272
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1273
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1274
#endif
1275
1276
/* GetModuleGlobalName.proto */
1277
#if CYTHON_USE_DICT_VERSIONS
1278
#define __Pyx_GetModuleGlobalName(var, name) {\
1279
static PY_UINT64_T __pyx_dict_version = 0;\
1280
static PyObject *__pyx_dict_cached_value = NULL;\
1281
(var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1282
(likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1283
__Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1284
}
1285
#define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1286
PY_UINT64_T __pyx_dict_version;\
1287
PyObject *__pyx_dict_cached_value;\
1288
(var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1289
}
1290
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1291
#else
1292
#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1293
#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1294
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1295
#endif
1296
1297
/* PyObjectCall.proto */
1298
#if CYTHON_COMPILING_IN_CPYTHON
1299
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1300
#else
1301
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1302
#endif
1303
1304
/* ExtTypeTest.proto */
1305
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1306
1307
/* BufferIndexError.proto */
1308
static void __Pyx_RaiseBufferIndexError(int axis);
1309
1310
#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1311
/* PyThreadStateGet.proto */
1312
#if CYTHON_FAST_THREAD_STATE
1313
#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1314
#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1315
#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1316
#else
1317
#define __Pyx_PyThreadState_declare
1318
#define __Pyx_PyThreadState_assign
1319
#define __Pyx_PyErr_Occurred() PyErr_Occurred()
1320
#endif
1321
1322
/* PyErrFetchRestore.proto */
1323
#if CYTHON_FAST_THREAD_STATE
1324
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1325
#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1326
#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1327
#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1328
#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1329
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1330
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1331
#if CYTHON_COMPILING_IN_CPYTHON
1332
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1333
#else
1334
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1335
#endif
1336
#else
1337
#define __Pyx_PyErr_Clear() PyErr_Clear()
1338
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1339
#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1340
#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1341
#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1342
#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1343
#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1344
#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1345
#endif
1346
1347
/* RaiseException.proto */
1348
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1349
1350
/* PyCFunctionFastCall.proto */
1351
#if CYTHON_FAST_PYCCALL
1352
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1353
#else
1354
#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1355
#endif
1356
1357
/* PyFunctionFastCall.proto */
1358
#if CYTHON_FAST_PYCALL
1359
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
1360
__Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1361
#if 1 || PY_VERSION_HEX < 0x030600B1
1362
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1363
#else
1364
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1365
#endif
1366
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
1367
(sizeof(char [1 - 2*!(cond)]) - 1)
1368
#ifndef Py_MEMBER_SIZE
1369
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1370
#endif
1371
static size_t __pyx_pyframe_localsplus_offset = 0;
1372
#include "frameobject.h"
1373
#define __Pxy_PyFrame_Initialize_Offsets()\
1374
((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1375
(void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1376
#define __Pyx_PyFrame_GetLocalsplus(frame)\
1377
(assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1378
#endif
1379
1380
/* PyObjectCallMethO.proto */
1381
#if CYTHON_COMPILING_IN_CPYTHON
1382
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1383
#endif
1384
1385
/* PyObjectCallOneArg.proto */
1386
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1387
1388
/* DictGetItem.proto */
1389
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1390
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1391
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
1392
(likely(PyDict_CheckExact(obj)) ?\
1393
__Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1394
#else
1395
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1396
#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1397
#endif
1398
1399
/* RaiseTooManyValuesToUnpack.proto */
1400
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1401
1402
/* RaiseNeedMoreValuesToUnpack.proto */
1403
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1404
1405
/* RaiseNoneIterError.proto */
1406
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1407
1408
/* GetTopmostException.proto */
1409
#if CYTHON_USE_EXC_INFO_STACK
1410
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1411
#endif
1412
1413
/* SaveResetException.proto */
1414
#if CYTHON_FAST_THREAD_STATE
1415
#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1416
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1417
#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1418
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1419
#else
1420
#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1421
#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1422
#endif
1423
1424
/* PyErrExceptionMatches.proto */
1425
#if CYTHON_FAST_THREAD_STATE
1426
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1427
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1428
#else
1429
#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1430
#endif
1431
1432
/* GetException.proto */
1433
#if CYTHON_FAST_THREAD_STATE
1434
#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1435
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1436
#else
1437
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1438
#endif
1439
1440
/* TypeImport.proto */
1441
#ifndef __PYX_HAVE_RT_ImportType_proto
1442
#define __PYX_HAVE_RT_ImportType_proto
1443
enum __Pyx_ImportType_CheckSize {
1444
__Pyx_ImportType_CheckSize_Error = 0,
1445
__Pyx_ImportType_CheckSize_Warn = 1,
1446
__Pyx_ImportType_CheckSize_Ignore = 2
1447
};
1448
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1449
#endif
1450
1451
/* Import.proto */
1452
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1453
1454
/* CLineInTraceback.proto */
1455
#ifdef CYTHON_CLINE_IN_TRACEBACK
1456
#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1457
#else
1458
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1459
#endif
1460
1461
/* CodeObjectCache.proto */
1462
typedef struct {
1463
PyCodeObject* code_object;
1464
int code_line;
1465
} __Pyx_CodeObjectCacheEntry;
1466
struct __Pyx_CodeObjectCache {
1467
int count;
1468
int max_count;
1469
__Pyx_CodeObjectCacheEntry* entries;
1470
};
1471
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1472
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1473
static PyCodeObject *__pyx_find_code_object(int code_line);
1474
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1475
1476
/* AddTraceback.proto */
1477
static void __Pyx_AddTraceback(const char *funcname, int c_line,
1478
int py_line, const char *filename);
1479
1480
/* BufferStructDeclare.proto */
1481
typedef struct {
1482
Py_ssize_t shape, strides, suboffsets;
1483
} __Pyx_Buf_DimInfo;
1484
typedef struct {
1485
size_t refcount;
1486
Py_buffer pybuffer;
1487
} __Pyx_Buffer;
1488
typedef struct {
1489
__Pyx_Buffer *rcbuffer;
1490
char *data;
1491
__Pyx_Buf_DimInfo diminfo[8];
1492
} __Pyx_LocalBuf_ND;
1493
1494
#if PY_MAJOR_VERSION < 3
1495
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1496
static void __Pyx_ReleaseBuffer(Py_buffer *view);
1497
#else
1498
#define __Pyx_GetBuffer PyObject_GetBuffer
1499
#define __Pyx_ReleaseBuffer PyBuffer_Release
1500
#endif
1501
1502
1503
/* CIntToPy.proto */
1504
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1505
1506
/* RealImag.proto */
1507
#if CYTHON_CCOMPLEX
1508
#ifdef __cplusplus
1509
#define __Pyx_CREAL(z) ((z).real())
1510
#define __Pyx_CIMAG(z) ((z).imag())
1511
#else
1512
#define __Pyx_CREAL(z) (__real__(z))
1513
#define __Pyx_CIMAG(z) (__imag__(z))
1514
#endif
1515
#else
1516
#define __Pyx_CREAL(z) ((z).real)
1517
#define __Pyx_CIMAG(z) ((z).imag)
1518
#endif
1519
#if defined(__cplusplus) && CYTHON_CCOMPLEX\
1520
&& (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1521
#define __Pyx_SET_CREAL(z,x) ((z).real(x))
1522
#define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1523
#else
1524
#define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1525
#define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1526
#endif
1527
1528
/* Arithmetic.proto */
1529
#if CYTHON_CCOMPLEX
1530
#define __Pyx_c_eq_float(a, b) ((a)==(b))
1531
#define __Pyx_c_sum_float(a, b) ((a)+(b))
1532
#define __Pyx_c_diff_float(a, b) ((a)-(b))
1533
#define __Pyx_c_prod_float(a, b) ((a)*(b))
1534
#define __Pyx_c_quot_float(a, b) ((a)/(b))
1535
#define __Pyx_c_neg_float(a) (-(a))
1536
#ifdef __cplusplus
1537
#define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1538
#define __Pyx_c_conj_float(z) (::std::conj(z))
1539
#if 1
1540
#define __Pyx_c_abs_float(z) (::std::abs(z))
1541
#define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1542
#endif
1543
#else
1544
#define __Pyx_c_is_zero_float(z) ((z)==0)
1545
#define __Pyx_c_conj_float(z) (conjf(z))
1546
#if 1
1547
#define __Pyx_c_abs_float(z) (cabsf(z))
1548
#define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1549
#endif
1550
#endif
1551
#else
1552
static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1553
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1554
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1555
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1556
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1557
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1558
static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1559
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1560
#if 1
1561
static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1562
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1563
#endif
1564
#endif
1565
1566
/* Arithmetic.proto */
1567
#if CYTHON_CCOMPLEX
1568
#define __Pyx_c_eq_double(a, b) ((a)==(b))
1569
#define __Pyx_c_sum_double(a, b) ((a)+(b))
1570
#define __Pyx_c_diff_double(a, b) ((a)-(b))
1571
#define __Pyx_c_prod_double(a, b) ((a)*(b))
1572
#define __Pyx_c_quot_double(a, b) ((a)/(b))
1573
#define __Pyx_c_neg_double(a) (-(a))
1574
#ifdef __cplusplus
1575
#define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1576
#define __Pyx_c_conj_double(z) (::std::conj(z))
1577
#if 1
1578
#define __Pyx_c_abs_double(z) (::std::abs(z))
1579
#define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1580
#endif
1581
#else
1582
#define __Pyx_c_is_zero_double(z) ((z)==0)
1583
#define __Pyx_c_conj_double(z) (conj(z))
1584
#if 1
1585
#define __Pyx_c_abs_double(z) (cabs(z))
1586
#define __Pyx_c_pow_double(a, b) (cpow(a, b))
1587
#endif
1588
#endif
1589
#else
1590
static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1591
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1592
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1593
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1594
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1595
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1596
static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1597
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1598
#if 1
1599
static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1600
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1601
#endif
1602
#endif
1603
1604
/* CIntToPy.proto */
1605
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1606
1607
/* CIntFromPy.proto */
1608
static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *);
1609
1610
/* CIntFromPy.proto */
1611
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1612
1613
/* CIntToPy.proto */
1614
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1615
1616
/* CIntFromPy.proto */
1617
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1618
1619
/* FastTypeChecks.proto */
1620
#if CYTHON_COMPILING_IN_CPYTHON
1621
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1622
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1623
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1624
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1625
#else
1626
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1627
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1628
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1629
#endif
1630
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1631
1632
/* CheckBinaryVersion.proto */
1633
static int __Pyx_check_binary_version(void);
1634
1635
/* InitStrings.proto */
1636
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1637
1638
1639
/* Module declarations from 'cpython.buffer' */
1640
1641
/* Module declarations from 'libc.string' */
1642
1643
/* Module declarations from 'libc.stdio' */
1644
1645
/* Module declarations from '__builtin__' */
1646
1647
/* Module declarations from 'cpython.type' */
1648
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1649
1650
/* Module declarations from 'cpython' */
1651
1652
/* Module declarations from 'cpython.object' */
1653
1654
/* Module declarations from 'cpython.ref' */
1655
1656
/* Module declarations from 'cpython.mem' */
1657
1658
/* Module declarations from 'numpy' */
1659
1660
/* Module declarations from 'numpy' */
1661
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1662
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1663
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1664
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1665
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1666
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1667
1668
/* Module declarations from 'poly_overlaps' */
1669
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), { 0 }, 0, 'R', 0, 0 };
1670
#define __Pyx_MODULE_NAME "poly_overlaps"
1671
extern int __pyx_module_is_main_poly_overlaps;
1672
int __pyx_module_is_main_poly_overlaps = 0;
1673
1674
/* Implementation of 'poly_overlaps' */
1675
static PyObject *__pyx_builtin_ValueError;
1676
static PyObject *__pyx_builtin_range;
1677
static PyObject *__pyx_builtin_RuntimeError;
1678
static PyObject *__pyx_builtin_ImportError;
1679
static const char __pyx_k_K[] = "K";
1680
static const char __pyx_k_N[] = "N";
1681
static const char __pyx_k_np[] = "np";
1682
static const char __pyx_k_main[] = "__main__";
1683
static const char __pyx_k_name[] = "__name__";
1684
static const char __pyx_k_test[] = "__test__";
1685
static const char __pyx_k_boxes[] = "boxes";
1686
static const char __pyx_k_dtype[] = "dtype";
1687
static const char __pyx_k_numpy[] = "numpy";
1688
static const char __pyx_k_range[] = "range";
1689
static const char __pyx_k_zeros[] = "zeros";
1690
static const char __pyx_k_import[] = "__import__";
1691
static const char __pyx_k_float32[] = "float32";
1692
static const char __pyx_k_overlaps[] = "overlaps";
1693
static const char __pyx_k_device_id[] = "device_id";
1694
static const char __pyx_k_ValueError[] = "ValueError";
1695
static const char __pyx_k_ImportError[] = "ImportError";
1696
static const char __pyx_k_query_boxes[] = "query_boxes";
1697
static const char __pyx_k_RuntimeError[] = "RuntimeError";
1698
static const char __pyx_k_poly_overlaps[] = "poly_overlaps";
1699
static const char __pyx_k_poly_overlaps_pyx[] = "poly_overlaps.pyx";
1700
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1701
static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1702
static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1703
static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1704
static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1705
static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1706
static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1707
static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1708
static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1709
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1710
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1711
static PyObject *__pyx_n_s_ImportError;
1712
static PyObject *__pyx_n_s_K;
1713
static PyObject *__pyx_n_s_N;
1714
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1715
static PyObject *__pyx_n_s_RuntimeError;
1716
static PyObject *__pyx_n_s_ValueError;
1717
static PyObject *__pyx_n_s_boxes;
1718
static PyObject *__pyx_n_s_cline_in_traceback;
1719
static PyObject *__pyx_n_s_device_id;
1720
static PyObject *__pyx_n_s_dtype;
1721
static PyObject *__pyx_n_s_float32;
1722
static PyObject *__pyx_n_s_import;
1723
static PyObject *__pyx_n_s_main;
1724
static PyObject *__pyx_n_s_name;
1725
static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
1726
static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
1727
static PyObject *__pyx_n_s_np;
1728
static PyObject *__pyx_n_s_numpy;
1729
static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1730
static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1731
static PyObject *__pyx_n_s_overlaps;
1732
static PyObject *__pyx_n_s_poly_overlaps;
1733
static PyObject *__pyx_kp_s_poly_overlaps_pyx;
1734
static PyObject *__pyx_n_s_query_boxes;
1735
static PyObject *__pyx_n_s_range;
1736
static PyObject *__pyx_n_s_test;
1737
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
1738
static PyObject *__pyx_n_s_zeros;
1739
static PyObject *__pyx_pf_13poly_overlaps_poly_overlaps(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes, __pyx_t_5numpy_int32_t __pyx_v_device_id); /* proto */
1740
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
1741
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
1742
static PyObject *__pyx_tuple_;
1743
static PyObject *__pyx_tuple__2;
1744
static PyObject *__pyx_tuple__3;
1745
static PyObject *__pyx_tuple__4;
1746
static PyObject *__pyx_tuple__5;
1747
static PyObject *__pyx_tuple__6;
1748
static PyObject *__pyx_tuple__7;
1749
static PyObject *__pyx_tuple__8;
1750
static PyObject *__pyx_codeobj__9;
1751
/* Late includes */
1752
1753
/* "poly_overlaps.pyx":7
1754
* void _overlaps(np.float32_t*, np.float32_t*, np.float32_t*, int, int, int)
1755
*
1756
* def poly_overlaps (np.ndarray[np.float32_t, ndim=2] boxes, np.ndarray[np.float32_t, ndim=2] query_boxes, np.int32_t device_id=0): # <<<<<<<<<<<<<<
1757
* cdef int N = boxes.shape[0]
1758
* cdef int K = query_boxes.shape[0]
1759
*/
1760
1761
/* Python wrapper */
1762
static PyObject *__pyx_pw_13poly_overlaps_1poly_overlaps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1763
static PyMethodDef __pyx_mdef_13poly_overlaps_1poly_overlaps = {"poly_overlaps", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_13poly_overlaps_1poly_overlaps, METH_VARARGS|METH_KEYWORDS, 0};
1764
static PyObject *__pyx_pw_13poly_overlaps_1poly_overlaps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1765
PyArrayObject *__pyx_v_boxes = 0;
1766
PyArrayObject *__pyx_v_query_boxes = 0;
1767
__pyx_t_5numpy_int32_t __pyx_v_device_id;
1768
PyObject *__pyx_r = 0;
1769
__Pyx_RefNannyDeclarations
1770
__Pyx_RefNannySetupContext("poly_overlaps (wrapper)", 0);
1771
{
1772
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_boxes,&__pyx_n_s_query_boxes,&__pyx_n_s_device_id,0};
1773
PyObject* values[3] = {0,0,0};
1774
if (unlikely(__pyx_kwds)) {
1775
Py_ssize_t kw_args;
1776
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1777
switch (pos_args) {
1778
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1779
CYTHON_FALLTHROUGH;
1780
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1781
CYTHON_FALLTHROUGH;
1782
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1783
CYTHON_FALLTHROUGH;
1784
case 0: break;
1785
default: goto __pyx_L5_argtuple_error;
1786
}
1787
kw_args = PyDict_Size(__pyx_kwds);
1788
switch (pos_args) {
1789
case 0:
1790
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxes)) != 0)) kw_args--;
1791
else goto __pyx_L5_argtuple_error;
1792
CYTHON_FALLTHROUGH;
1793
case 1:
1794
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_query_boxes)) != 0)) kw_args--;
1795
else {
1796
__Pyx_RaiseArgtupleInvalid("poly_overlaps", 0, 2, 3, 1); __PYX_ERR(0, 7, __pyx_L3_error)
1797
}
1798
CYTHON_FALLTHROUGH;
1799
case 2:
1800
if (kw_args > 0) {
1801
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_device_id);
1802
if (value) { values[2] = value; kw_args--; }
1803
}
1804
}
1805
if (unlikely(kw_args > 0)) {
1806
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poly_overlaps") < 0)) __PYX_ERR(0, 7, __pyx_L3_error)
1807
}
1808
} else {
1809
switch (PyTuple_GET_SIZE(__pyx_args)) {
1810
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1811
CYTHON_FALLTHROUGH;
1812
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1813
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1814
break;
1815
default: goto __pyx_L5_argtuple_error;
1816
}
1817
}
1818
__pyx_v_boxes = ((PyArrayObject *)values[0]);
1819
__pyx_v_query_boxes = ((PyArrayObject *)values[1]);
1820
if (values[2]) {
1821
__pyx_v_device_id = __Pyx_PyInt_As_npy_int32(values[2]); if (unlikely((__pyx_v_device_id == ((npy_int32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 7, __pyx_L3_error)
1822
} else {
1823
__pyx_v_device_id = ((__pyx_t_5numpy_int32_t)0);
1824
}
1825
}
1826
goto __pyx_L4_argument_unpacking_done;
1827
__pyx_L5_argtuple_error:;
1828
__Pyx_RaiseArgtupleInvalid("poly_overlaps", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 7, __pyx_L3_error)
1829
__pyx_L3_error:;
1830
__Pyx_AddTraceback("poly_overlaps.poly_overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
1831
__Pyx_RefNannyFinishContext();
1832
return NULL;
1833
__pyx_L4_argument_unpacking_done:;
1834
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_boxes), __pyx_ptype_5numpy_ndarray, 1, "boxes", 0))) __PYX_ERR(0, 7, __pyx_L1_error)
1835
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query_boxes), __pyx_ptype_5numpy_ndarray, 1, "query_boxes", 0))) __PYX_ERR(0, 7, __pyx_L1_error)
1836
__pyx_r = __pyx_pf_13poly_overlaps_poly_overlaps(__pyx_self, __pyx_v_boxes, __pyx_v_query_boxes, __pyx_v_device_id);
1837
1838
/* function exit code */
1839
goto __pyx_L0;
1840
__pyx_L1_error:;
1841
__pyx_r = NULL;
1842
__pyx_L0:;
1843
__Pyx_RefNannyFinishContext();
1844
return __pyx_r;
1845
}
1846
1847
static PyObject *__pyx_pf_13poly_overlaps_poly_overlaps(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes, __pyx_t_5numpy_int32_t __pyx_v_device_id) {
1848
int __pyx_v_N;
1849
int __pyx_v_K;
1850
PyArrayObject *__pyx_v_overlaps = 0;
1851
__Pyx_LocalBuf_ND __pyx_pybuffernd_boxes;
1852
__Pyx_Buffer __pyx_pybuffer_boxes;
1853
__Pyx_LocalBuf_ND __pyx_pybuffernd_overlaps;
1854
__Pyx_Buffer __pyx_pybuffer_overlaps;
1855
__Pyx_LocalBuf_ND __pyx_pybuffernd_query_boxes;
1856
__Pyx_Buffer __pyx_pybuffer_query_boxes;
1857
PyObject *__pyx_r = NULL;
1858
__Pyx_RefNannyDeclarations
1859
PyObject *__pyx_t_1 = NULL;
1860
PyObject *__pyx_t_2 = NULL;
1861
PyObject *__pyx_t_3 = NULL;
1862
PyObject *__pyx_t_4 = NULL;
1863
PyObject *__pyx_t_5 = NULL;
1864
PyArrayObject *__pyx_t_6 = NULL;
1865
Py_ssize_t __pyx_t_7;
1866
Py_ssize_t __pyx_t_8;
1867
int __pyx_t_9;
1868
Py_ssize_t __pyx_t_10;
1869
Py_ssize_t __pyx_t_11;
1870
Py_ssize_t __pyx_t_12;
1871
Py_ssize_t __pyx_t_13;
1872
__Pyx_RefNannySetupContext("poly_overlaps", 0);
1873
__pyx_pybuffer_overlaps.pybuffer.buf = NULL;
1874
__pyx_pybuffer_overlaps.refcount = 0;
1875
__pyx_pybuffernd_overlaps.data = NULL;
1876
__pyx_pybuffernd_overlaps.rcbuffer = &__pyx_pybuffer_overlaps;
1877
__pyx_pybuffer_boxes.pybuffer.buf = NULL;
1878
__pyx_pybuffer_boxes.refcount = 0;
1879
__pyx_pybuffernd_boxes.data = NULL;
1880
__pyx_pybuffernd_boxes.rcbuffer = &__pyx_pybuffer_boxes;
1881
__pyx_pybuffer_query_boxes.pybuffer.buf = NULL;
1882
__pyx_pybuffer_query_boxes.refcount = 0;
1883
__pyx_pybuffernd_query_boxes.data = NULL;
1884
__pyx_pybuffernd_query_boxes.rcbuffer = &__pyx_pybuffer_query_boxes;
1885
{
1886
__Pyx_BufFmt_StackElem __pyx_stack[1];
1887
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_boxes, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 7, __pyx_L1_error)
1888
}
1889
__pyx_pybuffernd_boxes.diminfo[0].strides = __pyx_pybuffernd_boxes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_boxes.diminfo[0].shape = __pyx_pybuffernd_boxes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_boxes.diminfo[1].strides = __pyx_pybuffernd_boxes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_boxes.diminfo[1].shape = __pyx_pybuffernd_boxes.rcbuffer->pybuffer.shape[1];
1890
{
1891
__Pyx_BufFmt_StackElem __pyx_stack[1];
1892
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_query_boxes, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 7, __pyx_L1_error)
1893
}
1894
__pyx_pybuffernd_query_boxes.diminfo[0].strides = __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_query_boxes.diminfo[0].shape = __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_query_boxes.diminfo[1].strides = __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_query_boxes.diminfo[1].shape = __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.shape[1];
1895
1896
/* "poly_overlaps.pyx":8
1897
*
1898
* def poly_overlaps (np.ndarray[np.float32_t, ndim=2] boxes, np.ndarray[np.float32_t, ndim=2] query_boxes, np.int32_t device_id=0):
1899
* cdef int N = boxes.shape[0] # <<<<<<<<<<<<<<
1900
* cdef int K = query_boxes.shape[0]
1901
* cdef np.ndarray[np.float32_t, ndim=2] overlaps = np.zeros((N, K), dtype = np.float32)
1902
*/
1903
__pyx_v_N = (__pyx_v_boxes->dimensions[0]);
1904
1905
/* "poly_overlaps.pyx":9
1906
* def poly_overlaps (np.ndarray[np.float32_t, ndim=2] boxes, np.ndarray[np.float32_t, ndim=2] query_boxes, np.int32_t device_id=0):
1907
* cdef int N = boxes.shape[0]
1908
* cdef int K = query_boxes.shape[0] # <<<<<<<<<<<<<<
1909
* cdef np.ndarray[np.float32_t, ndim=2] overlaps = np.zeros((N, K), dtype = np.float32)
1910
* _overlaps(&overlaps[0, 0], &boxes[0, 0], &query_boxes[0, 0], N, K, device_id)
1911
*/
1912
__pyx_v_K = (__pyx_v_query_boxes->dimensions[0]);
1913
1914
/* "poly_overlaps.pyx":10
1915
* cdef int N = boxes.shape[0]
1916
* cdef int K = query_boxes.shape[0]
1917
* cdef np.ndarray[np.float32_t, ndim=2] overlaps = np.zeros((N, K), dtype = np.float32) # <<<<<<<<<<<<<<
1918
* _overlaps(&overlaps[0, 0], &boxes[0, 0], &query_boxes[0, 0], N, K, device_id)
1919
* return overlaps
1920
*/
1921
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
1922
__Pyx_GOTREF(__pyx_t_1);
1923
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
1924
__Pyx_GOTREF(__pyx_t_2);
1925
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1926
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
1927
__Pyx_GOTREF(__pyx_t_1);
1928
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_K); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error)
1929
__Pyx_GOTREF(__pyx_t_3);
1930
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 10, __pyx_L1_error)
1931
__Pyx_GOTREF(__pyx_t_4);
1932
__Pyx_GIVEREF(__pyx_t_1);
1933
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
1934
__Pyx_GIVEREF(__pyx_t_3);
1935
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
1936
__pyx_t_1 = 0;
1937
__pyx_t_3 = 0;
1938
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error)
1939
__Pyx_GOTREF(__pyx_t_3);
1940
__Pyx_GIVEREF(__pyx_t_4);
1941
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
1942
__pyx_t_4 = 0;
1943
__pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 10, __pyx_L1_error)
1944
__Pyx_GOTREF(__pyx_t_4);
1945
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
1946
__Pyx_GOTREF(__pyx_t_1);
1947
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 10, __pyx_L1_error)
1948
__Pyx_GOTREF(__pyx_t_5);
1949
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1950
if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
1951
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1952
__pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 10, __pyx_L1_error)
1953
__Pyx_GOTREF(__pyx_t_5);
1954
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1955
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1956
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1957
if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 10, __pyx_L1_error)
1958
__pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
1959
{
1960
__Pyx_BufFmt_StackElem __pyx_stack[1];
1961
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
1962
__pyx_v_overlaps = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.buf = NULL;
1963
__PYX_ERR(0, 10, __pyx_L1_error)
1964
} else {__pyx_pybuffernd_overlaps.diminfo[0].strides = __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_overlaps.diminfo[0].shape = __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_overlaps.diminfo[1].strides = __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_overlaps.diminfo[1].shape = __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.shape[1];
1965
}
1966
}
1967
__pyx_t_6 = 0;
1968
__pyx_v_overlaps = ((PyArrayObject *)__pyx_t_5);
1969
__pyx_t_5 = 0;
1970
1971
/* "poly_overlaps.pyx":11
1972
* cdef int K = query_boxes.shape[0]
1973
* cdef np.ndarray[np.float32_t, ndim=2] overlaps = np.zeros((N, K), dtype = np.float32)
1974
* _overlaps(&overlaps[0, 0], &boxes[0, 0], &query_boxes[0, 0], N, K, device_id) # <<<<<<<<<<<<<<
1975
* return overlaps
1976
*
1977
*/
1978
__pyx_t_7 = 0;
1979
__pyx_t_8 = 0;
1980
__pyx_t_9 = -1;
1981
if (__pyx_t_7 < 0) {
1982
__pyx_t_7 += __pyx_pybuffernd_overlaps.diminfo[0].shape;
1983
if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
1984
} else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_overlaps.diminfo[0].shape)) __pyx_t_9 = 0;
1985
if (__pyx_t_8 < 0) {
1986
__pyx_t_8 += __pyx_pybuffernd_overlaps.diminfo[1].shape;
1987
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
1988
} else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_overlaps.diminfo[1].shape)) __pyx_t_9 = 1;
1989
if (unlikely(__pyx_t_9 != -1)) {
1990
__Pyx_RaiseBufferIndexError(__pyx_t_9);
1991
__PYX_ERR(0, 11, __pyx_L1_error)
1992
}
1993
__pyx_t_10 = 0;
1994
__pyx_t_11 = 0;
1995
__pyx_t_9 = -1;
1996
if (__pyx_t_10 < 0) {
1997
__pyx_t_10 += __pyx_pybuffernd_boxes.diminfo[0].shape;
1998
if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
1999
} else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_9 = 0;
2000
if (__pyx_t_11 < 0) {
2001
__pyx_t_11 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2002
if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
2003
} else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_9 = 1;
2004
if (unlikely(__pyx_t_9 != -1)) {
2005
__Pyx_RaiseBufferIndexError(__pyx_t_9);
2006
__PYX_ERR(0, 11, __pyx_L1_error)
2007
}
2008
__pyx_t_12 = 0;
2009
__pyx_t_13 = 0;
2010
__pyx_t_9 = -1;
2011
if (__pyx_t_12 < 0) {
2012
__pyx_t_12 += __pyx_pybuffernd_query_boxes.diminfo[0].shape;
2013
if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
2014
} else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_9 = 0;
2015
if (__pyx_t_13 < 0) {
2016
__pyx_t_13 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
2017
if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
2018
} else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_9 = 1;
2019
if (unlikely(__pyx_t_9 != -1)) {
2020
__Pyx_RaiseBufferIndexError(__pyx_t_9);
2021
__PYX_ERR(0, 11, __pyx_L1_error)
2022
}
2023
_overlaps((&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_overlaps.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_overlaps.diminfo[1].strides))), (&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_boxes.diminfo[1].strides))), (&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_query_boxes.diminfo[1].strides))), __pyx_v_N, __pyx_v_K, __pyx_v_device_id);
2024
2025
/* "poly_overlaps.pyx":12
2026
* cdef np.ndarray[np.float32_t, ndim=2] overlaps = np.zeros((N, K), dtype = np.float32)
2027
* _overlaps(&overlaps[0, 0], &boxes[0, 0], &query_boxes[0, 0], N, K, device_id)
2028
* return overlaps # <<<<<<<<<<<<<<
2029
*
2030
*
2031
*/
2032
__Pyx_XDECREF(__pyx_r);
2033
__Pyx_INCREF(((PyObject *)__pyx_v_overlaps));
2034
__pyx_r = ((PyObject *)__pyx_v_overlaps);
2035
goto __pyx_L0;
2036
2037
/* "poly_overlaps.pyx":7
2038
* void _overlaps(np.float32_t*, np.float32_t*, np.float32_t*, int, int, int)
2039
*
2040
* def poly_overlaps (np.ndarray[np.float32_t, ndim=2] boxes, np.ndarray[np.float32_t, ndim=2] query_boxes, np.int32_t device_id=0): # <<<<<<<<<<<<<<
2041
* cdef int N = boxes.shape[0]
2042
* cdef int K = query_boxes.shape[0]
2043
*/
2044
2045
/* function exit code */
2046
__pyx_L1_error:;
2047
__Pyx_XDECREF(__pyx_t_1);
2048
__Pyx_XDECREF(__pyx_t_2);
2049
__Pyx_XDECREF(__pyx_t_3);
2050
__Pyx_XDECREF(__pyx_t_4);
2051
__Pyx_XDECREF(__pyx_t_5);
2052
{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2053
__Pyx_PyThreadState_declare
2054
__Pyx_PyThreadState_assign
2055
__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2056
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
2057
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer);
2058
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
2059
__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2060
__Pyx_AddTraceback("poly_overlaps.poly_overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
2061
__pyx_r = NULL;
2062
goto __pyx_L2;
2063
__pyx_L0:;
2064
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
2065
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer);
2066
__Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
2067
__pyx_L2:;
2068
__Pyx_XDECREF((PyObject *)__pyx_v_overlaps);
2069
__Pyx_XGIVEREF(__pyx_r);
2070
__Pyx_RefNannyFinishContext();
2071
return __pyx_r;
2072
}
2073
2074
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
2075
* # experimental exception made for __getbuffer__ and __releasebuffer__
2076
* # -- the details of this may change.
2077
* def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
2078
* # This implementation of getbuffer is geared towards Cython
2079
* # requirements, and does not yet fulfill the PEP.
2080
*/
2081
2082
/* Python wrapper */
2083
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
2084
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
2085
int __pyx_r;
2086
__Pyx_RefNannyDeclarations
2087
__Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
2088
__pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
2089
2090
/* function exit code */
2091
__Pyx_RefNannyFinishContext();
2092
return __pyx_r;
2093
}
2094
2095
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
2096
int __pyx_v_i;
2097
int __pyx_v_ndim;
2098
int __pyx_v_endian_detector;
2099
int __pyx_v_little_endian;
2100
int __pyx_v_t;
2101
char *__pyx_v_f;
2102
PyArray_Descr *__pyx_v_descr = 0;
2103
int __pyx_v_offset;
2104
int __pyx_r;
2105
__Pyx_RefNannyDeclarations
2106
int __pyx_t_1;
2107
int __pyx_t_2;
2108
PyObject *__pyx_t_3 = NULL;
2109
int __pyx_t_4;
2110
int __pyx_t_5;
2111
int __pyx_t_6;
2112
PyArray_Descr *__pyx_t_7;
2113
PyObject *__pyx_t_8 = NULL;
2114
char *__pyx_t_9;
2115
if (__pyx_v_info == NULL) {
2116
PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
2117
return -1;
2118
}
2119
__Pyx_RefNannySetupContext("__getbuffer__", 0);
2120
__pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
2121
__Pyx_GIVEREF(__pyx_v_info->obj);
2122
2123
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
2124
*
2125
* cdef int i, ndim
2126
* cdef int endian_detector = 1 # <<<<<<<<<<<<<<
2127
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
2128
*
2129
*/
2130
__pyx_v_endian_detector = 1;
2131
2132
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
2133
* cdef int i, ndim
2134
* cdef int endian_detector = 1
2135
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
2136
*
2137
* ndim = PyArray_NDIM(self)
2138
*/
2139
__pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
2140
2141
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
2142
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
2143
*
2144
* ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
2145
*
2146
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
2147
*/
2148
__pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
2149
2150
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
2151
* ndim = PyArray_NDIM(self)
2152
*
2153
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
2154
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
2155
* raise ValueError(u"ndarray is not C contiguous")
2156
*/
2157
__pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
2158
if (__pyx_t_2) {
2159
} else {
2160
__pyx_t_1 = __pyx_t_2;
2161
goto __pyx_L4_bool_binop_done;
2162
}
2163
2164
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
2165
*
2166
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
2167
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
2168
* raise ValueError(u"ndarray is not C contiguous")
2169
*
2170
*/
2171
__pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
2172
__pyx_t_1 = __pyx_t_2;
2173
__pyx_L4_bool_binop_done:;
2174
2175
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
2176
* ndim = PyArray_NDIM(self)
2177
*
2178
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
2179
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
2180
* raise ValueError(u"ndarray is not C contiguous")
2181
*/
2182
if (unlikely(__pyx_t_1)) {
2183
2184
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
2185
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
2186
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
2187
* raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
2188
*
2189
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
2190
*/
2191
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error)
2192
__Pyx_GOTREF(__pyx_t_3);
2193
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
2194
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2195
__PYX_ERR(1, 272, __pyx_L1_error)
2196
2197
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
2198
* ndim = PyArray_NDIM(self)
2199
*
2200
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
2201
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
2202
* raise ValueError(u"ndarray is not C contiguous")
2203
*/
2204
}
2205
2206
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
2207
* raise ValueError(u"ndarray is not C contiguous")
2208
*
2209
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
2210
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
2211
* raise ValueError(u"ndarray is not Fortran contiguous")
2212
*/
2213
__pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
2214
if (__pyx_t_2) {
2215
} else {
2216
__pyx_t_1 = __pyx_t_2;
2217
goto __pyx_L7_bool_binop_done;
2218
}
2219
2220
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
2221
*
2222
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
2223
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
2224
* raise ValueError(u"ndarray is not Fortran contiguous")
2225
*
2226
*/
2227
__pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
2228
__pyx_t_1 = __pyx_t_2;
2229
__pyx_L7_bool_binop_done:;
2230
2231
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
2232
* raise ValueError(u"ndarray is not C contiguous")
2233
*
2234
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
2235
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
2236
* raise ValueError(u"ndarray is not Fortran contiguous")
2237
*/
2238
if (unlikely(__pyx_t_1)) {
2239
2240
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
2241
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
2242
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
2243
* raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
2244
*
2245
* info.buf = PyArray_DATA(self)
2246
*/
2247
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error)
2248
__Pyx_GOTREF(__pyx_t_3);
2249
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
2250
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2251
__PYX_ERR(1, 276, __pyx_L1_error)
2252
2253
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
2254
* raise ValueError(u"ndarray is not C contiguous")
2255
*
2256
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
2257
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
2258
* raise ValueError(u"ndarray is not Fortran contiguous")
2259
*/
2260
}
2261
2262
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
2263
* raise ValueError(u"ndarray is not Fortran contiguous")
2264
*
2265
* info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
2266
* info.ndim = ndim
2267
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
2268
*/
2269
__pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
2270
2271
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
2272
*
2273
* info.buf = PyArray_DATA(self)
2274
* info.ndim = ndim # <<<<<<<<<<<<<<
2275
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
2276
* # Allocate new buffer for strides and shape info.
2277
*/
2278
__pyx_v_info->ndim = __pyx_v_ndim;
2279
2280
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
2281
* info.buf = PyArray_DATA(self)
2282
* info.ndim = ndim
2283
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
2284
* # Allocate new buffer for strides and shape info.
2285
* # This is allocated as one block, strides first.
2286
*/
2287
__pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
2288
if (__pyx_t_1) {
2289
2290
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
2291
* # Allocate new buffer for strides and shape info.
2292
* # This is allocated as one block, strides first.
2293
* info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim) # <<<<<<<<<<<<<<
2294
* info.shape = info.strides + ndim
2295
* for i in range(ndim):
2296
*/
2297
__pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
2298
2299
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":284
2300
* # This is allocated as one block, strides first.
2301
* info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
2302
* info.shape = info.strides + ndim # <<<<<<<<<<<<<<
2303
* for i in range(ndim):
2304
* info.strides[i] = PyArray_STRIDES(self)[i]
2305
*/
2306
__pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
2307
2308
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
2309
* info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
2310
* info.shape = info.strides + ndim
2311
* for i in range(ndim): # <<<<<<<<<<<<<<
2312
* info.strides[i] = PyArray_STRIDES(self)[i]
2313
* info.shape[i] = PyArray_DIMS(self)[i]
2314
*/
2315
__pyx_t_4 = __pyx_v_ndim;
2316
__pyx_t_5 = __pyx_t_4;
2317
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
2318
__pyx_v_i = __pyx_t_6;
2319
2320
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":286
2321
* info.shape = info.strides + ndim
2322
* for i in range(ndim):
2323
* info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
2324
* info.shape[i] = PyArray_DIMS(self)[i]
2325
* else:
2326
*/
2327
(__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
2328
2329
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":287
2330
* for i in range(ndim):
2331
* info.strides[i] = PyArray_STRIDES(self)[i]
2332
* info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
2333
* else:
2334
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
2335
*/
2336
(__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
2337
}
2338
2339
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
2340
* info.buf = PyArray_DATA(self)
2341
* info.ndim = ndim
2342
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
2343
* # Allocate new buffer for strides and shape info.
2344
* # This is allocated as one block, strides first.
2345
*/
2346
goto __pyx_L9;
2347
}
2348
2349
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":289
2350
* info.shape[i] = PyArray_DIMS(self)[i]
2351
* else:
2352
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
2353
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
2354
* info.suboffsets = NULL
2355
*/
2356
/*else*/ {
2357
__pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
2358
2359
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
2360
* else:
2361
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
2362
* info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
2363
* info.suboffsets = NULL
2364
* info.itemsize = PyArray_ITEMSIZE(self)
2365
*/
2366
__pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
2367
}
2368
__pyx_L9:;
2369
2370
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
2371
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
2372
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
2373
* info.suboffsets = NULL # <<<<<<<<<<<<<<
2374
* info.itemsize = PyArray_ITEMSIZE(self)
2375
* info.readonly = not PyArray_ISWRITEABLE(self)
2376
*/
2377
__pyx_v_info->suboffsets = NULL;
2378
2379
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
2380
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
2381
* info.suboffsets = NULL
2382
* info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
2383
* info.readonly = not PyArray_ISWRITEABLE(self)
2384
*
2385
*/
2386
__pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
2387
2388
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
2389
* info.suboffsets = NULL
2390
* info.itemsize = PyArray_ITEMSIZE(self)
2391
* info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
2392
*
2393
* cdef int t
2394
*/
2395
__pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
2396
2397
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":296
2398
*
2399
* cdef int t
2400
* cdef char* f = NULL # <<<<<<<<<<<<<<
2401
* cdef dtype descr = <dtype>PyArray_DESCR(self)
2402
* cdef int offset
2403
*/
2404
__pyx_v_f = NULL;
2405
2406
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":297
2407
* cdef int t
2408
* cdef char* f = NULL
2409
* cdef dtype descr = <dtype>PyArray_DESCR(self) # <<<<<<<<<<<<<<
2410
* cdef int offset
2411
*
2412
*/
2413
__pyx_t_7 = PyArray_DESCR(__pyx_v_self);
2414
__pyx_t_3 = ((PyObject *)__pyx_t_7);
2415
__Pyx_INCREF(__pyx_t_3);
2416
__pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
2417
__pyx_t_3 = 0;
2418
2419
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":300
2420
* cdef int offset
2421
*
2422
* info.obj = self # <<<<<<<<<<<<<<
2423
*
2424
* if not PyDataType_HASFIELDS(descr):
2425
*/
2426
__Pyx_INCREF(((PyObject *)__pyx_v_self));
2427
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
2428
__Pyx_GOTREF(__pyx_v_info->obj);
2429
__Pyx_DECREF(__pyx_v_info->obj);
2430
__pyx_v_info->obj = ((PyObject *)__pyx_v_self);
2431
2432
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":302
2433
* info.obj = self
2434
*
2435
* if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
2436
* t = descr.type_num
2437
* if ((descr.byteorder == c'>' and little_endian) or
2438
*/
2439
__pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
2440
if (__pyx_t_1) {
2441
2442
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":303
2443
*
2444
* if not PyDataType_HASFIELDS(descr):
2445
* t = descr.type_num # <<<<<<<<<<<<<<
2446
* if ((descr.byteorder == c'>' and little_endian) or
2447
* (descr.byteorder == c'<' and not little_endian)):
2448
*/
2449
__pyx_t_4 = __pyx_v_descr->type_num;
2450
__pyx_v_t = __pyx_t_4;
2451
2452
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
2453
* if not PyDataType_HASFIELDS(descr):
2454
* t = descr.type_num
2455
* if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
2456
* (descr.byteorder == c'<' and not little_endian)):
2457
* raise ValueError(u"Non-native byte order not supported")
2458
*/
2459
__pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
2460
if (!__pyx_t_2) {
2461
goto __pyx_L15_next_or;
2462
} else {
2463
}
2464
__pyx_t_2 = (__pyx_v_little_endian != 0);
2465
if (!__pyx_t_2) {
2466
} else {
2467
__pyx_t_1 = __pyx_t_2;
2468
goto __pyx_L14_bool_binop_done;
2469
}
2470
__pyx_L15_next_or:;
2471
2472
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":305
2473
* t = descr.type_num
2474
* if ((descr.byteorder == c'>' and little_endian) or
2475
* (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
2476
* raise ValueError(u"Non-native byte order not supported")
2477
* if t == NPY_BYTE: f = "b"
2478
*/
2479
__pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
2480
if (__pyx_t_2) {
2481
} else {
2482
__pyx_t_1 = __pyx_t_2;
2483
goto __pyx_L14_bool_binop_done;
2484
}
2485
__pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
2486
__pyx_t_1 = __pyx_t_2;
2487
__pyx_L14_bool_binop_done:;
2488
2489
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
2490
* if not PyDataType_HASFIELDS(descr):
2491
* t = descr.type_num
2492
* if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
2493
* (descr.byteorder == c'<' and not little_endian)):
2494
* raise ValueError(u"Non-native byte order not supported")
2495
*/
2496
if (unlikely(__pyx_t_1)) {
2497
2498
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":306
2499
* if ((descr.byteorder == c'>' and little_endian) or
2500
* (descr.byteorder == c'<' and not little_endian)):
2501
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
2502
* if t == NPY_BYTE: f = "b"
2503
* elif t == NPY_UBYTE: f = "B"
2504
*/
2505
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error)
2506
__Pyx_GOTREF(__pyx_t_3);
2507
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
2508
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2509
__PYX_ERR(1, 306, __pyx_L1_error)
2510
2511
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
2512
* if not PyDataType_HASFIELDS(descr):
2513
* t = descr.type_num
2514
* if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
2515
* (descr.byteorder == c'<' and not little_endian)):
2516
* raise ValueError(u"Non-native byte order not supported")
2517
*/
2518
}
2519
2520
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":307
2521
* (descr.byteorder == c'<' and not little_endian)):
2522
* raise ValueError(u"Non-native byte order not supported")
2523
* if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
2524
* elif t == NPY_UBYTE: f = "B"
2525
* elif t == NPY_SHORT: f = "h"
2526
*/
2527
switch (__pyx_v_t) {
2528
case NPY_BYTE:
2529
__pyx_v_f = ((char *)"b");
2530
break;
2531
case NPY_UBYTE:
2532
2533
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":308
2534
* raise ValueError(u"Non-native byte order not supported")
2535
* if t == NPY_BYTE: f = "b"
2536
* elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
2537
* elif t == NPY_SHORT: f = "h"
2538
* elif t == NPY_USHORT: f = "H"
2539
*/
2540
__pyx_v_f = ((char *)"B");
2541
break;
2542
case NPY_SHORT:
2543
2544
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":309
2545
* if t == NPY_BYTE: f = "b"
2546
* elif t == NPY_UBYTE: f = "B"
2547
* elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
2548
* elif t == NPY_USHORT: f = "H"
2549
* elif t == NPY_INT: f = "i"
2550
*/
2551
__pyx_v_f = ((char *)"h");
2552
break;
2553
case NPY_USHORT:
2554
2555
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":310
2556
* elif t == NPY_UBYTE: f = "B"
2557
* elif t == NPY_SHORT: f = "h"
2558
* elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
2559
* elif t == NPY_INT: f = "i"
2560
* elif t == NPY_UINT: f = "I"
2561
*/
2562
__pyx_v_f = ((char *)"H");
2563
break;
2564
case NPY_INT:
2565
2566
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":311
2567
* elif t == NPY_SHORT: f = "h"
2568
* elif t == NPY_USHORT: f = "H"
2569
* elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
2570
* elif t == NPY_UINT: f = "I"
2571
* elif t == NPY_LONG: f = "l"
2572
*/
2573
__pyx_v_f = ((char *)"i");
2574
break;
2575
case NPY_UINT:
2576
2577
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":312
2578
* elif t == NPY_USHORT: f = "H"
2579
* elif t == NPY_INT: f = "i"
2580
* elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
2581
* elif t == NPY_LONG: f = "l"
2582
* elif t == NPY_ULONG: f = "L"
2583
*/
2584
__pyx_v_f = ((char *)"I");
2585
break;
2586
case NPY_LONG:
2587
2588
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":313
2589
* elif t == NPY_INT: f = "i"
2590
* elif t == NPY_UINT: f = "I"
2591
* elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
2592
* elif t == NPY_ULONG: f = "L"
2593
* elif t == NPY_LONGLONG: f = "q"
2594
*/
2595
__pyx_v_f = ((char *)"l");
2596
break;
2597
case NPY_ULONG:
2598
2599
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":314
2600
* elif t == NPY_UINT: f = "I"
2601
* elif t == NPY_LONG: f = "l"
2602
* elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
2603
* elif t == NPY_LONGLONG: f = "q"
2604
* elif t == NPY_ULONGLONG: f = "Q"
2605
*/
2606
__pyx_v_f = ((char *)"L");
2607
break;
2608
case NPY_LONGLONG:
2609
2610
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":315
2611
* elif t == NPY_LONG: f = "l"
2612
* elif t == NPY_ULONG: f = "L"
2613
* elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
2614
* elif t == NPY_ULONGLONG: f = "Q"
2615
* elif t == NPY_FLOAT: f = "f"
2616
*/
2617
__pyx_v_f = ((char *)"q");
2618
break;
2619
case NPY_ULONGLONG:
2620
2621
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":316
2622
* elif t == NPY_ULONG: f = "L"
2623
* elif t == NPY_LONGLONG: f = "q"
2624
* elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
2625
* elif t == NPY_FLOAT: f = "f"
2626
* elif t == NPY_DOUBLE: f = "d"
2627
*/
2628
__pyx_v_f = ((char *)"Q");
2629
break;
2630
case NPY_FLOAT:
2631
2632
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":317
2633
* elif t == NPY_LONGLONG: f = "q"
2634
* elif t == NPY_ULONGLONG: f = "Q"
2635
* elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
2636
* elif t == NPY_DOUBLE: f = "d"
2637
* elif t == NPY_LONGDOUBLE: f = "g"
2638
*/
2639
__pyx_v_f = ((char *)"f");
2640
break;
2641
case NPY_DOUBLE:
2642
2643
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":318
2644
* elif t == NPY_ULONGLONG: f = "Q"
2645
* elif t == NPY_FLOAT: f = "f"
2646
* elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
2647
* elif t == NPY_LONGDOUBLE: f = "g"
2648
* elif t == NPY_CFLOAT: f = "Zf"
2649
*/
2650
__pyx_v_f = ((char *)"d");
2651
break;
2652
case NPY_LONGDOUBLE:
2653
2654
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":319
2655
* elif t == NPY_FLOAT: f = "f"
2656
* elif t == NPY_DOUBLE: f = "d"
2657
* elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
2658
* elif t == NPY_CFLOAT: f = "Zf"
2659
* elif t == NPY_CDOUBLE: f = "Zd"
2660
*/
2661
__pyx_v_f = ((char *)"g");
2662
break;
2663
case NPY_CFLOAT:
2664
2665
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":320
2666
* elif t == NPY_DOUBLE: f = "d"
2667
* elif t == NPY_LONGDOUBLE: f = "g"
2668
* elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
2669
* elif t == NPY_CDOUBLE: f = "Zd"
2670
* elif t == NPY_CLONGDOUBLE: f = "Zg"
2671
*/
2672
__pyx_v_f = ((char *)"Zf");
2673
break;
2674
case NPY_CDOUBLE:
2675
2676
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":321
2677
* elif t == NPY_LONGDOUBLE: f = "g"
2678
* elif t == NPY_CFLOAT: f = "Zf"
2679
* elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
2680
* elif t == NPY_CLONGDOUBLE: f = "Zg"
2681
* elif t == NPY_OBJECT: f = "O"
2682
*/
2683
__pyx_v_f = ((char *)"Zd");
2684
break;
2685
case NPY_CLONGDOUBLE:
2686
2687
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":322
2688
* elif t == NPY_CFLOAT: f = "Zf"
2689
* elif t == NPY_CDOUBLE: f = "Zd"
2690
* elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
2691
* elif t == NPY_OBJECT: f = "O"
2692
* else:
2693
*/
2694
__pyx_v_f = ((char *)"Zg");
2695
break;
2696
case NPY_OBJECT:
2697
2698
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":323
2699
* elif t == NPY_CDOUBLE: f = "Zd"
2700
* elif t == NPY_CLONGDOUBLE: f = "Zg"
2701
* elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
2702
* else:
2703
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
2704
*/
2705
__pyx_v_f = ((char *)"O");
2706
break;
2707
default:
2708
2709
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":325
2710
* elif t == NPY_OBJECT: f = "O"
2711
* else:
2712
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
2713
* info.format = f
2714
* return
2715
*/
2716
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
2717
__Pyx_GOTREF(__pyx_t_3);
2718
__pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error)
2719
__Pyx_GOTREF(__pyx_t_8);
2720
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2721
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
2722
__Pyx_GOTREF(__pyx_t_3);
2723
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2724
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
2725
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2726
__PYX_ERR(1, 325, __pyx_L1_error)
2727
break;
2728
}
2729
2730
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":326
2731
* else:
2732
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
2733
* info.format = f # <<<<<<<<<<<<<<
2734
* return
2735
* else:
2736
*/
2737
__pyx_v_info->format = __pyx_v_f;
2738
2739
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":327
2740
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
2741
* info.format = f
2742
* return # <<<<<<<<<<<<<<
2743
* else:
2744
* info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
2745
*/
2746
__pyx_r = 0;
2747
goto __pyx_L0;
2748
2749
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":302
2750
* info.obj = self
2751
*
2752
* if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
2753
* t = descr.type_num
2754
* if ((descr.byteorder == c'>' and little_endian) or
2755
*/
2756
}
2757
2758
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":329
2759
* return
2760
* else:
2761
* info.format = <char*>PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
2762
* info.format[0] = c'^' # Native data types, manual alignment
2763
* offset = 0
2764
*/
2765
/*else*/ {
2766
__pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
2767
2768
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":330
2769
* else:
2770
* info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
2771
* info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
2772
* offset = 0
2773
* f = _util_dtypestring(descr, info.format + 1,
2774
*/
2775
(__pyx_v_info->format[0]) = '^';
2776
2777
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":331
2778
* info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
2779
* info.format[0] = c'^' # Native data types, manual alignment
2780
* offset = 0 # <<<<<<<<<<<<<<
2781
* f = _util_dtypestring(descr, info.format + 1,
2782
* info.format + _buffer_format_string_len,
2783
*/
2784
__pyx_v_offset = 0;
2785
2786
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":332
2787
* info.format[0] = c'^' # Native data types, manual alignment
2788
* offset = 0
2789
* f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
2790
* info.format + _buffer_format_string_len,
2791
* &offset)
2792
*/
2793
__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(1, 332, __pyx_L1_error)
2794
__pyx_v_f = __pyx_t_9;
2795
2796
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":335
2797
* info.format + _buffer_format_string_len,
2798
* &offset)
2799
* f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
2800
*
2801
* def __releasebuffer__(ndarray self, Py_buffer* info):
2802
*/
2803
(__pyx_v_f[0]) = '\x00';
2804
}
2805
2806
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
2807
* # experimental exception made for __getbuffer__ and __releasebuffer__
2808
* # -- the details of this may change.
2809
* def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
2810
* # This implementation of getbuffer is geared towards Cython
2811
* # requirements, and does not yet fulfill the PEP.
2812
*/
2813
2814
/* function exit code */
2815
__pyx_r = 0;
2816
goto __pyx_L0;
2817
__pyx_L1_error:;
2818
__Pyx_XDECREF(__pyx_t_3);
2819
__Pyx_XDECREF(__pyx_t_8);
2820
__Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2821
__pyx_r = -1;
2822
if (__pyx_v_info->obj != NULL) {
2823
__Pyx_GOTREF(__pyx_v_info->obj);
2824
__Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
2825
}
2826
goto __pyx_L2;
2827
__pyx_L0:;
2828
if (__pyx_v_info->obj == Py_None) {
2829
__Pyx_GOTREF(__pyx_v_info->obj);
2830
__Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
2831
}
2832
__pyx_L2:;
2833
__Pyx_XDECREF((PyObject *)__pyx_v_descr);
2834
__Pyx_RefNannyFinishContext();
2835
return __pyx_r;
2836
}
2837
2838
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":337
2839
* f[0] = c'\0' # Terminate format string
2840
*
2841
* def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
2842
* if PyArray_HASFIELDS(self):
2843
* PyObject_Free(info.format)
2844
*/
2845
2846
/* Python wrapper */
2847
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
2848
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
2849
__Pyx_RefNannyDeclarations
2850
__Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
2851
__pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
2852
2853
/* function exit code */
2854
__Pyx_RefNannyFinishContext();
2855
}
2856
2857
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
2858
__Pyx_RefNannyDeclarations
2859
int __pyx_t_1;
2860
__Pyx_RefNannySetupContext("__releasebuffer__", 0);
2861
2862
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":338
2863
*
2864
* def __releasebuffer__(ndarray self, Py_buffer* info):
2865
* if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
2866
* PyObject_Free(info.format)
2867
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
2868
*/
2869
__pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
2870
if (__pyx_t_1) {
2871
2872
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":339
2873
* def __releasebuffer__(ndarray self, Py_buffer* info):
2874
* if PyArray_HASFIELDS(self):
2875
* PyObject_Free(info.format) # <<<<<<<<<<<<<<
2876
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
2877
* PyObject_Free(info.strides)
2878
*/
2879
PyObject_Free(__pyx_v_info->format);
2880
2881
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":338
2882
*
2883
* def __releasebuffer__(ndarray self, Py_buffer* info):
2884
* if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
2885
* PyObject_Free(info.format)
2886
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
2887
*/
2888
}
2889
2890
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":340
2891
* if PyArray_HASFIELDS(self):
2892
* PyObject_Free(info.format)
2893
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
2894
* PyObject_Free(info.strides)
2895
* # info.shape was stored after info.strides in the same block
2896
*/
2897
__pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
2898
if (__pyx_t_1) {
2899
2900
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":341
2901
* PyObject_Free(info.format)
2902
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
2903
* PyObject_Free(info.strides) # <<<<<<<<<<<<<<
2904
* # info.shape was stored after info.strides in the same block
2905
*
2906
*/
2907
PyObject_Free(__pyx_v_info->strides);
2908
2909
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":340
2910
* if PyArray_HASFIELDS(self):
2911
* PyObject_Free(info.format)
2912
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
2913
* PyObject_Free(info.strides)
2914
* # info.shape was stored after info.strides in the same block
2915
*/
2916
}
2917
2918
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":337
2919
* f[0] = c'\0' # Terminate format string
2920
*
2921
* def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
2922
* if PyArray_HASFIELDS(self):
2923
* PyObject_Free(info.format)
2924
*/
2925
2926
/* function exit code */
2927
__Pyx_RefNannyFinishContext();
2928
}
2929
2930
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
2931
* ctypedef npy_cdouble complex_t
2932
*
2933
* cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
2934
* return PyArray_MultiIterNew(1, <void*>a)
2935
*
2936
*/
2937
2938
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
2939
PyObject *__pyx_r = NULL;
2940
__Pyx_RefNannyDeclarations
2941
PyObject *__pyx_t_1 = NULL;
2942
__Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
2943
2944
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
2945
*
2946
* cdef inline object PyArray_MultiIterNew1(a):
2947
* return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
2948
*
2949
* cdef inline object PyArray_MultiIterNew2(a, b):
2950
*/
2951
__Pyx_XDECREF(__pyx_r);
2952
__pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error)
2953
__Pyx_GOTREF(__pyx_t_1);
2954
__pyx_r = __pyx_t_1;
2955
__pyx_t_1 = 0;
2956
goto __pyx_L0;
2957
2958
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
2959
* ctypedef npy_cdouble complex_t
2960
*
2961
* cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
2962
* return PyArray_MultiIterNew(1, <void*>a)
2963
*
2964
*/
2965
2966
/* function exit code */
2967
__pyx_L1_error:;
2968
__Pyx_XDECREF(__pyx_t_1);
2969
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
2970
__pyx_r = 0;
2971
__pyx_L0:;
2972
__Pyx_XGIVEREF(__pyx_r);
2973
__Pyx_RefNannyFinishContext();
2974
return __pyx_r;
2975
}
2976
2977
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
2978
* return PyArray_MultiIterNew(1, <void*>a)
2979
*
2980
* cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
2981
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
2982
*
2983
*/
2984
2985
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
2986
PyObject *__pyx_r = NULL;
2987
__Pyx_RefNannyDeclarations
2988
PyObject *__pyx_t_1 = NULL;
2989
__Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
2990
2991
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":825
2992
*
2993
* cdef inline object PyArray_MultiIterNew2(a, b):
2994
* return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
2995
*
2996
* cdef inline object PyArray_MultiIterNew3(a, b, c):
2997
*/
2998
__Pyx_XDECREF(__pyx_r);
2999
__pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error)
3000
__Pyx_GOTREF(__pyx_t_1);
3001
__pyx_r = __pyx_t_1;
3002
__pyx_t_1 = 0;
3003
goto __pyx_L0;
3004
3005
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
3006
* return PyArray_MultiIterNew(1, <void*>a)
3007
*
3008
* cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
3009
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
3010
*
3011
*/
3012
3013
/* function exit code */
3014
__pyx_L1_error:;
3015
__Pyx_XDECREF(__pyx_t_1);
3016
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
3017
__pyx_r = 0;
3018
__pyx_L0:;
3019
__Pyx_XGIVEREF(__pyx_r);
3020
__Pyx_RefNannyFinishContext();
3021
return __pyx_r;
3022
}
3023
3024
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
3025
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
3026
*
3027
* cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
3028
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
3029
*
3030
*/
3031
3032
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
3033
PyObject *__pyx_r = NULL;
3034
__Pyx_RefNannyDeclarations
3035
PyObject *__pyx_t_1 = NULL;
3036
__Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
3037
3038
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":828
3039
*
3040
* cdef inline object PyArray_MultiIterNew3(a, b, c):
3041
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
3042
*
3043
* cdef inline object PyArray_MultiIterNew4(a, b, c, d):
3044
*/
3045
__Pyx_XDECREF(__pyx_r);
3046
__pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error)
3047
__Pyx_GOTREF(__pyx_t_1);
3048
__pyx_r = __pyx_t_1;
3049
__pyx_t_1 = 0;
3050
goto __pyx_L0;
3051
3052
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
3053
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
3054
*
3055
* cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
3056
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
3057
*
3058
*/
3059
3060
/* function exit code */
3061
__pyx_L1_error:;
3062
__Pyx_XDECREF(__pyx_t_1);
3063
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
3064
__pyx_r = 0;
3065
__pyx_L0:;
3066
__Pyx_XGIVEREF(__pyx_r);
3067
__Pyx_RefNannyFinishContext();
3068
return __pyx_r;
3069
}
3070
3071
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
3072
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
3073
*
3074
* cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
3075
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
3076
*
3077
*/
3078
3079
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) {
3080
PyObject *__pyx_r = NULL;
3081
__Pyx_RefNannyDeclarations
3082
PyObject *__pyx_t_1 = NULL;
3083
__Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
3084
3085
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
3086
*
3087
* cdef inline object PyArray_MultiIterNew4(a, b, c, d):
3088
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
3089
*
3090
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
3091
*/
3092
__Pyx_XDECREF(__pyx_r);
3093
__pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error)
3094
__Pyx_GOTREF(__pyx_t_1);
3095
__pyx_r = __pyx_t_1;
3096
__pyx_t_1 = 0;
3097
goto __pyx_L0;
3098
3099
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
3100
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
3101
*
3102
* cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
3103
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
3104
*
3105
*/
3106
3107
/* function exit code */
3108
__pyx_L1_error:;
3109
__Pyx_XDECREF(__pyx_t_1);
3110
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
3111
__pyx_r = 0;
3112
__pyx_L0:;
3113
__Pyx_XGIVEREF(__pyx_r);
3114
__Pyx_RefNannyFinishContext();
3115
return __pyx_r;
3116
}
3117
3118
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
3119
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
3120
*
3121
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
3122
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
3123
*
3124
*/
3125
3126
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) {
3127
PyObject *__pyx_r = NULL;
3128
__Pyx_RefNannyDeclarations
3129
PyObject *__pyx_t_1 = NULL;
3130
__Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
3131
3132
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
3133
*
3134
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
3135
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
3136
*
3137
* cdef inline tuple PyDataType_SHAPE(dtype d):
3138
*/
3139
__Pyx_XDECREF(__pyx_r);
3140
__pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error)
3141
__Pyx_GOTREF(__pyx_t_1);
3142
__pyx_r = __pyx_t_1;
3143
__pyx_t_1 = 0;
3144
goto __pyx_L0;
3145
3146
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
3147
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
3148
*
3149
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
3150
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
3151
*
3152
*/
3153
3154
/* function exit code */
3155
__pyx_L1_error:;
3156
__Pyx_XDECREF(__pyx_t_1);
3157
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
3158
__pyx_r = 0;
3159
__pyx_L0:;
3160
__Pyx_XGIVEREF(__pyx_r);
3161
__Pyx_RefNannyFinishContext();
3162
return __pyx_r;
3163
}
3164
3165
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
3166
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
3167
*
3168
* cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
3169
* if PyDataType_HASSUBARRAY(d):
3170
* return <tuple>d.subarray.shape
3171
*/
3172
3173
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
3174
PyObject *__pyx_r = NULL;
3175
__Pyx_RefNannyDeclarations
3176
int __pyx_t_1;
3177
__Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
3178
3179
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
3180
*
3181
* cdef inline tuple PyDataType_SHAPE(dtype d):
3182
* if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
3183
* return <tuple>d.subarray.shape
3184
* else:
3185
*/
3186
__pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
3187
if (__pyx_t_1) {
3188
3189
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
3190
* cdef inline tuple PyDataType_SHAPE(dtype d):
3191
* if PyDataType_HASSUBARRAY(d):
3192
* return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
3193
* else:
3194
* return ()
3195
*/
3196
__Pyx_XDECREF(__pyx_r);
3197
__Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
3198
__pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
3199
goto __pyx_L0;
3200
3201
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
3202
*
3203
* cdef inline tuple PyDataType_SHAPE(dtype d):
3204
* if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
3205
* return <tuple>d.subarray.shape
3206
* else:
3207
*/
3208
}
3209
3210
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
3211
* return <tuple>d.subarray.shape
3212
* else:
3213
* return () # <<<<<<<<<<<<<<
3214
*
3215
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
3216
*/
3217
/*else*/ {
3218
__Pyx_XDECREF(__pyx_r);
3219
__Pyx_INCREF(__pyx_empty_tuple);
3220
__pyx_r = __pyx_empty_tuple;
3221
goto __pyx_L0;
3222
}
3223
3224
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
3225
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
3226
*
3227
* cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
3228
* if PyDataType_HASSUBARRAY(d):
3229
* return <tuple>d.subarray.shape
3230
*/
3231
3232
/* function exit code */
3233
__pyx_L0:;
3234
__Pyx_XGIVEREF(__pyx_r);
3235
__Pyx_RefNannyFinishContext();
3236
return __pyx_r;
3237
}
3238
3239
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
3240
* return ()
3241
*
3242
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
3243
* # Recursive utility function used in __getbuffer__ to get format
3244
* # string. The new location in the format string is returned.
3245
*/
3246
3247
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) {
3248
PyArray_Descr *__pyx_v_child = 0;
3249
int __pyx_v_endian_detector;
3250
int __pyx_v_little_endian;
3251
PyObject *__pyx_v_fields = 0;
3252
PyObject *__pyx_v_childname = NULL;
3253
PyObject *__pyx_v_new_offset = NULL;
3254
PyObject *__pyx_v_t = NULL;
3255
char *__pyx_r;
3256
__Pyx_RefNannyDeclarations
3257
PyObject *__pyx_t_1 = NULL;
3258
Py_ssize_t __pyx_t_2;
3259
PyObject *__pyx_t_3 = NULL;
3260
PyObject *__pyx_t_4 = NULL;
3261
int __pyx_t_5;
3262
int __pyx_t_6;
3263
int __pyx_t_7;
3264
long __pyx_t_8;
3265
char *__pyx_t_9;
3266
__Pyx_RefNannySetupContext("_util_dtypestring", 0);
3267
3268
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":847
3269
*
3270
* cdef dtype child
3271
* cdef int endian_detector = 1 # <<<<<<<<<<<<<<
3272
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
3273
* cdef tuple fields
3274
*/
3275
__pyx_v_endian_detector = 1;
3276
3277
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":848
3278
* cdef dtype child
3279
* cdef int endian_detector = 1
3280
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
3281
* cdef tuple fields
3282
*
3283
*/
3284
__pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
3285
3286
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
3287
* cdef tuple fields
3288
*
3289
* for childname in descr.names: # <<<<<<<<<<<<<<
3290
* fields = descr.fields[childname]
3291
* child, new_offset = fields
3292
*/
3293
if (unlikely(__pyx_v_descr->names == Py_None)) {
3294
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
3295
__PYX_ERR(1, 851, __pyx_L1_error)
3296
}
3297
__pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
3298
for (;;) {
3299
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
3300
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3301
__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(1, 851, __pyx_L1_error)
3302
#else
3303
__pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
3304
__Pyx_GOTREF(__pyx_t_3);
3305
#endif
3306
__Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
3307
__pyx_t_3 = 0;
3308
3309
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":852
3310
*
3311
* for childname in descr.names:
3312
* fields = descr.fields[childname] # <<<<<<<<<<<<<<
3313
* child, new_offset = fields
3314
*
3315
*/
3316
if (unlikely(__pyx_v_descr->fields == Py_None)) {
3317
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3318
__PYX_ERR(1, 852, __pyx_L1_error)
3319
}
3320
__pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error)
3321
__Pyx_GOTREF(__pyx_t_3);
3322
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(1, 852, __pyx_L1_error)
3323
__Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
3324
__pyx_t_3 = 0;
3325
3326
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":853
3327
* for childname in descr.names:
3328
* fields = descr.fields[childname]
3329
* child, new_offset = fields # <<<<<<<<<<<<<<
3330
*
3331
* if (end - f) - <int>(new_offset - offset[0]) < 15:
3332
*/
3333
if (likely(__pyx_v_fields != Py_None)) {
3334
PyObject* sequence = __pyx_v_fields;
3335
Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3336
if (unlikely(size != 2)) {
3337
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
3338
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3339
__PYX_ERR(1, 853, __pyx_L1_error)
3340
}
3341
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3342
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
3343
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
3344
__Pyx_INCREF(__pyx_t_3);
3345
__Pyx_INCREF(__pyx_t_4);
3346
#else
3347
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
3348
__Pyx_GOTREF(__pyx_t_3);
3349
__pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
3350
__Pyx_GOTREF(__pyx_t_4);
3351
#endif
3352
} else {
3353
__Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error)
3354
}
3355
if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error)
3356
__Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
3357
__pyx_t_3 = 0;
3358
__Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
3359
__pyx_t_4 = 0;
3360
3361
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
3362
* child, new_offset = fields
3363
*
3364
* if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
3365
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
3366
*
3367
*/
3368
__pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
3369
__Pyx_GOTREF(__pyx_t_4);
3370
__pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
3371
__Pyx_GOTREF(__pyx_t_3);
3372
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3373
__pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error)
3374
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3375
__pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
3376
if (unlikely(__pyx_t_6)) {
3377
3378
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
3379
*
3380
* if (end - f) - <int>(new_offset - offset[0]) < 15:
3381
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
3382
*
3383
* if ((child.byteorder == c'>' and little_endian) or
3384
*/
3385
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error)
3386
__Pyx_GOTREF(__pyx_t_3);
3387
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
3388
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3389
__PYX_ERR(1, 856, __pyx_L1_error)
3390
3391
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
3392
* child, new_offset = fields
3393
*
3394
* if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
3395
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
3396
*
3397
*/
3398
}
3399
3400
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
3401
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
3402
*
3403
* if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
3404
* (child.byteorder == c'<' and not little_endian)):
3405
* raise ValueError(u"Non-native byte order not supported")
3406
*/
3407
__pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
3408
if (!__pyx_t_7) {
3409
goto __pyx_L8_next_or;
3410
} else {
3411
}
3412
__pyx_t_7 = (__pyx_v_little_endian != 0);
3413
if (!__pyx_t_7) {
3414
} else {
3415
__pyx_t_6 = __pyx_t_7;
3416
goto __pyx_L7_bool_binop_done;
3417
}
3418
__pyx_L8_next_or:;
3419
3420
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":859
3421
*
3422
* if ((child.byteorder == c'>' and little_endian) or
3423
* (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
3424
* raise ValueError(u"Non-native byte order not supported")
3425
* # One could encode it in the format string and have Cython
3426
*/
3427
__pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
3428
if (__pyx_t_7) {
3429
} else {
3430
__pyx_t_6 = __pyx_t_7;
3431
goto __pyx_L7_bool_binop_done;
3432
}
3433
__pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
3434
__pyx_t_6 = __pyx_t_7;
3435
__pyx_L7_bool_binop_done:;
3436
3437
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
3438
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
3439
*
3440
* if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
3441
* (child.byteorder == c'<' and not little_endian)):
3442
* raise ValueError(u"Non-native byte order not supported")
3443
*/
3444
if (unlikely(__pyx_t_6)) {
3445
3446
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":860
3447
* if ((child.byteorder == c'>' and little_endian) or
3448
* (child.byteorder == c'<' and not little_endian)):
3449
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
3450
* # One could encode it in the format string and have Cython
3451
* # complain instead, BUT: < and > in format strings also imply
3452
*/
3453
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error)
3454
__Pyx_GOTREF(__pyx_t_3);
3455
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
3456
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3457
__PYX_ERR(1, 860, __pyx_L1_error)
3458
3459
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
3460
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
3461
*
3462
* if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
3463
* (child.byteorder == c'<' and not little_endian)):
3464
* raise ValueError(u"Non-native byte order not supported")
3465
*/
3466
}
3467
3468
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":870
3469
*
3470
* # Output padding bytes
3471
* while offset[0] < new_offset: # <<<<<<<<<<<<<<
3472
* f[0] = 120 # "x"; pad byte
3473
* f += 1
3474
*/
3475
while (1) {
3476
__pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error)
3477
__Pyx_GOTREF(__pyx_t_3);
3478
__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(1, 870, __pyx_L1_error)
3479
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3480
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
3481
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3482
if (!__pyx_t_6) break;
3483
3484
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":871
3485
* # Output padding bytes
3486
* while offset[0] < new_offset:
3487
* f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
3488
* f += 1
3489
* offset[0] += 1
3490
*/
3491
(__pyx_v_f[0]) = 0x78;
3492
3493
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":872
3494
* while offset[0] < new_offset:
3495
* f[0] = 120 # "x"; pad byte
3496
* f += 1 # <<<<<<<<<<<<<<
3497
* offset[0] += 1
3498
*
3499
*/
3500
__pyx_v_f = (__pyx_v_f + 1);
3501
3502
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":873
3503
* f[0] = 120 # "x"; pad byte
3504
* f += 1
3505
* offset[0] += 1 # <<<<<<<<<<<<<<
3506
*
3507
* offset[0] += child.itemsize
3508
*/
3509
__pyx_t_8 = 0;
3510
(__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
3511
}
3512
3513
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":875
3514
* offset[0] += 1
3515
*
3516
* offset[0] += child.itemsize # <<<<<<<<<<<<<<
3517
*
3518
* if not PyDataType_HASFIELDS(child):
3519
*/
3520
__pyx_t_8 = 0;
3521
(__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
3522
3523
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":877
3524
* offset[0] += child.itemsize
3525
*
3526
* if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
3527
* t = child.type_num
3528
* if end - f < 5:
3529
*/
3530
__pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
3531
if (__pyx_t_6) {
3532
3533
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":878
3534
*
3535
* if not PyDataType_HASFIELDS(child):
3536
* t = child.type_num # <<<<<<<<<<<<<<
3537
* if end - f < 5:
3538
* raise RuntimeError(u"Format string allocated too short.")
3539
*/
3540
__pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error)
3541
__Pyx_GOTREF(__pyx_t_4);
3542
__Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
3543
__pyx_t_4 = 0;
3544
3545
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":879
3546
* if not PyDataType_HASFIELDS(child):
3547
* t = child.type_num
3548
* if end - f < 5: # <<<<<<<<<<<<<<
3549
* raise RuntimeError(u"Format string allocated too short.")
3550
*
3551
*/
3552
__pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
3553
if (unlikely(__pyx_t_6)) {
3554
3555
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":880
3556
* t = child.type_num
3557
* if end - f < 5:
3558
* raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
3559
*
3560
* # Until ticket #99 is fixed, use integers to avoid warnings
3561
*/
3562
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error)
3563
__Pyx_GOTREF(__pyx_t_4);
3564
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
3565
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3566
__PYX_ERR(1, 880, __pyx_L1_error)
3567
3568
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":879
3569
* if not PyDataType_HASFIELDS(child):
3570
* t = child.type_num
3571
* if end - f < 5: # <<<<<<<<<<<<<<
3572
* raise RuntimeError(u"Format string allocated too short.")
3573
*
3574
*/
3575
}
3576
3577
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":883
3578
*
3579
* # Until ticket #99 is fixed, use integers to avoid warnings
3580
* if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
3581
* elif t == NPY_UBYTE: f[0] = 66 #"B"
3582
* elif t == NPY_SHORT: f[0] = 104 #"h"
3583
*/
3584
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error)
3585
__Pyx_GOTREF(__pyx_t_4);
3586
__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(1, 883, __pyx_L1_error)
3587
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3588
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error)
3589
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3590
if (__pyx_t_6) {
3591
(__pyx_v_f[0]) = 98;
3592
goto __pyx_L15;
3593
}
3594
3595
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":884
3596
* # Until ticket #99 is fixed, use integers to avoid warnings
3597
* if t == NPY_BYTE: f[0] = 98 #"b"
3598
* elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
3599
* elif t == NPY_SHORT: f[0] = 104 #"h"
3600
* elif t == NPY_USHORT: f[0] = 72 #"H"
3601
*/
3602
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error)
3603
__Pyx_GOTREF(__pyx_t_3);
3604
__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(1, 884, __pyx_L1_error)
3605
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3606
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error)
3607
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3608
if (__pyx_t_6) {
3609
(__pyx_v_f[0]) = 66;
3610
goto __pyx_L15;
3611
}
3612
3613
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":885
3614
* if t == NPY_BYTE: f[0] = 98 #"b"
3615
* elif t == NPY_UBYTE: f[0] = 66 #"B"
3616
* elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
3617
* elif t == NPY_USHORT: f[0] = 72 #"H"
3618
* elif t == NPY_INT: f[0] = 105 #"i"
3619
*/
3620
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error)
3621
__Pyx_GOTREF(__pyx_t_4);
3622
__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(1, 885, __pyx_L1_error)
3623
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3624
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error)
3625
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3626
if (__pyx_t_6) {
3627
(__pyx_v_f[0]) = 0x68;
3628
goto __pyx_L15;
3629
}
3630
3631
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":886
3632
* elif t == NPY_UBYTE: f[0] = 66 #"B"
3633
* elif t == NPY_SHORT: f[0] = 104 #"h"
3634
* elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
3635
* elif t == NPY_INT: f[0] = 105 #"i"
3636
* elif t == NPY_UINT: f[0] = 73 #"I"
3637
*/
3638
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error)
3639
__Pyx_GOTREF(__pyx_t_3);
3640
__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(1, 886, __pyx_L1_error)
3641
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3642
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error)
3643
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3644
if (__pyx_t_6) {
3645
(__pyx_v_f[0]) = 72;
3646
goto __pyx_L15;
3647
}
3648
3649
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":887
3650
* elif t == NPY_SHORT: f[0] = 104 #"h"
3651
* elif t == NPY_USHORT: f[0] = 72 #"H"
3652
* elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
3653
* elif t == NPY_UINT: f[0] = 73 #"I"
3654
* elif t == NPY_LONG: f[0] = 108 #"l"
3655
*/
3656
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error)
3657
__Pyx_GOTREF(__pyx_t_4);
3658
__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(1, 887, __pyx_L1_error)
3659
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3660
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
3661
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3662
if (__pyx_t_6) {
3663
(__pyx_v_f[0]) = 0x69;
3664
goto __pyx_L15;
3665
}
3666
3667
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":888
3668
* elif t == NPY_USHORT: f[0] = 72 #"H"
3669
* elif t == NPY_INT: f[0] = 105 #"i"
3670
* elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
3671
* elif t == NPY_LONG: f[0] = 108 #"l"
3672
* elif t == NPY_ULONG: f[0] = 76 #"L"
3673
*/
3674
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error)
3675
__Pyx_GOTREF(__pyx_t_3);
3676
__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(1, 888, __pyx_L1_error)
3677
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3678
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error)
3679
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3680
if (__pyx_t_6) {
3681
(__pyx_v_f[0]) = 73;
3682
goto __pyx_L15;
3683
}
3684
3685
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":889
3686
* elif t == NPY_INT: f[0] = 105 #"i"
3687
* elif t == NPY_UINT: f[0] = 73 #"I"
3688
* elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
3689
* elif t == NPY_ULONG: f[0] = 76 #"L"
3690
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
3691
*/
3692
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error)
3693
__Pyx_GOTREF(__pyx_t_4);
3694
__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(1, 889, __pyx_L1_error)
3695
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3696
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error)
3697
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3698
if (__pyx_t_6) {
3699
(__pyx_v_f[0]) = 0x6C;
3700
goto __pyx_L15;
3701
}
3702
3703
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":890
3704
* elif t == NPY_UINT: f[0] = 73 #"I"
3705
* elif t == NPY_LONG: f[0] = 108 #"l"
3706
* elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
3707
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
3708
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
3709
*/
3710
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error)
3711
__Pyx_GOTREF(__pyx_t_3);
3712
__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(1, 890, __pyx_L1_error)
3713
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3714
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error)
3715
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3716
if (__pyx_t_6) {
3717
(__pyx_v_f[0]) = 76;
3718
goto __pyx_L15;
3719
}
3720
3721
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":891
3722
* elif t == NPY_LONG: f[0] = 108 #"l"
3723
* elif t == NPY_ULONG: f[0] = 76 #"L"
3724
* elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
3725
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
3726
* elif t == NPY_FLOAT: f[0] = 102 #"f"
3727
*/
3728
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error)
3729
__Pyx_GOTREF(__pyx_t_4);
3730
__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(1, 891, __pyx_L1_error)
3731
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3732
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error)
3733
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3734
if (__pyx_t_6) {
3735
(__pyx_v_f[0]) = 0x71;
3736
goto __pyx_L15;
3737
}
3738
3739
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":892
3740
* elif t == NPY_ULONG: f[0] = 76 #"L"
3741
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
3742
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
3743
* elif t == NPY_FLOAT: f[0] = 102 #"f"
3744
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
3745
*/
3746
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error)
3747
__Pyx_GOTREF(__pyx_t_3);
3748
__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(1, 892, __pyx_L1_error)
3749
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3750
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error)
3751
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3752
if (__pyx_t_6) {
3753
(__pyx_v_f[0]) = 81;
3754
goto __pyx_L15;
3755
}
3756
3757
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":893
3758
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
3759
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
3760
* elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
3761
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
3762
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
3763
*/
3764
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error)
3765
__Pyx_GOTREF(__pyx_t_4);
3766
__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(1, 893, __pyx_L1_error)
3767
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3768
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error)
3769
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3770
if (__pyx_t_6) {
3771
(__pyx_v_f[0]) = 0x66;
3772
goto __pyx_L15;
3773
}
3774
3775
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":894
3776
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
3777
* elif t == NPY_FLOAT: f[0] = 102 #"f"
3778
* elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
3779
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
3780
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
3781
*/
3782
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error)
3783
__Pyx_GOTREF(__pyx_t_3);
3784
__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(1, 894, __pyx_L1_error)
3785
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3786
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error)
3787
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3788
if (__pyx_t_6) {
3789
(__pyx_v_f[0]) = 0x64;
3790
goto __pyx_L15;
3791
}
3792
3793
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":895
3794
* elif t == NPY_FLOAT: f[0] = 102 #"f"
3795
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
3796
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
3797
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
3798
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
3799
*/
3800
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error)
3801
__Pyx_GOTREF(__pyx_t_4);
3802
__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(1, 895, __pyx_L1_error)
3803
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3804
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error)
3805
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3806
if (__pyx_t_6) {
3807
(__pyx_v_f[0]) = 0x67;
3808
goto __pyx_L15;
3809
}
3810
3811
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":896
3812
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
3813
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
3814
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
3815
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
3816
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
3817
*/
3818
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error)
3819
__Pyx_GOTREF(__pyx_t_3);
3820
__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(1, 896, __pyx_L1_error)
3821
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3822
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error)
3823
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3824
if (__pyx_t_6) {
3825
(__pyx_v_f[0]) = 90;
3826
(__pyx_v_f[1]) = 0x66;
3827
__pyx_v_f = (__pyx_v_f + 1);
3828
goto __pyx_L15;
3829
}
3830
3831
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":897
3832
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
3833
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
3834
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
3835
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
3836
* elif t == NPY_OBJECT: f[0] = 79 #"O"
3837
*/
3838
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error)
3839
__Pyx_GOTREF(__pyx_t_4);
3840
__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(1, 897, __pyx_L1_error)
3841
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3842
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error)
3843
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3844
if (__pyx_t_6) {
3845
(__pyx_v_f[0]) = 90;
3846
(__pyx_v_f[1]) = 0x64;
3847
__pyx_v_f = (__pyx_v_f + 1);
3848
goto __pyx_L15;
3849
}
3850
3851
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":898
3852
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
3853
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
3854
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
3855
* elif t == NPY_OBJECT: f[0] = 79 #"O"
3856
* else:
3857
*/
3858
__pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error)
3859
__Pyx_GOTREF(__pyx_t_3);
3860
__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(1, 898, __pyx_L1_error)
3861
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3862
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error)
3863
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3864
if (__pyx_t_6) {
3865
(__pyx_v_f[0]) = 90;
3866
(__pyx_v_f[1]) = 0x67;
3867
__pyx_v_f = (__pyx_v_f + 1);
3868
goto __pyx_L15;
3869
}
3870
3871
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":899
3872
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
3873
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
3874
* elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
3875
* else:
3876
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
3877
*/
3878
__pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error)
3879
__Pyx_GOTREF(__pyx_t_4);
3880
__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(1, 899, __pyx_L1_error)
3881
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3882
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error)
3883
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3884
if (likely(__pyx_t_6)) {
3885
(__pyx_v_f[0]) = 79;
3886
goto __pyx_L15;
3887
}
3888
3889
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":901
3890
* elif t == NPY_OBJECT: f[0] = 79 #"O"
3891
* else:
3892
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
3893
* f += 1
3894
* else:
3895
*/
3896
/*else*/ {
3897
__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(1, 901, __pyx_L1_error)
3898
__Pyx_GOTREF(__pyx_t_3);
3899
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error)
3900
__Pyx_GOTREF(__pyx_t_4);
3901
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3902
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
3903
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3904
__PYX_ERR(1, 901, __pyx_L1_error)
3905
}
3906
__pyx_L15:;
3907
3908
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":902
3909
* else:
3910
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
3911
* f += 1 # <<<<<<<<<<<<<<
3912
* else:
3913
* # Cython ignores struct boundary information ("T{...}"),
3914
*/
3915
__pyx_v_f = (__pyx_v_f + 1);
3916
3917
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":877
3918
* offset[0] += child.itemsize
3919
*
3920
* if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
3921
* t = child.type_num
3922
* if end - f < 5:
3923
*/
3924
goto __pyx_L13;
3925
}
3926
3927
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":906
3928
* # Cython ignores struct boundary information ("T{...}"),
3929
* # so don't output it
3930
* f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
3931
* return f
3932
*
3933
*/
3934
/*else*/ {
3935
__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(1, 906, __pyx_L1_error)
3936
__pyx_v_f = __pyx_t_9;
3937
}
3938
__pyx_L13:;
3939
3940
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
3941
* cdef tuple fields
3942
*
3943
* for childname in descr.names: # <<<<<<<<<<<<<<
3944
* fields = descr.fields[childname]
3945
* child, new_offset = fields
3946
*/
3947
}
3948
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3949
3950
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":907
3951
* # so don't output it
3952
* f = _util_dtypestring(child, f, end, offset)
3953
* return f # <<<<<<<<<<<<<<
3954
*
3955
*
3956
*/
3957
__pyx_r = __pyx_v_f;
3958
goto __pyx_L0;
3959
3960
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
3961
* return ()
3962
*
3963
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
3964
* # Recursive utility function used in __getbuffer__ to get format
3965
* # string. The new location in the format string is returned.
3966
*/
3967
3968
/* function exit code */
3969
__pyx_L1_error:;
3970
__Pyx_XDECREF(__pyx_t_1);
3971
__Pyx_XDECREF(__pyx_t_3);
3972
__Pyx_XDECREF(__pyx_t_4);
3973
__Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
3974
__pyx_r = NULL;
3975
__pyx_L0:;
3976
__Pyx_XDECREF((PyObject *)__pyx_v_child);
3977
__Pyx_XDECREF(__pyx_v_fields);
3978
__Pyx_XDECREF(__pyx_v_childname);
3979
__Pyx_XDECREF(__pyx_v_new_offset);
3980
__Pyx_XDECREF(__pyx_v_t);
3981
__Pyx_RefNannyFinishContext();
3982
return __pyx_r;
3983
}
3984
3985
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022
3986
* int _import_umath() except -1
3987
*
3988
* cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
3989
* Py_INCREF(base) # important to do this before stealing the reference below!
3990
* PyArray_SetBaseObject(arr, base)
3991
*/
3992
3993
static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
3994
__Pyx_RefNannyDeclarations
3995
__Pyx_RefNannySetupContext("set_array_base", 0);
3996
3997
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1023
3998
*
3999
* cdef inline void set_array_base(ndarray arr, object base):
4000
* Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
4001
* PyArray_SetBaseObject(arr, base)
4002
*
4003
*/
4004
Py_INCREF(__pyx_v_base);
4005
4006
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1024
4007
* cdef inline void set_array_base(ndarray arr, object base):
4008
* Py_INCREF(base) # important to do this before stealing the reference below!
4009
* PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
4010
*
4011
* cdef inline object get_array_base(ndarray arr):
4012
*/
4013
(void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
4014
4015
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022
4016
* int _import_umath() except -1
4017
*
4018
* cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
4019
* Py_INCREF(base) # important to do this before stealing the reference below!
4020
* PyArray_SetBaseObject(arr, base)
4021
*/
4022
4023
/* function exit code */
4024
__Pyx_RefNannyFinishContext();
4025
}
4026
4027
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026
4028
* PyArray_SetBaseObject(arr, base)
4029
*
4030
* cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
4031
* base = PyArray_BASE(arr)
4032
* if base is NULL:
4033
*/
4034
4035
static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
4036
PyObject *__pyx_v_base;
4037
PyObject *__pyx_r = NULL;
4038
__Pyx_RefNannyDeclarations
4039
int __pyx_t_1;
4040
__Pyx_RefNannySetupContext("get_array_base", 0);
4041
4042
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1027
4043
*
4044
* cdef inline object get_array_base(ndarray arr):
4045
* base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
4046
* if base is NULL:
4047
* return None
4048
*/
4049
__pyx_v_base = PyArray_BASE(__pyx_v_arr);
4050
4051
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028
4052
* cdef inline object get_array_base(ndarray arr):
4053
* base = PyArray_BASE(arr)
4054
* if base is NULL: # <<<<<<<<<<<<<<
4055
* return None
4056
* return <object>base
4057
*/
4058
__pyx_t_1 = ((__pyx_v_base == NULL) != 0);
4059
if (__pyx_t_1) {
4060
4061
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1029
4062
* base = PyArray_BASE(arr)
4063
* if base is NULL:
4064
* return None # <<<<<<<<<<<<<<
4065
* return <object>base
4066
*
4067
*/
4068
__Pyx_XDECREF(__pyx_r);
4069
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
4070
goto __pyx_L0;
4071
4072
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028
4073
* cdef inline object get_array_base(ndarray arr):
4074
* base = PyArray_BASE(arr)
4075
* if base is NULL: # <<<<<<<<<<<<<<
4076
* return None
4077
* return <object>base
4078
*/
4079
}
4080
4081
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1030
4082
* if base is NULL:
4083
* return None
4084
* return <object>base # <<<<<<<<<<<<<<
4085
*
4086
* # Versions of the import_* functions which are more suitable for
4087
*/
4088
__Pyx_XDECREF(__pyx_r);
4089
__Pyx_INCREF(((PyObject *)__pyx_v_base));
4090
__pyx_r = ((PyObject *)__pyx_v_base);
4091
goto __pyx_L0;
4092
4093
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026
4094
* PyArray_SetBaseObject(arr, base)
4095
*
4096
* cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
4097
* base = PyArray_BASE(arr)
4098
* if base is NULL:
4099
*/
4100
4101
/* function exit code */
4102
__pyx_L0:;
4103
__Pyx_XGIVEREF(__pyx_r);
4104
__Pyx_RefNannyFinishContext();
4105
return __pyx_r;
4106
}
4107
4108
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034
4109
* # Versions of the import_* functions which are more suitable for
4110
* # Cython code.
4111
* cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
4112
* try:
4113
* _import_array()
4114
*/
4115
4116
static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
4117
int __pyx_r;
4118
__Pyx_RefNannyDeclarations
4119
PyObject *__pyx_t_1 = NULL;
4120
PyObject *__pyx_t_2 = NULL;
4121
PyObject *__pyx_t_3 = NULL;
4122
int __pyx_t_4;
4123
PyObject *__pyx_t_5 = NULL;
4124
PyObject *__pyx_t_6 = NULL;
4125
PyObject *__pyx_t_7 = NULL;
4126
PyObject *__pyx_t_8 = NULL;
4127
__Pyx_RefNannySetupContext("import_array", 0);
4128
4129
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
4130
* # Cython code.
4131
* cdef inline int import_array() except -1:
4132
* try: # <<<<<<<<<<<<<<
4133
* _import_array()
4134
* except Exception:
4135
*/
4136
{
4137
__Pyx_PyThreadState_declare
4138
__Pyx_PyThreadState_assign
4139
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4140
__Pyx_XGOTREF(__pyx_t_1);
4141
__Pyx_XGOTREF(__pyx_t_2);
4142
__Pyx_XGOTREF(__pyx_t_3);
4143
/*try:*/ {
4144
4145
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1036
4146
* cdef inline int import_array() except -1:
4147
* try:
4148
* _import_array() # <<<<<<<<<<<<<<
4149
* except Exception:
4150
* raise ImportError("numpy.core.multiarray failed to import")
4151
*/
4152
__pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error)
4153
4154
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
4155
* # Cython code.
4156
* cdef inline int import_array() except -1:
4157
* try: # <<<<<<<<<<<<<<
4158
* _import_array()
4159
* except Exception:
4160
*/
4161
}
4162
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4163
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4164
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4165
goto __pyx_L8_try_end;
4166
__pyx_L3_error:;
4167
4168
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1037
4169
* try:
4170
* _import_array()
4171
* except Exception: # <<<<<<<<<<<<<<
4172
* raise ImportError("numpy.core.multiarray failed to import")
4173
*
4174
*/
4175
__pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4176
if (__pyx_t_4) {
4177
__Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
4178
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error)
4179
__Pyx_GOTREF(__pyx_t_5);
4180
__Pyx_GOTREF(__pyx_t_6);
4181
__Pyx_GOTREF(__pyx_t_7);
4182
4183
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038
4184
* _import_array()
4185
* except Exception:
4186
* raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
4187
*
4188
* cdef inline int import_umath() except -1:
4189
*/
4190
__pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error)
4191
__Pyx_GOTREF(__pyx_t_8);
4192
__Pyx_Raise(__pyx_t_8, 0, 0, 0);
4193
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4194
__PYX_ERR(1, 1038, __pyx_L5_except_error)
4195
}
4196
goto __pyx_L5_except_error;
4197
__pyx_L5_except_error:;
4198
4199
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
4200
* # Cython code.
4201
* cdef inline int import_array() except -1:
4202
* try: # <<<<<<<<<<<<<<
4203
* _import_array()
4204
* except Exception:
4205
*/
4206
__Pyx_XGIVEREF(__pyx_t_1);
4207
__Pyx_XGIVEREF(__pyx_t_2);
4208
__Pyx_XGIVEREF(__pyx_t_3);
4209
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4210
goto __pyx_L1_error;
4211
__pyx_L8_try_end:;
4212
}
4213
4214
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034
4215
* # Versions of the import_* functions which are more suitable for
4216
* # Cython code.
4217
* cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
4218
* try:
4219
* _import_array()
4220
*/
4221
4222
/* function exit code */
4223
__pyx_r = 0;
4224
goto __pyx_L0;
4225
__pyx_L1_error:;
4226
__Pyx_XDECREF(__pyx_t_5);
4227
__Pyx_XDECREF(__pyx_t_6);
4228
__Pyx_XDECREF(__pyx_t_7);
4229
__Pyx_XDECREF(__pyx_t_8);
4230
__Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
4231
__pyx_r = -1;
4232
__pyx_L0:;
4233
__Pyx_RefNannyFinishContext();
4234
return __pyx_r;
4235
}
4236
4237
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040
4238
* raise ImportError("numpy.core.multiarray failed to import")
4239
*
4240
* cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
4241
* try:
4242
* _import_umath()
4243
*/
4244
4245
static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
4246
int __pyx_r;
4247
__Pyx_RefNannyDeclarations
4248
PyObject *__pyx_t_1 = NULL;
4249
PyObject *__pyx_t_2 = NULL;
4250
PyObject *__pyx_t_3 = NULL;
4251
int __pyx_t_4;
4252
PyObject *__pyx_t_5 = NULL;
4253
PyObject *__pyx_t_6 = NULL;
4254
PyObject *__pyx_t_7 = NULL;
4255
PyObject *__pyx_t_8 = NULL;
4256
__Pyx_RefNannySetupContext("import_umath", 0);
4257
4258
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
4259
*
4260
* cdef inline int import_umath() except -1:
4261
* try: # <<<<<<<<<<<<<<
4262
* _import_umath()
4263
* except Exception:
4264
*/
4265
{
4266
__Pyx_PyThreadState_declare
4267
__Pyx_PyThreadState_assign
4268
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4269
__Pyx_XGOTREF(__pyx_t_1);
4270
__Pyx_XGOTREF(__pyx_t_2);
4271
__Pyx_XGOTREF(__pyx_t_3);
4272
/*try:*/ {
4273
4274
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1042
4275
* cdef inline int import_umath() except -1:
4276
* try:
4277
* _import_umath() # <<<<<<<<<<<<<<
4278
* except Exception:
4279
* raise ImportError("numpy.core.umath failed to import")
4280
*/
4281
__pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error)
4282
4283
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
4284
*
4285
* cdef inline int import_umath() except -1:
4286
* try: # <<<<<<<<<<<<<<
4287
* _import_umath()
4288
* except Exception:
4289
*/
4290
}
4291
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4292
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4293
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4294
goto __pyx_L8_try_end;
4295
__pyx_L3_error:;
4296
4297
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1043
4298
* try:
4299
* _import_umath()
4300
* except Exception: # <<<<<<<<<<<<<<
4301
* raise ImportError("numpy.core.umath failed to import")
4302
*
4303
*/
4304
__pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4305
if (__pyx_t_4) {
4306
__Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
4307
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error)
4308
__Pyx_GOTREF(__pyx_t_5);
4309
__Pyx_GOTREF(__pyx_t_6);
4310
__Pyx_GOTREF(__pyx_t_7);
4311
4312
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044
4313
* _import_umath()
4314
* except Exception:
4315
* raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
4316
*
4317
* cdef inline int import_ufunc() except -1:
4318
*/
4319
__pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error)
4320
__Pyx_GOTREF(__pyx_t_8);
4321
__Pyx_Raise(__pyx_t_8, 0, 0, 0);
4322
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4323
__PYX_ERR(1, 1044, __pyx_L5_except_error)
4324
}
4325
goto __pyx_L5_except_error;
4326
__pyx_L5_except_error:;
4327
4328
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
4329
*
4330
* cdef inline int import_umath() except -1:
4331
* try: # <<<<<<<<<<<<<<
4332
* _import_umath()
4333
* except Exception:
4334
*/
4335
__Pyx_XGIVEREF(__pyx_t_1);
4336
__Pyx_XGIVEREF(__pyx_t_2);
4337
__Pyx_XGIVEREF(__pyx_t_3);
4338
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4339
goto __pyx_L1_error;
4340
__pyx_L8_try_end:;
4341
}
4342
4343
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040
4344
* raise ImportError("numpy.core.multiarray failed to import")
4345
*
4346
* cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
4347
* try:
4348
* _import_umath()
4349
*/
4350
4351
/* function exit code */
4352
__pyx_r = 0;
4353
goto __pyx_L0;
4354
__pyx_L1_error:;
4355
__Pyx_XDECREF(__pyx_t_5);
4356
__Pyx_XDECREF(__pyx_t_6);
4357
__Pyx_XDECREF(__pyx_t_7);
4358
__Pyx_XDECREF(__pyx_t_8);
4359
__Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
4360
__pyx_r = -1;
4361
__pyx_L0:;
4362
__Pyx_RefNannyFinishContext();
4363
return __pyx_r;
4364
}
4365
4366
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
4367
* raise ImportError("numpy.core.umath failed to import")
4368
*
4369
* cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
4370
* try:
4371
* _import_umath()
4372
*/
4373
4374
static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
4375
int __pyx_r;
4376
__Pyx_RefNannyDeclarations
4377
PyObject *__pyx_t_1 = NULL;
4378
PyObject *__pyx_t_2 = NULL;
4379
PyObject *__pyx_t_3 = NULL;
4380
int __pyx_t_4;
4381
PyObject *__pyx_t_5 = NULL;
4382
PyObject *__pyx_t_6 = NULL;
4383
PyObject *__pyx_t_7 = NULL;
4384
PyObject *__pyx_t_8 = NULL;
4385
__Pyx_RefNannySetupContext("import_ufunc", 0);
4386
4387
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
4388
*
4389
* cdef inline int import_ufunc() except -1:
4390
* try: # <<<<<<<<<<<<<<
4391
* _import_umath()
4392
* except Exception:
4393
*/
4394
{
4395
__Pyx_PyThreadState_declare
4396
__Pyx_PyThreadState_assign
4397
__Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4398
__Pyx_XGOTREF(__pyx_t_1);
4399
__Pyx_XGOTREF(__pyx_t_2);
4400
__Pyx_XGOTREF(__pyx_t_3);
4401
/*try:*/ {
4402
4403
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1048
4404
* cdef inline int import_ufunc() except -1:
4405
* try:
4406
* _import_umath() # <<<<<<<<<<<<<<
4407
* except Exception:
4408
* raise ImportError("numpy.core.umath failed to import")
4409
*/
4410
__pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error)
4411
4412
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
4413
*
4414
* cdef inline int import_ufunc() except -1:
4415
* try: # <<<<<<<<<<<<<<
4416
* _import_umath()
4417
* except Exception:
4418
*/
4419
}
4420
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4421
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4422
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4423
goto __pyx_L8_try_end;
4424
__pyx_L3_error:;
4425
4426
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1049
4427
* try:
4428
* _import_umath()
4429
* except Exception: # <<<<<<<<<<<<<<
4430
* raise ImportError("numpy.core.umath failed to import")
4431
*/
4432
__pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4433
if (__pyx_t_4) {
4434
__Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
4435
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error)
4436
__Pyx_GOTREF(__pyx_t_5);
4437
__Pyx_GOTREF(__pyx_t_6);
4438
__Pyx_GOTREF(__pyx_t_7);
4439
4440
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1050
4441
* _import_umath()
4442
* except Exception:
4443
* raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
4444
*/
4445
__pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error)
4446
__Pyx_GOTREF(__pyx_t_8);
4447
__Pyx_Raise(__pyx_t_8, 0, 0, 0);
4448
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4449
__PYX_ERR(1, 1050, __pyx_L5_except_error)
4450
}
4451
goto __pyx_L5_except_error;
4452
__pyx_L5_except_error:;
4453
4454
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
4455
*
4456
* cdef inline int import_ufunc() except -1:
4457
* try: # <<<<<<<<<<<<<<
4458
* _import_umath()
4459
* except Exception:
4460
*/
4461
__Pyx_XGIVEREF(__pyx_t_1);
4462
__Pyx_XGIVEREF(__pyx_t_2);
4463
__Pyx_XGIVEREF(__pyx_t_3);
4464
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4465
goto __pyx_L1_error;
4466
__pyx_L8_try_end:;
4467
}
4468
4469
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
4470
* raise ImportError("numpy.core.umath failed to import")
4471
*
4472
* cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
4473
* try:
4474
* _import_umath()
4475
*/
4476
4477
/* function exit code */
4478
__pyx_r = 0;
4479
goto __pyx_L0;
4480
__pyx_L1_error:;
4481
__Pyx_XDECREF(__pyx_t_5);
4482
__Pyx_XDECREF(__pyx_t_6);
4483
__Pyx_XDECREF(__pyx_t_7);
4484
__Pyx_XDECREF(__pyx_t_8);
4485
__Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
4486
__pyx_r = -1;
4487
__pyx_L0:;
4488
__Pyx_RefNannyFinishContext();
4489
return __pyx_r;
4490
}
4491
4492
static PyMethodDef __pyx_methods[] = {
4493
{0, 0, 0, 0}
4494
};
4495
4496
#if PY_MAJOR_VERSION >= 3
4497
#if CYTHON_PEP489_MULTI_PHASE_INIT
4498
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
4499
static int __pyx_pymod_exec_poly_overlaps(PyObject* module); /*proto*/
4500
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
4501
{Py_mod_create, (void*)__pyx_pymod_create},
4502
{Py_mod_exec, (void*)__pyx_pymod_exec_poly_overlaps},
4503
{0, NULL}
4504
};
4505
#endif
4506
4507
static struct PyModuleDef __pyx_moduledef = {
4508
PyModuleDef_HEAD_INIT,
4509
"poly_overlaps",
4510
0, /* m_doc */
4511
#if CYTHON_PEP489_MULTI_PHASE_INIT
4512
0, /* m_size */
4513
#else
4514
-1, /* m_size */
4515
#endif
4516
__pyx_methods /* m_methods */,
4517
#if CYTHON_PEP489_MULTI_PHASE_INIT
4518
__pyx_moduledef_slots, /* m_slots */
4519
#else
4520
NULL, /* m_reload */
4521
#endif
4522
NULL, /* m_traverse */
4523
NULL, /* m_clear */
4524
NULL /* m_free */
4525
};
4526
#endif
4527
#ifndef CYTHON_SMALL_CODE
4528
#if defined(__clang__)
4529
#define CYTHON_SMALL_CODE
4530
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
4531
#define CYTHON_SMALL_CODE __attribute__((cold))
4532
#else
4533
#define CYTHON_SMALL_CODE
4534
#endif
4535
#endif
4536
4537
static __Pyx_StringTabEntry __pyx_string_tab[] = {
4538
{&__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},
4539
{&__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},
4540
{&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
4541
{&__pyx_n_s_K, __pyx_k_K, sizeof(__pyx_k_K), 0, 0, 1, 1},
4542
{&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
4543
{&__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},
4544
{&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
4545
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
4546
{&__pyx_n_s_boxes, __pyx_k_boxes, sizeof(__pyx_k_boxes), 0, 0, 1, 1},
4547
{&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
4548
{&__pyx_n_s_device_id, __pyx_k_device_id, sizeof(__pyx_k_device_id), 0, 0, 1, 1},
4549
{&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
4550
{&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
4551
{&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
4552
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
4553
{&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
4554
{&__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},
4555
{&__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},
4556
{&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
4557
{&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
4558
{&__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},
4559
{&__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},
4560
{&__pyx_n_s_overlaps, __pyx_k_overlaps, sizeof(__pyx_k_overlaps), 0, 0, 1, 1},
4561
{&__pyx_n_s_poly_overlaps, __pyx_k_poly_overlaps, sizeof(__pyx_k_poly_overlaps), 0, 0, 1, 1},
4562
{&__pyx_kp_s_poly_overlaps_pyx, __pyx_k_poly_overlaps_pyx, sizeof(__pyx_k_poly_overlaps_pyx), 0, 0, 1, 0},
4563
{&__pyx_n_s_query_boxes, __pyx_k_query_boxes, sizeof(__pyx_k_query_boxes), 0, 0, 1, 1},
4564
{&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
4565
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
4566
{&__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},
4567
{&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
4568
{0, 0, 0, 0, 0, 0, 0}
4569
};
4570
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
4571
__pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error)
4572
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 285, __pyx_L1_error)
4573
__pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error)
4574
__pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error)
4575
return 0;
4576
__pyx_L1_error:;
4577
return -1;
4578
}
4579
4580
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
4581
__Pyx_RefNannyDeclarations
4582
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
4583
4584
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
4585
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
4586
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
4587
* raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
4588
*
4589
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
4590
*/
4591
__pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 272, __pyx_L1_error)
4592
__Pyx_GOTREF(__pyx_tuple_);
4593
__Pyx_GIVEREF(__pyx_tuple_);
4594
4595
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
4596
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
4597
* and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
4598
* raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
4599
*
4600
* info.buf = PyArray_DATA(self)
4601
*/
4602
__pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 276, __pyx_L1_error)
4603
__Pyx_GOTREF(__pyx_tuple__2);
4604
__Pyx_GIVEREF(__pyx_tuple__2);
4605
4606
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":306
4607
* if ((descr.byteorder == c'>' and little_endian) or
4608
* (descr.byteorder == c'<' and not little_endian)):
4609
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
4610
* if t == NPY_BYTE: f = "b"
4611
* elif t == NPY_UBYTE: f = "B"
4612
*/
4613
__pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 306, __pyx_L1_error)
4614
__Pyx_GOTREF(__pyx_tuple__3);
4615
__Pyx_GIVEREF(__pyx_tuple__3);
4616
4617
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
4618
*
4619
* if (end - f) - <int>(new_offset - offset[0]) < 15:
4620
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
4621
*
4622
* if ((child.byteorder == c'>' and little_endian) or
4623
*/
4624
__pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 856, __pyx_L1_error)
4625
__Pyx_GOTREF(__pyx_tuple__4);
4626
__Pyx_GIVEREF(__pyx_tuple__4);
4627
4628
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":880
4629
* t = child.type_num
4630
* if end - f < 5:
4631
* raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
4632
*
4633
* # Until ticket #99 is fixed, use integers to avoid warnings
4634
*/
4635
__pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 880, __pyx_L1_error)
4636
__Pyx_GOTREF(__pyx_tuple__5);
4637
__Pyx_GIVEREF(__pyx_tuple__5);
4638
4639
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038
4640
* _import_array()
4641
* except Exception:
4642
* raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
4643
*
4644
* cdef inline int import_umath() except -1:
4645
*/
4646
__pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 1038, __pyx_L1_error)
4647
__Pyx_GOTREF(__pyx_tuple__6);
4648
__Pyx_GIVEREF(__pyx_tuple__6);
4649
4650
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044
4651
* _import_umath()
4652
* except Exception:
4653
* raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
4654
*
4655
* cdef inline int import_ufunc() except -1:
4656
*/
4657
__pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1044, __pyx_L1_error)
4658
__Pyx_GOTREF(__pyx_tuple__7);
4659
__Pyx_GIVEREF(__pyx_tuple__7);
4660
4661
/* "poly_overlaps.pyx":7
4662
* void _overlaps(np.float32_t*, np.float32_t*, np.float32_t*, int, int, int)
4663
*
4664
* def poly_overlaps (np.ndarray[np.float32_t, ndim=2] boxes, np.ndarray[np.float32_t, ndim=2] query_boxes, np.int32_t device_id=0): # <<<<<<<<<<<<<<
4665
* cdef int N = boxes.shape[0]
4666
* cdef int K = query_boxes.shape[0]
4667
*/
4668
__pyx_tuple__8 = PyTuple_Pack(6, __pyx_n_s_boxes, __pyx_n_s_query_boxes, __pyx_n_s_device_id, __pyx_n_s_N, __pyx_n_s_K, __pyx_n_s_overlaps); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 7, __pyx_L1_error)
4669
__Pyx_GOTREF(__pyx_tuple__8);
4670
__Pyx_GIVEREF(__pyx_tuple__8);
4671
__pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_poly_overlaps_pyx, __pyx_n_s_poly_overlaps, 7, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 7, __pyx_L1_error)
4672
__Pyx_RefNannyFinishContext();
4673
return 0;
4674
__pyx_L1_error:;
4675
__Pyx_RefNannyFinishContext();
4676
return -1;
4677
}
4678
4679
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
4680
if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4681
return 0;
4682
__pyx_L1_error:;
4683
return -1;
4684
}
4685
4686
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
4687
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
4688
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
4689
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
4690
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
4691
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
4692
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
4693
4694
static int __Pyx_modinit_global_init_code(void) {
4695
__Pyx_RefNannyDeclarations
4696
__Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
4697
/*--- Global init code ---*/
4698
__Pyx_RefNannyFinishContext();
4699
return 0;
4700
}
4701
4702
static int __Pyx_modinit_variable_export_code(void) {
4703
__Pyx_RefNannyDeclarations
4704
__Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
4705
/*--- Variable export code ---*/
4706
__Pyx_RefNannyFinishContext();
4707
return 0;
4708
}
4709
4710
static int __Pyx_modinit_function_export_code(void) {
4711
__Pyx_RefNannyDeclarations
4712
__Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
4713
/*--- Function export code ---*/
4714
__Pyx_RefNannyFinishContext();
4715
return 0;
4716
}
4717
4718
static int __Pyx_modinit_type_init_code(void) {
4719
__Pyx_RefNannyDeclarations
4720
__Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
4721
/*--- Type init code ---*/
4722
__Pyx_RefNannyFinishContext();
4723
return 0;
4724
}
4725
4726
static int __Pyx_modinit_type_import_code(void) {
4727
__Pyx_RefNannyDeclarations
4728
PyObject *__pyx_t_1 = NULL;
4729
__Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
4730
/*--- Type import code ---*/
4731
__pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
4732
__Pyx_GOTREF(__pyx_t_1);
4733
__pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
4734
#if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
4735
sizeof(PyTypeObject),
4736
#else
4737
sizeof(PyHeapTypeObject),
4738
#endif
4739
__Pyx_ImportType_CheckSize_Warn);
4740
if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
4741
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4742
__pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error)
4743
__Pyx_GOTREF(__pyx_t_1);
4744
__pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
4745
if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error)
4746
__pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
4747
if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error)
4748
__pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
4749
if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error)
4750
__pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
4751
if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error)
4752
__pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
4753
if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error)
4754
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4755
__Pyx_RefNannyFinishContext();
4756
return 0;
4757
__pyx_L1_error:;
4758
__Pyx_XDECREF(__pyx_t_1);
4759
__Pyx_RefNannyFinishContext();
4760
return -1;
4761
}
4762
4763
static int __Pyx_modinit_variable_import_code(void) {
4764
__Pyx_RefNannyDeclarations
4765
__Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
4766
/*--- Variable import code ---*/
4767
__Pyx_RefNannyFinishContext();
4768
return 0;
4769
}
4770
4771
static int __Pyx_modinit_function_import_code(void) {
4772
__Pyx_RefNannyDeclarations
4773
__Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
4774
/*--- Function import code ---*/
4775
__Pyx_RefNannyFinishContext();
4776
return 0;
4777
}
4778
4779
4780
#if PY_MAJOR_VERSION < 3
4781
#ifdef CYTHON_NO_PYINIT_EXPORT
4782
#define __Pyx_PyMODINIT_FUNC void
4783
#else
4784
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
4785
#endif
4786
#else
4787
#ifdef CYTHON_NO_PYINIT_EXPORT
4788
#define __Pyx_PyMODINIT_FUNC PyObject *
4789
#else
4790
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
4791
#endif
4792
#endif
4793
4794
4795
#if PY_MAJOR_VERSION < 3
4796
__Pyx_PyMODINIT_FUNC initpoly_overlaps(void) CYTHON_SMALL_CODE; /*proto*/
4797
__Pyx_PyMODINIT_FUNC initpoly_overlaps(void)
4798
#else
4799
__Pyx_PyMODINIT_FUNC PyInit_poly_overlaps(void) CYTHON_SMALL_CODE; /*proto*/
4800
__Pyx_PyMODINIT_FUNC PyInit_poly_overlaps(void)
4801
#if CYTHON_PEP489_MULTI_PHASE_INIT
4802
{
4803
return PyModuleDef_Init(&__pyx_moduledef);
4804
}
4805
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
4806
#if PY_VERSION_HEX >= 0x030700A1
4807
static PY_INT64_T main_interpreter_id = -1;
4808
PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
4809
if (main_interpreter_id == -1) {
4810
main_interpreter_id = current_id;
4811
return (unlikely(current_id == -1)) ? -1 : 0;
4812
} else if (unlikely(main_interpreter_id != current_id))
4813
#else
4814
static PyInterpreterState *main_interpreter = NULL;
4815
PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
4816
if (!main_interpreter) {
4817
main_interpreter = current_interpreter;
4818
} else if (unlikely(main_interpreter != current_interpreter))
4819
#endif
4820
{
4821
PyErr_SetString(
4822
PyExc_ImportError,
4823
"Interpreter change detected - this module can only be loaded into one interpreter per process.");
4824
return -1;
4825
}
4826
return 0;
4827
}
4828
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) {
4829
PyObject *value = PyObject_GetAttrString(spec, from_name);
4830
int result = 0;
4831
if (likely(value)) {
4832
if (allow_none || value != Py_None) {
4833
result = PyDict_SetItemString(moddict, to_name, value);
4834
}
4835
Py_DECREF(value);
4836
} else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
4837
PyErr_Clear();
4838
} else {
4839
result = -1;
4840
}
4841
return result;
4842
}
4843
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
4844
PyObject *module = NULL, *moddict, *modname;
4845
if (__Pyx_check_single_interpreter())
4846
return NULL;
4847
if (__pyx_m)
4848
return __Pyx_NewRef(__pyx_m);
4849
modname = PyObject_GetAttrString(spec, "name");
4850
if (unlikely(!modname)) goto bad;
4851
module = PyModule_NewObject(modname);
4852
Py_DECREF(modname);
4853
if (unlikely(!module)) goto bad;
4854
moddict = PyModule_GetDict(module);
4855
if (unlikely(!moddict)) goto bad;
4856
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
4857
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
4858
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
4859
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
4860
return module;
4861
bad:
4862
Py_XDECREF(module);
4863
return NULL;
4864
}
4865
4866
4867
static CYTHON_SMALL_CODE int __pyx_pymod_exec_poly_overlaps(PyObject *__pyx_pyinit_module)
4868
#endif
4869
#endif
4870
{
4871
PyObject *__pyx_t_1 = NULL;
4872
__Pyx_RefNannyDeclarations
4873
#if CYTHON_PEP489_MULTI_PHASE_INIT
4874
if (__pyx_m) {
4875
if (__pyx_m == __pyx_pyinit_module) return 0;
4876
PyErr_SetString(PyExc_RuntimeError, "Module 'poly_overlaps' has already been imported. Re-initialisation is not supported.");
4877
return -1;
4878
}
4879
#elif PY_MAJOR_VERSION >= 3
4880
if (__pyx_m) return __Pyx_NewRef(__pyx_m);
4881
#endif
4882
#if CYTHON_REFNANNY
4883
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
4884
if (!__Pyx_RefNanny) {
4885
PyErr_Clear();
4886
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
4887
if (!__Pyx_RefNanny)
4888
Py_FatalError("failed to import 'refnanny' module");
4889
}
4890
#endif
4891
__Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_poly_overlaps(void)", 0);
4892
if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4893
#ifdef __Pxy_PyFrame_Initialize_Offsets
4894
__Pxy_PyFrame_Initialize_Offsets();
4895
#endif
4896
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
4897
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
4898
__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
4899
#ifdef __Pyx_CyFunction_USED
4900
if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4901
#endif
4902
#ifdef __Pyx_FusedFunction_USED
4903
if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4904
#endif
4905
#ifdef __Pyx_Coroutine_USED
4906
if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4907
#endif
4908
#ifdef __Pyx_Generator_USED
4909
if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4910
#endif
4911
#ifdef __Pyx_AsyncGen_USED
4912
if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4913
#endif
4914
#ifdef __Pyx_StopAsyncIteration_USED
4915
if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4916
#endif
4917
/*--- Library function declarations ---*/
4918
/*--- Threads initialization code ---*/
4919
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
4920
#ifdef WITH_THREAD /* Python build with threading support? */
4921
PyEval_InitThreads();
4922
#endif
4923
#endif
4924
/*--- Module creation code ---*/
4925
#if CYTHON_PEP489_MULTI_PHASE_INIT
4926
__pyx_m = __pyx_pyinit_module;
4927
Py_INCREF(__pyx_m);
4928
#else
4929
#if PY_MAJOR_VERSION < 3
4930
__pyx_m = Py_InitModule4("poly_overlaps", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
4931
#else
4932
__pyx_m = PyModule_Create(&__pyx_moduledef);
4933
#endif
4934
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
4935
#endif
4936
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
4937
Py_INCREF(__pyx_d);
4938
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
4939
Py_INCREF(__pyx_b);
4940
__pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
4941
Py_INCREF(__pyx_cython_runtime);
4942
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4943
/*--- Initialize various global constants etc. ---*/
4944
if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4945
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
4946
if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4947
#endif
4948
if (__pyx_module_is_main_poly_overlaps) {
4949
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4950
}
4951
#if PY_MAJOR_VERSION >= 3
4952
{
4953
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
4954
if (!PyDict_GetItemString(modules, "poly_overlaps")) {
4955
if (unlikely(PyDict_SetItemString(modules, "poly_overlaps", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
4956
}
4957
}
4958
#endif
4959
/*--- Builtin init code ---*/
4960
if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
4961
/*--- Constants init code ---*/
4962
if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
4963
/*--- Global type/function init code ---*/
4964
(void)__Pyx_modinit_global_init_code();
4965
(void)__Pyx_modinit_variable_export_code();
4966
(void)__Pyx_modinit_function_export_code();
4967
(void)__Pyx_modinit_type_init_code();
4968
if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
4969
(void)__Pyx_modinit_variable_import_code();
4970
(void)__Pyx_modinit_function_import_code();
4971
/*--- Execution code ---*/
4972
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
4973
if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4974
#endif
4975
4976
/* "poly_overlaps.pyx":1
4977
* import numpy as np # <<<<<<<<<<<<<<
4978
* cimport numpy as np
4979
*
4980
*/
4981
__pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
4982
__Pyx_GOTREF(__pyx_t_1);
4983
if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4984
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4985
4986
/* "poly_overlaps.pyx":7
4987
* void _overlaps(np.float32_t*, np.float32_t*, np.float32_t*, int, int, int)
4988
*
4989
* def poly_overlaps (np.ndarray[np.float32_t, ndim=2] boxes, np.ndarray[np.float32_t, ndim=2] query_boxes, np.int32_t device_id=0): # <<<<<<<<<<<<<<
4990
* cdef int N = boxes.shape[0]
4991
* cdef int K = query_boxes.shape[0]
4992
*/
4993
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_13poly_overlaps_1poly_overlaps, NULL, __pyx_n_s_poly_overlaps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
4994
__Pyx_GOTREF(__pyx_t_1);
4995
if (PyDict_SetItem(__pyx_d, __pyx_n_s_poly_overlaps, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
4996
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4997
4998
/* "poly_overlaps.pyx":1
4999
* import numpy as np # <<<<<<<<<<<<<<
5000
* cimport numpy as np
5001
*
5002
*/
5003
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
5004
__Pyx_GOTREF(__pyx_t_1);
5005
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5006
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5007
5008
/* "../../../anaconda3/envs/mmdet/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
5009
* raise ImportError("numpy.core.umath failed to import")
5010
*
5011
* cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
5012
* try:
5013
* _import_umath()
5014
*/
5015
5016
/*--- Wrapped vars code ---*/
5017
5018
goto __pyx_L0;
5019
__pyx_L1_error:;
5020
__Pyx_XDECREF(__pyx_t_1);
5021
if (__pyx_m) {
5022
if (__pyx_d) {
5023
__Pyx_AddTraceback("init poly_overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
5024
}
5025
Py_CLEAR(__pyx_m);
5026
} else if (!PyErr_Occurred()) {
5027
PyErr_SetString(PyExc_ImportError, "init poly_overlaps");
5028
}
5029
__pyx_L0:;
5030
__Pyx_RefNannyFinishContext();
5031
#if CYTHON_PEP489_MULTI_PHASE_INIT
5032
return (__pyx_m != NULL) ? 0 : -1;
5033
#elif PY_MAJOR_VERSION >= 3
5034
return __pyx_m;
5035
#else
5036
return;
5037
#endif
5038
}
5039
5040
/* --- Runtime support code --- */
5041
/* Refnanny */
5042
#if CYTHON_REFNANNY
5043
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
5044
PyObject *m = NULL, *p = NULL;
5045
void *r = NULL;
5046
m = PyImport_ImportModule(modname);
5047
if (!m) goto end;
5048
p = PyObject_GetAttrString(m, "RefNannyAPI");
5049
if (!p) goto end;
5050
r = PyLong_AsVoidPtr(p);
5051
end:
5052
Py_XDECREF(p);
5053
Py_XDECREF(m);
5054
return (__Pyx_RefNannyAPIStruct *)r;
5055
}
5056
#endif
5057
5058
/* RaiseArgTupleInvalid */
5059
static void __Pyx_RaiseArgtupleInvalid(
5060
const char* func_name,
5061
int exact,
5062
Py_ssize_t num_min,
5063
Py_ssize_t num_max,
5064
Py_ssize_t num_found)
5065
{
5066
Py_ssize_t num_expected;
5067
const char *more_or_less;
5068
if (num_found < num_min) {
5069
num_expected = num_min;
5070
more_or_less = "at least";
5071
} else {
5072
num_expected = num_max;
5073
more_or_less = "at most";
5074
}
5075
if (exact) {
5076
more_or_less = "exactly";
5077
}
5078
PyErr_Format(PyExc_TypeError,
5079
"%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
5080
func_name, more_or_less, num_expected,
5081
(num_expected == 1) ? "" : "s", num_found);
5082
}
5083
5084
/* RaiseDoubleKeywords */
5085
static void __Pyx_RaiseDoubleKeywordsError(
5086
const char* func_name,
5087
PyObject* kw_name)
5088
{
5089
PyErr_Format(PyExc_TypeError,
5090
#if PY_MAJOR_VERSION >= 3
5091
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
5092
#else
5093
"%s() got multiple values for keyword argument '%s'", func_name,
5094
PyString_AsString(kw_name));
5095
#endif
5096
}
5097
5098
/* ParseKeywords */
5099
static int __Pyx_ParseOptionalKeywords(
5100
PyObject *kwds,
5101
PyObject **argnames[],
5102
PyObject *kwds2,
5103
PyObject *values[],
5104
Py_ssize_t num_pos_args,
5105
const char* function_name)
5106
{
5107
PyObject *key = 0, *value = 0;
5108
Py_ssize_t pos = 0;
5109
PyObject*** name;
5110
PyObject*** first_kw_arg = argnames + num_pos_args;
5111
while (PyDict_Next(kwds, &pos, &key, &value)) {
5112
name = first_kw_arg;
5113
while (*name && (**name != key)) name++;
5114
if (*name) {
5115
values[name-argnames] = value;
5116
continue;
5117
}
5118
name = first_kw_arg;
5119
#if PY_MAJOR_VERSION < 3
5120
if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
5121
while (*name) {
5122
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
5123
&& _PyString_Eq(**name, key)) {
5124
values[name-argnames] = value;
5125
break;
5126
}
5127
name++;
5128
}
5129
if (*name) continue;
5130
else {
5131
PyObject*** argname = argnames;
5132
while (argname != first_kw_arg) {
5133
if ((**argname == key) || (
5134
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
5135
&& _PyString_Eq(**argname, key))) {
5136
goto arg_passed_twice;
5137
}
5138
argname++;
5139
}
5140
}
5141
} else
5142
#endif
5143
if (likely(PyUnicode_Check(key))) {
5144
while (*name) {
5145
int cmp = (**name == key) ? 0 :
5146
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
5147
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
5148
#endif
5149
PyUnicode_Compare(**name, key);
5150
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
5151
if (cmp == 0) {
5152
values[name-argnames] = value;
5153
break;
5154
}
5155
name++;
5156
}
5157
if (*name) continue;
5158
else {
5159
PyObject*** argname = argnames;
5160
while (argname != first_kw_arg) {
5161
int cmp = (**argname == key) ? 0 :
5162
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
5163
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
5164
#endif
5165
PyUnicode_Compare(**argname, key);
5166
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
5167
if (cmp == 0) goto arg_passed_twice;
5168
argname++;
5169
}
5170
}
5171
} else
5172
goto invalid_keyword_type;
5173
if (kwds2) {
5174
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
5175
} else {
5176
goto invalid_keyword;
5177
}
5178
}
5179
return 0;
5180
arg_passed_twice:
5181
__Pyx_RaiseDoubleKeywordsError(function_name, key);
5182
goto bad;
5183
invalid_keyword_type:
5184
PyErr_Format(PyExc_TypeError,
5185
"%.200s() keywords must be strings", function_name);
5186
goto bad;
5187
invalid_keyword:
5188
PyErr_Format(PyExc_TypeError,
5189
#if PY_MAJOR_VERSION < 3
5190
"%.200s() got an unexpected keyword argument '%.200s'",
5191
function_name, PyString_AsString(key));
5192
#else
5193
"%s() got an unexpected keyword argument '%U'",
5194
function_name, key);
5195
#endif
5196
bad:
5197
return -1;
5198
}
5199
5200
/* ArgTypeTest */
5201
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
5202
{
5203
if (unlikely(!type)) {
5204
PyErr_SetString(PyExc_SystemError, "Missing type object");
5205
return 0;
5206
}
5207
else if (exact) {
5208
#if PY_MAJOR_VERSION == 2
5209
if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
5210
#endif
5211
}
5212
else {
5213
if (likely(__Pyx_TypeCheck(obj, type))) return 1;
5214
}
5215
PyErr_Format(PyExc_TypeError,
5216
"Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
5217
name, type->tp_name, Py_TYPE(obj)->tp_name);
5218
return 0;
5219
}
5220
5221
/* IsLittleEndian */
5222
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
5223
{
5224
union {
5225
uint32_t u32;
5226
uint8_t u8[4];
5227
} S;
5228
S.u32 = 0x01020304;
5229
return S.u8[0] == 4;
5230
}
5231
5232
/* BufferFormatCheck */
5233
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
5234
__Pyx_BufFmt_StackElem* stack,
5235
__Pyx_TypeInfo* type) {
5236
stack[0].field = &ctx->root;
5237
stack[0].parent_offset = 0;
5238
ctx->root.type = type;
5239
ctx->root.name = "buffer dtype";
5240
ctx->root.offset = 0;
5241
ctx->head = stack;
5242
ctx->head->field = &ctx->root;
5243
ctx->fmt_offset = 0;
5244
ctx->head->parent_offset = 0;
5245
ctx->new_packmode = '@';
5246
ctx->enc_packmode = '@';
5247
ctx->new_count = 1;
5248
ctx->enc_count = 0;
5249
ctx->enc_type = 0;
5250
ctx->is_complex = 0;
5251
ctx->is_valid_array = 0;
5252
ctx->struct_alignment = 0;
5253
while (type->typegroup == 'S') {
5254
++ctx->head;
5255
ctx->head->field = type->fields;
5256
ctx->head->parent_offset = 0;
5257
type = type->fields->type;
5258
}
5259
}
5260
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
5261
int count;
5262
const char* t = *ts;
5263
if (*t < '0' || *t > '9') {
5264
return -1;
5265
} else {
5266
count = *t++ - '0';
5267
while (*t >= '0' && *t <= '9') {
5268
count *= 10;
5269
count += *t++ - '0';
5270
}
5271
}
5272
*ts = t;
5273
return count;
5274
}
5275
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
5276
int number = __Pyx_BufFmt_ParseNumber(ts);
5277
if (number == -1)
5278
PyErr_Format(PyExc_ValueError,\
5279
"Does not understand character buffer dtype format string ('%c')", **ts);
5280
return number;
5281
}
5282
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
5283
PyErr_Format(PyExc_ValueError,
5284
"Unexpected format string character: '%c'", ch);
5285
}
5286
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
5287
switch (ch) {
5288
case '?': return "'bool'";
5289
case 'c': return "'char'";
5290
case 'b': return "'signed char'";
5291
case 'B': return "'unsigned char'";
5292
case 'h': return "'short'";
5293
case 'H': return "'unsigned short'";
5294
case 'i': return "'int'";
5295
case 'I': return "'unsigned int'";
5296
case 'l': return "'long'";
5297
case 'L': return "'unsigned long'";
5298
case 'q': return "'long long'";
5299
case 'Q': return "'unsigned long long'";
5300
case 'f': return (is_complex ? "'complex float'" : "'float'");
5301
case 'd': return (is_complex ? "'complex double'" : "'double'");
5302
case 'g': return (is_complex ? "'complex long double'" : "'long double'");
5303
case 'T': return "a struct";
5304
case 'O': return "Python object";
5305
case 'P': return "a pointer";
5306
case 's': case 'p': return "a string";
5307
case 0: return "end";
5308
default: return "unparseable format string";
5309
}
5310
}
5311
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
5312
switch (ch) {
5313
case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
5314
case 'h': case 'H': return 2;
5315
case 'i': case 'I': case 'l': case 'L': return 4;
5316
case 'q': case 'Q': return 8;
5317
case 'f': return (is_complex ? 8 : 4);
5318
case 'd': return (is_complex ? 16 : 8);
5319
case 'g': {
5320
PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
5321
return 0;
5322
}
5323
case 'O': case 'P': return sizeof(void*);
5324
default:
5325
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
5326
return 0;
5327
}
5328
}
5329
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
5330
switch (ch) {
5331
case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
5332
case 'h': case 'H': return sizeof(short);
5333
case 'i': case 'I': return sizeof(int);
5334
case 'l': case 'L': return sizeof(long);
5335
#ifdef HAVE_LONG_LONG
5336
case 'q': case 'Q': return sizeof(PY_LONG_LONG);
5337
#endif
5338
case 'f': return sizeof(float) * (is_complex ? 2 : 1);
5339
case 'd': return sizeof(double) * (is_complex ? 2 : 1);
5340
case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
5341
case 'O': case 'P': return sizeof(void*);
5342
default: {
5343
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
5344
return 0;
5345
}
5346
}
5347
}
5348
typedef struct { char c; short x; } __Pyx_st_short;
5349
typedef struct { char c; int x; } __Pyx_st_int;
5350
typedef struct { char c; long x; } __Pyx_st_long;
5351
typedef struct { char c; float x; } __Pyx_st_float;
5352
typedef struct { char c; double x; } __Pyx_st_double;
5353
typedef struct { char c; long double x; } __Pyx_st_longdouble;
5354
typedef struct { char c; void *x; } __Pyx_st_void_p;
5355
#ifdef HAVE_LONG_LONG
5356
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
5357
#endif
5358
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
5359
switch (ch) {
5360
case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
5361
case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
5362
case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
5363
case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
5364
#ifdef HAVE_LONG_LONG
5365
case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
5366
#endif
5367
case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
5368
case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
5369
case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
5370
case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
5371
default:
5372
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
5373
return 0;
5374
}
5375
}
5376
/* These are for computing the padding at the end of the struct to align
5377
on the first member of the struct. This will probably the same as above,
5378
but we don't have any guarantees.
5379
*/
5380
typedef struct { short x; char c; } __Pyx_pad_short;
5381
typedef struct { int x; char c; } __Pyx_pad_int;
5382
typedef struct { long x; char c; } __Pyx_pad_long;
5383
typedef struct { float x; char c; } __Pyx_pad_float;
5384
typedef struct { double x; char c; } __Pyx_pad_double;
5385
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
5386
typedef struct { void *x; char c; } __Pyx_pad_void_p;
5387
#ifdef HAVE_LONG_LONG
5388
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
5389
#endif
5390
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
5391
switch (ch) {
5392
case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
5393
case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
5394
case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
5395
case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
5396
#ifdef HAVE_LONG_LONG
5397
case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
5398
#endif
5399
case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
5400
case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
5401
case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
5402
case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
5403
default:
5404
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
5405
return 0;
5406
}
5407
}
5408
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
5409
switch (ch) {
5410
case 'c':
5411
return 'H';
5412
case 'b': case 'h': case 'i':
5413
case 'l': case 'q': case 's': case 'p':
5414
return 'I';
5415
case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
5416
return 'U';
5417
case 'f': case 'd': case 'g':
5418
return (is_complex ? 'C' : 'R');
5419
case 'O':
5420
return 'O';
5421
case 'P':
5422
return 'P';
5423
default: {
5424
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
5425
return 0;
5426
}
5427
}
5428
}
5429
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
5430
if (ctx->head == NULL || ctx->head->field == &ctx->root) {
5431
const char* expected;
5432
const char* quote;
5433
if (ctx->head == NULL) {
5434
expected = "end";
5435
quote = "";
5436
} else {
5437
expected = ctx->head->field->type->name;
5438
quote = "'";
5439
}
5440
PyErr_Format(PyExc_ValueError,
5441
"Buffer dtype mismatch, expected %s%s%s but got %s",
5442
quote, expected, quote,
5443
__Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
5444
} else {
5445
__Pyx_StructField* field = ctx->head->field;
5446
__Pyx_StructField* parent = (ctx->head - 1)->field;
5447
PyErr_Format(PyExc_ValueError,
5448
"Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
5449
field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
5450
parent->type->name, field->name);
5451
}
5452
}
5453
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
5454
char group;
5455
size_t size, offset, arraysize = 1;
5456
if (ctx->enc_type == 0) return 0;
5457
if (ctx->head->field->type->arraysize[0]) {
5458
int i, ndim = 0;
5459
if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
5460
ctx->is_valid_array = ctx->head->field->type->ndim == 1;
5461
ndim = 1;
5462
if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
5463
PyErr_Format(PyExc_ValueError,
5464
"Expected a dimension of size %zu, got %zu",
5465
ctx->head->field->type->arraysize[0], ctx->enc_count);
5466
return -1;
5467
}
5468
}
5469
if (!ctx->is_valid_array) {
5470
PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
5471
ctx->head->field->type->ndim, ndim);
5472
return -1;
5473
}
5474
for (i = 0; i < ctx->head->field->type->ndim; i++) {
5475
arraysize *= ctx->head->field->type->arraysize[i];
5476
}
5477
ctx->is_valid_array = 0;
5478
ctx->enc_count = 1;
5479
}
5480
group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
5481
do {
5482
__Pyx_StructField* field = ctx->head->field;
5483
__Pyx_TypeInfo* type = field->type;
5484
if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
5485
size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
5486
} else {
5487
size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
5488
}
5489
if (ctx->enc_packmode == '@') {
5490
size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
5491
size_t align_mod_offset;
5492
if (align_at == 0) return -1;
5493
align_mod_offset = ctx->fmt_offset % align_at;
5494
if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
5495
if (ctx->struct_alignment == 0)
5496
ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
5497
ctx->is_complex);
5498
}
5499
if (type->size != size || type->typegroup != group) {
5500
if (type->typegroup == 'C' && type->fields != NULL) {
5501
size_t parent_offset = ctx->head->parent_offset + field->offset;
5502
++ctx->head;
5503
ctx->head->field = type->fields;
5504
ctx->head->parent_offset = parent_offset;
5505
continue;
5506
}
5507
if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
5508
} else {
5509
__Pyx_BufFmt_RaiseExpected(ctx);
5510
return -1;
5511
}
5512
}
5513
offset = ctx->head->parent_offset + field->offset;
5514
if (ctx->fmt_offset != offset) {
5515
PyErr_Format(PyExc_ValueError,
5516
"Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
5517
(Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
5518
return -1;
5519
}
5520
ctx->fmt_offset += size;
5521
if (arraysize)
5522
ctx->fmt_offset += (arraysize - 1) * size;
5523
--ctx->enc_count;
5524
while (1) {
5525
if (field == &ctx->root) {
5526
ctx->head = NULL;
5527
if (ctx->enc_count != 0) {
5528
__Pyx_BufFmt_RaiseExpected(ctx);
5529
return -1;
5530
}
5531
break;
5532
}
5533
ctx->head->field = ++field;
5534
if (field->type == NULL) {
5535
--ctx->head;
5536
field = ctx->head->field;
5537
continue;
5538
} else if (field->type->typegroup == 'S') {
5539
size_t parent_offset = ctx->head->parent_offset + field->offset;
5540
if (field->type->fields->type == NULL) continue;
5541
field = field->type->fields;
5542
++ctx->head;
5543
ctx->head->field = field;
5544
ctx->head->parent_offset = parent_offset;
5545
break;
5546
} else {
5547
break;
5548
}
5549
}
5550
} while (ctx->enc_count);
5551
ctx->enc_type = 0;
5552
ctx->is_complex = 0;
5553
return 0;
5554
}
5555
static PyObject *
5556
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
5557
{
5558
const char *ts = *tsp;
5559
int i = 0, number;
5560
int ndim = ctx->head->field->type->ndim;
5561
;
5562
++ts;
5563
if (ctx->new_count != 1) {
5564
PyErr_SetString(PyExc_ValueError,
5565
"Cannot handle repeated arrays in format string");
5566
return NULL;
5567
}
5568
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
5569
while (*ts && *ts != ')') {
5570
switch (*ts) {
5571
case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
5572
default: break;
5573
}
5574
number = __Pyx_BufFmt_ExpectNumber(&ts);
5575
if (number == -1) return NULL;
5576
if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
5577
return PyErr_Format(PyExc_ValueError,
5578
"Expected a dimension of size %zu, got %d",
5579
ctx->head->field->type->arraysize[i], number);
5580
if (*ts != ',' && *ts != ')')
5581
return PyErr_Format(PyExc_ValueError,
5582
"Expected a comma in format string, got '%c'", *ts);
5583
if (*ts == ',') ts++;
5584
i++;
5585
}
5586
if (i != ndim)
5587
return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
5588
ctx->head->field->type->ndim, i);
5589
if (!*ts) {
5590
PyErr_SetString(PyExc_ValueError,
5591
"Unexpected end of format string, expected ')'");
5592
return NULL;
5593
}
5594
ctx->is_valid_array = 1;
5595
ctx->new_count = 1;
5596
*tsp = ++ts;
5597
return Py_None;
5598
}
5599
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
5600
int got_Z = 0;
5601
while (1) {
5602
switch(*ts) {
5603
case 0:
5604
if (ctx->enc_type != 0 && ctx->head == NULL) {
5605
__Pyx_BufFmt_RaiseExpected(ctx);
5606
return NULL;
5607
}
5608
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
5609
if (ctx->head != NULL) {
5610
__Pyx_BufFmt_RaiseExpected(ctx);
5611
return NULL;
5612
}
5613
return ts;
5614
case ' ':
5615
case '\r':
5616
case '\n':
5617
++ts;
5618
break;
5619
case '<':
5620
if (!__Pyx_Is_Little_Endian()) {
5621
PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
5622
return NULL;
5623
}
5624
ctx->new_packmode = '=';
5625
++ts;
5626
break;
5627
case '>':
5628
case '!':
5629
if (__Pyx_Is_Little_Endian()) {
5630
PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
5631
return NULL;
5632
}
5633
ctx->new_packmode = '=';
5634
++ts;
5635
break;
5636
case '=':
5637
case '@':
5638
case '^':
5639
ctx->new_packmode = *ts++;
5640
break;
5641
case 'T':
5642
{
5643
const char* ts_after_sub;
5644
size_t i, struct_count = ctx->new_count;
5645
size_t struct_alignment = ctx->struct_alignment;
5646
ctx->new_count = 1;
5647
++ts;
5648
if (*ts != '{') {
5649
PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
5650
return NULL;
5651
}
5652
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
5653
ctx->enc_type = 0;
5654
ctx->enc_count = 0;
5655
ctx->struct_alignment = 0;
5656
++ts;
5657
ts_after_sub = ts;
5658
for (i = 0; i != struct_count; ++i) {
5659
ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
5660
if (!ts_after_sub) return NULL;
5661
}
5662
ts = ts_after_sub;
5663
if (struct_alignment) ctx->struct_alignment = struct_alignment;
5664
}
5665
break;
5666
case '}':
5667
{
5668
size_t alignment = ctx->struct_alignment;
5669
++ts;
5670
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
5671
ctx->enc_type = 0;
5672
if (alignment && ctx->fmt_offset % alignment) {
5673
ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
5674
}
5675
}
5676
return ts;
5677
case 'x':
5678
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
5679
ctx->fmt_offset += ctx->new_count;
5680
ctx->new_count = 1;
5681
ctx->enc_count = 0;
5682
ctx->enc_type = 0;
5683
ctx->enc_packmode = ctx->new_packmode;
5684
++ts;
5685
break;
5686
case 'Z':
5687
got_Z = 1;
5688
++ts;
5689
if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
5690
__Pyx_BufFmt_RaiseUnexpectedChar('Z');
5691
return NULL;
5692
}
5693
CYTHON_FALLTHROUGH;
5694
case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
5695
case 'l': case 'L': case 'q': case 'Q':
5696
case 'f': case 'd': case 'g':
5697
case 'O': case 'p':
5698
if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
5699
ctx->enc_packmode == ctx->new_packmode) {
5700
ctx->enc_count += ctx->new_count;
5701
ctx->new_count = 1;
5702
got_Z = 0;
5703
++ts;
5704
break;
5705
}
5706
CYTHON_FALLTHROUGH;
5707
case 's':
5708
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
5709
ctx->enc_count = ctx->new_count;
5710
ctx->enc_packmode = ctx->new_packmode;
5711
ctx->enc_type = *ts;
5712
ctx->is_complex = got_Z;
5713
++ts;
5714
ctx->new_count = 1;
5715
got_Z = 0;
5716
break;
5717
case ':':
5718
++ts;
5719
while(*ts != ':') ++ts;
5720
++ts;
5721
break;
5722
case '(':
5723
if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
5724
break;
5725
default:
5726
{
5727
int number = __Pyx_BufFmt_ExpectNumber(&ts);
5728
if (number == -1) return NULL;
5729
ctx->new_count = (size_t)number;
5730
}
5731
}
5732
}
5733
}
5734
5735
/* BufferGetAndValidate */
5736
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
5737
if (unlikely(info->buf == NULL)) return;
5738
if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
5739
__Pyx_ReleaseBuffer(info);
5740
}
5741
static void __Pyx_ZeroBuffer(Py_buffer* buf) {
5742
buf->buf = NULL;
5743
buf->obj = NULL;
5744
buf->strides = __Pyx_zeros;
5745
buf->shape = __Pyx_zeros;
5746
buf->suboffsets = __Pyx_minusones;
5747
}
5748
static int __Pyx__GetBufferAndValidate(
5749
Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
5750
int nd, int cast, __Pyx_BufFmt_StackElem* stack)
5751
{
5752
buf->buf = NULL;
5753
if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
5754
__Pyx_ZeroBuffer(buf);
5755
return -1;
5756
}
5757
if (unlikely(buf->ndim != nd)) {
5758
PyErr_Format(PyExc_ValueError,
5759
"Buffer has wrong number of dimensions (expected %d, got %d)",
5760
nd, buf->ndim);
5761
goto fail;
5762
}
5763
if (!cast) {
5764
__Pyx_BufFmt_Context ctx;
5765
__Pyx_BufFmt_Init(&ctx, stack, dtype);
5766
if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
5767
}
5768
if (unlikely((size_t)buf->itemsize != dtype->size)) {
5769
PyErr_Format(PyExc_ValueError,
5770
"Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
5771
buf->itemsize, (buf->itemsize > 1) ? "s" : "",
5772
dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
5773
goto fail;
5774
}
5775
if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
5776
return 0;
5777
fail:;
5778
__Pyx_SafeReleaseBuffer(buf);
5779
return -1;
5780
}
5781
5782
/* PyObjectGetAttrStr */
5783
#if CYTHON_USE_TYPE_SLOTS
5784
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
5785
PyTypeObject* tp = Py_TYPE(obj);
5786
if (likely(tp->tp_getattro))
5787
return tp->tp_getattro(obj, attr_name);
5788
#if PY_MAJOR_VERSION < 3
5789
if (likely(tp->tp_getattr))
5790
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
5791
#endif
5792
return PyObject_GetAttr(obj, attr_name);
5793
}
5794
#endif
5795
5796
/* GetBuiltinName */
5797
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
5798
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
5799
if (unlikely(!result)) {
5800
PyErr_Format(PyExc_NameError,
5801
#if PY_MAJOR_VERSION >= 3
5802
"name '%U' is not defined", name);
5803
#else
5804
"name '%.200s' is not defined", PyString_AS_STRING(name));
5805
#endif
5806
}
5807
return result;
5808
}
5809
5810
/* PyDictVersioning */
5811
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
5812
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
5813
PyObject *dict = Py_TYPE(obj)->tp_dict;
5814
return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
5815
}
5816
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
5817
PyObject **dictptr = NULL;
5818
Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
5819
if (offset) {
5820
#if CYTHON_COMPILING_IN_CPYTHON
5821
dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
5822
#else
5823
dictptr = _PyObject_GetDictPtr(obj);
5824
#endif
5825
}
5826
return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
5827
}
5828
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
5829
PyObject *dict = Py_TYPE(obj)->tp_dict;
5830
if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
5831
return 0;
5832
return obj_dict_version == __Pyx_get_object_dict_version(obj);
5833
}
5834
#endif
5835
5836
/* GetModuleGlobalName */
5837
#if CYTHON_USE_DICT_VERSIONS
5838
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
5839
#else
5840
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
5841
#endif
5842
{
5843
PyObject *result;
5844
#if !CYTHON_AVOID_BORROWED_REFS
5845
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
5846
result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
5847
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5848
if (likely(result)) {
5849
return __Pyx_NewRef(result);
5850
} else if (unlikely(PyErr_Occurred())) {
5851
return NULL;
5852
}
5853
#else
5854
result = PyDict_GetItem(__pyx_d, name);
5855
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5856
if (likely(result)) {
5857
return __Pyx_NewRef(result);
5858
}
5859
#endif
5860
#else
5861
result = PyObject_GetItem(__pyx_d, name);
5862
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5863
if (likely(result)) {
5864
return __Pyx_NewRef(result);
5865
}
5866
PyErr_Clear();
5867
#endif
5868
return __Pyx_GetBuiltinName(name);
5869
}
5870
5871
/* PyObjectCall */
5872
#if CYTHON_COMPILING_IN_CPYTHON
5873
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
5874
PyObject *result;
5875
ternaryfunc call = func->ob_type->tp_call;
5876
if (unlikely(!call))
5877
return PyObject_Call(func, arg, kw);
5878
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
5879
return NULL;
5880
result = (*call)(func, arg, kw);
5881
Py_LeaveRecursiveCall();
5882
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
5883
PyErr_SetString(
5884
PyExc_SystemError,
5885
"NULL result without error in PyObject_Call");
5886
}
5887
return result;
5888
}
5889
#endif
5890
5891
/* ExtTypeTest */
5892
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
5893
if (unlikely(!type)) {
5894
PyErr_SetString(PyExc_SystemError, "Missing type object");
5895
return 0;
5896
}
5897
if (likely(__Pyx_TypeCheck(obj, type)))
5898
return 1;
5899
PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
5900
Py_TYPE(obj)->tp_name, type->tp_name);
5901
return 0;
5902
}
5903
5904
/* BufferIndexError */
5905
static void __Pyx_RaiseBufferIndexError(int axis) {
5906
PyErr_Format(PyExc_IndexError,
5907
"Out of bounds on buffer access (axis %d)", axis);
5908
}
5909
5910
/* PyErrFetchRestore */
5911
#if CYTHON_FAST_THREAD_STATE
5912
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
5913
PyObject *tmp_type, *tmp_value, *tmp_tb;
5914
tmp_type = tstate->curexc_type;
5915
tmp_value = tstate->curexc_value;
5916
tmp_tb = tstate->curexc_traceback;
5917
tstate->curexc_type = type;
5918
tstate->curexc_value = value;
5919
tstate->curexc_traceback = tb;
5920
Py_XDECREF(tmp_type);
5921
Py_XDECREF(tmp_value);
5922
Py_XDECREF(tmp_tb);
5923
}
5924
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
5925
*type = tstate->curexc_type;
5926
*value = tstate->curexc_value;
5927
*tb = tstate->curexc_traceback;
5928
tstate->curexc_type = 0;
5929
tstate->curexc_value = 0;
5930
tstate->curexc_traceback = 0;
5931
}
5932
#endif
5933
5934
/* RaiseException */
5935
#if PY_MAJOR_VERSION < 3
5936
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
5937
CYTHON_UNUSED PyObject *cause) {
5938
__Pyx_PyThreadState_declare
5939
Py_XINCREF(type);
5940
if (!value || value == Py_None)
5941
value = NULL;
5942
else
5943
Py_INCREF(value);
5944
if (!tb || tb == Py_None)
5945
tb = NULL;
5946
else {
5947
Py_INCREF(tb);
5948
if (!PyTraceBack_Check(tb)) {
5949
PyErr_SetString(PyExc_TypeError,
5950
"raise: arg 3 must be a traceback or None");
5951
goto raise_error;
5952
}
5953
}
5954
if (PyType_Check(type)) {
5955
#if CYTHON_COMPILING_IN_PYPY
5956
if (!value) {
5957
Py_INCREF(Py_None);
5958
value = Py_None;
5959
}
5960
#endif
5961
PyErr_NormalizeException(&type, &value, &tb);
5962
} else {
5963
if (value) {
5964
PyErr_SetString(PyExc_TypeError,
5965
"instance exception may not have a separate value");
5966
goto raise_error;
5967
}
5968
value = type;
5969
type = (PyObject*) Py_TYPE(type);
5970
Py_INCREF(type);
5971
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
5972
PyErr_SetString(PyExc_TypeError,
5973
"raise: exception class must be a subclass of BaseException");
5974
goto raise_error;
5975
}
5976
}
5977
__Pyx_PyThreadState_assign
5978
__Pyx_ErrRestore(type, value, tb);
5979
return;
5980
raise_error:
5981
Py_XDECREF(value);
5982
Py_XDECREF(type);
5983
Py_XDECREF(tb);
5984
return;
5985
}
5986
#else
5987
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
5988
PyObject* owned_instance = NULL;
5989
if (tb == Py_None) {
5990
tb = 0;
5991
} else if (tb && !PyTraceBack_Check(tb)) {
5992
PyErr_SetString(PyExc_TypeError,
5993
"raise: arg 3 must be a traceback or None");
5994
goto bad;
5995
}
5996
if (value == Py_None)
5997
value = 0;
5998
if (PyExceptionInstance_Check(type)) {
5999
if (value) {
6000
PyErr_SetString(PyExc_TypeError,
6001
"instance exception may not have a separate value");
6002
goto bad;
6003
}
6004
value = type;
6005
type = (PyObject*) Py_TYPE(value);
6006
} else if (PyExceptionClass_Check(type)) {
6007
PyObject *instance_class = NULL;
6008
if (value && PyExceptionInstance_Check(value)) {
6009
instance_class = (PyObject*) Py_TYPE(value);
6010
if (instance_class != type) {
6011
int is_subclass = PyObject_IsSubclass(instance_class, type);
6012
if (!is_subclass) {
6013
instance_class = NULL;
6014
} else if (unlikely(is_subclass == -1)) {
6015
goto bad;
6016
} else {
6017
type = instance_class;
6018
}
6019
}
6020
}
6021
if (!instance_class) {
6022
PyObject *args;
6023
if (!value)
6024
args = PyTuple_New(0);
6025
else if (PyTuple_Check(value)) {
6026
Py_INCREF(value);
6027
args = value;
6028
} else
6029
args = PyTuple_Pack(1, value);
6030
if (!args)
6031
goto bad;
6032
owned_instance = PyObject_Call(type, args, NULL);
6033
Py_DECREF(args);
6034
if (!owned_instance)
6035
goto bad;
6036
value = owned_instance;
6037
if (!PyExceptionInstance_Check(value)) {
6038
PyErr_Format(PyExc_TypeError,
6039
"calling %R should have returned an instance of "
6040
"BaseException, not %R",
6041
type, Py_TYPE(value));
6042
goto bad;
6043
}
6044
}
6045
} else {
6046
PyErr_SetString(PyExc_TypeError,
6047
"raise: exception class must be a subclass of BaseException");
6048
goto bad;
6049
}
6050
if (cause) {
6051
PyObject *fixed_cause;
6052
if (cause == Py_None) {
6053
fixed_cause = NULL;
6054
} else if (PyExceptionClass_Check(cause)) {
6055
fixed_cause = PyObject_CallObject(cause, NULL);
6056
if (fixed_cause == NULL)
6057
goto bad;
6058
} else if (PyExceptionInstance_Check(cause)) {
6059
fixed_cause = cause;
6060
Py_INCREF(fixed_cause);
6061
} else {
6062
PyErr_SetString(PyExc_TypeError,
6063
"exception causes must derive from "
6064
"BaseException");
6065
goto bad;
6066
}
6067
PyException_SetCause(value, fixed_cause);
6068
}
6069
PyErr_SetObject(type, value);
6070
if (tb) {
6071
#if CYTHON_COMPILING_IN_PYPY
6072
PyObject *tmp_type, *tmp_value, *tmp_tb;
6073
PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
6074
Py_INCREF(tb);
6075
PyErr_Restore(tmp_type, tmp_value, tb);
6076
Py_XDECREF(tmp_tb);
6077
#else
6078
PyThreadState *tstate = __Pyx_PyThreadState_Current;
6079
PyObject* tmp_tb = tstate->curexc_traceback;
6080
if (tb != tmp_tb) {
6081
Py_INCREF(tb);
6082
tstate->curexc_traceback = tb;
6083
Py_XDECREF(tmp_tb);
6084
}
6085
#endif
6086
}
6087
bad:
6088
Py_XDECREF(owned_instance);
6089
return;
6090
}
6091
#endif
6092
6093
/* PyCFunctionFastCall */
6094
#if CYTHON_FAST_PYCCALL
6095
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
6096
PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
6097
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
6098
PyObject *self = PyCFunction_GET_SELF(func);
6099
int flags = PyCFunction_GET_FLAGS(func);
6100
assert(PyCFunction_Check(func));
6101
assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
6102
assert(nargs >= 0);
6103
assert(nargs == 0 || args != NULL);
6104
/* _PyCFunction_FastCallDict() must not be called with an exception set,
6105
because it may clear it (directly or indirectly) and so the
6106
caller loses its exception */
6107
assert(!PyErr_Occurred());
6108
if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
6109
return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
6110
} else {
6111
return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
6112
}
6113
}
6114
#endif
6115
6116
/* PyFunctionFastCall */
6117
#if CYTHON_FAST_PYCALL
6118
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
6119
PyObject *globals) {
6120
PyFrameObject *f;
6121
PyThreadState *tstate = __Pyx_PyThreadState_Current;
6122
PyObject **fastlocals;
6123
Py_ssize_t i;
6124
PyObject *result;
6125
assert(globals != NULL);
6126
/* XXX Perhaps we should create a specialized
6127
PyFrame_New() that doesn't take locals, but does
6128
take builtins without sanity checking them.
6129
*/
6130
assert(tstate != NULL);
6131
f = PyFrame_New(tstate, co, globals, NULL);
6132
if (f == NULL) {
6133
return NULL;
6134
}
6135
fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
6136
for (i = 0; i < na; i++) {
6137
Py_INCREF(*args);
6138
fastlocals[i] = *args++;
6139
}
6140
result = PyEval_EvalFrameEx(f,0);
6141
++tstate->recursion_depth;
6142
Py_DECREF(f);
6143
--tstate->recursion_depth;
6144
return result;
6145
}
6146
#if 1 || PY_VERSION_HEX < 0x030600B1
6147
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
6148
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
6149
PyObject *globals = PyFunction_GET_GLOBALS(func);
6150
PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
6151
PyObject *closure;
6152
#if PY_MAJOR_VERSION >= 3
6153
PyObject *kwdefs;
6154
#endif
6155
PyObject *kwtuple, **k;
6156
PyObject **d;
6157
Py_ssize_t nd;
6158
Py_ssize_t nk;
6159
PyObject *result;
6160
assert(kwargs == NULL || PyDict_Check(kwargs));
6161
nk = kwargs ? PyDict_Size(kwargs) : 0;
6162
if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
6163
return NULL;
6164
}
6165
if (
6166
#if PY_MAJOR_VERSION >= 3
6167
co->co_kwonlyargcount == 0 &&
6168
#endif
6169
likely(kwargs == NULL || nk == 0) &&
6170
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
6171
if (argdefs == NULL && co->co_argcount == nargs) {
6172
result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
6173
goto done;
6174
}
6175
else if (nargs == 0 && argdefs != NULL
6176
&& co->co_argcount == Py_SIZE(argdefs)) {
6177
/* function called with no arguments, but all parameters have
6178
a default value: use default values as arguments .*/
6179
args = &PyTuple_GET_ITEM(argdefs, 0);
6180
result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
6181
goto done;
6182
}
6183
}
6184
if (kwargs != NULL) {
6185
Py_ssize_t pos, i;
6186
kwtuple = PyTuple_New(2 * nk);
6187
if (kwtuple == NULL) {
6188
result = NULL;
6189
goto done;
6190
}
6191
k = &PyTuple_GET_ITEM(kwtuple, 0);
6192
pos = i = 0;
6193
while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
6194
Py_INCREF(k[i]);
6195
Py_INCREF(k[i+1]);
6196
i += 2;
6197
}
6198
nk = i / 2;
6199
}
6200
else {
6201
kwtuple = NULL;
6202
k = NULL;
6203
}
6204
closure = PyFunction_GET_CLOSURE(func);
6205
#if PY_MAJOR_VERSION >= 3
6206
kwdefs = PyFunction_GET_KW_DEFAULTS(func);
6207
#endif
6208
if (argdefs != NULL) {
6209
d = &PyTuple_GET_ITEM(argdefs, 0);
6210
nd = Py_SIZE(argdefs);
6211
}
6212
else {
6213
d = NULL;
6214
nd = 0;
6215
}
6216
#if PY_MAJOR_VERSION >= 3
6217
result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
6218
args, (int)nargs,
6219
k, (int)nk,
6220
d, (int)nd, kwdefs, closure);
6221
#else
6222
result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
6223
args, (int)nargs,
6224
k, (int)nk,
6225
d, (int)nd, closure);
6226
#endif
6227
Py_XDECREF(kwtuple);
6228
done:
6229
Py_LeaveRecursiveCall();
6230
return result;
6231
}
6232
#endif
6233
#endif
6234
6235
/* PyObjectCallMethO */
6236
#if CYTHON_COMPILING_IN_CPYTHON
6237
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
6238
PyObject *self, *result;
6239
PyCFunction cfunc;
6240
cfunc = PyCFunction_GET_FUNCTION(func);
6241
self = PyCFunction_GET_SELF(func);
6242
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6243
return NULL;
6244
result = cfunc(self, arg);
6245
Py_LeaveRecursiveCall();
6246
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6247
PyErr_SetString(
6248
PyExc_SystemError,
6249
"NULL result without error in PyObject_Call");
6250
}
6251
return result;
6252
}
6253
#endif
6254
6255
/* PyObjectCallOneArg */
6256
#if CYTHON_COMPILING_IN_CPYTHON
6257
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6258
PyObject *result;
6259
PyObject *args = PyTuple_New(1);
6260
if (unlikely(!args)) return NULL;
6261
Py_INCREF(arg);
6262
PyTuple_SET_ITEM(args, 0, arg);
6263
result = __Pyx_PyObject_Call(func, args, NULL);
6264
Py_DECREF(args);
6265
return result;
6266
}
6267
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6268
#if CYTHON_FAST_PYCALL
6269
if (PyFunction_Check(func)) {
6270
return __Pyx_PyFunction_FastCall(func, &arg, 1);
6271
}
6272
#endif
6273
if (likely(PyCFunction_Check(func))) {
6274
if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
6275
return __Pyx_PyObject_CallMethO(func, arg);
6276
#if CYTHON_FAST_PYCCALL
6277
} else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
6278
return __Pyx_PyCFunction_FastCall(func, &arg, 1);
6279
#endif
6280
}
6281
}
6282
return __Pyx__PyObject_CallOneArg(func, arg);
6283
}
6284
#else
6285
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6286
PyObject *result;
6287
PyObject *args = PyTuple_Pack(1, arg);
6288
if (unlikely(!args)) return NULL;
6289
result = __Pyx_PyObject_Call(func, args, NULL);
6290
Py_DECREF(args);
6291
return result;
6292
}
6293
#endif
6294
6295
/* DictGetItem */
6296
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
6297
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
6298
PyObject *value;
6299
value = PyDict_GetItemWithError(d, key);
6300
if (unlikely(!value)) {
6301
if (!PyErr_Occurred()) {
6302
if (unlikely(PyTuple_Check(key))) {
6303
PyObject* args = PyTuple_Pack(1, key);
6304
if (likely(args)) {
6305
PyErr_SetObject(PyExc_KeyError, args);
6306
Py_DECREF(args);
6307
}
6308
} else {
6309
PyErr_SetObject(PyExc_KeyError, key);
6310
}
6311
}
6312
return NULL;
6313
}
6314
Py_INCREF(value);
6315
return value;
6316
}
6317
#endif
6318
6319
/* RaiseTooManyValuesToUnpack */
6320
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
6321
PyErr_Format(PyExc_ValueError,
6322
"too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
6323
}
6324
6325
/* RaiseNeedMoreValuesToUnpack */
6326
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
6327
PyErr_Format(PyExc_ValueError,
6328
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
6329
index, (index == 1) ? "" : "s");
6330
}
6331
6332
/* RaiseNoneIterError */
6333
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
6334
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
6335
}
6336
6337
/* GetTopmostException */
6338
#if CYTHON_USE_EXC_INFO_STACK
6339
static _PyErr_StackItem *
6340
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
6341
{
6342
_PyErr_StackItem *exc_info = tstate->exc_info;
6343
while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
6344
exc_info->previous_item != NULL)
6345
{
6346
exc_info = exc_info->previous_item;
6347
}
6348
return exc_info;
6349
}
6350
#endif
6351
6352
/* SaveResetException */
6353
#if CYTHON_FAST_THREAD_STATE
6354
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
6355
#if CYTHON_USE_EXC_INFO_STACK
6356
_PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
6357
*type = exc_info->exc_type;
6358
*value = exc_info->exc_value;
6359
*tb = exc_info->exc_traceback;
6360
#else
6361
*type = tstate->exc_type;
6362
*value = tstate->exc_value;
6363
*tb = tstate->exc_traceback;
6364
#endif
6365
Py_XINCREF(*type);
6366
Py_XINCREF(*value);
6367
Py_XINCREF(*tb);
6368
}
6369
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
6370
PyObject *tmp_type, *tmp_value, *tmp_tb;
6371
#if CYTHON_USE_EXC_INFO_STACK
6372
_PyErr_StackItem *exc_info = tstate->exc_info;
6373
tmp_type = exc_info->exc_type;
6374
tmp_value = exc_info->exc_value;
6375
tmp_tb = exc_info->exc_traceback;
6376
exc_info->exc_type = type;
6377
exc_info->exc_value = value;
6378
exc_info->exc_traceback = tb;
6379
#else
6380
tmp_type = tstate->exc_type;
6381
tmp_value = tstate->exc_value;
6382
tmp_tb = tstate->exc_traceback;
6383
tstate->exc_type = type;
6384
tstate->exc_value = value;
6385
tstate->exc_traceback = tb;
6386
#endif
6387
Py_XDECREF(tmp_type);
6388
Py_XDECREF(tmp_value);
6389
Py_XDECREF(tmp_tb);
6390
}
6391
#endif
6392
6393
/* PyErrExceptionMatches */
6394
#if CYTHON_FAST_THREAD_STATE
6395
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
6396
Py_ssize_t i, n;
6397
n = PyTuple_GET_SIZE(tuple);
6398
#if PY_MAJOR_VERSION >= 3
6399
for (i=0; i<n; i++) {
6400
if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
6401
}
6402
#endif
6403
for (i=0; i<n; i++) {
6404
if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
6405
}
6406
return 0;
6407
}
6408
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
6409
PyObject *exc_type = tstate->curexc_type;
6410
if (exc_type == err) return 1;
6411
if (unlikely(!exc_type)) return 0;
6412
if (unlikely(PyTuple_Check(err)))
6413
return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
6414
return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
6415
}
6416
#endif
6417
6418
/* GetException */
6419
#if CYTHON_FAST_THREAD_STATE
6420
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
6421
#else
6422
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
6423
#endif
6424
{
6425
PyObject *local_type, *local_value, *local_tb;
6426
#if CYTHON_FAST_THREAD_STATE
6427
PyObject *tmp_type, *tmp_value, *tmp_tb;
6428
local_type = tstate->curexc_type;
6429
local_value = tstate->curexc_value;
6430
local_tb = tstate->curexc_traceback;
6431
tstate->curexc_type = 0;
6432
tstate->curexc_value = 0;
6433
tstate->curexc_traceback = 0;
6434
#else
6435
PyErr_Fetch(&local_type, &local_value, &local_tb);
6436
#endif
6437
PyErr_NormalizeException(&local_type, &local_value, &local_tb);
6438
#if CYTHON_FAST_THREAD_STATE
6439
if (unlikely(tstate->curexc_type))
6440
#else
6441
if (unlikely(PyErr_Occurred()))
6442
#endif
6443
goto bad;
6444
#if PY_MAJOR_VERSION >= 3
6445
if (local_tb) {
6446
if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
6447
goto bad;
6448
}
6449
#endif
6450
Py_XINCREF(local_tb);
6451
Py_XINCREF(local_type);
6452
Py_XINCREF(local_value);
6453
*type = local_type;
6454
*value = local_value;
6455
*tb = local_tb;
6456
#if CYTHON_FAST_THREAD_STATE
6457
#if CYTHON_USE_EXC_INFO_STACK
6458
{
6459
_PyErr_StackItem *exc_info = tstate->exc_info;
6460
tmp_type = exc_info->exc_type;
6461
tmp_value = exc_info->exc_value;
6462
tmp_tb = exc_info->exc_traceback;
6463
exc_info->exc_type = local_type;
6464
exc_info->exc_value = local_value;
6465
exc_info->exc_traceback = local_tb;
6466
}
6467
#else
6468
tmp_type = tstate->exc_type;
6469
tmp_value = tstate->exc_value;
6470
tmp_tb = tstate->exc_traceback;
6471
tstate->exc_type = local_type;
6472
tstate->exc_value = local_value;
6473
tstate->exc_traceback = local_tb;
6474
#endif
6475
Py_XDECREF(tmp_type);
6476
Py_XDECREF(tmp_value);
6477
Py_XDECREF(tmp_tb);
6478
#else
6479
PyErr_SetExcInfo(local_type, local_value, local_tb);
6480
#endif
6481
return 0;
6482
bad:
6483
*type = 0;
6484
*value = 0;
6485
*tb = 0;
6486
Py_XDECREF(local_type);
6487
Py_XDECREF(local_value);
6488
Py_XDECREF(local_tb);
6489
return -1;
6490
}
6491
6492
/* TypeImport */
6493
#ifndef __PYX_HAVE_RT_ImportType
6494
#define __PYX_HAVE_RT_ImportType
6495
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
6496
size_t size, enum __Pyx_ImportType_CheckSize check_size)
6497
{
6498
PyObject *result = 0;
6499
char warning[200];
6500
Py_ssize_t basicsize;
6501
#ifdef Py_LIMITED_API
6502
PyObject *py_basicsize;
6503
#endif
6504
result = PyObject_GetAttrString(module, class_name);
6505
if (!result)
6506
goto bad;
6507
if (!PyType_Check(result)) {
6508
PyErr_Format(PyExc_TypeError,
6509
"%.200s.%.200s is not a type object",
6510
module_name, class_name);
6511
goto bad;
6512
}
6513
#ifndef Py_LIMITED_API
6514
basicsize = ((PyTypeObject *)result)->tp_basicsize;
6515
#else
6516
py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
6517
if (!py_basicsize)
6518
goto bad;
6519
basicsize = PyLong_AsSsize_t(py_basicsize);
6520
Py_DECREF(py_basicsize);
6521
py_basicsize = 0;
6522
if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
6523
goto bad;
6524
#endif
6525
if ((size_t)basicsize < size) {
6526
PyErr_Format(PyExc_ValueError,
6527
"%.200s.%.200s size changed, may indicate binary incompatibility. "
6528
"Expected %zd from C header, got %zd from PyObject",
6529
module_name, class_name, size, basicsize);
6530
goto bad;
6531
}
6532
if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
6533
PyErr_Format(PyExc_ValueError,
6534
"%.200s.%.200s size changed, may indicate binary incompatibility. "
6535
"Expected %zd from C header, got %zd from PyObject",
6536
module_name, class_name, size, basicsize);
6537
goto bad;
6538
}
6539
else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
6540
PyOS_snprintf(warning, sizeof(warning),
6541
"%s.%s size changed, may indicate binary incompatibility. "
6542
"Expected %zd from C header, got %zd from PyObject",
6543
module_name, class_name, size, basicsize);
6544
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
6545
}
6546
return (PyTypeObject *)result;
6547
bad:
6548
Py_XDECREF(result);
6549
return NULL;
6550
}
6551
#endif
6552
6553
/* Import */
6554
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
6555
PyObject *empty_list = 0;
6556
PyObject *module = 0;
6557
PyObject *global_dict = 0;
6558
PyObject *empty_dict = 0;
6559
PyObject *list;
6560
#if PY_MAJOR_VERSION < 3
6561
PyObject *py_import;
6562
py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
6563
if (!py_import)
6564
goto bad;
6565
#endif
6566
if (from_list)
6567
list = from_list;
6568
else {
6569
empty_list = PyList_New(0);
6570
if (!empty_list)
6571
goto bad;
6572
list = empty_list;
6573
}
6574
global_dict = PyModule_GetDict(__pyx_m);
6575
if (!global_dict)
6576
goto bad;
6577
empty_dict = PyDict_New();
6578
if (!empty_dict)
6579
goto bad;
6580
{
6581
#if PY_MAJOR_VERSION >= 3
6582
if (level == -1) {
6583
if (strchr(__Pyx_MODULE_NAME, '.')) {
6584
module = PyImport_ImportModuleLevelObject(
6585
name, global_dict, empty_dict, list, 1);
6586
if (!module) {
6587
if (!PyErr_ExceptionMatches(PyExc_ImportError))
6588
goto bad;
6589
PyErr_Clear();
6590
}
6591
}
6592
level = 0;
6593
}
6594
#endif
6595
if (!module) {
6596
#if PY_MAJOR_VERSION < 3
6597
PyObject *py_level = PyInt_FromLong(level);
6598
if (!py_level)
6599
goto bad;
6600
module = PyObject_CallFunctionObjArgs(py_import,
6601
name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
6602
Py_DECREF(py_level);
6603
#else
6604
module = PyImport_ImportModuleLevelObject(
6605
name, global_dict, empty_dict, list, level);
6606
#endif
6607
}
6608
}
6609
bad:
6610
#if PY_MAJOR_VERSION < 3
6611
Py_XDECREF(py_import);
6612
#endif
6613
Py_XDECREF(empty_list);
6614
Py_XDECREF(empty_dict);
6615
return module;
6616
}
6617
6618
/* CLineInTraceback */
6619
#ifndef CYTHON_CLINE_IN_TRACEBACK
6620
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
6621
PyObject *use_cline;
6622
PyObject *ptype, *pvalue, *ptraceback;
6623
#if CYTHON_COMPILING_IN_CPYTHON
6624
PyObject **cython_runtime_dict;
6625
#endif
6626
if (unlikely(!__pyx_cython_runtime)) {
6627
return c_line;
6628
}
6629
__Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
6630
#if CYTHON_COMPILING_IN_CPYTHON
6631
cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
6632
if (likely(cython_runtime_dict)) {
6633
__PYX_PY_DICT_LOOKUP_IF_MODIFIED(
6634
use_cline, *cython_runtime_dict,
6635
__Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
6636
} else
6637
#endif
6638
{
6639
PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
6640
if (use_cline_obj) {
6641
use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
6642
Py_DECREF(use_cline_obj);
6643
} else {
6644
PyErr_Clear();
6645
use_cline = NULL;
6646
}
6647
}
6648
if (!use_cline) {
6649
c_line = 0;
6650
PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
6651
}
6652
else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
6653
c_line = 0;
6654
}
6655
__Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
6656
return c_line;
6657
}
6658
#endif
6659
6660
/* CodeObjectCache */
6661
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
6662
int start = 0, mid = 0, end = count - 1;
6663
if (end >= 0 && code_line > entries[end].code_line) {
6664
return count;
6665
}
6666
while (start < end) {
6667
mid = start + (end - start) / 2;
6668
if (code_line < entries[mid].code_line) {
6669
end = mid;
6670
} else if (code_line > entries[mid].code_line) {
6671
start = mid + 1;
6672
} else {
6673
return mid;
6674
}
6675
}
6676
if (code_line <= entries[mid].code_line) {
6677
return mid;
6678
} else {
6679
return mid + 1;
6680
}
6681
}
6682
static PyCodeObject *__pyx_find_code_object(int code_line) {
6683
PyCodeObject* code_object;
6684
int pos;
6685
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
6686
return NULL;
6687
}
6688
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
6689
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
6690
return NULL;
6691
}
6692
code_object = __pyx_code_cache.entries[pos].code_object;
6693
Py_INCREF(code_object);
6694
return code_object;
6695
}
6696
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
6697
int pos, i;
6698
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
6699
if (unlikely(!code_line)) {
6700
return;
6701
}
6702
if (unlikely(!entries)) {
6703
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
6704
if (likely(entries)) {
6705
__pyx_code_cache.entries = entries;
6706
__pyx_code_cache.max_count = 64;
6707
__pyx_code_cache.count = 1;
6708
entries[0].code_line = code_line;
6709
entries[0].code_object = code_object;
6710
Py_INCREF(code_object);
6711
}
6712
return;
6713
}
6714
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
6715
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
6716
PyCodeObject* tmp = entries[pos].code_object;
6717
entries[pos].code_object = code_object;
6718
Py_DECREF(tmp);
6719
return;
6720
}
6721
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
6722
int new_max = __pyx_code_cache.max_count + 64;
6723
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
6724
__pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
6725
if (unlikely(!entries)) {
6726
return;
6727
}
6728
__pyx_code_cache.entries = entries;
6729
__pyx_code_cache.max_count = new_max;
6730
}
6731
for (i=__pyx_code_cache.count; i>pos; i--) {
6732
entries[i] = entries[i-1];
6733
}
6734
entries[pos].code_line = code_line;
6735
entries[pos].code_object = code_object;
6736
__pyx_code_cache.count++;
6737
Py_INCREF(code_object);
6738
}
6739
6740
/* AddTraceback */
6741
#include "compile.h"
6742
#include "frameobject.h"
6743
#include "traceback.h"
6744
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
6745
const char *funcname, int c_line,
6746
int py_line, const char *filename) {
6747
PyCodeObject *py_code = 0;
6748
PyObject *py_srcfile = 0;
6749
PyObject *py_funcname = 0;
6750
#if PY_MAJOR_VERSION < 3
6751
py_srcfile = PyString_FromString(filename);
6752
#else
6753
py_srcfile = PyUnicode_FromString(filename);
6754
#endif
6755
if (!py_srcfile) goto bad;
6756
if (c_line) {
6757
#if PY_MAJOR_VERSION < 3
6758
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
6759
#else
6760
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
6761
#endif
6762
}
6763
else {
6764
#if PY_MAJOR_VERSION < 3
6765
py_funcname = PyString_FromString(funcname);
6766
#else
6767
py_funcname = PyUnicode_FromString(funcname);
6768
#endif
6769
}
6770
if (!py_funcname) goto bad;
6771
py_code = __Pyx_PyCode_New(
6772
0,
6773
0,
6774
0,
6775
0,
6776
0,
6777
__pyx_empty_bytes, /*PyObject *code,*/
6778
__pyx_empty_tuple, /*PyObject *consts,*/
6779
__pyx_empty_tuple, /*PyObject *names,*/
6780
__pyx_empty_tuple, /*PyObject *varnames,*/
6781
__pyx_empty_tuple, /*PyObject *freevars,*/
6782
__pyx_empty_tuple, /*PyObject *cellvars,*/
6783
py_srcfile, /*PyObject *filename,*/
6784
py_funcname, /*PyObject *name,*/
6785
py_line,
6786
__pyx_empty_bytes /*PyObject *lnotab*/
6787
);
6788
Py_DECREF(py_srcfile);
6789
Py_DECREF(py_funcname);
6790
return py_code;
6791
bad:
6792
Py_XDECREF(py_srcfile);
6793
Py_XDECREF(py_funcname);
6794
return NULL;
6795
}
6796
static void __Pyx_AddTraceback(const char *funcname, int c_line,
6797
int py_line, const char *filename) {
6798
PyCodeObject *py_code = 0;
6799
PyFrameObject *py_frame = 0;
6800
PyThreadState *tstate = __Pyx_PyThreadState_Current;
6801
if (c_line) {
6802
c_line = __Pyx_CLineForTraceback(tstate, c_line);
6803
}
6804
py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
6805
if (!py_code) {
6806
py_code = __Pyx_CreateCodeObjectForTraceback(
6807
funcname, c_line, py_line, filename);
6808
if (!py_code) goto bad;
6809
__pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
6810
}
6811
py_frame = PyFrame_New(
6812
tstate, /*PyThreadState *tstate,*/
6813
py_code, /*PyCodeObject *code,*/
6814
__pyx_d, /*PyObject *globals,*/
6815
0 /*PyObject *locals*/
6816
);
6817
if (!py_frame) goto bad;
6818
__Pyx_PyFrame_SetLineNumber(py_frame, py_line);
6819
PyTraceBack_Here(py_frame);
6820
bad:
6821
Py_XDECREF(py_code);
6822
Py_XDECREF(py_frame);
6823
}
6824
6825
#if PY_MAJOR_VERSION < 3
6826
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
6827
if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
6828
if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
6829
PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
6830
return -1;
6831
}
6832
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
6833
PyObject *obj = view->obj;
6834
if (!obj) return;
6835
if (PyObject_CheckBuffer(obj)) {
6836
PyBuffer_Release(view);
6837
return;
6838
}
6839
if ((0)) {}
6840
else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
6841
view->obj = NULL;
6842
Py_DECREF(obj);
6843
}
6844
#endif
6845
6846
6847
/* CIntFromPyVerify */
6848
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
6849
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
6850
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
6851
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
6852
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
6853
{\
6854
func_type value = func_value;\
6855
if (sizeof(target_type) < sizeof(func_type)) {\
6856
if (unlikely(value != (func_type) (target_type) value)) {\
6857
func_type zero = 0;\
6858
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
6859
return (target_type) -1;\
6860
if (is_unsigned && unlikely(value < zero))\
6861
goto raise_neg_overflow;\
6862
else\
6863
goto raise_overflow;\
6864
}\
6865
}\
6866
return (target_type) value;\
6867
}
6868
6869
/* CIntToPy */
6870
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
6871
const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
6872
const int is_unsigned = neg_one > const_zero;
6873
if (is_unsigned) {
6874
if (sizeof(int) < sizeof(long)) {
6875
return PyInt_FromLong((long) value);
6876
} else if (sizeof(int) <= sizeof(unsigned long)) {
6877
return PyLong_FromUnsignedLong((unsigned long) value);
6878
#ifdef HAVE_LONG_LONG
6879
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
6880
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
6881
#endif
6882
}
6883
} else {
6884
if (sizeof(int) <= sizeof(long)) {
6885
return PyInt_FromLong((long) value);
6886
#ifdef HAVE_LONG_LONG
6887
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
6888
return PyLong_FromLongLong((PY_LONG_LONG) value);
6889
#endif
6890
}
6891
}
6892
{
6893
int one = 1; int little = (int)*(unsigned char *)&one;
6894
unsigned char *bytes = (unsigned char *)&value;
6895
return _PyLong_FromByteArray(bytes, sizeof(int),
6896
little, !is_unsigned);
6897
}
6898
}
6899
6900
/* Declarations */
6901
#if CYTHON_CCOMPLEX
6902
#ifdef __cplusplus
6903
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
6904
return ::std::complex< float >(x, y);
6905
}
6906
#else
6907
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
6908
return x + y*(__pyx_t_float_complex)_Complex_I;
6909
}
6910
#endif
6911
#else
6912
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
6913
__pyx_t_float_complex z;
6914
z.real = x;
6915
z.imag = y;
6916
return z;
6917
}
6918
#endif
6919
6920
/* Arithmetic */
6921
#if CYTHON_CCOMPLEX
6922
#else
6923
static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6924
return (a.real == b.real) && (a.imag == b.imag);
6925
}
6926
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6927
__pyx_t_float_complex z;
6928
z.real = a.real + b.real;
6929
z.imag = a.imag + b.imag;
6930
return z;
6931
}
6932
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6933
__pyx_t_float_complex z;
6934
z.real = a.real - b.real;
6935
z.imag = a.imag - b.imag;
6936
return z;
6937
}
6938
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6939
__pyx_t_float_complex z;
6940
z.real = a.real * b.real - a.imag * b.imag;
6941
z.imag = a.real * b.imag + a.imag * b.real;
6942
return z;
6943
}
6944
#if 1
6945
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6946
if (b.imag == 0) {
6947
return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
6948
} else if (fabsf(b.real) >= fabsf(b.imag)) {
6949
if (b.real == 0 && b.imag == 0) {
6950
return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
6951
} else {
6952
float r = b.imag / b.real;
6953
float s = (float)(1.0) / (b.real + b.imag * r);
6954
return __pyx_t_float_complex_from_parts(
6955
(a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
6956
}
6957
} else {
6958
float r = b.real / b.imag;
6959
float s = (float)(1.0) / (b.imag + b.real * r);
6960
return __pyx_t_float_complex_from_parts(
6961
(a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
6962
}
6963
}
6964
#else
6965
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
6966
if (b.imag == 0) {
6967
return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
6968
} else {
6969
float denom = b.real * b.real + b.imag * b.imag;
6970
return __pyx_t_float_complex_from_parts(
6971
(a.real * b.real + a.imag * b.imag) / denom,
6972
(a.imag * b.real - a.real * b.imag) / denom);
6973
}
6974
}
6975
#endif
6976
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
6977
__pyx_t_float_complex z;
6978
z.real = -a.real;
6979
z.imag = -a.imag;
6980
return z;
6981
}
6982
static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
6983
return (a.real == 0) && (a.imag == 0);
6984
}
6985
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
6986
__pyx_t_float_complex z;
6987
z.real = a.real;
6988
z.imag = -a.imag;
6989
return z;
6990
}
6991
#if 1
6992
static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
6993
#if !defined(HAVE_HYPOT) || defined(_MSC_VER)
6994
return sqrtf(z.real*z.real + z.imag*z.imag);
6995
#else
6996
return hypotf(z.real, z.imag);
6997
#endif
6998
}
6999
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
7000
__pyx_t_float_complex z;
7001
float r, lnr, theta, z_r, z_theta;
7002
if (b.imag == 0 && b.real == (int)b.real) {
7003
if (b.real < 0) {
7004
float denom = a.real * a.real + a.imag * a.imag;
7005
a.real = a.real / denom;
7006
a.imag = -a.imag / denom;
7007
b.real = -b.real;
7008
}
7009
switch ((int)b.real) {
7010
case 0:
7011
z.real = 1;
7012
z.imag = 0;
7013
return z;
7014
case 1:
7015
return a;
7016
case 2:
7017
return __Pyx_c_prod_float(a, a);
7018
case 3:
7019
z = __Pyx_c_prod_float(a, a);
7020
return __Pyx_c_prod_float(z, a);
7021
case 4:
7022
z = __Pyx_c_prod_float(a, a);
7023
return __Pyx_c_prod_float(z, z);
7024
}
7025
}
7026
if (a.imag == 0) {
7027
if (a.real == 0) {
7028
return a;
7029
} else if (b.imag == 0) {
7030
z.real = powf(a.real, b.real);
7031
z.imag = 0;
7032
return z;
7033
} else if (a.real > 0) {
7034
r = a.real;
7035
theta = 0;
7036
} else {
7037
r = -a.real;
7038
theta = atan2f(0.0, -1.0);
7039
}
7040
} else {
7041
r = __Pyx_c_abs_float(a);
7042
theta = atan2f(a.imag, a.real);
7043
}
7044
lnr = logf(r);
7045
z_r = expf(lnr * b.real - theta * b.imag);
7046
z_theta = theta * b.real + lnr * b.imag;
7047
z.real = z_r * cosf(z_theta);
7048
z.imag = z_r * sinf(z_theta);
7049
return z;
7050
}
7051
#endif
7052
#endif
7053
7054
/* Declarations */
7055
#if CYTHON_CCOMPLEX
7056
#ifdef __cplusplus
7057
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
7058
return ::std::complex< double >(x, y);
7059
}
7060
#else
7061
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
7062
return x + y*(__pyx_t_double_complex)_Complex_I;
7063
}
7064
#endif
7065
#else
7066
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
7067
__pyx_t_double_complex z;
7068
z.real = x;
7069
z.imag = y;
7070
return z;
7071
}
7072
#endif
7073
7074
/* Arithmetic */
7075
#if CYTHON_CCOMPLEX
7076
#else
7077
static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7078
return (a.real == b.real) && (a.imag == b.imag);
7079
}
7080
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7081
__pyx_t_double_complex z;
7082
z.real = a.real + b.real;
7083
z.imag = a.imag + b.imag;
7084
return z;
7085
}
7086
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7087
__pyx_t_double_complex z;
7088
z.real = a.real - b.real;
7089
z.imag = a.imag - b.imag;
7090
return z;
7091
}
7092
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7093
__pyx_t_double_complex z;
7094
z.real = a.real * b.real - a.imag * b.imag;
7095
z.imag = a.real * b.imag + a.imag * b.real;
7096
return z;
7097
}
7098
#if 1
7099
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7100
if (b.imag == 0) {
7101
return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
7102
} else if (fabs(b.real) >= fabs(b.imag)) {
7103
if (b.real == 0 && b.imag == 0) {
7104
return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
7105
} else {
7106
double r = b.imag / b.real;
7107
double s = (double)(1.0) / (b.real + b.imag * r);
7108
return __pyx_t_double_complex_from_parts(
7109
(a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
7110
}
7111
} else {
7112
double r = b.real / b.imag;
7113
double s = (double)(1.0) / (b.imag + b.real * r);
7114
return __pyx_t_double_complex_from_parts(
7115
(a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
7116
}
7117
}
7118
#else
7119
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7120
if (b.imag == 0) {
7121
return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
7122
} else {
7123
double denom = b.real * b.real + b.imag * b.imag;
7124
return __pyx_t_double_complex_from_parts(
7125
(a.real * b.real + a.imag * b.imag) / denom,
7126
(a.imag * b.real - a.real * b.imag) / denom);
7127
}
7128
}
7129
#endif
7130
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
7131
__pyx_t_double_complex z;
7132
z.real = -a.real;
7133
z.imag = -a.imag;
7134
return z;
7135
}
7136
static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
7137
return (a.real == 0) && (a.imag == 0);
7138
}
7139
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
7140
__pyx_t_double_complex z;
7141
z.real = a.real;
7142
z.imag = -a.imag;
7143
return z;
7144
}
7145
#if 1
7146
static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
7147
#if !defined(HAVE_HYPOT) || defined(_MSC_VER)
7148
return sqrt(z.real*z.real + z.imag*z.imag);
7149
#else
7150
return hypot(z.real, z.imag);
7151
#endif
7152
}
7153
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
7154
__pyx_t_double_complex z;
7155
double r, lnr, theta, z_r, z_theta;
7156
if (b.imag == 0 && b.real == (int)b.real) {
7157
if (b.real < 0) {
7158
double denom = a.real * a.real + a.imag * a.imag;
7159
a.real = a.real / denom;
7160
a.imag = -a.imag / denom;
7161
b.real = -b.real;
7162
}
7163
switch ((int)b.real) {
7164
case 0:
7165
z.real = 1;
7166
z.imag = 0;
7167
return z;
7168
case 1:
7169
return a;
7170
case 2:
7171
return __Pyx_c_prod_double(a, a);
7172
case 3:
7173
z = __Pyx_c_prod_double(a, a);
7174
return __Pyx_c_prod_double(z, a);
7175
case 4:
7176
z = __Pyx_c_prod_double(a, a);
7177
return __Pyx_c_prod_double(z, z);
7178
}
7179
}
7180
if (a.imag == 0) {
7181
if (a.real == 0) {
7182
return a;
7183
} else if (b.imag == 0) {
7184
z.real = pow(a.real, b.real);
7185
z.imag = 0;
7186
return z;
7187
} else if (a.real > 0) {
7188
r = a.real;
7189
theta = 0;
7190
} else {
7191
r = -a.real;
7192
theta = atan2(0.0, -1.0);
7193
}
7194
} else {
7195
r = __Pyx_c_abs_double(a);
7196
theta = atan2(a.imag, a.real);
7197
}
7198
lnr = log(r);
7199
z_r = exp(lnr * b.real - theta * b.imag);
7200
z_theta = theta * b.real + lnr * b.imag;
7201
z.real = z_r * cos(z_theta);
7202
z.imag = z_r * sin(z_theta);
7203
return z;
7204
}
7205
#endif
7206
#endif
7207
7208
/* CIntToPy */
7209
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
7210
const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
7211
const int is_unsigned = neg_one > const_zero;
7212
if (is_unsigned) {
7213
if (sizeof(enum NPY_TYPES) < sizeof(long)) {
7214
return PyInt_FromLong((long) value);
7215
} else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
7216
return PyLong_FromUnsignedLong((unsigned long) value);
7217
#ifdef HAVE_LONG_LONG
7218
} else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
7219
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
7220
#endif
7221
}
7222
} else {
7223
if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
7224
return PyInt_FromLong((long) value);
7225
#ifdef HAVE_LONG_LONG
7226
} else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
7227
return PyLong_FromLongLong((PY_LONG_LONG) value);
7228
#endif
7229
}
7230
}
7231
{
7232
int one = 1; int little = (int)*(unsigned char *)&one;
7233
unsigned char *bytes = (unsigned char *)&value;
7234
return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
7235
little, !is_unsigned);
7236
}
7237
}
7238
7239
/* CIntFromPy */
7240
static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *x) {
7241
const npy_int32 neg_one = (npy_int32) ((npy_int32) 0 - (npy_int32) 1), const_zero = (npy_int32) 0;
7242
const int is_unsigned = neg_one > const_zero;
7243
#if PY_MAJOR_VERSION < 3
7244
if (likely(PyInt_Check(x))) {
7245
if (sizeof(npy_int32) < sizeof(long)) {
7246
__PYX_VERIFY_RETURN_INT(npy_int32, long, PyInt_AS_LONG(x))
7247
} else {
7248
long val = PyInt_AS_LONG(x);
7249
if (is_unsigned && unlikely(val < 0)) {
7250
goto raise_neg_overflow;
7251
}
7252
return (npy_int32) val;
7253
}
7254
} else
7255
#endif
7256
if (likely(PyLong_Check(x))) {
7257
if (is_unsigned) {
7258
#if CYTHON_USE_PYLONG_INTERNALS
7259
const digit* digits = ((PyLongObject*)x)->ob_digit;
7260
switch (Py_SIZE(x)) {
7261
case 0: return (npy_int32) 0;
7262
case 1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, digits[0])
7263
case 2:
7264
if (8 * sizeof(npy_int32) > 1 * PyLong_SHIFT) {
7265
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7266
__PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7267
} else if (8 * sizeof(npy_int32) >= 2 * PyLong_SHIFT) {
7268
return (npy_int32) (((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
7269
}
7270
}
7271
break;
7272
case 3:
7273
if (8 * sizeof(npy_int32) > 2 * PyLong_SHIFT) {
7274
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7275
__PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7276
} else if (8 * sizeof(npy_int32) >= 3 * PyLong_SHIFT) {
7277
return (npy_int32) (((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
7278
}
7279
}
7280
break;
7281
case 4:
7282
if (8 * sizeof(npy_int32) > 3 * PyLong_SHIFT) {
7283
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7284
__PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7285
} else if (8 * sizeof(npy_int32) >= 4 * PyLong_SHIFT) {
7286
return (npy_int32) (((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
7287
}
7288
}
7289
break;
7290
}
7291
#endif
7292
#if CYTHON_COMPILING_IN_CPYTHON
7293
if (unlikely(Py_SIZE(x) < 0)) {
7294
goto raise_neg_overflow;
7295
}
7296
#else
7297
{
7298
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7299
if (unlikely(result < 0))
7300
return (npy_int32) -1;
7301
if (unlikely(result == 1))
7302
goto raise_neg_overflow;
7303
}
7304
#endif
7305
if (sizeof(npy_int32) <= sizeof(unsigned long)) {
7306
__PYX_VERIFY_RETURN_INT_EXC(npy_int32, unsigned long, PyLong_AsUnsignedLong(x))
7307
#ifdef HAVE_LONG_LONG
7308
} else if (sizeof(npy_int32) <= sizeof(unsigned PY_LONG_LONG)) {
7309
__PYX_VERIFY_RETURN_INT_EXC(npy_int32, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7310
#endif
7311
}
7312
} else {
7313
#if CYTHON_USE_PYLONG_INTERNALS
7314
const digit* digits = ((PyLongObject*)x)->ob_digit;
7315
switch (Py_SIZE(x)) {
7316
case 0: return (npy_int32) 0;
7317
case -1: __PYX_VERIFY_RETURN_INT(npy_int32, sdigit, (sdigit) (-(sdigit)digits[0]))
7318
case 1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, +digits[0])
7319
case -2:
7320
if (8 * sizeof(npy_int32) - 1 > 1 * PyLong_SHIFT) {
7321
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7322
__PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7323
} else if (8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
7324
return (npy_int32) (((npy_int32)-1)*(((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
7325
}
7326
}
7327
break;
7328
case 2:
7329
if (8 * sizeof(npy_int32) > 1 * PyLong_SHIFT) {
7330
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7331
__PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7332
} else if (8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
7333
return (npy_int32) ((((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
7334
}
7335
}
7336
break;
7337
case -3:
7338
if (8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
7339
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7340
__PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7341
} else if (8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
7342
return (npy_int32) (((npy_int32)-1)*(((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
7343
}
7344
}
7345
break;
7346
case 3:
7347
if (8 * sizeof(npy_int32) > 2 * PyLong_SHIFT) {
7348
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7349
__PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7350
} else if (8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
7351
return (npy_int32) ((((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
7352
}
7353
}
7354
break;
7355
case -4:
7356
if (8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
7357
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7358
__PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7359
} else if (8 * sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) {
7360
return (npy_int32) (((npy_int32)-1)*(((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
7361
}
7362
}
7363
break;
7364
case 4:
7365
if (8 * sizeof(npy_int32) > 3 * PyLong_SHIFT) {
7366
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7367
__PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7368
} else if (8 * sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) {
7369
return (npy_int32) ((((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
7370
}
7371
}
7372
break;
7373
}
7374
#endif
7375
if (sizeof(npy_int32) <= sizeof(long)) {
7376
__PYX_VERIFY_RETURN_INT_EXC(npy_int32, long, PyLong_AsLong(x))
7377
#ifdef HAVE_LONG_LONG
7378
} else if (sizeof(npy_int32) <= sizeof(PY_LONG_LONG)) {
7379
__PYX_VERIFY_RETURN_INT_EXC(npy_int32, PY_LONG_LONG, PyLong_AsLongLong(x))
7380
#endif
7381
}
7382
}
7383
{
7384
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7385
PyErr_SetString(PyExc_RuntimeError,
7386
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7387
#else
7388
npy_int32 val;
7389
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
7390
#if PY_MAJOR_VERSION < 3
7391
if (likely(v) && !PyLong_Check(v)) {
7392
PyObject *tmp = v;
7393
v = PyNumber_Long(tmp);
7394
Py_DECREF(tmp);
7395
}
7396
#endif
7397
if (likely(v)) {
7398
int one = 1; int is_little = (int)*(unsigned char *)&one;
7399
unsigned char *bytes = (unsigned char *)&val;
7400
int ret = _PyLong_AsByteArray((PyLongObject *)v,
7401
bytes, sizeof(val),
7402
is_little, !is_unsigned);
7403
Py_DECREF(v);
7404
if (likely(!ret))
7405
return val;
7406
}
7407
#endif
7408
return (npy_int32) -1;
7409
}
7410
} else {
7411
npy_int32 val;
7412
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7413
if (!tmp) return (npy_int32) -1;
7414
val = __Pyx_PyInt_As_npy_int32(tmp);
7415
Py_DECREF(tmp);
7416
return val;
7417
}
7418
raise_overflow:
7419
PyErr_SetString(PyExc_OverflowError,
7420
"value too large to convert to npy_int32");
7421
return (npy_int32) -1;
7422
raise_neg_overflow:
7423
PyErr_SetString(PyExc_OverflowError,
7424
"can't convert negative value to npy_int32");
7425
return (npy_int32) -1;
7426
}
7427
7428
/* CIntFromPy */
7429
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
7430
const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
7431
const int is_unsigned = neg_one > const_zero;
7432
#if PY_MAJOR_VERSION < 3
7433
if (likely(PyInt_Check(x))) {
7434
if (sizeof(int) < sizeof(long)) {
7435
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
7436
} else {
7437
long val = PyInt_AS_LONG(x);
7438
if (is_unsigned && unlikely(val < 0)) {
7439
goto raise_neg_overflow;
7440
}
7441
return (int) val;
7442
}
7443
} else
7444
#endif
7445
if (likely(PyLong_Check(x))) {
7446
if (is_unsigned) {
7447
#if CYTHON_USE_PYLONG_INTERNALS
7448
const digit* digits = ((PyLongObject*)x)->ob_digit;
7449
switch (Py_SIZE(x)) {
7450
case 0: return (int) 0;
7451
case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
7452
case 2:
7453
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
7454
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7455
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7456
} else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
7457
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7458
}
7459
}
7460
break;
7461
case 3:
7462
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
7463
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7464
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7465
} else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
7466
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7467
}
7468
}
7469
break;
7470
case 4:
7471
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
7472
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7473
__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])))
7474
} else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
7475
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7476
}
7477
}
7478
break;
7479
}
7480
#endif
7481
#if CYTHON_COMPILING_IN_CPYTHON
7482
if (unlikely(Py_SIZE(x) < 0)) {
7483
goto raise_neg_overflow;
7484
}
7485
#else
7486
{
7487
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7488
if (unlikely(result < 0))
7489
return (int) -1;
7490
if (unlikely(result == 1))
7491
goto raise_neg_overflow;
7492
}
7493
#endif
7494
if (sizeof(int) <= sizeof(unsigned long)) {
7495
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
7496
#ifdef HAVE_LONG_LONG
7497
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
7498
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7499
#endif
7500
}
7501
} else {
7502
#if CYTHON_USE_PYLONG_INTERNALS
7503
const digit* digits = ((PyLongObject*)x)->ob_digit;
7504
switch (Py_SIZE(x)) {
7505
case 0: return (int) 0;
7506
case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
7507
case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
7508
case -2:
7509
if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
7510
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7511
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7512
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
7513
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7514
}
7515
}
7516
break;
7517
case 2:
7518
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
7519
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7520
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7521
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
7522
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7523
}
7524
}
7525
break;
7526
case -3:
7527
if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
7528
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7529
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7530
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
7531
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7532
}
7533
}
7534
break;
7535
case 3:
7536
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
7537
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7538
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7539
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
7540
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7541
}
7542
}
7543
break;
7544
case -4:
7545
if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
7546
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7547
__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])))
7548
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
7549
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7550
}
7551
}
7552
break;
7553
case 4:
7554
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
7555
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7556
__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])))
7557
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
7558
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7559
}
7560
}
7561
break;
7562
}
7563
#endif
7564
if (sizeof(int) <= sizeof(long)) {
7565
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
7566
#ifdef HAVE_LONG_LONG
7567
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
7568
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
7569
#endif
7570
}
7571
}
7572
{
7573
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7574
PyErr_SetString(PyExc_RuntimeError,
7575
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7576
#else
7577
int val;
7578
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
7579
#if PY_MAJOR_VERSION < 3
7580
if (likely(v) && !PyLong_Check(v)) {
7581
PyObject *tmp = v;
7582
v = PyNumber_Long(tmp);
7583
Py_DECREF(tmp);
7584
}
7585
#endif
7586
if (likely(v)) {
7587
int one = 1; int is_little = (int)*(unsigned char *)&one;
7588
unsigned char *bytes = (unsigned char *)&val;
7589
int ret = _PyLong_AsByteArray((PyLongObject *)v,
7590
bytes, sizeof(val),
7591
is_little, !is_unsigned);
7592
Py_DECREF(v);
7593
if (likely(!ret))
7594
return val;
7595
}
7596
#endif
7597
return (int) -1;
7598
}
7599
} else {
7600
int val;
7601
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7602
if (!tmp) return (int) -1;
7603
val = __Pyx_PyInt_As_int(tmp);
7604
Py_DECREF(tmp);
7605
return val;
7606
}
7607
raise_overflow:
7608
PyErr_SetString(PyExc_OverflowError,
7609
"value too large to convert to int");
7610
return (int) -1;
7611
raise_neg_overflow:
7612
PyErr_SetString(PyExc_OverflowError,
7613
"can't convert negative value to int");
7614
return (int) -1;
7615
}
7616
7617
/* CIntToPy */
7618
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
7619
const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
7620
const int is_unsigned = neg_one > const_zero;
7621
if (is_unsigned) {
7622
if (sizeof(long) < sizeof(long)) {
7623
return PyInt_FromLong((long) value);
7624
} else if (sizeof(long) <= sizeof(unsigned long)) {
7625
return PyLong_FromUnsignedLong((unsigned long) value);
7626
#ifdef HAVE_LONG_LONG
7627
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
7628
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
7629
#endif
7630
}
7631
} else {
7632
if (sizeof(long) <= sizeof(long)) {
7633
return PyInt_FromLong((long) value);
7634
#ifdef HAVE_LONG_LONG
7635
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
7636
return PyLong_FromLongLong((PY_LONG_LONG) value);
7637
#endif
7638
}
7639
}
7640
{
7641
int one = 1; int little = (int)*(unsigned char *)&one;
7642
unsigned char *bytes = (unsigned char *)&value;
7643
return _PyLong_FromByteArray(bytes, sizeof(long),
7644
little, !is_unsigned);
7645
}
7646
}
7647
7648
/* CIntFromPy */
7649
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
7650
const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
7651
const int is_unsigned = neg_one > const_zero;
7652
#if PY_MAJOR_VERSION < 3
7653
if (likely(PyInt_Check(x))) {
7654
if (sizeof(long) < sizeof(long)) {
7655
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
7656
} else {
7657
long val = PyInt_AS_LONG(x);
7658
if (is_unsigned && unlikely(val < 0)) {
7659
goto raise_neg_overflow;
7660
}
7661
return (long) val;
7662
}
7663
} else
7664
#endif
7665
if (likely(PyLong_Check(x))) {
7666
if (is_unsigned) {
7667
#if CYTHON_USE_PYLONG_INTERNALS
7668
const digit* digits = ((PyLongObject*)x)->ob_digit;
7669
switch (Py_SIZE(x)) {
7670
case 0: return (long) 0;
7671
case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
7672
case 2:
7673
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
7674
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7675
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7676
} else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
7677
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7678
}
7679
}
7680
break;
7681
case 3:
7682
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
7683
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7684
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7685
} else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
7686
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7687
}
7688
}
7689
break;
7690
case 4:
7691
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
7692
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7693
__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])))
7694
} else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
7695
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7696
}
7697
}
7698
break;
7699
}
7700
#endif
7701
#if CYTHON_COMPILING_IN_CPYTHON
7702
if (unlikely(Py_SIZE(x) < 0)) {
7703
goto raise_neg_overflow;
7704
}
7705
#else
7706
{
7707
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7708
if (unlikely(result < 0))
7709
return (long) -1;
7710
if (unlikely(result == 1))
7711
goto raise_neg_overflow;
7712
}
7713
#endif
7714
if (sizeof(long) <= sizeof(unsigned long)) {
7715
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
7716
#ifdef HAVE_LONG_LONG
7717
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
7718
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7719
#endif
7720
}
7721
} else {
7722
#if CYTHON_USE_PYLONG_INTERNALS
7723
const digit* digits = ((PyLongObject*)x)->ob_digit;
7724
switch (Py_SIZE(x)) {
7725
case 0: return (long) 0;
7726
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
7727
case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
7728
case -2:
7729
if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
7730
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7731
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7732
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
7733
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7734
}
7735
}
7736
break;
7737
case 2:
7738
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
7739
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7740
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7741
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
7742
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7743
}
7744
}
7745
break;
7746
case -3:
7747
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
7748
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7749
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7750
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
7751
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7752
}
7753
}
7754
break;
7755
case 3:
7756
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
7757
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7758
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7759
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
7760
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7761
}
7762
}
7763
break;
7764
case -4:
7765
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
7766
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7767
__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])))
7768
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
7769
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7770
}
7771
}
7772
break;
7773
case 4:
7774
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
7775
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7776
__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])))
7777
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
7778
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7779
}
7780
}
7781
break;
7782
}
7783
#endif
7784
if (sizeof(long) <= sizeof(long)) {
7785
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
7786
#ifdef HAVE_LONG_LONG
7787
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
7788
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
7789
#endif
7790
}
7791
}
7792
{
7793
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7794
PyErr_SetString(PyExc_RuntimeError,
7795
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7796
#else
7797
long val;
7798
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
7799
#if PY_MAJOR_VERSION < 3
7800
if (likely(v) && !PyLong_Check(v)) {
7801
PyObject *tmp = v;
7802
v = PyNumber_Long(tmp);
7803
Py_DECREF(tmp);
7804
}
7805
#endif
7806
if (likely(v)) {
7807
int one = 1; int is_little = (int)*(unsigned char *)&one;
7808
unsigned char *bytes = (unsigned char *)&val;
7809
int ret = _PyLong_AsByteArray((PyLongObject *)v,
7810
bytes, sizeof(val),
7811
is_little, !is_unsigned);
7812
Py_DECREF(v);
7813
if (likely(!ret))
7814
return val;
7815
}
7816
#endif
7817
return (long) -1;
7818
}
7819
} else {
7820
long val;
7821
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7822
if (!tmp) return (long) -1;
7823
val = __Pyx_PyInt_As_long(tmp);
7824
Py_DECREF(tmp);
7825
return val;
7826
}
7827
raise_overflow:
7828
PyErr_SetString(PyExc_OverflowError,
7829
"value too large to convert to long");
7830
return (long) -1;
7831
raise_neg_overflow:
7832
PyErr_SetString(PyExc_OverflowError,
7833
"can't convert negative value to long");
7834
return (long) -1;
7835
}
7836
7837
/* FastTypeChecks */
7838
#if CYTHON_COMPILING_IN_CPYTHON
7839
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
7840
while (a) {
7841
a = a->tp_base;
7842
if (a == b)
7843
return 1;
7844
}
7845
return b == &PyBaseObject_Type;
7846
}
7847
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
7848
PyObject *mro;
7849
if (a == b) return 1;
7850
mro = a->tp_mro;
7851
if (likely(mro)) {
7852
Py_ssize_t i, n;
7853
n = PyTuple_GET_SIZE(mro);
7854
for (i = 0; i < n; i++) {
7855
if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
7856
return 1;
7857
}
7858
return 0;
7859
}
7860
return __Pyx_InBases(a, b);
7861
}
7862
#if PY_MAJOR_VERSION == 2
7863
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
7864
PyObject *exception, *value, *tb;
7865
int res;
7866
__Pyx_PyThreadState_declare
7867
__Pyx_PyThreadState_assign
7868
__Pyx_ErrFetch(&exception, &value, &tb);
7869
res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
7870
if (unlikely(res == -1)) {
7871
PyErr_WriteUnraisable(err);
7872
res = 0;
7873
}
7874
if (!res) {
7875
res = PyObject_IsSubclass(err, exc_type2);
7876
if (unlikely(res == -1)) {
7877
PyErr_WriteUnraisable(err);
7878
res = 0;
7879
}
7880
}
7881
__Pyx_ErrRestore(exception, value, tb);
7882
return res;
7883
}
7884
#else
7885
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
7886
int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
7887
if (!res) {
7888
res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
7889
}
7890
return res;
7891
}
7892
#endif
7893
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
7894
Py_ssize_t i, n;
7895
assert(PyExceptionClass_Check(exc_type));
7896
n = PyTuple_GET_SIZE(tuple);
7897
#if PY_MAJOR_VERSION >= 3
7898
for (i=0; i<n; i++) {
7899
if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
7900
}
7901
#endif
7902
for (i=0; i<n; i++) {
7903
PyObject *t = PyTuple_GET_ITEM(tuple, i);
7904
#if PY_MAJOR_VERSION < 3
7905
if (likely(exc_type == t)) return 1;
7906
#endif
7907
if (likely(PyExceptionClass_Check(t))) {
7908
if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
7909
} else {
7910
}
7911
}
7912
return 0;
7913
}
7914
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
7915
if (likely(err == exc_type)) return 1;
7916
if (likely(PyExceptionClass_Check(err))) {
7917
if (likely(PyExceptionClass_Check(exc_type))) {
7918
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
7919
} else if (likely(PyTuple_Check(exc_type))) {
7920
return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
7921
} else {
7922
}
7923
}
7924
return PyErr_GivenExceptionMatches(err, exc_type);
7925
}
7926
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
7927
assert(PyExceptionClass_Check(exc_type1));
7928
assert(PyExceptionClass_Check(exc_type2));
7929
if (likely(err == exc_type1 || err == exc_type2)) return 1;
7930
if (likely(PyExceptionClass_Check(err))) {
7931
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
7932
}
7933
return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
7934
}
7935
#endif
7936
7937
/* CheckBinaryVersion */
7938
static int __Pyx_check_binary_version(void) {
7939
char ctversion[4], rtversion[4];
7940
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
7941
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
7942
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
7943
char message[200];
7944
PyOS_snprintf(message, sizeof(message),
7945
"compiletime version %s of module '%.100s' "
7946
"does not match runtime version %s",
7947
ctversion, __Pyx_MODULE_NAME, rtversion);
7948
return PyErr_WarnEx(NULL, message, 1);
7949
}
7950
return 0;
7951
}
7952
7953
/* InitStrings */
7954
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
7955
while (t->p) {
7956
#if PY_MAJOR_VERSION < 3
7957
if (t->is_unicode) {
7958
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
7959
} else if (t->intern) {
7960
*t->p = PyString_InternFromString(t->s);
7961
} else {
7962
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
7963
}
7964
#else
7965
if (t->is_unicode | t->is_str) {
7966
if (t->intern) {
7967
*t->p = PyUnicode_InternFromString(t->s);
7968
} else if (t->encoding) {
7969
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
7970
} else {
7971
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
7972
}
7973
} else {
7974
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
7975
}
7976
#endif
7977
if (!*t->p)
7978
return -1;
7979
if (PyObject_Hash(*t->p) == -1)
7980
return -1;
7981
++t;
7982
}
7983
return 0;
7984
}
7985
7986
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
7987
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
7988
}
7989
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
7990
Py_ssize_t ignore;
7991
return __Pyx_PyObject_AsStringAndSize(o, &ignore);
7992
}
7993
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
7994
#if !CYTHON_PEP393_ENABLED
7995
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
7996
char* defenc_c;
7997
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
7998
if (!defenc) return NULL;
7999
defenc_c = PyBytes_AS_STRING(defenc);
8000
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
8001
{
8002
char* end = defenc_c + PyBytes_GET_SIZE(defenc);
8003
char* c;
8004
for (c = defenc_c; c < end; c++) {
8005
if ((unsigned char) (*c) >= 128) {
8006
PyUnicode_AsASCIIString(o);
8007
return NULL;
8008
}
8009
}
8010
}
8011
#endif
8012
*length = PyBytes_GET_SIZE(defenc);
8013
return defenc_c;
8014
}
8015
#else
8016
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
8017
if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
8018
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
8019
if (likely(PyUnicode_IS_ASCII(o))) {
8020
*length = PyUnicode_GET_LENGTH(o);
8021
return PyUnicode_AsUTF8(o);
8022
} else {
8023
PyUnicode_AsASCIIString(o);
8024
return NULL;
8025
}
8026
#else
8027
return PyUnicode_AsUTF8AndSize(o, length);
8028
#endif
8029
}
8030
#endif
8031
#endif
8032
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
8033
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
8034
if (
8035
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
8036
__Pyx_sys_getdefaultencoding_not_ascii &&
8037
#endif
8038
PyUnicode_Check(o)) {
8039
return __Pyx_PyUnicode_AsStringAndSize(o, length);
8040
} else
8041
#endif
8042
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
8043
if (PyByteArray_Check(o)) {
8044
*length = PyByteArray_GET_SIZE(o);
8045
return PyByteArray_AS_STRING(o);
8046
} else
8047
#endif
8048
{
8049
char* result;
8050
int r = PyBytes_AsStringAndSize(o, &result, length);
8051
if (unlikely(r < 0)) {
8052
return NULL;
8053
} else {
8054
return result;
8055
}
8056
}
8057
}
8058
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
8059
int is_true = x == Py_True;
8060
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
8061
else return PyObject_IsTrue(x);
8062
}
8063
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
8064
int retval;
8065
if (unlikely(!x)) return -1;
8066
retval = __Pyx_PyObject_IsTrue(x);
8067
Py_DECREF(x);
8068
return retval;
8069
}
8070
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
8071
#if PY_MAJOR_VERSION >= 3
8072
if (PyLong_Check(result)) {
8073
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
8074
"__int__ returned non-int (type %.200s). "
8075
"The ability to return an instance of a strict subclass of int "
8076
"is deprecated, and may be removed in a future version of Python.",
8077
Py_TYPE(result)->tp_name)) {
8078
Py_DECREF(result);
8079
return NULL;
8080
}
8081
return result;
8082
}
8083
#endif
8084
PyErr_Format(PyExc_TypeError,
8085
"__%.4s__ returned non-%.4s (type %.200s)",
8086
type_name, type_name, Py_TYPE(result)->tp_name);
8087
Py_DECREF(result);
8088
return NULL;
8089
}
8090
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
8091
#if CYTHON_USE_TYPE_SLOTS
8092
PyNumberMethods *m;
8093
#endif
8094
const char *name = NULL;
8095
PyObject *res = NULL;
8096
#if PY_MAJOR_VERSION < 3
8097
if (likely(PyInt_Check(x) || PyLong_Check(x)))
8098
#else
8099
if (likely(PyLong_Check(x)))
8100
#endif
8101
return __Pyx_NewRef(x);
8102
#if CYTHON_USE_TYPE_SLOTS
8103
m = Py_TYPE(x)->tp_as_number;
8104
#if PY_MAJOR_VERSION < 3
8105
if (m && m->nb_int) {
8106
name = "int";
8107
res = m->nb_int(x);
8108
}
8109
else if (m && m->nb_long) {
8110
name = "long";
8111
res = m->nb_long(x);
8112
}
8113
#else
8114
if (likely(m && m->nb_int)) {
8115
name = "int";
8116
res = m->nb_int(x);
8117
}
8118
#endif
8119
#else
8120
if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
8121
res = PyNumber_Int(x);
8122
}
8123
#endif
8124
if (likely(res)) {
8125
#if PY_MAJOR_VERSION < 3
8126
if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
8127
#else
8128
if (unlikely(!PyLong_CheckExact(res))) {
8129
#endif
8130
return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
8131
}
8132
}
8133
else if (!PyErr_Occurred()) {
8134
PyErr_SetString(PyExc_TypeError,
8135
"an integer is required");
8136
}
8137
return res;
8138
}
8139
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
8140
Py_ssize_t ival;
8141
PyObject *x;
8142
#if PY_MAJOR_VERSION < 3
8143
if (likely(PyInt_CheckExact(b))) {
8144
if (sizeof(Py_ssize_t) >= sizeof(long))
8145
return PyInt_AS_LONG(b);
8146
else
8147
return PyInt_AsSsize_t(b);
8148
}
8149
#endif
8150
if (likely(PyLong_CheckExact(b))) {
8151
#if CYTHON_USE_PYLONG_INTERNALS
8152
const digit* digits = ((PyLongObject*)b)->ob_digit;
8153
const Py_ssize_t size = Py_SIZE(b);
8154
if (likely(__Pyx_sst_abs(size) <= 1)) {
8155
ival = likely(size) ? digits[0] : 0;
8156
if (size == -1) ival = -ival;
8157
return ival;
8158
} else {
8159
switch (size) {
8160
case 2:
8161
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
8162
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8163
}
8164
break;
8165
case -2:
8166
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
8167
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8168
}
8169
break;
8170
case 3:
8171
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
8172
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8173
}
8174
break;
8175
case -3:
8176
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
8177
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8178
}
8179
break;
8180
case 4:
8181
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
8182
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]));
8183
}
8184
break;
8185
case -4:
8186
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
8187
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]));
8188
}
8189
break;
8190
}
8191
}
8192
#endif
8193
return PyLong_AsSsize_t(b);
8194
}
8195
x = PyNumber_Index(b);
8196
if (!x) return -1;
8197
ival = PyInt_AsSsize_t(x);
8198
Py_DECREF(x);
8199
return ival;
8200
}
8201
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
8202
return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
8203
}
8204
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
8205
return PyInt_FromSize_t(ival);
8206
}
8207
8208
8209
#endif /* Py_PYTHON_H */
8210
8211