1 /* Generated by Cython 0.25.2 */
3 #define PY_SSIZE_T_CLEAN
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 < 0x03020000)
8 #error Cython requires Python 2.6+ or Python 3.2+.
10 #define CYTHON_ABI "0_25_2"
13 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
15 #if !defined(WIN32) && !defined(MS_WINDOWS)
27 #define DL_IMPORT(t) t
30 #define DL_EXPORT(t) t
32 #ifndef HAVE_LONG_LONG
33 #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
34 #define HAVE_LONG_LONG
38 #define PY_LONG_LONG LONG_LONG
41 #define Py_HUGE_VAL HUGE_VAL
44 #define CYTHON_COMPILING_IN_PYPY 1
45 #define CYTHON_COMPILING_IN_PYSTON 0
46 #define CYTHON_COMPILING_IN_CPYTHON 0
47 #undef CYTHON_USE_TYPE_SLOTS
48 #define CYTHON_USE_TYPE_SLOTS 0
49 #undef CYTHON_USE_ASYNC_SLOTS
50 #define CYTHON_USE_ASYNC_SLOTS 0
51 #undef CYTHON_USE_PYLIST_INTERNALS
52 #define CYTHON_USE_PYLIST_INTERNALS 0
53 #undef CYTHON_USE_UNICODE_INTERNALS
54 #define CYTHON_USE_UNICODE_INTERNALS 0
55 #undef CYTHON_USE_UNICODE_WRITER
56 #define CYTHON_USE_UNICODE_WRITER 0
57 #undef CYTHON_USE_PYLONG_INTERNALS
58 #define CYTHON_USE_PYLONG_INTERNALS 0
59 #undef CYTHON_AVOID_BORROWED_REFS
60 #define CYTHON_AVOID_BORROWED_REFS 1
61 #undef CYTHON_ASSUME_SAFE_MACROS
62 #define CYTHON_ASSUME_SAFE_MACROS 0
63 #undef CYTHON_UNPACK_METHODS
64 #define CYTHON_UNPACK_METHODS 0
65 #undef CYTHON_FAST_THREAD_STATE
66 #define CYTHON_FAST_THREAD_STATE 0
67 #undef CYTHON_FAST_PYCALL
68 #define CYTHON_FAST_PYCALL 0
69 #elif defined(PYSTON_VERSION)
70 #define CYTHON_COMPILING_IN_PYPY 0
71 #define CYTHON_COMPILING_IN_PYSTON 1
72 #define CYTHON_COMPILING_IN_CPYTHON 0
73 #ifndef CYTHON_USE_TYPE_SLOTS
74 #define CYTHON_USE_TYPE_SLOTS 1
76 #undef CYTHON_USE_ASYNC_SLOTS
77 #define CYTHON_USE_ASYNC_SLOTS 0
78 #undef CYTHON_USE_PYLIST_INTERNALS
79 #define CYTHON_USE_PYLIST_INTERNALS 0
80 #ifndef CYTHON_USE_UNICODE_INTERNALS
81 #define CYTHON_USE_UNICODE_INTERNALS 1
83 #undef CYTHON_USE_UNICODE_WRITER
84 #define CYTHON_USE_UNICODE_WRITER 0
85 #undef CYTHON_USE_PYLONG_INTERNALS
86 #define CYTHON_USE_PYLONG_INTERNALS 0
87 #ifndef CYTHON_AVOID_BORROWED_REFS
88 #define CYTHON_AVOID_BORROWED_REFS 0
90 #ifndef CYTHON_ASSUME_SAFE_MACROS
91 #define CYTHON_ASSUME_SAFE_MACROS 1
93 #ifndef CYTHON_UNPACK_METHODS
94 #define CYTHON_UNPACK_METHODS 1
96 #undef CYTHON_FAST_THREAD_STATE
97 #define CYTHON_FAST_THREAD_STATE 0
98 #undef CYTHON_FAST_PYCALL
99 #define CYTHON_FAST_PYCALL 0
101 #define CYTHON_COMPILING_IN_PYPY 0
102 #define CYTHON_COMPILING_IN_PYSTON 0
103 #define CYTHON_COMPILING_IN_CPYTHON 1
104 #ifndef CYTHON_USE_TYPE_SLOTS
105 #define CYTHON_USE_TYPE_SLOTS 1
107 #if PY_MAJOR_VERSION < 3
108 #undef CYTHON_USE_ASYNC_SLOTS
109 #define CYTHON_USE_ASYNC_SLOTS 0
110 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
111 #define CYTHON_USE_ASYNC_SLOTS 1
113 #if PY_VERSION_HEX < 0x02070000
114 #undef CYTHON_USE_PYLONG_INTERNALS
115 #define CYTHON_USE_PYLONG_INTERNALS 0
116 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
117 #define CYTHON_USE_PYLONG_INTERNALS 1
119 #ifndef CYTHON_USE_PYLIST_INTERNALS
120 #define CYTHON_USE_PYLIST_INTERNALS 1
122 #ifndef CYTHON_USE_UNICODE_INTERNALS
123 #define CYTHON_USE_UNICODE_INTERNALS 1
125 #if PY_VERSION_HEX < 0x030300F0
126 #undef CYTHON_USE_UNICODE_WRITER
127 #define CYTHON_USE_UNICODE_WRITER 0
128 #elif !defined(CYTHON_USE_UNICODE_WRITER)
129 #define CYTHON_USE_UNICODE_WRITER 1
131 #ifndef CYTHON_AVOID_BORROWED_REFS
132 #define CYTHON_AVOID_BORROWED_REFS 0
134 #ifndef CYTHON_ASSUME_SAFE_MACROS
135 #define CYTHON_ASSUME_SAFE_MACROS 1
137 #ifndef CYTHON_UNPACK_METHODS
138 #define CYTHON_UNPACK_METHODS 1
140 #ifndef CYTHON_FAST_THREAD_STATE
141 #define CYTHON_FAST_THREAD_STATE 1
143 #ifndef CYTHON_FAST_PYCALL
144 #define CYTHON_FAST_PYCALL 1
147 #if !defined(CYTHON_FAST_PYCCALL)
148 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
150 #if CYTHON_USE_PYLONG_INTERNALS
151 #include "longintrepr.h"
156 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
157 #define Py_OptimizeFlag 0
159 #define __PYX_BUILD_PY_SSIZE_T "n"
160 #define CYTHON_FORMAT_SSIZE_T "z"
161 #if PY_MAJOR_VERSION < 3
162 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
163 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
164 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
165 #define __Pyx_DefaultClassType PyClass_Type
167 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
168 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
169 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
170 #define __Pyx_DefaultClassType PyType_Type
172 #ifndef Py_TPFLAGS_CHECKTYPES
173 #define Py_TPFLAGS_CHECKTYPES 0
175 #ifndef Py_TPFLAGS_HAVE_INDEX
176 #define Py_TPFLAGS_HAVE_INDEX 0
178 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
179 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
181 #ifndef Py_TPFLAGS_HAVE_FINALIZE
182 #define Py_TPFLAGS_HAVE_FINALIZE 0
184 #ifndef METH_FASTCALL
185 #define METH_FASTCALL 0x80
186 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
187 Py_ssize_t nargs, PyObject *kwnames);
189 #define __Pyx_PyCFunctionFast _PyCFunctionFast
191 #if CYTHON_FAST_PYCCALL
192 #define __Pyx_PyFastCFunction_Check(func)\
193 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
195 #define __Pyx_PyFastCFunction_Check(func) 0
197 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
198 #define CYTHON_PEP393_ENABLED 1
199 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
200 0 : _PyUnicode_Ready((PyObject *)(op)))
201 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
202 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
203 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
204 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
205 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
206 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
207 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
208 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
210 #define CYTHON_PEP393_ENABLED 0
211 #define PyUnicode_1BYTE_KIND 1
212 #define PyUnicode_2BYTE_KIND 2
213 #define PyUnicode_4BYTE_KIND 4
214 #define __Pyx_PyUnicode_READY(op) (0)
215 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
216 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
217 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
218 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
219 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
220 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
221 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
222 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
224 #if CYTHON_COMPILING_IN_PYPY
225 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
226 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
228 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
229 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
230 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
232 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
233 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
235 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
236 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
238 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
239 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
241 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
242 #define PyObject_Malloc(s) PyMem_Malloc(s)
243 #define PyObject_Free(p) PyMem_Free(p)
244 #define PyObject_Realloc(p) PyMem_Realloc(p)
246 #if CYTHON_COMPILING_IN_PYSTON
247 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
248 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
250 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
251 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
253 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
254 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
255 #if PY_MAJOR_VERSION >= 3
256 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
258 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
260 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
261 #define PyObject_ASCII(o) PyObject_Repr(o)
263 #if PY_MAJOR_VERSION >= 3
264 #define PyBaseString_Type PyUnicode_Type
265 #define PyStringObject PyUnicodeObject
266 #define PyString_Type PyUnicode_Type
267 #define PyString_Check PyUnicode_Check
268 #define PyString_CheckExact PyUnicode_CheckExact
270 #if PY_MAJOR_VERSION >= 3
271 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
272 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
274 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
275 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
277 #ifndef PySet_CheckExact
278 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
280 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
281 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
282 #if PY_MAJOR_VERSION >= 3
283 #define PyIntObject PyLongObject
284 #define PyInt_Type PyLong_Type
285 #define PyInt_Check(op) PyLong_Check(op)
286 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
287 #define PyInt_FromString PyLong_FromString
288 #define PyInt_FromUnicode PyLong_FromUnicode
289 #define PyInt_FromLong PyLong_FromLong
290 #define PyInt_FromSize_t PyLong_FromSize_t
291 #define PyInt_FromSsize_t PyLong_FromSsize_t
292 #define PyInt_AsLong PyLong_AsLong
293 #define PyInt_AS_LONG PyLong_AS_LONG
294 #define PyInt_AsSsize_t PyLong_AsSsize_t
295 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
296 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
297 #define PyNumber_Int PyNumber_Long
299 #if PY_MAJOR_VERSION >= 3
300 #define PyBoolObject PyLongObject
302 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
303 #ifndef PyUnicode_InternFromString
304 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
307 #if PY_VERSION_HEX < 0x030200A4
308 typedef long Py_hash_t;
309 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
310 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
312 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
313 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
315 #if PY_MAJOR_VERSION >= 3
316 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
318 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
320 #if CYTHON_USE_ASYNC_SLOTS
321 #if PY_VERSION_HEX >= 0x030500B1
322 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
323 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
329 } __Pyx_PyAsyncMethodsStruct;
330 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
333 #define __Pyx_PyType_AsAsync(obj) NULL
335 #ifndef CYTHON_RESTRICT
336 #if defined(__GNUC__)
337 #define CYTHON_RESTRICT __restrict__
338 #elif defined(_MSC_VER) && _MSC_VER >= 1400
339 #define CYTHON_RESTRICT __restrict
340 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
341 #define CYTHON_RESTRICT restrict
343 #define CYTHON_RESTRICT
346 #ifndef CYTHON_UNUSED
347 # if defined(__GNUC__)
348 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
349 # define CYTHON_UNUSED __attribute__ ((__unused__))
351 # define CYTHON_UNUSED
353 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
354 # define CYTHON_UNUSED __attribute__ ((__unused__))
356 # define CYTHON_UNUSED
359 #ifndef CYTHON_MAYBE_UNUSED_VAR
360 # if defined(__cplusplus)
361 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
363 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
366 #ifndef CYTHON_NCP_UNUSED
367 # if CYTHON_COMPILING_IN_CPYTHON
368 # define CYTHON_NCP_UNUSED
370 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
373 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
375 #ifndef CYTHON_INLINE
376 #if defined(__clang__)
377 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
378 #elif defined(__GNUC__)
379 #define CYTHON_INLINE __inline__
380 #elif defined(_MSC_VER)
381 #define CYTHON_INLINE __inline
382 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
383 #define CYTHON_INLINE inline
385 #define CYTHON_INLINE
389 #if defined(WIN32) || defined(MS_WINDOWS)
390 #define _USE_MATH_DEFINES
394 #define __PYX_NAN() ((float) NAN)
396 static CYTHON_INLINE float __PYX_NAN() {
398 memset(&value, 0xFF, sizeof(value));
402 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
403 #define __Pyx_truncl trunc
405 #define __Pyx_truncl truncl
409 #define __PYX_ERR(f_index, lineno, Ln_error) \
411 __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
414 #if PY_MAJOR_VERSION >= 3
415 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
416 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
418 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
419 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
422 #ifndef __PYX_EXTERN_C
424 #define __PYX_EXTERN_C extern "C"
426 #define __PYX_EXTERN_C extern
430 #define __PYX_HAVE__cython_bbox
431 #define __PYX_HAVE_API__cython_bbox
435 #include "numpy/arrayobject.h"
436 #include "numpy/ufuncobject.h"
441 #ifdef PYREX_WITHOUT_ASSERTIONS
442 #define CYTHON_WITHOUT_ASSERTIONS
445 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
446 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
448 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
449 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
450 #define __PYX_DEFAULT_STRING_ENCODING ""
451 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
452 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
453 #define __Pyx_uchar_cast(c) ((unsigned char)c)
454 #define __Pyx_long_cast(x) ((long)x)
455 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
456 (sizeof(type) < sizeof(Py_ssize_t)) ||\
457 (sizeof(type) > sizeof(Py_ssize_t) &&\
458 likely(v < (type)PY_SSIZE_T_MAX ||\
459 v == (type)PY_SSIZE_T_MAX) &&\
460 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
461 v == (type)PY_SSIZE_T_MIN))) ||\
462 (sizeof(type) == sizeof(Py_ssize_t) &&\
463 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
464 v == (type)PY_SSIZE_T_MAX))) )
465 #if defined (__cplusplus) && __cplusplus >= 201103L
467 #define __Pyx_sst_abs(value) std::abs(value)
468 #elif SIZEOF_INT >= SIZEOF_SIZE_T
469 #define __Pyx_sst_abs(value) abs(value)
470 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
471 #define __Pyx_sst_abs(value) labs(value)
472 #elif defined (_MSC_VER) && defined (_M_X64)
473 #define __Pyx_sst_abs(value) _abs64(value)
474 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
475 #define __Pyx_sst_abs(value) llabs(value)
476 #elif defined (__GNUC__)
477 #define __Pyx_sst_abs(value) __builtin_llabs(value)
479 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
481 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
482 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
483 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
484 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
485 #define __Pyx_PyBytes_FromString PyBytes_FromString
486 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
487 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
488 #if PY_MAJOR_VERSION < 3
489 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
490 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
492 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
493 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
495 #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
496 #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
497 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
498 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
499 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
500 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
501 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
502 #if PY_MAJOR_VERSION < 3
503 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
505 const Py_UNICODE *u_end = u;
507 return (size_t)(u_end - u - 1);
510 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
512 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
513 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
514 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
515 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
516 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
517 #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
518 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
519 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
520 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
521 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
522 #if CYTHON_ASSUME_SAFE_MACROS
523 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
525 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
527 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
528 #if PY_MAJOR_VERSION >= 3
529 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
531 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
533 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
534 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
535 static int __Pyx_sys_getdefaultencoding_not_ascii;
536 static int __Pyx_init_sys_getdefaultencoding_params(void) {
538 PyObject* default_encoding = NULL;
539 PyObject* ascii_chars_u = NULL;
540 PyObject* ascii_chars_b = NULL;
541 const char* default_encoding_c;
542 sys = PyImport_ImportModule("sys");
544 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
546 if (!default_encoding) goto bad;
547 default_encoding_c = PyBytes_AsString(default_encoding);
548 if (!default_encoding_c) goto bad;
549 if (strcmp(default_encoding_c, "ascii") == 0) {
550 __Pyx_sys_getdefaultencoding_not_ascii = 0;
552 char ascii_chars[128];
554 for (c = 0; c < 128; c++) {
557 __Pyx_sys_getdefaultencoding_not_ascii = 1;
558 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
559 if (!ascii_chars_u) goto bad;
560 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
561 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
564 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
568 Py_DECREF(ascii_chars_u);
569 Py_DECREF(ascii_chars_b);
571 Py_DECREF(default_encoding);
574 Py_XDECREF(default_encoding);
575 Py_XDECREF(ascii_chars_u);
576 Py_XDECREF(ascii_chars_b);
580 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
581 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
583 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
584 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
585 static char* __PYX_DEFAULT_STRING_ENCODING;
586 static int __Pyx_init_sys_getdefaultencoding_params(void) {
588 PyObject* default_encoding = NULL;
589 char* default_encoding_c;
590 sys = PyImport_ImportModule("sys");
592 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
594 if (!default_encoding) goto bad;
595 default_encoding_c = PyBytes_AsString(default_encoding);
596 if (!default_encoding_c) goto bad;
597 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
598 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
599 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
600 Py_DECREF(default_encoding);
603 Py_XDECREF(default_encoding);
610 /* Test for GCC > 2.95 */
611 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
612 #define likely(x) __builtin_expect(!!(x), 1)
613 #define unlikely(x) __builtin_expect(!!(x), 0)
614 #else /* !__GNUC__ or GCC < 2.95 */
615 #define likely(x) (x)
616 #define unlikely(x) (x)
617 #endif /* __GNUC__ */
619 static PyObject *__pyx_m;
620 static PyObject *__pyx_d;
621 static PyObject *__pyx_b;
622 static PyObject *__pyx_empty_tuple;
623 static PyObject *__pyx_empty_bytes;
624 static PyObject *__pyx_empty_unicode;
625 static int __pyx_lineno;
626 static int __pyx_clineno = 0;
627 static const char * __pyx_cfilenm= __FILE__;
628 static const char *__pyx_filename;
631 #if !defined(CYTHON_CCOMPLEX)
632 #if defined(__cplusplus)
633 #define CYTHON_CCOMPLEX 1
634 #elif defined(_Complex_I)
635 #define CYTHON_CCOMPLEX 1
637 #define CYTHON_CCOMPLEX 0
647 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
649 #define _Complex_I 1.0fj
653 static const char *__pyx_f[] = {
658 /* BufferFormatStructs.proto */
659 #define IS_UNSIGNED(type) (((type) -1) > 0)
660 struct __Pyx_StructField_;
661 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
664 struct __Pyx_StructField_* fields;
672 typedef struct __Pyx_StructField_ {
673 __Pyx_TypeInfo* type;
678 __Pyx_StructField* field;
679 size_t parent_offset;
680 } __Pyx_BufFmt_StackElem;
682 __Pyx_StructField root;
683 __Pyx_BufFmt_StackElem* head;
685 size_t new_count, enc_count;
686 size_t struct_alignment;
692 } __Pyx_BufFmt_Context;
695 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":725
696 * # in Cython to enable them only on the right systems.
698 * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
699 * ctypedef npy_int16 int16_t
700 * ctypedef npy_int32 int32_t
702 typedef npy_int8 __pyx_t_5numpy_int8_t;
704 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":726
706 * ctypedef npy_int8 int8_t
707 * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
708 * ctypedef npy_int32 int32_t
709 * ctypedef npy_int64 int64_t
711 typedef npy_int16 __pyx_t_5numpy_int16_t;
713 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":727
714 * ctypedef npy_int8 int8_t
715 * ctypedef npy_int16 int16_t
716 * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
717 * ctypedef npy_int64 int64_t
718 * #ctypedef npy_int96 int96_t
720 typedef npy_int32 __pyx_t_5numpy_int32_t;
722 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":728
723 * ctypedef npy_int16 int16_t
724 * ctypedef npy_int32 int32_t
725 * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
726 * #ctypedef npy_int96 int96_t
727 * #ctypedef npy_int128 int128_t
729 typedef npy_int64 __pyx_t_5numpy_int64_t;
731 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":732
732 * #ctypedef npy_int128 int128_t
734 * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
735 * ctypedef npy_uint16 uint16_t
736 * ctypedef npy_uint32 uint32_t
738 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
740 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":733
742 * ctypedef npy_uint8 uint8_t
743 * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
744 * ctypedef npy_uint32 uint32_t
745 * ctypedef npy_uint64 uint64_t
747 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
749 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":734
750 * ctypedef npy_uint8 uint8_t
751 * ctypedef npy_uint16 uint16_t
752 * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
753 * ctypedef npy_uint64 uint64_t
754 * #ctypedef npy_uint96 uint96_t
756 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
758 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":735
759 * ctypedef npy_uint16 uint16_t
760 * ctypedef npy_uint32 uint32_t
761 * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
762 * #ctypedef npy_uint96 uint96_t
763 * #ctypedef npy_uint128 uint128_t
765 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
767 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":739
768 * #ctypedef npy_uint128 uint128_t
770 * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
771 * ctypedef npy_float64 float64_t
772 * #ctypedef npy_float80 float80_t
774 typedef npy_float32 __pyx_t_5numpy_float32_t;
776 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":740
778 * ctypedef npy_float32 float32_t
779 * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
780 * #ctypedef npy_float80 float80_t
781 * #ctypedef npy_float128 float128_t
783 typedef npy_float64 __pyx_t_5numpy_float64_t;
785 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":749
786 * # The int types are mapped a bit surprising --
787 * # numpy.int corresponds to 'l' and numpy.long to 'q'
788 * ctypedef npy_long int_t # <<<<<<<<<<<<<<
789 * ctypedef npy_longlong long_t
790 * ctypedef npy_longlong longlong_t
792 typedef npy_long __pyx_t_5numpy_int_t;
794 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":750
795 * # numpy.int corresponds to 'l' and numpy.long to 'q'
796 * ctypedef npy_long int_t
797 * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
798 * ctypedef npy_longlong longlong_t
801 typedef npy_longlong __pyx_t_5numpy_long_t;
803 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":751
804 * ctypedef npy_long int_t
805 * ctypedef npy_longlong long_t
806 * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
808 * ctypedef npy_ulong uint_t
810 typedef npy_longlong __pyx_t_5numpy_longlong_t;
812 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":753
813 * ctypedef npy_longlong longlong_t
815 * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
816 * ctypedef npy_ulonglong ulong_t
817 * ctypedef npy_ulonglong ulonglong_t
819 typedef npy_ulong __pyx_t_5numpy_uint_t;
821 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":754
823 * ctypedef npy_ulong uint_t
824 * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
825 * ctypedef npy_ulonglong ulonglong_t
828 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
830 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":755
831 * ctypedef npy_ulong uint_t
832 * ctypedef npy_ulonglong ulong_t
833 * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
835 * ctypedef npy_intp intp_t
837 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
839 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":757
840 * ctypedef npy_ulonglong ulonglong_t
842 * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
843 * ctypedef npy_uintp uintp_t
846 typedef npy_intp __pyx_t_5numpy_intp_t;
848 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758
850 * ctypedef npy_intp intp_t
851 * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
853 * ctypedef npy_double float_t
855 typedef npy_uintp __pyx_t_5numpy_uintp_t;
857 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":760
858 * ctypedef npy_uintp uintp_t
860 * ctypedef npy_double float_t # <<<<<<<<<<<<<<
861 * ctypedef npy_double double_t
862 * ctypedef npy_longdouble longdouble_t
864 typedef npy_double __pyx_t_5numpy_float_t;
866 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":761
868 * ctypedef npy_double float_t
869 * ctypedef npy_double double_t # <<<<<<<<<<<<<<
870 * ctypedef npy_longdouble longdouble_t
873 typedef npy_double __pyx_t_5numpy_double_t;
875 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":762
876 * ctypedef npy_double float_t
877 * ctypedef npy_double double_t
878 * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
880 * ctypedef npy_cfloat cfloat_t
882 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
887 * ctypedef np.float_t DTYPE_t # <<<<<<<<<<<<<<
889 * def bbox_overlaps_float(
891 typedef __pyx_t_5numpy_float_t __pyx_t_11cython_bbox_DTYPE_t;
892 /* Declarations.proto */
895 typedef ::std::complex< float > __pyx_t_float_complex;
897 typedef float _Complex __pyx_t_float_complex;
900 typedef struct { float real, imag; } __pyx_t_float_complex;
902 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
904 /* Declarations.proto */
907 typedef ::std::complex< double > __pyx_t_double_complex;
909 typedef double _Complex __pyx_t_double_complex;
912 typedef struct { double real, imag; } __pyx_t_double_complex;
914 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
917 /*--- Type declarations ---*/
919 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":764
920 * ctypedef npy_longdouble longdouble_t
922 * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
923 * ctypedef npy_cdouble cdouble_t
924 * ctypedef npy_clongdouble clongdouble_t
926 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
928 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":765
930 * ctypedef npy_cfloat cfloat_t
931 * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
932 * ctypedef npy_clongdouble clongdouble_t
935 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
937 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":766
938 * ctypedef npy_cfloat cfloat_t
939 * ctypedef npy_cdouble cdouble_t
940 * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
942 * ctypedef npy_cdouble complex_t
944 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
946 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":768
947 * ctypedef npy_clongdouble clongdouble_t
949 * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
951 * cdef inline object PyArray_MultiIterNew1(a):
953 typedef npy_cdouble __pyx_t_5numpy_complex_t;
955 /* --- Runtime support code (head) --- */
957 #ifndef CYTHON_REFNANNY
958 #define CYTHON_REFNANNY 0
962 void (*INCREF)(void*, PyObject*, int);
963 void (*DECREF)(void*, PyObject*, int);
964 void (*GOTREF)(void*, PyObject*, int);
965 void (*GIVEREF)(void*, PyObject*, int);
966 void* (*SetupContext)(const char*, int, const char*);
967 void (*FinishContext)(void**);
968 } __Pyx_RefNannyAPIStruct;
969 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
970 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
971 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
973 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
975 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
976 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
977 PyGILState_Release(__pyx_gilstate_save);\
979 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
982 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
983 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
985 #define __Pyx_RefNannyFinishContext()\
986 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
987 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
988 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
989 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
990 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
991 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
992 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
993 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
994 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
996 #define __Pyx_RefNannyDeclarations
997 #define __Pyx_RefNannySetupContext(name, acquire_gil)
998 #define __Pyx_RefNannyFinishContext()
999 #define __Pyx_INCREF(r) Py_INCREF(r)
1000 #define __Pyx_DECREF(r) Py_DECREF(r)
1001 #define __Pyx_GOTREF(r)
1002 #define __Pyx_GIVEREF(r)
1003 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1004 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1005 #define __Pyx_XGOTREF(r)
1006 #define __Pyx_XGIVEREF(r)
1008 #define __Pyx_XDECREF_SET(r, v) do {\
1009 PyObject *tmp = (PyObject *) r;\
1010 r = v; __Pyx_XDECREF(tmp);\
1012 #define __Pyx_DECREF_SET(r, v) do {\
1013 PyObject *tmp = (PyObject *) r;\
1014 r = v; __Pyx_DECREF(tmp);\
1016 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1017 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1019 /* PyObjectGetAttrStr.proto */
1020 #if CYTHON_USE_TYPE_SLOTS
1021 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
1022 PyTypeObject* tp = Py_TYPE(obj);
1023 if (likely(tp->tp_getattro))
1024 return tp->tp_getattro(obj, attr_name);
1025 #if PY_MAJOR_VERSION < 3
1026 if (likely(tp->tp_getattr))
1027 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
1029 return PyObject_GetAttr(obj, attr_name);
1032 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1035 /* GetBuiltinName.proto */
1036 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1038 /* RaiseArgTupleInvalid.proto */
1039 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1040 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1042 /* RaiseDoubleKeywords.proto */
1043 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1045 /* ParseKeywords.proto */
1046 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1047 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1048 const char* function_name);
1050 /* ArgTypeTest.proto */
1051 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
1052 const char *name, int exact);
1054 /* BufferFormatCheck.proto */
1055 static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1056 __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1057 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1058 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1059 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1060 __Pyx_BufFmt_StackElem* stack,
1061 __Pyx_TypeInfo* type); // PROTO
1063 /* GetModuleGlobalName.proto */
1064 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
1066 /* PyObjectCall.proto */
1067 #if CYTHON_COMPILING_IN_CPYTHON
1068 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1070 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1073 /* ExtTypeTest.proto */
1074 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1076 /* BufferIndexError.proto */
1077 static void __Pyx_RaiseBufferIndexError(int axis);
1079 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1080 /* PyThreadStateGet.proto */
1081 #if CYTHON_FAST_THREAD_STATE
1082 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1083 #define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET();
1085 #define __Pyx_PyThreadState_declare
1086 #define __Pyx_PyThreadState_assign
1089 /* PyErrFetchRestore.proto */
1090 #if CYTHON_FAST_THREAD_STATE
1091 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1092 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1093 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1094 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1095 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1096 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1098 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1099 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1100 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1101 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1104 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1105 /* RaiseException.proto */
1106 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1108 /* DictGetItem.proto */
1109 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1110 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
1112 value = PyDict_GetItemWithError(d, key);
1113 if (unlikely(!value)) {
1114 if (!PyErr_Occurred()) {
1115 PyObject* args = PyTuple_Pack(1, key);
1117 PyErr_SetObject(PyExc_KeyError, args);
1126 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1129 /* RaiseTooManyValuesToUnpack.proto */
1130 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1132 /* RaiseNeedMoreValuesToUnpack.proto */
1133 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1135 /* RaiseNoneIterError.proto */
1136 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1138 /* SaveResetException.proto */
1139 #if CYTHON_FAST_THREAD_STATE
1140 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1141 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1142 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1143 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1145 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1146 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1149 /* PyErrExceptionMatches.proto */
1150 #if CYTHON_FAST_THREAD_STATE
1151 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1152 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1154 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1157 /* GetException.proto */
1158 #if CYTHON_FAST_THREAD_STATE
1159 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1160 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1162 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1166 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1168 /* CodeObjectCache.proto */
1170 PyCodeObject* code_object;
1172 } __Pyx_CodeObjectCacheEntry;
1173 struct __Pyx_CodeObjectCache {
1176 __Pyx_CodeObjectCacheEntry* entries;
1178 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1179 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1180 static PyCodeObject *__pyx_find_code_object(int code_line);
1181 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1183 /* AddTraceback.proto */
1184 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1185 int py_line, const char *filename);
1187 /* BufferStructDeclare.proto */
1189 Py_ssize_t shape, strides, suboffsets;
1190 } __Pyx_Buf_DimInfo;
1196 __Pyx_Buffer *rcbuffer;
1198 __Pyx_Buf_DimInfo diminfo[8];
1199 } __Pyx_LocalBuf_ND;
1201 #if PY_MAJOR_VERSION < 3
1202 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1203 static void __Pyx_ReleaseBuffer(Py_buffer *view);
1205 #define __Pyx_GetBuffer PyObject_GetBuffer
1206 #define __Pyx_ReleaseBuffer PyBuffer_Release
1211 static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
1212 static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
1214 /* CIntToPy.proto */
1215 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);
1217 /* RealImag.proto */
1220 #define __Pyx_CREAL(z) ((z).real())
1221 #define __Pyx_CIMAG(z) ((z).imag())
1223 #define __Pyx_CREAL(z) (__real__(z))
1224 #define __Pyx_CIMAG(z) (__imag__(z))
1227 #define __Pyx_CREAL(z) ((z).real)
1228 #define __Pyx_CIMAG(z) ((z).imag)
1230 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1231 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1232 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1233 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1235 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1236 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1239 /* Arithmetic.proto */
1241 #define __Pyx_c_eq_float(a, b) ((a)==(b))
1242 #define __Pyx_c_sum_float(a, b) ((a)+(b))
1243 #define __Pyx_c_diff_float(a, b) ((a)-(b))
1244 #define __Pyx_c_prod_float(a, b) ((a)*(b))
1245 #define __Pyx_c_quot_float(a, b) ((a)/(b))
1246 #define __Pyx_c_neg_float(a) (-(a))
1248 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1249 #define __Pyx_c_conj_float(z) (::std::conj(z))
1251 #define __Pyx_c_abs_float(z) (::std::abs(z))
1252 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1255 #define __Pyx_c_is_zero_float(z) ((z)==0)
1256 #define __Pyx_c_conj_float(z) (conjf(z))
1258 #define __Pyx_c_abs_float(z) (cabsf(z))
1259 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1263 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1264 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1265 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1266 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1267 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1268 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1269 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1270 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1272 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1273 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1277 /* Arithmetic.proto */
1279 #define __Pyx_c_eq_double(a, b) ((a)==(b))
1280 #define __Pyx_c_sum_double(a, b) ((a)+(b))
1281 #define __Pyx_c_diff_double(a, b) ((a)-(b))
1282 #define __Pyx_c_prod_double(a, b) ((a)*(b))
1283 #define __Pyx_c_quot_double(a, b) ((a)/(b))
1284 #define __Pyx_c_neg_double(a) (-(a))
1286 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1287 #define __Pyx_c_conj_double(z) (::std::conj(z))
1289 #define __Pyx_c_abs_double(z) (::std::abs(z))
1290 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1293 #define __Pyx_c_is_zero_double(z) ((z)==0)
1294 #define __Pyx_c_conj_double(z) (conj(z))
1296 #define __Pyx_c_abs_double(z) (cabs(z))
1297 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1301 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1302 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1303 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1304 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1305 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1306 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1307 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1308 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1310 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1311 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1315 /* CIntToPy.proto */
1316 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1318 /* CIntToPy.proto */
1319 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1321 /* CIntFromPy.proto */
1322 static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);
1324 /* CIntFromPy.proto */
1325 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1327 /* CIntToPy.proto */
1328 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1330 /* CIntFromPy.proto */
1331 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1333 /* CheckBinaryVersion.proto */
1334 static int __Pyx_check_binary_version(void);
1336 /* PyIdentifierFromString.proto */
1337 #if !defined(__Pyx_PyIdentifier_FromString)
1338 #if PY_MAJOR_VERSION < 3
1339 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
1341 #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
1345 /* ModuleImport.proto */
1346 static PyObject *__Pyx_ImportModule(const char *name);
1348 /* TypeImport.proto */
1349 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
1351 /* InitStrings.proto */
1352 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1355 /* Module declarations from 'cython' */
1357 /* Module declarations from 'cpython.buffer' */
1359 /* Module declarations from 'libc.string' */
1361 /* Module declarations from 'libc.stdio' */
1363 /* Module declarations from '__builtin__' */
1365 /* Module declarations from 'cpython.type' */
1366 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1368 /* Module declarations from 'cpython' */
1370 /* Module declarations from 'cpython.object' */
1372 /* Module declarations from 'cpython.ref' */
1374 /* Module declarations from 'libc.stdlib' */
1376 /* Module declarations from 'numpy' */
1378 /* Module declarations from 'numpy' */
1379 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1380 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1381 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1382 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1383 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1384 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1386 /* Module declarations from 'cython_bbox' */
1387 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_11cython_bbox_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
1388 static __Pyx_TypeInfo __Pyx_TypeInfo_long = { "long", NULL, sizeof(long), { 0 }, 0, IS_UNSIGNED(long) ? 'U' : 'I', IS_UNSIGNED(long), 0 };
1389 #define __Pyx_MODULE_NAME "cython_bbox"
1390 int __pyx_module_is_main_cython_bbox = 0;
1392 /* Implementation of 'cython_bbox' */
1393 static PyObject *__pyx_builtin_range;
1394 static PyObject *__pyx_builtin_ValueError;
1395 static PyObject *__pyx_builtin_RuntimeError;
1396 static PyObject *__pyx_builtin_ImportError;
1397 static const char __pyx_k_K[] = "K";
1398 static const char __pyx_k_N[] = "N";
1399 static const char __pyx_k_k[] = "k";
1400 static const char __pyx_k_n[] = "n";
1401 static const char __pyx_k_ih[] = "ih";
1402 static const char __pyx_k_iw[] = "iw";
1403 static const char __pyx_k_np[] = "np";
1404 static const char __pyx_k_ua[] = "ua";
1405 static const char __pyx_k_int[] = "int";
1406 static const char __pyx_k_main[] = "__main__";
1407 static const char __pyx_k_test[] = "__test__";
1408 static const char __pyx_k_DTYPE[] = "DTYPE";
1409 static const char __pyx_k_boxes[] = "boxes";
1410 static const char __pyx_k_dtype[] = "dtype";
1411 static const char __pyx_k_float[] = "float";
1412 static const char __pyx_k_numpy[] = "numpy";
1413 static const char __pyx_k_range[] = "range";
1414 static const char __pyx_k_zeros[] = "zeros";
1415 static const char __pyx_k_import[] = "__import__";
1416 static const char __pyx_k_overlap[] = "overlap";
1417 static const char __pyx_k_box_area[] = "box_area";
1418 static const char __pyx_k_overlaps[] = "overlaps";
1419 static const char __pyx_k_FG_THRESH[] = "FG_THRESH";
1420 static const char __pyx_k_ValueError[] = "ValueError";
1421 static const char __pyx_k_ImportError[] = "ImportError";
1422 static const char __pyx_k_cython_bbox[] = "cython_bbox";
1423 static const char __pyx_k_query_boxes[] = "query_boxes";
1424 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1425 static const char __pyx_k_max_overlaps[] = "max_overlaps";
1426 static const char __pyx_k_bbox_overlaps[] = "bbox_overlaps";
1427 static const char __pyx_k_gt_assignment[] = "gt_assignment";
1428 static const char __pyx_k_bbox_overlaps_self[] = "bbox_overlaps_self";
1429 static const char __pyx_k_bbox_overlaps_float[] = "bbox_overlaps_float";
1430 static const char __pyx_k_bbox_overlaps_ignore[] = "bbox_overlaps_ignore";
1431 static const char __pyx_k_get_assignment_overlaps[] = "get_assignment_overlaps";
1432 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1433 static const char __pyx_k_home_yjr_PycharmProjects_Faster[] = "/home/yjr/PycharmProjects/Faster-RCNN_Tensorflow/libs/box_utils/cython_utils/bbox.pyx";
1434 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1435 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1436 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1437 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1438 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1439 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1440 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1441 static PyObject *__pyx_n_s_DTYPE;
1442 static PyObject *__pyx_n_s_FG_THRESH;
1443 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1444 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1445 static PyObject *__pyx_n_s_ImportError;
1446 static PyObject *__pyx_n_s_K;
1447 static PyObject *__pyx_n_s_N;
1448 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1449 static PyObject *__pyx_n_s_RuntimeError;
1450 static PyObject *__pyx_n_s_ValueError;
1451 static PyObject *__pyx_n_s_bbox_overlaps;
1452 static PyObject *__pyx_n_s_bbox_overlaps_float;
1453 static PyObject *__pyx_n_s_bbox_overlaps_ignore;
1454 static PyObject *__pyx_n_s_bbox_overlaps_self;
1455 static PyObject *__pyx_n_s_box_area;
1456 static PyObject *__pyx_n_s_boxes;
1457 static PyObject *__pyx_n_s_cython_bbox;
1458 static PyObject *__pyx_n_s_dtype;
1459 static PyObject *__pyx_n_s_float;
1460 static PyObject *__pyx_n_s_get_assignment_overlaps;
1461 static PyObject *__pyx_n_s_gt_assignment;
1462 static PyObject *__pyx_kp_s_home_yjr_PycharmProjects_Faster;
1463 static PyObject *__pyx_n_s_ih;
1464 static PyObject *__pyx_n_s_import;
1465 static PyObject *__pyx_n_s_int;
1466 static PyObject *__pyx_n_s_iw;
1467 static PyObject *__pyx_n_s_k;
1468 static PyObject *__pyx_n_s_main;
1469 static PyObject *__pyx_n_s_max_overlaps;
1470 static PyObject *__pyx_n_s_n;
1471 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
1472 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
1473 static PyObject *__pyx_n_s_np;
1474 static PyObject *__pyx_n_s_numpy;
1475 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1476 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1477 static PyObject *__pyx_n_s_overlap;
1478 static PyObject *__pyx_n_s_overlaps;
1479 static PyObject *__pyx_n_s_query_boxes;
1480 static PyObject *__pyx_n_s_range;
1481 static PyObject *__pyx_n_s_test;
1482 static PyObject *__pyx_n_s_ua;
1483 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
1484 static PyObject *__pyx_n_s_zeros;
1485 static PyObject *__pyx_pf_11cython_bbox_bbox_overlaps_float(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes); /* proto */
1486 static PyObject *__pyx_pf_11cython_bbox_2bbox_overlaps(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes); /* proto */
1487 static PyObject *__pyx_pf_11cython_bbox_4bbox_overlaps_self(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes); /* proto */
1488 static PyObject *__pyx_pf_11cython_bbox_6bbox_overlaps_ignore(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes); /* proto */
1489 static PyObject *__pyx_pf_11cython_bbox_8get_assignment_overlaps(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes, __pyx_t_11cython_bbox_DTYPE_t __pyx_v_FG_THRESH); /* proto */
1490 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
1491 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
1492 static PyObject *__pyx_tuple_;
1493 static PyObject *__pyx_tuple__2;
1494 static PyObject *__pyx_tuple__3;
1495 static PyObject *__pyx_tuple__4;
1496 static PyObject *__pyx_tuple__5;
1497 static PyObject *__pyx_tuple__6;
1498 static PyObject *__pyx_tuple__7;
1499 static PyObject *__pyx_tuple__8;
1500 static PyObject *__pyx_tuple__9;
1501 static PyObject *__pyx_tuple__10;
1502 static PyObject *__pyx_tuple__12;
1503 static PyObject *__pyx_tuple__14;
1504 static PyObject *__pyx_tuple__16;
1505 static PyObject *__pyx_tuple__18;
1506 static PyObject *__pyx_codeobj__11;
1507 static PyObject *__pyx_codeobj__13;
1508 static PyObject *__pyx_codeobj__15;
1509 static PyObject *__pyx_codeobj__17;
1510 static PyObject *__pyx_codeobj__19;
1513 * ctypedef np.float_t DTYPE_t
1515 * def bbox_overlaps_float( # <<<<<<<<<<<<<<
1516 * np.ndarray[DTYPE_t, ndim=2] boxes,
1517 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
1520 /* Python wrapper */
1521 static PyObject *__pyx_pw_11cython_bbox_1bbox_overlaps_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1522 static char __pyx_doc_11cython_bbox_bbox_overlaps_float[] = "\n Parameters\n ----------\n boxes: (N, 4) ndarray of float\n query_boxes: (K, 4) ndarray of float\n Returns\n -------\n overlaps: (N, K) ndarray of overlap between boxes and query_boxes\n ";
1523 static PyMethodDef __pyx_mdef_11cython_bbox_1bbox_overlaps_float = {"bbox_overlaps_float", (PyCFunction)__pyx_pw_11cython_bbox_1bbox_overlaps_float, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11cython_bbox_bbox_overlaps_float};
1524 static PyObject *__pyx_pw_11cython_bbox_1bbox_overlaps_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1525 PyArrayObject *__pyx_v_boxes = 0;
1526 PyArrayObject *__pyx_v_query_boxes = 0;
1527 PyObject *__pyx_r = 0;
1528 __Pyx_RefNannyDeclarations
1529 __Pyx_RefNannySetupContext("bbox_overlaps_float (wrapper)", 0);
1531 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_boxes,&__pyx_n_s_query_boxes,0};
1532 PyObject* values[2] = {0,0};
1533 if (unlikely(__pyx_kwds)) {
1535 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1537 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1538 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1540 default: goto __pyx_L5_argtuple_error;
1542 kw_args = PyDict_Size(__pyx_kwds);
1545 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boxes)) != 0)) kw_args--;
1546 else goto __pyx_L5_argtuple_error;
1548 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query_boxes)) != 0)) kw_args--;
1550 __Pyx_RaiseArgtupleInvalid("bbox_overlaps_float", 1, 2, 2, 1); __PYX_ERR(0, 15, __pyx_L3_error)
1553 if (unlikely(kw_args > 0)) {
1554 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bbox_overlaps_float") < 0)) __PYX_ERR(0, 15, __pyx_L3_error)
1556 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
1557 goto __pyx_L5_argtuple_error;
1559 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1560 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1562 __pyx_v_boxes = ((PyArrayObject *)values[0]);
1563 __pyx_v_query_boxes = ((PyArrayObject *)values[1]);
1565 goto __pyx_L4_argument_unpacking_done;
1566 __pyx_L5_argtuple_error:;
1567 __Pyx_RaiseArgtupleInvalid("bbox_overlaps_float", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 15, __pyx_L3_error)
1569 __Pyx_AddTraceback("cython_bbox.bbox_overlaps_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
1570 __Pyx_RefNannyFinishContext();
1572 __pyx_L4_argument_unpacking_done:;
1573 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_boxes), __pyx_ptype_5numpy_ndarray, 1, "boxes", 0))) __PYX_ERR(0, 16, __pyx_L1_error)
1574 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query_boxes), __pyx_ptype_5numpy_ndarray, 1, "query_boxes", 0))) __PYX_ERR(0, 17, __pyx_L1_error)
1575 __pyx_r = __pyx_pf_11cython_bbox_bbox_overlaps_float(__pyx_self, __pyx_v_boxes, __pyx_v_query_boxes);
1577 /* function exit code */
1582 __Pyx_RefNannyFinishContext();
1586 static PyObject *__pyx_pf_11cython_bbox_bbox_overlaps_float(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes) {
1587 unsigned int __pyx_v_N;
1588 unsigned int __pyx_v_K;
1589 PyArrayObject *__pyx_v_overlaps = 0;
1590 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_iw;
1591 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_ih;
1592 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_box_area;
1593 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_ua;
1594 unsigned int __pyx_v_k;
1595 unsigned int __pyx_v_n;
1596 __Pyx_LocalBuf_ND __pyx_pybuffernd_boxes;
1597 __Pyx_Buffer __pyx_pybuffer_boxes;
1598 __Pyx_LocalBuf_ND __pyx_pybuffernd_overlaps;
1599 __Pyx_Buffer __pyx_pybuffer_overlaps;
1600 __Pyx_LocalBuf_ND __pyx_pybuffernd_query_boxes;
1601 __Pyx_Buffer __pyx_pybuffer_query_boxes;
1602 PyObject *__pyx_r = NULL;
1603 __Pyx_RefNannyDeclarations
1604 PyObject *__pyx_t_1 = NULL;
1605 PyObject *__pyx_t_2 = NULL;
1606 PyObject *__pyx_t_3 = NULL;
1607 PyObject *__pyx_t_4 = NULL;
1608 PyArrayObject *__pyx_t_5 = NULL;
1609 unsigned int __pyx_t_6;
1610 unsigned int __pyx_t_7;
1612 Py_ssize_t __pyx_t_9;
1615 Py_ssize_t __pyx_t_12;
1617 Py_ssize_t __pyx_t_14;
1619 Py_ssize_t __pyx_t_16;
1620 unsigned int __pyx_t_17;
1621 unsigned int __pyx_t_18;
1623 Py_ssize_t __pyx_t_20;
1624 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_21;
1626 Py_ssize_t __pyx_t_23;
1627 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_24;
1628 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_25;
1630 Py_ssize_t __pyx_t_27;
1632 Py_ssize_t __pyx_t_29;
1633 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_30;
1636 Py_ssize_t __pyx_t_33;
1638 Py_ssize_t __pyx_t_35;
1640 Py_ssize_t __pyx_t_37;
1642 Py_ssize_t __pyx_t_39;
1644 Py_ssize_t __pyx_t_41;
1646 Py_ssize_t __pyx_t_43;
1648 Py_ssize_t __pyx_t_45;
1650 Py_ssize_t __pyx_t_47;
1653 __Pyx_RefNannySetupContext("bbox_overlaps_float", 0);
1654 __pyx_pybuffer_overlaps.pybuffer.buf = NULL;
1655 __pyx_pybuffer_overlaps.refcount = 0;
1656 __pyx_pybuffernd_overlaps.data = NULL;
1657 __pyx_pybuffernd_overlaps.rcbuffer = &__pyx_pybuffer_overlaps;
1658 __pyx_pybuffer_boxes.pybuffer.buf = NULL;
1659 __pyx_pybuffer_boxes.refcount = 0;
1660 __pyx_pybuffernd_boxes.data = NULL;
1661 __pyx_pybuffernd_boxes.rcbuffer = &__pyx_pybuffer_boxes;
1662 __pyx_pybuffer_query_boxes.pybuffer.buf = NULL;
1663 __pyx_pybuffer_query_boxes.refcount = 0;
1664 __pyx_pybuffernd_query_boxes.data = NULL;
1665 __pyx_pybuffernd_query_boxes.rcbuffer = &__pyx_pybuffer_query_boxes;
1667 __Pyx_BufFmt_StackElem __pyx_stack[1];
1668 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_boxes, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 15, __pyx_L1_error)
1670 __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];
1672 __Pyx_BufFmt_StackElem __pyx_stack[1];
1673 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_query_boxes, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 15, __pyx_L1_error)
1675 __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];
1678 * overlaps: (N, K) ndarray of overlap between boxes and query_boxes
1680 * cdef unsigned int N = boxes.shape[0] # <<<<<<<<<<<<<<
1681 * cdef unsigned int K = query_boxes.shape[0]
1682 * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE)
1684 __pyx_v_N = (__pyx_v_boxes->dimensions[0]);
1688 * cdef unsigned int N = boxes.shape[0]
1689 * cdef unsigned int K = query_boxes.shape[0] # <<<<<<<<<<<<<<
1690 * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE)
1691 * cdef DTYPE_t iw, ih, box_area
1693 __pyx_v_K = (__pyx_v_query_boxes->dimensions[0]);
1696 * cdef unsigned int N = boxes.shape[0]
1697 * cdef unsigned int K = query_boxes.shape[0]
1698 * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE) # <<<<<<<<<<<<<<
1699 * cdef DTYPE_t iw, ih, box_area
1702 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
1703 __Pyx_GOTREF(__pyx_t_1);
1704 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
1705 __Pyx_GOTREF(__pyx_t_2);
1706 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1707 __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
1708 __Pyx_GOTREF(__pyx_t_1);
1709 __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_K); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
1710 __Pyx_GOTREF(__pyx_t_3);
1711 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)
1712 __Pyx_GOTREF(__pyx_t_4);
1713 __Pyx_GIVEREF(__pyx_t_1);
1714 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
1715 __Pyx_GIVEREF(__pyx_t_3);
1716 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
1719 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
1720 __Pyx_GOTREF(__pyx_t_3);
1721 __Pyx_GIVEREF(__pyx_t_4);
1722 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
1724 __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)
1725 __Pyx_GOTREF(__pyx_t_4);
1726 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
1727 __Pyx_GOTREF(__pyx_t_1);
1728 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
1729 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1730 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
1731 __Pyx_GOTREF(__pyx_t_1);
1732 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1733 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1734 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1735 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 29, __pyx_L1_error)
1736 __pyx_t_5 = ((PyArrayObject *)__pyx_t_1);
1738 __Pyx_BufFmt_StackElem __pyx_stack[1];
1739 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
1740 __pyx_v_overlaps = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.buf = NULL;
1741 __PYX_ERR(0, 29, __pyx_L1_error)
1742 } 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];
1746 __pyx_v_overlaps = ((PyArrayObject *)__pyx_t_1);
1751 * cdef unsigned int k, n
1752 * for k in range(K): # <<<<<<<<<<<<<<
1754 * (query_boxes[k, 2] - query_boxes[k, 0]) *
1756 __pyx_t_6 = __pyx_v_K;
1757 for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
1758 __pyx_v_k = __pyx_t_7;
1761 * for k in range(K):
1763 * (query_boxes[k, 2] - query_boxes[k, 0]) * # <<<<<<<<<<<<<<
1764 * (query_boxes[k, 3] - query_boxes[k, 1])
1767 __pyx_t_8 = __pyx_v_k;
1770 if (unlikely(__pyx_t_8 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
1771 if (__pyx_t_9 < 0) {
1772 __pyx_t_9 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
1773 if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1;
1774 } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
1775 if (unlikely(__pyx_t_10 != -1)) {
1776 __Pyx_RaiseBufferIndexError(__pyx_t_10);
1777 __PYX_ERR(0, 35, __pyx_L1_error)
1779 __pyx_t_11 = __pyx_v_k;
1782 if (unlikely(__pyx_t_11 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
1783 if (__pyx_t_12 < 0) {
1784 __pyx_t_12 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
1785 if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
1786 } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
1787 if (unlikely(__pyx_t_10 != -1)) {
1788 __Pyx_RaiseBufferIndexError(__pyx_t_10);
1789 __PYX_ERR(0, 35, __pyx_L1_error)
1794 * (query_boxes[k, 2] - query_boxes[k, 0]) *
1795 * (query_boxes[k, 3] - query_boxes[k, 1]) # <<<<<<<<<<<<<<
1797 * for n in range(N):
1799 __pyx_t_13 = __pyx_v_k;
1802 if (unlikely(__pyx_t_13 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
1803 if (__pyx_t_14 < 0) {
1804 __pyx_t_14 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
1805 if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 1;
1806 } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
1807 if (unlikely(__pyx_t_10 != -1)) {
1808 __Pyx_RaiseBufferIndexError(__pyx_t_10);
1809 __PYX_ERR(0, 36, __pyx_L1_error)
1811 __pyx_t_15 = __pyx_v_k;
1814 if (unlikely(__pyx_t_15 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
1815 if (__pyx_t_16 < 0) {
1816 __pyx_t_16 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
1817 if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 1;
1818 } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
1819 if (unlikely(__pyx_t_10 != -1)) {
1820 __Pyx_RaiseBufferIndexError(__pyx_t_10);
1821 __PYX_ERR(0, 36, __pyx_L1_error)
1825 * for k in range(K):
1827 * (query_boxes[k, 2] - query_boxes[k, 0]) * # <<<<<<<<<<<<<<
1828 * (query_boxes[k, 3] - query_boxes[k, 1])
1831 __pyx_v_box_area = (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_query_boxes.diminfo[1].strides))) * ((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_query_boxes.diminfo[1].strides))));
1834 * (query_boxes[k, 3] - query_boxes[k, 1])
1836 * for n in range(N): # <<<<<<<<<<<<<<
1838 * min(boxes[n, 2], query_boxes[k, 2]) -
1840 __pyx_t_17 = __pyx_v_N;
1841 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
1842 __pyx_v_n = __pyx_t_18;
1845 * for n in range(N):
1847 * min(boxes[n, 2], query_boxes[k, 2]) - # <<<<<<<<<<<<<<
1848 * max(boxes[n, 0], query_boxes[k, 0])
1851 __pyx_t_19 = __pyx_v_k;
1854 if (unlikely(__pyx_t_19 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
1855 if (__pyx_t_20 < 0) {
1856 __pyx_t_20 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
1857 if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 1;
1858 } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
1859 if (unlikely(__pyx_t_10 != -1)) {
1860 __Pyx_RaiseBufferIndexError(__pyx_t_10);
1861 __PYX_ERR(0, 40, __pyx_L1_error)
1863 __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
1864 __pyx_t_22 = __pyx_v_n;
1867 if (unlikely(__pyx_t_22 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
1868 if (__pyx_t_23 < 0) {
1869 __pyx_t_23 += __pyx_pybuffernd_boxes.diminfo[1].shape;
1870 if (unlikely(__pyx_t_23 < 0)) __pyx_t_10 = 1;
1871 } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
1872 if (unlikely(__pyx_t_10 != -1)) {
1873 __Pyx_RaiseBufferIndexError(__pyx_t_10);
1874 __PYX_ERR(0, 40, __pyx_L1_error)
1876 __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_boxes.diminfo[1].strides));
1877 if (((__pyx_t_21 < __pyx_t_24) != 0)) {
1878 __pyx_t_25 = __pyx_t_21;
1880 __pyx_t_25 = __pyx_t_24;
1885 * min(boxes[n, 2], query_boxes[k, 2]) -
1886 * max(boxes[n, 0], query_boxes[k, 0]) # <<<<<<<<<<<<<<
1890 __pyx_t_26 = __pyx_v_k;
1893 if (unlikely(__pyx_t_26 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
1894 if (__pyx_t_27 < 0) {
1895 __pyx_t_27 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
1896 if (unlikely(__pyx_t_27 < 0)) __pyx_t_10 = 1;
1897 } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
1898 if (unlikely(__pyx_t_10 != -1)) {
1899 __Pyx_RaiseBufferIndexError(__pyx_t_10);
1900 __PYX_ERR(0, 41, __pyx_L1_error)
1902 __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
1903 __pyx_t_28 = __pyx_v_n;
1906 if (unlikely(__pyx_t_28 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
1907 if (__pyx_t_29 < 0) {
1908 __pyx_t_29 += __pyx_pybuffernd_boxes.diminfo[1].shape;
1909 if (unlikely(__pyx_t_29 < 0)) __pyx_t_10 = 1;
1910 } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
1911 if (unlikely(__pyx_t_10 != -1)) {
1912 __Pyx_RaiseBufferIndexError(__pyx_t_10);
1913 __PYX_ERR(0, 41, __pyx_L1_error)
1915 __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_boxes.diminfo[1].strides));
1916 if (((__pyx_t_21 > __pyx_t_24) != 0)) {
1917 __pyx_t_30 = __pyx_t_21;
1919 __pyx_t_30 = __pyx_t_24;
1923 * for n in range(N):
1925 * min(boxes[n, 2], query_boxes[k, 2]) - # <<<<<<<<<<<<<<
1926 * max(boxes[n, 0], query_boxes[k, 0])
1929 __pyx_v_iw = (__pyx_t_25 - __pyx_t_30);
1932 * max(boxes[n, 0], query_boxes[k, 0])
1934 * if iw > 0: # <<<<<<<<<<<<<<
1936 * min(boxes[n, 3], query_boxes[k, 3]) -
1938 __pyx_t_31 = ((__pyx_v_iw > 0.0) != 0);
1944 * min(boxes[n, 3], query_boxes[k, 3]) - # <<<<<<<<<<<<<<
1945 * max(boxes[n, 1], query_boxes[k, 1])
1948 __pyx_t_32 = __pyx_v_k;
1951 if (unlikely(__pyx_t_32 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
1952 if (__pyx_t_33 < 0) {
1953 __pyx_t_33 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
1954 if (unlikely(__pyx_t_33 < 0)) __pyx_t_10 = 1;
1955 } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
1956 if (unlikely(__pyx_t_10 != -1)) {
1957 __Pyx_RaiseBufferIndexError(__pyx_t_10);
1958 __PYX_ERR(0, 45, __pyx_L1_error)
1960 __pyx_t_30 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
1961 __pyx_t_34 = __pyx_v_n;
1964 if (unlikely(__pyx_t_34 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
1965 if (__pyx_t_35 < 0) {
1966 __pyx_t_35 += __pyx_pybuffernd_boxes.diminfo[1].shape;
1967 if (unlikely(__pyx_t_35 < 0)) __pyx_t_10 = 1;
1968 } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
1969 if (unlikely(__pyx_t_10 != -1)) {
1970 __Pyx_RaiseBufferIndexError(__pyx_t_10);
1971 __PYX_ERR(0, 45, __pyx_L1_error)
1973 __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_boxes.diminfo[1].strides));
1974 if (((__pyx_t_30 < __pyx_t_25) != 0)) {
1975 __pyx_t_21 = __pyx_t_30;
1977 __pyx_t_21 = __pyx_t_25;
1982 * min(boxes[n, 3], query_boxes[k, 3]) -
1983 * max(boxes[n, 1], query_boxes[k, 1]) # <<<<<<<<<<<<<<
1987 __pyx_t_36 = __pyx_v_k;
1990 if (unlikely(__pyx_t_36 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
1991 if (__pyx_t_37 < 0) {
1992 __pyx_t_37 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
1993 if (unlikely(__pyx_t_37 < 0)) __pyx_t_10 = 1;
1994 } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
1995 if (unlikely(__pyx_t_10 != -1)) {
1996 __Pyx_RaiseBufferIndexError(__pyx_t_10);
1997 __PYX_ERR(0, 46, __pyx_L1_error)
1999 __pyx_t_30 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
2000 __pyx_t_38 = __pyx_v_n;
2003 if (unlikely(__pyx_t_38 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2004 if (__pyx_t_39 < 0) {
2005 __pyx_t_39 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2006 if (unlikely(__pyx_t_39 < 0)) __pyx_t_10 = 1;
2007 } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2008 if (unlikely(__pyx_t_10 != -1)) {
2009 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2010 __PYX_ERR(0, 46, __pyx_L1_error)
2012 __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_boxes.diminfo[1].strides));
2013 if (((__pyx_t_30 > __pyx_t_25) != 0)) {
2014 __pyx_t_24 = __pyx_t_30;
2016 __pyx_t_24 = __pyx_t_25;
2022 * min(boxes[n, 3], query_boxes[k, 3]) - # <<<<<<<<<<<<<<
2023 * max(boxes[n, 1], query_boxes[k, 1])
2026 __pyx_v_ih = (__pyx_t_21 - __pyx_t_24);
2029 * max(boxes[n, 1], query_boxes[k, 1])
2031 * if ih > 0: # <<<<<<<<<<<<<<
2033 * (boxes[n, 2] - boxes[n, 0]) *
2035 __pyx_t_31 = ((__pyx_v_ih > 0.0) != 0);
2041 * (boxes[n, 2] - boxes[n, 0]) * # <<<<<<<<<<<<<<
2042 * (boxes[n, 3] - boxes[n, 1]) +
2043 * box_area - iw * ih
2045 __pyx_t_40 = __pyx_v_n;
2048 if (unlikely(__pyx_t_40 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2049 if (__pyx_t_41 < 0) {
2050 __pyx_t_41 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2051 if (unlikely(__pyx_t_41 < 0)) __pyx_t_10 = 1;
2052 } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2053 if (unlikely(__pyx_t_10 != -1)) {
2054 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2055 __PYX_ERR(0, 50, __pyx_L1_error)
2057 __pyx_t_42 = __pyx_v_n;
2060 if (unlikely(__pyx_t_42 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2061 if (__pyx_t_43 < 0) {
2062 __pyx_t_43 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2063 if (unlikely(__pyx_t_43 < 0)) __pyx_t_10 = 1;
2064 } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2065 if (unlikely(__pyx_t_10 != -1)) {
2066 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2067 __PYX_ERR(0, 50, __pyx_L1_error)
2072 * (boxes[n, 2] - boxes[n, 0]) *
2073 * (boxes[n, 3] - boxes[n, 1]) + # <<<<<<<<<<<<<<
2074 * box_area - iw * ih
2077 __pyx_t_44 = __pyx_v_n;
2080 if (unlikely(__pyx_t_44 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2081 if (__pyx_t_45 < 0) {
2082 __pyx_t_45 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2083 if (unlikely(__pyx_t_45 < 0)) __pyx_t_10 = 1;
2084 } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2085 if (unlikely(__pyx_t_10 != -1)) {
2086 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2087 __PYX_ERR(0, 51, __pyx_L1_error)
2089 __pyx_t_46 = __pyx_v_n;
2092 if (unlikely(__pyx_t_46 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2093 if (__pyx_t_47 < 0) {
2094 __pyx_t_47 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2095 if (unlikely(__pyx_t_47 < 0)) __pyx_t_10 = 1;
2096 } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2097 if (unlikely(__pyx_t_10 != -1)) {
2098 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2099 __PYX_ERR(0, 51, __pyx_L1_error)
2105 * ua = float( # <<<<<<<<<<<<<<
2106 * (boxes[n, 2] - boxes[n, 0]) *
2107 * (boxes[n, 3] - boxes[n, 1]) +
2109 __pyx_v_ua = ((double)(((((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_boxes.diminfo[1].strides))) * ((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_boxes.diminfo[1].strides)))) + __pyx_v_box_area) - (__pyx_v_iw * __pyx_v_ih)));
2112 * # box_area - iw * ih
2114 * overlaps[n, k] = iw * ih / ua # <<<<<<<<<<<<<<
2118 __pyx_t_24 = (__pyx_v_iw * __pyx_v_ih);
2119 if (unlikely(__pyx_v_ua == 0)) {
2120 PyErr_SetString(PyExc_ZeroDivisionError, "float division");
2121 __PYX_ERR(0, 63, __pyx_L1_error)
2123 __pyx_t_48 = __pyx_v_n;
2124 __pyx_t_49 = __pyx_v_k;
2126 if (unlikely(__pyx_t_48 >= (size_t)__pyx_pybuffernd_overlaps.diminfo[0].shape)) __pyx_t_10 = 0;
2127 if (unlikely(__pyx_t_49 >= (size_t)__pyx_pybuffernd_overlaps.diminfo[1].shape)) __pyx_t_10 = 1;
2128 if (unlikely(__pyx_t_10 != -1)) {
2129 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2130 __PYX_ERR(0, 63, __pyx_L1_error)
2132 *__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_overlaps.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_overlaps.diminfo[1].strides) = (__pyx_t_24 / __pyx_v_ua);
2135 * max(boxes[n, 1], query_boxes[k, 1])
2137 * if ih > 0: # <<<<<<<<<<<<<<
2139 * (boxes[n, 2] - boxes[n, 0]) *
2144 * max(boxes[n, 0], query_boxes[k, 0])
2146 * if iw > 0: # <<<<<<<<<<<<<<
2148 * min(boxes[n, 3], query_boxes[k, 3]) -
2156 * overlaps[n, k] = iw * ih / ua
2157 * return overlaps # <<<<<<<<<<<<<<
2159 * def bbox_overlaps(
2161 __Pyx_XDECREF(__pyx_r);
2162 __Pyx_INCREF(((PyObject *)__pyx_v_overlaps));
2163 __pyx_r = ((PyObject *)__pyx_v_overlaps);
2167 * ctypedef np.float_t DTYPE_t
2169 * def bbox_overlaps_float( # <<<<<<<<<<<<<<
2170 * np.ndarray[DTYPE_t, ndim=2] boxes,
2171 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
2174 /* function exit code */
2176 __Pyx_XDECREF(__pyx_t_1);
2177 __Pyx_XDECREF(__pyx_t_2);
2178 __Pyx_XDECREF(__pyx_t_3);
2179 __Pyx_XDECREF(__pyx_t_4);
2180 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2181 __Pyx_PyThreadState_declare
2182 __Pyx_PyThreadState_assign
2183 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2184 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
2185 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer);
2186 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
2187 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2188 __Pyx_AddTraceback("cython_bbox.bbox_overlaps_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
2192 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
2193 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer);
2194 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
2196 __Pyx_XDECREF((PyObject *)__pyx_v_overlaps);
2197 __Pyx_XGIVEREF(__pyx_r);
2198 __Pyx_RefNannyFinishContext();
2205 * def bbox_overlaps( # <<<<<<<<<<<<<<
2206 * np.ndarray[DTYPE_t, ndim=2] boxes,
2207 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
2210 /* Python wrapper */
2211 static PyObject *__pyx_pw_11cython_bbox_3bbox_overlaps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2212 static char __pyx_doc_11cython_bbox_2bbox_overlaps[] = "\n Parameters\n ----------\n boxes: (N, 4) ndarray of float\n query_boxes: (K, 4) ndarray of float\n Returns\n -------\n overlaps: (N, K) ndarray of overlap between boxes and query_boxes\n ";
2213 static PyMethodDef __pyx_mdef_11cython_bbox_3bbox_overlaps = {"bbox_overlaps", (PyCFunction)__pyx_pw_11cython_bbox_3bbox_overlaps, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11cython_bbox_2bbox_overlaps};
2214 static PyObject *__pyx_pw_11cython_bbox_3bbox_overlaps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2215 PyArrayObject *__pyx_v_boxes = 0;
2216 PyArrayObject *__pyx_v_query_boxes = 0;
2217 PyObject *__pyx_r = 0;
2218 __Pyx_RefNannyDeclarations
2219 __Pyx_RefNannySetupContext("bbox_overlaps (wrapper)", 0);
2221 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_boxes,&__pyx_n_s_query_boxes,0};
2222 PyObject* values[2] = {0,0};
2223 if (unlikely(__pyx_kwds)) {
2225 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2227 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2228 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2230 default: goto __pyx_L5_argtuple_error;
2232 kw_args = PyDict_Size(__pyx_kwds);
2235 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boxes)) != 0)) kw_args--;
2236 else goto __pyx_L5_argtuple_error;
2238 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query_boxes)) != 0)) kw_args--;
2240 __Pyx_RaiseArgtupleInvalid("bbox_overlaps", 1, 2, 2, 1); __PYX_ERR(0, 66, __pyx_L3_error)
2243 if (unlikely(kw_args > 0)) {
2244 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bbox_overlaps") < 0)) __PYX_ERR(0, 66, __pyx_L3_error)
2246 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2247 goto __pyx_L5_argtuple_error;
2249 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2250 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2252 __pyx_v_boxes = ((PyArrayObject *)values[0]);
2253 __pyx_v_query_boxes = ((PyArrayObject *)values[1]);
2255 goto __pyx_L4_argument_unpacking_done;
2256 __pyx_L5_argtuple_error:;
2257 __Pyx_RaiseArgtupleInvalid("bbox_overlaps", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 66, __pyx_L3_error)
2259 __Pyx_AddTraceback("cython_bbox.bbox_overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
2260 __Pyx_RefNannyFinishContext();
2262 __pyx_L4_argument_unpacking_done:;
2263 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_boxes), __pyx_ptype_5numpy_ndarray, 1, "boxes", 0))) __PYX_ERR(0, 67, __pyx_L1_error)
2264 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query_boxes), __pyx_ptype_5numpy_ndarray, 1, "query_boxes", 0))) __PYX_ERR(0, 68, __pyx_L1_error)
2265 __pyx_r = __pyx_pf_11cython_bbox_2bbox_overlaps(__pyx_self, __pyx_v_boxes, __pyx_v_query_boxes);
2267 /* function exit code */
2272 __Pyx_RefNannyFinishContext();
2276 static PyObject *__pyx_pf_11cython_bbox_2bbox_overlaps(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes) {
2277 unsigned int __pyx_v_N;
2278 unsigned int __pyx_v_K;
2279 PyArrayObject *__pyx_v_overlaps = 0;
2280 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_iw;
2281 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_ih;
2282 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_box_area;
2283 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_ua;
2284 unsigned int __pyx_v_k;
2285 unsigned int __pyx_v_n;
2286 __Pyx_LocalBuf_ND __pyx_pybuffernd_boxes;
2287 __Pyx_Buffer __pyx_pybuffer_boxes;
2288 __Pyx_LocalBuf_ND __pyx_pybuffernd_overlaps;
2289 __Pyx_Buffer __pyx_pybuffer_overlaps;
2290 __Pyx_LocalBuf_ND __pyx_pybuffernd_query_boxes;
2291 __Pyx_Buffer __pyx_pybuffer_query_boxes;
2292 PyObject *__pyx_r = NULL;
2293 __Pyx_RefNannyDeclarations
2294 PyObject *__pyx_t_1 = NULL;
2295 PyObject *__pyx_t_2 = NULL;
2296 PyObject *__pyx_t_3 = NULL;
2297 PyObject *__pyx_t_4 = NULL;
2298 PyArrayObject *__pyx_t_5 = NULL;
2299 unsigned int __pyx_t_6;
2300 unsigned int __pyx_t_7;
2302 Py_ssize_t __pyx_t_9;
2305 Py_ssize_t __pyx_t_12;
2307 Py_ssize_t __pyx_t_14;
2309 Py_ssize_t __pyx_t_16;
2310 unsigned int __pyx_t_17;
2311 unsigned int __pyx_t_18;
2313 Py_ssize_t __pyx_t_20;
2314 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_21;
2316 Py_ssize_t __pyx_t_23;
2317 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_24;
2318 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_25;
2320 Py_ssize_t __pyx_t_27;
2322 Py_ssize_t __pyx_t_29;
2323 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_30;
2326 Py_ssize_t __pyx_t_33;
2328 Py_ssize_t __pyx_t_35;
2330 Py_ssize_t __pyx_t_37;
2332 Py_ssize_t __pyx_t_39;
2334 Py_ssize_t __pyx_t_41;
2336 Py_ssize_t __pyx_t_43;
2338 Py_ssize_t __pyx_t_45;
2340 Py_ssize_t __pyx_t_47;
2343 __Pyx_RefNannySetupContext("bbox_overlaps", 0);
2344 __pyx_pybuffer_overlaps.pybuffer.buf = NULL;
2345 __pyx_pybuffer_overlaps.refcount = 0;
2346 __pyx_pybuffernd_overlaps.data = NULL;
2347 __pyx_pybuffernd_overlaps.rcbuffer = &__pyx_pybuffer_overlaps;
2348 __pyx_pybuffer_boxes.pybuffer.buf = NULL;
2349 __pyx_pybuffer_boxes.refcount = 0;
2350 __pyx_pybuffernd_boxes.data = NULL;
2351 __pyx_pybuffernd_boxes.rcbuffer = &__pyx_pybuffer_boxes;
2352 __pyx_pybuffer_query_boxes.pybuffer.buf = NULL;
2353 __pyx_pybuffer_query_boxes.refcount = 0;
2354 __pyx_pybuffernd_query_boxes.data = NULL;
2355 __pyx_pybuffernd_query_boxes.rcbuffer = &__pyx_pybuffer_query_boxes;
2357 __Pyx_BufFmt_StackElem __pyx_stack[1];
2358 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_boxes, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 66, __pyx_L1_error)
2360 __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];
2362 __Pyx_BufFmt_StackElem __pyx_stack[1];
2363 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_query_boxes, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 66, __pyx_L1_error)
2365 __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];
2368 * overlaps: (N, K) ndarray of overlap between boxes and query_boxes
2370 * cdef unsigned int N = boxes.shape[0] # <<<<<<<<<<<<<<
2371 * cdef unsigned int K = query_boxes.shape[0]
2372 * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE)
2374 __pyx_v_N = (__pyx_v_boxes->dimensions[0]);
2378 * cdef unsigned int N = boxes.shape[0]
2379 * cdef unsigned int K = query_boxes.shape[0] # <<<<<<<<<<<<<<
2380 * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE)
2381 * cdef DTYPE_t iw, ih, box_area
2383 __pyx_v_K = (__pyx_v_query_boxes->dimensions[0]);
2386 * cdef unsigned int N = boxes.shape[0]
2387 * cdef unsigned int K = query_boxes.shape[0]
2388 * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE) # <<<<<<<<<<<<<<
2389 * cdef DTYPE_t iw, ih, box_area
2392 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
2393 __Pyx_GOTREF(__pyx_t_1);
2394 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error)
2395 __Pyx_GOTREF(__pyx_t_2);
2396 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2397 __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
2398 __Pyx_GOTREF(__pyx_t_1);
2399 __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_K); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error)
2400 __Pyx_GOTREF(__pyx_t_3);
2401 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error)
2402 __Pyx_GOTREF(__pyx_t_4);
2403 __Pyx_GIVEREF(__pyx_t_1);
2404 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
2405 __Pyx_GIVEREF(__pyx_t_3);
2406 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
2409 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error)
2410 __Pyx_GOTREF(__pyx_t_3);
2411 __Pyx_GIVEREF(__pyx_t_4);
2412 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
2414 __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error)
2415 __Pyx_GOTREF(__pyx_t_4);
2416 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
2417 __Pyx_GOTREF(__pyx_t_1);
2418 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 80, __pyx_L1_error)
2419 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2420 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
2421 __Pyx_GOTREF(__pyx_t_1);
2422 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2423 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2424 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2425 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 80, __pyx_L1_error)
2426 __pyx_t_5 = ((PyArrayObject *)__pyx_t_1);
2428 __Pyx_BufFmt_StackElem __pyx_stack[1];
2429 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
2430 __pyx_v_overlaps = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.buf = NULL;
2431 __PYX_ERR(0, 80, __pyx_L1_error)
2432 } 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];
2436 __pyx_v_overlaps = ((PyArrayObject *)__pyx_t_1);
2441 * cdef unsigned int k, n
2442 * for k in range(K): # <<<<<<<<<<<<<<
2444 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
2446 __pyx_t_6 = __pyx_v_K;
2447 for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
2448 __pyx_v_k = __pyx_t_7;
2451 * for k in range(K):
2453 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) * # <<<<<<<<<<<<<<
2454 * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
2457 __pyx_t_8 = __pyx_v_k;
2460 if (unlikely(__pyx_t_8 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2461 if (__pyx_t_9 < 0) {
2462 __pyx_t_9 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
2463 if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1;
2464 } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2465 if (unlikely(__pyx_t_10 != -1)) {
2466 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2467 __PYX_ERR(0, 86, __pyx_L1_error)
2469 __pyx_t_11 = __pyx_v_k;
2472 if (unlikely(__pyx_t_11 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2473 if (__pyx_t_12 < 0) {
2474 __pyx_t_12 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
2475 if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
2476 } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2477 if (unlikely(__pyx_t_10 != -1)) {
2478 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2479 __PYX_ERR(0, 86, __pyx_L1_error)
2484 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
2485 * (query_boxes[k, 3] - query_boxes[k, 1] + 1) # <<<<<<<<<<<<<<
2487 * for n in range(N):
2489 __pyx_t_13 = __pyx_v_k;
2492 if (unlikely(__pyx_t_13 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2493 if (__pyx_t_14 < 0) {
2494 __pyx_t_14 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
2495 if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 1;
2496 } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2497 if (unlikely(__pyx_t_10 != -1)) {
2498 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2499 __PYX_ERR(0, 87, __pyx_L1_error)
2501 __pyx_t_15 = __pyx_v_k;
2504 if (unlikely(__pyx_t_15 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2505 if (__pyx_t_16 < 0) {
2506 __pyx_t_16 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
2507 if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 1;
2508 } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2509 if (unlikely(__pyx_t_10 != -1)) {
2510 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2511 __PYX_ERR(0, 87, __pyx_L1_error)
2515 * for k in range(K):
2517 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) * # <<<<<<<<<<<<<<
2518 * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
2521 __pyx_v_box_area = ((((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_query_boxes.diminfo[1].strides))) + 1.0) * (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_query_boxes.diminfo[1].strides))) + 1.0));
2524 * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
2526 * for n in range(N): # <<<<<<<<<<<<<<
2528 * min(boxes[n, 2], query_boxes[k, 2]) -
2530 __pyx_t_17 = __pyx_v_N;
2531 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
2532 __pyx_v_n = __pyx_t_18;
2535 * for n in range(N):
2537 * min(boxes[n, 2], query_boxes[k, 2]) - # <<<<<<<<<<<<<<
2538 * max(boxes[n, 0], query_boxes[k, 0]) + 1
2541 __pyx_t_19 = __pyx_v_k;
2544 if (unlikely(__pyx_t_19 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2545 if (__pyx_t_20 < 0) {
2546 __pyx_t_20 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
2547 if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 1;
2548 } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2549 if (unlikely(__pyx_t_10 != -1)) {
2550 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2551 __PYX_ERR(0, 91, __pyx_L1_error)
2553 __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
2554 __pyx_t_22 = __pyx_v_n;
2557 if (unlikely(__pyx_t_22 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2558 if (__pyx_t_23 < 0) {
2559 __pyx_t_23 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2560 if (unlikely(__pyx_t_23 < 0)) __pyx_t_10 = 1;
2561 } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2562 if (unlikely(__pyx_t_10 != -1)) {
2563 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2564 __PYX_ERR(0, 91, __pyx_L1_error)
2566 __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_boxes.diminfo[1].strides));
2567 if (((__pyx_t_21 < __pyx_t_24) != 0)) {
2568 __pyx_t_25 = __pyx_t_21;
2570 __pyx_t_25 = __pyx_t_24;
2575 * min(boxes[n, 2], query_boxes[k, 2]) -
2576 * max(boxes[n, 0], query_boxes[k, 0]) + 1 # <<<<<<<<<<<<<<
2580 __pyx_t_26 = __pyx_v_k;
2583 if (unlikely(__pyx_t_26 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2584 if (__pyx_t_27 < 0) {
2585 __pyx_t_27 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
2586 if (unlikely(__pyx_t_27 < 0)) __pyx_t_10 = 1;
2587 } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2588 if (unlikely(__pyx_t_10 != -1)) {
2589 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2590 __PYX_ERR(0, 92, __pyx_L1_error)
2592 __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
2593 __pyx_t_28 = __pyx_v_n;
2596 if (unlikely(__pyx_t_28 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2597 if (__pyx_t_29 < 0) {
2598 __pyx_t_29 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2599 if (unlikely(__pyx_t_29 < 0)) __pyx_t_10 = 1;
2600 } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2601 if (unlikely(__pyx_t_10 != -1)) {
2602 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2603 __PYX_ERR(0, 92, __pyx_L1_error)
2605 __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_boxes.diminfo[1].strides));
2606 if (((__pyx_t_21 > __pyx_t_24) != 0)) {
2607 __pyx_t_30 = __pyx_t_21;
2609 __pyx_t_30 = __pyx_t_24;
2613 * for n in range(N):
2615 * min(boxes[n, 2], query_boxes[k, 2]) - # <<<<<<<<<<<<<<
2616 * max(boxes[n, 0], query_boxes[k, 0]) + 1
2619 __pyx_v_iw = ((__pyx_t_25 - __pyx_t_30) + 1.0);
2622 * max(boxes[n, 0], query_boxes[k, 0]) + 1
2624 * if iw > 0: # <<<<<<<<<<<<<<
2626 * min(boxes[n, 3], query_boxes[k, 3]) -
2628 __pyx_t_31 = ((__pyx_v_iw > 0.0) != 0);
2634 * min(boxes[n, 3], query_boxes[k, 3]) - # <<<<<<<<<<<<<<
2635 * max(boxes[n, 1], query_boxes[k, 1]) + 1
2638 __pyx_t_32 = __pyx_v_k;
2641 if (unlikely(__pyx_t_32 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2642 if (__pyx_t_33 < 0) {
2643 __pyx_t_33 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
2644 if (unlikely(__pyx_t_33 < 0)) __pyx_t_10 = 1;
2645 } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2646 if (unlikely(__pyx_t_10 != -1)) {
2647 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2648 __PYX_ERR(0, 96, __pyx_L1_error)
2650 __pyx_t_30 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
2651 __pyx_t_34 = __pyx_v_n;
2654 if (unlikely(__pyx_t_34 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2655 if (__pyx_t_35 < 0) {
2656 __pyx_t_35 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2657 if (unlikely(__pyx_t_35 < 0)) __pyx_t_10 = 1;
2658 } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2659 if (unlikely(__pyx_t_10 != -1)) {
2660 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2661 __PYX_ERR(0, 96, __pyx_L1_error)
2663 __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_boxes.diminfo[1].strides));
2664 if (((__pyx_t_30 < __pyx_t_25) != 0)) {
2665 __pyx_t_21 = __pyx_t_30;
2667 __pyx_t_21 = __pyx_t_25;
2672 * min(boxes[n, 3], query_boxes[k, 3]) -
2673 * max(boxes[n, 1], query_boxes[k, 1]) + 1 # <<<<<<<<<<<<<<
2677 __pyx_t_36 = __pyx_v_k;
2680 if (unlikely(__pyx_t_36 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2681 if (__pyx_t_37 < 0) {
2682 __pyx_t_37 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
2683 if (unlikely(__pyx_t_37 < 0)) __pyx_t_10 = 1;
2684 } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2685 if (unlikely(__pyx_t_10 != -1)) {
2686 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2687 __PYX_ERR(0, 97, __pyx_L1_error)
2689 __pyx_t_30 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
2690 __pyx_t_38 = __pyx_v_n;
2693 if (unlikely(__pyx_t_38 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2694 if (__pyx_t_39 < 0) {
2695 __pyx_t_39 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2696 if (unlikely(__pyx_t_39 < 0)) __pyx_t_10 = 1;
2697 } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2698 if (unlikely(__pyx_t_10 != -1)) {
2699 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2700 __PYX_ERR(0, 97, __pyx_L1_error)
2702 __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_boxes.diminfo[1].strides));
2703 if (((__pyx_t_30 > __pyx_t_25) != 0)) {
2704 __pyx_t_24 = __pyx_t_30;
2706 __pyx_t_24 = __pyx_t_25;
2712 * min(boxes[n, 3], query_boxes[k, 3]) - # <<<<<<<<<<<<<<
2713 * max(boxes[n, 1], query_boxes[k, 1]) + 1
2716 __pyx_v_ih = ((__pyx_t_21 - __pyx_t_24) + 1.0);
2719 * max(boxes[n, 1], query_boxes[k, 1]) + 1
2721 * if ih > 0: # <<<<<<<<<<<<<<
2723 * (boxes[n, 2] - boxes[n, 0] + 1) *
2725 __pyx_t_31 = ((__pyx_v_ih > 0.0) != 0);
2731 * (boxes[n, 2] - boxes[n, 0] + 1) * # <<<<<<<<<<<<<<
2732 * (boxes[n, 3] - boxes[n, 1] + 1) +
2733 * box_area - iw * ih
2735 __pyx_t_40 = __pyx_v_n;
2738 if (unlikely(__pyx_t_40 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2739 if (__pyx_t_41 < 0) {
2740 __pyx_t_41 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2741 if (unlikely(__pyx_t_41 < 0)) __pyx_t_10 = 1;
2742 } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2743 if (unlikely(__pyx_t_10 != -1)) {
2744 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2745 __PYX_ERR(0, 101, __pyx_L1_error)
2747 __pyx_t_42 = __pyx_v_n;
2750 if (unlikely(__pyx_t_42 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2751 if (__pyx_t_43 < 0) {
2752 __pyx_t_43 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2753 if (unlikely(__pyx_t_43 < 0)) __pyx_t_10 = 1;
2754 } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2755 if (unlikely(__pyx_t_10 != -1)) {
2756 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2757 __PYX_ERR(0, 101, __pyx_L1_error)
2762 * (boxes[n, 2] - boxes[n, 0] + 1) *
2763 * (boxes[n, 3] - boxes[n, 1] + 1) + # <<<<<<<<<<<<<<
2764 * box_area - iw * ih
2767 __pyx_t_44 = __pyx_v_n;
2770 if (unlikely(__pyx_t_44 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2771 if (__pyx_t_45 < 0) {
2772 __pyx_t_45 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2773 if (unlikely(__pyx_t_45 < 0)) __pyx_t_10 = 1;
2774 } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2775 if (unlikely(__pyx_t_10 != -1)) {
2776 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2777 __PYX_ERR(0, 102, __pyx_L1_error)
2779 __pyx_t_46 = __pyx_v_n;
2782 if (unlikely(__pyx_t_46 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
2783 if (__pyx_t_47 < 0) {
2784 __pyx_t_47 += __pyx_pybuffernd_boxes.diminfo[1].shape;
2785 if (unlikely(__pyx_t_47 < 0)) __pyx_t_10 = 1;
2786 } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
2787 if (unlikely(__pyx_t_10 != -1)) {
2788 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2789 __PYX_ERR(0, 102, __pyx_L1_error)
2795 * ua = float( # <<<<<<<<<<<<<<
2796 * (boxes[n, 2] - boxes[n, 0] + 1) *
2797 * (boxes[n, 3] - boxes[n, 1] + 1) +
2799 __pyx_v_ua = ((double)((((((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_boxes.diminfo[1].strides))) + 1.0) * (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_boxes.diminfo[1].strides))) + 1.0)) + __pyx_v_box_area) - (__pyx_v_iw * __pyx_v_ih)));
2802 * box_area - iw * ih
2804 * overlaps[n, k] = iw * ih / ua # <<<<<<<<<<<<<<
2808 __pyx_t_24 = (__pyx_v_iw * __pyx_v_ih);
2809 if (unlikely(__pyx_v_ua == 0)) {
2810 PyErr_SetString(PyExc_ZeroDivisionError, "float division");
2811 __PYX_ERR(0, 105, __pyx_L1_error)
2813 __pyx_t_48 = __pyx_v_n;
2814 __pyx_t_49 = __pyx_v_k;
2816 if (unlikely(__pyx_t_48 >= (size_t)__pyx_pybuffernd_overlaps.diminfo[0].shape)) __pyx_t_10 = 0;
2817 if (unlikely(__pyx_t_49 >= (size_t)__pyx_pybuffernd_overlaps.diminfo[1].shape)) __pyx_t_10 = 1;
2818 if (unlikely(__pyx_t_10 != -1)) {
2819 __Pyx_RaiseBufferIndexError(__pyx_t_10);
2820 __PYX_ERR(0, 105, __pyx_L1_error)
2822 *__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_overlaps.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_overlaps.diminfo[1].strides) = (__pyx_t_24 / __pyx_v_ua);
2825 * max(boxes[n, 1], query_boxes[k, 1]) + 1
2827 * if ih > 0: # <<<<<<<<<<<<<<
2829 * (boxes[n, 2] - boxes[n, 0] + 1) *
2834 * max(boxes[n, 0], query_boxes[k, 0]) + 1
2836 * if iw > 0: # <<<<<<<<<<<<<<
2838 * min(boxes[n, 3], query_boxes[k, 3]) -
2846 * overlaps[n, k] = iw * ih / ua
2847 * return overlaps # <<<<<<<<<<<<<<
2849 * def bbox_overlaps_self(
2851 __Pyx_XDECREF(__pyx_r);
2852 __Pyx_INCREF(((PyObject *)__pyx_v_overlaps));
2853 __pyx_r = ((PyObject *)__pyx_v_overlaps);
2859 * def bbox_overlaps( # <<<<<<<<<<<<<<
2860 * np.ndarray[DTYPE_t, ndim=2] boxes,
2861 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
2864 /* function exit code */
2866 __Pyx_XDECREF(__pyx_t_1);
2867 __Pyx_XDECREF(__pyx_t_2);
2868 __Pyx_XDECREF(__pyx_t_3);
2869 __Pyx_XDECREF(__pyx_t_4);
2870 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2871 __Pyx_PyThreadState_declare
2872 __Pyx_PyThreadState_assign
2873 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2874 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
2875 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer);
2876 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
2877 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2878 __Pyx_AddTraceback("cython_bbox.bbox_overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
2882 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
2883 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer);
2884 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
2886 __Pyx_XDECREF((PyObject *)__pyx_v_overlaps);
2887 __Pyx_XGIVEREF(__pyx_r);
2888 __Pyx_RefNannyFinishContext();
2895 * def bbox_overlaps_self( # <<<<<<<<<<<<<<
2896 * np.ndarray[DTYPE_t, ndim=2] boxes,
2897 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
2900 /* Python wrapper */
2901 static PyObject *__pyx_pw_11cython_bbox_5bbox_overlaps_self(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2902 static char __pyx_doc_11cython_bbox_4bbox_overlaps_self[] = "\n Parameters\n ----------\n boxes: (N, 4) ndarray of float\n query_boxes: (K, 4) ndarray of float\n Returns\n -------\n overlaps: (N, K) ndarray of overlap between boxes and query_boxes\n ";
2903 static PyMethodDef __pyx_mdef_11cython_bbox_5bbox_overlaps_self = {"bbox_overlaps_self", (PyCFunction)__pyx_pw_11cython_bbox_5bbox_overlaps_self, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11cython_bbox_4bbox_overlaps_self};
2904 static PyObject *__pyx_pw_11cython_bbox_5bbox_overlaps_self(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2905 PyArrayObject *__pyx_v_boxes = 0;
2906 PyArrayObject *__pyx_v_query_boxes = 0;
2907 PyObject *__pyx_r = 0;
2908 __Pyx_RefNannyDeclarations
2909 __Pyx_RefNannySetupContext("bbox_overlaps_self (wrapper)", 0);
2911 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_boxes,&__pyx_n_s_query_boxes,0};
2912 PyObject* values[2] = {0,0};
2913 if (unlikely(__pyx_kwds)) {
2915 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2917 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2918 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2920 default: goto __pyx_L5_argtuple_error;
2922 kw_args = PyDict_Size(__pyx_kwds);
2925 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boxes)) != 0)) kw_args--;
2926 else goto __pyx_L5_argtuple_error;
2928 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query_boxes)) != 0)) kw_args--;
2930 __Pyx_RaiseArgtupleInvalid("bbox_overlaps_self", 1, 2, 2, 1); __PYX_ERR(0, 108, __pyx_L3_error)
2933 if (unlikely(kw_args > 0)) {
2934 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bbox_overlaps_self") < 0)) __PYX_ERR(0, 108, __pyx_L3_error)
2936 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2937 goto __pyx_L5_argtuple_error;
2939 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2940 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2942 __pyx_v_boxes = ((PyArrayObject *)values[0]);
2943 __pyx_v_query_boxes = ((PyArrayObject *)values[1]);
2945 goto __pyx_L4_argument_unpacking_done;
2946 __pyx_L5_argtuple_error:;
2947 __Pyx_RaiseArgtupleInvalid("bbox_overlaps_self", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 108, __pyx_L3_error)
2949 __Pyx_AddTraceback("cython_bbox.bbox_overlaps_self", __pyx_clineno, __pyx_lineno, __pyx_filename);
2950 __Pyx_RefNannyFinishContext();
2952 __pyx_L4_argument_unpacking_done:;
2953 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_boxes), __pyx_ptype_5numpy_ndarray, 1, "boxes", 0))) __PYX_ERR(0, 109, __pyx_L1_error)
2954 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query_boxes), __pyx_ptype_5numpy_ndarray, 1, "query_boxes", 0))) __PYX_ERR(0, 110, __pyx_L1_error)
2955 __pyx_r = __pyx_pf_11cython_bbox_4bbox_overlaps_self(__pyx_self, __pyx_v_boxes, __pyx_v_query_boxes);
2957 /* function exit code */
2962 __Pyx_RefNannyFinishContext();
2966 static PyObject *__pyx_pf_11cython_bbox_4bbox_overlaps_self(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes) {
2967 unsigned int __pyx_v_N;
2968 unsigned int __pyx_v_K;
2969 PyArrayObject *__pyx_v_overlaps = 0;
2970 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_iw;
2971 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_ih;
2972 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_box_area;
2973 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_ua;
2974 unsigned int __pyx_v_k;
2975 unsigned int __pyx_v_n;
2976 __Pyx_LocalBuf_ND __pyx_pybuffernd_boxes;
2977 __Pyx_Buffer __pyx_pybuffer_boxes;
2978 __Pyx_LocalBuf_ND __pyx_pybuffernd_overlaps;
2979 __Pyx_Buffer __pyx_pybuffer_overlaps;
2980 __Pyx_LocalBuf_ND __pyx_pybuffernd_query_boxes;
2981 __Pyx_Buffer __pyx_pybuffer_query_boxes;
2982 PyObject *__pyx_r = NULL;
2983 __Pyx_RefNannyDeclarations
2984 PyObject *__pyx_t_1 = NULL;
2985 PyObject *__pyx_t_2 = NULL;
2986 PyObject *__pyx_t_3 = NULL;
2987 PyObject *__pyx_t_4 = NULL;
2988 PyArrayObject *__pyx_t_5 = NULL;
2989 unsigned int __pyx_t_6;
2990 unsigned int __pyx_t_7;
2992 Py_ssize_t __pyx_t_9;
2995 Py_ssize_t __pyx_t_12;
2997 Py_ssize_t __pyx_t_14;
2999 Py_ssize_t __pyx_t_16;
3000 unsigned int __pyx_t_17;
3001 unsigned int __pyx_t_18;
3003 Py_ssize_t __pyx_t_20;
3004 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_21;
3006 Py_ssize_t __pyx_t_23;
3007 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_24;
3008 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_25;
3010 Py_ssize_t __pyx_t_27;
3012 Py_ssize_t __pyx_t_29;
3013 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_30;
3016 Py_ssize_t __pyx_t_33;
3018 Py_ssize_t __pyx_t_35;
3020 Py_ssize_t __pyx_t_37;
3022 Py_ssize_t __pyx_t_39;
3025 __Pyx_RefNannySetupContext("bbox_overlaps_self", 0);
3026 __pyx_pybuffer_overlaps.pybuffer.buf = NULL;
3027 __pyx_pybuffer_overlaps.refcount = 0;
3028 __pyx_pybuffernd_overlaps.data = NULL;
3029 __pyx_pybuffernd_overlaps.rcbuffer = &__pyx_pybuffer_overlaps;
3030 __pyx_pybuffer_boxes.pybuffer.buf = NULL;
3031 __pyx_pybuffer_boxes.refcount = 0;
3032 __pyx_pybuffernd_boxes.data = NULL;
3033 __pyx_pybuffernd_boxes.rcbuffer = &__pyx_pybuffer_boxes;
3034 __pyx_pybuffer_query_boxes.pybuffer.buf = NULL;
3035 __pyx_pybuffer_query_boxes.refcount = 0;
3036 __pyx_pybuffernd_query_boxes.data = NULL;
3037 __pyx_pybuffernd_query_boxes.rcbuffer = &__pyx_pybuffer_query_boxes;
3039 __Pyx_BufFmt_StackElem __pyx_stack[1];
3040 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_boxes, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 108, __pyx_L1_error)
3042 __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];
3044 __Pyx_BufFmt_StackElem __pyx_stack[1];
3045 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_query_boxes, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 108, __pyx_L1_error)
3047 __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];
3050 * overlaps: (N, K) ndarray of overlap between boxes and query_boxes
3052 * cdef unsigned int N = boxes.shape[0] # <<<<<<<<<<<<<<
3053 * cdef unsigned int K = query_boxes.shape[0]
3054 * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE)
3056 __pyx_v_N = (__pyx_v_boxes->dimensions[0]);
3060 * cdef unsigned int N = boxes.shape[0]
3061 * cdef unsigned int K = query_boxes.shape[0] # <<<<<<<<<<<<<<
3062 * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE)
3063 * cdef DTYPE_t iw, ih, box_area
3065 __pyx_v_K = (__pyx_v_query_boxes->dimensions[0]);
3068 * cdef unsigned int N = boxes.shape[0]
3069 * cdef unsigned int K = query_boxes.shape[0]
3070 * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE) # <<<<<<<<<<<<<<
3071 * cdef DTYPE_t iw, ih, box_area
3074 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
3075 __Pyx_GOTREF(__pyx_t_1);
3076 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
3077 __Pyx_GOTREF(__pyx_t_2);
3078 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3079 __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
3080 __Pyx_GOTREF(__pyx_t_1);
3081 __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_K); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
3082 __Pyx_GOTREF(__pyx_t_3);
3083 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error)
3084 __Pyx_GOTREF(__pyx_t_4);
3085 __Pyx_GIVEREF(__pyx_t_1);
3086 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
3087 __Pyx_GIVEREF(__pyx_t_3);
3088 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
3091 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
3092 __Pyx_GOTREF(__pyx_t_3);
3093 __Pyx_GIVEREF(__pyx_t_4);
3094 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
3096 __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error)
3097 __Pyx_GOTREF(__pyx_t_4);
3098 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
3099 __Pyx_GOTREF(__pyx_t_1);
3100 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 122, __pyx_L1_error)
3101 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3102 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
3103 __Pyx_GOTREF(__pyx_t_1);
3104 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3105 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3106 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3107 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 122, __pyx_L1_error)
3108 __pyx_t_5 = ((PyArrayObject *)__pyx_t_1);
3110 __Pyx_BufFmt_StackElem __pyx_stack[1];
3111 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
3112 __pyx_v_overlaps = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.buf = NULL;
3113 __PYX_ERR(0, 122, __pyx_L1_error)
3114 } 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];
3118 __pyx_v_overlaps = ((PyArrayObject *)__pyx_t_1);
3123 * cdef unsigned int k, n
3124 * for k in range(K): # <<<<<<<<<<<<<<
3126 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
3128 __pyx_t_6 = __pyx_v_K;
3129 for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
3130 __pyx_v_k = __pyx_t_7;
3133 * for k in range(K):
3135 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) * # <<<<<<<<<<<<<<
3136 * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
3139 __pyx_t_8 = __pyx_v_k;
3142 if (unlikely(__pyx_t_8 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3143 if (__pyx_t_9 < 0) {
3144 __pyx_t_9 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3145 if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1;
3146 } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3147 if (unlikely(__pyx_t_10 != -1)) {
3148 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3149 __PYX_ERR(0, 128, __pyx_L1_error)
3151 __pyx_t_11 = __pyx_v_k;
3154 if (unlikely(__pyx_t_11 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3155 if (__pyx_t_12 < 0) {
3156 __pyx_t_12 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3157 if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
3158 } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3159 if (unlikely(__pyx_t_10 != -1)) {
3160 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3161 __PYX_ERR(0, 128, __pyx_L1_error)
3166 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
3167 * (query_boxes[k, 3] - query_boxes[k, 1] + 1) # <<<<<<<<<<<<<<
3169 * for n in range(N):
3171 __pyx_t_13 = __pyx_v_k;
3174 if (unlikely(__pyx_t_13 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3175 if (__pyx_t_14 < 0) {
3176 __pyx_t_14 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3177 if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 1;
3178 } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3179 if (unlikely(__pyx_t_10 != -1)) {
3180 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3181 __PYX_ERR(0, 129, __pyx_L1_error)
3183 __pyx_t_15 = __pyx_v_k;
3186 if (unlikely(__pyx_t_15 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3187 if (__pyx_t_16 < 0) {
3188 __pyx_t_16 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3189 if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 1;
3190 } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3191 if (unlikely(__pyx_t_10 != -1)) {
3192 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3193 __PYX_ERR(0, 129, __pyx_L1_error)
3197 * for k in range(K):
3199 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) * # <<<<<<<<<<<<<<
3200 * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
3203 __pyx_v_box_area = ((((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_query_boxes.diminfo[1].strides))) + 1.0) * (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_query_boxes.diminfo[1].strides))) + 1.0));
3206 * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
3208 * for n in range(N): # <<<<<<<<<<<<<<
3210 * min(boxes[n, 2], query_boxes[k, 2]) -
3212 __pyx_t_17 = __pyx_v_N;
3213 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
3214 __pyx_v_n = __pyx_t_18;
3217 * for n in range(N):
3219 * min(boxes[n, 2], query_boxes[k, 2]) - # <<<<<<<<<<<<<<
3220 * max(boxes[n, 0], query_boxes[k, 0]) + 1
3223 __pyx_t_19 = __pyx_v_k;
3226 if (unlikely(__pyx_t_19 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3227 if (__pyx_t_20 < 0) {
3228 __pyx_t_20 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3229 if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 1;
3230 } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3231 if (unlikely(__pyx_t_10 != -1)) {
3232 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3233 __PYX_ERR(0, 133, __pyx_L1_error)
3235 __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
3236 __pyx_t_22 = __pyx_v_n;
3239 if (unlikely(__pyx_t_22 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3240 if (__pyx_t_23 < 0) {
3241 __pyx_t_23 += __pyx_pybuffernd_boxes.diminfo[1].shape;
3242 if (unlikely(__pyx_t_23 < 0)) __pyx_t_10 = 1;
3243 } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3244 if (unlikely(__pyx_t_10 != -1)) {
3245 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3246 __PYX_ERR(0, 133, __pyx_L1_error)
3248 __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_boxes.diminfo[1].strides));
3249 if (((__pyx_t_21 < __pyx_t_24) != 0)) {
3250 __pyx_t_25 = __pyx_t_21;
3252 __pyx_t_25 = __pyx_t_24;
3257 * min(boxes[n, 2], query_boxes[k, 2]) -
3258 * max(boxes[n, 0], query_boxes[k, 0]) + 1 # <<<<<<<<<<<<<<
3262 __pyx_t_26 = __pyx_v_k;
3265 if (unlikely(__pyx_t_26 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3266 if (__pyx_t_27 < 0) {
3267 __pyx_t_27 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3268 if (unlikely(__pyx_t_27 < 0)) __pyx_t_10 = 1;
3269 } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3270 if (unlikely(__pyx_t_10 != -1)) {
3271 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3272 __PYX_ERR(0, 134, __pyx_L1_error)
3274 __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
3275 __pyx_t_28 = __pyx_v_n;
3278 if (unlikely(__pyx_t_28 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3279 if (__pyx_t_29 < 0) {
3280 __pyx_t_29 += __pyx_pybuffernd_boxes.diminfo[1].shape;
3281 if (unlikely(__pyx_t_29 < 0)) __pyx_t_10 = 1;
3282 } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3283 if (unlikely(__pyx_t_10 != -1)) {
3284 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3285 __PYX_ERR(0, 134, __pyx_L1_error)
3287 __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_boxes.diminfo[1].strides));
3288 if (((__pyx_t_21 > __pyx_t_24) != 0)) {
3289 __pyx_t_30 = __pyx_t_21;
3291 __pyx_t_30 = __pyx_t_24;
3295 * for n in range(N):
3297 * min(boxes[n, 2], query_boxes[k, 2]) - # <<<<<<<<<<<<<<
3298 * max(boxes[n, 0], query_boxes[k, 0]) + 1
3301 __pyx_v_iw = ((__pyx_t_25 - __pyx_t_30) + 1.0);
3304 * max(boxes[n, 0], query_boxes[k, 0]) + 1
3306 * if iw > 0: # <<<<<<<<<<<<<<
3308 * min(boxes[n, 3], query_boxes[k, 3]) -
3310 __pyx_t_31 = ((__pyx_v_iw > 0.0) != 0);
3316 * min(boxes[n, 3], query_boxes[k, 3]) - # <<<<<<<<<<<<<<
3317 * max(boxes[n, 1], query_boxes[k, 1]) + 1
3320 __pyx_t_32 = __pyx_v_k;
3323 if (unlikely(__pyx_t_32 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3324 if (__pyx_t_33 < 0) {
3325 __pyx_t_33 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3326 if (unlikely(__pyx_t_33 < 0)) __pyx_t_10 = 1;
3327 } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3328 if (unlikely(__pyx_t_10 != -1)) {
3329 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3330 __PYX_ERR(0, 138, __pyx_L1_error)
3332 __pyx_t_30 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
3333 __pyx_t_34 = __pyx_v_n;
3336 if (unlikely(__pyx_t_34 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3337 if (__pyx_t_35 < 0) {
3338 __pyx_t_35 += __pyx_pybuffernd_boxes.diminfo[1].shape;
3339 if (unlikely(__pyx_t_35 < 0)) __pyx_t_10 = 1;
3340 } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3341 if (unlikely(__pyx_t_10 != -1)) {
3342 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3343 __PYX_ERR(0, 138, __pyx_L1_error)
3345 __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_boxes.diminfo[1].strides));
3346 if (((__pyx_t_30 < __pyx_t_25) != 0)) {
3347 __pyx_t_21 = __pyx_t_30;
3349 __pyx_t_21 = __pyx_t_25;
3354 * min(boxes[n, 3], query_boxes[k, 3]) -
3355 * max(boxes[n, 1], query_boxes[k, 1]) + 1 # <<<<<<<<<<<<<<
3359 __pyx_t_36 = __pyx_v_k;
3362 if (unlikely(__pyx_t_36 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3363 if (__pyx_t_37 < 0) {
3364 __pyx_t_37 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3365 if (unlikely(__pyx_t_37 < 0)) __pyx_t_10 = 1;
3366 } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3367 if (unlikely(__pyx_t_10 != -1)) {
3368 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3369 __PYX_ERR(0, 139, __pyx_L1_error)
3371 __pyx_t_30 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
3372 __pyx_t_38 = __pyx_v_n;
3375 if (unlikely(__pyx_t_38 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3376 if (__pyx_t_39 < 0) {
3377 __pyx_t_39 += __pyx_pybuffernd_boxes.diminfo[1].shape;
3378 if (unlikely(__pyx_t_39 < 0)) __pyx_t_10 = 1;
3379 } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3380 if (unlikely(__pyx_t_10 != -1)) {
3381 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3382 __PYX_ERR(0, 139, __pyx_L1_error)
3384 __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_boxes.diminfo[1].strides));
3385 if (((__pyx_t_30 > __pyx_t_25) != 0)) {
3386 __pyx_t_24 = __pyx_t_30;
3388 __pyx_t_24 = __pyx_t_25;
3394 * min(boxes[n, 3], query_boxes[k, 3]) - # <<<<<<<<<<<<<<
3395 * max(boxes[n, 1], query_boxes[k, 1]) + 1
3398 __pyx_v_ih = ((__pyx_t_21 - __pyx_t_24) + 1.0);
3401 * max(boxes[n, 1], query_boxes[k, 1]) + 1
3403 * if ih > 0: # <<<<<<<<<<<<<<
3404 * ua = float(box_area)
3405 * overlaps[n, k] = iw * ih / ua
3407 __pyx_t_31 = ((__pyx_v_ih > 0.0) != 0);
3413 * ua = float(box_area) # <<<<<<<<<<<<<<
3414 * overlaps[n, k] = iw * ih / ua
3417 __pyx_v_ua = ((double)__pyx_v_box_area);
3421 * ua = float(box_area)
3422 * overlaps[n, k] = iw * ih / ua # <<<<<<<<<<<<<<
3426 __pyx_t_24 = (__pyx_v_iw * __pyx_v_ih);
3427 if (unlikely(__pyx_v_ua == 0)) {
3428 PyErr_SetString(PyExc_ZeroDivisionError, "float division");
3429 __PYX_ERR(0, 143, __pyx_L1_error)
3431 __pyx_t_40 = __pyx_v_n;
3432 __pyx_t_41 = __pyx_v_k;
3434 if (unlikely(__pyx_t_40 >= (size_t)__pyx_pybuffernd_overlaps.diminfo[0].shape)) __pyx_t_10 = 0;
3435 if (unlikely(__pyx_t_41 >= (size_t)__pyx_pybuffernd_overlaps.diminfo[1].shape)) __pyx_t_10 = 1;
3436 if (unlikely(__pyx_t_10 != -1)) {
3437 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3438 __PYX_ERR(0, 143, __pyx_L1_error)
3440 *__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_overlaps.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_overlaps.diminfo[1].strides) = (__pyx_t_24 / __pyx_v_ua);
3443 * max(boxes[n, 1], query_boxes[k, 1]) + 1
3445 * if ih > 0: # <<<<<<<<<<<<<<
3446 * ua = float(box_area)
3447 * overlaps[n, k] = iw * ih / ua
3452 * max(boxes[n, 0], query_boxes[k, 0]) + 1
3454 * if iw > 0: # <<<<<<<<<<<<<<
3456 * min(boxes[n, 3], query_boxes[k, 3]) -
3463 * ua = float(box_area)
3464 * overlaps[n, k] = iw * ih / ua
3465 * return overlaps # <<<<<<<<<<<<<<
3469 __Pyx_XDECREF(__pyx_r);
3470 __Pyx_INCREF(((PyObject *)__pyx_v_overlaps));
3471 __pyx_r = ((PyObject *)__pyx_v_overlaps);
3477 * def bbox_overlaps_self( # <<<<<<<<<<<<<<
3478 * np.ndarray[DTYPE_t, ndim=2] boxes,
3479 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
3482 /* function exit code */
3484 __Pyx_XDECREF(__pyx_t_1);
3485 __Pyx_XDECREF(__pyx_t_2);
3486 __Pyx_XDECREF(__pyx_t_3);
3487 __Pyx_XDECREF(__pyx_t_4);
3488 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3489 __Pyx_PyThreadState_declare
3490 __Pyx_PyThreadState_assign
3491 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3492 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
3493 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer);
3494 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
3495 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3496 __Pyx_AddTraceback("cython_bbox.bbox_overlaps_self", __pyx_clineno, __pyx_lineno, __pyx_filename);
3500 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
3501 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer);
3502 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
3504 __Pyx_XDECREF((PyObject *)__pyx_v_overlaps);
3505 __Pyx_XGIVEREF(__pyx_r);
3506 __Pyx_RefNannyFinishContext();
3513 * def bbox_overlaps_ignore( # <<<<<<<<<<<<<<
3514 * np.ndarray[DTYPE_t, ndim=2] boxes,
3515 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
3518 /* Python wrapper */
3519 static PyObject *__pyx_pw_11cython_bbox_7bbox_overlaps_ignore(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3520 static char __pyx_doc_11cython_bbox_6bbox_overlaps_ignore[] = "\n Parameters\n ----------\n boxes: (N, 4) ndarray of float\n query_boxes: (K, 4) ndarray of float\n Returns\n -------\n overlaps: (N, K) ndarray of overlap between boxes and query_boxes\n ";
3521 static PyMethodDef __pyx_mdef_11cython_bbox_7bbox_overlaps_ignore = {"bbox_overlaps_ignore", (PyCFunction)__pyx_pw_11cython_bbox_7bbox_overlaps_ignore, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11cython_bbox_6bbox_overlaps_ignore};
3522 static PyObject *__pyx_pw_11cython_bbox_7bbox_overlaps_ignore(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3523 PyArrayObject *__pyx_v_boxes = 0;
3524 PyArrayObject *__pyx_v_query_boxes = 0;
3525 PyObject *__pyx_r = 0;
3526 __Pyx_RefNannyDeclarations
3527 __Pyx_RefNannySetupContext("bbox_overlaps_ignore (wrapper)", 0);
3529 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_boxes,&__pyx_n_s_query_boxes,0};
3530 PyObject* values[2] = {0,0};
3531 if (unlikely(__pyx_kwds)) {
3533 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3535 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3536 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3538 default: goto __pyx_L5_argtuple_error;
3540 kw_args = PyDict_Size(__pyx_kwds);
3543 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boxes)) != 0)) kw_args--;
3544 else goto __pyx_L5_argtuple_error;
3546 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query_boxes)) != 0)) kw_args--;
3548 __Pyx_RaiseArgtupleInvalid("bbox_overlaps_ignore", 1, 2, 2, 1); __PYX_ERR(0, 147, __pyx_L3_error)
3551 if (unlikely(kw_args > 0)) {
3552 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bbox_overlaps_ignore") < 0)) __PYX_ERR(0, 147, __pyx_L3_error)
3554 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3555 goto __pyx_L5_argtuple_error;
3557 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3558 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3560 __pyx_v_boxes = ((PyArrayObject *)values[0]);
3561 __pyx_v_query_boxes = ((PyArrayObject *)values[1]);
3563 goto __pyx_L4_argument_unpacking_done;
3564 __pyx_L5_argtuple_error:;
3565 __Pyx_RaiseArgtupleInvalid("bbox_overlaps_ignore", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 147, __pyx_L3_error)
3567 __Pyx_AddTraceback("cython_bbox.bbox_overlaps_ignore", __pyx_clineno, __pyx_lineno, __pyx_filename);
3568 __Pyx_RefNannyFinishContext();
3570 __pyx_L4_argument_unpacking_done:;
3571 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_boxes), __pyx_ptype_5numpy_ndarray, 1, "boxes", 0))) __PYX_ERR(0, 148, __pyx_L1_error)
3572 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query_boxes), __pyx_ptype_5numpy_ndarray, 1, "query_boxes", 0))) __PYX_ERR(0, 149, __pyx_L1_error)
3573 __pyx_r = __pyx_pf_11cython_bbox_6bbox_overlaps_ignore(__pyx_self, __pyx_v_boxes, __pyx_v_query_boxes);
3575 /* function exit code */
3580 __Pyx_RefNannyFinishContext();
3584 static PyObject *__pyx_pf_11cython_bbox_6bbox_overlaps_ignore(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes) {
3585 unsigned int __pyx_v_N;
3586 unsigned int __pyx_v_K;
3587 PyArrayObject *__pyx_v_overlaps = 0;
3588 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_iw;
3589 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_ih;
3590 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_box_area;
3591 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_ua;
3592 unsigned int __pyx_v_k;
3593 unsigned int __pyx_v_n;
3594 __Pyx_LocalBuf_ND __pyx_pybuffernd_boxes;
3595 __Pyx_Buffer __pyx_pybuffer_boxes;
3596 __Pyx_LocalBuf_ND __pyx_pybuffernd_overlaps;
3597 __Pyx_Buffer __pyx_pybuffer_overlaps;
3598 __Pyx_LocalBuf_ND __pyx_pybuffernd_query_boxes;
3599 __Pyx_Buffer __pyx_pybuffer_query_boxes;
3600 PyObject *__pyx_r = NULL;
3601 __Pyx_RefNannyDeclarations
3602 PyObject *__pyx_t_1 = NULL;
3603 PyObject *__pyx_t_2 = NULL;
3604 PyObject *__pyx_t_3 = NULL;
3605 PyObject *__pyx_t_4 = NULL;
3606 PyArrayObject *__pyx_t_5 = NULL;
3607 unsigned int __pyx_t_6;
3608 unsigned int __pyx_t_7;
3610 Py_ssize_t __pyx_t_9;
3613 Py_ssize_t __pyx_t_12;
3615 Py_ssize_t __pyx_t_14;
3617 Py_ssize_t __pyx_t_16;
3618 unsigned int __pyx_t_17;
3619 unsigned int __pyx_t_18;
3621 Py_ssize_t __pyx_t_20;
3622 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_21;
3624 Py_ssize_t __pyx_t_23;
3625 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_24;
3626 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_25;
3628 Py_ssize_t __pyx_t_27;
3630 Py_ssize_t __pyx_t_29;
3631 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_30;
3634 Py_ssize_t __pyx_t_33;
3636 Py_ssize_t __pyx_t_35;
3638 Py_ssize_t __pyx_t_37;
3640 Py_ssize_t __pyx_t_39;
3642 Py_ssize_t __pyx_t_41;
3644 Py_ssize_t __pyx_t_43;
3646 Py_ssize_t __pyx_t_45;
3648 Py_ssize_t __pyx_t_47;
3650 Py_ssize_t __pyx_t_49;
3652 Py_ssize_t __pyx_t_51;
3654 Py_ssize_t __pyx_t_53;
3656 Py_ssize_t __pyx_t_55;
3658 Py_ssize_t __pyx_t_57;
3661 __Pyx_RefNannySetupContext("bbox_overlaps_ignore", 0);
3662 __pyx_pybuffer_overlaps.pybuffer.buf = NULL;
3663 __pyx_pybuffer_overlaps.refcount = 0;
3664 __pyx_pybuffernd_overlaps.data = NULL;
3665 __pyx_pybuffernd_overlaps.rcbuffer = &__pyx_pybuffer_overlaps;
3666 __pyx_pybuffer_boxes.pybuffer.buf = NULL;
3667 __pyx_pybuffer_boxes.refcount = 0;
3668 __pyx_pybuffernd_boxes.data = NULL;
3669 __pyx_pybuffernd_boxes.rcbuffer = &__pyx_pybuffer_boxes;
3670 __pyx_pybuffer_query_boxes.pybuffer.buf = NULL;
3671 __pyx_pybuffer_query_boxes.refcount = 0;
3672 __pyx_pybuffernd_query_boxes.data = NULL;
3673 __pyx_pybuffernd_query_boxes.rcbuffer = &__pyx_pybuffer_query_boxes;
3675 __Pyx_BufFmt_StackElem __pyx_stack[1];
3676 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_boxes, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 147, __pyx_L1_error)
3678 __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];
3680 __Pyx_BufFmt_StackElem __pyx_stack[1];
3681 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_query_boxes, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 147, __pyx_L1_error)
3683 __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];
3686 * overlaps: (N, K) ndarray of overlap between boxes and query_boxes
3688 * cdef unsigned int N = boxes.shape[0] # <<<<<<<<<<<<<<
3689 * cdef unsigned int K = query_boxes.shape[0]
3690 * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE)
3692 __pyx_v_N = (__pyx_v_boxes->dimensions[0]);
3696 * cdef unsigned int N = boxes.shape[0]
3697 * cdef unsigned int K = query_boxes.shape[0] # <<<<<<<<<<<<<<
3698 * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE)
3699 * cdef DTYPE_t iw, ih, box_area
3701 __pyx_v_K = (__pyx_v_query_boxes->dimensions[0]);
3704 * cdef unsigned int N = boxes.shape[0]
3705 * cdef unsigned int K = query_boxes.shape[0]
3706 * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE) # <<<<<<<<<<<<<<
3707 * cdef DTYPE_t iw, ih, box_area
3710 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
3711 __Pyx_GOTREF(__pyx_t_1);
3712 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
3713 __Pyx_GOTREF(__pyx_t_2);
3714 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3715 __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
3716 __Pyx_GOTREF(__pyx_t_1);
3717 __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_K); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error)
3718 __Pyx_GOTREF(__pyx_t_3);
3719 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L1_error)
3720 __Pyx_GOTREF(__pyx_t_4);
3721 __Pyx_GIVEREF(__pyx_t_1);
3722 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
3723 __Pyx_GIVEREF(__pyx_t_3);
3724 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
3727 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error)
3728 __Pyx_GOTREF(__pyx_t_3);
3729 __Pyx_GIVEREF(__pyx_t_4);
3730 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
3732 __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L1_error)
3733 __Pyx_GOTREF(__pyx_t_4);
3734 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
3735 __Pyx_GOTREF(__pyx_t_1);
3736 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 161, __pyx_L1_error)
3737 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3738 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
3739 __Pyx_GOTREF(__pyx_t_1);
3740 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3741 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3742 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3743 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 161, __pyx_L1_error)
3744 __pyx_t_5 = ((PyArrayObject *)__pyx_t_1);
3746 __Pyx_BufFmt_StackElem __pyx_stack[1];
3747 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
3748 __pyx_v_overlaps = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.buf = NULL;
3749 __PYX_ERR(0, 161, __pyx_L1_error)
3750 } 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];
3754 __pyx_v_overlaps = ((PyArrayObject *)__pyx_t_1);
3759 * cdef unsigned int k, n
3760 * for k in range(K): # <<<<<<<<<<<<<<
3762 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
3764 __pyx_t_6 = __pyx_v_K;
3765 for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
3766 __pyx_v_k = __pyx_t_7;
3769 * for k in range(K):
3771 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) * # <<<<<<<<<<<<<<
3772 * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
3775 __pyx_t_8 = __pyx_v_k;
3778 if (unlikely(__pyx_t_8 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3779 if (__pyx_t_9 < 0) {
3780 __pyx_t_9 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3781 if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1;
3782 } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3783 if (unlikely(__pyx_t_10 != -1)) {
3784 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3785 __PYX_ERR(0, 167, __pyx_L1_error)
3787 __pyx_t_11 = __pyx_v_k;
3790 if (unlikely(__pyx_t_11 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3791 if (__pyx_t_12 < 0) {
3792 __pyx_t_12 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3793 if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
3794 } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3795 if (unlikely(__pyx_t_10 != -1)) {
3796 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3797 __PYX_ERR(0, 167, __pyx_L1_error)
3802 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
3803 * (query_boxes[k, 3] - query_boxes[k, 1] + 1) # <<<<<<<<<<<<<<
3805 * for n in range(N):
3807 __pyx_t_13 = __pyx_v_k;
3810 if (unlikely(__pyx_t_13 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3811 if (__pyx_t_14 < 0) {
3812 __pyx_t_14 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3813 if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 1;
3814 } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3815 if (unlikely(__pyx_t_10 != -1)) {
3816 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3817 __PYX_ERR(0, 168, __pyx_L1_error)
3819 __pyx_t_15 = __pyx_v_k;
3822 if (unlikely(__pyx_t_15 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3823 if (__pyx_t_16 < 0) {
3824 __pyx_t_16 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3825 if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 1;
3826 } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3827 if (unlikely(__pyx_t_10 != -1)) {
3828 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3829 __PYX_ERR(0, 168, __pyx_L1_error)
3833 * for k in range(K):
3835 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) * # <<<<<<<<<<<<<<
3836 * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
3839 __pyx_v_box_area = ((((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_query_boxes.diminfo[1].strides))) + 1.0) * (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_query_boxes.diminfo[1].strides))) + 1.0));
3842 * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
3844 * for n in range(N): # <<<<<<<<<<<<<<
3846 * min(boxes[n, 2], query_boxes[k, 2]) -
3848 __pyx_t_17 = __pyx_v_N;
3849 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
3850 __pyx_v_n = __pyx_t_18;
3853 * for n in range(N):
3855 * min(boxes[n, 2], query_boxes[k, 2]) - # <<<<<<<<<<<<<<
3856 * max(boxes[n, 0], query_boxes[k, 0]) + 1
3859 __pyx_t_19 = __pyx_v_k;
3862 if (unlikely(__pyx_t_19 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3863 if (__pyx_t_20 < 0) {
3864 __pyx_t_20 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3865 if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 1;
3866 } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3867 if (unlikely(__pyx_t_10 != -1)) {
3868 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3869 __PYX_ERR(0, 172, __pyx_L1_error)
3871 __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
3872 __pyx_t_22 = __pyx_v_n;
3875 if (unlikely(__pyx_t_22 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3876 if (__pyx_t_23 < 0) {
3877 __pyx_t_23 += __pyx_pybuffernd_boxes.diminfo[1].shape;
3878 if (unlikely(__pyx_t_23 < 0)) __pyx_t_10 = 1;
3879 } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3880 if (unlikely(__pyx_t_10 != -1)) {
3881 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3882 __PYX_ERR(0, 172, __pyx_L1_error)
3884 __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_boxes.diminfo[1].strides));
3885 if (((__pyx_t_21 < __pyx_t_24) != 0)) {
3886 __pyx_t_25 = __pyx_t_21;
3888 __pyx_t_25 = __pyx_t_24;
3893 * min(boxes[n, 2], query_boxes[k, 2]) -
3894 * max(boxes[n, 0], query_boxes[k, 0]) + 1 # <<<<<<<<<<<<<<
3898 __pyx_t_26 = __pyx_v_k;
3901 if (unlikely(__pyx_t_26 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3902 if (__pyx_t_27 < 0) {
3903 __pyx_t_27 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3904 if (unlikely(__pyx_t_27 < 0)) __pyx_t_10 = 1;
3905 } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3906 if (unlikely(__pyx_t_10 != -1)) {
3907 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3908 __PYX_ERR(0, 173, __pyx_L1_error)
3910 __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
3911 __pyx_t_28 = __pyx_v_n;
3914 if (unlikely(__pyx_t_28 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3915 if (__pyx_t_29 < 0) {
3916 __pyx_t_29 += __pyx_pybuffernd_boxes.diminfo[1].shape;
3917 if (unlikely(__pyx_t_29 < 0)) __pyx_t_10 = 1;
3918 } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3919 if (unlikely(__pyx_t_10 != -1)) {
3920 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3921 __PYX_ERR(0, 173, __pyx_L1_error)
3923 __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_boxes.diminfo[1].strides));
3924 if (((__pyx_t_21 > __pyx_t_24) != 0)) {
3925 __pyx_t_30 = __pyx_t_21;
3927 __pyx_t_30 = __pyx_t_24;
3931 * for n in range(N):
3933 * min(boxes[n, 2], query_boxes[k, 2]) - # <<<<<<<<<<<<<<
3934 * max(boxes[n, 0], query_boxes[k, 0]) + 1
3937 __pyx_v_iw = ((__pyx_t_25 - __pyx_t_30) + 1.0);
3940 * max(boxes[n, 0], query_boxes[k, 0]) + 1
3942 * if iw > 0: # <<<<<<<<<<<<<<
3944 * min(boxes[n, 3], query_boxes[k, 3]) -
3946 __pyx_t_31 = ((__pyx_v_iw > 0.0) != 0);
3952 * min(boxes[n, 3], query_boxes[k, 3]) - # <<<<<<<<<<<<<<
3953 * max(boxes[n, 1], query_boxes[k, 1]) + 1
3956 __pyx_t_32 = __pyx_v_k;
3959 if (unlikely(__pyx_t_32 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3960 if (__pyx_t_33 < 0) {
3961 __pyx_t_33 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
3962 if (unlikely(__pyx_t_33 < 0)) __pyx_t_10 = 1;
3963 } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3964 if (unlikely(__pyx_t_10 != -1)) {
3965 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3966 __PYX_ERR(0, 177, __pyx_L1_error)
3968 __pyx_t_30 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
3969 __pyx_t_34 = __pyx_v_n;
3972 if (unlikely(__pyx_t_34 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3973 if (__pyx_t_35 < 0) {
3974 __pyx_t_35 += __pyx_pybuffernd_boxes.diminfo[1].shape;
3975 if (unlikely(__pyx_t_35 < 0)) __pyx_t_10 = 1;
3976 } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
3977 if (unlikely(__pyx_t_10 != -1)) {
3978 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3979 __PYX_ERR(0, 177, __pyx_L1_error)
3981 __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_boxes.diminfo[1].strides));
3982 if (((__pyx_t_30 < __pyx_t_25) != 0)) {
3983 __pyx_t_21 = __pyx_t_30;
3985 __pyx_t_21 = __pyx_t_25;
3990 * min(boxes[n, 3], query_boxes[k, 3]) -
3991 * max(boxes[n, 1], query_boxes[k, 1]) + 1 # <<<<<<<<<<<<<<
3995 __pyx_t_36 = __pyx_v_k;
3998 if (unlikely(__pyx_t_36 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
3999 if (__pyx_t_37 < 0) {
4000 __pyx_t_37 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
4001 if (unlikely(__pyx_t_37 < 0)) __pyx_t_10 = 1;
4002 } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
4003 if (unlikely(__pyx_t_10 != -1)) {
4004 __Pyx_RaiseBufferIndexError(__pyx_t_10);
4005 __PYX_ERR(0, 178, __pyx_L1_error)
4007 __pyx_t_30 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
4008 __pyx_t_38 = __pyx_v_n;
4011 if (unlikely(__pyx_t_38 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
4012 if (__pyx_t_39 < 0) {
4013 __pyx_t_39 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4014 if (unlikely(__pyx_t_39 < 0)) __pyx_t_10 = 1;
4015 } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
4016 if (unlikely(__pyx_t_10 != -1)) {
4017 __Pyx_RaiseBufferIndexError(__pyx_t_10);
4018 __PYX_ERR(0, 178, __pyx_L1_error)
4020 __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_boxes.diminfo[1].strides));
4021 if (((__pyx_t_30 > __pyx_t_25) != 0)) {
4022 __pyx_t_24 = __pyx_t_30;
4024 __pyx_t_24 = __pyx_t_25;
4030 * min(boxes[n, 3], query_boxes[k, 3]) - # <<<<<<<<<<<<<<
4031 * max(boxes[n, 1], query_boxes[k, 1]) + 1
4034 __pyx_v_ih = ((__pyx_t_21 - __pyx_t_24) + 1.0);
4037 * max(boxes[n, 1], query_boxes[k, 1]) + 1
4039 * if ih > 0: # <<<<<<<<<<<<<<
4040 * if query_boxes[k, 4] == -1:
4041 * ua = float((boxes[n, 2] - boxes[n, 0] + 1)
4043 __pyx_t_31 = ((__pyx_v_ih > 0.0) != 0);
4049 * if query_boxes[k, 4] == -1: # <<<<<<<<<<<<<<
4050 * ua = float((boxes[n, 2] - boxes[n, 0] + 1)
4051 * *(boxes[n, 3] - boxes[n, 1] + 1))
4053 __pyx_t_40 = __pyx_v_k;
4056 if (unlikely(__pyx_t_40 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
4057 if (__pyx_t_41 < 0) {
4058 __pyx_t_41 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
4059 if (unlikely(__pyx_t_41 < 0)) __pyx_t_10 = 1;
4060 } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
4061 if (unlikely(__pyx_t_10 != -1)) {
4062 __Pyx_RaiseBufferIndexError(__pyx_t_10);
4063 __PYX_ERR(0, 181, __pyx_L1_error)
4065 __pyx_t_31 = (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) == -1.0) != 0);
4070 * if query_boxes[k, 4] == -1:
4071 * ua = float((boxes[n, 2] - boxes[n, 0] + 1) # <<<<<<<<<<<<<<
4072 * *(boxes[n, 3] - boxes[n, 1] + 1))
4075 __pyx_t_42 = __pyx_v_n;
4078 if (unlikely(__pyx_t_42 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
4079 if (__pyx_t_43 < 0) {
4080 __pyx_t_43 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4081 if (unlikely(__pyx_t_43 < 0)) __pyx_t_10 = 1;
4082 } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
4083 if (unlikely(__pyx_t_10 != -1)) {
4084 __Pyx_RaiseBufferIndexError(__pyx_t_10);
4085 __PYX_ERR(0, 182, __pyx_L1_error)
4087 __pyx_t_44 = __pyx_v_n;
4090 if (unlikely(__pyx_t_44 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
4091 if (__pyx_t_45 < 0) {
4092 __pyx_t_45 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4093 if (unlikely(__pyx_t_45 < 0)) __pyx_t_10 = 1;
4094 } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
4095 if (unlikely(__pyx_t_10 != -1)) {
4096 __Pyx_RaiseBufferIndexError(__pyx_t_10);
4097 __PYX_ERR(0, 182, __pyx_L1_error)
4101 * if query_boxes[k, 4] == -1:
4102 * ua = float((boxes[n, 2] - boxes[n, 0] + 1)
4103 * *(boxes[n, 3] - boxes[n, 1] + 1)) # <<<<<<<<<<<<<<
4107 __pyx_t_46 = __pyx_v_n;
4110 if (unlikely(__pyx_t_46 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
4111 if (__pyx_t_47 < 0) {
4112 __pyx_t_47 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4113 if (unlikely(__pyx_t_47 < 0)) __pyx_t_10 = 1;
4114 } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
4115 if (unlikely(__pyx_t_10 != -1)) {
4116 __Pyx_RaiseBufferIndexError(__pyx_t_10);
4117 __PYX_ERR(0, 183, __pyx_L1_error)
4119 __pyx_t_48 = __pyx_v_n;
4122 if (unlikely(__pyx_t_48 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
4123 if (__pyx_t_49 < 0) {
4124 __pyx_t_49 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4125 if (unlikely(__pyx_t_49 < 0)) __pyx_t_10 = 1;
4126 } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
4127 if (unlikely(__pyx_t_10 != -1)) {
4128 __Pyx_RaiseBufferIndexError(__pyx_t_10);
4129 __PYX_ERR(0, 183, __pyx_L1_error)
4134 * if query_boxes[k, 4] == -1:
4135 * ua = float((boxes[n, 2] - boxes[n, 0] + 1) # <<<<<<<<<<<<<<
4136 * *(boxes[n, 3] - boxes[n, 1] + 1))
4139 __pyx_v_ua = ((double)((((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_boxes.diminfo[1].strides))) + 1.0) * (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_boxes.diminfo[1].strides))) + 1.0)));
4144 * if query_boxes[k, 4] == -1: # <<<<<<<<<<<<<<
4145 * ua = float((boxes[n, 2] - boxes[n, 0] + 1)
4146 * *(boxes[n, 3] - boxes[n, 1] + 1))
4152 * *(boxes[n, 3] - boxes[n, 1] + 1))
4154 * ua = float( # <<<<<<<<<<<<<<
4155 * (boxes[n, 2] - boxes[n, 0] + 1) *
4156 * (boxes[n, 3] - boxes[n, 1] + 1) +
4163 * (boxes[n, 2] - boxes[n, 0] + 1) * # <<<<<<<<<<<<<<
4164 * (boxes[n, 3] - boxes[n, 1] + 1) +
4165 * box_area - iw * ih
4167 __pyx_t_50 = __pyx_v_n;
4170 if (unlikely(__pyx_t_50 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
4171 if (__pyx_t_51 < 0) {
4172 __pyx_t_51 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4173 if (unlikely(__pyx_t_51 < 0)) __pyx_t_10 = 1;
4174 } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
4175 if (unlikely(__pyx_t_10 != -1)) {
4176 __Pyx_RaiseBufferIndexError(__pyx_t_10);
4177 __PYX_ERR(0, 186, __pyx_L1_error)
4179 __pyx_t_52 = __pyx_v_n;
4182 if (unlikely(__pyx_t_52 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
4183 if (__pyx_t_53 < 0) {
4184 __pyx_t_53 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4185 if (unlikely(__pyx_t_53 < 0)) __pyx_t_10 = 1;
4186 } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
4187 if (unlikely(__pyx_t_10 != -1)) {
4188 __Pyx_RaiseBufferIndexError(__pyx_t_10);
4189 __PYX_ERR(0, 186, __pyx_L1_error)
4194 * (boxes[n, 2] - boxes[n, 0] + 1) *
4195 * (boxes[n, 3] - boxes[n, 1] + 1) + # <<<<<<<<<<<<<<
4196 * box_area - iw * ih
4199 __pyx_t_54 = __pyx_v_n;
4202 if (unlikely(__pyx_t_54 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
4203 if (__pyx_t_55 < 0) {
4204 __pyx_t_55 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4205 if (unlikely(__pyx_t_55 < 0)) __pyx_t_10 = 1;
4206 } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
4207 if (unlikely(__pyx_t_10 != -1)) {
4208 __Pyx_RaiseBufferIndexError(__pyx_t_10);
4209 __PYX_ERR(0, 187, __pyx_L1_error)
4211 __pyx_t_56 = __pyx_v_n;
4214 if (unlikely(__pyx_t_56 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_10 = 0;
4215 if (__pyx_t_57 < 0) {
4216 __pyx_t_57 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4217 if (unlikely(__pyx_t_57 < 0)) __pyx_t_10 = 1;
4218 } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_10 = 1;
4219 if (unlikely(__pyx_t_10 != -1)) {
4220 __Pyx_RaiseBufferIndexError(__pyx_t_10);
4221 __PYX_ERR(0, 187, __pyx_L1_error)
4225 * *(boxes[n, 3] - boxes[n, 1] + 1))
4227 * ua = float( # <<<<<<<<<<<<<<
4228 * (boxes[n, 2] - boxes[n, 0] + 1) *
4229 * (boxes[n, 3] - boxes[n, 1] + 1) +
4231 __pyx_v_ua = ((double)((((((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_boxes.diminfo[1].strides))) + 1.0) * (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_57, __pyx_pybuffernd_boxes.diminfo[1].strides))) + 1.0)) + __pyx_v_box_area) - (__pyx_v_iw * __pyx_v_ih)));
4236 * box_area - iw * ih
4238 * overlaps[n, k] = iw * ih / ua # <<<<<<<<<<<<<<
4242 __pyx_t_24 = (__pyx_v_iw * __pyx_v_ih);
4243 if (unlikely(__pyx_v_ua == 0)) {
4244 PyErr_SetString(PyExc_ZeroDivisionError, "float division");
4245 __PYX_ERR(0, 190, __pyx_L1_error)
4247 __pyx_t_58 = __pyx_v_n;
4248 __pyx_t_59 = __pyx_v_k;
4250 if (unlikely(__pyx_t_58 >= (size_t)__pyx_pybuffernd_overlaps.diminfo[0].shape)) __pyx_t_10 = 0;
4251 if (unlikely(__pyx_t_59 >= (size_t)__pyx_pybuffernd_overlaps.diminfo[1].shape)) __pyx_t_10 = 1;
4252 if (unlikely(__pyx_t_10 != -1)) {
4253 __Pyx_RaiseBufferIndexError(__pyx_t_10);
4254 __PYX_ERR(0, 190, __pyx_L1_error)
4256 *__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_overlaps.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_overlaps.diminfo[1].strides) = (__pyx_t_24 / __pyx_v_ua);
4259 * max(boxes[n, 1], query_boxes[k, 1]) + 1
4261 * if ih > 0: # <<<<<<<<<<<<<<
4262 * if query_boxes[k, 4] == -1:
4263 * ua = float((boxes[n, 2] - boxes[n, 0] + 1)
4268 * max(boxes[n, 0], query_boxes[k, 0]) + 1
4270 * if iw > 0: # <<<<<<<<<<<<<<
4272 * min(boxes[n, 3], query_boxes[k, 3]) -
4280 * overlaps[n, k] = iw * ih / ua
4281 * return overlaps # <<<<<<<<<<<<<<
4285 __Pyx_XDECREF(__pyx_r);
4286 __Pyx_INCREF(((PyObject *)__pyx_v_overlaps));
4287 __pyx_r = ((PyObject *)__pyx_v_overlaps);
4293 * def bbox_overlaps_ignore( # <<<<<<<<<<<<<<
4294 * np.ndarray[DTYPE_t, ndim=2] boxes,
4295 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
4298 /* function exit code */
4300 __Pyx_XDECREF(__pyx_t_1);
4301 __Pyx_XDECREF(__pyx_t_2);
4302 __Pyx_XDECREF(__pyx_t_3);
4303 __Pyx_XDECREF(__pyx_t_4);
4304 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4305 __Pyx_PyThreadState_declare
4306 __Pyx_PyThreadState_assign
4307 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4308 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
4309 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer);
4310 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
4311 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4312 __Pyx_AddTraceback("cython_bbox.bbox_overlaps_ignore", __pyx_clineno, __pyx_lineno, __pyx_filename);
4316 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
4317 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer);
4318 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
4320 __Pyx_XDECREF((PyObject *)__pyx_v_overlaps);
4321 __Pyx_XGIVEREF(__pyx_r);
4322 __Pyx_RefNannyFinishContext();
4329 * def get_assignment_overlaps( # <<<<<<<<<<<<<<
4330 * np.ndarray[DTYPE_t, ndim=2] boxes,
4331 * np.ndarray[DTYPE_t, ndim=2] query_boxes,
4334 /* Python wrapper */
4335 static PyObject *__pyx_pw_11cython_bbox_9get_assignment_overlaps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4336 static char __pyx_doc_11cython_bbox_8get_assignment_overlaps[] = " Used for proposal_target_layer_ignore\n Parameters\n ----------\n boxes: (N, 4) ndarray of float\n query_boxes: (K, 4) ndarray of float\n Returns\n -------\n overlaps: (N, K) ndarray of overlap between boxes and query_boxes\n ";
4337 static PyMethodDef __pyx_mdef_11cython_bbox_9get_assignment_overlaps = {"get_assignment_overlaps", (PyCFunction)__pyx_pw_11cython_bbox_9get_assignment_overlaps, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11cython_bbox_8get_assignment_overlaps};
4338 static PyObject *__pyx_pw_11cython_bbox_9get_assignment_overlaps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4339 PyArrayObject *__pyx_v_boxes = 0;
4340 PyArrayObject *__pyx_v_query_boxes = 0;
4341 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_FG_THRESH;
4342 PyObject *__pyx_r = 0;
4343 __Pyx_RefNannyDeclarations
4344 __Pyx_RefNannySetupContext("get_assignment_overlaps (wrapper)", 0);
4346 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_boxes,&__pyx_n_s_query_boxes,&__pyx_n_s_FG_THRESH,0};
4347 PyObject* values[3] = {0,0,0};
4348 if (unlikely(__pyx_kwds)) {
4350 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4352 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4353 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4354 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4356 default: goto __pyx_L5_argtuple_error;
4358 kw_args = PyDict_Size(__pyx_kwds);
4361 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boxes)) != 0)) kw_args--;
4362 else goto __pyx_L5_argtuple_error;
4364 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query_boxes)) != 0)) kw_args--;
4366 __Pyx_RaiseArgtupleInvalid("get_assignment_overlaps", 1, 3, 3, 1); __PYX_ERR(0, 194, __pyx_L3_error)
4369 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_FG_THRESH)) != 0)) kw_args--;
4371 __Pyx_RaiseArgtupleInvalid("get_assignment_overlaps", 1, 3, 3, 2); __PYX_ERR(0, 194, __pyx_L3_error)
4374 if (unlikely(kw_args > 0)) {
4375 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_assignment_overlaps") < 0)) __PYX_ERR(0, 194, __pyx_L3_error)
4377 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4378 goto __pyx_L5_argtuple_error;
4380 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4381 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4382 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4384 __pyx_v_boxes = ((PyArrayObject *)values[0]);
4385 __pyx_v_query_boxes = ((PyArrayObject *)values[1]);
4386 __pyx_v_FG_THRESH = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_FG_THRESH == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error)
4388 goto __pyx_L4_argument_unpacking_done;
4389 __pyx_L5_argtuple_error:;
4390 __Pyx_RaiseArgtupleInvalid("get_assignment_overlaps", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 194, __pyx_L3_error)
4392 __Pyx_AddTraceback("cython_bbox.get_assignment_overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
4393 __Pyx_RefNannyFinishContext();
4395 __pyx_L4_argument_unpacking_done:;
4396 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_boxes), __pyx_ptype_5numpy_ndarray, 1, "boxes", 0))) __PYX_ERR(0, 195, __pyx_L1_error)
4397 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query_boxes), __pyx_ptype_5numpy_ndarray, 1, "query_boxes", 0))) __PYX_ERR(0, 196, __pyx_L1_error)
4398 __pyx_r = __pyx_pf_11cython_bbox_8get_assignment_overlaps(__pyx_self, __pyx_v_boxes, __pyx_v_query_boxes, __pyx_v_FG_THRESH);
4400 /* function exit code */
4405 __Pyx_RefNannyFinishContext();
4409 static PyObject *__pyx_pf_11cython_bbox_8get_assignment_overlaps(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes, __pyx_t_11cython_bbox_DTYPE_t __pyx_v_FG_THRESH) {
4410 unsigned int __pyx_v_N;
4411 unsigned int __pyx_v_K;
4412 PyArrayObject *__pyx_v_gt_assignment = 0;
4413 PyArrayObject *__pyx_v_max_overlaps = 0;
4414 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_iw;
4415 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_ih;
4416 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_box_area;
4417 __pyx_t_11cython_bbox_DTYPE_t __pyx_v_ua;
4418 unsigned int __pyx_v_k;
4419 unsigned int __pyx_v_n;
4420 PyObject *__pyx_v_overlap = NULL;
4421 __Pyx_LocalBuf_ND __pyx_pybuffernd_boxes;
4422 __Pyx_Buffer __pyx_pybuffer_boxes;
4423 __Pyx_LocalBuf_ND __pyx_pybuffernd_gt_assignment;
4424 __Pyx_Buffer __pyx_pybuffer_gt_assignment;
4425 __Pyx_LocalBuf_ND __pyx_pybuffernd_max_overlaps;
4426 __Pyx_Buffer __pyx_pybuffer_max_overlaps;
4427 __Pyx_LocalBuf_ND __pyx_pybuffernd_query_boxes;
4428 __Pyx_Buffer __pyx_pybuffer_query_boxes;
4429 PyObject *__pyx_r = NULL;
4430 __Pyx_RefNannyDeclarations
4431 PyObject *__pyx_t_1 = NULL;
4432 PyObject *__pyx_t_2 = NULL;
4433 PyObject *__pyx_t_3 = NULL;
4434 PyObject *__pyx_t_4 = NULL;
4435 PyObject *__pyx_t_5 = NULL;
4436 PyArrayObject *__pyx_t_6 = NULL;
4437 PyArrayObject *__pyx_t_7 = NULL;
4438 unsigned int __pyx_t_8;
4439 unsigned int __pyx_t_9;
4441 Py_ssize_t __pyx_t_11;
4444 Py_ssize_t __pyx_t_14;
4446 Py_ssize_t __pyx_t_16;
4448 Py_ssize_t __pyx_t_18;
4449 unsigned int __pyx_t_19;
4450 unsigned int __pyx_t_20;
4452 Py_ssize_t __pyx_t_22;
4453 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_23;
4455 Py_ssize_t __pyx_t_25;
4456 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_26;
4457 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_27;
4459 Py_ssize_t __pyx_t_29;
4461 Py_ssize_t __pyx_t_31;
4462 __pyx_t_11cython_bbox_DTYPE_t __pyx_t_32;
4465 Py_ssize_t __pyx_t_35;
4467 Py_ssize_t __pyx_t_37;
4469 Py_ssize_t __pyx_t_39;
4471 Py_ssize_t __pyx_t_41;
4473 Py_ssize_t __pyx_t_43;
4475 Py_ssize_t __pyx_t_45;
4477 Py_ssize_t __pyx_t_47;
4479 Py_ssize_t __pyx_t_49;
4481 Py_ssize_t __pyx_t_51;
4484 Py_ssize_t __pyx_t_54;
4485 Py_ssize_t __pyx_t_55;
4491 Py_ssize_t __pyx_t_61;
4493 Py_ssize_t __pyx_t_63;
4495 Py_ssize_t __pyx_t_65;
4497 Py_ssize_t __pyx_t_67;
4501 __Pyx_RefNannySetupContext("get_assignment_overlaps", 0);
4502 __pyx_pybuffer_gt_assignment.pybuffer.buf = NULL;
4503 __pyx_pybuffer_gt_assignment.refcount = 0;
4504 __pyx_pybuffernd_gt_assignment.data = NULL;
4505 __pyx_pybuffernd_gt_assignment.rcbuffer = &__pyx_pybuffer_gt_assignment;
4506 __pyx_pybuffer_max_overlaps.pybuffer.buf = NULL;
4507 __pyx_pybuffer_max_overlaps.refcount = 0;
4508 __pyx_pybuffernd_max_overlaps.data = NULL;
4509 __pyx_pybuffernd_max_overlaps.rcbuffer = &__pyx_pybuffer_max_overlaps;
4510 __pyx_pybuffer_boxes.pybuffer.buf = NULL;
4511 __pyx_pybuffer_boxes.refcount = 0;
4512 __pyx_pybuffernd_boxes.data = NULL;
4513 __pyx_pybuffernd_boxes.rcbuffer = &__pyx_pybuffer_boxes;
4514 __pyx_pybuffer_query_boxes.pybuffer.buf = NULL;
4515 __pyx_pybuffer_query_boxes.refcount = 0;
4516 __pyx_pybuffernd_query_boxes.data = NULL;
4517 __pyx_pybuffernd_query_boxes.rcbuffer = &__pyx_pybuffer_query_boxes;
4519 __Pyx_BufFmt_StackElem __pyx_stack[1];
4520 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_boxes, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 194, __pyx_L1_error)
4522 __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];
4524 __Pyx_BufFmt_StackElem __pyx_stack[1];
4525 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_query_boxes, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 194, __pyx_L1_error)
4527 __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];
4530 * overlaps: (N, K) ndarray of overlap between boxes and query_boxes
4532 * cdef unsigned int N = boxes.shape[0] # <<<<<<<<<<<<<<
4533 * cdef unsigned int K = query_boxes.shape[0]
4534 * cdef np.ndarray[long, ndim=1] gt_assignment = np.zeros((N,), dtype=np.int)
4536 __pyx_v_N = (__pyx_v_boxes->dimensions[0]);
4540 * cdef unsigned int N = boxes.shape[0]
4541 * cdef unsigned int K = query_boxes.shape[0] # <<<<<<<<<<<<<<
4542 * cdef np.ndarray[long, ndim=1] gt_assignment = np.zeros((N,), dtype=np.int)
4543 * cdef np.ndarray[DTYPE_t, ndim=1] max_overlaps = np.zeros((N,), dtype=DTYPE)
4545 __pyx_v_K = (__pyx_v_query_boxes->dimensions[0]);
4548 * cdef unsigned int N = boxes.shape[0]
4549 * cdef unsigned int K = query_boxes.shape[0]
4550 * cdef np.ndarray[long, ndim=1] gt_assignment = np.zeros((N,), dtype=np.int) # <<<<<<<<<<<<<<
4551 * cdef np.ndarray[DTYPE_t, ndim=1] max_overlaps = np.zeros((N,), dtype=DTYPE)
4552 * cdef DTYPE_t iw, ih, box_area
4554 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
4555 __Pyx_GOTREF(__pyx_t_1);
4556 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error)
4557 __Pyx_GOTREF(__pyx_t_2);
4558 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4559 __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
4560 __Pyx_GOTREF(__pyx_t_1);
4561 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error)
4562 __Pyx_GOTREF(__pyx_t_3);
4563 __Pyx_GIVEREF(__pyx_t_1);
4564 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
4566 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
4567 __Pyx_GOTREF(__pyx_t_1);
4568 __Pyx_GIVEREF(__pyx_t_3);
4569 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
4571 __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error)
4572 __Pyx_GOTREF(__pyx_t_3);
4573 __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L1_error)
4574 __Pyx_GOTREF(__pyx_t_4);
4575 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error)
4576 __Pyx_GOTREF(__pyx_t_5);
4577 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4578 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
4579 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4580 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error)
4581 __Pyx_GOTREF(__pyx_t_5);
4582 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4583 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4584 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4585 if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 209, __pyx_L1_error)
4586 __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
4588 __Pyx_BufFmt_StackElem __pyx_stack[1];
4589 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gt_assignment.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
4590 __pyx_v_gt_assignment = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_gt_assignment.rcbuffer->pybuffer.buf = NULL;
4591 __PYX_ERR(0, 209, __pyx_L1_error)
4592 } else {__pyx_pybuffernd_gt_assignment.diminfo[0].strides = __pyx_pybuffernd_gt_assignment.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gt_assignment.diminfo[0].shape = __pyx_pybuffernd_gt_assignment.rcbuffer->pybuffer.shape[0];
4596 __pyx_v_gt_assignment = ((PyArrayObject *)__pyx_t_5);
4600 * cdef unsigned int K = query_boxes.shape[0]
4601 * cdef np.ndarray[long, ndim=1] gt_assignment = np.zeros((N,), dtype=np.int)
4602 * cdef np.ndarray[DTYPE_t, ndim=1] max_overlaps = np.zeros((N,), dtype=DTYPE) # <<<<<<<<<<<<<<
4603 * cdef DTYPE_t iw, ih, box_area
4606 __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error)
4607 __Pyx_GOTREF(__pyx_t_5);
4608 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error)
4609 __Pyx_GOTREF(__pyx_t_3);
4610 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4611 __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error)
4612 __Pyx_GOTREF(__pyx_t_5);
4613 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
4614 __Pyx_GOTREF(__pyx_t_1);
4615 __Pyx_GIVEREF(__pyx_t_5);
4616 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
4618 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error)
4619 __Pyx_GOTREF(__pyx_t_5);
4620 __Pyx_GIVEREF(__pyx_t_1);
4621 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
4623 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
4624 __Pyx_GOTREF(__pyx_t_1);
4625 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
4626 __Pyx_GOTREF(__pyx_t_2);
4627 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 210, __pyx_L1_error)
4628 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4629 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
4630 __Pyx_GOTREF(__pyx_t_2);
4631 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4632 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4633 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4634 if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 210, __pyx_L1_error)
4635 __pyx_t_7 = ((PyArrayObject *)__pyx_t_2);
4637 __Pyx_BufFmt_StackElem __pyx_stack[1];
4638 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_overlaps.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
4639 __pyx_v_max_overlaps = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_max_overlaps.rcbuffer->pybuffer.buf = NULL;
4640 __PYX_ERR(0, 210, __pyx_L1_error)
4641 } else {__pyx_pybuffernd_max_overlaps.diminfo[0].strides = __pyx_pybuffernd_max_overlaps.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_overlaps.diminfo[0].shape = __pyx_pybuffernd_max_overlaps.rcbuffer->pybuffer.shape[0];
4645 __pyx_v_max_overlaps = ((PyArrayObject *)__pyx_t_2);
4650 * cdef unsigned int k, n
4651 * for k in range(K): # <<<<<<<<<<<<<<
4653 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
4655 __pyx_t_8 = __pyx_v_K;
4656 for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
4657 __pyx_v_k = __pyx_t_9;
4660 * for k in range(K):
4662 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) * # <<<<<<<<<<<<<<
4663 * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
4666 __pyx_t_10 = __pyx_v_k;
4669 if (unlikely(__pyx_t_10 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4670 if (__pyx_t_11 < 0) {
4671 __pyx_t_11 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
4672 if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 1;
4673 } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4674 if (unlikely(__pyx_t_12 != -1)) {
4675 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4676 __PYX_ERR(0, 216, __pyx_L1_error)
4678 __pyx_t_13 = __pyx_v_k;
4681 if (unlikely(__pyx_t_13 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4682 if (__pyx_t_14 < 0) {
4683 __pyx_t_14 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
4684 if (unlikely(__pyx_t_14 < 0)) __pyx_t_12 = 1;
4685 } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4686 if (unlikely(__pyx_t_12 != -1)) {
4687 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4688 __PYX_ERR(0, 216, __pyx_L1_error)
4693 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
4694 * (query_boxes[k, 3] - query_boxes[k, 1] + 1) # <<<<<<<<<<<<<<
4696 * for n in range(N):
4698 __pyx_t_15 = __pyx_v_k;
4701 if (unlikely(__pyx_t_15 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4702 if (__pyx_t_16 < 0) {
4703 __pyx_t_16 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
4704 if (unlikely(__pyx_t_16 < 0)) __pyx_t_12 = 1;
4705 } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4706 if (unlikely(__pyx_t_12 != -1)) {
4707 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4708 __PYX_ERR(0, 217, __pyx_L1_error)
4710 __pyx_t_17 = __pyx_v_k;
4713 if (unlikely(__pyx_t_17 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4714 if (__pyx_t_18 < 0) {
4715 __pyx_t_18 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
4716 if (unlikely(__pyx_t_18 < 0)) __pyx_t_12 = 1;
4717 } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4718 if (unlikely(__pyx_t_12 != -1)) {
4719 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4720 __PYX_ERR(0, 217, __pyx_L1_error)
4724 * for k in range(K):
4726 * (query_boxes[k, 2] - query_boxes[k, 0] + 1) * # <<<<<<<<<<<<<<
4727 * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
4730 __pyx_v_box_area = ((((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_query_boxes.diminfo[1].strides))) + 1.0) * (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_query_boxes.diminfo[1].strides))) + 1.0));
4733 * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
4735 * for n in range(N): # <<<<<<<<<<<<<<
4737 * min(boxes[n, 2], query_boxes[k, 2]) -
4739 __pyx_t_19 = __pyx_v_N;
4740 for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
4741 __pyx_v_n = __pyx_t_20;
4744 * for n in range(N):
4746 * min(boxes[n, 2], query_boxes[k, 2]) - # <<<<<<<<<<<<<<
4747 * max(boxes[n, 0], query_boxes[k, 0]) + 1
4750 __pyx_t_21 = __pyx_v_k;
4753 if (unlikely(__pyx_t_21 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4754 if (__pyx_t_22 < 0) {
4755 __pyx_t_22 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
4756 if (unlikely(__pyx_t_22 < 0)) __pyx_t_12 = 1;
4757 } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4758 if (unlikely(__pyx_t_12 != -1)) {
4759 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4760 __PYX_ERR(0, 221, __pyx_L1_error)
4762 __pyx_t_23 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
4763 __pyx_t_24 = __pyx_v_n;
4766 if (unlikely(__pyx_t_24 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4767 if (__pyx_t_25 < 0) {
4768 __pyx_t_25 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4769 if (unlikely(__pyx_t_25 < 0)) __pyx_t_12 = 1;
4770 } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4771 if (unlikely(__pyx_t_12 != -1)) {
4772 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4773 __PYX_ERR(0, 221, __pyx_L1_error)
4775 __pyx_t_26 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_boxes.diminfo[1].strides));
4776 if (((__pyx_t_23 < __pyx_t_26) != 0)) {
4777 __pyx_t_27 = __pyx_t_23;
4779 __pyx_t_27 = __pyx_t_26;
4784 * min(boxes[n, 2], query_boxes[k, 2]) -
4785 * max(boxes[n, 0], query_boxes[k, 0]) + 1 # <<<<<<<<<<<<<<
4789 __pyx_t_28 = __pyx_v_k;
4792 if (unlikely(__pyx_t_28 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4793 if (__pyx_t_29 < 0) {
4794 __pyx_t_29 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
4795 if (unlikely(__pyx_t_29 < 0)) __pyx_t_12 = 1;
4796 } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4797 if (unlikely(__pyx_t_12 != -1)) {
4798 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4799 __PYX_ERR(0, 222, __pyx_L1_error)
4801 __pyx_t_23 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
4802 __pyx_t_30 = __pyx_v_n;
4805 if (unlikely(__pyx_t_30 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4806 if (__pyx_t_31 < 0) {
4807 __pyx_t_31 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4808 if (unlikely(__pyx_t_31 < 0)) __pyx_t_12 = 1;
4809 } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4810 if (unlikely(__pyx_t_12 != -1)) {
4811 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4812 __PYX_ERR(0, 222, __pyx_L1_error)
4814 __pyx_t_26 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_boxes.diminfo[1].strides));
4815 if (((__pyx_t_23 > __pyx_t_26) != 0)) {
4816 __pyx_t_32 = __pyx_t_23;
4818 __pyx_t_32 = __pyx_t_26;
4822 * for n in range(N):
4824 * min(boxes[n, 2], query_boxes[k, 2]) - # <<<<<<<<<<<<<<
4825 * max(boxes[n, 0], query_boxes[k, 0]) + 1
4828 __pyx_v_iw = ((__pyx_t_27 - __pyx_t_32) + 1.0);
4831 * max(boxes[n, 0], query_boxes[k, 0]) + 1
4833 * if iw > 0: # <<<<<<<<<<<<<<
4835 * min(boxes[n, 3], query_boxes[k, 3]) -
4837 __pyx_t_33 = ((__pyx_v_iw > 0.0) != 0);
4843 * min(boxes[n, 3], query_boxes[k, 3]) - # <<<<<<<<<<<<<<
4844 * max(boxes[n, 1], query_boxes[k, 1]) + 1
4847 __pyx_t_34 = __pyx_v_k;
4850 if (unlikely(__pyx_t_34 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4851 if (__pyx_t_35 < 0) {
4852 __pyx_t_35 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
4853 if (unlikely(__pyx_t_35 < 0)) __pyx_t_12 = 1;
4854 } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4855 if (unlikely(__pyx_t_12 != -1)) {
4856 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4857 __PYX_ERR(0, 226, __pyx_L1_error)
4859 __pyx_t_32 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
4860 __pyx_t_36 = __pyx_v_n;
4863 if (unlikely(__pyx_t_36 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4864 if (__pyx_t_37 < 0) {
4865 __pyx_t_37 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4866 if (unlikely(__pyx_t_37 < 0)) __pyx_t_12 = 1;
4867 } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4868 if (unlikely(__pyx_t_12 != -1)) {
4869 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4870 __PYX_ERR(0, 226, __pyx_L1_error)
4872 __pyx_t_27 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_boxes.diminfo[1].strides));
4873 if (((__pyx_t_32 < __pyx_t_27) != 0)) {
4874 __pyx_t_23 = __pyx_t_32;
4876 __pyx_t_23 = __pyx_t_27;
4881 * min(boxes[n, 3], query_boxes[k, 3]) -
4882 * max(boxes[n, 1], query_boxes[k, 1]) + 1 # <<<<<<<<<<<<<<
4886 __pyx_t_38 = __pyx_v_k;
4889 if (unlikely(__pyx_t_38 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4890 if (__pyx_t_39 < 0) {
4891 __pyx_t_39 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
4892 if (unlikely(__pyx_t_39 < 0)) __pyx_t_12 = 1;
4893 } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4894 if (unlikely(__pyx_t_12 != -1)) {
4895 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4896 __PYX_ERR(0, 227, __pyx_L1_error)
4898 __pyx_t_32 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
4899 __pyx_t_40 = __pyx_v_n;
4902 if (unlikely(__pyx_t_40 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4903 if (__pyx_t_41 < 0) {
4904 __pyx_t_41 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4905 if (unlikely(__pyx_t_41 < 0)) __pyx_t_12 = 1;
4906 } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4907 if (unlikely(__pyx_t_12 != -1)) {
4908 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4909 __PYX_ERR(0, 227, __pyx_L1_error)
4911 __pyx_t_27 = (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_boxes.diminfo[1].strides));
4912 if (((__pyx_t_32 > __pyx_t_27) != 0)) {
4913 __pyx_t_26 = __pyx_t_32;
4915 __pyx_t_26 = __pyx_t_27;
4921 * min(boxes[n, 3], query_boxes[k, 3]) - # <<<<<<<<<<<<<<
4922 * max(boxes[n, 1], query_boxes[k, 1]) + 1
4925 __pyx_v_ih = ((__pyx_t_23 - __pyx_t_26) + 1.0);
4928 * max(boxes[n, 1], query_boxes[k, 1]) + 1
4930 * if ih > 0: # <<<<<<<<<<<<<<
4931 * if query_boxes[k, 4] == -1:
4932 * ua = float((boxes[n, 2] - boxes[n, 0] + 1)
4934 __pyx_t_33 = ((__pyx_v_ih > 0.0) != 0);
4940 * if query_boxes[k, 4] == -1: # <<<<<<<<<<<<<<
4941 * ua = float((boxes[n, 2] - boxes[n, 0] + 1)
4942 * *(boxes[n, 3] - boxes[n, 1] + 1))
4944 __pyx_t_42 = __pyx_v_k;
4947 if (unlikely(__pyx_t_42 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4948 if (__pyx_t_43 < 0) {
4949 __pyx_t_43 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
4950 if (unlikely(__pyx_t_43 < 0)) __pyx_t_12 = 1;
4951 } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4952 if (unlikely(__pyx_t_12 != -1)) {
4953 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4954 __PYX_ERR(0, 230, __pyx_L1_error)
4956 __pyx_t_33 = (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) == -1.0) != 0);
4961 * if query_boxes[k, 4] == -1:
4962 * ua = float((boxes[n, 2] - boxes[n, 0] + 1) # <<<<<<<<<<<<<<
4963 * *(boxes[n, 3] - boxes[n, 1] + 1))
4964 * overlap = iw * ih / ua
4966 __pyx_t_44 = __pyx_v_n;
4969 if (unlikely(__pyx_t_44 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4970 if (__pyx_t_45 < 0) {
4971 __pyx_t_45 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4972 if (unlikely(__pyx_t_45 < 0)) __pyx_t_12 = 1;
4973 } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4974 if (unlikely(__pyx_t_12 != -1)) {
4975 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4976 __PYX_ERR(0, 231, __pyx_L1_error)
4978 __pyx_t_46 = __pyx_v_n;
4981 if (unlikely(__pyx_t_46 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
4982 if (__pyx_t_47 < 0) {
4983 __pyx_t_47 += __pyx_pybuffernd_boxes.diminfo[1].shape;
4984 if (unlikely(__pyx_t_47 < 0)) __pyx_t_12 = 1;
4985 } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
4986 if (unlikely(__pyx_t_12 != -1)) {
4987 __Pyx_RaiseBufferIndexError(__pyx_t_12);
4988 __PYX_ERR(0, 231, __pyx_L1_error)
4992 * if query_boxes[k, 4] == -1:
4993 * ua = float((boxes[n, 2] - boxes[n, 0] + 1)
4994 * *(boxes[n, 3] - boxes[n, 1] + 1)) # <<<<<<<<<<<<<<
4995 * overlap = iw * ih / ua
4996 * if overlap > max_overlaps[n]:
4998 __pyx_t_48 = __pyx_v_n;
5001 if (unlikely(__pyx_t_48 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
5002 if (__pyx_t_49 < 0) {
5003 __pyx_t_49 += __pyx_pybuffernd_boxes.diminfo[1].shape;
5004 if (unlikely(__pyx_t_49 < 0)) __pyx_t_12 = 1;
5005 } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
5006 if (unlikely(__pyx_t_12 != -1)) {
5007 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5008 __PYX_ERR(0, 232, __pyx_L1_error)
5010 __pyx_t_50 = __pyx_v_n;
5013 if (unlikely(__pyx_t_50 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
5014 if (__pyx_t_51 < 0) {
5015 __pyx_t_51 += __pyx_pybuffernd_boxes.diminfo[1].shape;
5016 if (unlikely(__pyx_t_51 < 0)) __pyx_t_12 = 1;
5017 } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
5018 if (unlikely(__pyx_t_12 != -1)) {
5019 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5020 __PYX_ERR(0, 232, __pyx_L1_error)
5025 * if query_boxes[k, 4] == -1:
5026 * ua = float((boxes[n, 2] - boxes[n, 0] + 1) # <<<<<<<<<<<<<<
5027 * *(boxes[n, 3] - boxes[n, 1] + 1))
5028 * overlap = iw * ih / ua
5030 __pyx_v_ua = ((double)((((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_boxes.diminfo[1].strides))) + 1.0) * (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_boxes.diminfo[1].strides))) + 1.0)));
5033 * ua = float((boxes[n, 2] - boxes[n, 0] + 1)
5034 * *(boxes[n, 3] - boxes[n, 1] + 1))
5035 * overlap = iw * ih / ua # <<<<<<<<<<<<<<
5036 * if overlap > max_overlaps[n]:
5037 * if query_boxes[gt_assignment[n], 4] == -1 or max_overlaps[n] < FG_THRESH:
5039 __pyx_t_26 = (__pyx_v_iw * __pyx_v_ih);
5040 if (unlikely(__pyx_v_ua == 0)) {
5041 PyErr_SetString(PyExc_ZeroDivisionError, "float division");
5042 __PYX_ERR(0, 233, __pyx_L1_error)
5044 __pyx_t_2 = PyFloat_FromDouble((__pyx_t_26 / __pyx_v_ua)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
5045 __Pyx_GOTREF(__pyx_t_2);
5046 __Pyx_XDECREF_SET(__pyx_v_overlap, __pyx_t_2);
5050 * *(boxes[n, 3] - boxes[n, 1] + 1))
5051 * overlap = iw * ih / ua
5052 * if overlap > max_overlaps[n]: # <<<<<<<<<<<<<<
5053 * if query_boxes[gt_assignment[n], 4] == -1 or max_overlaps[n] < FG_THRESH:
5054 * max_overlaps[n] = overlap
5056 __pyx_t_52 = __pyx_v_n;
5058 if (unlikely(__pyx_t_52 >= (size_t)__pyx_pybuffernd_max_overlaps.diminfo[0].shape)) __pyx_t_12 = 0;
5059 if (unlikely(__pyx_t_12 != -1)) {
5060 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5061 __PYX_ERR(0, 234, __pyx_L1_error)
5063 __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_max_overlaps.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_max_overlaps.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error)
5064 __Pyx_GOTREF(__pyx_t_2);
5065 __pyx_t_1 = PyObject_RichCompare(__pyx_v_overlap, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
5066 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5067 __pyx_t_33 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_33 < 0)) __PYX_ERR(0, 234, __pyx_L1_error)
5068 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5072 * overlap = iw * ih / ua
5073 * if overlap > max_overlaps[n]:
5074 * if query_boxes[gt_assignment[n], 4] == -1 or max_overlaps[n] < FG_THRESH: # <<<<<<<<<<<<<<
5075 * max_overlaps[n] = overlap
5076 * gt_assignment[n] = k
5078 __pyx_t_53 = __pyx_v_n;
5080 if (unlikely(__pyx_t_53 >= (size_t)__pyx_pybuffernd_gt_assignment.diminfo[0].shape)) __pyx_t_12 = 0;
5081 if (unlikely(__pyx_t_12 != -1)) {
5082 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5083 __PYX_ERR(0, 235, __pyx_L1_error)
5085 __pyx_t_54 = (*__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_gt_assignment.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_gt_assignment.diminfo[0].strides));
5088 if (__pyx_t_54 < 0) {
5089 __pyx_t_54 += __pyx_pybuffernd_query_boxes.diminfo[0].shape;
5090 if (unlikely(__pyx_t_54 < 0)) __pyx_t_12 = 0;
5091 } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
5092 if (__pyx_t_55 < 0) {
5093 __pyx_t_55 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
5094 if (unlikely(__pyx_t_55 < 0)) __pyx_t_12 = 1;
5095 } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
5096 if (unlikely(__pyx_t_12 != -1)) {
5097 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5098 __PYX_ERR(0, 235, __pyx_L1_error)
5100 __pyx_t_56 = (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) == -1.0) != 0);
5103 __pyx_t_33 = __pyx_t_56;
5104 goto __pyx_L12_bool_binop_done;
5106 __pyx_t_57 = __pyx_v_n;
5108 if (unlikely(__pyx_t_57 >= (size_t)__pyx_pybuffernd_max_overlaps.diminfo[0].shape)) __pyx_t_12 = 0;
5109 if (unlikely(__pyx_t_12 != -1)) {
5110 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5111 __PYX_ERR(0, 235, __pyx_L1_error)
5113 __pyx_t_56 = (((*__Pyx_BufPtrStrided1d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_max_overlaps.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_max_overlaps.diminfo[0].strides)) < __pyx_v_FG_THRESH) != 0);
5114 __pyx_t_33 = __pyx_t_56;
5115 __pyx_L12_bool_binop_done:;
5119 * if overlap > max_overlaps[n]:
5120 * if query_boxes[gt_assignment[n], 4] == -1 or max_overlaps[n] < FG_THRESH:
5121 * max_overlaps[n] = overlap # <<<<<<<<<<<<<<
5122 * gt_assignment[n] = k
5125 __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_v_overlap); if (unlikely((__pyx_t_26 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L1_error)
5126 __pyx_t_58 = __pyx_v_n;
5128 if (unlikely(__pyx_t_58 >= (size_t)__pyx_pybuffernd_max_overlaps.diminfo[0].shape)) __pyx_t_12 = 0;
5129 if (unlikely(__pyx_t_12 != -1)) {
5130 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5131 __PYX_ERR(0, 236, __pyx_L1_error)
5133 *__Pyx_BufPtrStrided1d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_max_overlaps.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_max_overlaps.diminfo[0].strides) = __pyx_t_26;
5136 * if query_boxes[gt_assignment[n], 4] == -1 or max_overlaps[n] < FG_THRESH:
5137 * max_overlaps[n] = overlap
5138 * gt_assignment[n] = k # <<<<<<<<<<<<<<
5142 __pyx_t_59 = __pyx_v_n;
5144 if (unlikely(__pyx_t_59 >= (size_t)__pyx_pybuffernd_gt_assignment.diminfo[0].shape)) __pyx_t_12 = 0;
5145 if (unlikely(__pyx_t_12 != -1)) {
5146 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5147 __PYX_ERR(0, 237, __pyx_L1_error)
5149 *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_gt_assignment.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_gt_assignment.diminfo[0].strides) = __pyx_v_k;
5152 * overlap = iw * ih / ua
5153 * if overlap > max_overlaps[n]:
5154 * if query_boxes[gt_assignment[n], 4] == -1 or max_overlaps[n] < FG_THRESH: # <<<<<<<<<<<<<<
5155 * max_overlaps[n] = overlap
5156 * gt_assignment[n] = k
5161 * *(boxes[n, 3] - boxes[n, 1] + 1))
5162 * overlap = iw * ih / ua
5163 * if overlap > max_overlaps[n]: # <<<<<<<<<<<<<<
5164 * if query_boxes[gt_assignment[n], 4] == -1 or max_overlaps[n] < FG_THRESH:
5165 * max_overlaps[n] = overlap
5172 * if query_boxes[k, 4] == -1: # <<<<<<<<<<<<<<
5173 * ua = float((boxes[n, 2] - boxes[n, 0] + 1)
5174 * *(boxes[n, 3] - boxes[n, 1] + 1))
5180 * gt_assignment[n] = k
5182 * ua = float( # <<<<<<<<<<<<<<
5183 * (boxes[n, 2] - boxes[n, 0] + 1) *
5184 * (boxes[n, 3] - boxes[n, 1] + 1) +
5191 * (boxes[n, 2] - boxes[n, 0] + 1) * # <<<<<<<<<<<<<<
5192 * (boxes[n, 3] - boxes[n, 1] + 1) +
5193 * box_area - iw * ih
5195 __pyx_t_60 = __pyx_v_n;
5198 if (unlikely(__pyx_t_60 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
5199 if (__pyx_t_61 < 0) {
5200 __pyx_t_61 += __pyx_pybuffernd_boxes.diminfo[1].shape;
5201 if (unlikely(__pyx_t_61 < 0)) __pyx_t_12 = 1;
5202 } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
5203 if (unlikely(__pyx_t_12 != -1)) {
5204 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5205 __PYX_ERR(0, 240, __pyx_L1_error)
5207 __pyx_t_62 = __pyx_v_n;
5210 if (unlikely(__pyx_t_62 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
5211 if (__pyx_t_63 < 0) {
5212 __pyx_t_63 += __pyx_pybuffernd_boxes.diminfo[1].shape;
5213 if (unlikely(__pyx_t_63 < 0)) __pyx_t_12 = 1;
5214 } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
5215 if (unlikely(__pyx_t_12 != -1)) {
5216 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5217 __PYX_ERR(0, 240, __pyx_L1_error)
5222 * (boxes[n, 2] - boxes[n, 0] + 1) *
5223 * (boxes[n, 3] - boxes[n, 1] + 1) + # <<<<<<<<<<<<<<
5224 * box_area - iw * ih
5227 __pyx_t_64 = __pyx_v_n;
5230 if (unlikely(__pyx_t_64 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
5231 if (__pyx_t_65 < 0) {
5232 __pyx_t_65 += __pyx_pybuffernd_boxes.diminfo[1].shape;
5233 if (unlikely(__pyx_t_65 < 0)) __pyx_t_12 = 1;
5234 } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
5235 if (unlikely(__pyx_t_12 != -1)) {
5236 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5237 __PYX_ERR(0, 241, __pyx_L1_error)
5239 __pyx_t_66 = __pyx_v_n;
5242 if (unlikely(__pyx_t_66 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_12 = 0;
5243 if (__pyx_t_67 < 0) {
5244 __pyx_t_67 += __pyx_pybuffernd_boxes.diminfo[1].shape;
5245 if (unlikely(__pyx_t_67 < 0)) __pyx_t_12 = 1;
5246 } else if (unlikely(__pyx_t_67 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_12 = 1;
5247 if (unlikely(__pyx_t_12 != -1)) {
5248 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5249 __PYX_ERR(0, 241, __pyx_L1_error)
5253 * gt_assignment[n] = k
5255 * ua = float( # <<<<<<<<<<<<<<
5256 * (boxes[n, 2] - boxes[n, 0] + 1) *
5257 * (boxes[n, 3] - boxes[n, 1] + 1) +
5259 __pyx_v_ua = ((double)((((((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_63, __pyx_pybuffernd_boxes.diminfo[1].strides))) + 1.0) * (((*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_boxes.diminfo[1].strides))) + 1.0)) + __pyx_v_box_area) - (__pyx_v_iw * __pyx_v_ih)));
5262 * box_area - iw * ih
5264 * overlap = iw * ih / ua # <<<<<<<<<<<<<<
5265 * if overlap > max_overlaps[n]:
5266 * max_overlaps[n] = overlap
5268 __pyx_t_26 = (__pyx_v_iw * __pyx_v_ih);
5269 if (unlikely(__pyx_v_ua == 0)) {
5270 PyErr_SetString(PyExc_ZeroDivisionError, "float division");
5271 __PYX_ERR(0, 244, __pyx_L1_error)
5273 __pyx_t_1 = PyFloat_FromDouble((__pyx_t_26 / __pyx_v_ua)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
5274 __Pyx_GOTREF(__pyx_t_1);
5275 __Pyx_XDECREF_SET(__pyx_v_overlap, __pyx_t_1);
5280 * overlap = iw * ih / ua
5281 * if overlap > max_overlaps[n]: # <<<<<<<<<<<<<<
5282 * max_overlaps[n] = overlap
5283 * gt_assignment[n] = k
5285 __pyx_t_68 = __pyx_v_n;
5287 if (unlikely(__pyx_t_68 >= (size_t)__pyx_pybuffernd_max_overlaps.diminfo[0].shape)) __pyx_t_12 = 0;
5288 if (unlikely(__pyx_t_12 != -1)) {
5289 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5290 __PYX_ERR(0, 245, __pyx_L1_error)
5292 __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_max_overlaps.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_max_overlaps.diminfo[0].strides))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error)
5293 __Pyx_GOTREF(__pyx_t_1);
5294 __pyx_t_2 = PyObject_RichCompare(__pyx_v_overlap, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error)
5295 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5296 __pyx_t_33 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_33 < 0)) __PYX_ERR(0, 245, __pyx_L1_error)
5297 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5301 * overlap = iw * ih / ua
5302 * if overlap > max_overlaps[n]:
5303 * max_overlaps[n] = overlap # <<<<<<<<<<<<<<
5304 * gt_assignment[n] = k
5305 * #overlaps[n, k] = overlap
5307 __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_v_overlap); if (unlikely((__pyx_t_26 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 246, __pyx_L1_error)
5308 __pyx_t_69 = __pyx_v_n;
5310 if (unlikely(__pyx_t_69 >= (size_t)__pyx_pybuffernd_max_overlaps.diminfo[0].shape)) __pyx_t_12 = 0;
5311 if (unlikely(__pyx_t_12 != -1)) {
5312 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5313 __PYX_ERR(0, 246, __pyx_L1_error)
5315 *__Pyx_BufPtrStrided1d(__pyx_t_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_max_overlaps.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_max_overlaps.diminfo[0].strides) = __pyx_t_26;
5318 * if overlap > max_overlaps[n]:
5319 * max_overlaps[n] = overlap
5320 * gt_assignment[n] = k # <<<<<<<<<<<<<<
5321 * #overlaps[n, k] = overlap
5322 * return gt_assignment, max_overlaps
5324 __pyx_t_70 = __pyx_v_n;
5326 if (unlikely(__pyx_t_70 >= (size_t)__pyx_pybuffernd_gt_assignment.diminfo[0].shape)) __pyx_t_12 = 0;
5327 if (unlikely(__pyx_t_12 != -1)) {
5328 __Pyx_RaiseBufferIndexError(__pyx_t_12);
5329 __PYX_ERR(0, 247, __pyx_L1_error)
5331 *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_gt_assignment.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_gt_assignment.diminfo[0].strides) = __pyx_v_k;
5335 * overlap = iw * ih / ua
5336 * if overlap > max_overlaps[n]: # <<<<<<<<<<<<<<
5337 * max_overlaps[n] = overlap
5338 * gt_assignment[n] = k
5345 * max(boxes[n, 1], query_boxes[k, 1]) + 1
5347 * if ih > 0: # <<<<<<<<<<<<<<
5348 * if query_boxes[k, 4] == -1:
5349 * ua = float((boxes[n, 2] - boxes[n, 0] + 1)
5354 * max(boxes[n, 0], query_boxes[k, 0]) + 1
5356 * if iw > 0: # <<<<<<<<<<<<<<
5358 * min(boxes[n, 3], query_boxes[k, 3]) -
5365 * gt_assignment[n] = k
5366 * #overlaps[n, k] = overlap
5367 * return gt_assignment, max_overlaps # <<<<<<<<<<<<<<
5369 __Pyx_XDECREF(__pyx_r);
5370 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error)
5371 __Pyx_GOTREF(__pyx_t_2);
5372 __Pyx_INCREF(((PyObject *)__pyx_v_gt_assignment));
5373 __Pyx_GIVEREF(((PyObject *)__pyx_v_gt_assignment));
5374 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_gt_assignment));
5375 __Pyx_INCREF(((PyObject *)__pyx_v_max_overlaps));
5376 __Pyx_GIVEREF(((PyObject *)__pyx_v_max_overlaps));
5377 PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_max_overlaps));
5378 __pyx_r = __pyx_t_2;
5385 * def get_assignment_overlaps( # <<<<<<<<<<<<<<
5386 * np.ndarray[DTYPE_t, ndim=2] boxes,
5387 * np.ndarray[DTYPE_t, ndim=2] query_boxes,
5390 /* function exit code */
5392 __Pyx_XDECREF(__pyx_t_1);
5393 __Pyx_XDECREF(__pyx_t_2);
5394 __Pyx_XDECREF(__pyx_t_3);
5395 __Pyx_XDECREF(__pyx_t_4);
5396 __Pyx_XDECREF(__pyx_t_5);
5397 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5398 __Pyx_PyThreadState_declare
5399 __Pyx_PyThreadState_assign
5400 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5401 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
5402 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gt_assignment.rcbuffer->pybuffer);
5403 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_overlaps.rcbuffer->pybuffer);
5404 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
5405 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5406 __Pyx_AddTraceback("cython_bbox.get_assignment_overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
5410 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
5411 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gt_assignment.rcbuffer->pybuffer);
5412 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_overlaps.rcbuffer->pybuffer);
5413 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
5415 __Pyx_XDECREF((PyObject *)__pyx_v_gt_assignment);
5416 __Pyx_XDECREF((PyObject *)__pyx_v_max_overlaps);
5417 __Pyx_XDECREF(__pyx_v_overlap);
5418 __Pyx_XGIVEREF(__pyx_r);
5419 __Pyx_RefNannyFinishContext();
5423 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197
5424 * # experimental exception made for __getbuffer__ and __releasebuffer__
5425 * # -- the details of this may change.
5426 * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
5427 * # This implementation of getbuffer is geared towards Cython
5428 * # requirements, and does not yet fullfill the PEP.
5431 /* Python wrapper */
5432 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
5433 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
5435 __Pyx_RefNannyDeclarations
5436 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
5437 __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
5439 /* function exit code */
5440 __Pyx_RefNannyFinishContext();
5444 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
5445 int __pyx_v_copy_shape;
5448 int __pyx_v_endian_detector;
5449 int __pyx_v_little_endian;
5452 PyArray_Descr *__pyx_v_descr = 0;
5454 int __pyx_v_hasfields;
5456 __Pyx_RefNannyDeclarations
5459 PyObject *__pyx_t_3 = NULL;
5462 PyObject *__pyx_t_6 = NULL;
5464 __Pyx_RefNannySetupContext("__getbuffer__", 0);
5465 if (__pyx_v_info != NULL) {
5466 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
5467 __Pyx_GIVEREF(__pyx_v_info->obj);
5470 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":203
5473 * if info == NULL: return # <<<<<<<<<<<<<<
5475 * cdef int copy_shape, i, ndim
5477 __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
5483 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":206
5485 * cdef int copy_shape, i, ndim
5486 * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
5487 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
5490 __pyx_v_endian_detector = 1;
5492 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":207
5493 * cdef int copy_shape, i, ndim
5494 * cdef int endian_detector = 1
5495 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
5497 * ndim = PyArray_NDIM(self)
5499 __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
5501 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":209
5502 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
5504 * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
5506 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
5508 __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
5510 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
5511 * ndim = PyArray_NDIM(self)
5513 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
5517 __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
5520 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":212
5522 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
5523 * copy_shape = 1 # <<<<<<<<<<<<<<
5527 __pyx_v_copy_shape = 1;
5529 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
5530 * ndim = PyArray_NDIM(self)
5532 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
5539 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":214
5542 * copy_shape = 0 # <<<<<<<<<<<<<<
5544 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
5547 __pyx_v_copy_shape = 0;
5551 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
5554 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
5555 * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
5556 * raise ValueError(u"ndarray is not C contiguous")
5558 __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
5561 __pyx_t_1 = __pyx_t_2;
5562 goto __pyx_L6_bool_binop_done;
5565 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":217
5567 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
5568 * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
5569 * raise ValueError(u"ndarray is not C contiguous")
5572 __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
5573 __pyx_t_1 = __pyx_t_2;
5574 __pyx_L6_bool_binop_done:;
5576 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
5579 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
5580 * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
5581 * raise ValueError(u"ndarray is not C contiguous")
5585 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218
5586 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
5587 * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
5588 * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
5590 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
5592 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __pyx_L1_error)
5593 __Pyx_GOTREF(__pyx_t_3);
5594 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5595 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5596 __PYX_ERR(1, 218, __pyx_L1_error)
5598 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
5601 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
5602 * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
5603 * raise ValueError(u"ndarray is not C contiguous")
5607 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
5608 * raise ValueError(u"ndarray is not C contiguous")
5610 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
5611 * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
5612 * raise ValueError(u"ndarray is not Fortran contiguous")
5614 __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
5617 __pyx_t_1 = __pyx_t_2;
5618 goto __pyx_L9_bool_binop_done;
5621 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":221
5623 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
5624 * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
5625 * raise ValueError(u"ndarray is not Fortran contiguous")
5628 __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
5629 __pyx_t_1 = __pyx_t_2;
5630 __pyx_L9_bool_binop_done:;
5632 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
5633 * raise ValueError(u"ndarray is not C contiguous")
5635 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
5636 * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
5637 * raise ValueError(u"ndarray is not Fortran contiguous")
5641 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
5642 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
5643 * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
5644 * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
5646 * info.buf = PyArray_DATA(self)
5648 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 222, __pyx_L1_error)
5649 __Pyx_GOTREF(__pyx_t_3);
5650 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5651 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5652 __PYX_ERR(1, 222, __pyx_L1_error)
5654 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
5655 * raise ValueError(u"ndarray is not C contiguous")
5657 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
5658 * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
5659 * raise ValueError(u"ndarray is not Fortran contiguous")
5663 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":224
5664 * raise ValueError(u"ndarray is not Fortran contiguous")
5666 * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
5670 __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
5672 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":225
5674 * info.buf = PyArray_DATA(self)
5675 * info.ndim = ndim # <<<<<<<<<<<<<<
5677 * # Allocate new buffer for strides and shape info.
5679 __pyx_v_info->ndim = __pyx_v_ndim;
5681 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
5682 * info.buf = PyArray_DATA(self)
5684 * if copy_shape: # <<<<<<<<<<<<<<
5685 * # Allocate new buffer for strides and shape info.
5686 * # This is allocated as one block, strides first.
5688 __pyx_t_1 = (__pyx_v_copy_shape != 0);
5691 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229
5692 * # Allocate new buffer for strides and shape info.
5693 * # This is allocated as one block, strides first.
5694 * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2) # <<<<<<<<<<<<<<
5695 * info.shape = info.strides + ndim
5696 * for i in range(ndim):
5698 __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
5700 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":230
5701 * # This is allocated as one block, strides first.
5702 * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
5703 * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
5704 * for i in range(ndim):
5705 * info.strides[i] = PyArray_STRIDES(self)[i]
5707 __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
5709 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231
5710 * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
5711 * info.shape = info.strides + ndim
5712 * for i in range(ndim): # <<<<<<<<<<<<<<
5713 * info.strides[i] = PyArray_STRIDES(self)[i]
5714 * info.shape[i] = PyArray_DIMS(self)[i]
5716 __pyx_t_4 = __pyx_v_ndim;
5717 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
5718 __pyx_v_i = __pyx_t_5;
5720 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":232
5721 * info.shape = info.strides + ndim
5722 * for i in range(ndim):
5723 * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
5724 * info.shape[i] = PyArray_DIMS(self)[i]
5727 (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
5729 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233
5730 * for i in range(ndim):
5731 * info.strides[i] = PyArray_STRIDES(self)[i]
5732 * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
5734 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
5736 (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
5739 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
5740 * info.buf = PyArray_DATA(self)
5742 * if copy_shape: # <<<<<<<<<<<<<<
5743 * # Allocate new buffer for strides and shape info.
5744 * # This is allocated as one block, strides first.
5749 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235
5750 * info.shape[i] = PyArray_DIMS(self)[i]
5752 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
5753 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
5754 * info.suboffsets = NULL
5757 __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
5759 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":236
5761 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
5762 * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
5763 * info.suboffsets = NULL
5764 * info.itemsize = PyArray_ITEMSIZE(self)
5766 __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
5770 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237
5771 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
5772 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
5773 * info.suboffsets = NULL # <<<<<<<<<<<<<<
5774 * info.itemsize = PyArray_ITEMSIZE(self)
5775 * info.readonly = not PyArray_ISWRITEABLE(self)
5777 __pyx_v_info->suboffsets = NULL;
5779 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":238
5780 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
5781 * info.suboffsets = NULL
5782 * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
5783 * info.readonly = not PyArray_ISWRITEABLE(self)
5786 __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
5788 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":239
5789 * info.suboffsets = NULL
5790 * info.itemsize = PyArray_ITEMSIZE(self)
5791 * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
5795 __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
5797 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242
5800 * cdef char* f = NULL # <<<<<<<<<<<<<<
5801 * cdef dtype descr = self.descr
5806 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243
5808 * cdef char* f = NULL
5809 * cdef dtype descr = self.descr # <<<<<<<<<<<<<<
5813 __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
5814 __Pyx_INCREF(__pyx_t_3);
5815 __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
5818 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":246
5821 * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<<
5823 * if not hasfields and not copy_shape:
5825 __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
5827 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
5828 * cdef bint hasfields = PyDataType_HASFIELDS(descr)
5830 * if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
5831 * # do not call releasebuffer
5834 __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
5837 __pyx_t_1 = __pyx_t_2;
5838 goto __pyx_L15_bool_binop_done;
5840 __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
5841 __pyx_t_1 = __pyx_t_2;
5842 __pyx_L15_bool_binop_done:;
5845 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":250
5846 * if not hasfields and not copy_shape:
5847 * # do not call releasebuffer
5848 * info.obj = None # <<<<<<<<<<<<<<
5850 * # need to call releasebuffer
5852 __Pyx_INCREF(Py_None);
5853 __Pyx_GIVEREF(Py_None);
5854 __Pyx_GOTREF(__pyx_v_info->obj);
5855 __Pyx_DECREF(__pyx_v_info->obj);
5856 __pyx_v_info->obj = Py_None;
5858 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
5859 * cdef bint hasfields = PyDataType_HASFIELDS(descr)
5861 * if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
5862 * # do not call releasebuffer
5868 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":253
5870 * # need to call releasebuffer
5871 * info.obj = self # <<<<<<<<<<<<<<
5876 __Pyx_INCREF(((PyObject *)__pyx_v_self));
5877 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
5878 __Pyx_GOTREF(__pyx_v_info->obj);
5879 __Pyx_DECREF(__pyx_v_info->obj);
5880 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
5884 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
5887 * if not hasfields: # <<<<<<<<<<<<<<
5888 * t = descr.type_num
5889 * if ((descr.byteorder == c'>' and little_endian) or
5891 __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
5894 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":256
5897 * t = descr.type_num # <<<<<<<<<<<<<<
5898 * if ((descr.byteorder == c'>' and little_endian) or
5899 * (descr.byteorder == c'<' and not little_endian)):
5901 __pyx_t_4 = __pyx_v_descr->type_num;
5902 __pyx_v_t = __pyx_t_4;
5904 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
5906 * t = descr.type_num
5907 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
5908 * (descr.byteorder == c'<' and not little_endian)):
5909 * raise ValueError(u"Non-native byte order not supported")
5911 __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
5913 goto __pyx_L20_next_or;
5916 __pyx_t_2 = (__pyx_v_little_endian != 0);
5919 __pyx_t_1 = __pyx_t_2;
5920 goto __pyx_L19_bool_binop_done;
5924 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
5925 * t = descr.type_num
5926 * if ((descr.byteorder == c'>' and little_endian) or
5927 * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
5928 * raise ValueError(u"Non-native byte order not supported")
5929 * if t == NPY_BYTE: f = "b"
5931 __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
5934 __pyx_t_1 = __pyx_t_2;
5935 goto __pyx_L19_bool_binop_done;
5937 __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
5938 __pyx_t_1 = __pyx_t_2;
5939 __pyx_L19_bool_binop_done:;
5941 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
5943 * t = descr.type_num
5944 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
5945 * (descr.byteorder == c'<' and not little_endian)):
5946 * raise ValueError(u"Non-native byte order not supported")
5950 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
5951 * if ((descr.byteorder == c'>' and little_endian) or
5952 * (descr.byteorder == c'<' and not little_endian)):
5953 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
5954 * if t == NPY_BYTE: f = "b"
5955 * elif t == NPY_UBYTE: f = "B"
5957 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 259, __pyx_L1_error)
5958 __Pyx_GOTREF(__pyx_t_3);
5959 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5960 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5961 __PYX_ERR(1, 259, __pyx_L1_error)
5963 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
5965 * t = descr.type_num
5966 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
5967 * (descr.byteorder == c'<' and not little_endian)):
5968 * raise ValueError(u"Non-native byte order not supported")
5972 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":260
5973 * (descr.byteorder == c'<' and not little_endian)):
5974 * raise ValueError(u"Non-native byte order not supported")
5975 * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
5976 * elif t == NPY_UBYTE: f = "B"
5977 * elif t == NPY_SHORT: f = "h"
5979 switch (__pyx_v_t) {
5981 __pyx_v_f = ((char *)"b");
5984 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261
5985 * raise ValueError(u"Non-native byte order not supported")
5986 * if t == NPY_BYTE: f = "b"
5987 * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
5988 * elif t == NPY_SHORT: f = "h"
5989 * elif t == NPY_USHORT: f = "H"
5992 __pyx_v_f = ((char *)"B");
5995 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":262
5996 * if t == NPY_BYTE: f = "b"
5997 * elif t == NPY_UBYTE: f = "B"
5998 * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
5999 * elif t == NPY_USHORT: f = "H"
6000 * elif t == NPY_INT: f = "i"
6003 __pyx_v_f = ((char *)"h");
6006 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263
6007 * elif t == NPY_UBYTE: f = "B"
6008 * elif t == NPY_SHORT: f = "h"
6009 * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
6010 * elif t == NPY_INT: f = "i"
6011 * elif t == NPY_UINT: f = "I"
6014 __pyx_v_f = ((char *)"H");
6017 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":264
6018 * elif t == NPY_SHORT: f = "h"
6019 * elif t == NPY_USHORT: f = "H"
6020 * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
6021 * elif t == NPY_UINT: f = "I"
6022 * elif t == NPY_LONG: f = "l"
6025 __pyx_v_f = ((char *)"i");
6028 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
6029 * elif t == NPY_USHORT: f = "H"
6030 * elif t == NPY_INT: f = "i"
6031 * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
6032 * elif t == NPY_LONG: f = "l"
6033 * elif t == NPY_ULONG: f = "L"
6036 __pyx_v_f = ((char *)"I");
6039 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
6040 * elif t == NPY_INT: f = "i"
6041 * elif t == NPY_UINT: f = "I"
6042 * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
6043 * elif t == NPY_ULONG: f = "L"
6044 * elif t == NPY_LONGLONG: f = "q"
6047 __pyx_v_f = ((char *)"l");
6050 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":267
6051 * elif t == NPY_UINT: f = "I"
6052 * elif t == NPY_LONG: f = "l"
6053 * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
6054 * elif t == NPY_LONGLONG: f = "q"
6055 * elif t == NPY_ULONGLONG: f = "Q"
6058 __pyx_v_f = ((char *)"L");
6061 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
6062 * elif t == NPY_LONG: f = "l"
6063 * elif t == NPY_ULONG: f = "L"
6064 * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
6065 * elif t == NPY_ULONGLONG: f = "Q"
6066 * elif t == NPY_FLOAT: f = "f"
6069 __pyx_v_f = ((char *)"q");
6072 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":269
6073 * elif t == NPY_ULONG: f = "L"
6074 * elif t == NPY_LONGLONG: f = "q"
6075 * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
6076 * elif t == NPY_FLOAT: f = "f"
6077 * elif t == NPY_DOUBLE: f = "d"
6080 __pyx_v_f = ((char *)"Q");
6083 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
6084 * elif t == NPY_LONGLONG: f = "q"
6085 * elif t == NPY_ULONGLONG: f = "Q"
6086 * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
6087 * elif t == NPY_DOUBLE: f = "d"
6088 * elif t == NPY_LONGDOUBLE: f = "g"
6091 __pyx_v_f = ((char *)"f");
6094 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
6095 * elif t == NPY_ULONGLONG: f = "Q"
6096 * elif t == NPY_FLOAT: f = "f"
6097 * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
6098 * elif t == NPY_LONGDOUBLE: f = "g"
6099 * elif t == NPY_CFLOAT: f = "Zf"
6102 __pyx_v_f = ((char *)"d");
6105 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
6106 * elif t == NPY_FLOAT: f = "f"
6107 * elif t == NPY_DOUBLE: f = "d"
6108 * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
6109 * elif t == NPY_CFLOAT: f = "Zf"
6110 * elif t == NPY_CDOUBLE: f = "Zd"
6112 case NPY_LONGDOUBLE:
6113 __pyx_v_f = ((char *)"g");
6116 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":273
6117 * elif t == NPY_DOUBLE: f = "d"
6118 * elif t == NPY_LONGDOUBLE: f = "g"
6119 * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
6120 * elif t == NPY_CDOUBLE: f = "Zd"
6121 * elif t == NPY_CLONGDOUBLE: f = "Zg"
6124 __pyx_v_f = ((char *)"Zf");
6127 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
6128 * elif t == NPY_LONGDOUBLE: f = "g"
6129 * elif t == NPY_CFLOAT: f = "Zf"
6130 * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
6131 * elif t == NPY_CLONGDOUBLE: f = "Zg"
6132 * elif t == NPY_OBJECT: f = "O"
6135 __pyx_v_f = ((char *)"Zd");
6138 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
6139 * elif t == NPY_CFLOAT: f = "Zf"
6140 * elif t == NPY_CDOUBLE: f = "Zd"
6141 * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
6142 * elif t == NPY_OBJECT: f = "O"
6145 case NPY_CLONGDOUBLE:
6146 __pyx_v_f = ((char *)"Zg");
6149 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
6150 * elif t == NPY_CDOUBLE: f = "Zd"
6151 * elif t == NPY_CLONGDOUBLE: f = "Zg"
6152 * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
6154 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6157 __pyx_v_f = ((char *)"O");
6161 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
6162 * elif t == NPY_OBJECT: f = "O"
6164 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
6168 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error)
6169 __Pyx_GOTREF(__pyx_t_3);
6170 __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error)
6171 __Pyx_GOTREF(__pyx_t_6);
6172 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6173 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error)
6174 __Pyx_GOTREF(__pyx_t_3);
6175 __Pyx_GIVEREF(__pyx_t_6);
6176 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
6178 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error)
6179 __Pyx_GOTREF(__pyx_t_6);
6180 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6181 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
6182 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6183 __PYX_ERR(1, 278, __pyx_L1_error)
6187 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
6189 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6190 * info.format = f # <<<<<<<<<<<<<<
6194 __pyx_v_info->format = __pyx_v_f;
6196 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
6197 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6199 * return # <<<<<<<<<<<<<<
6201 * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
6206 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
6209 * if not hasfields: # <<<<<<<<<<<<<<
6210 * t = descr.type_num
6211 * if ((descr.byteorder == c'>' and little_endian) or
6215 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":282
6218 * info.format = <char*>stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
6219 * info.format[0] = c'^' # Native data types, manual alignment
6223 __pyx_v_info->format = ((char *)malloc(0xFF));
6225 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
6227 * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
6228 * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
6230 * f = _util_dtypestring(descr, info.format + 1,
6232 (__pyx_v_info->format[0]) = '^';
6234 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":284
6235 * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
6236 * info.format[0] = c'^' # Native data types, manual alignment
6237 * offset = 0 # <<<<<<<<<<<<<<
6238 * f = _util_dtypestring(descr, info.format + 1,
6239 * info.format + _buffer_format_string_len,
6243 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
6244 * info.format[0] = c'^' # Native data types, manual alignment
6246 * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
6247 * info.format + _buffer_format_string_len,
6250 __pyx_t_7 = __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_7 == NULL)) __PYX_ERR(1, 285, __pyx_L1_error)
6251 __pyx_v_f = __pyx_t_7;
6253 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":288
6254 * info.format + _buffer_format_string_len,
6256 * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
6258 * def __releasebuffer__(ndarray self, Py_buffer* info):
6260 (__pyx_v_f[0]) = '\x00';
6263 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197
6264 * # experimental exception made for __getbuffer__ and __releasebuffer__
6265 * # -- the details of this may change.
6266 * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
6267 * # This implementation of getbuffer is geared towards Cython
6268 * # requirements, and does not yet fullfill the PEP.
6271 /* function exit code */
6275 __Pyx_XDECREF(__pyx_t_3);
6276 __Pyx_XDECREF(__pyx_t_6);
6277 __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6279 if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
6280 __Pyx_GOTREF(__pyx_v_info->obj);
6281 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
6285 if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
6286 __Pyx_GOTREF(Py_None);
6287 __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
6290 __Pyx_XDECREF((PyObject *)__pyx_v_descr);
6291 __Pyx_RefNannyFinishContext();
6295 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
6296 * f[0] = c'\0' # Terminate format string
6298 * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
6299 * if PyArray_HASFIELDS(self):
6300 * stdlib.free(info.format)
6303 /* Python wrapper */
6304 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
6305 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
6306 __Pyx_RefNannyDeclarations
6307 __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
6308 __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
6310 /* function exit code */
6311 __Pyx_RefNannyFinishContext();
6314 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
6315 __Pyx_RefNannyDeclarations
6317 __Pyx_RefNannySetupContext("__releasebuffer__", 0);
6319 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
6321 * def __releasebuffer__(ndarray self, Py_buffer* info):
6322 * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
6323 * stdlib.free(info.format)
6324 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
6326 __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
6329 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
6330 * def __releasebuffer__(ndarray self, Py_buffer* info):
6331 * if PyArray_HASFIELDS(self):
6332 * stdlib.free(info.format) # <<<<<<<<<<<<<<
6333 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
6334 * stdlib.free(info.strides)
6336 free(__pyx_v_info->format);
6338 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
6340 * def __releasebuffer__(ndarray self, Py_buffer* info):
6341 * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
6342 * stdlib.free(info.format)
6343 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
6347 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
6348 * if PyArray_HASFIELDS(self):
6349 * stdlib.free(info.format)
6350 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
6351 * stdlib.free(info.strides)
6352 * # info.shape was stored after info.strides in the same block
6354 __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
6357 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294
6358 * stdlib.free(info.format)
6359 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
6360 * stdlib.free(info.strides) # <<<<<<<<<<<<<<
6361 * # info.shape was stored after info.strides in the same block
6364 free(__pyx_v_info->strides);
6366 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
6367 * if PyArray_HASFIELDS(self):
6368 * stdlib.free(info.format)
6369 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
6370 * stdlib.free(info.strides)
6371 * # info.shape was stored after info.strides in the same block
6375 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
6376 * f[0] = c'\0' # Terminate format string
6378 * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
6379 * if PyArray_HASFIELDS(self):
6380 * stdlib.free(info.format)
6383 /* function exit code */
6384 __Pyx_RefNannyFinishContext();
6387 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
6388 * ctypedef npy_cdouble complex_t
6390 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
6391 * return PyArray_MultiIterNew(1, <void*>a)
6395 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
6396 PyObject *__pyx_r = NULL;
6397 __Pyx_RefNannyDeclarations
6398 PyObject *__pyx_t_1 = NULL;
6399 __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
6401 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771
6403 * cdef inline object PyArray_MultiIterNew1(a):
6404 * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
6406 * cdef inline object PyArray_MultiIterNew2(a, b):
6408 __Pyx_XDECREF(__pyx_r);
6409 __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 771, __pyx_L1_error)
6410 __Pyx_GOTREF(__pyx_t_1);
6411 __pyx_r = __pyx_t_1;
6415 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
6416 * ctypedef npy_cdouble complex_t
6418 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
6419 * return PyArray_MultiIterNew(1, <void*>a)
6423 /* function exit code */
6425 __Pyx_XDECREF(__pyx_t_1);
6426 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
6429 __Pyx_XGIVEREF(__pyx_r);
6430 __Pyx_RefNannyFinishContext();
6434 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
6435 * return PyArray_MultiIterNew(1, <void*>a)
6437 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
6438 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6442 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
6443 PyObject *__pyx_r = NULL;
6444 __Pyx_RefNannyDeclarations
6445 PyObject *__pyx_t_1 = NULL;
6446 __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
6448 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":774
6450 * cdef inline object PyArray_MultiIterNew2(a, b):
6451 * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
6453 * cdef inline object PyArray_MultiIterNew3(a, b, c):
6455 __Pyx_XDECREF(__pyx_r);
6456 __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 774, __pyx_L1_error)
6457 __Pyx_GOTREF(__pyx_t_1);
6458 __pyx_r = __pyx_t_1;
6462 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
6463 * return PyArray_MultiIterNew(1, <void*>a)
6465 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
6466 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6470 /* function exit code */
6472 __Pyx_XDECREF(__pyx_t_1);
6473 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
6476 __Pyx_XGIVEREF(__pyx_r);
6477 __Pyx_RefNannyFinishContext();
6481 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
6482 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6484 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
6485 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6489 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
6490 PyObject *__pyx_r = NULL;
6491 __Pyx_RefNannyDeclarations
6492 PyObject *__pyx_t_1 = NULL;
6493 __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
6495 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
6497 * cdef inline object PyArray_MultiIterNew3(a, b, c):
6498 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
6500 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6502 __Pyx_XDECREF(__pyx_r);
6503 __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, 777, __pyx_L1_error)
6504 __Pyx_GOTREF(__pyx_t_1);
6505 __pyx_r = __pyx_t_1;
6509 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
6510 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6512 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
6513 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6517 /* function exit code */
6519 __Pyx_XDECREF(__pyx_t_1);
6520 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
6523 __Pyx_XGIVEREF(__pyx_r);
6524 __Pyx_RefNannyFinishContext();
6528 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
6529 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6531 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
6532 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6536 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) {
6537 PyObject *__pyx_r = NULL;
6538 __Pyx_RefNannyDeclarations
6539 PyObject *__pyx_t_1 = NULL;
6540 __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
6542 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":780
6544 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6545 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
6547 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6549 __Pyx_XDECREF(__pyx_r);
6550 __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, 780, __pyx_L1_error)
6551 __Pyx_GOTREF(__pyx_t_1);
6552 __pyx_r = __pyx_t_1;
6556 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
6557 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6559 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
6560 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6564 /* function exit code */
6566 __Pyx_XDECREF(__pyx_t_1);
6567 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
6570 __Pyx_XGIVEREF(__pyx_r);
6571 __Pyx_RefNannyFinishContext();
6575 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782
6576 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6578 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
6579 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6583 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) {
6584 PyObject *__pyx_r = NULL;
6585 __Pyx_RefNannyDeclarations
6586 PyObject *__pyx_t_1 = NULL;
6587 __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
6589 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
6591 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6592 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
6594 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
6596 __Pyx_XDECREF(__pyx_r);
6597 __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, 783, __pyx_L1_error)
6598 __Pyx_GOTREF(__pyx_t_1);
6599 __pyx_r = __pyx_t_1;
6603 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782
6604 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6606 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
6607 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6611 /* function exit code */
6613 __Pyx_XDECREF(__pyx_t_1);
6614 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
6617 __Pyx_XGIVEREF(__pyx_r);
6618 __Pyx_RefNannyFinishContext();
6622 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
6623 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6625 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
6626 * # Recursive utility function used in __getbuffer__ to get format
6627 * # string. The new location in the format string is returned.
6630 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) {
6631 PyArray_Descr *__pyx_v_child = 0;
6632 int __pyx_v_endian_detector;
6633 int __pyx_v_little_endian;
6634 PyObject *__pyx_v_fields = 0;
6635 PyObject *__pyx_v_childname = NULL;
6636 PyObject *__pyx_v_new_offset = NULL;
6637 PyObject *__pyx_v_t = NULL;
6639 __Pyx_RefNannyDeclarations
6640 PyObject *__pyx_t_1 = NULL;
6641 Py_ssize_t __pyx_t_2;
6642 PyObject *__pyx_t_3 = NULL;
6643 PyObject *__pyx_t_4 = NULL;
6649 __Pyx_RefNannySetupContext("_util_dtypestring", 0);
6651 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
6654 * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
6655 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
6658 __pyx_v_endian_detector = 1;
6660 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
6662 * cdef int endian_detector = 1
6663 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
6667 __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
6669 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
6672 * for childname in descr.names: # <<<<<<<<<<<<<<
6673 * fields = descr.fields[childname]
6674 * child, new_offset = fields
6676 if (unlikely(__pyx_v_descr->names == Py_None)) {
6677 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
6678 __PYX_ERR(1, 794, __pyx_L1_error)
6680 __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
6682 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
6683 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6684 __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, 794, __pyx_L1_error)
6686 __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 794, __pyx_L1_error)
6687 __Pyx_GOTREF(__pyx_t_3);
6689 __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
6692 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":795
6694 * for childname in descr.names:
6695 * fields = descr.fields[childname] # <<<<<<<<<<<<<<
6696 * child, new_offset = fields
6699 if (unlikely(__pyx_v_descr->fields == Py_None)) {
6700 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6701 __PYX_ERR(1, 795, __pyx_L1_error)
6703 __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 795, __pyx_L1_error)
6704 __Pyx_GOTREF(__pyx_t_3);
6705 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, 795, __pyx_L1_error)
6706 __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
6709 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":796
6710 * for childname in descr.names:
6711 * fields = descr.fields[childname]
6712 * child, new_offset = fields # <<<<<<<<<<<<<<
6714 * if (end - f) - <int>(new_offset - offset[0]) < 15:
6716 if (likely(__pyx_v_fields != Py_None)) {
6717 PyObject* sequence = __pyx_v_fields;
6718 #if !CYTHON_COMPILING_IN_PYPY
6719 Py_ssize_t size = Py_SIZE(sequence);
6721 Py_ssize_t size = PySequence_Size(sequence);
6723 if (unlikely(size != 2)) {
6724 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6725 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6726 __PYX_ERR(1, 796, __pyx_L1_error)
6728 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6729 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
6730 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
6731 __Pyx_INCREF(__pyx_t_3);
6732 __Pyx_INCREF(__pyx_t_4);
6734 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 796, __pyx_L1_error)
6735 __Pyx_GOTREF(__pyx_t_3);
6736 __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 796, __pyx_L1_error)
6737 __Pyx_GOTREF(__pyx_t_4);
6740 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 796, __pyx_L1_error)
6742 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 796, __pyx_L1_error)
6743 __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
6745 __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
6748 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
6749 * child, new_offset = fields
6751 * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
6752 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6755 __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 798, __pyx_L1_error)
6756 __Pyx_GOTREF(__pyx_t_4);
6757 __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 798, __pyx_L1_error)
6758 __Pyx_GOTREF(__pyx_t_3);
6759 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6760 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 798, __pyx_L1_error)
6761 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6762 __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
6765 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
6767 * if (end - f) - <int>(new_offset - offset[0]) < 15:
6768 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
6770 * if ((child.byteorder == c'>' and little_endian) or
6772 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 799, __pyx_L1_error)
6773 __Pyx_GOTREF(__pyx_t_3);
6774 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6775 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6776 __PYX_ERR(1, 799, __pyx_L1_error)
6778 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
6779 * child, new_offset = fields
6781 * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
6782 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6787 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
6788 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6790 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
6791 * (child.byteorder == c'<' and not little_endian)):
6792 * raise ValueError(u"Non-native byte order not supported")
6794 __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
6796 goto __pyx_L8_next_or;
6799 __pyx_t_7 = (__pyx_v_little_endian != 0);
6802 __pyx_t_6 = __pyx_t_7;
6803 goto __pyx_L7_bool_binop_done;
6807 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
6809 * if ((child.byteorder == c'>' and little_endian) or
6810 * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
6811 * raise ValueError(u"Non-native byte order not supported")
6812 * # One could encode it in the format string and have Cython
6814 __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
6817 __pyx_t_6 = __pyx_t_7;
6818 goto __pyx_L7_bool_binop_done;
6820 __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
6821 __pyx_t_6 = __pyx_t_7;
6822 __pyx_L7_bool_binop_done:;
6824 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
6825 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6827 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
6828 * (child.byteorder == c'<' and not little_endian)):
6829 * raise ValueError(u"Non-native byte order not supported")
6833 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":803
6834 * if ((child.byteorder == c'>' and little_endian) or
6835 * (child.byteorder == c'<' and not little_endian)):
6836 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
6837 * # One could encode it in the format string and have Cython
6838 * # complain instead, BUT: < and > in format strings also imply
6840 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 803, __pyx_L1_error)
6841 __Pyx_GOTREF(__pyx_t_3);
6842 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6843 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6844 __PYX_ERR(1, 803, __pyx_L1_error)
6846 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
6847 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6849 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
6850 * (child.byteorder == c'<' and not little_endian)):
6851 * raise ValueError(u"Non-native byte order not supported")
6855 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
6857 * # Output padding bytes
6858 * while offset[0] < new_offset: # <<<<<<<<<<<<<<
6859 * f[0] = 120 # "x"; pad byte
6863 __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 813, __pyx_L1_error)
6864 __Pyx_GOTREF(__pyx_t_3);
6865 __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, 813, __pyx_L1_error)
6866 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6867 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 813, __pyx_L1_error)
6868 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6869 if (!__pyx_t_6) break;
6871 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":814
6872 * # Output padding bytes
6873 * while offset[0] < new_offset:
6874 * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
6878 (__pyx_v_f[0]) = 0x78;
6880 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":815
6881 * while offset[0] < new_offset:
6882 * f[0] = 120 # "x"; pad byte
6883 * f += 1 # <<<<<<<<<<<<<<
6887 __pyx_v_f = (__pyx_v_f + 1);
6889 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
6890 * f[0] = 120 # "x"; pad byte
6892 * offset[0] += 1 # <<<<<<<<<<<<<<
6894 * offset[0] += child.itemsize
6897 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
6900 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":818
6903 * offset[0] += child.itemsize # <<<<<<<<<<<<<<
6905 * if not PyDataType_HASFIELDS(child):
6908 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
6910 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
6911 * offset[0] += child.itemsize
6913 * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
6914 * t = child.type_num
6917 __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
6920 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
6922 * if not PyDataType_HASFIELDS(child):
6923 * t = child.type_num # <<<<<<<<<<<<<<
6925 * raise RuntimeError(u"Format string allocated too short.")
6927 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 821, __pyx_L1_error)
6928 __Pyx_GOTREF(__pyx_t_4);
6929 __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
6932 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
6933 * if not PyDataType_HASFIELDS(child):
6934 * t = child.type_num
6935 * if end - f < 5: # <<<<<<<<<<<<<<
6936 * raise RuntimeError(u"Format string allocated too short.")
6939 __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
6942 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
6943 * t = child.type_num
6945 * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
6947 * # Until ticket #99 is fixed, use integers to avoid warnings
6949 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 823, __pyx_L1_error)
6950 __Pyx_GOTREF(__pyx_t_4);
6951 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6952 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6953 __PYX_ERR(1, 823, __pyx_L1_error)
6955 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
6956 * if not PyDataType_HASFIELDS(child):
6957 * t = child.type_num
6958 * if end - f < 5: # <<<<<<<<<<<<<<
6959 * raise RuntimeError(u"Format string allocated too short.")
6964 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826
6966 * # Until ticket #99 is fixed, use integers to avoid warnings
6967 * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
6968 * elif t == NPY_UBYTE: f[0] = 66 #"B"
6969 * elif t == NPY_SHORT: f[0] = 104 #"h"
6971 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 826, __pyx_L1_error)
6972 __Pyx_GOTREF(__pyx_t_4);
6973 __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, 826, __pyx_L1_error)
6974 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6975 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 826, __pyx_L1_error)
6976 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6978 (__pyx_v_f[0]) = 98;
6982 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
6983 * # Until ticket #99 is fixed, use integers to avoid warnings
6984 * if t == NPY_BYTE: f[0] = 98 #"b"
6985 * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
6986 * elif t == NPY_SHORT: f[0] = 104 #"h"
6987 * elif t == NPY_USHORT: f[0] = 72 #"H"
6989 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 827, __pyx_L1_error)
6990 __Pyx_GOTREF(__pyx_t_3);
6991 __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, 827, __pyx_L1_error)
6992 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6993 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 827, __pyx_L1_error)
6994 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6996 (__pyx_v_f[0]) = 66;
7000 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":828
7001 * if t == NPY_BYTE: f[0] = 98 #"b"
7002 * elif t == NPY_UBYTE: f[0] = 66 #"B"
7003 * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
7004 * elif t == NPY_USHORT: f[0] = 72 #"H"
7005 * elif t == NPY_INT: f[0] = 105 #"i"
7007 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 828, __pyx_L1_error)
7008 __Pyx_GOTREF(__pyx_t_4);
7009 __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, 828, __pyx_L1_error)
7010 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7011 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 828, __pyx_L1_error)
7012 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7014 (__pyx_v_f[0]) = 0x68;
7018 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":829
7019 * elif t == NPY_UBYTE: f[0] = 66 #"B"
7020 * elif t == NPY_SHORT: f[0] = 104 #"h"
7021 * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
7022 * elif t == NPY_INT: f[0] = 105 #"i"
7023 * elif t == NPY_UINT: f[0] = 73 #"I"
7025 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 829, __pyx_L1_error)
7026 __Pyx_GOTREF(__pyx_t_3);
7027 __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, 829, __pyx_L1_error)
7028 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7029 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 829, __pyx_L1_error)
7030 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7032 (__pyx_v_f[0]) = 72;
7036 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
7037 * elif t == NPY_SHORT: f[0] = 104 #"h"
7038 * elif t == NPY_USHORT: f[0] = 72 #"H"
7039 * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
7040 * elif t == NPY_UINT: f[0] = 73 #"I"
7041 * elif t == NPY_LONG: f[0] = 108 #"l"
7043 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 830, __pyx_L1_error)
7044 __Pyx_GOTREF(__pyx_t_4);
7045 __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, 830, __pyx_L1_error)
7046 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7047 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 830, __pyx_L1_error)
7048 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7050 (__pyx_v_f[0]) = 0x69;
7054 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
7055 * elif t == NPY_USHORT: f[0] = 72 #"H"
7056 * elif t == NPY_INT: f[0] = 105 #"i"
7057 * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
7058 * elif t == NPY_LONG: f[0] = 108 #"l"
7059 * elif t == NPY_ULONG: f[0] = 76 #"L"
7061 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 831, __pyx_L1_error)
7062 __Pyx_GOTREF(__pyx_t_3);
7063 __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, 831, __pyx_L1_error)
7064 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7065 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 831, __pyx_L1_error)
7066 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7068 (__pyx_v_f[0]) = 73;
7072 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":832
7073 * elif t == NPY_INT: f[0] = 105 #"i"
7074 * elif t == NPY_UINT: f[0] = 73 #"I"
7075 * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
7076 * elif t == NPY_ULONG: f[0] = 76 #"L"
7077 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
7079 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error)
7080 __Pyx_GOTREF(__pyx_t_4);
7081 __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, 832, __pyx_L1_error)
7082 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7083 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 832, __pyx_L1_error)
7084 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7086 (__pyx_v_f[0]) = 0x6C;
7090 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
7091 * elif t == NPY_UINT: f[0] = 73 #"I"
7092 * elif t == NPY_LONG: f[0] = 108 #"l"
7093 * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
7094 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
7095 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
7097 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 833, __pyx_L1_error)
7098 __Pyx_GOTREF(__pyx_t_3);
7099 __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, 833, __pyx_L1_error)
7100 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7101 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 833, __pyx_L1_error)
7102 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7104 (__pyx_v_f[0]) = 76;
7108 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
7109 * elif t == NPY_LONG: f[0] = 108 #"l"
7110 * elif t == NPY_ULONG: f[0] = 76 #"L"
7111 * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
7112 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
7113 * elif t == NPY_FLOAT: f[0] = 102 #"f"
7115 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error)
7116 __Pyx_GOTREF(__pyx_t_4);
7117 __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, 834, __pyx_L1_error)
7118 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7119 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 834, __pyx_L1_error)
7120 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7122 (__pyx_v_f[0]) = 0x71;
7126 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":835
7127 * elif t == NPY_ULONG: f[0] = 76 #"L"
7128 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
7129 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
7130 * elif t == NPY_FLOAT: f[0] = 102 #"f"
7131 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
7133 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 835, __pyx_L1_error)
7134 __Pyx_GOTREF(__pyx_t_3);
7135 __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, 835, __pyx_L1_error)
7136 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7137 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 835, __pyx_L1_error)
7138 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7140 (__pyx_v_f[0]) = 81;
7144 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
7145 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
7146 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
7147 * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
7148 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
7149 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
7151 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 836, __pyx_L1_error)
7152 __Pyx_GOTREF(__pyx_t_4);
7153 __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, 836, __pyx_L1_error)
7154 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7155 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 836, __pyx_L1_error)
7156 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7158 (__pyx_v_f[0]) = 0x66;
7162 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
7163 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
7164 * elif t == NPY_FLOAT: f[0] = 102 #"f"
7165 * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
7166 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
7167 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
7169 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error)
7170 __Pyx_GOTREF(__pyx_t_3);
7171 __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, 837, __pyx_L1_error)
7172 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7173 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error)
7174 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7176 (__pyx_v_f[0]) = 0x64;
7180 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
7181 * elif t == NPY_FLOAT: f[0] = 102 #"f"
7182 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
7183 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
7184 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
7185 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
7187 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error)
7188 __Pyx_GOTREF(__pyx_t_4);
7189 __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, 838, __pyx_L1_error)
7190 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7191 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error)
7192 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7194 (__pyx_v_f[0]) = 0x67;
7198 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":839
7199 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
7200 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
7201 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
7202 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
7203 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
7205 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error)
7206 __Pyx_GOTREF(__pyx_t_3);
7207 __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, 839, __pyx_L1_error)
7208 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7209 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error)
7210 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7212 (__pyx_v_f[0]) = 90;
7213 (__pyx_v_f[1]) = 0x66;
7214 __pyx_v_f = (__pyx_v_f + 1);
7218 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
7219 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
7220 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
7221 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
7222 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
7223 * elif t == NPY_OBJECT: f[0] = 79 #"O"
7225 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error)
7226 __Pyx_GOTREF(__pyx_t_4);
7227 __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, 840, __pyx_L1_error)
7228 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7229 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error)
7230 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7232 (__pyx_v_f[0]) = 90;
7233 (__pyx_v_f[1]) = 0x64;
7234 __pyx_v_f = (__pyx_v_f + 1);
7238 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":841
7239 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
7240 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
7241 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
7242 * elif t == NPY_OBJECT: f[0] = 79 #"O"
7245 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error)
7246 __Pyx_GOTREF(__pyx_t_3);
7247 __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, 841, __pyx_L1_error)
7248 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7249 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error)
7250 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7252 (__pyx_v_f[0]) = 90;
7253 (__pyx_v_f[1]) = 0x67;
7254 __pyx_v_f = (__pyx_v_f + 1);
7258 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
7259 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
7260 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
7261 * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
7263 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
7265 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error)
7266 __Pyx_GOTREF(__pyx_t_4);
7267 __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, 842, __pyx_L1_error)
7268 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7269 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error)
7270 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7272 (__pyx_v_f[0]) = 79;
7276 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844
7277 * elif t == NPY_OBJECT: f[0] = 79 #"O"
7279 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
7284 __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error)
7285 __Pyx_GOTREF(__pyx_t_3);
7286 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error)
7287 __Pyx_GOTREF(__pyx_t_4);
7288 __Pyx_GIVEREF(__pyx_t_3);
7289 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
7291 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error)
7292 __Pyx_GOTREF(__pyx_t_3);
7293 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7294 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7295 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7296 __PYX_ERR(1, 844, __pyx_L1_error)
7300 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845
7302 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
7303 * f += 1 # <<<<<<<<<<<<<<
7305 * # Cython ignores struct boundary information ("T{...}"),
7307 __pyx_v_f = (__pyx_v_f + 1);
7309 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
7310 * offset[0] += child.itemsize
7312 * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
7313 * t = child.type_num
7319 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":849
7320 * # Cython ignores struct boundary information ("T{...}"),
7321 * # so don't output it
7322 * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
7327 __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 == NULL)) __PYX_ERR(1, 849, __pyx_L1_error)
7328 __pyx_v_f = __pyx_t_9;
7332 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
7335 * for childname in descr.names: # <<<<<<<<<<<<<<
7336 * fields = descr.fields[childname]
7337 * child, new_offset = fields
7340 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7342 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":850
7343 * # so don't output it
7344 * f = _util_dtypestring(child, f, end, offset)
7345 * return f # <<<<<<<<<<<<<<
7349 __pyx_r = __pyx_v_f;
7352 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
7353 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
7355 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
7356 * # Recursive utility function used in __getbuffer__ to get format
7357 * # string. The new location in the format string is returned.
7360 /* function exit code */
7362 __Pyx_XDECREF(__pyx_t_1);
7363 __Pyx_XDECREF(__pyx_t_3);
7364 __Pyx_XDECREF(__pyx_t_4);
7365 __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
7368 __Pyx_XDECREF((PyObject *)__pyx_v_child);
7369 __Pyx_XDECREF(__pyx_v_fields);
7370 __Pyx_XDECREF(__pyx_v_childname);
7371 __Pyx_XDECREF(__pyx_v_new_offset);
7372 __Pyx_XDECREF(__pyx_v_t);
7373 __Pyx_RefNannyFinishContext();
7377 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
7380 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
7381 * cdef PyObject* baseptr
7385 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
7386 PyObject *__pyx_v_baseptr;
7387 __Pyx_RefNannyDeclarations
7390 __Pyx_RefNannySetupContext("set_array_base", 0);
7392 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":968
7393 * cdef inline void set_array_base(ndarray arr, object base):
7394 * cdef PyObject* baseptr
7395 * if base is None: # <<<<<<<<<<<<<<
7399 __pyx_t_1 = (__pyx_v_base == Py_None);
7400 __pyx_t_2 = (__pyx_t_1 != 0);
7403 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":969
7404 * cdef PyObject* baseptr
7406 * baseptr = NULL # <<<<<<<<<<<<<<
7408 * Py_INCREF(base) # important to do this before decref below!
7410 __pyx_v_baseptr = NULL;
7412 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":968
7413 * cdef inline void set_array_base(ndarray arr, object base):
7414 * cdef PyObject* baseptr
7415 * if base is None: # <<<<<<<<<<<<<<
7422 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":971
7425 * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<<
7426 * baseptr = <PyObject*>base
7427 * Py_XDECREF(arr.base)
7430 Py_INCREF(__pyx_v_base);
7432 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":972
7434 * Py_INCREF(base) # important to do this before decref below!
7435 * baseptr = <PyObject*>base # <<<<<<<<<<<<<<
7436 * Py_XDECREF(arr.base)
7437 * arr.base = baseptr
7439 __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
7443 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":973
7444 * Py_INCREF(base) # important to do this before decref below!
7445 * baseptr = <PyObject*>base
7446 * Py_XDECREF(arr.base) # <<<<<<<<<<<<<<
7447 * arr.base = baseptr
7450 Py_XDECREF(__pyx_v_arr->base);
7452 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":974
7453 * baseptr = <PyObject*>base
7454 * Py_XDECREF(arr.base)
7455 * arr.base = baseptr # <<<<<<<<<<<<<<
7457 * cdef inline object get_array_base(ndarray arr):
7459 __pyx_v_arr->base = __pyx_v_baseptr;
7461 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
7464 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
7465 * cdef PyObject* baseptr
7469 /* function exit code */
7470 __Pyx_RefNannyFinishContext();
7473 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
7474 * arr.base = baseptr
7476 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
7477 * if arr.base is NULL:
7481 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
7482 PyObject *__pyx_r = NULL;
7483 __Pyx_RefNannyDeclarations
7485 __Pyx_RefNannySetupContext("get_array_base", 0);
7487 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
7489 * cdef inline object get_array_base(ndarray arr):
7490 * if arr.base is NULL: # <<<<<<<<<<<<<<
7494 __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
7497 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":978
7498 * cdef inline object get_array_base(ndarray arr):
7499 * if arr.base is NULL:
7500 * return None # <<<<<<<<<<<<<<
7502 * return <object>arr.base
7504 __Pyx_XDECREF(__pyx_r);
7505 __Pyx_INCREF(Py_None);
7509 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
7511 * cdef inline object get_array_base(ndarray arr):
7512 * if arr.base is NULL: # <<<<<<<<<<<<<<
7518 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":980
7521 * return <object>arr.base # <<<<<<<<<<<<<<
7526 __Pyx_XDECREF(__pyx_r);
7527 __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
7528 __pyx_r = ((PyObject *)__pyx_v_arr->base);
7532 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
7533 * arr.base = baseptr
7535 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
7536 * if arr.base is NULL:
7540 /* function exit code */
7542 __Pyx_XGIVEREF(__pyx_r);
7543 __Pyx_RefNannyFinishContext();
7547 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":985
7548 * # Versions of the import_* functions which are more suitable for
7550 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
7555 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
7557 __Pyx_RefNannyDeclarations
7558 PyObject *__pyx_t_1 = NULL;
7559 PyObject *__pyx_t_2 = NULL;
7560 PyObject *__pyx_t_3 = NULL;
7562 PyObject *__pyx_t_5 = NULL;
7563 PyObject *__pyx_t_6 = NULL;
7564 PyObject *__pyx_t_7 = NULL;
7565 PyObject *__pyx_t_8 = NULL;
7566 __Pyx_RefNannySetupContext("import_array", 0);
7568 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
7570 * cdef inline int import_array() except -1:
7571 * try: # <<<<<<<<<<<<<<
7576 __Pyx_PyThreadState_declare
7577 __Pyx_PyThreadState_assign
7578 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7579 __Pyx_XGOTREF(__pyx_t_1);
7580 __Pyx_XGOTREF(__pyx_t_2);
7581 __Pyx_XGOTREF(__pyx_t_3);
7584 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":987
7585 * cdef inline int import_array() except -1:
7587 * _import_array() # <<<<<<<<<<<<<<
7589 * raise ImportError("numpy.core.multiarray failed to import")
7591 __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 987, __pyx_L3_error)
7593 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
7595 * cdef inline int import_array() except -1:
7596 * try: # <<<<<<<<<<<<<<
7601 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7602 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7603 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7604 goto __pyx_L10_try_end;
7606 __Pyx_PyThreadState_assign
7608 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":988
7611 * except Exception: # <<<<<<<<<<<<<<
7612 * raise ImportError("numpy.core.multiarray failed to import")
7615 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7617 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7618 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 988, __pyx_L5_except_error)
7619 __Pyx_GOTREF(__pyx_t_5);
7620 __Pyx_GOTREF(__pyx_t_6);
7621 __Pyx_GOTREF(__pyx_t_7);
7623 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
7626 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
7628 * cdef inline int import_umath() except -1:
7630 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 989, __pyx_L5_except_error)
7631 __Pyx_GOTREF(__pyx_t_8);
7632 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7633 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7634 __PYX_ERR(1, 989, __pyx_L5_except_error)
7636 goto __pyx_L5_except_error;
7637 __pyx_L5_except_error:;
7639 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
7641 * cdef inline int import_array() except -1:
7642 * try: # <<<<<<<<<<<<<<
7646 __Pyx_PyThreadState_assign
7647 __Pyx_XGIVEREF(__pyx_t_1);
7648 __Pyx_XGIVEREF(__pyx_t_2);
7649 __Pyx_XGIVEREF(__pyx_t_3);
7650 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7651 goto __pyx_L1_error;
7655 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":985
7656 * # Versions of the import_* functions which are more suitable for
7658 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
7663 /* function exit code */
7667 __Pyx_XDECREF(__pyx_t_5);
7668 __Pyx_XDECREF(__pyx_t_6);
7669 __Pyx_XDECREF(__pyx_t_7);
7670 __Pyx_XDECREF(__pyx_t_8);
7671 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7674 __Pyx_RefNannyFinishContext();
7678 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
7679 * raise ImportError("numpy.core.multiarray failed to import")
7681 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
7686 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
7688 __Pyx_RefNannyDeclarations
7689 PyObject *__pyx_t_1 = NULL;
7690 PyObject *__pyx_t_2 = NULL;
7691 PyObject *__pyx_t_3 = NULL;
7693 PyObject *__pyx_t_5 = NULL;
7694 PyObject *__pyx_t_6 = NULL;
7695 PyObject *__pyx_t_7 = NULL;
7696 PyObject *__pyx_t_8 = NULL;
7697 __Pyx_RefNannySetupContext("import_umath", 0);
7699 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
7701 * cdef inline int import_umath() except -1:
7702 * try: # <<<<<<<<<<<<<<
7707 __Pyx_PyThreadState_declare
7708 __Pyx_PyThreadState_assign
7709 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7710 __Pyx_XGOTREF(__pyx_t_1);
7711 __Pyx_XGOTREF(__pyx_t_2);
7712 __Pyx_XGOTREF(__pyx_t_3);
7715 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":993
7716 * cdef inline int import_umath() except -1:
7718 * _import_umath() # <<<<<<<<<<<<<<
7720 * raise ImportError("numpy.core.umath failed to import")
7722 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 993, __pyx_L3_error)
7724 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
7726 * cdef inline int import_umath() except -1:
7727 * try: # <<<<<<<<<<<<<<
7732 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7733 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7734 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7735 goto __pyx_L10_try_end;
7737 __Pyx_PyThreadState_assign
7739 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":994
7742 * except Exception: # <<<<<<<<<<<<<<
7743 * raise ImportError("numpy.core.umath failed to import")
7746 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7748 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
7749 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 994, __pyx_L5_except_error)
7750 __Pyx_GOTREF(__pyx_t_5);
7751 __Pyx_GOTREF(__pyx_t_6);
7752 __Pyx_GOTREF(__pyx_t_7);
7754 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995
7757 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
7759 * cdef inline int import_ufunc() except -1:
7761 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 995, __pyx_L5_except_error)
7762 __Pyx_GOTREF(__pyx_t_8);
7763 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7764 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7765 __PYX_ERR(1, 995, __pyx_L5_except_error)
7767 goto __pyx_L5_except_error;
7768 __pyx_L5_except_error:;
7770 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
7772 * cdef inline int import_umath() except -1:
7773 * try: # <<<<<<<<<<<<<<
7777 __Pyx_PyThreadState_assign
7778 __Pyx_XGIVEREF(__pyx_t_1);
7779 __Pyx_XGIVEREF(__pyx_t_2);
7780 __Pyx_XGIVEREF(__pyx_t_3);
7781 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7782 goto __pyx_L1_error;
7786 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
7787 * raise ImportError("numpy.core.multiarray failed to import")
7789 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
7794 /* function exit code */
7798 __Pyx_XDECREF(__pyx_t_5);
7799 __Pyx_XDECREF(__pyx_t_6);
7800 __Pyx_XDECREF(__pyx_t_7);
7801 __Pyx_XDECREF(__pyx_t_8);
7802 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
7805 __Pyx_RefNannyFinishContext();
7809 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
7810 * raise ImportError("numpy.core.umath failed to import")
7812 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
7817 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
7819 __Pyx_RefNannyDeclarations
7820 PyObject *__pyx_t_1 = NULL;
7821 PyObject *__pyx_t_2 = NULL;
7822 PyObject *__pyx_t_3 = NULL;
7824 PyObject *__pyx_t_5 = NULL;
7825 PyObject *__pyx_t_6 = NULL;
7826 PyObject *__pyx_t_7 = NULL;
7827 PyObject *__pyx_t_8 = NULL;
7828 __Pyx_RefNannySetupContext("import_ufunc", 0);
7830 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
7832 * cdef inline int import_ufunc() except -1:
7833 * try: # <<<<<<<<<<<<<<
7838 __Pyx_PyThreadState_declare
7839 __Pyx_PyThreadState_assign
7840 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7841 __Pyx_XGOTREF(__pyx_t_1);
7842 __Pyx_XGOTREF(__pyx_t_2);
7843 __Pyx_XGOTREF(__pyx_t_3);
7846 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":999
7847 * cdef inline int import_ufunc() except -1:
7849 * _import_umath() # <<<<<<<<<<<<<<
7851 * raise ImportError("numpy.core.umath failed to import")
7853 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 999, __pyx_L3_error)
7855 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
7857 * cdef inline int import_ufunc() except -1:
7858 * try: # <<<<<<<<<<<<<<
7863 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7864 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7865 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7866 goto __pyx_L10_try_end;
7868 __Pyx_PyThreadState_assign
7870 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000
7873 * except Exception: # <<<<<<<<<<<<<<
7874 * raise ImportError("numpy.core.umath failed to import")
7876 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7878 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7879 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1000, __pyx_L5_except_error)
7880 __Pyx_GOTREF(__pyx_t_5);
7881 __Pyx_GOTREF(__pyx_t_6);
7882 __Pyx_GOTREF(__pyx_t_7);
7884 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001
7887 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
7889 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1001, __pyx_L5_except_error)
7890 __Pyx_GOTREF(__pyx_t_8);
7891 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7892 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7893 __PYX_ERR(1, 1001, __pyx_L5_except_error)
7895 goto __pyx_L5_except_error;
7896 __pyx_L5_except_error:;
7898 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
7900 * cdef inline int import_ufunc() except -1:
7901 * try: # <<<<<<<<<<<<<<
7905 __Pyx_PyThreadState_assign
7906 __Pyx_XGIVEREF(__pyx_t_1);
7907 __Pyx_XGIVEREF(__pyx_t_2);
7908 __Pyx_XGIVEREF(__pyx_t_3);
7909 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7910 goto __pyx_L1_error;
7914 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
7915 * raise ImportError("numpy.core.umath failed to import")
7917 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
7922 /* function exit code */
7926 __Pyx_XDECREF(__pyx_t_5);
7927 __Pyx_XDECREF(__pyx_t_6);
7928 __Pyx_XDECREF(__pyx_t_7);
7929 __Pyx_XDECREF(__pyx_t_8);
7930 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7933 __Pyx_RefNannyFinishContext();
7937 static PyMethodDef __pyx_methods[] = {
7941 #if PY_MAJOR_VERSION >= 3
7942 static struct PyModuleDef __pyx_moduledef = {
7943 #if PY_VERSION_HEX < 0x03020000
7944 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
7946 PyModuleDef_HEAD_INIT,
7951 __pyx_methods /* m_methods */,
7952 NULL, /* m_reload */
7953 NULL, /* m_traverse */
7959 static __Pyx_StringTabEntry __pyx_string_tab[] = {
7960 {&__pyx_n_s_DTYPE, __pyx_k_DTYPE, sizeof(__pyx_k_DTYPE), 0, 0, 1, 1},
7961 {&__pyx_n_s_FG_THRESH, __pyx_k_FG_THRESH, sizeof(__pyx_k_FG_THRESH), 0, 0, 1, 1},
7962 {&__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},
7963 {&__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},
7964 {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
7965 {&__pyx_n_s_K, __pyx_k_K, sizeof(__pyx_k_K), 0, 0, 1, 1},
7966 {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
7967 {&__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},
7968 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
7969 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
7970 {&__pyx_n_s_bbox_overlaps, __pyx_k_bbox_overlaps, sizeof(__pyx_k_bbox_overlaps), 0, 0, 1, 1},
7971 {&__pyx_n_s_bbox_overlaps_float, __pyx_k_bbox_overlaps_float, sizeof(__pyx_k_bbox_overlaps_float), 0, 0, 1, 1},
7972 {&__pyx_n_s_bbox_overlaps_ignore, __pyx_k_bbox_overlaps_ignore, sizeof(__pyx_k_bbox_overlaps_ignore), 0, 0, 1, 1},
7973 {&__pyx_n_s_bbox_overlaps_self, __pyx_k_bbox_overlaps_self, sizeof(__pyx_k_bbox_overlaps_self), 0, 0, 1, 1},
7974 {&__pyx_n_s_box_area, __pyx_k_box_area, sizeof(__pyx_k_box_area), 0, 0, 1, 1},
7975 {&__pyx_n_s_boxes, __pyx_k_boxes, sizeof(__pyx_k_boxes), 0, 0, 1, 1},
7976 {&__pyx_n_s_cython_bbox, __pyx_k_cython_bbox, sizeof(__pyx_k_cython_bbox), 0, 0, 1, 1},
7977 {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
7978 {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1},
7979 {&__pyx_n_s_get_assignment_overlaps, __pyx_k_get_assignment_overlaps, sizeof(__pyx_k_get_assignment_overlaps), 0, 0, 1, 1},
7980 {&__pyx_n_s_gt_assignment, __pyx_k_gt_assignment, sizeof(__pyx_k_gt_assignment), 0, 0, 1, 1},
7981 {&__pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_k_home_yjr_PycharmProjects_Faster, sizeof(__pyx_k_home_yjr_PycharmProjects_Faster), 0, 0, 1, 0},
7982 {&__pyx_n_s_ih, __pyx_k_ih, sizeof(__pyx_k_ih), 0, 0, 1, 1},
7983 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
7984 {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1},
7985 {&__pyx_n_s_iw, __pyx_k_iw, sizeof(__pyx_k_iw), 0, 0, 1, 1},
7986 {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
7987 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
7988 {&__pyx_n_s_max_overlaps, __pyx_k_max_overlaps, sizeof(__pyx_k_max_overlaps), 0, 0, 1, 1},
7989 {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
7990 {&__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},
7991 {&__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},
7992 {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
7993 {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
7994 {&__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},
7995 {&__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},
7996 {&__pyx_n_s_overlap, __pyx_k_overlap, sizeof(__pyx_k_overlap), 0, 0, 1, 1},
7997 {&__pyx_n_s_overlaps, __pyx_k_overlaps, sizeof(__pyx_k_overlaps), 0, 0, 1, 1},
7998 {&__pyx_n_s_query_boxes, __pyx_k_query_boxes, sizeof(__pyx_k_query_boxes), 0, 0, 1, 1},
7999 {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
8000 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
8001 {&__pyx_n_s_ua, __pyx_k_ua, sizeof(__pyx_k_ua), 0, 0, 1, 1},
8002 {&__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},
8003 {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
8004 {0, 0, 0, 0, 0, 0, 0}
8006 static int __Pyx_InitCachedBuiltins(void) {
8007 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 33, __pyx_L1_error)
8008 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 218, __pyx_L1_error)
8009 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 799, __pyx_L1_error)
8010 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 989, __pyx_L1_error)
8016 static int __Pyx_InitCachedConstants(void) {
8017 __Pyx_RefNannyDeclarations
8018 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
8020 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218
8021 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
8022 * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
8023 * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
8025 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8027 __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 218, __pyx_L1_error)
8028 __Pyx_GOTREF(__pyx_tuple_);
8029 __Pyx_GIVEREF(__pyx_tuple_);
8031 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
8032 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8033 * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
8034 * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
8036 * info.buf = PyArray_DATA(self)
8038 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 222, __pyx_L1_error)
8039 __Pyx_GOTREF(__pyx_tuple__2);
8040 __Pyx_GIVEREF(__pyx_tuple__2);
8042 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
8043 * if ((descr.byteorder == c'>' and little_endian) or
8044 * (descr.byteorder == c'<' and not little_endian)):
8045 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
8046 * if t == NPY_BYTE: f = "b"
8047 * elif t == NPY_UBYTE: f = "B"
8049 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 259, __pyx_L1_error)
8050 __Pyx_GOTREF(__pyx_tuple__3);
8051 __Pyx_GIVEREF(__pyx_tuple__3);
8053 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
8055 * if (end - f) - <int>(new_offset - offset[0]) < 15:
8056 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
8058 * if ((child.byteorder == c'>' and little_endian) or
8060 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 799, __pyx_L1_error)
8061 __Pyx_GOTREF(__pyx_tuple__4);
8062 __Pyx_GIVEREF(__pyx_tuple__4);
8064 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":803
8065 * if ((child.byteorder == c'>' and little_endian) or
8066 * (child.byteorder == c'<' and not little_endian)):
8067 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
8068 * # One could encode it in the format string and have Cython
8069 * # complain instead, BUT: < and > in format strings also imply
8071 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 803, __pyx_L1_error)
8072 __Pyx_GOTREF(__pyx_tuple__5);
8073 __Pyx_GIVEREF(__pyx_tuple__5);
8075 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
8076 * t = child.type_num
8078 * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
8080 * # Until ticket #99 is fixed, use integers to avoid warnings
8082 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 823, __pyx_L1_error)
8083 __Pyx_GOTREF(__pyx_tuple__6);
8084 __Pyx_GIVEREF(__pyx_tuple__6);
8086 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
8089 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
8091 * cdef inline int import_umath() except -1:
8093 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 989, __pyx_L1_error)
8094 __Pyx_GOTREF(__pyx_tuple__7);
8095 __Pyx_GIVEREF(__pyx_tuple__7);
8097 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995
8100 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
8102 * cdef inline int import_ufunc() except -1:
8104 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 995, __pyx_L1_error)
8105 __Pyx_GOTREF(__pyx_tuple__8);
8106 __Pyx_GIVEREF(__pyx_tuple__8);
8108 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001
8111 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
8113 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1001, __pyx_L1_error)
8114 __Pyx_GOTREF(__pyx_tuple__9);
8115 __Pyx_GIVEREF(__pyx_tuple__9);
8118 * ctypedef np.float_t DTYPE_t
8120 * def bbox_overlaps_float( # <<<<<<<<<<<<<<
8121 * np.ndarray[DTYPE_t, ndim=2] boxes,
8122 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
8124 __pyx_tuple__10 = PyTuple_Pack(11, __pyx_n_s_boxes, __pyx_n_s_query_boxes, __pyx_n_s_N, __pyx_n_s_K, __pyx_n_s_overlaps, __pyx_n_s_iw, __pyx_n_s_ih, __pyx_n_s_box_area, __pyx_n_s_ua, __pyx_n_s_k, __pyx_n_s_n); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 15, __pyx_L1_error)
8125 __Pyx_GOTREF(__pyx_tuple__10);
8126 __Pyx_GIVEREF(__pyx_tuple__10);
8127 __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_bbox_overlaps_float, 15, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 15, __pyx_L1_error)
8132 * def bbox_overlaps( # <<<<<<<<<<<<<<
8133 * np.ndarray[DTYPE_t, ndim=2] boxes,
8134 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
8136 __pyx_tuple__12 = PyTuple_Pack(11, __pyx_n_s_boxes, __pyx_n_s_query_boxes, __pyx_n_s_N, __pyx_n_s_K, __pyx_n_s_overlaps, __pyx_n_s_iw, __pyx_n_s_ih, __pyx_n_s_box_area, __pyx_n_s_ua, __pyx_n_s_k, __pyx_n_s_n); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 66, __pyx_L1_error)
8137 __Pyx_GOTREF(__pyx_tuple__12);
8138 __Pyx_GIVEREF(__pyx_tuple__12);
8139 __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_bbox_overlaps, 66, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 66, __pyx_L1_error)
8144 * def bbox_overlaps_self( # <<<<<<<<<<<<<<
8145 * np.ndarray[DTYPE_t, ndim=2] boxes,
8146 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
8148 __pyx_tuple__14 = PyTuple_Pack(11, __pyx_n_s_boxes, __pyx_n_s_query_boxes, __pyx_n_s_N, __pyx_n_s_K, __pyx_n_s_overlaps, __pyx_n_s_iw, __pyx_n_s_ih, __pyx_n_s_box_area, __pyx_n_s_ua, __pyx_n_s_k, __pyx_n_s_n); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 108, __pyx_L1_error)
8149 __Pyx_GOTREF(__pyx_tuple__14);
8150 __Pyx_GIVEREF(__pyx_tuple__14);
8151 __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_bbox_overlaps_self, 108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 108, __pyx_L1_error)
8156 * def bbox_overlaps_ignore( # <<<<<<<<<<<<<<
8157 * np.ndarray[DTYPE_t, ndim=2] boxes,
8158 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
8160 __pyx_tuple__16 = PyTuple_Pack(11, __pyx_n_s_boxes, __pyx_n_s_query_boxes, __pyx_n_s_N, __pyx_n_s_K, __pyx_n_s_overlaps, __pyx_n_s_iw, __pyx_n_s_ih, __pyx_n_s_box_area, __pyx_n_s_ua, __pyx_n_s_k, __pyx_n_s_n); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 147, __pyx_L1_error)
8161 __Pyx_GOTREF(__pyx_tuple__16);
8162 __Pyx_GIVEREF(__pyx_tuple__16);
8163 __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_bbox_overlaps_ignore, 147, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 147, __pyx_L1_error)
8168 * def get_assignment_overlaps( # <<<<<<<<<<<<<<
8169 * np.ndarray[DTYPE_t, ndim=2] boxes,
8170 * np.ndarray[DTYPE_t, ndim=2] query_boxes,
8172 __pyx_tuple__18 = PyTuple_Pack(14, __pyx_n_s_boxes, __pyx_n_s_query_boxes, __pyx_n_s_FG_THRESH, __pyx_n_s_N, __pyx_n_s_K, __pyx_n_s_gt_assignment, __pyx_n_s_max_overlaps, __pyx_n_s_iw, __pyx_n_s_ih, __pyx_n_s_box_area, __pyx_n_s_ua, __pyx_n_s_k, __pyx_n_s_n, __pyx_n_s_overlap); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 194, __pyx_L1_error)
8173 __Pyx_GOTREF(__pyx_tuple__18);
8174 __Pyx_GIVEREF(__pyx_tuple__18);
8175 __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(3, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_get_assignment_overlaps, 194, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 194, __pyx_L1_error)
8176 __Pyx_RefNannyFinishContext();
8179 __Pyx_RefNannyFinishContext();
8183 static int __Pyx_InitGlobals(void) {
8184 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
8190 #if PY_MAJOR_VERSION < 3
8191 PyMODINIT_FUNC initcython_bbox(void); /*proto*/
8192 PyMODINIT_FUNC initcython_bbox(void)
8194 PyMODINIT_FUNC PyInit_cython_bbox(void); /*proto*/
8195 PyMODINIT_FUNC PyInit_cython_bbox(void)
8198 PyObject *__pyx_t_1 = NULL;
8199 PyObject *__pyx_t_2 = NULL;
8200 __Pyx_RefNannyDeclarations
8202 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
8203 if (!__Pyx_RefNanny) {
8205 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
8206 if (!__Pyx_RefNanny)
8207 Py_FatalError("failed to import 'refnanny' module");
8210 __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_cython_bbox(void)", 0);
8211 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8212 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
8213 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
8214 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
8215 #ifdef __Pyx_CyFunction_USED
8216 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8218 #ifdef __Pyx_FusedFunction_USED
8219 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8221 #ifdef __Pyx_Coroutine_USED
8222 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8224 #ifdef __Pyx_Generator_USED
8225 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8227 #ifdef __Pyx_StopAsyncIteration_USED
8228 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8230 /*--- Library function declarations ---*/
8231 /*--- Threads initialization code ---*/
8232 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
8233 #ifdef WITH_THREAD /* Python build with threading support? */
8234 PyEval_InitThreads();
8237 /*--- Module creation code ---*/
8238 #if PY_MAJOR_VERSION < 3
8239 __pyx_m = Py_InitModule4("cython_bbox", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
8241 __pyx_m = PyModule_Create(&__pyx_moduledef);
8243 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
8244 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
8246 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
8247 #if CYTHON_COMPILING_IN_PYPY
8250 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
8251 /*--- Initialize various global constants etc. ---*/
8252 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8253 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
8254 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8256 if (__pyx_module_is_main_cython_bbox) {
8257 if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8259 #if PY_MAJOR_VERSION >= 3
8261 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
8262 if (!PyDict_GetItemString(modules, "cython_bbox")) {
8263 if (unlikely(PyDict_SetItemString(modules, "cython_bbox", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
8267 /*--- Builtin init code ---*/
8268 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8269 /*--- Constants init code ---*/
8270 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8271 /*--- Global init code ---*/
8272 /*--- Variable export code ---*/
8273 /*--- Function export code ---*/
8274 /*--- Type init code ---*/
8275 /*--- Type import code ---*/
8276 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
8277 #if CYTHON_COMPILING_IN_PYPY
8278 sizeof(PyTypeObject),
8280 sizeof(PyHeapTypeObject),
8282 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error)
8283 __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 155, __pyx_L1_error)
8284 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 168, __pyx_L1_error)
8285 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 172, __pyx_L1_error)
8286 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 181, __pyx_L1_error)
8287 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 861, __pyx_L1_error)
8288 /*--- Variable import code ---*/
8289 /*--- Function import code ---*/
8290 /*--- Execution code ---*/
8291 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
8292 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8298 * import numpy as np # <<<<<<<<<<<<<<
8299 * cimport numpy as np
8302 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
8303 __Pyx_GOTREF(__pyx_t_1);
8304 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
8305 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8308 * cimport numpy as np
8310 * DTYPE = np.float # <<<<<<<<<<<<<<
8311 * ctypedef np.float_t DTYPE_t
8314 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
8315 __Pyx_GOTREF(__pyx_t_1);
8316 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
8317 __Pyx_GOTREF(__pyx_t_2);
8318 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8319 if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTYPE, __pyx_t_2) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
8320 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8323 * ctypedef np.float_t DTYPE_t
8325 * def bbox_overlaps_float( # <<<<<<<<<<<<<<
8326 * np.ndarray[DTYPE_t, ndim=2] boxes,
8327 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
8329 __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11cython_bbox_1bbox_overlaps_float, NULL, __pyx_n_s_cython_bbox); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
8330 __Pyx_GOTREF(__pyx_t_2);
8331 if (PyDict_SetItem(__pyx_d, __pyx_n_s_bbox_overlaps_float, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
8332 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8337 * def bbox_overlaps( # <<<<<<<<<<<<<<
8338 * np.ndarray[DTYPE_t, ndim=2] boxes,
8339 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
8341 __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11cython_bbox_3bbox_overlaps, NULL, __pyx_n_s_cython_bbox); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error)
8342 __Pyx_GOTREF(__pyx_t_2);
8343 if (PyDict_SetItem(__pyx_d, __pyx_n_s_bbox_overlaps, __pyx_t_2) < 0) __PYX_ERR(0, 66, __pyx_L1_error)
8344 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8349 * def bbox_overlaps_self( # <<<<<<<<<<<<<<
8350 * np.ndarray[DTYPE_t, ndim=2] boxes,
8351 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
8353 __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11cython_bbox_5bbox_overlaps_self, NULL, __pyx_n_s_cython_bbox); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
8354 __Pyx_GOTREF(__pyx_t_2);
8355 if (PyDict_SetItem(__pyx_d, __pyx_n_s_bbox_overlaps_self, __pyx_t_2) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
8356 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8361 * def bbox_overlaps_ignore( # <<<<<<<<<<<<<<
8362 * np.ndarray[DTYPE_t, ndim=2] boxes,
8363 * np.ndarray[DTYPE_t, ndim=2] query_boxes):
8365 __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11cython_bbox_7bbox_overlaps_ignore, NULL, __pyx_n_s_cython_bbox); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
8366 __Pyx_GOTREF(__pyx_t_2);
8367 if (PyDict_SetItem(__pyx_d, __pyx_n_s_bbox_overlaps_ignore, __pyx_t_2) < 0) __PYX_ERR(0, 147, __pyx_L1_error)
8368 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8373 * def get_assignment_overlaps( # <<<<<<<<<<<<<<
8374 * np.ndarray[DTYPE_t, ndim=2] boxes,
8375 * np.ndarray[DTYPE_t, ndim=2] query_boxes,
8377 __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11cython_bbox_9get_assignment_overlaps, NULL, __pyx_n_s_cython_bbox); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error)
8378 __Pyx_GOTREF(__pyx_t_2);
8379 if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_assignment_overlaps, __pyx_t_2) < 0) __PYX_ERR(0, 194, __pyx_L1_error)
8380 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8383 * # -------------------------------------------------------- # <<<<<<<<<<<<<<
8385 * # Copyright (c) 2015 Microsoft
8387 __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
8388 __Pyx_GOTREF(__pyx_t_2);
8389 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8390 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8392 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
8393 * raise ImportError("numpy.core.umath failed to import")
8395 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
8400 /*--- Wrapped vars code ---*/
8404 __Pyx_XDECREF(__pyx_t_1);
8405 __Pyx_XDECREF(__pyx_t_2);
8408 __Pyx_AddTraceback("init cython_bbox", __pyx_clineno, __pyx_lineno, __pyx_filename);
8410 Py_DECREF(__pyx_m); __pyx_m = 0;
8411 } else if (!PyErr_Occurred()) {
8412 PyErr_SetString(PyExc_ImportError, "init cython_bbox");
8415 __Pyx_RefNannyFinishContext();
8416 #if PY_MAJOR_VERSION < 3
8423 /* --- Runtime support code --- */
8426 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
8427 PyObject *m = NULL, *p = NULL;
8429 m = PyImport_ImportModule((char *)modname);
8431 p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
8433 r = PyLong_AsVoidPtr(p);
8437 return (__Pyx_RefNannyAPIStruct *)r;
8441 /* GetBuiltinName */
8442 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
8443 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
8444 if (unlikely(!result)) {
8445 PyErr_Format(PyExc_NameError,
8446 #if PY_MAJOR_VERSION >= 3
8447 "name '%U' is not defined", name);
8449 "name '%.200s' is not defined", PyString_AS_STRING(name));
8455 /* RaiseArgTupleInvalid */
8456 static void __Pyx_RaiseArgtupleInvalid(
8457 const char* func_name,
8461 Py_ssize_t num_found)
8463 Py_ssize_t num_expected;
8464 const char *more_or_less;
8465 if (num_found < num_min) {
8466 num_expected = num_min;
8467 more_or_less = "at least";
8469 num_expected = num_max;
8470 more_or_less = "at most";
8473 more_or_less = "exactly";
8475 PyErr_Format(PyExc_TypeError,
8476 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
8477 func_name, more_or_less, num_expected,
8478 (num_expected == 1) ? "" : "s", num_found);
8481 /* RaiseDoubleKeywords */
8482 static void __Pyx_RaiseDoubleKeywordsError(
8483 const char* func_name,
8486 PyErr_Format(PyExc_TypeError,
8487 #if PY_MAJOR_VERSION >= 3
8488 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
8490 "%s() got multiple values for keyword argument '%s'", func_name,
8491 PyString_AsString(kw_name));
8496 static int __Pyx_ParseOptionalKeywords(
8498 PyObject **argnames[],
8501 Py_ssize_t num_pos_args,
8502 const char* function_name)
8504 PyObject *key = 0, *value = 0;
8507 PyObject*** first_kw_arg = argnames + num_pos_args;
8508 while (PyDict_Next(kwds, &pos, &key, &value)) {
8509 name = first_kw_arg;
8510 while (*name && (**name != key)) name++;
8512 values[name-argnames] = value;
8515 name = first_kw_arg;
8516 #if PY_MAJOR_VERSION < 3
8517 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
8519 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
8520 && _PyString_Eq(**name, key)) {
8521 values[name-argnames] = value;
8526 if (*name) continue;
8528 PyObject*** argname = argnames;
8529 while (argname != first_kw_arg) {
8530 if ((**argname == key) || (
8531 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
8532 && _PyString_Eq(**argname, key))) {
8533 goto arg_passed_twice;
8540 if (likely(PyUnicode_Check(key))) {
8542 int cmp = (**name == key) ? 0 :
8543 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
8544 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
8546 PyUnicode_Compare(**name, key);
8547 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
8549 values[name-argnames] = value;
8554 if (*name) continue;
8556 PyObject*** argname = argnames;
8557 while (argname != first_kw_arg) {
8558 int cmp = (**argname == key) ? 0 :
8559 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
8560 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
8562 PyUnicode_Compare(**argname, key);
8563 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
8564 if (cmp == 0) goto arg_passed_twice;
8569 goto invalid_keyword_type;
8571 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
8573 goto invalid_keyword;
8578 __Pyx_RaiseDoubleKeywordsError(function_name, key);
8580 invalid_keyword_type:
8581 PyErr_Format(PyExc_TypeError,
8582 "%.200s() keywords must be strings", function_name);
8585 PyErr_Format(PyExc_TypeError,
8586 #if PY_MAJOR_VERSION < 3
8587 "%.200s() got an unexpected keyword argument '%.200s'",
8588 function_name, PyString_AsString(key));
8590 "%s() got an unexpected keyword argument '%U'",
8591 function_name, key);
8598 static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
8599 PyErr_Format(PyExc_TypeError,
8600 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
8601 name, type->tp_name, Py_TYPE(obj)->tp_name);
8603 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
8604 const char *name, int exact)
8606 if (unlikely(!type)) {
8607 PyErr_SetString(PyExc_SystemError, "Missing type object");
8610 if (none_allowed && obj == Py_None) return 1;
8612 if (likely(Py_TYPE(obj) == type)) return 1;
8613 #if PY_MAJOR_VERSION == 2
8614 else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
8618 if (likely(PyObject_TypeCheck(obj, type))) return 1;
8620 __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
8624 /* BufferFormatCheck */
8625 static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
8627 return *(unsigned char*)(&n) != 0;
8629 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
8630 __Pyx_BufFmt_StackElem* stack,
8631 __Pyx_TypeInfo* type) {
8632 stack[0].field = &ctx->root;
8633 stack[0].parent_offset = 0;
8634 ctx->root.type = type;
8635 ctx->root.name = "buffer dtype";
8636 ctx->root.offset = 0;
8638 ctx->head->field = &ctx->root;
8639 ctx->fmt_offset = 0;
8640 ctx->head->parent_offset = 0;
8641 ctx->new_packmode = '@';
8642 ctx->enc_packmode = '@';
8646 ctx->is_complex = 0;
8647 ctx->is_valid_array = 0;
8648 ctx->struct_alignment = 0;
8649 while (type->typegroup == 'S') {
8651 ctx->head->field = type->fields;
8652 ctx->head->parent_offset = 0;
8653 type = type->fields->type;
8656 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
8658 const char* t = *ts;
8659 if (*t < '0' || *t > '9') {
8663 while (*t >= '0' && *t < '9') {
8665 count += *t++ - '0';
8671 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
8672 int number = __Pyx_BufFmt_ParseNumber(ts);
8674 PyErr_Format(PyExc_ValueError,\
8675 "Does not understand character buffer dtype format string ('%c')", **ts);
8678 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
8679 PyErr_Format(PyExc_ValueError,
8680 "Unexpected format string character: '%c'", ch);
8682 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
8684 case 'c': return "'char'";
8685 case 'b': return "'signed char'";
8686 case 'B': return "'unsigned char'";
8687 case 'h': return "'short'";
8688 case 'H': return "'unsigned short'";
8689 case 'i': return "'int'";
8690 case 'I': return "'unsigned int'";
8691 case 'l': return "'long'";
8692 case 'L': return "'unsigned long'";
8693 case 'q': return "'long long'";
8694 case 'Q': return "'unsigned long long'";
8695 case 'f': return (is_complex ? "'complex float'" : "'float'");
8696 case 'd': return (is_complex ? "'complex double'" : "'double'");
8697 case 'g': return (is_complex ? "'complex long double'" : "'long double'");
8698 case 'T': return "a struct";
8699 case 'O': return "Python object";
8700 case 'P': return "a pointer";
8701 case 's': case 'p': return "a string";
8702 case 0: return "end";
8703 default: return "unparseable format string";
8706 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
8708 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
8709 case 'h': case 'H': return 2;
8710 case 'i': case 'I': case 'l': case 'L': return 4;
8711 case 'q': case 'Q': return 8;
8712 case 'f': return (is_complex ? 8 : 4);
8713 case 'd': return (is_complex ? 16 : 8);
8715 PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
8718 case 'O': case 'P': return sizeof(void*);
8720 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
8724 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
8726 case 'c': case 'b': case 'B': case 's': case 'p': return 1;
8727 case 'h': case 'H': return sizeof(short);
8728 case 'i': case 'I': return sizeof(int);
8729 case 'l': case 'L': return sizeof(long);
8730 #ifdef HAVE_LONG_LONG
8731 case 'q': case 'Q': return sizeof(PY_LONG_LONG);
8733 case 'f': return sizeof(float) * (is_complex ? 2 : 1);
8734 case 'd': return sizeof(double) * (is_complex ? 2 : 1);
8735 case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
8736 case 'O': case 'P': return sizeof(void*);
8738 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
8743 typedef struct { char c; short x; } __Pyx_st_short;
8744 typedef struct { char c; int x; } __Pyx_st_int;
8745 typedef struct { char c; long x; } __Pyx_st_long;
8746 typedef struct { char c; float x; } __Pyx_st_float;
8747 typedef struct { char c; double x; } __Pyx_st_double;
8748 typedef struct { char c; long double x; } __Pyx_st_longdouble;
8749 typedef struct { char c; void *x; } __Pyx_st_void_p;
8750 #ifdef HAVE_LONG_LONG
8751 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
8753 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
8755 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
8756 case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
8757 case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
8758 case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
8759 #ifdef HAVE_LONG_LONG
8760 case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
8762 case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
8763 case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
8764 case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
8765 case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
8767 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
8771 /* These are for computing the padding at the end of the struct to align
8772 on the first member of the struct. This will probably the same as above,
8773 but we don't have any guarantees.
8775 typedef struct { short x; char c; } __Pyx_pad_short;
8776 typedef struct { int x; char c; } __Pyx_pad_int;
8777 typedef struct { long x; char c; } __Pyx_pad_long;
8778 typedef struct { float x; char c; } __Pyx_pad_float;
8779 typedef struct { double x; char c; } __Pyx_pad_double;
8780 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
8781 typedef struct { void *x; char c; } __Pyx_pad_void_p;
8782 #ifdef HAVE_LONG_LONG
8783 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
8785 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
8787 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
8788 case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
8789 case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
8790 case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
8791 #ifdef HAVE_LONG_LONG
8792 case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
8794 case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
8795 case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
8796 case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
8797 case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
8799 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
8803 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
8807 case 'b': case 'h': case 'i':
8808 case 'l': case 'q': case 's': case 'p':
8810 case 'B': case 'H': case 'I': case 'L': case 'Q':
8812 case 'f': case 'd': case 'g':
8813 return (is_complex ? 'C' : 'R');
8819 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
8824 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
8825 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
8826 const char* expected;
8828 if (ctx->head == NULL) {
8832 expected = ctx->head->field->type->name;
8835 PyErr_Format(PyExc_ValueError,
8836 "Buffer dtype mismatch, expected %s%s%s but got %s",
8837 quote, expected, quote,
8838 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
8840 __Pyx_StructField* field = ctx->head->field;
8841 __Pyx_StructField* parent = (ctx->head - 1)->field;
8842 PyErr_Format(PyExc_ValueError,
8843 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
8844 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
8845 parent->type->name, field->name);
8848 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
8850 size_t size, offset, arraysize = 1;
8851 if (ctx->enc_type == 0) return 0;
8852 if (ctx->head->field->type->arraysize[0]) {
8854 if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
8855 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
8857 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
8858 PyErr_Format(PyExc_ValueError,
8859 "Expected a dimension of size %zu, got %zu",
8860 ctx->head->field->type->arraysize[0], ctx->enc_count);
8864 if (!ctx->is_valid_array) {
8865 PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
8866 ctx->head->field->type->ndim, ndim);
8869 for (i = 0; i < ctx->head->field->type->ndim; i++) {
8870 arraysize *= ctx->head->field->type->arraysize[i];
8872 ctx->is_valid_array = 0;
8875 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
8877 __Pyx_StructField* field = ctx->head->field;
8878 __Pyx_TypeInfo* type = field->type;
8879 if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
8880 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
8882 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
8884 if (ctx->enc_packmode == '@') {
8885 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
8886 size_t align_mod_offset;
8887 if (align_at == 0) return -1;
8888 align_mod_offset = ctx->fmt_offset % align_at;
8889 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
8890 if (ctx->struct_alignment == 0)
8891 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
8894 if (type->size != size || type->typegroup != group) {
8895 if (type->typegroup == 'C' && type->fields != NULL) {
8896 size_t parent_offset = ctx->head->parent_offset + field->offset;
8898 ctx->head->field = type->fields;
8899 ctx->head->parent_offset = parent_offset;
8902 if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
8904 __Pyx_BufFmt_RaiseExpected(ctx);
8908 offset = ctx->head->parent_offset + field->offset;
8909 if (ctx->fmt_offset != offset) {
8910 PyErr_Format(PyExc_ValueError,
8911 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
8912 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
8915 ctx->fmt_offset += size;
8917 ctx->fmt_offset += (arraysize - 1) * size;
8920 if (field == &ctx->root) {
8922 if (ctx->enc_count != 0) {
8923 __Pyx_BufFmt_RaiseExpected(ctx);
8928 ctx->head->field = ++field;
8929 if (field->type == NULL) {
8931 field = ctx->head->field;
8933 } else if (field->type->typegroup == 'S') {
8934 size_t parent_offset = ctx->head->parent_offset + field->offset;
8935 if (field->type->fields->type == NULL) continue;
8936 field = field->type->fields;
8938 ctx->head->field = field;
8939 ctx->head->parent_offset = parent_offset;
8945 } while (ctx->enc_count);
8947 ctx->is_complex = 0;
8950 static CYTHON_INLINE PyObject *
8951 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
8953 const char *ts = *tsp;
8955 int ndim = ctx->head->field->type->ndim;
8958 if (ctx->new_count != 1) {
8959 PyErr_SetString(PyExc_ValueError,
8960 "Cannot handle repeated arrays in format string");
8963 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
8964 while (*ts && *ts != ')') {
8966 case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
8969 number = __Pyx_BufFmt_ExpectNumber(&ts);
8970 if (number == -1) return NULL;
8971 if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
8972 return PyErr_Format(PyExc_ValueError,
8973 "Expected a dimension of size %zu, got %d",
8974 ctx->head->field->type->arraysize[i], number);
8975 if (*ts != ',' && *ts != ')')
8976 return PyErr_Format(PyExc_ValueError,
8977 "Expected a comma in format string, got '%c'", *ts);
8978 if (*ts == ',') ts++;
8982 return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
8983 ctx->head->field->type->ndim, i);
8985 PyErr_SetString(PyExc_ValueError,
8986 "Unexpected end of format string, expected ')'");
8989 ctx->is_valid_array = 1;
8994 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
8999 if (ctx->enc_type != 0 && ctx->head == NULL) {
9000 __Pyx_BufFmt_RaiseExpected(ctx);
9003 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9004 if (ctx->head != NULL) {
9005 __Pyx_BufFmt_RaiseExpected(ctx);
9015 if (!__Pyx_IsLittleEndian()) {
9016 PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
9019 ctx->new_packmode = '=';
9024 if (__Pyx_IsLittleEndian()) {
9025 PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
9028 ctx->new_packmode = '=';
9034 ctx->new_packmode = *ts++;
9038 const char* ts_after_sub;
9039 size_t i, struct_count = ctx->new_count;
9040 size_t struct_alignment = ctx->struct_alignment;
9044 PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
9047 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9050 ctx->struct_alignment = 0;
9053 for (i = 0; i != struct_count; ++i) {
9054 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
9055 if (!ts_after_sub) return NULL;
9058 if (struct_alignment) ctx->struct_alignment = struct_alignment;
9063 size_t alignment = ctx->struct_alignment;
9065 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9067 if (alignment && ctx->fmt_offset % alignment) {
9068 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
9073 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9074 ctx->fmt_offset += ctx->new_count;
9078 ctx->enc_packmode = ctx->new_packmode;
9084 if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
9085 __Pyx_BufFmt_RaiseUnexpectedChar('Z');
9088 case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
9089 case 'l': case 'L': case 'q': case 'Q':
9090 case 'f': case 'd': case 'g':
9092 if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
9093 ctx->enc_packmode == ctx->new_packmode) {
9094 ctx->enc_count += ctx->new_count;
9101 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9102 ctx->enc_count = ctx->new_count;
9103 ctx->enc_packmode = ctx->new_packmode;
9104 ctx->enc_type = *ts;
9105 ctx->is_complex = got_Z;
9112 while(*ts != ':') ++ts;
9116 if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
9120 int number = __Pyx_BufFmt_ExpectNumber(&ts);
9121 if (number == -1) return NULL;
9122 ctx->new_count = (size_t)number;
9127 static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
9130 buf->strides = __Pyx_zeros;
9131 buf->shape = __Pyx_zeros;
9132 buf->suboffsets = __Pyx_minusones;
9134 static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
9135 Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
9136 int nd, int cast, __Pyx_BufFmt_StackElem* stack)
9138 if (obj == Py_None || obj == NULL) {
9139 __Pyx_ZeroBuffer(buf);
9143 if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
9144 if (buf->ndim != nd) {
9145 PyErr_Format(PyExc_ValueError,
9146 "Buffer has wrong number of dimensions (expected %d, got %d)",
9151 __Pyx_BufFmt_Context ctx;
9152 __Pyx_BufFmt_Init(&ctx, stack, dtype);
9153 if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
9155 if ((unsigned)buf->itemsize != dtype->size) {
9156 PyErr_Format(PyExc_ValueError,
9157 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
9158 buf->itemsize, (buf->itemsize > 1) ? "s" : "",
9159 dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
9162 if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
9165 __Pyx_ZeroBuffer(buf);
9168 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
9169 if (info->buf == NULL) return;
9170 if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
9171 __Pyx_ReleaseBuffer(info);
9174 /* GetModuleGlobalName */
9175 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
9177 #if !CYTHON_AVOID_BORROWED_REFS
9178 result = PyDict_GetItem(__pyx_d, name);
9179 if (likely(result)) {
9183 result = PyObject_GetItem(__pyx_d, name);
9187 result = __Pyx_GetBuiltinName(name);
9193 #if CYTHON_COMPILING_IN_CPYTHON
9194 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
9196 ternaryfunc call = func->ob_type->tp_call;
9197 if (unlikely(!call))
9198 return PyObject_Call(func, arg, kw);
9199 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
9201 result = (*call)(func, arg, kw);
9202 Py_LeaveRecursiveCall();
9203 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
9206 "NULL result without error in PyObject_Call");
9213 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
9214 if (unlikely(!type)) {
9215 PyErr_SetString(PyExc_SystemError, "Missing type object");
9218 if (likely(PyObject_TypeCheck(obj, type)))
9220 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
9221 Py_TYPE(obj)->tp_name, type->tp_name);
9225 /* BufferIndexError */
9226 static void __Pyx_RaiseBufferIndexError(int axis) {
9227 PyErr_Format(PyExc_IndexError,
9228 "Out of bounds on buffer access (axis %d)", axis);
9231 /* PyErrFetchRestore */
9232 #if CYTHON_FAST_THREAD_STATE
9233 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
9234 PyObject *tmp_type, *tmp_value, *tmp_tb;
9235 tmp_type = tstate->curexc_type;
9236 tmp_value = tstate->curexc_value;
9237 tmp_tb = tstate->curexc_traceback;
9238 tstate->curexc_type = type;
9239 tstate->curexc_value = value;
9240 tstate->curexc_traceback = tb;
9241 Py_XDECREF(tmp_type);
9242 Py_XDECREF(tmp_value);
9245 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
9246 *type = tstate->curexc_type;
9247 *value = tstate->curexc_value;
9248 *tb = tstate->curexc_traceback;
9249 tstate->curexc_type = 0;
9250 tstate->curexc_value = 0;
9251 tstate->curexc_traceback = 0;
9255 /* RaiseException */
9256 #if PY_MAJOR_VERSION < 3
9257 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
9258 CYTHON_UNUSED PyObject *cause) {
9259 __Pyx_PyThreadState_declare
9261 if (!value || value == Py_None)
9265 if (!tb || tb == Py_None)
9269 if (!PyTraceBack_Check(tb)) {
9270 PyErr_SetString(PyExc_TypeError,
9271 "raise: arg 3 must be a traceback or None");
9275 if (PyType_Check(type)) {
9276 #if CYTHON_COMPILING_IN_PYPY
9282 PyErr_NormalizeException(&type, &value, &tb);
9285 PyErr_SetString(PyExc_TypeError,
9286 "instance exception may not have a separate value");
9290 type = (PyObject*) Py_TYPE(type);
9292 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
9293 PyErr_SetString(PyExc_TypeError,
9294 "raise: exception class must be a subclass of BaseException");
9298 __Pyx_PyThreadState_assign
9299 __Pyx_ErrRestore(type, value, tb);
9308 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
9309 PyObject* owned_instance = NULL;
9310 if (tb == Py_None) {
9312 } else if (tb && !PyTraceBack_Check(tb)) {
9313 PyErr_SetString(PyExc_TypeError,
9314 "raise: arg 3 must be a traceback or None");
9317 if (value == Py_None)
9319 if (PyExceptionInstance_Check(type)) {
9321 PyErr_SetString(PyExc_TypeError,
9322 "instance exception may not have a separate value");
9326 type = (PyObject*) Py_TYPE(value);
9327 } else if (PyExceptionClass_Check(type)) {
9328 PyObject *instance_class = NULL;
9329 if (value && PyExceptionInstance_Check(value)) {
9330 instance_class = (PyObject*) Py_TYPE(value);
9331 if (instance_class != type) {
9332 int is_subclass = PyObject_IsSubclass(instance_class, type);
9334 instance_class = NULL;
9335 } else if (unlikely(is_subclass == -1)) {
9338 type = instance_class;
9342 if (!instance_class) {
9345 args = PyTuple_New(0);
9346 else if (PyTuple_Check(value)) {
9350 args = PyTuple_Pack(1, value);
9353 owned_instance = PyObject_Call(type, args, NULL);
9355 if (!owned_instance)
9357 value = owned_instance;
9358 if (!PyExceptionInstance_Check(value)) {
9359 PyErr_Format(PyExc_TypeError,
9360 "calling %R should have returned an instance of "
9361 "BaseException, not %R",
9362 type, Py_TYPE(value));
9367 PyErr_SetString(PyExc_TypeError,
9368 "raise: exception class must be a subclass of BaseException");
9371 #if PY_VERSION_HEX >= 0x03030000
9374 if (cause && cause != Py_None) {
9376 PyObject *fixed_cause;
9377 if (cause == Py_None) {
9379 } else if (PyExceptionClass_Check(cause)) {
9380 fixed_cause = PyObject_CallObject(cause, NULL);
9381 if (fixed_cause == NULL)
9383 } else if (PyExceptionInstance_Check(cause)) {
9384 fixed_cause = cause;
9385 Py_INCREF(fixed_cause);
9387 PyErr_SetString(PyExc_TypeError,
9388 "exception causes must derive from "
9392 PyException_SetCause(value, fixed_cause);
9394 PyErr_SetObject(type, value);
9396 #if CYTHON_COMPILING_IN_PYPY
9397 PyObject *tmp_type, *tmp_value, *tmp_tb;
9398 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
9400 PyErr_Restore(tmp_type, tmp_value, tb);
9403 PyThreadState *tstate = PyThreadState_GET();
9404 PyObject* tmp_tb = tstate->curexc_traceback;
9407 tstate->curexc_traceback = tb;
9413 Py_XDECREF(owned_instance);
9418 /* RaiseTooManyValuesToUnpack */
9419 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
9420 PyErr_Format(PyExc_ValueError,
9421 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
9424 /* RaiseNeedMoreValuesToUnpack */
9425 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
9426 PyErr_Format(PyExc_ValueError,
9427 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
9428 index, (index == 1) ? "" : "s");
9431 /* RaiseNoneIterError */
9432 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
9433 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
9436 /* SaveResetException */
9437 #if CYTHON_FAST_THREAD_STATE
9438 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
9439 *type = tstate->exc_type;
9440 *value = tstate->exc_value;
9441 *tb = tstate->exc_traceback;
9446 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
9447 PyObject *tmp_type, *tmp_value, *tmp_tb;
9448 tmp_type = tstate->exc_type;
9449 tmp_value = tstate->exc_value;
9450 tmp_tb = tstate->exc_traceback;
9451 tstate->exc_type = type;
9452 tstate->exc_value = value;
9453 tstate->exc_traceback = tb;
9454 Py_XDECREF(tmp_type);
9455 Py_XDECREF(tmp_value);
9460 /* PyErrExceptionMatches */
9461 #if CYTHON_FAST_THREAD_STATE
9462 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
9463 PyObject *exc_type = tstate->curexc_type;
9464 if (exc_type == err) return 1;
9465 if (unlikely(!exc_type)) return 0;
9466 return PyErr_GivenExceptionMatches(exc_type, err);
9471 #if CYTHON_FAST_THREAD_STATE
9472 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
9474 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
9476 PyObject *local_type, *local_value, *local_tb;
9477 #if CYTHON_FAST_THREAD_STATE
9478 PyObject *tmp_type, *tmp_value, *tmp_tb;
9479 local_type = tstate->curexc_type;
9480 local_value = tstate->curexc_value;
9481 local_tb = tstate->curexc_traceback;
9482 tstate->curexc_type = 0;
9483 tstate->curexc_value = 0;
9484 tstate->curexc_traceback = 0;
9486 PyErr_Fetch(&local_type, &local_value, &local_tb);
9488 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
9489 #if CYTHON_FAST_THREAD_STATE
9490 if (unlikely(tstate->curexc_type))
9492 if (unlikely(PyErr_Occurred()))
9495 #if PY_MAJOR_VERSION >= 3
9497 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
9501 Py_XINCREF(local_tb);
9502 Py_XINCREF(local_type);
9503 Py_XINCREF(local_value);
9505 *value = local_value;
9507 #if CYTHON_FAST_THREAD_STATE
9508 tmp_type = tstate->exc_type;
9509 tmp_value = tstate->exc_value;
9510 tmp_tb = tstate->exc_traceback;
9511 tstate->exc_type = local_type;
9512 tstate->exc_value = local_value;
9513 tstate->exc_traceback = local_tb;
9514 Py_XDECREF(tmp_type);
9515 Py_XDECREF(tmp_value);
9518 PyErr_SetExcInfo(local_type, local_value, local_tb);
9525 Py_XDECREF(local_type);
9526 Py_XDECREF(local_value);
9527 Py_XDECREF(local_tb);
9532 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
9533 PyObject *empty_list = 0;
9534 PyObject *module = 0;
9535 PyObject *global_dict = 0;
9536 PyObject *empty_dict = 0;
9538 #if PY_VERSION_HEX < 0x03030000
9539 PyObject *py_import;
9540 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
9547 empty_list = PyList_New(0);
9552 global_dict = PyModule_GetDict(__pyx_m);
9555 empty_dict = PyDict_New();
9559 #if PY_MAJOR_VERSION >= 3
9561 if (strchr(__Pyx_MODULE_NAME, '.')) {
9562 #if PY_VERSION_HEX < 0x03030000
9563 PyObject *py_level = PyInt_FromLong(1);
9566 module = PyObject_CallFunctionObjArgs(py_import,
9567 name, global_dict, empty_dict, list, py_level, NULL);
9568 Py_DECREF(py_level);
9570 module = PyImport_ImportModuleLevelObject(
9571 name, global_dict, empty_dict, list, 1);
9574 if (!PyErr_ExceptionMatches(PyExc_ImportError))
9583 #if PY_VERSION_HEX < 0x03030000
9584 PyObject *py_level = PyInt_FromLong(level);
9587 module = PyObject_CallFunctionObjArgs(py_import,
9588 name, global_dict, empty_dict, list, py_level, NULL);
9589 Py_DECREF(py_level);
9591 module = PyImport_ImportModuleLevelObject(
9592 name, global_dict, empty_dict, list, level);
9597 #if PY_VERSION_HEX < 0x03030000
9598 Py_XDECREF(py_import);
9600 Py_XDECREF(empty_list);
9601 Py_XDECREF(empty_dict);
9605 /* CodeObjectCache */
9606 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
9607 int start = 0, mid = 0, end = count - 1;
9608 if (end >= 0 && code_line > entries[end].code_line) {
9611 while (start < end) {
9612 mid = start + (end - start) / 2;
9613 if (code_line < entries[mid].code_line) {
9615 } else if (code_line > entries[mid].code_line) {
9621 if (code_line <= entries[mid].code_line) {
9627 static PyCodeObject *__pyx_find_code_object(int code_line) {
9628 PyCodeObject* code_object;
9630 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
9633 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
9634 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
9637 code_object = __pyx_code_cache.entries[pos].code_object;
9638 Py_INCREF(code_object);
9641 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
9643 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
9644 if (unlikely(!code_line)) {
9647 if (unlikely(!entries)) {
9648 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
9649 if (likely(entries)) {
9650 __pyx_code_cache.entries = entries;
9651 __pyx_code_cache.max_count = 64;
9652 __pyx_code_cache.count = 1;
9653 entries[0].code_line = code_line;
9654 entries[0].code_object = code_object;
9655 Py_INCREF(code_object);
9659 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
9660 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
9661 PyCodeObject* tmp = entries[pos].code_object;
9662 entries[pos].code_object = code_object;
9666 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
9667 int new_max = __pyx_code_cache.max_count + 64;
9668 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
9669 __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
9670 if (unlikely(!entries)) {
9673 __pyx_code_cache.entries = entries;
9674 __pyx_code_cache.max_count = new_max;
9676 for (i=__pyx_code_cache.count; i>pos; i--) {
9677 entries[i] = entries[i-1];
9679 entries[pos].code_line = code_line;
9680 entries[pos].code_object = code_object;
9681 __pyx_code_cache.count++;
9682 Py_INCREF(code_object);
9686 #include "compile.h"
9687 #include "frameobject.h"
9688 #include "traceback.h"
9689 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
9690 const char *funcname, int c_line,
9691 int py_line, const char *filename) {
9692 PyCodeObject *py_code = 0;
9693 PyObject *py_srcfile = 0;
9694 PyObject *py_funcname = 0;
9695 #if PY_MAJOR_VERSION < 3
9696 py_srcfile = PyString_FromString(filename);
9698 py_srcfile = PyUnicode_FromString(filename);
9700 if (!py_srcfile) goto bad;
9702 #if PY_MAJOR_VERSION < 3
9703 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
9705 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
9709 #if PY_MAJOR_VERSION < 3
9710 py_funcname = PyString_FromString(funcname);
9712 py_funcname = PyUnicode_FromString(funcname);
9715 if (!py_funcname) goto bad;
9716 py_code = __Pyx_PyCode_New(
9722 __pyx_empty_bytes, /*PyObject *code,*/
9723 __pyx_empty_tuple, /*PyObject *consts,*/
9724 __pyx_empty_tuple, /*PyObject *names,*/
9725 __pyx_empty_tuple, /*PyObject *varnames,*/
9726 __pyx_empty_tuple, /*PyObject *freevars,*/
9727 __pyx_empty_tuple, /*PyObject *cellvars,*/
9728 py_srcfile, /*PyObject *filename,*/
9729 py_funcname, /*PyObject *name,*/
9731 __pyx_empty_bytes /*PyObject *lnotab*/
9733 Py_DECREF(py_srcfile);
9734 Py_DECREF(py_funcname);
9737 Py_XDECREF(py_srcfile);
9738 Py_XDECREF(py_funcname);
9741 static void __Pyx_AddTraceback(const char *funcname, int c_line,
9742 int py_line, const char *filename) {
9743 PyCodeObject *py_code = 0;
9744 PyFrameObject *py_frame = 0;
9745 py_code = __pyx_find_code_object(c_line ? c_line : py_line);
9747 py_code = __Pyx_CreateCodeObjectForTraceback(
9748 funcname, c_line, py_line, filename);
9749 if (!py_code) goto bad;
9750 __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
9752 py_frame = PyFrame_New(
9753 PyThreadState_GET(), /*PyThreadState *tstate,*/
9754 py_code, /*PyCodeObject *code,*/
9755 __pyx_d, /*PyObject *globals,*/
9756 0 /*PyObject *locals*/
9758 if (!py_frame) goto bad;
9759 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
9760 PyTraceBack_Here(py_frame);
9762 Py_XDECREF(py_code);
9763 Py_XDECREF(py_frame);
9766 #if PY_MAJOR_VERSION < 3
9767 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
9768 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
9769 if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
9770 PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
9773 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
9774 PyObject *obj = view->obj;
9776 if (PyObject_CheckBuffer(obj)) {
9777 PyBuffer_Release(view);
9780 if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
9788 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
9789 const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
9790 const int is_unsigned = neg_one > const_zero;
9792 if (sizeof(unsigned int) < sizeof(long)) {
9793 return PyInt_FromLong((long) value);
9794 } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
9795 return PyLong_FromUnsignedLong((unsigned long) value);
9796 #ifdef HAVE_LONG_LONG
9797 } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
9798 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9802 if (sizeof(unsigned int) <= sizeof(long)) {
9803 return PyInt_FromLong((long) value);
9804 #ifdef HAVE_LONG_LONG
9805 } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
9806 return PyLong_FromLongLong((PY_LONG_LONG) value);
9811 int one = 1; int little = (int)*(unsigned char *)&one;
9812 unsigned char *bytes = (unsigned char *)&value;
9813 return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
9814 little, !is_unsigned);
9818 /* CIntFromPyVerify */
9819 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
9820 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
9821 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
9822 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
9823 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
9825 func_type value = func_value;\
9826 if (sizeof(target_type) < sizeof(func_type)) {\
9827 if (unlikely(value != (func_type) (target_type) value)) {\
9828 func_type zero = 0;\
9829 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
9830 return (target_type) -1;\
9831 if (is_unsigned && unlikely(value < zero))\
9832 goto raise_neg_overflow;\
9834 goto raise_overflow;\
9837 return (target_type) value;\
9843 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
9844 return ::std::complex< float >(x, y);
9847 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
9848 return x + y*(__pyx_t_float_complex)_Complex_I;
9852 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
9853 __pyx_t_float_complex z;
9863 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9864 return (a.real == b.real) && (a.imag == b.imag);
9866 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9867 __pyx_t_float_complex z;
9868 z.real = a.real + b.real;
9869 z.imag = a.imag + b.imag;
9872 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9873 __pyx_t_float_complex z;
9874 z.real = a.real - b.real;
9875 z.imag = a.imag - b.imag;
9878 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9879 __pyx_t_float_complex z;
9880 z.real = a.real * b.real - a.imag * b.imag;
9881 z.imag = a.real * b.imag + a.imag * b.real;
9885 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9887 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
9888 } else if (fabsf(b.real) >= fabsf(b.imag)) {
9889 if (b.real == 0 && b.imag == 0) {
9890 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
9892 float r = b.imag / b.real;
9893 float s = 1.0 / (b.real + b.imag * r);
9894 return __pyx_t_float_complex_from_parts(
9895 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
9898 float r = b.real / b.imag;
9899 float s = 1.0 / (b.imag + b.real * r);
9900 return __pyx_t_float_complex_from_parts(
9901 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
9905 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9907 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
9909 float denom = b.real * b.real + b.imag * b.imag;
9910 return __pyx_t_float_complex_from_parts(
9911 (a.real * b.real + a.imag * b.imag) / denom,
9912 (a.imag * b.real - a.real * b.imag) / denom);
9916 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
9917 __pyx_t_float_complex z;
9922 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
9923 return (a.real == 0) && (a.imag == 0);
9925 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
9926 __pyx_t_float_complex z;
9932 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
9933 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
9934 return sqrtf(z.real*z.real + z.imag*z.imag);
9936 return hypotf(z.real, z.imag);
9939 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9940 __pyx_t_float_complex z;
9941 float r, lnr, theta, z_r, z_theta;
9942 if (b.imag == 0 && b.real == (int)b.real) {
9944 float denom = a.real * a.real + a.imag * a.imag;
9945 a.real = a.real / denom;
9946 a.imag = -a.imag / denom;
9949 switch ((int)b.real) {
9957 z = __Pyx_c_prod_float(a, a);
9958 return __Pyx_c_prod_float(a, a);
9960 z = __Pyx_c_prod_float(a, a);
9961 return __Pyx_c_prod_float(z, a);
9963 z = __Pyx_c_prod_float(a, a);
9964 return __Pyx_c_prod_float(z, z);
9970 } else if (b.imag == 0) {
9971 z.real = powf(a.real, b.real);
9974 } else if (a.real > 0) {
9979 theta = atan2f(0, -1);
9982 r = __Pyx_c_abs_float(a);
9983 theta = atan2f(a.imag, a.real);
9986 z_r = expf(lnr * b.real - theta * b.imag);
9987 z_theta = theta * b.real + lnr * b.imag;
9988 z.real = z_r * cosf(z_theta);
9989 z.imag = z_r * sinf(z_theta);
9998 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
9999 return ::std::complex< double >(x, y);
10002 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
10003 return x + y*(__pyx_t_double_complex)_Complex_I;
10007 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
10008 __pyx_t_double_complex z;
10016 #if CYTHON_CCOMPLEX
10018 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10019 return (a.real == b.real) && (a.imag == b.imag);
10021 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10022 __pyx_t_double_complex z;
10023 z.real = a.real + b.real;
10024 z.imag = a.imag + b.imag;
10027 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10028 __pyx_t_double_complex z;
10029 z.real = a.real - b.real;
10030 z.imag = a.imag - b.imag;
10033 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10034 __pyx_t_double_complex z;
10035 z.real = a.real * b.real - a.imag * b.imag;
10036 z.imag = a.real * b.imag + a.imag * b.real;
10040 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10042 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
10043 } else if (fabs(b.real) >= fabs(b.imag)) {
10044 if (b.real == 0 && b.imag == 0) {
10045 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
10047 double r = b.imag / b.real;
10048 double s = 1.0 / (b.real + b.imag * r);
10049 return __pyx_t_double_complex_from_parts(
10050 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
10053 double r = b.real / b.imag;
10054 double s = 1.0 / (b.imag + b.real * r);
10055 return __pyx_t_double_complex_from_parts(
10056 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
10060 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10062 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
10064 double denom = b.real * b.real + b.imag * b.imag;
10065 return __pyx_t_double_complex_from_parts(
10066 (a.real * b.real + a.imag * b.imag) / denom,
10067 (a.imag * b.real - a.real * b.imag) / denom);
10071 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
10072 __pyx_t_double_complex z;
10077 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
10078 return (a.real == 0) && (a.imag == 0);
10080 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
10081 __pyx_t_double_complex z;
10087 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
10088 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
10089 return sqrt(z.real*z.real + z.imag*z.imag);
10091 return hypot(z.real, z.imag);
10094 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10095 __pyx_t_double_complex z;
10096 double r, lnr, theta, z_r, z_theta;
10097 if (b.imag == 0 && b.real == (int)b.real) {
10099 double denom = a.real * a.real + a.imag * a.imag;
10100 a.real = a.real / denom;
10101 a.imag = -a.imag / denom;
10104 switch ((int)b.real) {
10112 z = __Pyx_c_prod_double(a, a);
10113 return __Pyx_c_prod_double(a, a);
10115 z = __Pyx_c_prod_double(a, a);
10116 return __Pyx_c_prod_double(z, a);
10118 z = __Pyx_c_prod_double(a, a);
10119 return __Pyx_c_prod_double(z, z);
10125 } else if (b.imag == 0) {
10126 z.real = pow(a.real, b.real);
10129 } else if (a.real > 0) {
10134 theta = atan2(0, -1);
10137 r = __Pyx_c_abs_double(a);
10138 theta = atan2(a.imag, a.real);
10141 z_r = exp(lnr * b.real - theta * b.imag);
10142 z_theta = theta * b.real + lnr * b.imag;
10143 z.real = z_r * cos(z_theta);
10144 z.imag = z_r * sin(z_theta);
10151 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
10152 const int neg_one = (int) -1, const_zero = (int) 0;
10153 const int is_unsigned = neg_one > const_zero;
10155 if (sizeof(int) < sizeof(long)) {
10156 return PyInt_FromLong((long) value);
10157 } else if (sizeof(int) <= sizeof(unsigned long)) {
10158 return PyLong_FromUnsignedLong((unsigned long) value);
10159 #ifdef HAVE_LONG_LONG
10160 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
10161 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
10165 if (sizeof(int) <= sizeof(long)) {
10166 return PyInt_FromLong((long) value);
10167 #ifdef HAVE_LONG_LONG
10168 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
10169 return PyLong_FromLongLong((PY_LONG_LONG) value);
10174 int one = 1; int little = (int)*(unsigned char *)&one;
10175 unsigned char *bytes = (unsigned char *)&value;
10176 return _PyLong_FromByteArray(bytes, sizeof(int),
10177 little, !is_unsigned);
10182 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
10183 const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0;
10184 const int is_unsigned = neg_one > const_zero;
10186 if (sizeof(enum NPY_TYPES) < sizeof(long)) {
10187 return PyInt_FromLong((long) value);
10188 } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
10189 return PyLong_FromUnsignedLong((unsigned long) value);
10190 #ifdef HAVE_LONG_LONG
10191 } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
10192 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
10196 if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
10197 return PyInt_FromLong((long) value);
10198 #ifdef HAVE_LONG_LONG
10199 } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
10200 return PyLong_FromLongLong((PY_LONG_LONG) value);
10205 int one = 1; int little = (int)*(unsigned char *)&one;
10206 unsigned char *bytes = (unsigned char *)&value;
10207 return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
10208 little, !is_unsigned);
10213 static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
10214 const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
10215 const int is_unsigned = neg_one > const_zero;
10216 #if PY_MAJOR_VERSION < 3
10217 if (likely(PyInt_Check(x))) {
10218 if (sizeof(unsigned int) < sizeof(long)) {
10219 __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
10221 long val = PyInt_AS_LONG(x);
10222 if (is_unsigned && unlikely(val < 0)) {
10223 goto raise_neg_overflow;
10225 return (unsigned int) val;
10229 if (likely(PyLong_Check(x))) {
10231 #if CYTHON_USE_PYLONG_INTERNALS
10232 const digit* digits = ((PyLongObject*)x)->ob_digit;
10233 switch (Py_SIZE(x)) {
10234 case 0: return (unsigned int) 0;
10235 case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0])
10237 if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
10238 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10239 __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10240 } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) {
10241 return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
10246 if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
10247 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10248 __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10249 } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) {
10250 return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
10255 if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
10256 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10257 __PYX_VERIFY_RETURN_INT(unsigned 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])))
10258 } else if (8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT) {
10259 return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
10265 #if CYTHON_COMPILING_IN_CPYTHON
10266 if (unlikely(Py_SIZE(x) < 0)) {
10267 goto raise_neg_overflow;
10271 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10272 if (unlikely(result < 0))
10273 return (unsigned int) -1;
10274 if (unlikely(result == 1))
10275 goto raise_neg_overflow;
10278 if (sizeof(unsigned int) <= sizeof(unsigned long)) {
10279 __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
10280 #ifdef HAVE_LONG_LONG
10281 } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
10282 __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
10286 #if CYTHON_USE_PYLONG_INTERNALS
10287 const digit* digits = ((PyLongObject*)x)->ob_digit;
10288 switch (Py_SIZE(x)) {
10289 case 0: return (unsigned int) 0;
10290 case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0]))
10291 case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +digits[0])
10293 if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) {
10294 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10295 __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10296 } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
10297 return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
10302 if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
10303 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10304 __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10305 } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
10306 return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
10311 if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
10312 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10313 __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10314 } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
10315 return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
10320 if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
10321 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10322 __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10323 } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
10324 return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
10329 if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
10330 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10331 __PYX_VERIFY_RETURN_INT(unsigned 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])))
10332 } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
10333 return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
10338 if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
10339 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10340 __PYX_VERIFY_RETURN_INT(unsigned 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])))
10341 } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
10342 return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
10348 if (sizeof(unsigned int) <= sizeof(long)) {
10349 __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
10350 #ifdef HAVE_LONG_LONG
10351 } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
10352 __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
10357 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
10358 PyErr_SetString(PyExc_RuntimeError,
10359 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
10362 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10363 #if PY_MAJOR_VERSION < 3
10364 if (likely(v) && !PyLong_Check(v)) {
10366 v = PyNumber_Long(tmp);
10371 int one = 1; int is_little = (int)*(unsigned char *)&one;
10372 unsigned char *bytes = (unsigned char *)&val;
10373 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10374 bytes, sizeof(val),
10375 is_little, !is_unsigned);
10381 return (unsigned int) -1;
10385 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10386 if (!tmp) return (unsigned int) -1;
10387 val = __Pyx_PyInt_As_unsigned_int(tmp);
10392 PyErr_SetString(PyExc_OverflowError,
10393 "value too large to convert to unsigned int");
10394 return (unsigned int) -1;
10395 raise_neg_overflow:
10396 PyErr_SetString(PyExc_OverflowError,
10397 "can't convert negative value to unsigned int");
10398 return (unsigned int) -1;
10402 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
10403 const int neg_one = (int) -1, const_zero = (int) 0;
10404 const int is_unsigned = neg_one > const_zero;
10405 #if PY_MAJOR_VERSION < 3
10406 if (likely(PyInt_Check(x))) {
10407 if (sizeof(int) < sizeof(long)) {
10408 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
10410 long val = PyInt_AS_LONG(x);
10411 if (is_unsigned && unlikely(val < 0)) {
10412 goto raise_neg_overflow;
10418 if (likely(PyLong_Check(x))) {
10420 #if CYTHON_USE_PYLONG_INTERNALS
10421 const digit* digits = ((PyLongObject*)x)->ob_digit;
10422 switch (Py_SIZE(x)) {
10423 case 0: return (int) 0;
10424 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
10426 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
10427 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10428 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10429 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
10430 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
10435 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
10436 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10437 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10438 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
10439 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
10444 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
10445 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10446 __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])))
10447 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
10448 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
10454 #if CYTHON_COMPILING_IN_CPYTHON
10455 if (unlikely(Py_SIZE(x) < 0)) {
10456 goto raise_neg_overflow;
10460 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10461 if (unlikely(result < 0))
10463 if (unlikely(result == 1))
10464 goto raise_neg_overflow;
10467 if (sizeof(int) <= sizeof(unsigned long)) {
10468 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
10469 #ifdef HAVE_LONG_LONG
10470 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
10471 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
10475 #if CYTHON_USE_PYLONG_INTERNALS
10476 const digit* digits = ((PyLongObject*)x)->ob_digit;
10477 switch (Py_SIZE(x)) {
10478 case 0: return (int) 0;
10479 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
10480 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
10482 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
10483 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10484 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10485 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
10486 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
10491 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
10492 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10493 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10494 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
10495 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
10500 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
10501 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10502 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10503 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
10504 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
10509 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
10510 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10511 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10512 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
10513 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
10518 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
10519 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10520 __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])))
10521 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
10522 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
10527 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
10528 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10529 __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])))
10530 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
10531 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
10537 if (sizeof(int) <= sizeof(long)) {
10538 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
10539 #ifdef HAVE_LONG_LONG
10540 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
10541 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
10546 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
10547 PyErr_SetString(PyExc_RuntimeError,
10548 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
10551 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10552 #if PY_MAJOR_VERSION < 3
10553 if (likely(v) && !PyLong_Check(v)) {
10555 v = PyNumber_Long(tmp);
10560 int one = 1; int is_little = (int)*(unsigned char *)&one;
10561 unsigned char *bytes = (unsigned char *)&val;
10562 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10563 bytes, sizeof(val),
10564 is_little, !is_unsigned);
10574 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10575 if (!tmp) return (int) -1;
10576 val = __Pyx_PyInt_As_int(tmp);
10581 PyErr_SetString(PyExc_OverflowError,
10582 "value too large to convert to int");
10584 raise_neg_overflow:
10585 PyErr_SetString(PyExc_OverflowError,
10586 "can't convert negative value to int");
10591 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
10592 const long neg_one = (long) -1, const_zero = (long) 0;
10593 const int is_unsigned = neg_one > const_zero;
10595 if (sizeof(long) < sizeof(long)) {
10596 return PyInt_FromLong((long) value);
10597 } else if (sizeof(long) <= sizeof(unsigned long)) {
10598 return PyLong_FromUnsignedLong((unsigned long) value);
10599 #ifdef HAVE_LONG_LONG
10600 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
10601 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
10605 if (sizeof(long) <= sizeof(long)) {
10606 return PyInt_FromLong((long) value);
10607 #ifdef HAVE_LONG_LONG
10608 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
10609 return PyLong_FromLongLong((PY_LONG_LONG) value);
10614 int one = 1; int little = (int)*(unsigned char *)&one;
10615 unsigned char *bytes = (unsigned char *)&value;
10616 return _PyLong_FromByteArray(bytes, sizeof(long),
10617 little, !is_unsigned);
10622 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
10623 const long neg_one = (long) -1, const_zero = (long) 0;
10624 const int is_unsigned = neg_one > const_zero;
10625 #if PY_MAJOR_VERSION < 3
10626 if (likely(PyInt_Check(x))) {
10627 if (sizeof(long) < sizeof(long)) {
10628 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
10630 long val = PyInt_AS_LONG(x);
10631 if (is_unsigned && unlikely(val < 0)) {
10632 goto raise_neg_overflow;
10638 if (likely(PyLong_Check(x))) {
10640 #if CYTHON_USE_PYLONG_INTERNALS
10641 const digit* digits = ((PyLongObject*)x)->ob_digit;
10642 switch (Py_SIZE(x)) {
10643 case 0: return (long) 0;
10644 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
10646 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
10647 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10648 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10649 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
10650 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
10655 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
10656 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10657 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10658 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
10659 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
10664 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
10665 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10666 __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])))
10667 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
10668 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
10674 #if CYTHON_COMPILING_IN_CPYTHON
10675 if (unlikely(Py_SIZE(x) < 0)) {
10676 goto raise_neg_overflow;
10680 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10681 if (unlikely(result < 0))
10683 if (unlikely(result == 1))
10684 goto raise_neg_overflow;
10687 if (sizeof(long) <= sizeof(unsigned long)) {
10688 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
10689 #ifdef HAVE_LONG_LONG
10690 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
10691 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
10695 #if CYTHON_USE_PYLONG_INTERNALS
10696 const digit* digits = ((PyLongObject*)x)->ob_digit;
10697 switch (Py_SIZE(x)) {
10698 case 0: return (long) 0;
10699 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
10700 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
10702 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
10703 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10704 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10705 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
10706 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10711 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
10712 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10713 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10714 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
10715 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10720 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
10721 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10722 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10723 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
10724 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10729 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
10730 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10731 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10732 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
10733 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10738 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
10739 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10740 __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])))
10741 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
10742 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10747 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
10748 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10749 __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])))
10750 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
10751 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10757 if (sizeof(long) <= sizeof(long)) {
10758 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
10759 #ifdef HAVE_LONG_LONG
10760 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
10761 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
10766 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
10767 PyErr_SetString(PyExc_RuntimeError,
10768 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
10771 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10772 #if PY_MAJOR_VERSION < 3
10773 if (likely(v) && !PyLong_Check(v)) {
10775 v = PyNumber_Long(tmp);
10780 int one = 1; int is_little = (int)*(unsigned char *)&one;
10781 unsigned char *bytes = (unsigned char *)&val;
10782 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10783 bytes, sizeof(val),
10784 is_little, !is_unsigned);
10794 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10795 if (!tmp) return (long) -1;
10796 val = __Pyx_PyInt_As_long(tmp);
10801 PyErr_SetString(PyExc_OverflowError,
10802 "value too large to convert to long");
10804 raise_neg_overflow:
10805 PyErr_SetString(PyExc_OverflowError,
10806 "can't convert negative value to long");
10810 /* CheckBinaryVersion */
10811 static int __Pyx_check_binary_version(void) {
10812 char ctversion[4], rtversion[4];
10813 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
10814 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
10815 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
10817 PyOS_snprintf(message, sizeof(message),
10818 "compiletime version %s of module '%.100s' "
10819 "does not match runtime version %s",
10820 ctversion, __Pyx_MODULE_NAME, rtversion);
10821 return PyErr_WarnEx(NULL, message, 1);
10827 #ifndef __PYX_HAVE_RT_ImportModule
10828 #define __PYX_HAVE_RT_ImportModule
10829 static PyObject *__Pyx_ImportModule(const char *name) {
10830 PyObject *py_name = 0;
10831 PyObject *py_module = 0;
10832 py_name = __Pyx_PyIdentifier_FromString(name);
10835 py_module = PyImport_Import(py_name);
10836 Py_DECREF(py_name);
10839 Py_XDECREF(py_name);
10845 #ifndef __PYX_HAVE_RT_ImportType
10846 #define __PYX_HAVE_RT_ImportType
10847 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
10848 size_t size, int strict)
10850 PyObject *py_module = 0;
10851 PyObject *result = 0;
10852 PyObject *py_name = 0;
10854 Py_ssize_t basicsize;
10855 #ifdef Py_LIMITED_API
10856 PyObject *py_basicsize;
10858 py_module = __Pyx_ImportModule(module_name);
10861 py_name = __Pyx_PyIdentifier_FromString(class_name);
10864 result = PyObject_GetAttr(py_module, py_name);
10865 Py_DECREF(py_name);
10867 Py_DECREF(py_module);
10871 if (!PyType_Check(result)) {
10872 PyErr_Format(PyExc_TypeError,
10873 "%.200s.%.200s is not a type object",
10874 module_name, class_name);
10877 #ifndef Py_LIMITED_API
10878 basicsize = ((PyTypeObject *)result)->tp_basicsize;
10880 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
10883 basicsize = PyLong_AsSsize_t(py_basicsize);
10884 Py_DECREF(py_basicsize);
10886 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
10889 if (!strict && (size_t)basicsize > size) {
10890 PyOS_snprintf(warning, sizeof(warning),
10891 "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
10892 module_name, class_name, basicsize, size);
10893 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
10895 else if ((size_t)basicsize != size) {
10896 PyErr_Format(PyExc_ValueError,
10897 "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
10898 module_name, class_name, basicsize, size);
10901 return (PyTypeObject *)result;
10903 Py_XDECREF(py_module);
10904 Py_XDECREF(result);
10910 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
10912 #if PY_MAJOR_VERSION < 3
10913 if (t->is_unicode) {
10914 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
10915 } else if (t->intern) {
10916 *t->p = PyString_InternFromString(t->s);
10918 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
10921 if (t->is_unicode | t->is_str) {
10923 *t->p = PyUnicode_InternFromString(t->s);
10924 } else if (t->encoding) {
10925 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
10927 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
10930 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
10940 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
10941 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
10943 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
10945 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
10947 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
10948 #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
10950 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
10951 __Pyx_sys_getdefaultencoding_not_ascii &&
10953 PyUnicode_Check(o)) {
10954 #if PY_VERSION_HEX < 0x03030000
10956 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
10957 if (!defenc) return NULL;
10958 defenc_c = PyBytes_AS_STRING(defenc);
10959 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
10961 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
10963 for (c = defenc_c; c < end; c++) {
10964 if ((unsigned char) (*c) >= 128) {
10965 PyUnicode_AsASCIIString(o);
10971 *length = PyBytes_GET_SIZE(defenc);
10974 if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
10975 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
10976 if (PyUnicode_IS_ASCII(o)) {
10977 *length = PyUnicode_GET_LENGTH(o);
10978 return PyUnicode_AsUTF8(o);
10980 PyUnicode_AsASCIIString(o);
10984 return PyUnicode_AsUTF8AndSize(o, length);
10989 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
10990 if (PyByteArray_Check(o)) {
10991 *length = PyByteArray_GET_SIZE(o);
10992 return PyByteArray_AS_STRING(o);
10997 int r = PyBytes_AsStringAndSize(o, &result, length);
10998 if (unlikely(r < 0)) {
11005 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
11006 int is_true = x == Py_True;
11007 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
11008 else return PyObject_IsTrue(x);
11010 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
11011 #if CYTHON_USE_TYPE_SLOTS
11012 PyNumberMethods *m;
11014 const char *name = NULL;
11015 PyObject *res = NULL;
11016 #if PY_MAJOR_VERSION < 3
11017 if (PyInt_Check(x) || PyLong_Check(x))
11019 if (PyLong_Check(x))
11021 return __Pyx_NewRef(x);
11022 #if CYTHON_USE_TYPE_SLOTS
11023 m = Py_TYPE(x)->tp_as_number;
11024 #if PY_MAJOR_VERSION < 3
11025 if (m && m->nb_int) {
11027 res = PyNumber_Int(x);
11029 else if (m && m->nb_long) {
11031 res = PyNumber_Long(x);
11034 if (m && m->nb_int) {
11036 res = PyNumber_Long(x);
11040 res = PyNumber_Int(x);
11043 #if PY_MAJOR_VERSION < 3
11044 if (!PyInt_Check(res) && !PyLong_Check(res)) {
11046 if (!PyLong_Check(res)) {
11048 PyErr_Format(PyExc_TypeError,
11049 "__%.4s__ returned non-%.4s (type %.200s)",
11050 name, name, Py_TYPE(res)->tp_name);
11055 else if (!PyErr_Occurred()) {
11056 PyErr_SetString(PyExc_TypeError,
11057 "an integer is required");
11061 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
11064 #if PY_MAJOR_VERSION < 3
11065 if (likely(PyInt_CheckExact(b))) {
11066 if (sizeof(Py_ssize_t) >= sizeof(long))
11067 return PyInt_AS_LONG(b);
11069 return PyInt_AsSsize_t(x);
11072 if (likely(PyLong_CheckExact(b))) {
11073 #if CYTHON_USE_PYLONG_INTERNALS
11074 const digit* digits = ((PyLongObject*)b)->ob_digit;
11075 const Py_ssize_t size = Py_SIZE(b);
11076 if (likely(__Pyx_sst_abs(size) <= 1)) {
11077 ival = likely(size) ? digits[0] : 0;
11078 if (size == -1) ival = -ival;
11083 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
11084 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11088 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
11089 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11093 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
11094 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11098 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
11099 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11103 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
11104 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]));
11108 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
11109 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]));
11115 return PyLong_AsSsize_t(b);
11117 x = PyNumber_Index(b);
11119 ival = PyInt_AsSsize_t(x);
11123 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
11124 return PyInt_FromSize_t(ival);
11128 #endif /* Py_PYTHON_H */