EG version upgrade to 1.3
[ealt-edge.git] / example-apps / PDD / pcb-defect-detection / libs / box_utils / cython_utils / bbox.c
1 /* Generated by Cython 0.25.2 */
2
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6     #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
8     #error Cython requires Python 2.6+ or Python 3.2+.
9 #else
10 #define CYTHON_ABI "0_25_2"
11 #include <stddef.h>
12 #ifndef offsetof
13   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14 #endif
15 #if !defined(WIN32) && !defined(MS_WINDOWS)
16   #ifndef __stdcall
17     #define __stdcall
18   #endif
19   #ifndef __cdecl
20     #define __cdecl
21   #endif
22   #ifndef __fastcall
23     #define __fastcall
24   #endif
25 #endif
26 #ifndef DL_IMPORT
27   #define DL_IMPORT(t) t
28 #endif
29 #ifndef DL_EXPORT
30   #define DL_EXPORT(t) t
31 #endif
32 #ifndef HAVE_LONG_LONG
33   #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
34     #define HAVE_LONG_LONG
35   #endif
36 #endif
37 #ifndef PY_LONG_LONG
38   #define PY_LONG_LONG LONG_LONG
39 #endif
40 #ifndef Py_HUGE_VAL
41   #define Py_HUGE_VAL HUGE_VAL
42 #endif
43 #ifdef PYPY_VERSION
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
75   #endif
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
82   #endif
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
89   #endif
90   #ifndef CYTHON_ASSUME_SAFE_MACROS
91     #define CYTHON_ASSUME_SAFE_MACROS 1
92   #endif
93   #ifndef CYTHON_UNPACK_METHODS
94     #define CYTHON_UNPACK_METHODS 1
95   #endif
96   #undef CYTHON_FAST_THREAD_STATE
97   #define CYTHON_FAST_THREAD_STATE 0
98   #undef CYTHON_FAST_PYCALL
99   #define CYTHON_FAST_PYCALL 0
100 #else
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
106   #endif
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
112   #endif
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
118   #endif
119   #ifndef CYTHON_USE_PYLIST_INTERNALS
120     #define CYTHON_USE_PYLIST_INTERNALS 1
121   #endif
122   #ifndef CYTHON_USE_UNICODE_INTERNALS
123     #define CYTHON_USE_UNICODE_INTERNALS 1
124   #endif
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
130   #endif
131   #ifndef CYTHON_AVOID_BORROWED_REFS
132     #define CYTHON_AVOID_BORROWED_REFS 0
133   #endif
134   #ifndef CYTHON_ASSUME_SAFE_MACROS
135     #define CYTHON_ASSUME_SAFE_MACROS 1
136   #endif
137   #ifndef CYTHON_UNPACK_METHODS
138     #define CYTHON_UNPACK_METHODS 1
139   #endif
140   #ifndef CYTHON_FAST_THREAD_STATE
141     #define CYTHON_FAST_THREAD_STATE 1
142   #endif
143   #ifndef CYTHON_FAST_PYCALL
144     #define CYTHON_FAST_PYCALL 1
145   #endif
146 #endif
147 #if !defined(CYTHON_FAST_PYCCALL)
148 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
149 #endif
150 #if CYTHON_USE_PYLONG_INTERNALS
151   #include "longintrepr.h"
152   #undef SHIFT
153   #undef BASE
154   #undef MASK
155 #endif
156 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
157   #define Py_OptimizeFlag 0
158 #endif
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
166 #else
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
171 #endif
172 #ifndef Py_TPFLAGS_CHECKTYPES
173   #define Py_TPFLAGS_CHECKTYPES 0
174 #endif
175 #ifndef Py_TPFLAGS_HAVE_INDEX
176   #define Py_TPFLAGS_HAVE_INDEX 0
177 #endif
178 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
179   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
180 #endif
181 #ifndef Py_TPFLAGS_HAVE_FINALIZE
182   #define Py_TPFLAGS_HAVE_FINALIZE 0
183 #endif
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);
188 #else
189   #define __Pyx_PyCFunctionFast _PyCFunctionFast
190 #endif
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)))))
194 #else
195 #define __Pyx_PyFastCFunction_Check(func) 0
196 #endif
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)))
209 #else
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))
223 #endif
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)
227 #else
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))
231 #endif
232 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
233   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
234 #endif
235 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
236   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
237 #endif
238 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
239   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
240 #endif
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)
245 #endif
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)
249 #else
250   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
251   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
252 #endif
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)
257 #else
258   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
259 #endif
260 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
261   #define PyObject_ASCII(o)            PyObject_Repr(o)
262 #endif
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
269 #endif
270 #if PY_MAJOR_VERSION >= 3
271   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
272   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
273 #else
274   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
275   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
276 #endif
277 #ifndef PySet_CheckExact
278   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
279 #endif
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
298 #endif
299 #if PY_MAJOR_VERSION >= 3
300   #define PyBoolObject                 PyLongObject
301 #endif
302 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
303   #ifndef PyUnicode_InternFromString
304     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
305   #endif
306 #endif
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
311 #else
312   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
313   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
314 #endif
315 #if PY_MAJOR_VERSION >= 3
316   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
317 #else
318   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
319 #endif
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)
324   #else
325     typedef struct {
326         unaryfunc am_await;
327         unaryfunc am_aiter;
328         unaryfunc am_anext;
329     } __Pyx_PyAsyncMethodsStruct;
330     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
331   #endif
332 #else
333   #define __Pyx_PyType_AsAsync(obj) NULL
334 #endif
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
342   #else
343     #define CYTHON_RESTRICT
344   #endif
345 #endif
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__))
350 #   else
351 #     define CYTHON_UNUSED
352 #   endif
353 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
354 #   define CYTHON_UNUSED __attribute__ ((__unused__))
355 # else
356 #   define CYTHON_UNUSED
357 # endif
358 #endif
359 #ifndef CYTHON_MAYBE_UNUSED_VAR
360 #  if defined(__cplusplus)
361      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
362 #  else
363 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
364 #  endif
365 #endif
366 #ifndef CYTHON_NCP_UNUSED
367 # if CYTHON_COMPILING_IN_CPYTHON
368 #  define CYTHON_NCP_UNUSED
369 # else
370 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
371 # endif
372 #endif
373 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
374
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
384   #else
385     #define CYTHON_INLINE
386   #endif
387 #endif
388
389 #if defined(WIN32) || defined(MS_WINDOWS)
390   #define _USE_MATH_DEFINES
391 #endif
392 #include <math.h>
393 #ifdef NAN
394 #define __PYX_NAN() ((float) NAN)
395 #else
396 static CYTHON_INLINE float __PYX_NAN() {
397   float value;
398   memset(&value, 0xFF, sizeof(value));
399   return value;
400 }
401 #endif
402 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
403 #define __Pyx_truncl trunc
404 #else
405 #define __Pyx_truncl truncl
406 #endif
407
408
409 #define __PYX_ERR(f_index, lineno, Ln_error) \
410 { \
411   __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
412 }
413
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)
417 #else
418   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
419   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
420 #endif
421
422 #ifndef __PYX_EXTERN_C
423   #ifdef __cplusplus
424     #define __PYX_EXTERN_C extern "C"
425   #else
426     #define __PYX_EXTERN_C extern
427   #endif
428 #endif
429
430 #define __PYX_HAVE__cython_bbox
431 #define __PYX_HAVE_API__cython_bbox
432 #include <string.h>
433 #include <stdio.h>
434 #include <stdlib.h>
435 #include "numpy/arrayobject.h"
436 #include "numpy/ufuncobject.h"
437 #ifdef _OPENMP
438 #include <omp.h>
439 #endif /* _OPENMP */
440
441 #ifdef PYREX_WITHOUT_ASSERTIONS
442 #define CYTHON_WITHOUT_ASSERTIONS
443 #endif
444
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;
447
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
466     #include <cstdlib>
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)
478 #else
479     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
480 #endif
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
491 #else
492     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
493     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
494 #endif
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)
504 {
505     const Py_UNICODE *u_end = u;
506     while (*u_end++) ;
507     return (size_t)(u_end - u - 1);
508 }
509 #else
510 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
511 #endif
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))
524 #else
525 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
526 #endif
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))
530 #else
531 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
532 #endif
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) {
537     PyObject* sys;
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");
543     if (!sys) goto bad;
544     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
545     Py_DECREF(sys);
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;
551     } else {
552         char ascii_chars[128];
553         int c;
554         for (c = 0; c < 128; c++) {
555             ascii_chars[c] = c;
556         }
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) {
562             PyErr_Format(
563                 PyExc_ValueError,
564                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
565                 default_encoding_c);
566             goto bad;
567         }
568         Py_DECREF(ascii_chars_u);
569         Py_DECREF(ascii_chars_b);
570     }
571     Py_DECREF(default_encoding);
572     return 0;
573 bad:
574     Py_XDECREF(default_encoding);
575     Py_XDECREF(ascii_chars_u);
576     Py_XDECREF(ascii_chars_b);
577     return -1;
578 }
579 #endif
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)
582 #else
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) {
587     PyObject* sys;
588     PyObject* default_encoding = NULL;
589     char* default_encoding_c;
590     sys = PyImport_ImportModule("sys");
591     if (!sys) goto bad;
592     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
593     Py_DECREF(sys);
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);
601     return 0;
602 bad:
603     Py_XDECREF(default_encoding);
604     return -1;
605 }
606 #endif
607 #endif
608
609
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__ */
618
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;
629
630 /* Header.proto */
631 #if !defined(CYTHON_CCOMPLEX)
632   #if defined(__cplusplus)
633     #define CYTHON_CCOMPLEX 1
634   #elif defined(_Complex_I)
635     #define CYTHON_CCOMPLEX 1
636   #else
637     #define CYTHON_CCOMPLEX 0
638   #endif
639 #endif
640 #if CYTHON_CCOMPLEX
641   #ifdef __cplusplus
642     #include <complex>
643   #else
644     #include <complex.h>
645   #endif
646 #endif
647 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
648   #undef _Complex_I
649   #define _Complex_I 1.0fj
650 #endif
651
652
653 static const char *__pyx_f[] = {
654   "_utils/bbox.pyx",
655   "__init__.pxd",
656   "type.pxd",
657 };
658 /* BufferFormatStructs.proto */
659 #define IS_UNSIGNED(type) (((type) -1) > 0)
660 struct __Pyx_StructField_;
661 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
662 typedef struct {
663   const char* name;
664   struct __Pyx_StructField_* fields;
665   size_t size;
666   size_t arraysize[8];
667   int ndim;
668   char typegroup;
669   char is_unsigned;
670   int flags;
671 } __Pyx_TypeInfo;
672 typedef struct __Pyx_StructField_ {
673   __Pyx_TypeInfo* type;
674   const char* name;
675   size_t offset;
676 } __Pyx_StructField;
677 typedef struct {
678   __Pyx_StructField* field;
679   size_t parent_offset;
680 } __Pyx_BufFmt_StackElem;
681 typedef struct {
682   __Pyx_StructField root;
683   __Pyx_BufFmt_StackElem* head;
684   size_t fmt_offset;
685   size_t new_count, enc_count;
686   size_t struct_alignment;
687   int is_complex;
688   char enc_type;
689   char new_packmode;
690   char enc_packmode;
691   char is_valid_array;
692 } __Pyx_BufFmt_Context;
693
694
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.
697  * 
698  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
699  * ctypedef npy_int16      int16_t
700  * ctypedef npy_int32      int32_t
701  */
702 typedef npy_int8 __pyx_t_5numpy_int8_t;
703
704 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":726
705  * 
706  * ctypedef npy_int8       int8_t
707  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
708  * ctypedef npy_int32      int32_t
709  * ctypedef npy_int64      int64_t
710  */
711 typedef npy_int16 __pyx_t_5numpy_int16_t;
712
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
719  */
720 typedef npy_int32 __pyx_t_5numpy_int32_t;
721
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
728  */
729 typedef npy_int64 __pyx_t_5numpy_int64_t;
730
731 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":732
732  * #ctypedef npy_int128     int128_t
733  * 
734  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
735  * ctypedef npy_uint16     uint16_t
736  * ctypedef npy_uint32     uint32_t
737  */
738 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
739
740 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":733
741  * 
742  * ctypedef npy_uint8      uint8_t
743  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
744  * ctypedef npy_uint32     uint32_t
745  * ctypedef npy_uint64     uint64_t
746  */
747 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
748
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
755  */
756 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
757
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
764  */
765 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
766
767 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":739
768  * #ctypedef npy_uint128    uint128_t
769  * 
770  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
771  * ctypedef npy_float64    float64_t
772  * #ctypedef npy_float80    float80_t
773  */
774 typedef npy_float32 __pyx_t_5numpy_float32_t;
775
776 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":740
777  * 
778  * ctypedef npy_float32    float32_t
779  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
780  * #ctypedef npy_float80    float80_t
781  * #ctypedef npy_float128   float128_t
782  */
783 typedef npy_float64 __pyx_t_5numpy_float64_t;
784
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
791  */
792 typedef npy_long __pyx_t_5numpy_int_t;
793
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
799  * 
800  */
801 typedef npy_longlong __pyx_t_5numpy_long_t;
802
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             # <<<<<<<<<<<<<<
807  * 
808  * ctypedef npy_ulong      uint_t
809  */
810 typedef npy_longlong __pyx_t_5numpy_longlong_t;
811
812 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":753
813  * ctypedef npy_longlong   longlong_t
814  * 
815  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
816  * ctypedef npy_ulonglong  ulong_t
817  * ctypedef npy_ulonglong  ulonglong_t
818  */
819 typedef npy_ulong __pyx_t_5numpy_uint_t;
820
821 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":754
822  * 
823  * ctypedef npy_ulong      uint_t
824  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
825  * ctypedef npy_ulonglong  ulonglong_t
826  * 
827  */
828 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
829
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             # <<<<<<<<<<<<<<
834  * 
835  * ctypedef npy_intp       intp_t
836  */
837 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
838
839 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":757
840  * ctypedef npy_ulonglong  ulonglong_t
841  * 
842  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
843  * ctypedef npy_uintp      uintp_t
844  * 
845  */
846 typedef npy_intp __pyx_t_5numpy_intp_t;
847
848 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758
849  * 
850  * ctypedef npy_intp       intp_t
851  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
852  * 
853  * ctypedef npy_double     float_t
854  */
855 typedef npy_uintp __pyx_t_5numpy_uintp_t;
856
857 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":760
858  * ctypedef npy_uintp      uintp_t
859  * 
860  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
861  * ctypedef npy_double     double_t
862  * ctypedef npy_longdouble longdouble_t
863  */
864 typedef npy_double __pyx_t_5numpy_float_t;
865
866 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":761
867  * 
868  * ctypedef npy_double     float_t
869  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
870  * ctypedef npy_longdouble longdouble_t
871  * 
872  */
873 typedef npy_double __pyx_t_5numpy_double_t;
874
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             # <<<<<<<<<<<<<<
879  * 
880  * ctypedef npy_cfloat      cfloat_t
881  */
882 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
883
884 /* "bbox.pyx":13
885  * 
886  * DTYPE = np.float
887  * ctypedef np.float_t DTYPE_t             # <<<<<<<<<<<<<<
888  * 
889  * def bbox_overlaps_float(
890  */
891 typedef __pyx_t_5numpy_float_t __pyx_t_11cython_bbox_DTYPE_t;
892 /* Declarations.proto */
893 #if CYTHON_CCOMPLEX
894   #ifdef __cplusplus
895     typedef ::std::complex< float > __pyx_t_float_complex;
896   #else
897     typedef float _Complex __pyx_t_float_complex;
898   #endif
899 #else
900     typedef struct { float real, imag; } __pyx_t_float_complex;
901 #endif
902 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
903
904 /* Declarations.proto */
905 #if CYTHON_CCOMPLEX
906   #ifdef __cplusplus
907     typedef ::std::complex< double > __pyx_t_double_complex;
908   #else
909     typedef double _Complex __pyx_t_double_complex;
910   #endif
911 #else
912     typedef struct { double real, imag; } __pyx_t_double_complex;
913 #endif
914 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
915
916
917 /*--- Type declarations ---*/
918
919 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":764
920  * ctypedef npy_longdouble longdouble_t
921  * 
922  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
923  * ctypedef npy_cdouble     cdouble_t
924  * ctypedef npy_clongdouble clongdouble_t
925  */
926 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
927
928 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":765
929  * 
930  * ctypedef npy_cfloat      cfloat_t
931  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
932  * ctypedef npy_clongdouble clongdouble_t
933  * 
934  */
935 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
936
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             # <<<<<<<<<<<<<<
941  * 
942  * ctypedef npy_cdouble     complex_t
943  */
944 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
945
946 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":768
947  * ctypedef npy_clongdouble clongdouble_t
948  * 
949  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
950  * 
951  * cdef inline object PyArray_MultiIterNew1(a):
952  */
953 typedef npy_cdouble __pyx_t_5numpy_complex_t;
954
955 /* --- Runtime support code (head) --- */
956 /* Refnanny.proto */
957 #ifndef CYTHON_REFNANNY
958   #define CYTHON_REFNANNY 0
959 #endif
960 #if CYTHON_REFNANNY
961   typedef struct {
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;
972 #ifdef WITH_THREAD
973   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
974           if (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);\
978           } else {\
979               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
980           }
981 #else
982   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
983           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
984 #endif
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)
995 #else
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)
1007 #endif
1008 #define __Pyx_XDECREF_SET(r, v) do {\
1009         PyObject *tmp = (PyObject *) r;\
1010         r = v; __Pyx_XDECREF(tmp);\
1011     } while (0)
1012 #define __Pyx_DECREF_SET(r, v) do {\
1013         PyObject *tmp = (PyObject *) r;\
1014         r = v; __Pyx_DECREF(tmp);\
1015     } while (0)
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)
1018
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));
1028 #endif
1029     return PyObject_GetAttr(obj, attr_name);
1030 }
1031 #else
1032 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1033 #endif
1034
1035 /* GetBuiltinName.proto */
1036 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1037
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);
1041
1042 /* RaiseDoubleKeywords.proto */
1043 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1044
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);
1049
1050 /* ArgTypeTest.proto */
1051 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
1052     const char *name, int exact);
1053
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
1062
1063 /* GetModuleGlobalName.proto */
1064 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
1065
1066 /* PyObjectCall.proto */
1067 #if CYTHON_COMPILING_IN_CPYTHON
1068 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1069 #else
1070 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1071 #endif
1072
1073 /* ExtTypeTest.proto */
1074 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1075
1076 /* BufferIndexError.proto */
1077 static void __Pyx_RaiseBufferIndexError(int axis);
1078
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();
1084 #else
1085 #define __Pyx_PyThreadState_declare
1086 #define __Pyx_PyThreadState_assign
1087 #endif
1088
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);
1097 #else
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)
1102 #endif
1103
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);
1107
1108 /* DictGetItem.proto */
1109 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1110 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
1111     PyObject *value;
1112     value = PyDict_GetItemWithError(d, key);
1113     if (unlikely(!value)) {
1114         if (!PyErr_Occurred()) {
1115             PyObject* args = PyTuple_Pack(1, key);
1116             if (likely(args))
1117                 PyErr_SetObject(PyExc_KeyError, args);
1118             Py_XDECREF(args);
1119         }
1120         return NULL;
1121     }
1122     Py_INCREF(value);
1123     return value;
1124 }
1125 #else
1126     #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1127 #endif
1128
1129 /* RaiseTooManyValuesToUnpack.proto */
1130 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1131
1132 /* RaiseNeedMoreValuesToUnpack.proto */
1133 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1134
1135 /* RaiseNoneIterError.proto */
1136 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1137
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);
1144 #else
1145 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1146 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1147 #endif
1148
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);
1153 #else
1154 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1155 #endif
1156
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);
1161 #else
1162 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1163 #endif
1164
1165 /* Import.proto */
1166 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1167
1168 /* CodeObjectCache.proto */
1169 typedef struct {
1170     PyCodeObject* code_object;
1171     int code_line;
1172 } __Pyx_CodeObjectCacheEntry;
1173 struct __Pyx_CodeObjectCache {
1174     int count;
1175     int max_count;
1176     __Pyx_CodeObjectCacheEntry* entries;
1177 };
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);
1182
1183 /* AddTraceback.proto */
1184 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1185                                int py_line, const char *filename);
1186
1187 /* BufferStructDeclare.proto */
1188 typedef struct {
1189   Py_ssize_t shape, strides, suboffsets;
1190 } __Pyx_Buf_DimInfo;
1191 typedef struct {
1192   size_t refcount;
1193   Py_buffer pybuffer;
1194 } __Pyx_Buffer;
1195 typedef struct {
1196   __Pyx_Buffer *rcbuffer;
1197   char *data;
1198   __Pyx_Buf_DimInfo diminfo[8];
1199 } __Pyx_LocalBuf_ND;
1200
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);
1204 #else
1205     #define __Pyx_GetBuffer PyObject_GetBuffer
1206     #define __Pyx_ReleaseBuffer PyBuffer_Release
1207 #endif
1208
1209
1210 /* None.proto */
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};
1213
1214 /* CIntToPy.proto */
1215 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);
1216
1217 /* RealImag.proto */
1218 #if CYTHON_CCOMPLEX
1219   #ifdef __cplusplus
1220     #define __Pyx_CREAL(z) ((z).real())
1221     #define __Pyx_CIMAG(z) ((z).imag())
1222   #else
1223     #define __Pyx_CREAL(z) (__real__(z))
1224     #define __Pyx_CIMAG(z) (__imag__(z))
1225   #endif
1226 #else
1227     #define __Pyx_CREAL(z) ((z).real)
1228     #define __Pyx_CIMAG(z) ((z).imag)
1229 #endif
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))
1234 #else
1235     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1236     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1237 #endif
1238
1239 /* Arithmetic.proto */
1240 #if CYTHON_CCOMPLEX
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))
1247   #ifdef __cplusplus
1248     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1249     #define __Pyx_c_conj_float(z)    (::std::conj(z))
1250     #if 1
1251         #define __Pyx_c_abs_float(z)     (::std::abs(z))
1252         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
1253     #endif
1254   #else
1255     #define __Pyx_c_is_zero_float(z) ((z)==0)
1256     #define __Pyx_c_conj_float(z)    (conjf(z))
1257     #if 1
1258         #define __Pyx_c_abs_float(z)     (cabsf(z))
1259         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
1260     #endif
1261  #endif
1262 #else
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);
1271     #if 1
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);
1274     #endif
1275 #endif
1276
1277 /* Arithmetic.proto */
1278 #if CYTHON_CCOMPLEX
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))
1285   #ifdef __cplusplus
1286     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1287     #define __Pyx_c_conj_double(z)    (::std::conj(z))
1288     #if 1
1289         #define __Pyx_c_abs_double(z)     (::std::abs(z))
1290         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
1291     #endif
1292   #else
1293     #define __Pyx_c_is_zero_double(z) ((z)==0)
1294     #define __Pyx_c_conj_double(z)    (conj(z))
1295     #if 1
1296         #define __Pyx_c_abs_double(z)     (cabs(z))
1297         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
1298     #endif
1299  #endif
1300 #else
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);
1309     #if 1
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);
1312     #endif
1313 #endif
1314
1315 /* CIntToPy.proto */
1316 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1317
1318 /* CIntToPy.proto */
1319 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1320
1321 /* CIntFromPy.proto */
1322 static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);
1323
1324 /* CIntFromPy.proto */
1325 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1326
1327 /* CIntToPy.proto */
1328 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1329
1330 /* CIntFromPy.proto */
1331 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1332
1333 /* CheckBinaryVersion.proto */
1334 static int __Pyx_check_binary_version(void);
1335
1336 /* PyIdentifierFromString.proto */
1337 #if !defined(__Pyx_PyIdentifier_FromString)
1338 #if PY_MAJOR_VERSION < 3
1339   #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
1340 #else
1341   #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
1342 #endif
1343 #endif
1344
1345 /* ModuleImport.proto */
1346 static PyObject *__Pyx_ImportModule(const char *name);
1347
1348 /* TypeImport.proto */
1349 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
1350
1351 /* InitStrings.proto */
1352 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1353
1354
1355 /* Module declarations from 'cython' */
1356
1357 /* Module declarations from 'cpython.buffer' */
1358
1359 /* Module declarations from 'libc.string' */
1360
1361 /* Module declarations from 'libc.stdio' */
1362
1363 /* Module declarations from '__builtin__' */
1364
1365 /* Module declarations from 'cpython.type' */
1366 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1367
1368 /* Module declarations from 'cpython' */
1369
1370 /* Module declarations from 'cpython.object' */
1371
1372 /* Module declarations from 'cpython.ref' */
1373
1374 /* Module declarations from 'libc.stdlib' */
1375
1376 /* Module declarations from 'numpy' */
1377
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*/
1385
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;
1391
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;
1511
1512 /* "bbox.pyx":15
1513  * ctypedef np.float_t DTYPE_t
1514  * 
1515  * def bbox_overlaps_float(             # <<<<<<<<<<<<<<
1516  *         np.ndarray[DTYPE_t, ndim=2] boxes,
1517  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
1518  */
1519
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);
1530   {
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)) {
1534       Py_ssize_t kw_args;
1535       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1536       switch (pos_args) {
1537         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1538         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1539         case  0: break;
1540         default: goto __pyx_L5_argtuple_error;
1541       }
1542       kw_args = PyDict_Size(__pyx_kwds);
1543       switch (pos_args) {
1544         case  0:
1545         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boxes)) != 0)) kw_args--;
1546         else goto __pyx_L5_argtuple_error;
1547         case  1:
1548         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query_boxes)) != 0)) kw_args--;
1549         else {
1550           __Pyx_RaiseArgtupleInvalid("bbox_overlaps_float", 1, 2, 2, 1); __PYX_ERR(0, 15, __pyx_L3_error)
1551         }
1552       }
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)
1555       }
1556     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
1557       goto __pyx_L5_argtuple_error;
1558     } else {
1559       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1560       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1561     }
1562     __pyx_v_boxes = ((PyArrayObject *)values[0]);
1563     __pyx_v_query_boxes = ((PyArrayObject *)values[1]);
1564   }
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)
1568   __pyx_L3_error:;
1569   __Pyx_AddTraceback("cython_bbox.bbox_overlaps_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
1570   __Pyx_RefNannyFinishContext();
1571   return NULL;
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);
1576
1577   /* function exit code */
1578   goto __pyx_L0;
1579   __pyx_L1_error:;
1580   __pyx_r = NULL;
1581   __pyx_L0:;
1582   __Pyx_RefNannyFinishContext();
1583   return __pyx_r;
1584 }
1585
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;
1611   size_t __pyx_t_8;
1612   Py_ssize_t __pyx_t_9;
1613   int __pyx_t_10;
1614   size_t __pyx_t_11;
1615   Py_ssize_t __pyx_t_12;
1616   size_t __pyx_t_13;
1617   Py_ssize_t __pyx_t_14;
1618   size_t __pyx_t_15;
1619   Py_ssize_t __pyx_t_16;
1620   unsigned int __pyx_t_17;
1621   unsigned int __pyx_t_18;
1622   size_t __pyx_t_19;
1623   Py_ssize_t __pyx_t_20;
1624   __pyx_t_11cython_bbox_DTYPE_t __pyx_t_21;
1625   size_t __pyx_t_22;
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;
1629   size_t __pyx_t_26;
1630   Py_ssize_t __pyx_t_27;
1631   size_t __pyx_t_28;
1632   Py_ssize_t __pyx_t_29;
1633   __pyx_t_11cython_bbox_DTYPE_t __pyx_t_30;
1634   int __pyx_t_31;
1635   size_t __pyx_t_32;
1636   Py_ssize_t __pyx_t_33;
1637   size_t __pyx_t_34;
1638   Py_ssize_t __pyx_t_35;
1639   size_t __pyx_t_36;
1640   Py_ssize_t __pyx_t_37;
1641   size_t __pyx_t_38;
1642   Py_ssize_t __pyx_t_39;
1643   size_t __pyx_t_40;
1644   Py_ssize_t __pyx_t_41;
1645   size_t __pyx_t_42;
1646   Py_ssize_t __pyx_t_43;
1647   size_t __pyx_t_44;
1648   Py_ssize_t __pyx_t_45;
1649   size_t __pyx_t_46;
1650   Py_ssize_t __pyx_t_47;
1651   size_t __pyx_t_48;
1652   size_t __pyx_t_49;
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;
1666   {
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)
1669   }
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];
1671   {
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)
1674   }
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];
1676
1677   /* "bbox.pyx":27
1678  *     overlaps: (N, K) ndarray of overlap between boxes and query_boxes
1679  *     """
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)
1683  */
1684   __pyx_v_N = (__pyx_v_boxes->dimensions[0]);
1685
1686   /* "bbox.pyx":28
1687  *     """
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
1692  */
1693   __pyx_v_K = (__pyx_v_query_boxes->dimensions[0]);
1694
1695   /* "bbox.pyx":29
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
1700  *     cdef DTYPE_t ua
1701  */
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);
1717   __pyx_t_1 = 0;
1718   __pyx_t_3 = 0;
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);
1723   __pyx_t_4 = 0;
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);
1737   {
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];
1743     }
1744   }
1745   __pyx_t_5 = 0;
1746   __pyx_v_overlaps = ((PyArrayObject *)__pyx_t_1);
1747   __pyx_t_1 = 0;
1748
1749   /* "bbox.pyx":33
1750  *     cdef DTYPE_t ua
1751  *     cdef unsigned int k, n
1752  *     for k in range(K):             # <<<<<<<<<<<<<<
1753  *         box_area = (
1754  *             (query_boxes[k, 2] - query_boxes[k, 0]) *
1755  */
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;
1759
1760     /* "bbox.pyx":35
1761  *     for k in range(K):
1762  *         box_area = (
1763  *             (query_boxes[k, 2] - query_boxes[k, 0]) *             # <<<<<<<<<<<<<<
1764  *             (query_boxes[k, 3] - query_boxes[k, 1])
1765  *         )
1766  */
1767     __pyx_t_8 = __pyx_v_k;
1768     __pyx_t_9 = 2;
1769     __pyx_t_10 = -1;
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)
1778     }
1779     __pyx_t_11 = __pyx_v_k;
1780     __pyx_t_12 = 0;
1781     __pyx_t_10 = -1;
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)
1790     }
1791
1792     /* "bbox.pyx":36
1793  *         box_area = (
1794  *             (query_boxes[k, 2] - query_boxes[k, 0]) *
1795  *             (query_boxes[k, 3] - query_boxes[k, 1])             # <<<<<<<<<<<<<<
1796  *         )
1797  *         for n in range(N):
1798  */
1799     __pyx_t_13 = __pyx_v_k;
1800     __pyx_t_14 = 3;
1801     __pyx_t_10 = -1;
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)
1810     }
1811     __pyx_t_15 = __pyx_v_k;
1812     __pyx_t_16 = 1;
1813     __pyx_t_10 = -1;
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)
1822     }
1823
1824     /* "bbox.pyx":35
1825  *     for k in range(K):
1826  *         box_area = (
1827  *             (query_boxes[k, 2] - query_boxes[k, 0]) *             # <<<<<<<<<<<<<<
1828  *             (query_boxes[k, 3] - query_boxes[k, 1])
1829  *         )
1830  */
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))));
1832
1833     /* "bbox.pyx":38
1834  *             (query_boxes[k, 3] - query_boxes[k, 1])
1835  *         )
1836  *         for n in range(N):             # <<<<<<<<<<<<<<
1837  *             iw = (
1838  *                 min(boxes[n, 2], query_boxes[k, 2]) -
1839  */
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;
1843
1844       /* "bbox.pyx":40
1845  *         for n in range(N):
1846  *             iw = (
1847  *                 min(boxes[n, 2], query_boxes[k, 2]) -             # <<<<<<<<<<<<<<
1848  *                 max(boxes[n, 0], query_boxes[k, 0])
1849  *             )
1850  */
1851       __pyx_t_19 = __pyx_v_k;
1852       __pyx_t_20 = 2;
1853       __pyx_t_10 = -1;
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)
1862       }
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;
1865       __pyx_t_23 = 2;
1866       __pyx_t_10 = -1;
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)
1875       }
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;
1879       } else {
1880         __pyx_t_25 = __pyx_t_24;
1881       }
1882
1883       /* "bbox.pyx":41
1884  *             iw = (
1885  *                 min(boxes[n, 2], query_boxes[k, 2]) -
1886  *                 max(boxes[n, 0], query_boxes[k, 0])             # <<<<<<<<<<<<<<
1887  *             )
1888  *             if iw > 0:
1889  */
1890       __pyx_t_26 = __pyx_v_k;
1891       __pyx_t_27 = 0;
1892       __pyx_t_10 = -1;
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)
1901       }
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;
1904       __pyx_t_29 = 0;
1905       __pyx_t_10 = -1;
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)
1914       }
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;
1918       } else {
1919         __pyx_t_30 = __pyx_t_24;
1920       }
1921
1922       /* "bbox.pyx":40
1923  *         for n in range(N):
1924  *             iw = (
1925  *                 min(boxes[n, 2], query_boxes[k, 2]) -             # <<<<<<<<<<<<<<
1926  *                 max(boxes[n, 0], query_boxes[k, 0])
1927  *             )
1928  */
1929       __pyx_v_iw = (__pyx_t_25 - __pyx_t_30);
1930
1931       /* "bbox.pyx":43
1932  *                 max(boxes[n, 0], query_boxes[k, 0])
1933  *             )
1934  *             if iw > 0:             # <<<<<<<<<<<<<<
1935  *                 ih = (
1936  *                     min(boxes[n, 3], query_boxes[k, 3]) -
1937  */
1938       __pyx_t_31 = ((__pyx_v_iw > 0.0) != 0);
1939       if (__pyx_t_31) {
1940
1941         /* "bbox.pyx":45
1942  *             if iw > 0:
1943  *                 ih = (
1944  *                     min(boxes[n, 3], query_boxes[k, 3]) -             # <<<<<<<<<<<<<<
1945  *                     max(boxes[n, 1], query_boxes[k, 1])
1946  *                 )
1947  */
1948         __pyx_t_32 = __pyx_v_k;
1949         __pyx_t_33 = 3;
1950         __pyx_t_10 = -1;
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)
1959         }
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;
1962         __pyx_t_35 = 3;
1963         __pyx_t_10 = -1;
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)
1972         }
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;
1976         } else {
1977           __pyx_t_21 = __pyx_t_25;
1978         }
1979
1980         /* "bbox.pyx":46
1981  *                 ih = (
1982  *                     min(boxes[n, 3], query_boxes[k, 3]) -
1983  *                     max(boxes[n, 1], query_boxes[k, 1])             # <<<<<<<<<<<<<<
1984  *                 )
1985  *                 if ih > 0:
1986  */
1987         __pyx_t_36 = __pyx_v_k;
1988         __pyx_t_37 = 1;
1989         __pyx_t_10 = -1;
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)
1998         }
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;
2001         __pyx_t_39 = 1;
2002         __pyx_t_10 = -1;
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)
2011         }
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;
2015         } else {
2016           __pyx_t_24 = __pyx_t_25;
2017         }
2018
2019         /* "bbox.pyx":45
2020  *             if iw > 0:
2021  *                 ih = (
2022  *                     min(boxes[n, 3], query_boxes[k, 3]) -             # <<<<<<<<<<<<<<
2023  *                     max(boxes[n, 1], query_boxes[k, 1])
2024  *                 )
2025  */
2026         __pyx_v_ih = (__pyx_t_21 - __pyx_t_24);
2027
2028         /* "bbox.pyx":48
2029  *                     max(boxes[n, 1], query_boxes[k, 1])
2030  *                 )
2031  *                 if ih > 0:             # <<<<<<<<<<<<<<
2032  *                     ua = float(
2033  *                         (boxes[n, 2] - boxes[n, 0]) *
2034  */
2035         __pyx_t_31 = ((__pyx_v_ih > 0.0) != 0);
2036         if (__pyx_t_31) {
2037
2038           /* "bbox.pyx":50
2039  *                 if ih > 0:
2040  *                     ua = float(
2041  *                         (boxes[n, 2] - boxes[n, 0]) *             # <<<<<<<<<<<<<<
2042  *                         (boxes[n, 3] - boxes[n, 1]) +
2043  *                         box_area - iw * ih
2044  */
2045           __pyx_t_40 = __pyx_v_n;
2046           __pyx_t_41 = 2;
2047           __pyx_t_10 = -1;
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)
2056           }
2057           __pyx_t_42 = __pyx_v_n;
2058           __pyx_t_43 = 0;
2059           __pyx_t_10 = -1;
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)
2068           }
2069
2070           /* "bbox.pyx":51
2071  *                     ua = float(
2072  *                         (boxes[n, 2] - boxes[n, 0]) *
2073  *                         (boxes[n, 3] - boxes[n, 1]) +             # <<<<<<<<<<<<<<
2074  *                         box_area - iw * ih
2075  *                     )
2076  */
2077           __pyx_t_44 = __pyx_v_n;
2078           __pyx_t_45 = 3;
2079           __pyx_t_10 = -1;
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)
2088           }
2089           __pyx_t_46 = __pyx_v_n;
2090           __pyx_t_47 = 1;
2091           __pyx_t_10 = -1;
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)
2100           }
2101
2102           /* "bbox.pyx":49
2103  *                 )
2104  *                 if ih > 0:
2105  *                     ua = float(             # <<<<<<<<<<<<<<
2106  *                         (boxes[n, 2] - boxes[n, 0]) *
2107  *                         (boxes[n, 3] - boxes[n, 1]) +
2108  */
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)));
2110
2111           /* "bbox.pyx":63
2112  *                     #         box_area - iw * ih
2113  *                     #     )
2114  *                     overlaps[n, k] = iw * ih / ua             # <<<<<<<<<<<<<<
2115  *     return overlaps
2116  * 
2117  */
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)
2122           }
2123           __pyx_t_48 = __pyx_v_n;
2124           __pyx_t_49 = __pyx_v_k;
2125           __pyx_t_10 = -1;
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)
2131           }
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);
2133
2134           /* "bbox.pyx":48
2135  *                     max(boxes[n, 1], query_boxes[k, 1])
2136  *                 )
2137  *                 if ih > 0:             # <<<<<<<<<<<<<<
2138  *                     ua = float(
2139  *                         (boxes[n, 2] - boxes[n, 0]) *
2140  */
2141         }
2142
2143         /* "bbox.pyx":43
2144  *                 max(boxes[n, 0], query_boxes[k, 0])
2145  *             )
2146  *             if iw > 0:             # <<<<<<<<<<<<<<
2147  *                 ih = (
2148  *                     min(boxes[n, 3], query_boxes[k, 3]) -
2149  */
2150       }
2151     }
2152   }
2153
2154   /* "bbox.pyx":64
2155  *                     #     )
2156  *                     overlaps[n, k] = iw * ih / ua
2157  *     return overlaps             # <<<<<<<<<<<<<<
2158  * 
2159  * def bbox_overlaps(
2160  */
2161   __Pyx_XDECREF(__pyx_r);
2162   __Pyx_INCREF(((PyObject *)__pyx_v_overlaps));
2163   __pyx_r = ((PyObject *)__pyx_v_overlaps);
2164   goto __pyx_L0;
2165
2166   /* "bbox.pyx":15
2167  * ctypedef np.float_t DTYPE_t
2168  * 
2169  * def bbox_overlaps_float(             # <<<<<<<<<<<<<<
2170  *         np.ndarray[DTYPE_t, ndim=2] boxes,
2171  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
2172  */
2173
2174   /* function exit code */
2175   __pyx_L1_error:;
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);
2189   __pyx_r = NULL;
2190   goto __pyx_L2;
2191   __pyx_L0:;
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);
2195   __pyx_L2:;
2196   __Pyx_XDECREF((PyObject *)__pyx_v_overlaps);
2197   __Pyx_XGIVEREF(__pyx_r);
2198   __Pyx_RefNannyFinishContext();
2199   return __pyx_r;
2200 }
2201
2202 /* "bbox.pyx":66
2203  *     return overlaps
2204  * 
2205  * def bbox_overlaps(             # <<<<<<<<<<<<<<
2206  *         np.ndarray[DTYPE_t, ndim=2] boxes,
2207  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
2208  */
2209
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);
2220   {
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)) {
2224       Py_ssize_t kw_args;
2225       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2226       switch (pos_args) {
2227         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2228         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2229         case  0: break;
2230         default: goto __pyx_L5_argtuple_error;
2231       }
2232       kw_args = PyDict_Size(__pyx_kwds);
2233       switch (pos_args) {
2234         case  0:
2235         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boxes)) != 0)) kw_args--;
2236         else goto __pyx_L5_argtuple_error;
2237         case  1:
2238         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query_boxes)) != 0)) kw_args--;
2239         else {
2240           __Pyx_RaiseArgtupleInvalid("bbox_overlaps", 1, 2, 2, 1); __PYX_ERR(0, 66, __pyx_L3_error)
2241         }
2242       }
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)
2245       }
2246     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2247       goto __pyx_L5_argtuple_error;
2248     } else {
2249       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2250       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2251     }
2252     __pyx_v_boxes = ((PyArrayObject *)values[0]);
2253     __pyx_v_query_boxes = ((PyArrayObject *)values[1]);
2254   }
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)
2258   __pyx_L3_error:;
2259   __Pyx_AddTraceback("cython_bbox.bbox_overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
2260   __Pyx_RefNannyFinishContext();
2261   return NULL;
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);
2266
2267   /* function exit code */
2268   goto __pyx_L0;
2269   __pyx_L1_error:;
2270   __pyx_r = NULL;
2271   __pyx_L0:;
2272   __Pyx_RefNannyFinishContext();
2273   return __pyx_r;
2274 }
2275
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;
2301   size_t __pyx_t_8;
2302   Py_ssize_t __pyx_t_9;
2303   int __pyx_t_10;
2304   size_t __pyx_t_11;
2305   Py_ssize_t __pyx_t_12;
2306   size_t __pyx_t_13;
2307   Py_ssize_t __pyx_t_14;
2308   size_t __pyx_t_15;
2309   Py_ssize_t __pyx_t_16;
2310   unsigned int __pyx_t_17;
2311   unsigned int __pyx_t_18;
2312   size_t __pyx_t_19;
2313   Py_ssize_t __pyx_t_20;
2314   __pyx_t_11cython_bbox_DTYPE_t __pyx_t_21;
2315   size_t __pyx_t_22;
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;
2319   size_t __pyx_t_26;
2320   Py_ssize_t __pyx_t_27;
2321   size_t __pyx_t_28;
2322   Py_ssize_t __pyx_t_29;
2323   __pyx_t_11cython_bbox_DTYPE_t __pyx_t_30;
2324   int __pyx_t_31;
2325   size_t __pyx_t_32;
2326   Py_ssize_t __pyx_t_33;
2327   size_t __pyx_t_34;
2328   Py_ssize_t __pyx_t_35;
2329   size_t __pyx_t_36;
2330   Py_ssize_t __pyx_t_37;
2331   size_t __pyx_t_38;
2332   Py_ssize_t __pyx_t_39;
2333   size_t __pyx_t_40;
2334   Py_ssize_t __pyx_t_41;
2335   size_t __pyx_t_42;
2336   Py_ssize_t __pyx_t_43;
2337   size_t __pyx_t_44;
2338   Py_ssize_t __pyx_t_45;
2339   size_t __pyx_t_46;
2340   Py_ssize_t __pyx_t_47;
2341   size_t __pyx_t_48;
2342   size_t __pyx_t_49;
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;
2356   {
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)
2359   }
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];
2361   {
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)
2364   }
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];
2366
2367   /* "bbox.pyx":78
2368  *     overlaps: (N, K) ndarray of overlap between boxes and query_boxes
2369  *     """
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)
2373  */
2374   __pyx_v_N = (__pyx_v_boxes->dimensions[0]);
2375
2376   /* "bbox.pyx":79
2377  *     """
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
2382  */
2383   __pyx_v_K = (__pyx_v_query_boxes->dimensions[0]);
2384
2385   /* "bbox.pyx":80
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
2390  *     cdef DTYPE_t ua
2391  */
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);
2407   __pyx_t_1 = 0;
2408   __pyx_t_3 = 0;
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);
2413   __pyx_t_4 = 0;
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);
2427   {
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];
2433     }
2434   }
2435   __pyx_t_5 = 0;
2436   __pyx_v_overlaps = ((PyArrayObject *)__pyx_t_1);
2437   __pyx_t_1 = 0;
2438
2439   /* "bbox.pyx":84
2440  *     cdef DTYPE_t ua
2441  *     cdef unsigned int k, n
2442  *     for k in range(K):             # <<<<<<<<<<<<<<
2443  *         box_area = (
2444  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
2445  */
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;
2449
2450     /* "bbox.pyx":86
2451  *     for k in range(K):
2452  *         box_area = (
2453  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *             # <<<<<<<<<<<<<<
2454  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)
2455  *         )
2456  */
2457     __pyx_t_8 = __pyx_v_k;
2458     __pyx_t_9 = 2;
2459     __pyx_t_10 = -1;
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)
2468     }
2469     __pyx_t_11 = __pyx_v_k;
2470     __pyx_t_12 = 0;
2471     __pyx_t_10 = -1;
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)
2480     }
2481
2482     /* "bbox.pyx":87
2483  *         box_area = (
2484  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
2485  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)             # <<<<<<<<<<<<<<
2486  *         )
2487  *         for n in range(N):
2488  */
2489     __pyx_t_13 = __pyx_v_k;
2490     __pyx_t_14 = 3;
2491     __pyx_t_10 = -1;
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)
2500     }
2501     __pyx_t_15 = __pyx_v_k;
2502     __pyx_t_16 = 1;
2503     __pyx_t_10 = -1;
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)
2512     }
2513
2514     /* "bbox.pyx":86
2515  *     for k in range(K):
2516  *         box_area = (
2517  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *             # <<<<<<<<<<<<<<
2518  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)
2519  *         )
2520  */
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));
2522
2523     /* "bbox.pyx":89
2524  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)
2525  *         )
2526  *         for n in range(N):             # <<<<<<<<<<<<<<
2527  *             iw = (
2528  *                 min(boxes[n, 2], query_boxes[k, 2]) -
2529  */
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;
2533
2534       /* "bbox.pyx":91
2535  *         for n in range(N):
2536  *             iw = (
2537  *                 min(boxes[n, 2], query_boxes[k, 2]) -             # <<<<<<<<<<<<<<
2538  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
2539  *             )
2540  */
2541       __pyx_t_19 = __pyx_v_k;
2542       __pyx_t_20 = 2;
2543       __pyx_t_10 = -1;
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)
2552       }
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;
2555       __pyx_t_23 = 2;
2556       __pyx_t_10 = -1;
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)
2565       }
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;
2569       } else {
2570         __pyx_t_25 = __pyx_t_24;
2571       }
2572
2573       /* "bbox.pyx":92
2574  *             iw = (
2575  *                 min(boxes[n, 2], query_boxes[k, 2]) -
2576  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1             # <<<<<<<<<<<<<<
2577  *             )
2578  *             if iw > 0:
2579  */
2580       __pyx_t_26 = __pyx_v_k;
2581       __pyx_t_27 = 0;
2582       __pyx_t_10 = -1;
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)
2591       }
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;
2594       __pyx_t_29 = 0;
2595       __pyx_t_10 = -1;
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)
2604       }
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;
2608       } else {
2609         __pyx_t_30 = __pyx_t_24;
2610       }
2611
2612       /* "bbox.pyx":91
2613  *         for n in range(N):
2614  *             iw = (
2615  *                 min(boxes[n, 2], query_boxes[k, 2]) -             # <<<<<<<<<<<<<<
2616  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
2617  *             )
2618  */
2619       __pyx_v_iw = ((__pyx_t_25 - __pyx_t_30) + 1.0);
2620
2621       /* "bbox.pyx":94
2622  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
2623  *             )
2624  *             if iw > 0:             # <<<<<<<<<<<<<<
2625  *                 ih = (
2626  *                     min(boxes[n, 3], query_boxes[k, 3]) -
2627  */
2628       __pyx_t_31 = ((__pyx_v_iw > 0.0) != 0);
2629       if (__pyx_t_31) {
2630
2631         /* "bbox.pyx":96
2632  *             if iw > 0:
2633  *                 ih = (
2634  *                     min(boxes[n, 3], query_boxes[k, 3]) -             # <<<<<<<<<<<<<<
2635  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
2636  *                 )
2637  */
2638         __pyx_t_32 = __pyx_v_k;
2639         __pyx_t_33 = 3;
2640         __pyx_t_10 = -1;
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)
2649         }
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;
2652         __pyx_t_35 = 3;
2653         __pyx_t_10 = -1;
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)
2662         }
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;
2666         } else {
2667           __pyx_t_21 = __pyx_t_25;
2668         }
2669
2670         /* "bbox.pyx":97
2671  *                 ih = (
2672  *                     min(boxes[n, 3], query_boxes[k, 3]) -
2673  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1             # <<<<<<<<<<<<<<
2674  *                 )
2675  *                 if ih > 0:
2676  */
2677         __pyx_t_36 = __pyx_v_k;
2678         __pyx_t_37 = 1;
2679         __pyx_t_10 = -1;
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)
2688         }
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;
2691         __pyx_t_39 = 1;
2692         __pyx_t_10 = -1;
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)
2701         }
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;
2705         } else {
2706           __pyx_t_24 = __pyx_t_25;
2707         }
2708
2709         /* "bbox.pyx":96
2710  *             if iw > 0:
2711  *                 ih = (
2712  *                     min(boxes[n, 3], query_boxes[k, 3]) -             # <<<<<<<<<<<<<<
2713  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
2714  *                 )
2715  */
2716         __pyx_v_ih = ((__pyx_t_21 - __pyx_t_24) + 1.0);
2717
2718         /* "bbox.pyx":99
2719  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
2720  *                 )
2721  *                 if ih > 0:             # <<<<<<<<<<<<<<
2722  *                     ua = float(
2723  *                         (boxes[n, 2] - boxes[n, 0] + 1) *
2724  */
2725         __pyx_t_31 = ((__pyx_v_ih > 0.0) != 0);
2726         if (__pyx_t_31) {
2727
2728           /* "bbox.pyx":101
2729  *                 if ih > 0:
2730  *                     ua = float(
2731  *                         (boxes[n, 2] - boxes[n, 0] + 1) *             # <<<<<<<<<<<<<<
2732  *                         (boxes[n, 3] - boxes[n, 1] + 1) +
2733  *                         box_area - iw * ih
2734  */
2735           __pyx_t_40 = __pyx_v_n;
2736           __pyx_t_41 = 2;
2737           __pyx_t_10 = -1;
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)
2746           }
2747           __pyx_t_42 = __pyx_v_n;
2748           __pyx_t_43 = 0;
2749           __pyx_t_10 = -1;
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)
2758           }
2759
2760           /* "bbox.pyx":102
2761  *                     ua = float(
2762  *                         (boxes[n, 2] - boxes[n, 0] + 1) *
2763  *                         (boxes[n, 3] - boxes[n, 1] + 1) +             # <<<<<<<<<<<<<<
2764  *                         box_area - iw * ih
2765  *                     )
2766  */
2767           __pyx_t_44 = __pyx_v_n;
2768           __pyx_t_45 = 3;
2769           __pyx_t_10 = -1;
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)
2778           }
2779           __pyx_t_46 = __pyx_v_n;
2780           __pyx_t_47 = 1;
2781           __pyx_t_10 = -1;
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)
2790           }
2791
2792           /* "bbox.pyx":100
2793  *                 )
2794  *                 if ih > 0:
2795  *                     ua = float(             # <<<<<<<<<<<<<<
2796  *                         (boxes[n, 2] - boxes[n, 0] + 1) *
2797  *                         (boxes[n, 3] - boxes[n, 1] + 1) +
2798  */
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)));
2800
2801           /* "bbox.pyx":105
2802  *                         box_area - iw * ih
2803  *                     )
2804  *                     overlaps[n, k] = iw * ih / ua             # <<<<<<<<<<<<<<
2805  *     return overlaps
2806  * 
2807  */
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)
2812           }
2813           __pyx_t_48 = __pyx_v_n;
2814           __pyx_t_49 = __pyx_v_k;
2815           __pyx_t_10 = -1;
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)
2821           }
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);
2823
2824           /* "bbox.pyx":99
2825  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
2826  *                 )
2827  *                 if ih > 0:             # <<<<<<<<<<<<<<
2828  *                     ua = float(
2829  *                         (boxes[n, 2] - boxes[n, 0] + 1) *
2830  */
2831         }
2832
2833         /* "bbox.pyx":94
2834  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
2835  *             )
2836  *             if iw > 0:             # <<<<<<<<<<<<<<
2837  *                 ih = (
2838  *                     min(boxes[n, 3], query_boxes[k, 3]) -
2839  */
2840       }
2841     }
2842   }
2843
2844   /* "bbox.pyx":106
2845  *                     )
2846  *                     overlaps[n, k] = iw * ih / ua
2847  *     return overlaps             # <<<<<<<<<<<<<<
2848  * 
2849  * def bbox_overlaps_self(
2850  */
2851   __Pyx_XDECREF(__pyx_r);
2852   __Pyx_INCREF(((PyObject *)__pyx_v_overlaps));
2853   __pyx_r = ((PyObject *)__pyx_v_overlaps);
2854   goto __pyx_L0;
2855
2856   /* "bbox.pyx":66
2857  *     return overlaps
2858  * 
2859  * def bbox_overlaps(             # <<<<<<<<<<<<<<
2860  *         np.ndarray[DTYPE_t, ndim=2] boxes,
2861  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
2862  */
2863
2864   /* function exit code */
2865   __pyx_L1_error:;
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);
2879   __pyx_r = NULL;
2880   goto __pyx_L2;
2881   __pyx_L0:;
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);
2885   __pyx_L2:;
2886   __Pyx_XDECREF((PyObject *)__pyx_v_overlaps);
2887   __Pyx_XGIVEREF(__pyx_r);
2888   __Pyx_RefNannyFinishContext();
2889   return __pyx_r;
2890 }
2891
2892 /* "bbox.pyx":108
2893  *     return overlaps
2894  * 
2895  * def bbox_overlaps_self(             # <<<<<<<<<<<<<<
2896  *         np.ndarray[DTYPE_t, ndim=2] boxes,
2897  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
2898  */
2899
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);
2910   {
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)) {
2914       Py_ssize_t kw_args;
2915       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2916       switch (pos_args) {
2917         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2918         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2919         case  0: break;
2920         default: goto __pyx_L5_argtuple_error;
2921       }
2922       kw_args = PyDict_Size(__pyx_kwds);
2923       switch (pos_args) {
2924         case  0:
2925         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boxes)) != 0)) kw_args--;
2926         else goto __pyx_L5_argtuple_error;
2927         case  1:
2928         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query_boxes)) != 0)) kw_args--;
2929         else {
2930           __Pyx_RaiseArgtupleInvalid("bbox_overlaps_self", 1, 2, 2, 1); __PYX_ERR(0, 108, __pyx_L3_error)
2931         }
2932       }
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)
2935       }
2936     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2937       goto __pyx_L5_argtuple_error;
2938     } else {
2939       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2940       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2941     }
2942     __pyx_v_boxes = ((PyArrayObject *)values[0]);
2943     __pyx_v_query_boxes = ((PyArrayObject *)values[1]);
2944   }
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)
2948   __pyx_L3_error:;
2949   __Pyx_AddTraceback("cython_bbox.bbox_overlaps_self", __pyx_clineno, __pyx_lineno, __pyx_filename);
2950   __Pyx_RefNannyFinishContext();
2951   return NULL;
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);
2956
2957   /* function exit code */
2958   goto __pyx_L0;
2959   __pyx_L1_error:;
2960   __pyx_r = NULL;
2961   __pyx_L0:;
2962   __Pyx_RefNannyFinishContext();
2963   return __pyx_r;
2964 }
2965
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;
2991   size_t __pyx_t_8;
2992   Py_ssize_t __pyx_t_9;
2993   int __pyx_t_10;
2994   size_t __pyx_t_11;
2995   Py_ssize_t __pyx_t_12;
2996   size_t __pyx_t_13;
2997   Py_ssize_t __pyx_t_14;
2998   size_t __pyx_t_15;
2999   Py_ssize_t __pyx_t_16;
3000   unsigned int __pyx_t_17;
3001   unsigned int __pyx_t_18;
3002   size_t __pyx_t_19;
3003   Py_ssize_t __pyx_t_20;
3004   __pyx_t_11cython_bbox_DTYPE_t __pyx_t_21;
3005   size_t __pyx_t_22;
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;
3009   size_t __pyx_t_26;
3010   Py_ssize_t __pyx_t_27;
3011   size_t __pyx_t_28;
3012   Py_ssize_t __pyx_t_29;
3013   __pyx_t_11cython_bbox_DTYPE_t __pyx_t_30;
3014   int __pyx_t_31;
3015   size_t __pyx_t_32;
3016   Py_ssize_t __pyx_t_33;
3017   size_t __pyx_t_34;
3018   Py_ssize_t __pyx_t_35;
3019   size_t __pyx_t_36;
3020   Py_ssize_t __pyx_t_37;
3021   size_t __pyx_t_38;
3022   Py_ssize_t __pyx_t_39;
3023   size_t __pyx_t_40;
3024   size_t __pyx_t_41;
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;
3038   {
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)
3041   }
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];
3043   {
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)
3046   }
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];
3048
3049   /* "bbox.pyx":120
3050  *     overlaps: (N, K) ndarray of overlap between boxes and query_boxes
3051  *     """
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)
3055  */
3056   __pyx_v_N = (__pyx_v_boxes->dimensions[0]);
3057
3058   /* "bbox.pyx":121
3059  *     """
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
3064  */
3065   __pyx_v_K = (__pyx_v_query_boxes->dimensions[0]);
3066
3067   /* "bbox.pyx":122
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
3072  *     cdef DTYPE_t ua
3073  */
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);
3089   __pyx_t_1 = 0;
3090   __pyx_t_3 = 0;
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);
3095   __pyx_t_4 = 0;
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);
3109   {
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];
3115     }
3116   }
3117   __pyx_t_5 = 0;
3118   __pyx_v_overlaps = ((PyArrayObject *)__pyx_t_1);
3119   __pyx_t_1 = 0;
3120
3121   /* "bbox.pyx":126
3122  *     cdef DTYPE_t ua
3123  *     cdef unsigned int k, n
3124  *     for k in range(K):             # <<<<<<<<<<<<<<
3125  *         box_area = (
3126  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
3127  */
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;
3131
3132     /* "bbox.pyx":128
3133  *     for k in range(K):
3134  *         box_area = (
3135  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *             # <<<<<<<<<<<<<<
3136  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)
3137  *         )
3138  */
3139     __pyx_t_8 = __pyx_v_k;
3140     __pyx_t_9 = 2;
3141     __pyx_t_10 = -1;
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)
3150     }
3151     __pyx_t_11 = __pyx_v_k;
3152     __pyx_t_12 = 0;
3153     __pyx_t_10 = -1;
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)
3162     }
3163
3164     /* "bbox.pyx":129
3165  *         box_area = (
3166  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
3167  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)             # <<<<<<<<<<<<<<
3168  *         )
3169  *         for n in range(N):
3170  */
3171     __pyx_t_13 = __pyx_v_k;
3172     __pyx_t_14 = 3;
3173     __pyx_t_10 = -1;
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)
3182     }
3183     __pyx_t_15 = __pyx_v_k;
3184     __pyx_t_16 = 1;
3185     __pyx_t_10 = -1;
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)
3194     }
3195
3196     /* "bbox.pyx":128
3197  *     for k in range(K):
3198  *         box_area = (
3199  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *             # <<<<<<<<<<<<<<
3200  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)
3201  *         )
3202  */
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));
3204
3205     /* "bbox.pyx":131
3206  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)
3207  *         )
3208  *         for n in range(N):             # <<<<<<<<<<<<<<
3209  *             iw = (
3210  *                 min(boxes[n, 2], query_boxes[k, 2]) -
3211  */
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;
3215
3216       /* "bbox.pyx":133
3217  *         for n in range(N):
3218  *             iw = (
3219  *                 min(boxes[n, 2], query_boxes[k, 2]) -             # <<<<<<<<<<<<<<
3220  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
3221  *             )
3222  */
3223       __pyx_t_19 = __pyx_v_k;
3224       __pyx_t_20 = 2;
3225       __pyx_t_10 = -1;
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)
3234       }
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;
3237       __pyx_t_23 = 2;
3238       __pyx_t_10 = -1;
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)
3247       }
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;
3251       } else {
3252         __pyx_t_25 = __pyx_t_24;
3253       }
3254
3255       /* "bbox.pyx":134
3256  *             iw = (
3257  *                 min(boxes[n, 2], query_boxes[k, 2]) -
3258  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1             # <<<<<<<<<<<<<<
3259  *             )
3260  *             if iw > 0:
3261  */
3262       __pyx_t_26 = __pyx_v_k;
3263       __pyx_t_27 = 0;
3264       __pyx_t_10 = -1;
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)
3273       }
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;
3276       __pyx_t_29 = 0;
3277       __pyx_t_10 = -1;
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)
3286       }
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;
3290       } else {
3291         __pyx_t_30 = __pyx_t_24;
3292       }
3293
3294       /* "bbox.pyx":133
3295  *         for n in range(N):
3296  *             iw = (
3297  *                 min(boxes[n, 2], query_boxes[k, 2]) -             # <<<<<<<<<<<<<<
3298  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
3299  *             )
3300  */
3301       __pyx_v_iw = ((__pyx_t_25 - __pyx_t_30) + 1.0);
3302
3303       /* "bbox.pyx":136
3304  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
3305  *             )
3306  *             if iw > 0:             # <<<<<<<<<<<<<<
3307  *                 ih = (
3308  *                     min(boxes[n, 3], query_boxes[k, 3]) -
3309  */
3310       __pyx_t_31 = ((__pyx_v_iw > 0.0) != 0);
3311       if (__pyx_t_31) {
3312
3313         /* "bbox.pyx":138
3314  *             if iw > 0:
3315  *                 ih = (
3316  *                     min(boxes[n, 3], query_boxes[k, 3]) -             # <<<<<<<<<<<<<<
3317  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
3318  *                 )
3319  */
3320         __pyx_t_32 = __pyx_v_k;
3321         __pyx_t_33 = 3;
3322         __pyx_t_10 = -1;
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)
3331         }
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;
3334         __pyx_t_35 = 3;
3335         __pyx_t_10 = -1;
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)
3344         }
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;
3348         } else {
3349           __pyx_t_21 = __pyx_t_25;
3350         }
3351
3352         /* "bbox.pyx":139
3353  *                 ih = (
3354  *                     min(boxes[n, 3], query_boxes[k, 3]) -
3355  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1             # <<<<<<<<<<<<<<
3356  *                 )
3357  *                 if ih > 0:
3358  */
3359         __pyx_t_36 = __pyx_v_k;
3360         __pyx_t_37 = 1;
3361         __pyx_t_10 = -1;
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)
3370         }
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;
3373         __pyx_t_39 = 1;
3374         __pyx_t_10 = -1;
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)
3383         }
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;
3387         } else {
3388           __pyx_t_24 = __pyx_t_25;
3389         }
3390
3391         /* "bbox.pyx":138
3392  *             if iw > 0:
3393  *                 ih = (
3394  *                     min(boxes[n, 3], query_boxes[k, 3]) -             # <<<<<<<<<<<<<<
3395  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
3396  *                 )
3397  */
3398         __pyx_v_ih = ((__pyx_t_21 - __pyx_t_24) + 1.0);
3399
3400         /* "bbox.pyx":141
3401  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
3402  *                 )
3403  *                 if ih > 0:             # <<<<<<<<<<<<<<
3404  *                     ua = float(box_area)
3405  *                     overlaps[n, k] = iw * ih / ua
3406  */
3407         __pyx_t_31 = ((__pyx_v_ih > 0.0) != 0);
3408         if (__pyx_t_31) {
3409
3410           /* "bbox.pyx":142
3411  *                 )
3412  *                 if ih > 0:
3413  *                     ua = float(box_area)             # <<<<<<<<<<<<<<
3414  *                     overlaps[n, k] = iw * ih / ua
3415  *     return overlaps
3416  */
3417           __pyx_v_ua = ((double)__pyx_v_box_area);
3418
3419           /* "bbox.pyx":143
3420  *                 if ih > 0:
3421  *                     ua = float(box_area)
3422  *                     overlaps[n, k] = iw * ih / ua             # <<<<<<<<<<<<<<
3423  *     return overlaps
3424  * 
3425  */
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)
3430           }
3431           __pyx_t_40 = __pyx_v_n;
3432           __pyx_t_41 = __pyx_v_k;
3433           __pyx_t_10 = -1;
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)
3439           }
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);
3441
3442           /* "bbox.pyx":141
3443  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
3444  *                 )
3445  *                 if ih > 0:             # <<<<<<<<<<<<<<
3446  *                     ua = float(box_area)
3447  *                     overlaps[n, k] = iw * ih / ua
3448  */
3449         }
3450
3451         /* "bbox.pyx":136
3452  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
3453  *             )
3454  *             if iw > 0:             # <<<<<<<<<<<<<<
3455  *                 ih = (
3456  *                     min(boxes[n, 3], query_boxes[k, 3]) -
3457  */
3458       }
3459     }
3460   }
3461
3462   /* "bbox.pyx":144
3463  *                     ua = float(box_area)
3464  *                     overlaps[n, k] = iw * ih / ua
3465  *     return overlaps             # <<<<<<<<<<<<<<
3466  * 
3467  * 
3468  */
3469   __Pyx_XDECREF(__pyx_r);
3470   __Pyx_INCREF(((PyObject *)__pyx_v_overlaps));
3471   __pyx_r = ((PyObject *)__pyx_v_overlaps);
3472   goto __pyx_L0;
3473
3474   /* "bbox.pyx":108
3475  *     return overlaps
3476  * 
3477  * def bbox_overlaps_self(             # <<<<<<<<<<<<<<
3478  *         np.ndarray[DTYPE_t, ndim=2] boxes,
3479  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
3480  */
3481
3482   /* function exit code */
3483   __pyx_L1_error:;
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);
3497   __pyx_r = NULL;
3498   goto __pyx_L2;
3499   __pyx_L0:;
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);
3503   __pyx_L2:;
3504   __Pyx_XDECREF((PyObject *)__pyx_v_overlaps);
3505   __Pyx_XGIVEREF(__pyx_r);
3506   __Pyx_RefNannyFinishContext();
3507   return __pyx_r;
3508 }
3509
3510 /* "bbox.pyx":147
3511  * 
3512  * 
3513  * def bbox_overlaps_ignore(             # <<<<<<<<<<<<<<
3514  *         np.ndarray[DTYPE_t, ndim=2] boxes,
3515  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
3516  */
3517
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);
3528   {
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)) {
3532       Py_ssize_t kw_args;
3533       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3534       switch (pos_args) {
3535         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3536         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3537         case  0: break;
3538         default: goto __pyx_L5_argtuple_error;
3539       }
3540       kw_args = PyDict_Size(__pyx_kwds);
3541       switch (pos_args) {
3542         case  0:
3543         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boxes)) != 0)) kw_args--;
3544         else goto __pyx_L5_argtuple_error;
3545         case  1:
3546         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query_boxes)) != 0)) kw_args--;
3547         else {
3548           __Pyx_RaiseArgtupleInvalid("bbox_overlaps_ignore", 1, 2, 2, 1); __PYX_ERR(0, 147, __pyx_L3_error)
3549         }
3550       }
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)
3553       }
3554     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3555       goto __pyx_L5_argtuple_error;
3556     } else {
3557       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3558       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3559     }
3560     __pyx_v_boxes = ((PyArrayObject *)values[0]);
3561     __pyx_v_query_boxes = ((PyArrayObject *)values[1]);
3562   }
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)
3566   __pyx_L3_error:;
3567   __Pyx_AddTraceback("cython_bbox.bbox_overlaps_ignore", __pyx_clineno, __pyx_lineno, __pyx_filename);
3568   __Pyx_RefNannyFinishContext();
3569   return NULL;
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);
3574
3575   /* function exit code */
3576   goto __pyx_L0;
3577   __pyx_L1_error:;
3578   __pyx_r = NULL;
3579   __pyx_L0:;
3580   __Pyx_RefNannyFinishContext();
3581   return __pyx_r;
3582 }
3583
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;
3609   size_t __pyx_t_8;
3610   Py_ssize_t __pyx_t_9;
3611   int __pyx_t_10;
3612   size_t __pyx_t_11;
3613   Py_ssize_t __pyx_t_12;
3614   size_t __pyx_t_13;
3615   Py_ssize_t __pyx_t_14;
3616   size_t __pyx_t_15;
3617   Py_ssize_t __pyx_t_16;
3618   unsigned int __pyx_t_17;
3619   unsigned int __pyx_t_18;
3620   size_t __pyx_t_19;
3621   Py_ssize_t __pyx_t_20;
3622   __pyx_t_11cython_bbox_DTYPE_t __pyx_t_21;
3623   size_t __pyx_t_22;
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;
3627   size_t __pyx_t_26;
3628   Py_ssize_t __pyx_t_27;
3629   size_t __pyx_t_28;
3630   Py_ssize_t __pyx_t_29;
3631   __pyx_t_11cython_bbox_DTYPE_t __pyx_t_30;
3632   int __pyx_t_31;
3633   size_t __pyx_t_32;
3634   Py_ssize_t __pyx_t_33;
3635   size_t __pyx_t_34;
3636   Py_ssize_t __pyx_t_35;
3637   size_t __pyx_t_36;
3638   Py_ssize_t __pyx_t_37;
3639   size_t __pyx_t_38;
3640   Py_ssize_t __pyx_t_39;
3641   size_t __pyx_t_40;
3642   Py_ssize_t __pyx_t_41;
3643   size_t __pyx_t_42;
3644   Py_ssize_t __pyx_t_43;
3645   size_t __pyx_t_44;
3646   Py_ssize_t __pyx_t_45;
3647   size_t __pyx_t_46;
3648   Py_ssize_t __pyx_t_47;
3649   size_t __pyx_t_48;
3650   Py_ssize_t __pyx_t_49;
3651   size_t __pyx_t_50;
3652   Py_ssize_t __pyx_t_51;
3653   size_t __pyx_t_52;
3654   Py_ssize_t __pyx_t_53;
3655   size_t __pyx_t_54;
3656   Py_ssize_t __pyx_t_55;
3657   size_t __pyx_t_56;
3658   Py_ssize_t __pyx_t_57;
3659   size_t __pyx_t_58;
3660   size_t __pyx_t_59;
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;
3674   {
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)
3677   }
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];
3679   {
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)
3682   }
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];
3684
3685   /* "bbox.pyx":159
3686  *     overlaps: (N, K) ndarray of overlap between boxes and query_boxes
3687  *     """
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)
3691  */
3692   __pyx_v_N = (__pyx_v_boxes->dimensions[0]);
3693
3694   /* "bbox.pyx":160
3695  *     """
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
3700  */
3701   __pyx_v_K = (__pyx_v_query_boxes->dimensions[0]);
3702
3703   /* "bbox.pyx":161
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
3708  *     cdef DTYPE_t ua
3709  */
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);
3725   __pyx_t_1 = 0;
3726   __pyx_t_3 = 0;
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);
3731   __pyx_t_4 = 0;
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);
3745   {
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];
3751     }
3752   }
3753   __pyx_t_5 = 0;
3754   __pyx_v_overlaps = ((PyArrayObject *)__pyx_t_1);
3755   __pyx_t_1 = 0;
3756
3757   /* "bbox.pyx":165
3758  *     cdef DTYPE_t ua
3759  *     cdef unsigned int k, n
3760  *     for k in range(K):             # <<<<<<<<<<<<<<
3761  *         box_area = (
3762  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
3763  */
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;
3767
3768     /* "bbox.pyx":167
3769  *     for k in range(K):
3770  *         box_area = (
3771  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *             # <<<<<<<<<<<<<<
3772  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)
3773  *         )
3774  */
3775     __pyx_t_8 = __pyx_v_k;
3776     __pyx_t_9 = 2;
3777     __pyx_t_10 = -1;
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)
3786     }
3787     __pyx_t_11 = __pyx_v_k;
3788     __pyx_t_12 = 0;
3789     __pyx_t_10 = -1;
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)
3798     }
3799
3800     /* "bbox.pyx":168
3801  *         box_area = (
3802  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
3803  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)             # <<<<<<<<<<<<<<
3804  *         )
3805  *         for n in range(N):
3806  */
3807     __pyx_t_13 = __pyx_v_k;
3808     __pyx_t_14 = 3;
3809     __pyx_t_10 = -1;
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)
3818     }
3819     __pyx_t_15 = __pyx_v_k;
3820     __pyx_t_16 = 1;
3821     __pyx_t_10 = -1;
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)
3830     }
3831
3832     /* "bbox.pyx":167
3833  *     for k in range(K):
3834  *         box_area = (
3835  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *             # <<<<<<<<<<<<<<
3836  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)
3837  *         )
3838  */
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));
3840
3841     /* "bbox.pyx":170
3842  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)
3843  *         )
3844  *         for n in range(N):             # <<<<<<<<<<<<<<
3845  *             iw = (
3846  *                 min(boxes[n, 2], query_boxes[k, 2]) -
3847  */
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;
3851
3852       /* "bbox.pyx":172
3853  *         for n in range(N):
3854  *             iw = (
3855  *                 min(boxes[n, 2], query_boxes[k, 2]) -             # <<<<<<<<<<<<<<
3856  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
3857  *             )
3858  */
3859       __pyx_t_19 = __pyx_v_k;
3860       __pyx_t_20 = 2;
3861       __pyx_t_10 = -1;
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)
3870       }
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;
3873       __pyx_t_23 = 2;
3874       __pyx_t_10 = -1;
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)
3883       }
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;
3887       } else {
3888         __pyx_t_25 = __pyx_t_24;
3889       }
3890
3891       /* "bbox.pyx":173
3892  *             iw = (
3893  *                 min(boxes[n, 2], query_boxes[k, 2]) -
3894  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1             # <<<<<<<<<<<<<<
3895  *             )
3896  *             if iw > 0:
3897  */
3898       __pyx_t_26 = __pyx_v_k;
3899       __pyx_t_27 = 0;
3900       __pyx_t_10 = -1;
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)
3909       }
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;
3912       __pyx_t_29 = 0;
3913       __pyx_t_10 = -1;
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)
3922       }
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;
3926       } else {
3927         __pyx_t_30 = __pyx_t_24;
3928       }
3929
3930       /* "bbox.pyx":172
3931  *         for n in range(N):
3932  *             iw = (
3933  *                 min(boxes[n, 2], query_boxes[k, 2]) -             # <<<<<<<<<<<<<<
3934  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
3935  *             )
3936  */
3937       __pyx_v_iw = ((__pyx_t_25 - __pyx_t_30) + 1.0);
3938
3939       /* "bbox.pyx":175
3940  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
3941  *             )
3942  *             if iw > 0:             # <<<<<<<<<<<<<<
3943  *                 ih = (
3944  *                     min(boxes[n, 3], query_boxes[k, 3]) -
3945  */
3946       __pyx_t_31 = ((__pyx_v_iw > 0.0) != 0);
3947       if (__pyx_t_31) {
3948
3949         /* "bbox.pyx":177
3950  *             if iw > 0:
3951  *                 ih = (
3952  *                     min(boxes[n, 3], query_boxes[k, 3]) -             # <<<<<<<<<<<<<<
3953  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
3954  *                 )
3955  */
3956         __pyx_t_32 = __pyx_v_k;
3957         __pyx_t_33 = 3;
3958         __pyx_t_10 = -1;
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)
3967         }
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;
3970         __pyx_t_35 = 3;
3971         __pyx_t_10 = -1;
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)
3980         }
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;
3984         } else {
3985           __pyx_t_21 = __pyx_t_25;
3986         }
3987
3988         /* "bbox.pyx":178
3989  *                 ih = (
3990  *                     min(boxes[n, 3], query_boxes[k, 3]) -
3991  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1             # <<<<<<<<<<<<<<
3992  *                 )
3993  *                 if ih > 0:
3994  */
3995         __pyx_t_36 = __pyx_v_k;
3996         __pyx_t_37 = 1;
3997         __pyx_t_10 = -1;
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)
4006         }
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;
4009         __pyx_t_39 = 1;
4010         __pyx_t_10 = -1;
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)
4019         }
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;
4023         } else {
4024           __pyx_t_24 = __pyx_t_25;
4025         }
4026
4027         /* "bbox.pyx":177
4028  *             if iw > 0:
4029  *                 ih = (
4030  *                     min(boxes[n, 3], query_boxes[k, 3]) -             # <<<<<<<<<<<<<<
4031  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
4032  *                 )
4033  */
4034         __pyx_v_ih = ((__pyx_t_21 - __pyx_t_24) + 1.0);
4035
4036         /* "bbox.pyx":180
4037  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
4038  *                 )
4039  *                 if ih > 0:             # <<<<<<<<<<<<<<
4040  *                     if query_boxes[k, 4] == -1:
4041  *                         ua = float((boxes[n, 2] - boxes[n, 0] + 1)
4042  */
4043         __pyx_t_31 = ((__pyx_v_ih > 0.0) != 0);
4044         if (__pyx_t_31) {
4045
4046           /* "bbox.pyx":181
4047  *                 )
4048  *                 if ih > 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))
4052  */
4053           __pyx_t_40 = __pyx_v_k;
4054           __pyx_t_41 = 4;
4055           __pyx_t_10 = -1;
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)
4064           }
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);
4066           if (__pyx_t_31) {
4067
4068             /* "bbox.pyx":182
4069  *                 if ih > 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))
4073  *                     else:
4074  */
4075             __pyx_t_42 = __pyx_v_n;
4076             __pyx_t_43 = 2;
4077             __pyx_t_10 = -1;
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)
4086             }
4087             __pyx_t_44 = __pyx_v_n;
4088             __pyx_t_45 = 0;
4089             __pyx_t_10 = -1;
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)
4098             }
4099
4100             /* "bbox.pyx":183
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))             # <<<<<<<<<<<<<<
4104  *                     else:
4105  *                         ua = float(
4106  */
4107             __pyx_t_46 = __pyx_v_n;
4108             __pyx_t_47 = 3;
4109             __pyx_t_10 = -1;
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)
4118             }
4119             __pyx_t_48 = __pyx_v_n;
4120             __pyx_t_49 = 1;
4121             __pyx_t_10 = -1;
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)
4130             }
4131
4132             /* "bbox.pyx":182
4133  *                 if ih > 0:
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))
4137  *                     else:
4138  */
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)));
4140
4141             /* "bbox.pyx":181
4142  *                 )
4143  *                 if ih > 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))
4147  */
4148             goto __pyx_L9;
4149           }
4150
4151           /* "bbox.pyx":185
4152  *                                   *(boxes[n, 3] - boxes[n, 1] + 1))
4153  *                     else:
4154  *                         ua = float(             # <<<<<<<<<<<<<<
4155  *                             (boxes[n, 2] - boxes[n, 0] + 1) *
4156  *                             (boxes[n, 3] - boxes[n, 1] + 1) +
4157  */
4158           /*else*/ {
4159
4160             /* "bbox.pyx":186
4161  *                     else:
4162  *                         ua = float(
4163  *                             (boxes[n, 2] - boxes[n, 0] + 1) *             # <<<<<<<<<<<<<<
4164  *                             (boxes[n, 3] - boxes[n, 1] + 1) +
4165  *                             box_area - iw * ih
4166  */
4167             __pyx_t_50 = __pyx_v_n;
4168             __pyx_t_51 = 2;
4169             __pyx_t_10 = -1;
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)
4178             }
4179             __pyx_t_52 = __pyx_v_n;
4180             __pyx_t_53 = 0;
4181             __pyx_t_10 = -1;
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)
4190             }
4191
4192             /* "bbox.pyx":187
4193  *                         ua = float(
4194  *                             (boxes[n, 2] - boxes[n, 0] + 1) *
4195  *                             (boxes[n, 3] - boxes[n, 1] + 1) +             # <<<<<<<<<<<<<<
4196  *                             box_area - iw * ih
4197  *                         )
4198  */
4199             __pyx_t_54 = __pyx_v_n;
4200             __pyx_t_55 = 3;
4201             __pyx_t_10 = -1;
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)
4210             }
4211             __pyx_t_56 = __pyx_v_n;
4212             __pyx_t_57 = 1;
4213             __pyx_t_10 = -1;
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)
4222             }
4223
4224             /* "bbox.pyx":185
4225  *                                   *(boxes[n, 3] - boxes[n, 1] + 1))
4226  *                     else:
4227  *                         ua = float(             # <<<<<<<<<<<<<<
4228  *                             (boxes[n, 2] - boxes[n, 0] + 1) *
4229  *                             (boxes[n, 3] - boxes[n, 1] + 1) +
4230  */
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)));
4232           }
4233           __pyx_L9:;
4234
4235           /* "bbox.pyx":190
4236  *                             box_area - iw * ih
4237  *                         )
4238  *                     overlaps[n, k] = iw * ih / ua             # <<<<<<<<<<<<<<
4239  *     return overlaps
4240  * 
4241  */
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)
4246           }
4247           __pyx_t_58 = __pyx_v_n;
4248           __pyx_t_59 = __pyx_v_k;
4249           __pyx_t_10 = -1;
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)
4255           }
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);
4257
4258           /* "bbox.pyx":180
4259  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
4260  *                 )
4261  *                 if ih > 0:             # <<<<<<<<<<<<<<
4262  *                     if query_boxes[k, 4] == -1:
4263  *                         ua = float((boxes[n, 2] - boxes[n, 0] + 1)
4264  */
4265         }
4266
4267         /* "bbox.pyx":175
4268  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
4269  *             )
4270  *             if iw > 0:             # <<<<<<<<<<<<<<
4271  *                 ih = (
4272  *                     min(boxes[n, 3], query_boxes[k, 3]) -
4273  */
4274       }
4275     }
4276   }
4277
4278   /* "bbox.pyx":191
4279  *                         )
4280  *                     overlaps[n, k] = iw * ih / ua
4281  *     return overlaps             # <<<<<<<<<<<<<<
4282  * 
4283  * 
4284  */
4285   __Pyx_XDECREF(__pyx_r);
4286   __Pyx_INCREF(((PyObject *)__pyx_v_overlaps));
4287   __pyx_r = ((PyObject *)__pyx_v_overlaps);
4288   goto __pyx_L0;
4289
4290   /* "bbox.pyx":147
4291  * 
4292  * 
4293  * def bbox_overlaps_ignore(             # <<<<<<<<<<<<<<
4294  *         np.ndarray[DTYPE_t, ndim=2] boxes,
4295  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
4296  */
4297
4298   /* function exit code */
4299   __pyx_L1_error:;
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);
4313   __pyx_r = NULL;
4314   goto __pyx_L2;
4315   __pyx_L0:;
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);
4319   __pyx_L2:;
4320   __Pyx_XDECREF((PyObject *)__pyx_v_overlaps);
4321   __Pyx_XGIVEREF(__pyx_r);
4322   __Pyx_RefNannyFinishContext();
4323   return __pyx_r;
4324 }
4325
4326 /* "bbox.pyx":194
4327  * 
4328  * 
4329  * def get_assignment_overlaps(             # <<<<<<<<<<<<<<
4330  *         np.ndarray[DTYPE_t, ndim=2] boxes,
4331  *         np.ndarray[DTYPE_t, ndim=2] query_boxes,
4332  */
4333
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);
4345   {
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)) {
4349       Py_ssize_t kw_args;
4350       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4351       switch (pos_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);
4355         case  0: break;
4356         default: goto __pyx_L5_argtuple_error;
4357       }
4358       kw_args = PyDict_Size(__pyx_kwds);
4359       switch (pos_args) {
4360         case  0:
4361         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boxes)) != 0)) kw_args--;
4362         else goto __pyx_L5_argtuple_error;
4363         case  1:
4364         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query_boxes)) != 0)) kw_args--;
4365         else {
4366           __Pyx_RaiseArgtupleInvalid("get_assignment_overlaps", 1, 3, 3, 1); __PYX_ERR(0, 194, __pyx_L3_error)
4367         }
4368         case  2:
4369         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_FG_THRESH)) != 0)) kw_args--;
4370         else {
4371           __Pyx_RaiseArgtupleInvalid("get_assignment_overlaps", 1, 3, 3, 2); __PYX_ERR(0, 194, __pyx_L3_error)
4372         }
4373       }
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)
4376       }
4377     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4378       goto __pyx_L5_argtuple_error;
4379     } else {
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);
4383     }
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)
4387   }
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)
4391   __pyx_L3_error:;
4392   __Pyx_AddTraceback("cython_bbox.get_assignment_overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
4393   __Pyx_RefNannyFinishContext();
4394   return NULL;
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);
4399
4400   /* function exit code */
4401   goto __pyx_L0;
4402   __pyx_L1_error:;
4403   __pyx_r = NULL;
4404   __pyx_L0:;
4405   __Pyx_RefNannyFinishContext();
4406   return __pyx_r;
4407 }
4408
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;
4440   size_t __pyx_t_10;
4441   Py_ssize_t __pyx_t_11;
4442   int __pyx_t_12;
4443   size_t __pyx_t_13;
4444   Py_ssize_t __pyx_t_14;
4445   size_t __pyx_t_15;
4446   Py_ssize_t __pyx_t_16;
4447   size_t __pyx_t_17;
4448   Py_ssize_t __pyx_t_18;
4449   unsigned int __pyx_t_19;
4450   unsigned int __pyx_t_20;
4451   size_t __pyx_t_21;
4452   Py_ssize_t __pyx_t_22;
4453   __pyx_t_11cython_bbox_DTYPE_t __pyx_t_23;
4454   size_t __pyx_t_24;
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;
4458   size_t __pyx_t_28;
4459   Py_ssize_t __pyx_t_29;
4460   size_t __pyx_t_30;
4461   Py_ssize_t __pyx_t_31;
4462   __pyx_t_11cython_bbox_DTYPE_t __pyx_t_32;
4463   int __pyx_t_33;
4464   size_t __pyx_t_34;
4465   Py_ssize_t __pyx_t_35;
4466   size_t __pyx_t_36;
4467   Py_ssize_t __pyx_t_37;
4468   size_t __pyx_t_38;
4469   Py_ssize_t __pyx_t_39;
4470   size_t __pyx_t_40;
4471   Py_ssize_t __pyx_t_41;
4472   size_t __pyx_t_42;
4473   Py_ssize_t __pyx_t_43;
4474   size_t __pyx_t_44;
4475   Py_ssize_t __pyx_t_45;
4476   size_t __pyx_t_46;
4477   Py_ssize_t __pyx_t_47;
4478   size_t __pyx_t_48;
4479   Py_ssize_t __pyx_t_49;
4480   size_t __pyx_t_50;
4481   Py_ssize_t __pyx_t_51;
4482   size_t __pyx_t_52;
4483   size_t __pyx_t_53;
4484   Py_ssize_t __pyx_t_54;
4485   Py_ssize_t __pyx_t_55;
4486   int __pyx_t_56;
4487   size_t __pyx_t_57;
4488   size_t __pyx_t_58;
4489   size_t __pyx_t_59;
4490   size_t __pyx_t_60;
4491   Py_ssize_t __pyx_t_61;
4492   size_t __pyx_t_62;
4493   Py_ssize_t __pyx_t_63;
4494   size_t __pyx_t_64;
4495   Py_ssize_t __pyx_t_65;
4496   size_t __pyx_t_66;
4497   Py_ssize_t __pyx_t_67;
4498   size_t __pyx_t_68;
4499   size_t __pyx_t_69;
4500   size_t __pyx_t_70;
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;
4518   {
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)
4521   }
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];
4523   {
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)
4526   }
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];
4528
4529   /* "bbox.pyx":207
4530  *     overlaps: (N, K) ndarray of overlap between boxes and query_boxes
4531  *     """
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)
4535  */
4536   __pyx_v_N = (__pyx_v_boxes->dimensions[0]);
4537
4538   /* "bbox.pyx":208
4539  *     """
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)
4544  */
4545   __pyx_v_K = (__pyx_v_query_boxes->dimensions[0]);
4546
4547   /* "bbox.pyx":209
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
4553  */
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);
4565   __pyx_t_1 = 0;
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);
4570   __pyx_t_3 = 0;
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);
4587   {
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];
4593     }
4594   }
4595   __pyx_t_6 = 0;
4596   __pyx_v_gt_assignment = ((PyArrayObject *)__pyx_t_5);
4597   __pyx_t_5 = 0;
4598
4599   /* "bbox.pyx":210
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
4604  *     cdef DTYPE_t ua
4605  */
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);
4617   __pyx_t_5 = 0;
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);
4622   __pyx_t_1 = 0;
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);
4636   {
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];
4642     }
4643   }
4644   __pyx_t_7 = 0;
4645   __pyx_v_max_overlaps = ((PyArrayObject *)__pyx_t_2);
4646   __pyx_t_2 = 0;
4647
4648   /* "bbox.pyx":214
4649  *     cdef DTYPE_t ua
4650  *     cdef unsigned int k, n
4651  *     for k in range(K):             # <<<<<<<<<<<<<<
4652  *         box_area = (
4653  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
4654  */
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;
4658
4659     /* "bbox.pyx":216
4660  *     for k in range(K):
4661  *         box_area = (
4662  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *             # <<<<<<<<<<<<<<
4663  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)
4664  *         )
4665  */
4666     __pyx_t_10 = __pyx_v_k;
4667     __pyx_t_11 = 2;
4668     __pyx_t_12 = -1;
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)
4677     }
4678     __pyx_t_13 = __pyx_v_k;
4679     __pyx_t_14 = 0;
4680     __pyx_t_12 = -1;
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)
4689     }
4690
4691     /* "bbox.pyx":217
4692  *         box_area = (
4693  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
4694  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)             # <<<<<<<<<<<<<<
4695  *         )
4696  *         for n in range(N):
4697  */
4698     __pyx_t_15 = __pyx_v_k;
4699     __pyx_t_16 = 3;
4700     __pyx_t_12 = -1;
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)
4709     }
4710     __pyx_t_17 = __pyx_v_k;
4711     __pyx_t_18 = 1;
4712     __pyx_t_12 = -1;
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)
4721     }
4722
4723     /* "bbox.pyx":216
4724  *     for k in range(K):
4725  *         box_area = (
4726  *             (query_boxes[k, 2] - query_boxes[k, 0] + 1) *             # <<<<<<<<<<<<<<
4727  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)
4728  *         )
4729  */
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));
4731
4732     /* "bbox.pyx":219
4733  *             (query_boxes[k, 3] - query_boxes[k, 1] + 1)
4734  *         )
4735  *         for n in range(N):             # <<<<<<<<<<<<<<
4736  *             iw = (
4737  *                 min(boxes[n, 2], query_boxes[k, 2]) -
4738  */
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;
4742
4743       /* "bbox.pyx":221
4744  *         for n in range(N):
4745  *             iw = (
4746  *                 min(boxes[n, 2], query_boxes[k, 2]) -             # <<<<<<<<<<<<<<
4747  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
4748  *             )
4749  */
4750       __pyx_t_21 = __pyx_v_k;
4751       __pyx_t_22 = 2;
4752       __pyx_t_12 = -1;
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)
4761       }
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;
4764       __pyx_t_25 = 2;
4765       __pyx_t_12 = -1;
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)
4774       }
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;
4778       } else {
4779         __pyx_t_27 = __pyx_t_26;
4780       }
4781
4782       /* "bbox.pyx":222
4783  *             iw = (
4784  *                 min(boxes[n, 2], query_boxes[k, 2]) -
4785  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1             # <<<<<<<<<<<<<<
4786  *             )
4787  *             if iw > 0:
4788  */
4789       __pyx_t_28 = __pyx_v_k;
4790       __pyx_t_29 = 0;
4791       __pyx_t_12 = -1;
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)
4800       }
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;
4803       __pyx_t_31 = 0;
4804       __pyx_t_12 = -1;
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)
4813       }
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;
4817       } else {
4818         __pyx_t_32 = __pyx_t_26;
4819       }
4820
4821       /* "bbox.pyx":221
4822  *         for n in range(N):
4823  *             iw = (
4824  *                 min(boxes[n, 2], query_boxes[k, 2]) -             # <<<<<<<<<<<<<<
4825  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
4826  *             )
4827  */
4828       __pyx_v_iw = ((__pyx_t_27 - __pyx_t_32) + 1.0);
4829
4830       /* "bbox.pyx":224
4831  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
4832  *             )
4833  *             if iw > 0:             # <<<<<<<<<<<<<<
4834  *                 ih = (
4835  *                     min(boxes[n, 3], query_boxes[k, 3]) -
4836  */
4837       __pyx_t_33 = ((__pyx_v_iw > 0.0) != 0);
4838       if (__pyx_t_33) {
4839
4840         /* "bbox.pyx":226
4841  *             if iw > 0:
4842  *                 ih = (
4843  *                     min(boxes[n, 3], query_boxes[k, 3]) -             # <<<<<<<<<<<<<<
4844  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
4845  *                 )
4846  */
4847         __pyx_t_34 = __pyx_v_k;
4848         __pyx_t_35 = 3;
4849         __pyx_t_12 = -1;
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)
4858         }
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;
4861         __pyx_t_37 = 3;
4862         __pyx_t_12 = -1;
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)
4871         }
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;
4875         } else {
4876           __pyx_t_23 = __pyx_t_27;
4877         }
4878
4879         /* "bbox.pyx":227
4880  *                 ih = (
4881  *                     min(boxes[n, 3], query_boxes[k, 3]) -
4882  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1             # <<<<<<<<<<<<<<
4883  *                 )
4884  *                 if ih > 0:
4885  */
4886         __pyx_t_38 = __pyx_v_k;
4887         __pyx_t_39 = 1;
4888         __pyx_t_12 = -1;
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)
4897         }
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;
4900         __pyx_t_41 = 1;
4901         __pyx_t_12 = -1;
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)
4910         }
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;
4914         } else {
4915           __pyx_t_26 = __pyx_t_27;
4916         }
4917
4918         /* "bbox.pyx":226
4919  *             if iw > 0:
4920  *                 ih = (
4921  *                     min(boxes[n, 3], query_boxes[k, 3]) -             # <<<<<<<<<<<<<<
4922  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
4923  *                 )
4924  */
4925         __pyx_v_ih = ((__pyx_t_23 - __pyx_t_26) + 1.0);
4926
4927         /* "bbox.pyx":229
4928  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
4929  *                 )
4930  *                 if ih > 0:             # <<<<<<<<<<<<<<
4931  *                     if query_boxes[k, 4] == -1:
4932  *                         ua = float((boxes[n, 2] - boxes[n, 0] + 1)
4933  */
4934         __pyx_t_33 = ((__pyx_v_ih > 0.0) != 0);
4935         if (__pyx_t_33) {
4936
4937           /* "bbox.pyx":230
4938  *                 )
4939  *                 if ih > 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))
4943  */
4944           __pyx_t_42 = __pyx_v_k;
4945           __pyx_t_43 = 4;
4946           __pyx_t_12 = -1;
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)
4955           }
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);
4957           if (__pyx_t_33) {
4958
4959             /* "bbox.pyx":231
4960  *                 if ih > 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
4965  */
4966             __pyx_t_44 = __pyx_v_n;
4967             __pyx_t_45 = 2;
4968             __pyx_t_12 = -1;
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)
4977             }
4978             __pyx_t_46 = __pyx_v_n;
4979             __pyx_t_47 = 0;
4980             __pyx_t_12 = -1;
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)
4989             }
4990
4991             /* "bbox.pyx":232
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]:
4997  */
4998             __pyx_t_48 = __pyx_v_n;
4999             __pyx_t_49 = 3;
5000             __pyx_t_12 = -1;
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)
5009             }
5010             __pyx_t_50 = __pyx_v_n;
5011             __pyx_t_51 = 1;
5012             __pyx_t_12 = -1;
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)
5021             }
5022
5023             /* "bbox.pyx":231
5024  *                 if ih > 0:
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
5029  */
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)));
5031
5032             /* "bbox.pyx":233
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:
5038  */
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)
5043             }
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);
5047             __pyx_t_2 = 0;
5048
5049             /* "bbox.pyx":234
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
5055  */
5056             __pyx_t_52 = __pyx_v_n;
5057             __pyx_t_12 = -1;
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)
5062             }
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;
5069             if (__pyx_t_33) {
5070
5071               /* "bbox.pyx":235
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
5077  */
5078               __pyx_t_53 = __pyx_v_n;
5079               __pyx_t_12 = -1;
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)
5084               }
5085               __pyx_t_54 = (*__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_gt_assignment.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_gt_assignment.diminfo[0].strides));
5086               __pyx_t_55 = 4;
5087               __pyx_t_12 = -1;
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)
5099               }
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);
5101               if (!__pyx_t_56) {
5102               } else {
5103                 __pyx_t_33 = __pyx_t_56;
5104                 goto __pyx_L12_bool_binop_done;
5105               }
5106               __pyx_t_57 = __pyx_v_n;
5107               __pyx_t_12 = -1;
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)
5112               }
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:;
5116               if (__pyx_t_33) {
5117
5118                 /* "bbox.pyx":236
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
5123  *                     else:
5124  */
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;
5127                 __pyx_t_12 = -1;
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)
5132                 }
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;
5134
5135                 /* "bbox.pyx":237
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             # <<<<<<<<<<<<<<
5139  *                     else:
5140  *                         ua = float(
5141  */
5142                 __pyx_t_59 = __pyx_v_n;
5143                 __pyx_t_12 = -1;
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)
5148                 }
5149                 *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_gt_assignment.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_gt_assignment.diminfo[0].strides) = __pyx_v_k;
5150
5151                 /* "bbox.pyx":235
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
5157  */
5158               }
5159
5160               /* "bbox.pyx":234
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
5166  */
5167             }
5168
5169             /* "bbox.pyx":230
5170  *                 )
5171  *                 if ih > 0:
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))
5175  */
5176             goto __pyx_L9;
5177           }
5178
5179           /* "bbox.pyx":239
5180  *                                 gt_assignment[n] = k
5181  *                     else:
5182  *                         ua = float(             # <<<<<<<<<<<<<<
5183  *                             (boxes[n, 2] - boxes[n, 0] + 1) *
5184  *                             (boxes[n, 3] - boxes[n, 1] + 1) +
5185  */
5186           /*else*/ {
5187
5188             /* "bbox.pyx":240
5189  *                     else:
5190  *                         ua = float(
5191  *                             (boxes[n, 2] - boxes[n, 0] + 1) *             # <<<<<<<<<<<<<<
5192  *                             (boxes[n, 3] - boxes[n, 1] + 1) +
5193  *                             box_area - iw * ih
5194  */
5195             __pyx_t_60 = __pyx_v_n;
5196             __pyx_t_61 = 2;
5197             __pyx_t_12 = -1;
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)
5206             }
5207             __pyx_t_62 = __pyx_v_n;
5208             __pyx_t_63 = 0;
5209             __pyx_t_12 = -1;
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)
5218             }
5219
5220             /* "bbox.pyx":241
5221  *                         ua = float(
5222  *                             (boxes[n, 2] - boxes[n, 0] + 1) *
5223  *                             (boxes[n, 3] - boxes[n, 1] + 1) +             # <<<<<<<<<<<<<<
5224  *                             box_area - iw * ih
5225  *                         )
5226  */
5227             __pyx_t_64 = __pyx_v_n;
5228             __pyx_t_65 = 3;
5229             __pyx_t_12 = -1;
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)
5238             }
5239             __pyx_t_66 = __pyx_v_n;
5240             __pyx_t_67 = 1;
5241             __pyx_t_12 = -1;
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)
5250             }
5251
5252             /* "bbox.pyx":239
5253  *                                 gt_assignment[n] = k
5254  *                     else:
5255  *                         ua = float(             # <<<<<<<<<<<<<<
5256  *                             (boxes[n, 2] - boxes[n, 0] + 1) *
5257  *                             (boxes[n, 3] - boxes[n, 1] + 1) +
5258  */
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)));
5260
5261             /* "bbox.pyx":244
5262  *                             box_area - iw * ih
5263  *                         )
5264  *                         overlap = iw * ih / ua             # <<<<<<<<<<<<<<
5265  *                         if overlap > max_overlaps[n]:
5266  *                             max_overlaps[n] = overlap
5267  */
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)
5272             }
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);
5276             __pyx_t_1 = 0;
5277
5278             /* "bbox.pyx":245
5279  *                         )
5280  *                         overlap = iw * ih / ua
5281  *                         if overlap > max_overlaps[n]:             # <<<<<<<<<<<<<<
5282  *                             max_overlaps[n] = overlap
5283  *                             gt_assignment[n] = k
5284  */
5285             __pyx_t_68 = __pyx_v_n;
5286             __pyx_t_12 = -1;
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)
5291             }
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;
5298             if (__pyx_t_33) {
5299
5300               /* "bbox.pyx":246
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
5306  */
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;
5309               __pyx_t_12 = -1;
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)
5314               }
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;
5316
5317               /* "bbox.pyx":247
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
5323  */
5324               __pyx_t_70 = __pyx_v_n;
5325               __pyx_t_12 = -1;
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)
5330               }
5331               *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_gt_assignment.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_gt_assignment.diminfo[0].strides) = __pyx_v_k;
5332
5333               /* "bbox.pyx":245
5334  *                         )
5335  *                         overlap = iw * ih / ua
5336  *                         if overlap > max_overlaps[n]:             # <<<<<<<<<<<<<<
5337  *                             max_overlaps[n] = overlap
5338  *                             gt_assignment[n] = k
5339  */
5340             }
5341           }
5342           __pyx_L9:;
5343
5344           /* "bbox.pyx":229
5345  *                     max(boxes[n, 1], query_boxes[k, 1]) + 1
5346  *                 )
5347  *                 if ih > 0:             # <<<<<<<<<<<<<<
5348  *                     if query_boxes[k, 4] == -1:
5349  *                         ua = float((boxes[n, 2] - boxes[n, 0] + 1)
5350  */
5351         }
5352
5353         /* "bbox.pyx":224
5354  *                 max(boxes[n, 0], query_boxes[k, 0]) + 1
5355  *             )
5356  *             if iw > 0:             # <<<<<<<<<<<<<<
5357  *                 ih = (
5358  *                     min(boxes[n, 3], query_boxes[k, 3]) -
5359  */
5360       }
5361     }
5362   }
5363
5364   /* "bbox.pyx":249
5365  *                             gt_assignment[n] = k
5366  *                     #overlaps[n, k] = overlap
5367  *     return gt_assignment, max_overlaps             # <<<<<<<<<<<<<<
5368  */
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;
5379   __pyx_t_2 = 0;
5380   goto __pyx_L0;
5381
5382   /* "bbox.pyx":194
5383  * 
5384  * 
5385  * def get_assignment_overlaps(             # <<<<<<<<<<<<<<
5386  *         np.ndarray[DTYPE_t, ndim=2] boxes,
5387  *         np.ndarray[DTYPE_t, ndim=2] query_boxes,
5388  */
5389
5390   /* function exit code */
5391   __pyx_L1_error:;
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);
5407   __pyx_r = NULL;
5408   goto __pyx_L2;
5409   __pyx_L0:;
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);
5414   __pyx_L2:;
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();
5420   return __pyx_r;
5421 }
5422
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.
5429  */
5430
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) {
5434   int __pyx_r;
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));
5438
5439   /* function exit code */
5440   __Pyx_RefNannyFinishContext();
5441   return __pyx_r;
5442 }
5443
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;
5446   int __pyx_v_i;
5447   int __pyx_v_ndim;
5448   int __pyx_v_endian_detector;
5449   int __pyx_v_little_endian;
5450   int __pyx_v_t;
5451   char *__pyx_v_f;
5452   PyArray_Descr *__pyx_v_descr = 0;
5453   int __pyx_v_offset;
5454   int __pyx_v_hasfields;
5455   int __pyx_r;
5456   __Pyx_RefNannyDeclarations
5457   int __pyx_t_1;
5458   int __pyx_t_2;
5459   PyObject *__pyx_t_3 = NULL;
5460   int __pyx_t_4;
5461   int __pyx_t_5;
5462   PyObject *__pyx_t_6 = NULL;
5463   char *__pyx_t_7;
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);
5468   }
5469
5470   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":203
5471  *             # of flags
5472  * 
5473  *             if info == NULL: return             # <<<<<<<<<<<<<<
5474  * 
5475  *             cdef int copy_shape, i, ndim
5476  */
5477   __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
5478   if (__pyx_t_1) {
5479     __pyx_r = 0;
5480     goto __pyx_L0;
5481   }
5482
5483   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":206
5484  * 
5485  *             cdef int copy_shape, i, ndim
5486  *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
5487  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
5488  * 
5489  */
5490   __pyx_v_endian_detector = 1;
5491
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)             # <<<<<<<<<<<<<<
5496  * 
5497  *             ndim = PyArray_NDIM(self)
5498  */
5499   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
5500
5501   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":209
5502  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
5503  * 
5504  *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
5505  * 
5506  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
5507  */
5508   __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
5509
5510   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
5511  *             ndim = PyArray_NDIM(self)
5512  * 
5513  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
5514  *                 copy_shape = 1
5515  *             else:
5516  */
5517   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
5518   if (__pyx_t_1) {
5519
5520     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":212
5521  * 
5522  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
5523  *                 copy_shape = 1             # <<<<<<<<<<<<<<
5524  *             else:
5525  *                 copy_shape = 0
5526  */
5527     __pyx_v_copy_shape = 1;
5528
5529     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
5530  *             ndim = PyArray_NDIM(self)
5531  * 
5532  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
5533  *                 copy_shape = 1
5534  *             else:
5535  */
5536     goto __pyx_L4;
5537   }
5538
5539   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":214
5540  *                 copy_shape = 1
5541  *             else:
5542  *                 copy_shape = 0             # <<<<<<<<<<<<<<
5543  * 
5544  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
5545  */
5546   /*else*/ {
5547     __pyx_v_copy_shape = 0;
5548   }
5549   __pyx_L4:;
5550
5551   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
5552  *                 copy_shape = 0
5553  * 
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")
5557  */
5558   __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
5559   if (__pyx_t_2) {
5560   } else {
5561     __pyx_t_1 = __pyx_t_2;
5562     goto __pyx_L6_bool_binop_done;
5563   }
5564
5565   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":217
5566  * 
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")
5570  * 
5571  */
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:;
5575
5576   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
5577  *                 copy_shape = 0
5578  * 
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")
5582  */
5583   if (__pyx_t_1) {
5584
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")             # <<<<<<<<<<<<<<
5589  * 
5590  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
5591  */
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)
5597
5598     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
5599  *                 copy_shape = 0
5600  * 
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")
5604  */
5605   }
5606
5607   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
5608  *                 raise ValueError(u"ndarray is not C contiguous")
5609  * 
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")
5613  */
5614   __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
5615   if (__pyx_t_2) {
5616   } else {
5617     __pyx_t_1 = __pyx_t_2;
5618     goto __pyx_L9_bool_binop_done;
5619   }
5620
5621   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":221
5622  * 
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")
5626  * 
5627  */
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:;
5631
5632   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
5633  *                 raise ValueError(u"ndarray is not C contiguous")
5634  * 
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")
5638  */
5639   if (__pyx_t_1) {
5640
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")             # <<<<<<<<<<<<<<
5645  * 
5646  *             info.buf = PyArray_DATA(self)
5647  */
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)
5653
5654     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
5655  *                 raise ValueError(u"ndarray is not C contiguous")
5656  * 
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")
5660  */
5661   }
5662
5663   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":224
5664  *                 raise ValueError(u"ndarray is not Fortran contiguous")
5665  * 
5666  *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
5667  *             info.ndim = ndim
5668  *             if copy_shape:
5669  */
5670   __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
5671
5672   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":225
5673  * 
5674  *             info.buf = PyArray_DATA(self)
5675  *             info.ndim = ndim             # <<<<<<<<<<<<<<
5676  *             if copy_shape:
5677  *                 # Allocate new buffer for strides and shape info.
5678  */
5679   __pyx_v_info->ndim = __pyx_v_ndim;
5680
5681   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
5682  *             info.buf = PyArray_DATA(self)
5683  *             info.ndim = ndim
5684  *             if copy_shape:             # <<<<<<<<<<<<<<
5685  *                 # Allocate new buffer for strides and shape info.
5686  *                 # This is allocated as one block, strides first.
5687  */
5688   __pyx_t_1 = (__pyx_v_copy_shape != 0);
5689   if (__pyx_t_1) {
5690
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):
5697  */
5698     __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
5699
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]
5706  */
5707     __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
5708
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]
5715  */
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;
5719
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]
5725  *             else:
5726  */
5727       (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
5728
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]             # <<<<<<<<<<<<<<
5733  *             else:
5734  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
5735  */
5736       (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
5737     }
5738
5739     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
5740  *             info.buf = PyArray_DATA(self)
5741  *             info.ndim = ndim
5742  *             if copy_shape:             # <<<<<<<<<<<<<<
5743  *                 # Allocate new buffer for strides and shape info.
5744  *                 # This is allocated as one block, strides first.
5745  */
5746     goto __pyx_L11;
5747   }
5748
5749   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235
5750  *                     info.shape[i] = PyArray_DIMS(self)[i]
5751  *             else:
5752  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
5753  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
5754  *             info.suboffsets = NULL
5755  */
5756   /*else*/ {
5757     __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
5758
5759     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":236
5760  *             else:
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)
5765  */
5766     __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
5767   }
5768   __pyx_L11:;
5769
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)
5776  */
5777   __pyx_v_info->suboffsets = NULL;
5778
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)
5784  * 
5785  */
5786   __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
5787
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)             # <<<<<<<<<<<<<<
5792  * 
5793  *             cdef int t
5794  */
5795   __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
5796
5797   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242
5798  * 
5799  *             cdef int t
5800  *             cdef char* f = NULL             # <<<<<<<<<<<<<<
5801  *             cdef dtype descr = self.descr
5802  *             cdef int offset
5803  */
5804   __pyx_v_f = NULL;
5805
5806   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243
5807  *             cdef int t
5808  *             cdef char* f = NULL
5809  *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
5810  *             cdef int offset
5811  * 
5812  */
5813   __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
5814   __Pyx_INCREF(__pyx_t_3);
5815   __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
5816   __pyx_t_3 = 0;
5817
5818   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":246
5819  *             cdef int offset
5820  * 
5821  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
5822  * 
5823  *             if not hasfields and not copy_shape:
5824  */
5825   __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
5826
5827   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
5828  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
5829  * 
5830  *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
5831  *                 # do not call releasebuffer
5832  *                 info.obj = None
5833  */
5834   __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
5835   if (__pyx_t_2) {
5836   } else {
5837     __pyx_t_1 = __pyx_t_2;
5838     goto __pyx_L15_bool_binop_done;
5839   }
5840   __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
5841   __pyx_t_1 = __pyx_t_2;
5842   __pyx_L15_bool_binop_done:;
5843   if (__pyx_t_1) {
5844
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             # <<<<<<<<<<<<<<
5849  *             else:
5850  *                 # need to call releasebuffer
5851  */
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;
5857
5858     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
5859  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
5860  * 
5861  *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
5862  *                 # do not call releasebuffer
5863  *                 info.obj = None
5864  */
5865     goto __pyx_L14;
5866   }
5867
5868   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":253
5869  *             else:
5870  *                 # need to call releasebuffer
5871  *                 info.obj = self             # <<<<<<<<<<<<<<
5872  * 
5873  *             if not hasfields:
5874  */
5875   /*else*/ {
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);
5881   }
5882   __pyx_L14:;
5883
5884   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
5885  *                 info.obj = self
5886  * 
5887  *             if not hasfields:             # <<<<<<<<<<<<<<
5888  *                 t = descr.type_num
5889  *                 if ((descr.byteorder == c'>' and little_endian) or
5890  */
5891   __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
5892   if (__pyx_t_1) {
5893
5894     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":256
5895  * 
5896  *             if not hasfields:
5897  *                 t = descr.type_num             # <<<<<<<<<<<<<<
5898  *                 if ((descr.byteorder == c'>' and little_endian) or
5899  *                     (descr.byteorder == c'<' and not little_endian)):
5900  */
5901     __pyx_t_4 = __pyx_v_descr->type_num;
5902     __pyx_v_t = __pyx_t_4;
5903
5904     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
5905  *             if not hasfields:
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")
5910  */
5911     __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
5912     if (!__pyx_t_2) {
5913       goto __pyx_L20_next_or;
5914     } else {
5915     }
5916     __pyx_t_2 = (__pyx_v_little_endian != 0);
5917     if (!__pyx_t_2) {
5918     } else {
5919       __pyx_t_1 = __pyx_t_2;
5920       goto __pyx_L19_bool_binop_done;
5921     }
5922     __pyx_L20_next_or:;
5923
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"
5930  */
5931     __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
5932     if (__pyx_t_2) {
5933     } else {
5934       __pyx_t_1 = __pyx_t_2;
5935       goto __pyx_L19_bool_binop_done;
5936     }
5937     __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
5938     __pyx_t_1 = __pyx_t_2;
5939     __pyx_L19_bool_binop_done:;
5940
5941     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
5942  *             if not hasfields:
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")
5947  */
5948     if (__pyx_t_1) {
5949
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"
5956  */
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)
5962
5963       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
5964  *             if not hasfields:
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")
5969  */
5970     }
5971
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"
5978  */
5979     switch (__pyx_v_t) {
5980       case NPY_BYTE:
5981       __pyx_v_f = ((char *)"b");
5982       break;
5983
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"
5990  */
5991       case NPY_UBYTE:
5992       __pyx_v_f = ((char *)"B");
5993       break;
5994
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"
6001  */
6002       case NPY_SHORT:
6003       __pyx_v_f = ((char *)"h");
6004       break;
6005
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"
6012  */
6013       case NPY_USHORT:
6014       __pyx_v_f = ((char *)"H");
6015       break;
6016
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"
6023  */
6024       case NPY_INT:
6025       __pyx_v_f = ((char *)"i");
6026       break;
6027
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"
6034  */
6035       case NPY_UINT:
6036       __pyx_v_f = ((char *)"I");
6037       break;
6038
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"
6045  */
6046       case NPY_LONG:
6047       __pyx_v_f = ((char *)"l");
6048       break;
6049
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"
6056  */
6057       case NPY_ULONG:
6058       __pyx_v_f = ((char *)"L");
6059       break;
6060
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"
6067  */
6068       case NPY_LONGLONG:
6069       __pyx_v_f = ((char *)"q");
6070       break;
6071
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"
6078  */
6079       case NPY_ULONGLONG:
6080       __pyx_v_f = ((char *)"Q");
6081       break;
6082
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"
6089  */
6090       case NPY_FLOAT:
6091       __pyx_v_f = ((char *)"f");
6092       break;
6093
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"
6100  */
6101       case NPY_DOUBLE:
6102       __pyx_v_f = ((char *)"d");
6103       break;
6104
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"
6111  */
6112       case NPY_LONGDOUBLE:
6113       __pyx_v_f = ((char *)"g");
6114       break;
6115
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"
6122  */
6123       case NPY_CFLOAT:
6124       __pyx_v_f = ((char *)"Zf");
6125       break;
6126
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"
6133  */
6134       case NPY_CDOUBLE:
6135       __pyx_v_f = ((char *)"Zd");
6136       break;
6137
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"
6143  *                 else:
6144  */
6145       case NPY_CLONGDOUBLE:
6146       __pyx_v_f = ((char *)"Zg");
6147       break;
6148
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"             # <<<<<<<<<<<<<<
6153  *                 else:
6154  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6155  */
6156       case NPY_OBJECT:
6157       __pyx_v_f = ((char *)"O");
6158       break;
6159       default:
6160
6161       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
6162  *                 elif t == NPY_OBJECT:      f = "O"
6163  *                 else:
6164  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
6165  *                 info.format = f
6166  *                 return
6167  */
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);
6177       __pyx_t_6 = 0;
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)
6184       break;
6185     }
6186
6187     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
6188  *                 else:
6189  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6190  *                 info.format = f             # <<<<<<<<<<<<<<
6191  *                 return
6192  *             else:
6193  */
6194     __pyx_v_info->format = __pyx_v_f;
6195
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)
6198  *                 info.format = f
6199  *                 return             # <<<<<<<<<<<<<<
6200  *             else:
6201  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
6202  */
6203     __pyx_r = 0;
6204     goto __pyx_L0;
6205
6206     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
6207  *                 info.obj = self
6208  * 
6209  *             if not hasfields:             # <<<<<<<<<<<<<<
6210  *                 t = descr.type_num
6211  *                 if ((descr.byteorder == c'>' and little_endian) or
6212  */
6213   }
6214
6215   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":282
6216  *                 return
6217  *             else:
6218  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
6219  *                 info.format[0] = c'^' # Native data types, manual alignment
6220  *                 offset = 0
6221  */
6222   /*else*/ {
6223     __pyx_v_info->format = ((char *)malloc(0xFF));
6224
6225     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
6226  *             else:
6227  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
6228  *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
6229  *                 offset = 0
6230  *                 f = _util_dtypestring(descr, info.format + 1,
6231  */
6232     (__pyx_v_info->format[0]) = '^';
6233
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,
6240  */
6241     __pyx_v_offset = 0;
6242
6243     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
6244  *                 info.format[0] = c'^' # Native data types, manual alignment
6245  *                 offset = 0
6246  *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
6247  *                                       info.format + _buffer_format_string_len,
6248  *                                       &offset)
6249  */
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;
6252
6253     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":288
6254  *                                       info.format + _buffer_format_string_len,
6255  *                                       &offset)
6256  *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
6257  * 
6258  *         def __releasebuffer__(ndarray self, Py_buffer* info):
6259  */
6260     (__pyx_v_f[0]) = '\x00';
6261   }
6262
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.
6269  */
6270
6271   /* function exit code */
6272   __pyx_r = 0;
6273   goto __pyx_L0;
6274   __pyx_L1_error:;
6275   __Pyx_XDECREF(__pyx_t_3);
6276   __Pyx_XDECREF(__pyx_t_6);
6277   __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6278   __pyx_r = -1;
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;
6282   }
6283   goto __pyx_L2;
6284   __pyx_L0:;
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;
6288   }
6289   __pyx_L2:;
6290   __Pyx_XDECREF((PyObject *)__pyx_v_descr);
6291   __Pyx_RefNannyFinishContext();
6292   return __pyx_r;
6293 }
6294
6295 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
6296  *                 f[0] = c'\0' # Terminate format string
6297  * 
6298  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
6299  *             if PyArray_HASFIELDS(self):
6300  *                 stdlib.free(info.format)
6301  */
6302
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));
6309
6310   /* function exit code */
6311   __Pyx_RefNannyFinishContext();
6312 }
6313
6314 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
6315   __Pyx_RefNannyDeclarations
6316   int __pyx_t_1;
6317   __Pyx_RefNannySetupContext("__releasebuffer__", 0);
6318
6319   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
6320  * 
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):
6325  */
6326   __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
6327   if (__pyx_t_1) {
6328
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)
6335  */
6336     free(__pyx_v_info->format);
6337
6338     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
6339  * 
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):
6344  */
6345   }
6346
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
6353  */
6354   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
6355   if (__pyx_t_1) {
6356
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
6362  * 
6363  */
6364     free(__pyx_v_info->strides);
6365
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
6372  */
6373   }
6374
6375   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
6376  *                 f[0] = c'\0' # Terminate format string
6377  * 
6378  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
6379  *             if PyArray_HASFIELDS(self):
6380  *                 stdlib.free(info.format)
6381  */
6382
6383   /* function exit code */
6384   __Pyx_RefNannyFinishContext();
6385 }
6386
6387 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
6388  * ctypedef npy_cdouble     complex_t
6389  * 
6390  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
6391  *     return PyArray_MultiIterNew(1, <void*>a)
6392  * 
6393  */
6394
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);
6400
6401   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771
6402  * 
6403  * cdef inline object PyArray_MultiIterNew1(a):
6404  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
6405  * 
6406  * cdef inline object PyArray_MultiIterNew2(a, b):
6407  */
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;
6412   __pyx_t_1 = 0;
6413   goto __pyx_L0;
6414
6415   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
6416  * ctypedef npy_cdouble     complex_t
6417  * 
6418  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
6419  *     return PyArray_MultiIterNew(1, <void*>a)
6420  * 
6421  */
6422
6423   /* function exit code */
6424   __pyx_L1_error:;
6425   __Pyx_XDECREF(__pyx_t_1);
6426   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
6427   __pyx_r = 0;
6428   __pyx_L0:;
6429   __Pyx_XGIVEREF(__pyx_r);
6430   __Pyx_RefNannyFinishContext();
6431   return __pyx_r;
6432 }
6433
6434 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
6435  *     return PyArray_MultiIterNew(1, <void*>a)
6436  * 
6437  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
6438  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6439  * 
6440  */
6441
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);
6447
6448   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":774
6449  * 
6450  * cdef inline object PyArray_MultiIterNew2(a, b):
6451  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
6452  * 
6453  * cdef inline object PyArray_MultiIterNew3(a, b, c):
6454  */
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;
6459   __pyx_t_1 = 0;
6460   goto __pyx_L0;
6461
6462   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
6463  *     return PyArray_MultiIterNew(1, <void*>a)
6464  * 
6465  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
6466  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6467  * 
6468  */
6469
6470   /* function exit code */
6471   __pyx_L1_error:;
6472   __Pyx_XDECREF(__pyx_t_1);
6473   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
6474   __pyx_r = 0;
6475   __pyx_L0:;
6476   __Pyx_XGIVEREF(__pyx_r);
6477   __Pyx_RefNannyFinishContext();
6478   return __pyx_r;
6479 }
6480
6481 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
6482  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6483  * 
6484  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
6485  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6486  * 
6487  */
6488
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);
6494
6495   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
6496  * 
6497  * cdef inline object PyArray_MultiIterNew3(a, b, c):
6498  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
6499  * 
6500  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6501  */
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;
6506   __pyx_t_1 = 0;
6507   goto __pyx_L0;
6508
6509   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
6510  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6511  * 
6512  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
6513  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6514  * 
6515  */
6516
6517   /* function exit code */
6518   __pyx_L1_error:;
6519   __Pyx_XDECREF(__pyx_t_1);
6520   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
6521   __pyx_r = 0;
6522   __pyx_L0:;
6523   __Pyx_XGIVEREF(__pyx_r);
6524   __Pyx_RefNannyFinishContext();
6525   return __pyx_r;
6526 }
6527
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)
6530  * 
6531  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
6532  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6533  * 
6534  */
6535
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);
6541
6542   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":780
6543  * 
6544  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6545  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
6546  * 
6547  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6548  */
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;
6553   __pyx_t_1 = 0;
6554   goto __pyx_L0;
6555
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)
6558  * 
6559  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
6560  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6561  * 
6562  */
6563
6564   /* function exit code */
6565   __pyx_L1_error:;
6566   __Pyx_XDECREF(__pyx_t_1);
6567   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
6568   __pyx_r = 0;
6569   __pyx_L0:;
6570   __Pyx_XGIVEREF(__pyx_r);
6571   __Pyx_RefNannyFinishContext();
6572   return __pyx_r;
6573 }
6574
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)
6577  * 
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)
6580  * 
6581  */
6582
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);
6588
6589   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
6590  * 
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)             # <<<<<<<<<<<<<<
6593  * 
6594  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
6595  */
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;
6600   __pyx_t_1 = 0;
6601   goto __pyx_L0;
6602
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)
6605  * 
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)
6608  * 
6609  */
6610
6611   /* function exit code */
6612   __pyx_L1_error:;
6613   __Pyx_XDECREF(__pyx_t_1);
6614   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
6615   __pyx_r = 0;
6616   __pyx_L0:;
6617   __Pyx_XGIVEREF(__pyx_r);
6618   __Pyx_RefNannyFinishContext();
6619   return __pyx_r;
6620 }
6621
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)
6624  * 
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.
6628  */
6629
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;
6638   char *__pyx_r;
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;
6644   int __pyx_t_5;
6645   int __pyx_t_6;
6646   int __pyx_t_7;
6647   long __pyx_t_8;
6648   char *__pyx_t_9;
6649   __Pyx_RefNannySetupContext("_util_dtypestring", 0);
6650
6651   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
6652  * 
6653  *     cdef dtype child
6654  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
6655  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
6656  *     cdef tuple fields
6657  */
6658   __pyx_v_endian_detector = 1;
6659
6660   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
6661  *     cdef dtype child
6662  *     cdef int endian_detector = 1
6663  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
6664  *     cdef tuple fields
6665  * 
6666  */
6667   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
6668
6669   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
6670  *     cdef tuple fields
6671  * 
6672  *     for childname in descr.names:             # <<<<<<<<<<<<<<
6673  *         fields = descr.fields[childname]
6674  *         child, new_offset = fields
6675  */
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)
6679   }
6680   __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
6681   for (;;) {
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)
6685     #else
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);
6688     #endif
6689     __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
6690     __pyx_t_3 = 0;
6691
6692     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":795
6693  * 
6694  *     for childname in descr.names:
6695  *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
6696  *         child, new_offset = fields
6697  * 
6698  */
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)
6702     }
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));
6707     __pyx_t_3 = 0;
6708
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             # <<<<<<<<<<<<<<
6713  * 
6714  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
6715  */
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);
6720       #else
6721       Py_ssize_t size = PySequence_Size(sequence);
6722       #endif
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)
6727       }
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);
6733       #else
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);
6738       #endif
6739     } else {
6740       __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 796, __pyx_L1_error)
6741     }
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));
6744     __pyx_t_3 = 0;
6745     __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
6746     __pyx_t_4 = 0;
6747
6748     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
6749  *         child, new_offset = fields
6750  * 
6751  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
6752  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6753  * 
6754  */
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);
6763     if (__pyx_t_6) {
6764
6765       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
6766  * 
6767  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
6768  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
6769  * 
6770  *         if ((child.byteorder == c'>' and little_endian) or
6771  */
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)
6777
6778       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
6779  *         child, new_offset = fields
6780  * 
6781  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
6782  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6783  * 
6784  */
6785     }
6786
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")
6789  * 
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")
6793  */
6794     __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
6795     if (!__pyx_t_7) {
6796       goto __pyx_L8_next_or;
6797     } else {
6798     }
6799     __pyx_t_7 = (__pyx_v_little_endian != 0);
6800     if (!__pyx_t_7) {
6801     } else {
6802       __pyx_t_6 = __pyx_t_7;
6803       goto __pyx_L7_bool_binop_done;
6804     }
6805     __pyx_L8_next_or:;
6806
6807     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
6808  * 
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
6813  */
6814     __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
6815     if (__pyx_t_7) {
6816     } else {
6817       __pyx_t_6 = __pyx_t_7;
6818       goto __pyx_L7_bool_binop_done;
6819     }
6820     __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
6821     __pyx_t_6 = __pyx_t_7;
6822     __pyx_L7_bool_binop_done:;
6823
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")
6826  * 
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")
6830  */
6831     if (__pyx_t_6) {
6832
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
6839  */
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)
6845
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")
6848  * 
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")
6852  */
6853     }
6854
6855     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
6856  * 
6857  *         # Output padding bytes
6858  *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
6859  *             f[0] = 120 # "x"; pad byte
6860  *             f += 1
6861  */
6862     while (1) {
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;
6870
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             # <<<<<<<<<<<<<<
6875  *             f += 1
6876  *             offset[0] += 1
6877  */
6878       (__pyx_v_f[0]) = 0x78;
6879
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             # <<<<<<<<<<<<<<
6884  *             offset[0] += 1
6885  * 
6886  */
6887       __pyx_v_f = (__pyx_v_f + 1);
6888
6889       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
6890  *             f[0] = 120 # "x"; pad byte
6891  *             f += 1
6892  *             offset[0] += 1             # <<<<<<<<<<<<<<
6893  * 
6894  *         offset[0] += child.itemsize
6895  */
6896       __pyx_t_8 = 0;
6897       (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
6898     }
6899
6900     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":818
6901  *             offset[0] += 1
6902  * 
6903  *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
6904  * 
6905  *         if not PyDataType_HASFIELDS(child):
6906  */
6907     __pyx_t_8 = 0;
6908     (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
6909
6910     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
6911  *         offset[0] += child.itemsize
6912  * 
6913  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
6914  *             t = child.type_num
6915  *             if end - f < 5:
6916  */
6917     __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
6918     if (__pyx_t_6) {
6919
6920       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
6921  * 
6922  *         if not PyDataType_HASFIELDS(child):
6923  *             t = child.type_num             # <<<<<<<<<<<<<<
6924  *             if end - f < 5:
6925  *                 raise RuntimeError(u"Format string allocated too short.")
6926  */
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);
6930       __pyx_t_4 = 0;
6931
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.")
6937  * 
6938  */
6939       __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
6940       if (__pyx_t_6) {
6941
6942         /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
6943  *             t = child.type_num
6944  *             if end - f < 5:
6945  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
6946  * 
6947  *             # Until ticket #99 is fixed, use integers to avoid warnings
6948  */
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)
6954
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.")
6960  * 
6961  */
6962       }
6963
6964       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826
6965  * 
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"
6970  */
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;
6977       if (__pyx_t_6) {
6978         (__pyx_v_f[0]) = 98;
6979         goto __pyx_L15;
6980       }
6981
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"
6988  */
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;
6995       if (__pyx_t_6) {
6996         (__pyx_v_f[0]) = 66;
6997         goto __pyx_L15;
6998       }
6999
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"
7006  */
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;
7013       if (__pyx_t_6) {
7014         (__pyx_v_f[0]) = 0x68;
7015         goto __pyx_L15;
7016       }
7017
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"
7024  */
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;
7031       if (__pyx_t_6) {
7032         (__pyx_v_f[0]) = 72;
7033         goto __pyx_L15;
7034       }
7035
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"
7042  */
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;
7049       if (__pyx_t_6) {
7050         (__pyx_v_f[0]) = 0x69;
7051         goto __pyx_L15;
7052       }
7053
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"
7060  */
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;
7067       if (__pyx_t_6) {
7068         (__pyx_v_f[0]) = 73;
7069         goto __pyx_L15;
7070       }
7071
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"
7078  */
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;
7085       if (__pyx_t_6) {
7086         (__pyx_v_f[0]) = 0x6C;
7087         goto __pyx_L15;
7088       }
7089
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"
7096  */
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;
7103       if (__pyx_t_6) {
7104         (__pyx_v_f[0]) = 76;
7105         goto __pyx_L15;
7106       }
7107
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"
7114  */
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;
7121       if (__pyx_t_6) {
7122         (__pyx_v_f[0]) = 0x71;
7123         goto __pyx_L15;
7124       }
7125
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"
7132  */
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;
7139       if (__pyx_t_6) {
7140         (__pyx_v_f[0]) = 81;
7141         goto __pyx_L15;
7142       }
7143
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"
7150  */
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;
7157       if (__pyx_t_6) {
7158         (__pyx_v_f[0]) = 0x66;
7159         goto __pyx_L15;
7160       }
7161
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
7168  */
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;
7175       if (__pyx_t_6) {
7176         (__pyx_v_f[0]) = 0x64;
7177         goto __pyx_L15;
7178       }
7179
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
7186  */
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;
7193       if (__pyx_t_6) {
7194         (__pyx_v_f[0]) = 0x67;
7195         goto __pyx_L15;
7196       }
7197
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
7204  */
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;
7211       if (__pyx_t_6) {
7212         (__pyx_v_f[0]) = 90;
7213         (__pyx_v_f[1]) = 0x66;
7214         __pyx_v_f = (__pyx_v_f + 1);
7215         goto __pyx_L15;
7216       }
7217
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"
7224  */
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;
7231       if (__pyx_t_6) {
7232         (__pyx_v_f[0]) = 90;
7233         (__pyx_v_f[1]) = 0x64;
7234         __pyx_v_f = (__pyx_v_f + 1);
7235         goto __pyx_L15;
7236       }
7237
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"
7243  *             else:
7244  */
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;
7251       if (__pyx_t_6) {
7252         (__pyx_v_f[0]) = 90;
7253         (__pyx_v_f[1]) = 0x67;
7254         __pyx_v_f = (__pyx_v_f + 1);
7255         goto __pyx_L15;
7256       }
7257
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"             # <<<<<<<<<<<<<<
7262  *             else:
7263  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
7264  */
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;
7271       if (__pyx_t_6) {
7272         (__pyx_v_f[0]) = 79;
7273         goto __pyx_L15;
7274       }
7275
7276       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844
7277  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
7278  *             else:
7279  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
7280  *             f += 1
7281  *         else:
7282  */
7283       /*else*/ {
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);
7290         __pyx_t_3 = 0;
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)
7297       }
7298       __pyx_L15:;
7299
7300       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845
7301  *             else:
7302  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
7303  *             f += 1             # <<<<<<<<<<<<<<
7304  *         else:
7305  *             # Cython ignores struct boundary information ("T{...}"),
7306  */
7307       __pyx_v_f = (__pyx_v_f + 1);
7308
7309       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
7310  *         offset[0] += child.itemsize
7311  * 
7312  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
7313  *             t = child.type_num
7314  *             if end - f < 5:
7315  */
7316       goto __pyx_L13;
7317     }
7318
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)             # <<<<<<<<<<<<<<
7323  *     return f
7324  * 
7325  */
7326     /*else*/ {
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;
7329     }
7330     __pyx_L13:;
7331
7332     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
7333  *     cdef tuple fields
7334  * 
7335  *     for childname in descr.names:             # <<<<<<<<<<<<<<
7336  *         fields = descr.fields[childname]
7337  *         child, new_offset = fields
7338  */
7339   }
7340   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7341
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             # <<<<<<<<<<<<<<
7346  * 
7347  * 
7348  */
7349   __pyx_r = __pyx_v_f;
7350   goto __pyx_L0;
7351
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)
7354  * 
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.
7358  */
7359
7360   /* function exit code */
7361   __pyx_L1_error:;
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);
7366   __pyx_r = NULL;
7367   __pyx_L0:;
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();
7374   return __pyx_r;
7375 }
7376
7377 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
7378  * 
7379  * 
7380  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
7381  *      cdef PyObject* baseptr
7382  *      if base is None:
7383  */
7384
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
7388   int __pyx_t_1;
7389   int __pyx_t_2;
7390   __Pyx_RefNannySetupContext("set_array_base", 0);
7391
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:             # <<<<<<<<<<<<<<
7396  *          baseptr = NULL
7397  *      else:
7398  */
7399   __pyx_t_1 = (__pyx_v_base == Py_None);
7400   __pyx_t_2 = (__pyx_t_1 != 0);
7401   if (__pyx_t_2) {
7402
7403     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":969
7404  *      cdef PyObject* baseptr
7405  *      if base is None:
7406  *          baseptr = NULL             # <<<<<<<<<<<<<<
7407  *      else:
7408  *          Py_INCREF(base) # important to do this before decref below!
7409  */
7410     __pyx_v_baseptr = NULL;
7411
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:             # <<<<<<<<<<<<<<
7416  *          baseptr = NULL
7417  *      else:
7418  */
7419     goto __pyx_L3;
7420   }
7421
7422   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":971
7423  *          baseptr = NULL
7424  *      else:
7425  *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
7426  *          baseptr = <PyObject*>base
7427  *      Py_XDECREF(arr.base)
7428  */
7429   /*else*/ {
7430     Py_INCREF(__pyx_v_base);
7431
7432     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":972
7433  *      else:
7434  *          Py_INCREF(base) # important to do this before decref below!
7435  *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
7436  *      Py_XDECREF(arr.base)
7437  *      arr.base = baseptr
7438  */
7439     __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
7440   }
7441   __pyx_L3:;
7442
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
7448  * 
7449  */
7450   Py_XDECREF(__pyx_v_arr->base);
7451
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             # <<<<<<<<<<<<<<
7456  * 
7457  * cdef inline object get_array_base(ndarray arr):
7458  */
7459   __pyx_v_arr->base = __pyx_v_baseptr;
7460
7461   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
7462  * 
7463  * 
7464  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
7465  *      cdef PyObject* baseptr
7466  *      if base is None:
7467  */
7468
7469   /* function exit code */
7470   __Pyx_RefNannyFinishContext();
7471 }
7472
7473 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
7474  *      arr.base = baseptr
7475  * 
7476  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
7477  *     if arr.base is NULL:
7478  *         return None
7479  */
7480
7481 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
7482   PyObject *__pyx_r = NULL;
7483   __Pyx_RefNannyDeclarations
7484   int __pyx_t_1;
7485   __Pyx_RefNannySetupContext("get_array_base", 0);
7486
7487   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
7488  * 
7489  * cdef inline object get_array_base(ndarray arr):
7490  *     if arr.base is NULL:             # <<<<<<<<<<<<<<
7491  *         return None
7492  *     else:
7493  */
7494   __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
7495   if (__pyx_t_1) {
7496
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             # <<<<<<<<<<<<<<
7501  *     else:
7502  *         return <object>arr.base
7503  */
7504     __Pyx_XDECREF(__pyx_r);
7505     __Pyx_INCREF(Py_None);
7506     __pyx_r = Py_None;
7507     goto __pyx_L0;
7508
7509     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
7510  * 
7511  * cdef inline object get_array_base(ndarray arr):
7512  *     if arr.base is NULL:             # <<<<<<<<<<<<<<
7513  *         return None
7514  *     else:
7515  */
7516   }
7517
7518   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":980
7519  *         return None
7520  *     else:
7521  *         return <object>arr.base             # <<<<<<<<<<<<<<
7522  * 
7523  * 
7524  */
7525   /*else*/ {
7526     __Pyx_XDECREF(__pyx_r);
7527     __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
7528     __pyx_r = ((PyObject *)__pyx_v_arr->base);
7529     goto __pyx_L0;
7530   }
7531
7532   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
7533  *      arr.base = baseptr
7534  * 
7535  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
7536  *     if arr.base is NULL:
7537  *         return None
7538  */
7539
7540   /* function exit code */
7541   __pyx_L0:;
7542   __Pyx_XGIVEREF(__pyx_r);
7543   __Pyx_RefNannyFinishContext();
7544   return __pyx_r;
7545 }
7546
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
7549  * # Cython code.
7550  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
7551  *     try:
7552  *         _import_array()
7553  */
7554
7555 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
7556   int __pyx_r;
7557   __Pyx_RefNannyDeclarations
7558   PyObject *__pyx_t_1 = NULL;
7559   PyObject *__pyx_t_2 = NULL;
7560   PyObject *__pyx_t_3 = NULL;
7561   int __pyx_t_4;
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);
7567
7568   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
7569  * # Cython code.
7570  * cdef inline int import_array() except -1:
7571  *     try:             # <<<<<<<<<<<<<<
7572  *         _import_array()
7573  *     except Exception:
7574  */
7575   {
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);
7582     /*try:*/ {
7583
7584       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":987
7585  * cdef inline int import_array() except -1:
7586  *     try:
7587  *         _import_array()             # <<<<<<<<<<<<<<
7588  *     except Exception:
7589  *         raise ImportError("numpy.core.multiarray failed to import")
7590  */
7591       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 987, __pyx_L3_error)
7592
7593       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
7594  * # Cython code.
7595  * cdef inline int import_array() except -1:
7596  *     try:             # <<<<<<<<<<<<<<
7597  *         _import_array()
7598  *     except Exception:
7599  */
7600     }
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;
7605     __pyx_L3_error:;
7606     __Pyx_PyThreadState_assign
7607
7608     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":988
7609  *     try:
7610  *         _import_array()
7611  *     except Exception:             # <<<<<<<<<<<<<<
7612  *         raise ImportError("numpy.core.multiarray failed to import")
7613  * 
7614  */
7615     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7616     if (__pyx_t_4) {
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);
7622
7623       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
7624  *         _import_array()
7625  *     except Exception:
7626  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
7627  * 
7628  * cdef inline int import_umath() except -1:
7629  */
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)
7635     }
7636     goto __pyx_L5_except_error;
7637     __pyx_L5_except_error:;
7638
7639     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
7640  * # Cython code.
7641  * cdef inline int import_array() except -1:
7642  *     try:             # <<<<<<<<<<<<<<
7643  *         _import_array()
7644  *     except Exception:
7645  */
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;
7652     __pyx_L10_try_end:;
7653   }
7654
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
7657  * # Cython code.
7658  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
7659  *     try:
7660  *         _import_array()
7661  */
7662
7663   /* function exit code */
7664   __pyx_r = 0;
7665   goto __pyx_L0;
7666   __pyx_L1_error:;
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);
7672   __pyx_r = -1;
7673   __pyx_L0:;
7674   __Pyx_RefNannyFinishContext();
7675   return __pyx_r;
7676 }
7677
7678 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
7679  *         raise ImportError("numpy.core.multiarray failed to import")
7680  * 
7681  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
7682  *     try:
7683  *         _import_umath()
7684  */
7685
7686 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
7687   int __pyx_r;
7688   __Pyx_RefNannyDeclarations
7689   PyObject *__pyx_t_1 = NULL;
7690   PyObject *__pyx_t_2 = NULL;
7691   PyObject *__pyx_t_3 = NULL;
7692   int __pyx_t_4;
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);
7698
7699   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
7700  * 
7701  * cdef inline int import_umath() except -1:
7702  *     try:             # <<<<<<<<<<<<<<
7703  *         _import_umath()
7704  *     except Exception:
7705  */
7706   {
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);
7713     /*try:*/ {
7714
7715       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":993
7716  * cdef inline int import_umath() except -1:
7717  *     try:
7718  *         _import_umath()             # <<<<<<<<<<<<<<
7719  *     except Exception:
7720  *         raise ImportError("numpy.core.umath failed to import")
7721  */
7722       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 993, __pyx_L3_error)
7723
7724       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
7725  * 
7726  * cdef inline int import_umath() except -1:
7727  *     try:             # <<<<<<<<<<<<<<
7728  *         _import_umath()
7729  *     except Exception:
7730  */
7731     }
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;
7736     __pyx_L3_error:;
7737     __Pyx_PyThreadState_assign
7738
7739     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":994
7740  *     try:
7741  *         _import_umath()
7742  *     except Exception:             # <<<<<<<<<<<<<<
7743  *         raise ImportError("numpy.core.umath failed to import")
7744  * 
7745  */
7746     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7747     if (__pyx_t_4) {
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);
7753
7754       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995
7755  *         _import_umath()
7756  *     except Exception:
7757  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
7758  * 
7759  * cdef inline int import_ufunc() except -1:
7760  */
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)
7766     }
7767     goto __pyx_L5_except_error;
7768     __pyx_L5_except_error:;
7769
7770     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
7771  * 
7772  * cdef inline int import_umath() except -1:
7773  *     try:             # <<<<<<<<<<<<<<
7774  *         _import_umath()
7775  *     except Exception:
7776  */
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;
7783     __pyx_L10_try_end:;
7784   }
7785
7786   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
7787  *         raise ImportError("numpy.core.multiarray failed to import")
7788  * 
7789  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
7790  *     try:
7791  *         _import_umath()
7792  */
7793
7794   /* function exit code */
7795   __pyx_r = 0;
7796   goto __pyx_L0;
7797   __pyx_L1_error:;
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);
7803   __pyx_r = -1;
7804   __pyx_L0:;
7805   __Pyx_RefNannyFinishContext();
7806   return __pyx_r;
7807 }
7808
7809 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
7810  *         raise ImportError("numpy.core.umath failed to import")
7811  * 
7812  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
7813  *     try:
7814  *         _import_umath()
7815  */
7816
7817 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
7818   int __pyx_r;
7819   __Pyx_RefNannyDeclarations
7820   PyObject *__pyx_t_1 = NULL;
7821   PyObject *__pyx_t_2 = NULL;
7822   PyObject *__pyx_t_3 = NULL;
7823   int __pyx_t_4;
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);
7829
7830   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
7831  * 
7832  * cdef inline int import_ufunc() except -1:
7833  *     try:             # <<<<<<<<<<<<<<
7834  *         _import_umath()
7835  *     except Exception:
7836  */
7837   {
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);
7844     /*try:*/ {
7845
7846       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":999
7847  * cdef inline int import_ufunc() except -1:
7848  *     try:
7849  *         _import_umath()             # <<<<<<<<<<<<<<
7850  *     except Exception:
7851  *         raise ImportError("numpy.core.umath failed to import")
7852  */
7853       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 999, __pyx_L3_error)
7854
7855       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
7856  * 
7857  * cdef inline int import_ufunc() except -1:
7858  *     try:             # <<<<<<<<<<<<<<
7859  *         _import_umath()
7860  *     except Exception:
7861  */
7862     }
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;
7867     __pyx_L3_error:;
7868     __Pyx_PyThreadState_assign
7869
7870     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000
7871  *     try:
7872  *         _import_umath()
7873  *     except Exception:             # <<<<<<<<<<<<<<
7874  *         raise ImportError("numpy.core.umath failed to import")
7875  */
7876     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7877     if (__pyx_t_4) {
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);
7883
7884       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001
7885  *         _import_umath()
7886  *     except Exception:
7887  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
7888  */
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)
7894     }
7895     goto __pyx_L5_except_error;
7896     __pyx_L5_except_error:;
7897
7898     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
7899  * 
7900  * cdef inline int import_ufunc() except -1:
7901  *     try:             # <<<<<<<<<<<<<<
7902  *         _import_umath()
7903  *     except Exception:
7904  */
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;
7911     __pyx_L10_try_end:;
7912   }
7913
7914   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
7915  *         raise ImportError("numpy.core.umath failed to import")
7916  * 
7917  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
7918  *     try:
7919  *         _import_umath()
7920  */
7921
7922   /* function exit code */
7923   __pyx_r = 0;
7924   goto __pyx_L0;
7925   __pyx_L1_error:;
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);
7931   __pyx_r = -1;
7932   __pyx_L0:;
7933   __Pyx_RefNannyFinishContext();
7934   return __pyx_r;
7935 }
7936
7937 static PyMethodDef __pyx_methods[] = {
7938   {0, 0, 0, 0}
7939 };
7940
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 },
7945   #else
7946     PyModuleDef_HEAD_INIT,
7947   #endif
7948     "cython_bbox",
7949     0, /* m_doc */
7950     -1, /* m_size */
7951     __pyx_methods /* m_methods */,
7952     NULL, /* m_reload */
7953     NULL, /* m_traverse */
7954     NULL, /* m_clear */
7955     NULL /* m_free */
7956 };
7957 #endif
7958
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}
8005 };
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)
8011   return 0;
8012   __pyx_L1_error:;
8013   return -1;
8014 }
8015
8016 static int __Pyx_InitCachedConstants(void) {
8017   __Pyx_RefNannyDeclarations
8018   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
8019
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")             # <<<<<<<<<<<<<<
8024  * 
8025  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8026  */
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_);
8030
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")             # <<<<<<<<<<<<<<
8035  * 
8036  *             info.buf = PyArray_DATA(self)
8037  */
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);
8041
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"
8048  */
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);
8052
8053   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
8054  * 
8055  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
8056  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
8057  * 
8058  *         if ((child.byteorder == c'>' and little_endian) or
8059  */
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);
8063
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
8070  */
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);
8074
8075   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
8076  *             t = child.type_num
8077  *             if end - f < 5:
8078  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
8079  * 
8080  *             # Until ticket #99 is fixed, use integers to avoid warnings
8081  */
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);
8085
8086   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
8087  *         _import_array()
8088  *     except Exception:
8089  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
8090  * 
8091  * cdef inline int import_umath() except -1:
8092  */
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);
8096
8097   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995
8098  *         _import_umath()
8099  *     except Exception:
8100  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
8101  * 
8102  * cdef inline int import_ufunc() except -1:
8103  */
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);
8107
8108   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001
8109  *         _import_umath()
8110  *     except Exception:
8111  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
8112  */
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);
8116
8117   /* "bbox.pyx":15
8118  * ctypedef np.float_t DTYPE_t
8119  * 
8120  * def bbox_overlaps_float(             # <<<<<<<<<<<<<<
8121  *         np.ndarray[DTYPE_t, ndim=2] boxes,
8122  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
8123  */
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)
8128
8129   /* "bbox.pyx":66
8130  *     return overlaps
8131  * 
8132  * def bbox_overlaps(             # <<<<<<<<<<<<<<
8133  *         np.ndarray[DTYPE_t, ndim=2] boxes,
8134  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
8135  */
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)
8140
8141   /* "bbox.pyx":108
8142  *     return overlaps
8143  * 
8144  * def bbox_overlaps_self(             # <<<<<<<<<<<<<<
8145  *         np.ndarray[DTYPE_t, ndim=2] boxes,
8146  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
8147  */
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)
8152
8153   /* "bbox.pyx":147
8154  * 
8155  * 
8156  * def bbox_overlaps_ignore(             # <<<<<<<<<<<<<<
8157  *         np.ndarray[DTYPE_t, ndim=2] boxes,
8158  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
8159  */
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)
8164
8165   /* "bbox.pyx":194
8166  * 
8167  * 
8168  * def get_assignment_overlaps(             # <<<<<<<<<<<<<<
8169  *         np.ndarray[DTYPE_t, ndim=2] boxes,
8170  *         np.ndarray[DTYPE_t, ndim=2] query_boxes,
8171  */
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();
8177   return 0;
8178   __pyx_L1_error:;
8179   __Pyx_RefNannyFinishContext();
8180   return -1;
8181 }
8182
8183 static int __Pyx_InitGlobals(void) {
8184   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
8185   return 0;
8186   __pyx_L1_error:;
8187   return -1;
8188 }
8189
8190 #if PY_MAJOR_VERSION < 3
8191 PyMODINIT_FUNC initcython_bbox(void); /*proto*/
8192 PyMODINIT_FUNC initcython_bbox(void)
8193 #else
8194 PyMODINIT_FUNC PyInit_cython_bbox(void); /*proto*/
8195 PyMODINIT_FUNC PyInit_cython_bbox(void)
8196 #endif
8197 {
8198   PyObject *__pyx_t_1 = NULL;
8199   PyObject *__pyx_t_2 = NULL;
8200   __Pyx_RefNannyDeclarations
8201   #if CYTHON_REFNANNY
8202   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
8203   if (!__Pyx_RefNanny) {
8204       PyErr_Clear();
8205       __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
8206       if (!__Pyx_RefNanny)
8207           Py_FatalError("failed to import 'refnanny' module");
8208   }
8209   #endif
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)
8217   #endif
8218   #ifdef __Pyx_FusedFunction_USED
8219   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8220   #endif
8221   #ifdef __Pyx_Coroutine_USED
8222   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8223   #endif
8224   #ifdef __Pyx_Generator_USED
8225   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8226   #endif
8227   #ifdef __Pyx_StopAsyncIteration_USED
8228   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8229   #endif
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();
8235   #endif
8236   #endif
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);
8240   #else
8241   __pyx_m = PyModule_Create(&__pyx_moduledef);
8242   #endif
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)
8245   Py_INCREF(__pyx_d);
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
8248   Py_INCREF(__pyx_b);
8249   #endif
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)
8255   #endif
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)
8258   }
8259   #if PY_MAJOR_VERSION >= 3
8260   {
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)
8264     }
8265   }
8266   #endif
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),
8279   #else
8280   sizeof(PyHeapTypeObject),
8281   #endif
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)
8293   #endif
8294
8295   /* "bbox.pyx":9
8296  * 
8297  * cimport cython
8298  * import numpy as np             # <<<<<<<<<<<<<<
8299  * cimport numpy as np
8300  * 
8301  */
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;
8306
8307   /* "bbox.pyx":12
8308  * cimport numpy as np
8309  * 
8310  * DTYPE = np.float             # <<<<<<<<<<<<<<
8311  * ctypedef np.float_t DTYPE_t
8312  * 
8313  */
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;
8321
8322   /* "bbox.pyx":15
8323  * ctypedef np.float_t DTYPE_t
8324  * 
8325  * def bbox_overlaps_float(             # <<<<<<<<<<<<<<
8326  *         np.ndarray[DTYPE_t, ndim=2] boxes,
8327  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
8328  */
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;
8333
8334   /* "bbox.pyx":66
8335  *     return overlaps
8336  * 
8337  * def bbox_overlaps(             # <<<<<<<<<<<<<<
8338  *         np.ndarray[DTYPE_t, ndim=2] boxes,
8339  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
8340  */
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;
8345
8346   /* "bbox.pyx":108
8347  *     return overlaps
8348  * 
8349  * def bbox_overlaps_self(             # <<<<<<<<<<<<<<
8350  *         np.ndarray[DTYPE_t, ndim=2] boxes,
8351  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
8352  */
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;
8357
8358   /* "bbox.pyx":147
8359  * 
8360  * 
8361  * def bbox_overlaps_ignore(             # <<<<<<<<<<<<<<
8362  *         np.ndarray[DTYPE_t, ndim=2] boxes,
8363  *         np.ndarray[DTYPE_t, ndim=2] query_boxes):
8364  */
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;
8369
8370   /* "bbox.pyx":194
8371  * 
8372  * 
8373  * def get_assignment_overlaps(             # <<<<<<<<<<<<<<
8374  *         np.ndarray[DTYPE_t, ndim=2] boxes,
8375  *         np.ndarray[DTYPE_t, ndim=2] query_boxes,
8376  */
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;
8381
8382   /* "bbox.pyx":1
8383  * # --------------------------------------------------------             # <<<<<<<<<<<<<<
8384  * # Fast R-CNN
8385  * # Copyright (c) 2015 Microsoft
8386  */
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;
8391
8392   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
8393  *         raise ImportError("numpy.core.umath failed to import")
8394  * 
8395  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
8396  *     try:
8397  *         _import_umath()
8398  */
8399
8400   /*--- Wrapped vars code ---*/
8401
8402   goto __pyx_L0;
8403   __pyx_L1_error:;
8404   __Pyx_XDECREF(__pyx_t_1);
8405   __Pyx_XDECREF(__pyx_t_2);
8406   if (__pyx_m) {
8407     if (__pyx_d) {
8408       __Pyx_AddTraceback("init cython_bbox", __pyx_clineno, __pyx_lineno, __pyx_filename);
8409     }
8410     Py_DECREF(__pyx_m); __pyx_m = 0;
8411   } else if (!PyErr_Occurred()) {
8412     PyErr_SetString(PyExc_ImportError, "init cython_bbox");
8413   }
8414   __pyx_L0:;
8415   __Pyx_RefNannyFinishContext();
8416   #if PY_MAJOR_VERSION < 3
8417   return;
8418   #else
8419   return __pyx_m;
8420   #endif
8421 }
8422
8423 /* --- Runtime support code --- */
8424 /* Refnanny */
8425 #if CYTHON_REFNANNY
8426 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
8427     PyObject *m = NULL, *p = NULL;
8428     void *r = NULL;
8429     m = PyImport_ImportModule((char *)modname);
8430     if (!m) goto end;
8431     p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
8432     if (!p) goto end;
8433     r = PyLong_AsVoidPtr(p);
8434 end:
8435     Py_XDECREF(p);
8436     Py_XDECREF(m);
8437     return (__Pyx_RefNannyAPIStruct *)r;
8438 }
8439 #endif
8440
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);
8448 #else
8449             "name '%.200s' is not defined", PyString_AS_STRING(name));
8450 #endif
8451     }
8452     return result;
8453 }
8454
8455 /* RaiseArgTupleInvalid */
8456 static void __Pyx_RaiseArgtupleInvalid(
8457     const char* func_name,
8458     int exact,
8459     Py_ssize_t num_min,
8460     Py_ssize_t num_max,
8461     Py_ssize_t num_found)
8462 {
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";
8468     } else {
8469         num_expected = num_max;
8470         more_or_less = "at most";
8471     }
8472     if (exact) {
8473         more_or_less = "exactly";
8474     }
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);
8479 }
8480
8481 /* RaiseDoubleKeywords */
8482 static void __Pyx_RaiseDoubleKeywordsError(
8483     const char* func_name,
8484     PyObject* kw_name)
8485 {
8486     PyErr_Format(PyExc_TypeError,
8487         #if PY_MAJOR_VERSION >= 3
8488         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
8489         #else
8490         "%s() got multiple values for keyword argument '%s'", func_name,
8491         PyString_AsString(kw_name));
8492         #endif
8493 }
8494
8495 /* ParseKeywords */
8496 static int __Pyx_ParseOptionalKeywords(
8497     PyObject *kwds,
8498     PyObject **argnames[],
8499     PyObject *kwds2,
8500     PyObject *values[],
8501     Py_ssize_t num_pos_args,
8502     const char* function_name)
8503 {
8504     PyObject *key = 0, *value = 0;
8505     Py_ssize_t pos = 0;
8506     PyObject*** name;
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++;
8511         if (*name) {
8512             values[name-argnames] = value;
8513             continue;
8514         }
8515         name = first_kw_arg;
8516         #if PY_MAJOR_VERSION < 3
8517         if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
8518             while (*name) {
8519                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
8520                         && _PyString_Eq(**name, key)) {
8521                     values[name-argnames] = value;
8522                     break;
8523                 }
8524                 name++;
8525             }
8526             if (*name) continue;
8527             else {
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;
8534                     }
8535                     argname++;
8536                 }
8537             }
8538         } else
8539         #endif
8540         if (likely(PyUnicode_Check(key))) {
8541             while (*name) {
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 :
8545                 #endif
8546                     PyUnicode_Compare(**name, key);
8547                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
8548                 if (cmp == 0) {
8549                     values[name-argnames] = value;
8550                     break;
8551                 }
8552                 name++;
8553             }
8554             if (*name) continue;
8555             else {
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 :
8561                     #endif
8562                         PyUnicode_Compare(**argname, key);
8563                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
8564                     if (cmp == 0) goto arg_passed_twice;
8565                     argname++;
8566                 }
8567             }
8568         } else
8569             goto invalid_keyword_type;
8570         if (kwds2) {
8571             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
8572         } else {
8573             goto invalid_keyword;
8574         }
8575     }
8576     return 0;
8577 arg_passed_twice:
8578     __Pyx_RaiseDoubleKeywordsError(function_name, key);
8579     goto bad;
8580 invalid_keyword_type:
8581     PyErr_Format(PyExc_TypeError,
8582         "%.200s() keywords must be strings", function_name);
8583     goto bad;
8584 invalid_keyword:
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));
8589     #else
8590         "%s() got an unexpected keyword argument '%U'",
8591         function_name, key);
8592     #endif
8593 bad:
8594     return -1;
8595 }
8596
8597 /* ArgTypeTest */
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);
8602 }
8603 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
8604     const char *name, int exact)
8605 {
8606     if (unlikely(!type)) {
8607         PyErr_SetString(PyExc_SystemError, "Missing type object");
8608         return 0;
8609     }
8610     if (none_allowed && obj == Py_None) return 1;
8611     else if (exact) {
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;
8615         #endif
8616     }
8617     else {
8618         if (likely(PyObject_TypeCheck(obj, type))) return 1;
8619     }
8620     __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
8621     return 0;
8622 }
8623
8624 /* BufferFormatCheck */
8625 static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
8626   unsigned int n = 1;
8627   return *(unsigned char*)(&n) != 0;
8628 }
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;
8637   ctx->head = stack;
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 = '@';
8643   ctx->new_count = 1;
8644   ctx->enc_count = 0;
8645   ctx->enc_type = 0;
8646   ctx->is_complex = 0;
8647   ctx->is_valid_array = 0;
8648   ctx->struct_alignment = 0;
8649   while (type->typegroup == 'S') {
8650     ++ctx->head;
8651     ctx->head->field = type->fields;
8652     ctx->head->parent_offset = 0;
8653     type = type->fields->type;
8654   }
8655 }
8656 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
8657     int count;
8658     const char* t = *ts;
8659     if (*t < '0' || *t > '9') {
8660       return -1;
8661     } else {
8662         count = *t++ - '0';
8663         while (*t >= '0' && *t < '9') {
8664             count *= 10;
8665             count += *t++ - '0';
8666         }
8667     }
8668     *ts = t;
8669     return count;
8670 }
8671 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
8672     int number = __Pyx_BufFmt_ParseNumber(ts);
8673     if (number == -1)
8674         PyErr_Format(PyExc_ValueError,\
8675                      "Does not understand character buffer dtype format string ('%c')", **ts);
8676     return number;
8677 }
8678 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
8679   PyErr_Format(PyExc_ValueError,
8680                "Unexpected format string character: '%c'", ch);
8681 }
8682 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
8683   switch (ch) {
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";
8704   }
8705 }
8706 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
8707   switch (ch) {
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);
8714     case 'g': {
8715       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
8716       return 0;
8717     }
8718     case 'O': case 'P': return sizeof(void*);
8719     default:
8720       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
8721       return 0;
8722     }
8723 }
8724 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
8725   switch (ch) {
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);
8732     #endif
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*);
8737     default: {
8738       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
8739       return 0;
8740     }
8741   }
8742 }
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;
8752 #endif
8753 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
8754   switch (ch) {
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);
8761 #endif
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*);
8766     default:
8767       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
8768       return 0;
8769     }
8770 }
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.
8774  */
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;
8784 #endif
8785 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
8786   switch (ch) {
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);
8793 #endif
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*);
8798     default:
8799       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
8800       return 0;
8801     }
8802 }
8803 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
8804   switch (ch) {
8805     case 'c':
8806         return 'H';
8807     case 'b': case 'h': case 'i':
8808     case 'l': case 'q': case 's': case 'p':
8809         return 'I';
8810     case 'B': case 'H': case 'I': case 'L': case 'Q':
8811         return 'U';
8812     case 'f': case 'd': case 'g':
8813         return (is_complex ? 'C' : 'R');
8814     case 'O':
8815         return 'O';
8816     case 'P':
8817         return 'P';
8818     default: {
8819       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
8820       return 0;
8821     }
8822   }
8823 }
8824 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
8825   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
8826     const char* expected;
8827     const char* quote;
8828     if (ctx->head == NULL) {
8829       expected = "end";
8830       quote = "";
8831     } else {
8832       expected = ctx->head->field->type->name;
8833       quote = "'";
8834     }
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));
8839   } else {
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);
8846   }
8847 }
8848 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
8849   char group;
8850   size_t size, offset, arraysize = 1;
8851   if (ctx->enc_type == 0) return 0;
8852   if (ctx->head->field->type->arraysize[0]) {
8853     int i, ndim = 0;
8854     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
8855         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
8856         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);
8861             return -1;
8862         }
8863     }
8864     if (!ctx->is_valid_array) {
8865       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
8866                    ctx->head->field->type->ndim, ndim);
8867       return -1;
8868     }
8869     for (i = 0; i < ctx->head->field->type->ndim; i++) {
8870       arraysize *= ctx->head->field->type->arraysize[i];
8871     }
8872     ctx->is_valid_array = 0;
8873     ctx->enc_count = 1;
8874   }
8875   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
8876   do {
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);
8881     } else {
8882       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
8883     }
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,
8892                                                                  ctx->is_complex);
8893     }
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;
8897         ++ctx->head;
8898         ctx->head->field = type->fields;
8899         ctx->head->parent_offset = parent_offset;
8900         continue;
8901       }
8902       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
8903       } else {
8904           __Pyx_BufFmt_RaiseExpected(ctx);
8905           return -1;
8906       }
8907     }
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);
8913       return -1;
8914     }
8915     ctx->fmt_offset += size;
8916     if (arraysize)
8917       ctx->fmt_offset += (arraysize - 1) * size;
8918     --ctx->enc_count;
8919     while (1) {
8920       if (field == &ctx->root) {
8921         ctx->head = NULL;
8922         if (ctx->enc_count != 0) {
8923           __Pyx_BufFmt_RaiseExpected(ctx);
8924           return -1;
8925         }
8926         break;
8927       }
8928       ctx->head->field = ++field;
8929       if (field->type == NULL) {
8930         --ctx->head;
8931         field = ctx->head->field;
8932         continue;
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;
8937         ++ctx->head;
8938         ctx->head->field = field;
8939         ctx->head->parent_offset = parent_offset;
8940         break;
8941       } else {
8942         break;
8943       }
8944     }
8945   } while (ctx->enc_count);
8946   ctx->enc_type = 0;
8947   ctx->is_complex = 0;
8948   return 0;
8949 }
8950 static CYTHON_INLINE PyObject *
8951 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
8952 {
8953     const char *ts = *tsp;
8954     int i = 0, number;
8955     int ndim = ctx->head->field->type->ndim;
8956 ;
8957     ++ts;
8958     if (ctx->new_count != 1) {
8959         PyErr_SetString(PyExc_ValueError,
8960                         "Cannot handle repeated arrays in format string");
8961         return NULL;
8962     }
8963     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
8964     while (*ts && *ts != ')') {
8965         switch (*ts) {
8966             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
8967             default:  break;
8968         }
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++;
8979         i++;
8980     }
8981     if (i != ndim)
8982         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
8983                             ctx->head->field->type->ndim, i);
8984     if (!*ts) {
8985         PyErr_SetString(PyExc_ValueError,
8986                         "Unexpected end of format string, expected ')'");
8987         return NULL;
8988     }
8989     ctx->is_valid_array = 1;
8990     ctx->new_count = 1;
8991     *tsp = ++ts;
8992     return Py_None;
8993 }
8994 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
8995   int got_Z = 0;
8996   while (1) {
8997     switch(*ts) {
8998       case 0:
8999         if (ctx->enc_type != 0 && ctx->head == NULL) {
9000           __Pyx_BufFmt_RaiseExpected(ctx);
9001           return NULL;
9002         }
9003         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9004         if (ctx->head != NULL) {
9005           __Pyx_BufFmt_RaiseExpected(ctx);
9006           return NULL;
9007         }
9008         return ts;
9009       case ' ':
9010       case '\r':
9011       case '\n':
9012         ++ts;
9013         break;
9014       case '<':
9015         if (!__Pyx_IsLittleEndian()) {
9016           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
9017           return NULL;
9018         }
9019         ctx->new_packmode = '=';
9020         ++ts;
9021         break;
9022       case '>':
9023       case '!':
9024         if (__Pyx_IsLittleEndian()) {
9025           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
9026           return NULL;
9027         }
9028         ctx->new_packmode = '=';
9029         ++ts;
9030         break;
9031       case '=':
9032       case '@':
9033       case '^':
9034         ctx->new_packmode = *ts++;
9035         break;
9036       case 'T':
9037         {
9038           const char* ts_after_sub;
9039           size_t i, struct_count = ctx->new_count;
9040           size_t struct_alignment = ctx->struct_alignment;
9041           ctx->new_count = 1;
9042           ++ts;
9043           if (*ts != '{') {
9044             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
9045             return NULL;
9046           }
9047           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9048           ctx->enc_type = 0;
9049           ctx->enc_count = 0;
9050           ctx->struct_alignment = 0;
9051           ++ts;
9052           ts_after_sub = ts;
9053           for (i = 0; i != struct_count; ++i) {
9054             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
9055             if (!ts_after_sub) return NULL;
9056           }
9057           ts = ts_after_sub;
9058           if (struct_alignment) ctx->struct_alignment = struct_alignment;
9059         }
9060         break;
9061       case '}':
9062         {
9063           size_t alignment = ctx->struct_alignment;
9064           ++ts;
9065           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9066           ctx->enc_type = 0;
9067           if (alignment && ctx->fmt_offset % alignment) {
9068             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
9069           }
9070         }
9071         return ts;
9072       case 'x':
9073         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9074         ctx->fmt_offset += ctx->new_count;
9075         ctx->new_count = 1;
9076         ctx->enc_count = 0;
9077         ctx->enc_type = 0;
9078         ctx->enc_packmode = ctx->new_packmode;
9079         ++ts;
9080         break;
9081       case 'Z':
9082         got_Z = 1;
9083         ++ts;
9084         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
9085           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
9086           return NULL;
9087         }
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':
9091       case 'O': case 'p':
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;
9095           ctx->new_count = 1;
9096           got_Z = 0;
9097           ++ts;
9098           break;
9099         }
9100       case 's':
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;
9106         ++ts;
9107         ctx->new_count = 1;
9108         got_Z = 0;
9109         break;
9110       case ':':
9111         ++ts;
9112         while(*ts != ':') ++ts;
9113         ++ts;
9114         break;
9115       case '(':
9116         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
9117         break;
9118       default:
9119         {
9120           int number = __Pyx_BufFmt_ExpectNumber(&ts);
9121           if (number == -1) return NULL;
9122           ctx->new_count = (size_t)number;
9123         }
9124     }
9125   }
9126 }
9127 static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
9128   buf->buf = NULL;
9129   buf->obj = NULL;
9130   buf->strides = __Pyx_zeros;
9131   buf->shape = __Pyx_zeros;
9132   buf->suboffsets = __Pyx_minusones;
9133 }
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)
9137 {
9138   if (obj == Py_None || obj == NULL) {
9139     __Pyx_ZeroBuffer(buf);
9140     return 0;
9141   }
9142   buf->buf = NULL;
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)",
9147                  nd, buf->ndim);
9148     goto fail;
9149   }
9150   if (!cast) {
9151     __Pyx_BufFmt_Context ctx;
9152     __Pyx_BufFmt_Init(&ctx, stack, dtype);
9153     if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
9154   }
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" : "");
9160     goto fail;
9161   }
9162   if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
9163   return 0;
9164 fail:;
9165   __Pyx_ZeroBuffer(buf);
9166   return -1;
9167 }
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);
9172 }
9173
9174 /* GetModuleGlobalName */
9175   static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
9176     PyObject *result;
9177 #if !CYTHON_AVOID_BORROWED_REFS
9178     result = PyDict_GetItem(__pyx_d, name);
9179     if (likely(result)) {
9180         Py_INCREF(result);
9181     } else {
9182 #else
9183     result = PyObject_GetItem(__pyx_d, name);
9184     if (!result) {
9185         PyErr_Clear();
9186 #endif
9187         result = __Pyx_GetBuiltinName(name);
9188     }
9189     return result;
9190 }
9191
9192 /* PyObjectCall */
9193     #if CYTHON_COMPILING_IN_CPYTHON
9194 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
9195     PyObject *result;
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")))
9200         return NULL;
9201     result = (*call)(func, arg, kw);
9202     Py_LeaveRecursiveCall();
9203     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
9204         PyErr_SetString(
9205             PyExc_SystemError,
9206             "NULL result without error in PyObject_Call");
9207     }
9208     return result;
9209 }
9210 #endif
9211
9212 /* ExtTypeTest */
9213     static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
9214     if (unlikely(!type)) {
9215         PyErr_SetString(PyExc_SystemError, "Missing type object");
9216         return 0;
9217     }
9218     if (likely(PyObject_TypeCheck(obj, type)))
9219         return 1;
9220     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
9221                  Py_TYPE(obj)->tp_name, type->tp_name);
9222     return 0;
9223 }
9224
9225 /* BufferIndexError */
9226     static void __Pyx_RaiseBufferIndexError(int axis) {
9227   PyErr_Format(PyExc_IndexError,
9228      "Out of bounds on buffer access (axis %d)", axis);
9229 }
9230
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);
9243     Py_XDECREF(tmp_tb);
9244 }
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;
9252 }
9253 #endif
9254
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
9260     Py_XINCREF(type);
9261     if (!value || value == Py_None)
9262         value = NULL;
9263     else
9264         Py_INCREF(value);
9265     if (!tb || tb == Py_None)
9266         tb = NULL;
9267     else {
9268         Py_INCREF(tb);
9269         if (!PyTraceBack_Check(tb)) {
9270             PyErr_SetString(PyExc_TypeError,
9271                 "raise: arg 3 must be a traceback or None");
9272             goto raise_error;
9273         }
9274     }
9275     if (PyType_Check(type)) {
9276 #if CYTHON_COMPILING_IN_PYPY
9277         if (!value) {
9278             Py_INCREF(Py_None);
9279             value = Py_None;
9280         }
9281 #endif
9282         PyErr_NormalizeException(&type, &value, &tb);
9283     } else {
9284         if (value) {
9285             PyErr_SetString(PyExc_TypeError,
9286                 "instance exception may not have a separate value");
9287             goto raise_error;
9288         }
9289         value = type;
9290         type = (PyObject*) Py_TYPE(type);
9291         Py_INCREF(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");
9295             goto raise_error;
9296         }
9297     }
9298     __Pyx_PyThreadState_assign
9299     __Pyx_ErrRestore(type, value, tb);
9300     return;
9301 raise_error:
9302     Py_XDECREF(value);
9303     Py_XDECREF(type);
9304     Py_XDECREF(tb);
9305     return;
9306 }
9307 #else
9308 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
9309     PyObject* owned_instance = NULL;
9310     if (tb == Py_None) {
9311         tb = 0;
9312     } else if (tb && !PyTraceBack_Check(tb)) {
9313         PyErr_SetString(PyExc_TypeError,
9314             "raise: arg 3 must be a traceback or None");
9315         goto bad;
9316     }
9317     if (value == Py_None)
9318         value = 0;
9319     if (PyExceptionInstance_Check(type)) {
9320         if (value) {
9321             PyErr_SetString(PyExc_TypeError,
9322                 "instance exception may not have a separate value");
9323             goto bad;
9324         }
9325         value = type;
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);
9333                 if (!is_subclass) {
9334                     instance_class = NULL;
9335                 } else if (unlikely(is_subclass == -1)) {
9336                     goto bad;
9337                 } else {
9338                     type = instance_class;
9339                 }
9340             }
9341         }
9342         if (!instance_class) {
9343             PyObject *args;
9344             if (!value)
9345                 args = PyTuple_New(0);
9346             else if (PyTuple_Check(value)) {
9347                 Py_INCREF(value);
9348                 args = value;
9349             } else
9350                 args = PyTuple_Pack(1, value);
9351             if (!args)
9352                 goto bad;
9353             owned_instance = PyObject_Call(type, args, NULL);
9354             Py_DECREF(args);
9355             if (!owned_instance)
9356                 goto bad;
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));
9363                 goto bad;
9364             }
9365         }
9366     } else {
9367         PyErr_SetString(PyExc_TypeError,
9368             "raise: exception class must be a subclass of BaseException");
9369         goto bad;
9370     }
9371 #if PY_VERSION_HEX >= 0x03030000
9372     if (cause) {
9373 #else
9374     if (cause && cause != Py_None) {
9375 #endif
9376         PyObject *fixed_cause;
9377         if (cause == Py_None) {
9378             fixed_cause = NULL;
9379         } else if (PyExceptionClass_Check(cause)) {
9380             fixed_cause = PyObject_CallObject(cause, NULL);
9381             if (fixed_cause == NULL)
9382                 goto bad;
9383         } else if (PyExceptionInstance_Check(cause)) {
9384             fixed_cause = cause;
9385             Py_INCREF(fixed_cause);
9386         } else {
9387             PyErr_SetString(PyExc_TypeError,
9388                             "exception causes must derive from "
9389                             "BaseException");
9390             goto bad;
9391         }
9392         PyException_SetCause(value, fixed_cause);
9393     }
9394     PyErr_SetObject(type, value);
9395     if (tb) {
9396 #if CYTHON_COMPILING_IN_PYPY
9397         PyObject *tmp_type, *tmp_value, *tmp_tb;
9398         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
9399         Py_INCREF(tb);
9400         PyErr_Restore(tmp_type, tmp_value, tb);
9401         Py_XDECREF(tmp_tb);
9402 #else
9403         PyThreadState *tstate = PyThreadState_GET();
9404         PyObject* tmp_tb = tstate->curexc_traceback;
9405         if (tb != tmp_tb) {
9406             Py_INCREF(tb);
9407             tstate->curexc_traceback = tb;
9408             Py_XDECREF(tmp_tb);
9409         }
9410 #endif
9411     }
9412 bad:
9413     Py_XDECREF(owned_instance);
9414     return;
9415 }
9416 #endif
9417
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);
9422 }
9423
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");
9429 }
9430
9431 /* RaiseNoneIterError */
9432       static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
9433     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
9434 }
9435
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;
9442     Py_XINCREF(*type);
9443     Py_XINCREF(*value);
9444     Py_XINCREF(*tb);
9445 }
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);
9456     Py_XDECREF(tmp_tb);
9457 }
9458 #endif
9459
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);
9467 }
9468 #endif
9469
9470 /* GetException */
9471       #if CYTHON_FAST_THREAD_STATE
9472 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
9473 #else
9474 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
9475 #endif
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;
9485 #else
9486     PyErr_Fetch(&local_type, &local_value, &local_tb);
9487 #endif
9488     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
9489 #if CYTHON_FAST_THREAD_STATE
9490     if (unlikely(tstate->curexc_type))
9491 #else
9492     if (unlikely(PyErr_Occurred()))
9493 #endif
9494         goto bad;
9495     #if PY_MAJOR_VERSION >= 3
9496     if (local_tb) {
9497         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
9498             goto bad;
9499     }
9500     #endif
9501     Py_XINCREF(local_tb);
9502     Py_XINCREF(local_type);
9503     Py_XINCREF(local_value);
9504     *type = local_type;
9505     *value = local_value;
9506     *tb = local_tb;
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);
9516     Py_XDECREF(tmp_tb);
9517 #else
9518     PyErr_SetExcInfo(local_type, local_value, local_tb);
9519 #endif
9520     return 0;
9521 bad:
9522     *type = 0;
9523     *value = 0;
9524     *tb = 0;
9525     Py_XDECREF(local_type);
9526     Py_XDECREF(local_value);
9527     Py_XDECREF(local_tb);
9528     return -1;
9529 }
9530
9531 /* Import */
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;
9537     PyObject *list;
9538     #if PY_VERSION_HEX < 0x03030000
9539     PyObject *py_import;
9540     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
9541     if (!py_import)
9542         goto bad;
9543     #endif
9544     if (from_list)
9545         list = from_list;
9546     else {
9547         empty_list = PyList_New(0);
9548         if (!empty_list)
9549             goto bad;
9550         list = empty_list;
9551     }
9552     global_dict = PyModule_GetDict(__pyx_m);
9553     if (!global_dict)
9554         goto bad;
9555     empty_dict = PyDict_New();
9556     if (!empty_dict)
9557         goto bad;
9558     {
9559         #if PY_MAJOR_VERSION >= 3
9560         if (level == -1) {
9561             if (strchr(__Pyx_MODULE_NAME, '.')) {
9562                 #if PY_VERSION_HEX < 0x03030000
9563                 PyObject *py_level = PyInt_FromLong(1);
9564                 if (!py_level)
9565                     goto bad;
9566                 module = PyObject_CallFunctionObjArgs(py_import,
9567                     name, global_dict, empty_dict, list, py_level, NULL);
9568                 Py_DECREF(py_level);
9569                 #else
9570                 module = PyImport_ImportModuleLevelObject(
9571                     name, global_dict, empty_dict, list, 1);
9572                 #endif
9573                 if (!module) {
9574                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
9575                         goto bad;
9576                     PyErr_Clear();
9577                 }
9578             }
9579             level = 0;
9580         }
9581         #endif
9582         if (!module) {
9583             #if PY_VERSION_HEX < 0x03030000
9584             PyObject *py_level = PyInt_FromLong(level);
9585             if (!py_level)
9586                 goto bad;
9587             module = PyObject_CallFunctionObjArgs(py_import,
9588                 name, global_dict, empty_dict, list, py_level, NULL);
9589             Py_DECREF(py_level);
9590             #else
9591             module = PyImport_ImportModuleLevelObject(
9592                 name, global_dict, empty_dict, list, level);
9593             #endif
9594         }
9595     }
9596 bad:
9597     #if PY_VERSION_HEX < 0x03030000
9598     Py_XDECREF(py_import);
9599     #endif
9600     Py_XDECREF(empty_list);
9601     Py_XDECREF(empty_dict);
9602     return module;
9603 }
9604
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) {
9609         return count;
9610     }
9611     while (start < end) {
9612         mid = start + (end - start) / 2;
9613         if (code_line < entries[mid].code_line) {
9614             end = mid;
9615         } else if (code_line > entries[mid].code_line) {
9616              start = mid + 1;
9617         } else {
9618             return mid;
9619         }
9620     }
9621     if (code_line <= entries[mid].code_line) {
9622         return mid;
9623     } else {
9624         return mid + 1;
9625     }
9626 }
9627 static PyCodeObject *__pyx_find_code_object(int code_line) {
9628     PyCodeObject* code_object;
9629     int pos;
9630     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
9631         return NULL;
9632     }
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)) {
9635         return NULL;
9636     }
9637     code_object = __pyx_code_cache.entries[pos].code_object;
9638     Py_INCREF(code_object);
9639     return code_object;
9640 }
9641 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
9642     int pos, i;
9643     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
9644     if (unlikely(!code_line)) {
9645         return;
9646     }
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);
9656         }
9657         return;
9658     }
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;
9663         Py_DECREF(tmp);
9664         return;
9665     }
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)) {
9671             return;
9672         }
9673         __pyx_code_cache.entries = entries;
9674         __pyx_code_cache.max_count = new_max;
9675     }
9676     for (i=__pyx_code_cache.count; i>pos; i--) {
9677         entries[i] = entries[i-1];
9678     }
9679     entries[pos].code_line = code_line;
9680     entries[pos].code_object = code_object;
9681     __pyx_code_cache.count++;
9682     Py_INCREF(code_object);
9683 }
9684
9685 /* AddTraceback */
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);
9697     #else
9698     py_srcfile = PyUnicode_FromString(filename);
9699     #endif
9700     if (!py_srcfile) goto bad;
9701     if (c_line) {
9702         #if PY_MAJOR_VERSION < 3
9703         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
9704         #else
9705         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
9706         #endif
9707     }
9708     else {
9709         #if PY_MAJOR_VERSION < 3
9710         py_funcname = PyString_FromString(funcname);
9711         #else
9712         py_funcname = PyUnicode_FromString(funcname);
9713         #endif
9714     }
9715     if (!py_funcname) goto bad;
9716     py_code = __Pyx_PyCode_New(
9717         0,
9718         0,
9719         0,
9720         0,
9721         0,
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,*/
9730         py_line,
9731         __pyx_empty_bytes  /*PyObject *lnotab*/
9732     );
9733     Py_DECREF(py_srcfile);
9734     Py_DECREF(py_funcname);
9735     return py_code;
9736 bad:
9737     Py_XDECREF(py_srcfile);
9738     Py_XDECREF(py_funcname);
9739     return NULL;
9740 }
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);
9746     if (!py_code) {
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);
9751     }
9752     py_frame = PyFrame_New(
9753         PyThreadState_GET(), /*PyThreadState *tstate,*/
9754         py_code,             /*PyCodeObject *code,*/
9755         __pyx_d,      /*PyObject *globals,*/
9756         0                    /*PyObject *locals*/
9757     );
9758     if (!py_frame) goto bad;
9759     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
9760     PyTraceBack_Here(py_frame);
9761 bad:
9762     Py_XDECREF(py_code);
9763     Py_XDECREF(py_frame);
9764 }
9765
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);
9771     return -1;
9772 }
9773 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
9774     PyObject *obj = view->obj;
9775     if (!obj) return;
9776     if (PyObject_CheckBuffer(obj)) {
9777         PyBuffer_Release(view);
9778         return;
9779     }
9780         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
9781     Py_DECREF(obj);
9782     view->obj = NULL;
9783 }
9784 #endif
9785
9786
9787         /* CIntToPy */
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;
9791     if (is_unsigned) {
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);
9799 #endif
9800         }
9801     } else {
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);
9807 #endif
9808         }
9809     }
9810     {
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);
9815     }
9816 }
9817
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)\
9824     {\
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;\
9833                 else\
9834                     goto raise_overflow;\
9835             }\
9836         }\
9837         return (target_type) value;\
9838     }
9839
9840 /* Declarations */
9841         #if CYTHON_CCOMPLEX
9842   #ifdef __cplusplus
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);
9845     }
9846   #else
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;
9849     }
9850   #endif
9851 #else
9852     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
9853       __pyx_t_float_complex z;
9854       z.real = x;
9855       z.imag = y;
9856       return z;
9857     }
9858 #endif
9859
9860 /* Arithmetic */
9861         #if CYTHON_CCOMPLEX
9862 #else
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);
9865     }
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;
9870         return z;
9871     }
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;
9876         return z;
9877     }
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;
9882         return z;
9883     }
9884     #if 1
9885     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9886         if (b.imag == 0) {
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);
9891             } else {
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);
9896             }
9897         } else {
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);
9902         }
9903     }
9904     #else
9905     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9906         if (b.imag == 0) {
9907             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
9908         } else {
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);
9913         }
9914     }
9915     #endif
9916     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
9917         __pyx_t_float_complex z;
9918         z.real = -a.real;
9919         z.imag = -a.imag;
9920         return z;
9921     }
9922     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
9923        return (a.real == 0) && (a.imag == 0);
9924     }
9925     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
9926         __pyx_t_float_complex z;
9927         z.real =  a.real;
9928         z.imag = -a.imag;
9929         return z;
9930     }
9931     #if 1
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);
9935           #else
9936             return hypotf(z.real, z.imag);
9937           #endif
9938         }
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) {
9943                 if (b.real < 0) {
9944                     float denom = a.real * a.real + a.imag * a.imag;
9945                     a.real = a.real / denom;
9946                     a.imag = -a.imag / denom;
9947                     b.real = -b.real;
9948                 }
9949                 switch ((int)b.real) {
9950                     case 0:
9951                         z.real = 1;
9952                         z.imag = 0;
9953                         return z;
9954                     case 1:
9955                         return a;
9956                     case 2:
9957                         z = __Pyx_c_prod_float(a, a);
9958                         return __Pyx_c_prod_float(a, a);
9959                     case 3:
9960                         z = __Pyx_c_prod_float(a, a);
9961                         return __Pyx_c_prod_float(z, a);
9962                     case 4:
9963                         z = __Pyx_c_prod_float(a, a);
9964                         return __Pyx_c_prod_float(z, z);
9965                 }
9966             }
9967             if (a.imag == 0) {
9968                 if (a.real == 0) {
9969                     return a;
9970                 } else if (b.imag == 0) {
9971                     z.real = powf(a.real, b.real);
9972                     z.imag = 0;
9973                     return z;
9974                 } else if (a.real > 0) {
9975                     r = a.real;
9976                     theta = 0;
9977                 } else {
9978                     r = -a.real;
9979                     theta = atan2f(0, -1);
9980                 }
9981             } else {
9982                 r = __Pyx_c_abs_float(a);
9983                 theta = atan2f(a.imag, a.real);
9984             }
9985             lnr = logf(r);
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);
9990             return z;
9991         }
9992     #endif
9993 #endif
9994
9995 /* Declarations */
9996         #if CYTHON_CCOMPLEX
9997   #ifdef __cplusplus
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);
10000     }
10001   #else
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;
10004     }
10005   #endif
10006 #else
10007     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
10008       __pyx_t_double_complex z;
10009       z.real = x;
10010       z.imag = y;
10011       return z;
10012     }
10013 #endif
10014
10015 /* Arithmetic */
10016         #if CYTHON_CCOMPLEX
10017 #else
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);
10020     }
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;
10025         return z;
10026     }
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;
10031         return z;
10032     }
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;
10037         return z;
10038     }
10039     #if 1
10040     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10041         if (b.imag == 0) {
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);
10046             } else {
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);
10051             }
10052         } else {
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);
10057         }
10058     }
10059     #else
10060     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10061         if (b.imag == 0) {
10062             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
10063         } else {
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);
10068         }
10069     }
10070     #endif
10071     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
10072         __pyx_t_double_complex z;
10073         z.real = -a.real;
10074         z.imag = -a.imag;
10075         return z;
10076     }
10077     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
10078        return (a.real == 0) && (a.imag == 0);
10079     }
10080     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
10081         __pyx_t_double_complex z;
10082         z.real =  a.real;
10083         z.imag = -a.imag;
10084         return z;
10085     }
10086     #if 1
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);
10090           #else
10091             return hypot(z.real, z.imag);
10092           #endif
10093         }
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) {
10098                 if (b.real < 0) {
10099                     double denom = a.real * a.real + a.imag * a.imag;
10100                     a.real = a.real / denom;
10101                     a.imag = -a.imag / denom;
10102                     b.real = -b.real;
10103                 }
10104                 switch ((int)b.real) {
10105                     case 0:
10106                         z.real = 1;
10107                         z.imag = 0;
10108                         return z;
10109                     case 1:
10110                         return a;
10111                     case 2:
10112                         z = __Pyx_c_prod_double(a, a);
10113                         return __Pyx_c_prod_double(a, a);
10114                     case 3:
10115                         z = __Pyx_c_prod_double(a, a);
10116                         return __Pyx_c_prod_double(z, a);
10117                     case 4:
10118                         z = __Pyx_c_prod_double(a, a);
10119                         return __Pyx_c_prod_double(z, z);
10120                 }
10121             }
10122             if (a.imag == 0) {
10123                 if (a.real == 0) {
10124                     return a;
10125                 } else if (b.imag == 0) {
10126                     z.real = pow(a.real, b.real);
10127                     z.imag = 0;
10128                     return z;
10129                 } else if (a.real > 0) {
10130                     r = a.real;
10131                     theta = 0;
10132                 } else {
10133                     r = -a.real;
10134                     theta = atan2(0, -1);
10135                 }
10136             } else {
10137                 r = __Pyx_c_abs_double(a);
10138                 theta = atan2(a.imag, a.real);
10139             }
10140             lnr = log(r);
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);
10145             return z;
10146         }
10147     #endif
10148 #endif
10149
10150 /* CIntToPy */
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;
10154     if (is_unsigned) {
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);
10162 #endif
10163         }
10164     } else {
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);
10170 #endif
10171         }
10172     }
10173     {
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);
10178     }
10179 }
10180
10181 /* CIntToPy */
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;
10185     if (is_unsigned) {
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);
10193 #endif
10194         }
10195     } else {
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);
10201 #endif
10202         }
10203     }
10204     {
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);
10209     }
10210 }
10211
10212 /* CIntFromPy */
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))
10220         } else {
10221             long val = PyInt_AS_LONG(x);
10222             if (is_unsigned && unlikely(val < 0)) {
10223                 goto raise_neg_overflow;
10224             }
10225             return (unsigned int) val;
10226         }
10227     } else
10228 #endif
10229     if (likely(PyLong_Check(x))) {
10230         if (is_unsigned) {
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])
10236                 case 2:
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]));
10242                         }
10243                     }
10244                     break;
10245                 case 3:
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]));
10251                         }
10252                     }
10253                     break;
10254                 case 4:
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]));
10260                         }
10261                     }
10262                     break;
10263             }
10264 #endif
10265 #if CYTHON_COMPILING_IN_CPYTHON
10266             if (unlikely(Py_SIZE(x) < 0)) {
10267                 goto raise_neg_overflow;
10268             }
10269 #else
10270             {
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;
10276             }
10277 #endif
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))
10283 #endif
10284             }
10285         } else {
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])
10292                 case -2:
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])));
10298                         }
10299                     }
10300                     break;
10301                 case 2:
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])));
10307                         }
10308                     }
10309                     break;
10310                 case -3:
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])));
10316                         }
10317                     }
10318                     break;
10319                 case 3:
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])));
10325                         }
10326                     }
10327                     break;
10328                 case -4:
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])));
10334                         }
10335                     }
10336                     break;
10337                 case 4:
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])));
10343                         }
10344                     }
10345                     break;
10346             }
10347 #endif
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))
10353 #endif
10354             }
10355         }
10356         {
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");
10360 #else
10361             unsigned int val;
10362             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10363  #if PY_MAJOR_VERSION < 3
10364             if (likely(v) && !PyLong_Check(v)) {
10365                 PyObject *tmp = v;
10366                 v = PyNumber_Long(tmp);
10367                 Py_DECREF(tmp);
10368             }
10369  #endif
10370             if (likely(v)) {
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);
10376                 Py_DECREF(v);
10377                 if (likely(!ret))
10378                     return val;
10379             }
10380 #endif
10381             return (unsigned int) -1;
10382         }
10383     } else {
10384         unsigned int val;
10385         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10386         if (!tmp) return (unsigned int) -1;
10387         val = __Pyx_PyInt_As_unsigned_int(tmp);
10388         Py_DECREF(tmp);
10389         return val;
10390     }
10391 raise_overflow:
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;
10399 }
10400
10401 /* CIntFromPy */
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))
10409         } else {
10410             long val = PyInt_AS_LONG(x);
10411             if (is_unsigned && unlikely(val < 0)) {
10412                 goto raise_neg_overflow;
10413             }
10414             return (int) val;
10415         }
10416     } else
10417 #endif
10418     if (likely(PyLong_Check(x))) {
10419         if (is_unsigned) {
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])
10425                 case 2:
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]));
10431                         }
10432                     }
10433                     break;
10434                 case 3:
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]));
10440                         }
10441                     }
10442                     break;
10443                 case 4:
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]));
10449                         }
10450                     }
10451                     break;
10452             }
10453 #endif
10454 #if CYTHON_COMPILING_IN_CPYTHON
10455             if (unlikely(Py_SIZE(x) < 0)) {
10456                 goto raise_neg_overflow;
10457             }
10458 #else
10459             {
10460                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10461                 if (unlikely(result < 0))
10462                     return (int) -1;
10463                 if (unlikely(result == 1))
10464                     goto raise_neg_overflow;
10465             }
10466 #endif
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))
10472 #endif
10473             }
10474         } else {
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])
10481                 case -2:
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])));
10487                         }
10488                     }
10489                     break;
10490                 case 2:
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])));
10496                         }
10497                     }
10498                     break;
10499                 case -3:
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])));
10505                         }
10506                     }
10507                     break;
10508                 case 3:
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])));
10514                         }
10515                     }
10516                     break;
10517                 case -4:
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])));
10523                         }
10524                     }
10525                     break;
10526                 case 4:
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])));
10532                         }
10533                     }
10534                     break;
10535             }
10536 #endif
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))
10542 #endif
10543             }
10544         }
10545         {
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");
10549 #else
10550             int val;
10551             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10552  #if PY_MAJOR_VERSION < 3
10553             if (likely(v) && !PyLong_Check(v)) {
10554                 PyObject *tmp = v;
10555                 v = PyNumber_Long(tmp);
10556                 Py_DECREF(tmp);
10557             }
10558  #endif
10559             if (likely(v)) {
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);
10565                 Py_DECREF(v);
10566                 if (likely(!ret))
10567                     return val;
10568             }
10569 #endif
10570             return (int) -1;
10571         }
10572     } else {
10573         int val;
10574         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10575         if (!tmp) return (int) -1;
10576         val = __Pyx_PyInt_As_int(tmp);
10577         Py_DECREF(tmp);
10578         return val;
10579     }
10580 raise_overflow:
10581     PyErr_SetString(PyExc_OverflowError,
10582         "value too large to convert to int");
10583     return (int) -1;
10584 raise_neg_overflow:
10585     PyErr_SetString(PyExc_OverflowError,
10586         "can't convert negative value to int");
10587     return (int) -1;
10588 }
10589
10590 /* CIntToPy */
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;
10594     if (is_unsigned) {
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);
10602 #endif
10603         }
10604     } else {
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);
10610 #endif
10611         }
10612     }
10613     {
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);
10618     }
10619 }
10620
10621 /* CIntFromPy */
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))
10629         } else {
10630             long val = PyInt_AS_LONG(x);
10631             if (is_unsigned && unlikely(val < 0)) {
10632                 goto raise_neg_overflow;
10633             }
10634             return (long) val;
10635         }
10636     } else
10637 #endif
10638     if (likely(PyLong_Check(x))) {
10639         if (is_unsigned) {
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])
10645                 case 2:
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]));
10651                         }
10652                     }
10653                     break;
10654                 case 3:
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]));
10660                         }
10661                     }
10662                     break;
10663                 case 4:
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]));
10669                         }
10670                     }
10671                     break;
10672             }
10673 #endif
10674 #if CYTHON_COMPILING_IN_CPYTHON
10675             if (unlikely(Py_SIZE(x) < 0)) {
10676                 goto raise_neg_overflow;
10677             }
10678 #else
10679             {
10680                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10681                 if (unlikely(result < 0))
10682                     return (long) -1;
10683                 if (unlikely(result == 1))
10684                     goto raise_neg_overflow;
10685             }
10686 #endif
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))
10692 #endif
10693             }
10694         } else {
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])
10701                 case -2:
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])));
10707                         }
10708                     }
10709                     break;
10710                 case 2:
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])));
10716                         }
10717                     }
10718                     break;
10719                 case -3:
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])));
10725                         }
10726                     }
10727                     break;
10728                 case 3:
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])));
10734                         }
10735                     }
10736                     break;
10737                 case -4:
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])));
10743                         }
10744                     }
10745                     break;
10746                 case 4:
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])));
10752                         }
10753                     }
10754                     break;
10755             }
10756 #endif
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))
10762 #endif
10763             }
10764         }
10765         {
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");
10769 #else
10770             long val;
10771             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10772  #if PY_MAJOR_VERSION < 3
10773             if (likely(v) && !PyLong_Check(v)) {
10774                 PyObject *tmp = v;
10775                 v = PyNumber_Long(tmp);
10776                 Py_DECREF(tmp);
10777             }
10778  #endif
10779             if (likely(v)) {
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);
10785                 Py_DECREF(v);
10786                 if (likely(!ret))
10787                     return val;
10788             }
10789 #endif
10790             return (long) -1;
10791         }
10792     } else {
10793         long val;
10794         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10795         if (!tmp) return (long) -1;
10796         val = __Pyx_PyInt_As_long(tmp);
10797         Py_DECREF(tmp);
10798         return val;
10799     }
10800 raise_overflow:
10801     PyErr_SetString(PyExc_OverflowError,
10802         "value too large to convert to long");
10803     return (long) -1;
10804 raise_neg_overflow:
10805     PyErr_SetString(PyExc_OverflowError,
10806         "can't convert negative value to long");
10807     return (long) -1;
10808 }
10809
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]) {
10816         char message[200];
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);
10822     }
10823     return 0;
10824 }
10825
10826 /* ModuleImport */
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);
10833     if (!py_name)
10834         goto bad;
10835     py_module = PyImport_Import(py_name);
10836     Py_DECREF(py_name);
10837     return py_module;
10838 bad:
10839     Py_XDECREF(py_name);
10840     return 0;
10841 }
10842 #endif
10843
10844 /* TypeImport */
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)
10849 {
10850     PyObject *py_module = 0;
10851     PyObject *result = 0;
10852     PyObject *py_name = 0;
10853     char warning[200];
10854     Py_ssize_t basicsize;
10855 #ifdef Py_LIMITED_API
10856     PyObject *py_basicsize;
10857 #endif
10858     py_module = __Pyx_ImportModule(module_name);
10859     if (!py_module)
10860         goto bad;
10861     py_name = __Pyx_PyIdentifier_FromString(class_name);
10862     if (!py_name)
10863         goto bad;
10864     result = PyObject_GetAttr(py_module, py_name);
10865     Py_DECREF(py_name);
10866     py_name = 0;
10867     Py_DECREF(py_module);
10868     py_module = 0;
10869     if (!result)
10870         goto bad;
10871     if (!PyType_Check(result)) {
10872         PyErr_Format(PyExc_TypeError,
10873             "%.200s.%.200s is not a type object",
10874             module_name, class_name);
10875         goto bad;
10876     }
10877 #ifndef Py_LIMITED_API
10878     basicsize = ((PyTypeObject *)result)->tp_basicsize;
10879 #else
10880     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
10881     if (!py_basicsize)
10882         goto bad;
10883     basicsize = PyLong_AsSsize_t(py_basicsize);
10884     Py_DECREF(py_basicsize);
10885     py_basicsize = 0;
10886     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
10887         goto bad;
10888 #endif
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;
10894     }
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);
10899         goto bad;
10900     }
10901     return (PyTypeObject *)result;
10902 bad:
10903     Py_XDECREF(py_module);
10904     Py_XDECREF(result);
10905     return NULL;
10906 }
10907 #endif
10908
10909 /* InitStrings */
10910         static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
10911     while (t->p) {
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);
10917         } else {
10918             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
10919         }
10920         #else
10921         if (t->is_unicode | t->is_str) {
10922             if (t->intern) {
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);
10926             } else {
10927                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
10928             }
10929         } else {
10930             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
10931         }
10932         #endif
10933         if (!*t->p)
10934             return -1;
10935         ++t;
10936     }
10937     return 0;
10938 }
10939
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));
10942 }
10943 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
10944     Py_ssize_t ignore;
10945     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
10946 }
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)
10949     if (
10950 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
10951             __Pyx_sys_getdefaultencoding_not_ascii &&
10952 #endif
10953             PyUnicode_Check(o)) {
10954 #if PY_VERSION_HEX < 0x03030000
10955         char* defenc_c;
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
10960         {
10961             char* end = defenc_c + PyBytes_GET_SIZE(defenc);
10962             char* c;
10963             for (c = defenc_c; c < end; c++) {
10964                 if ((unsigned char) (*c) >= 128) {
10965                     PyUnicode_AsASCIIString(o);
10966                     return NULL;
10967                 }
10968             }
10969         }
10970 #endif
10971         *length = PyBytes_GET_SIZE(defenc);
10972         return defenc_c;
10973 #else
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);
10979         } else {
10980             PyUnicode_AsASCIIString(o);
10981             return NULL;
10982         }
10983 #else
10984         return PyUnicode_AsUTF8AndSize(o, length);
10985 #endif
10986 #endif
10987     } else
10988 #endif
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);
10993     } else
10994 #endif
10995     {
10996         char* result;
10997         int r = PyBytes_AsStringAndSize(o, &result, length);
10998         if (unlikely(r < 0)) {
10999             return NULL;
11000         } else {
11001             return result;
11002         }
11003     }
11004 }
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);
11009 }
11010 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
11011 #if CYTHON_USE_TYPE_SLOTS
11012   PyNumberMethods *m;
11013 #endif
11014   const char *name = NULL;
11015   PyObject *res = NULL;
11016 #if PY_MAJOR_VERSION < 3
11017   if (PyInt_Check(x) || PyLong_Check(x))
11018 #else
11019   if (PyLong_Check(x))
11020 #endif
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) {
11026     name = "int";
11027     res = PyNumber_Int(x);
11028   }
11029   else if (m && m->nb_long) {
11030     name = "long";
11031     res = PyNumber_Long(x);
11032   }
11033   #else
11034   if (m && m->nb_int) {
11035     name = "int";
11036     res = PyNumber_Long(x);
11037   }
11038   #endif
11039 #else
11040   res = PyNumber_Int(x);
11041 #endif
11042   if (res) {
11043 #if PY_MAJOR_VERSION < 3
11044     if (!PyInt_Check(res) && !PyLong_Check(res)) {
11045 #else
11046     if (!PyLong_Check(res)) {
11047 #endif
11048       PyErr_Format(PyExc_TypeError,
11049                    "__%.4s__ returned non-%.4s (type %.200s)",
11050                    name, name, Py_TYPE(res)->tp_name);
11051       Py_DECREF(res);
11052       return NULL;
11053     }
11054   }
11055   else if (!PyErr_Occurred()) {
11056     PyErr_SetString(PyExc_TypeError,
11057                     "an integer is required");
11058   }
11059   return res;
11060 }
11061 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
11062   Py_ssize_t ival;
11063   PyObject *x;
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);
11068     else
11069         return PyInt_AsSsize_t(x);
11070   }
11071 #endif
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;
11079         return ival;
11080     } else {
11081       switch (size) {
11082          case 2:
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]));
11085            }
11086            break;
11087          case -2:
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]));
11090            }
11091            break;
11092          case 3:
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]));
11095            }
11096            break;
11097          case -3:
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]));
11100            }
11101            break;
11102          case 4:
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]));
11105            }
11106            break;
11107          case -4:
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]));
11110            }
11111            break;
11112       }
11113     }
11114     #endif
11115     return PyLong_AsSsize_t(b);
11116   }
11117   x = PyNumber_Index(b);
11118   if (!x) return -1;
11119   ival = PyInt_AsSsize_t(x);
11120   Py_DECREF(x);
11121   return ival;
11122 }
11123 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
11124     return PyInt_FromSize_t(ival);
11125 }
11126
11127
11128 #endif /* Py_PYTHON_H */