gpu_nms.cpp
Go to the documentation of this file.
00001 /* Generated by Cython 0.25.2 */
00002 
00003 #define PY_SSIZE_T_CLEAN
00004 #include "Python.h"
00005 #ifndef Py_PYTHON_H
00006     #error Python headers needed to compile C extensions, please install development version of Python.
00007 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
00008     #error Cython requires Python 2.6+ or Python 3.2+.
00009 #else
00010 #define CYTHON_ABI "0_25_2"
00011 #include <stddef.h>
00012 #ifndef offsetof
00013   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
00014 #endif
00015 #if !defined(WIN32) && !defined(MS_WINDOWS)
00016   #ifndef __stdcall
00017     #define __stdcall
00018   #endif
00019   #ifndef __cdecl
00020     #define __cdecl
00021   #endif
00022   #ifndef __fastcall
00023     #define __fastcall
00024   #endif
00025 #endif
00026 #ifndef DL_IMPORT
00027   #define DL_IMPORT(t) t
00028 #endif
00029 #ifndef DL_EXPORT
00030   #define DL_EXPORT(t) t
00031 #endif
00032 #ifndef HAVE_LONG_LONG
00033   #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
00034     #define HAVE_LONG_LONG
00035   #endif
00036 #endif
00037 #ifndef PY_LONG_LONG
00038   #define PY_LONG_LONG LONG_LONG
00039 #endif
00040 #ifndef Py_HUGE_VAL
00041   #define Py_HUGE_VAL HUGE_VAL
00042 #endif
00043 #ifdef PYPY_VERSION
00044   #define CYTHON_COMPILING_IN_PYPY 1
00045   #define CYTHON_COMPILING_IN_PYSTON 0
00046   #define CYTHON_COMPILING_IN_CPYTHON 0
00047   #undef CYTHON_USE_TYPE_SLOTS
00048   #define CYTHON_USE_TYPE_SLOTS 0
00049   #undef CYTHON_USE_ASYNC_SLOTS
00050   #define CYTHON_USE_ASYNC_SLOTS 0
00051   #undef CYTHON_USE_PYLIST_INTERNALS
00052   #define CYTHON_USE_PYLIST_INTERNALS 0
00053   #undef CYTHON_USE_UNICODE_INTERNALS
00054   #define CYTHON_USE_UNICODE_INTERNALS 0
00055   #undef CYTHON_USE_UNICODE_WRITER
00056   #define CYTHON_USE_UNICODE_WRITER 0
00057   #undef CYTHON_USE_PYLONG_INTERNALS
00058   #define CYTHON_USE_PYLONG_INTERNALS 0
00059   #undef CYTHON_AVOID_BORROWED_REFS
00060   #define CYTHON_AVOID_BORROWED_REFS 1
00061   #undef CYTHON_ASSUME_SAFE_MACROS
00062   #define CYTHON_ASSUME_SAFE_MACROS 0
00063   #undef CYTHON_UNPACK_METHODS
00064   #define CYTHON_UNPACK_METHODS 0
00065   #undef CYTHON_FAST_THREAD_STATE
00066   #define CYTHON_FAST_THREAD_STATE 0
00067   #undef CYTHON_FAST_PYCALL
00068   #define CYTHON_FAST_PYCALL 0
00069 #elif defined(PYSTON_VERSION)
00070   #define CYTHON_COMPILING_IN_PYPY 0
00071   #define CYTHON_COMPILING_IN_PYSTON 1
00072   #define CYTHON_COMPILING_IN_CPYTHON 0
00073   #ifndef CYTHON_USE_TYPE_SLOTS
00074     #define CYTHON_USE_TYPE_SLOTS 1
00075   #endif
00076   #undef CYTHON_USE_ASYNC_SLOTS
00077   #define CYTHON_USE_ASYNC_SLOTS 0
00078   #undef CYTHON_USE_PYLIST_INTERNALS
00079   #define CYTHON_USE_PYLIST_INTERNALS 0
00080   #ifndef CYTHON_USE_UNICODE_INTERNALS
00081     #define CYTHON_USE_UNICODE_INTERNALS 1
00082   #endif
00083   #undef CYTHON_USE_UNICODE_WRITER
00084   #define CYTHON_USE_UNICODE_WRITER 0
00085   #undef CYTHON_USE_PYLONG_INTERNALS
00086   #define CYTHON_USE_PYLONG_INTERNALS 0
00087   #ifndef CYTHON_AVOID_BORROWED_REFS
00088     #define CYTHON_AVOID_BORROWED_REFS 0
00089   #endif
00090   #ifndef CYTHON_ASSUME_SAFE_MACROS
00091     #define CYTHON_ASSUME_SAFE_MACROS 1
00092   #endif
00093   #ifndef CYTHON_UNPACK_METHODS
00094     #define CYTHON_UNPACK_METHODS 1
00095   #endif
00096   #undef CYTHON_FAST_THREAD_STATE
00097   #define CYTHON_FAST_THREAD_STATE 0
00098   #undef CYTHON_FAST_PYCALL
00099   #define CYTHON_FAST_PYCALL 0
00100 #else
00101   #define CYTHON_COMPILING_IN_PYPY 0
00102   #define CYTHON_COMPILING_IN_PYSTON 0
00103   #define CYTHON_COMPILING_IN_CPYTHON 1
00104   #ifndef CYTHON_USE_TYPE_SLOTS
00105     #define CYTHON_USE_TYPE_SLOTS 1
00106   #endif
00107   #if PY_MAJOR_VERSION < 3
00108     #undef CYTHON_USE_ASYNC_SLOTS
00109     #define CYTHON_USE_ASYNC_SLOTS 0
00110   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
00111     #define CYTHON_USE_ASYNC_SLOTS 1
00112   #endif
00113   #if PY_VERSION_HEX < 0x02070000
00114     #undef CYTHON_USE_PYLONG_INTERNALS
00115     #define CYTHON_USE_PYLONG_INTERNALS 0
00116   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
00117     #define CYTHON_USE_PYLONG_INTERNALS 1
00118   #endif
00119   #ifndef CYTHON_USE_PYLIST_INTERNALS
00120     #define CYTHON_USE_PYLIST_INTERNALS 1
00121   #endif
00122   #ifndef CYTHON_USE_UNICODE_INTERNALS
00123     #define CYTHON_USE_UNICODE_INTERNALS 1
00124   #endif
00125   #if PY_VERSION_HEX < 0x030300F0
00126     #undef CYTHON_USE_UNICODE_WRITER
00127     #define CYTHON_USE_UNICODE_WRITER 0
00128   #elif !defined(CYTHON_USE_UNICODE_WRITER)
00129     #define CYTHON_USE_UNICODE_WRITER 1
00130   #endif
00131   #ifndef CYTHON_AVOID_BORROWED_REFS
00132     #define CYTHON_AVOID_BORROWED_REFS 0
00133   #endif
00134   #ifndef CYTHON_ASSUME_SAFE_MACROS
00135     #define CYTHON_ASSUME_SAFE_MACROS 1
00136   #endif
00137   #ifndef CYTHON_UNPACK_METHODS
00138     #define CYTHON_UNPACK_METHODS 1
00139   #endif
00140   #ifndef CYTHON_FAST_THREAD_STATE
00141     #define CYTHON_FAST_THREAD_STATE 1
00142   #endif
00143   #ifndef CYTHON_FAST_PYCALL
00144     #define CYTHON_FAST_PYCALL 1
00145   #endif
00146 #endif
00147 #if !defined(CYTHON_FAST_PYCCALL)
00148 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
00149 #endif
00150 #if CYTHON_USE_PYLONG_INTERNALS
00151   #include "longintrepr.h"
00152   #undef SHIFT
00153   #undef BASE
00154   #undef MASK
00155 #endif
00156 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
00157   #define Py_OptimizeFlag 0
00158 #endif
00159 #define __PYX_BUILD_PY_SSIZE_T "n"
00160 #define CYTHON_FORMAT_SSIZE_T "z"
00161 #if PY_MAJOR_VERSION < 3
00162   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
00163   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
00164           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
00165   #define __Pyx_DefaultClassType PyClass_Type
00166 #else
00167   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
00168   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
00169           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
00170   #define __Pyx_DefaultClassType PyType_Type
00171 #endif
00172 #ifndef Py_TPFLAGS_CHECKTYPES
00173   #define Py_TPFLAGS_CHECKTYPES 0
00174 #endif
00175 #ifndef Py_TPFLAGS_HAVE_INDEX
00176   #define Py_TPFLAGS_HAVE_INDEX 0
00177 #endif
00178 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
00179   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
00180 #endif
00181 #ifndef Py_TPFLAGS_HAVE_FINALIZE
00182   #define Py_TPFLAGS_HAVE_FINALIZE 0
00183 #endif
00184 #ifndef METH_FASTCALL
00185   #define METH_FASTCALL 0x80
00186   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
00187                                               Py_ssize_t nargs, PyObject *kwnames);
00188 #else
00189   #define __Pyx_PyCFunctionFast _PyCFunctionFast
00190 #endif
00191 #if CYTHON_FAST_PYCCALL
00192 #define __Pyx_PyFastCFunction_Check(func)\
00193     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
00194 #else
00195 #define __Pyx_PyFastCFunction_Check(func) 0
00196 #endif
00197 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
00198   #define CYTHON_PEP393_ENABLED 1
00199   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
00200                                               0 : _PyUnicode_Ready((PyObject *)(op)))
00201   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
00202   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
00203   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
00204   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
00205   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
00206   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
00207   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
00208   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
00209 #else
00210   #define CYTHON_PEP393_ENABLED 0
00211   #define PyUnicode_1BYTE_KIND  1
00212   #define PyUnicode_2BYTE_KIND  2
00213   #define PyUnicode_4BYTE_KIND  4
00214   #define __Pyx_PyUnicode_READY(op)       (0)
00215   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
00216   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
00217   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
00218   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
00219   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
00220   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
00221   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
00222   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
00223 #endif
00224 #if CYTHON_COMPILING_IN_PYPY
00225   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
00226   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
00227 #else
00228   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
00229   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
00230       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
00231 #endif
00232 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
00233   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
00234 #endif
00235 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
00236   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
00237 #endif
00238 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
00239   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
00240 #endif
00241 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
00242   #define PyObject_Malloc(s)   PyMem_Malloc(s)
00243   #define PyObject_Free(p)     PyMem_Free(p)
00244   #define PyObject_Realloc(p)  PyMem_Realloc(p)
00245 #endif
00246 #if CYTHON_COMPILING_IN_PYSTON
00247   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
00248   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
00249 #else
00250   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
00251   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
00252 #endif
00253 #define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
00254 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
00255 #if PY_MAJOR_VERSION >= 3
00256   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
00257 #else
00258   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
00259 #endif
00260 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
00261   #define PyObject_ASCII(o)            PyObject_Repr(o)
00262 #endif
00263 #if PY_MAJOR_VERSION >= 3
00264   #define PyBaseString_Type            PyUnicode_Type
00265   #define PyStringObject               PyUnicodeObject
00266   #define PyString_Type                PyUnicode_Type
00267   #define PyString_Check               PyUnicode_Check
00268   #define PyString_CheckExact          PyUnicode_CheckExact
00269 #endif
00270 #if PY_MAJOR_VERSION >= 3
00271   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
00272   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
00273 #else
00274   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
00275   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
00276 #endif
00277 #ifndef PySet_CheckExact
00278   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
00279 #endif
00280 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
00281 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
00282 #if PY_MAJOR_VERSION >= 3
00283   #define PyIntObject                  PyLongObject
00284   #define PyInt_Type                   PyLong_Type
00285   #define PyInt_Check(op)              PyLong_Check(op)
00286   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
00287   #define PyInt_FromString             PyLong_FromString
00288   #define PyInt_FromUnicode            PyLong_FromUnicode
00289   #define PyInt_FromLong               PyLong_FromLong
00290   #define PyInt_FromSize_t             PyLong_FromSize_t
00291   #define PyInt_FromSsize_t            PyLong_FromSsize_t
00292   #define PyInt_AsLong                 PyLong_AsLong
00293   #define PyInt_AS_LONG                PyLong_AS_LONG
00294   #define PyInt_AsSsize_t              PyLong_AsSsize_t
00295   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
00296   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
00297   #define PyNumber_Int                 PyNumber_Long
00298 #endif
00299 #if PY_MAJOR_VERSION >= 3
00300   #define PyBoolObject                 PyLongObject
00301 #endif
00302 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
00303   #ifndef PyUnicode_InternFromString
00304     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
00305   #endif
00306 #endif
00307 #if PY_VERSION_HEX < 0x030200A4
00308   typedef long Py_hash_t;
00309   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
00310   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
00311 #else
00312   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
00313   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
00314 #endif
00315 #if PY_MAJOR_VERSION >= 3
00316   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
00317 #else
00318   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
00319 #endif
00320 #if CYTHON_USE_ASYNC_SLOTS
00321   #if PY_VERSION_HEX >= 0x030500B1
00322     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
00323     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
00324   #else
00325     typedef struct {
00326         unaryfunc am_await;
00327         unaryfunc am_aiter;
00328         unaryfunc am_anext;
00329     } __Pyx_PyAsyncMethodsStruct;
00330     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
00331   #endif
00332 #else
00333   #define __Pyx_PyType_AsAsync(obj) NULL
00334 #endif
00335 #ifndef CYTHON_RESTRICT
00336   #if defined(__GNUC__)
00337     #define CYTHON_RESTRICT __restrict__
00338   #elif defined(_MSC_VER) && _MSC_VER >= 1400
00339     #define CYTHON_RESTRICT __restrict
00340   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
00341     #define CYTHON_RESTRICT restrict
00342   #else
00343     #define CYTHON_RESTRICT
00344   #endif
00345 #endif
00346 #ifndef CYTHON_UNUSED
00347 # if defined(__GNUC__)
00348 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
00349 #     define CYTHON_UNUSED __attribute__ ((__unused__))
00350 #   else
00351 #     define CYTHON_UNUSED
00352 #   endif
00353 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
00354 #   define CYTHON_UNUSED __attribute__ ((__unused__))
00355 # else
00356 #   define CYTHON_UNUSED
00357 # endif
00358 #endif
00359 #ifndef CYTHON_MAYBE_UNUSED_VAR
00360 #  if defined(__cplusplus)
00361      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
00362 #  else
00363 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
00364 #  endif
00365 #endif
00366 #ifndef CYTHON_NCP_UNUSED
00367 # if CYTHON_COMPILING_IN_CPYTHON
00368 #  define CYTHON_NCP_UNUSED
00369 # else
00370 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
00371 # endif
00372 #endif
00373 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
00374 
00375 #ifndef __cplusplus
00376   #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
00377 #endif
00378 #ifndef CYTHON_INLINE
00379   #if defined(__clang__)
00380     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
00381   #else
00382     #define CYTHON_INLINE inline
00383   #endif
00384 #endif
00385 template<typename T>
00386 void __Pyx_call_destructor(T& x) {
00387     x.~T();
00388 }
00389 template<typename T>
00390 class __Pyx_FakeReference {
00391   public:
00392     __Pyx_FakeReference() : ptr(NULL) { }
00393     __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
00394     T *operator->() { return ptr; }
00395     T *operator&() { return ptr; }
00396     operator T&() { return *ptr; }
00397     template<typename U> bool operator ==(U other) { return *ptr == other; }
00398     template<typename U> bool operator !=(U other) { return *ptr != other; }
00399   private:
00400     T *ptr;
00401 };
00402 
00403 #if defined(WIN32) || defined(MS_WINDOWS)
00404   #define _USE_MATH_DEFINES
00405 #endif
00406 #include <math.h>
00407 #ifdef NAN
00408 #define __PYX_NAN() ((float) NAN)
00409 #else
00410 static CYTHON_INLINE float __PYX_NAN() {
00411   float value;
00412   memset(&value, 0xFF, sizeof(value));
00413   return value;
00414 }
00415 #endif
00416 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
00417 #define __Pyx_truncl trunc
00418 #else
00419 #define __Pyx_truncl truncl
00420 #endif
00421 
00422 
00423 #define __PYX_ERR(f_index, lineno, Ln_error) \
00424 { \
00425   __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
00426 }
00427 
00428 #if PY_MAJOR_VERSION >= 3
00429   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
00430   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
00431 #else
00432   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
00433   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
00434 #endif
00435 
00436 #ifndef __PYX_EXTERN_C
00437   #ifdef __cplusplus
00438     #define __PYX_EXTERN_C extern "C"
00439   #else
00440     #define __PYX_EXTERN_C extern
00441   #endif
00442 #endif
00443 
00444 #define __PYX_HAVE__gpu_nms
00445 #define __PYX_HAVE_API__gpu_nms
00446 #include <string.h>
00447 #include <stdio.h>
00448 #include <stdlib.h>
00449 #include "numpy/arrayobject.h"
00450 #include "numpy/ufuncobject.h"
00451 #include "gpu_nms.hpp"
00452 #ifdef _OPENMP
00453 #include <omp.h>
00454 #endif /* _OPENMP */
00455 
00456 #ifdef PYREX_WITHOUT_ASSERTIONS
00457 #define CYTHON_WITHOUT_ASSERTIONS
00458 #endif
00459 
00460 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
00461                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
00462 
00463 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
00464 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
00465 #define __PYX_DEFAULT_STRING_ENCODING ""
00466 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
00467 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
00468 #define __Pyx_uchar_cast(c) ((unsigned char)c)
00469 #define __Pyx_long_cast(x) ((long)x)
00470 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
00471     (sizeof(type) < sizeof(Py_ssize_t))  ||\
00472     (sizeof(type) > sizeof(Py_ssize_t) &&\
00473           likely(v < (type)PY_SSIZE_T_MAX ||\
00474                  v == (type)PY_SSIZE_T_MAX)  &&\
00475           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
00476                                 v == (type)PY_SSIZE_T_MIN)))  ||\
00477     (sizeof(type) == sizeof(Py_ssize_t) &&\
00478           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
00479                                v == (type)PY_SSIZE_T_MAX)))  )
00480 #if defined (__cplusplus) && __cplusplus >= 201103L
00481     #include <cstdlib>
00482     #define __Pyx_sst_abs(value) std::abs(value)
00483 #elif SIZEOF_INT >= SIZEOF_SIZE_T
00484     #define __Pyx_sst_abs(value) abs(value)
00485 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
00486     #define __Pyx_sst_abs(value) labs(value)
00487 #elif defined (_MSC_VER) && defined (_M_X64)
00488     #define __Pyx_sst_abs(value) _abs64(value)
00489 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
00490     #define __Pyx_sst_abs(value) llabs(value)
00491 #elif defined (__GNUC__)
00492     #define __Pyx_sst_abs(value) __builtin_llabs(value)
00493 #else
00494     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
00495 #endif
00496 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
00497 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
00498 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
00499 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
00500 #define __Pyx_PyBytes_FromString        PyBytes_FromString
00501 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
00502 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
00503 #if PY_MAJOR_VERSION < 3
00504     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
00505     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
00506 #else
00507     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
00508     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
00509 #endif
00510 #define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
00511 #define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
00512 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
00513 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
00514 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
00515 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
00516 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
00517 #if PY_MAJOR_VERSION < 3
00518 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
00519 {
00520     const Py_UNICODE *u_end = u;
00521     while (*u_end++) ;
00522     return (size_t)(u_end - u - 1);
00523 }
00524 #else
00525 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
00526 #endif
00527 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
00528 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
00529 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
00530 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
00531 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
00532 #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
00533 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
00534 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
00535 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
00536 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
00537 #if CYTHON_ASSUME_SAFE_MACROS
00538 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
00539 #else
00540 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
00541 #endif
00542 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
00543 #if PY_MAJOR_VERSION >= 3
00544 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
00545 #else
00546 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
00547 #endif
00548 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
00549 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
00550 static int __Pyx_sys_getdefaultencoding_not_ascii;
00551 static int __Pyx_init_sys_getdefaultencoding_params(void) {
00552     PyObject* sys;
00553     PyObject* default_encoding = NULL;
00554     PyObject* ascii_chars_u = NULL;
00555     PyObject* ascii_chars_b = NULL;
00556     const char* default_encoding_c;
00557     sys = PyImport_ImportModule("sys");
00558     if (!sys) goto bad;
00559     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
00560     Py_DECREF(sys);
00561     if (!default_encoding) goto bad;
00562     default_encoding_c = PyBytes_AsString(default_encoding);
00563     if (!default_encoding_c) goto bad;
00564     if (strcmp(default_encoding_c, "ascii") == 0) {
00565         __Pyx_sys_getdefaultencoding_not_ascii = 0;
00566     } else {
00567         char ascii_chars[128];
00568         int c;
00569         for (c = 0; c < 128; c++) {
00570             ascii_chars[c] = c;
00571         }
00572         __Pyx_sys_getdefaultencoding_not_ascii = 1;
00573         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
00574         if (!ascii_chars_u) goto bad;
00575         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
00576         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
00577             PyErr_Format(
00578                 PyExc_ValueError,
00579                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
00580                 default_encoding_c);
00581             goto bad;
00582         }
00583         Py_DECREF(ascii_chars_u);
00584         Py_DECREF(ascii_chars_b);
00585     }
00586     Py_DECREF(default_encoding);
00587     return 0;
00588 bad:
00589     Py_XDECREF(default_encoding);
00590     Py_XDECREF(ascii_chars_u);
00591     Py_XDECREF(ascii_chars_b);
00592     return -1;
00593 }
00594 #endif
00595 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
00596 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
00597 #else
00598 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
00599 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
00600 static char* __PYX_DEFAULT_STRING_ENCODING;
00601 static int __Pyx_init_sys_getdefaultencoding_params(void) {
00602     PyObject* sys;
00603     PyObject* default_encoding = NULL;
00604     char* default_encoding_c;
00605     sys = PyImport_ImportModule("sys");
00606     if (!sys) goto bad;
00607     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
00608     Py_DECREF(sys);
00609     if (!default_encoding) goto bad;
00610     default_encoding_c = PyBytes_AsString(default_encoding);
00611     if (!default_encoding_c) goto bad;
00612     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
00613     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
00614     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
00615     Py_DECREF(default_encoding);
00616     return 0;
00617 bad:
00618     Py_XDECREF(default_encoding);
00619     return -1;
00620 }
00621 #endif
00622 #endif
00623 
00624 
00625 /* Test for GCC > 2.95 */
00626 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
00627   #define likely(x)   __builtin_expect(!!(x), 1)
00628   #define unlikely(x) __builtin_expect(!!(x), 0)
00629 #else /* !__GNUC__ or GCC < 2.95 */
00630   #define likely(x)   (x)
00631   #define unlikely(x) (x)
00632 #endif /* __GNUC__ */
00633 
00634 static PyObject *__pyx_m;
00635 static PyObject *__pyx_d;
00636 static PyObject *__pyx_b;
00637 static PyObject *__pyx_empty_tuple;
00638 static PyObject *__pyx_empty_bytes;
00639 static PyObject *__pyx_empty_unicode;
00640 static int __pyx_lineno;
00641 static int __pyx_clineno = 0;
00642 static const char * __pyx_cfilenm= __FILE__;
00643 static const char *__pyx_filename;
00644 
00645 /* Header.proto */
00646 #if !defined(CYTHON_CCOMPLEX)
00647   #if defined(__cplusplus)
00648     #define CYTHON_CCOMPLEX 1
00649   #elif defined(_Complex_I)
00650     #define CYTHON_CCOMPLEX 1
00651   #else
00652     #define CYTHON_CCOMPLEX 0
00653   #endif
00654 #endif
00655 #if CYTHON_CCOMPLEX
00656   #ifdef __cplusplus
00657     #include <complex>
00658   #else
00659     #include <complex.h>
00660   #endif
00661 #endif
00662 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
00663   #undef _Complex_I
00664   #define _Complex_I 1.0fj
00665 #endif
00666 
00667 
00668 static const char *__pyx_f[] = {
00669   "gpu_nms.pyx",
00670   "__init__.pxd",
00671   "type.pxd",
00672 };
00673 /* BufferFormatStructs.proto */
00674 #define IS_UNSIGNED(type) (((type) -1) > 0)
00675 struct __Pyx_StructField_;
00676 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
00677 typedef struct {
00678   const char* name;
00679   struct __Pyx_StructField_* fields;
00680   size_t size;
00681   size_t arraysize[8];
00682   int ndim;
00683   char typegroup;
00684   char is_unsigned;
00685   int flags;
00686 } __Pyx_TypeInfo;
00687 typedef struct __Pyx_StructField_ {
00688   __Pyx_TypeInfo* type;
00689   const char* name;
00690   size_t offset;
00691 } __Pyx_StructField;
00692 typedef struct {
00693   __Pyx_StructField* field;
00694   size_t parent_offset;
00695 } __Pyx_BufFmt_StackElem;
00696 typedef struct {
00697   __Pyx_StructField root;
00698   __Pyx_BufFmt_StackElem* head;
00699   size_t fmt_offset;
00700   size_t new_count, enc_count;
00701   size_t struct_alignment;
00702   int is_complex;
00703   char enc_type;
00704   char new_packmode;
00705   char enc_packmode;
00706   char is_valid_array;
00707 } __Pyx_BufFmt_Context;
00708 
00709 
00710 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":725
00711  * # in Cython to enable them only on the right systems.
00712  * 
00713  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
00714  * ctypedef npy_int16      int16_t
00715  * ctypedef npy_int32      int32_t
00716  */
00717 typedef npy_int8 __pyx_t_5numpy_int8_t;
00718 
00719 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":726
00720  * 
00721  * ctypedef npy_int8       int8_t
00722  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
00723  * ctypedef npy_int32      int32_t
00724  * ctypedef npy_int64      int64_t
00725  */
00726 typedef npy_int16 __pyx_t_5numpy_int16_t;
00727 
00728 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":727
00729  * ctypedef npy_int8       int8_t
00730  * ctypedef npy_int16      int16_t
00731  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
00732  * ctypedef npy_int64      int64_t
00733  * #ctypedef npy_int96      int96_t
00734  */
00735 typedef npy_int32 __pyx_t_5numpy_int32_t;
00736 
00737 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":728
00738  * ctypedef npy_int16      int16_t
00739  * ctypedef npy_int32      int32_t
00740  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
00741  * #ctypedef npy_int96      int96_t
00742  * #ctypedef npy_int128     int128_t
00743  */
00744 typedef npy_int64 __pyx_t_5numpy_int64_t;
00745 
00746 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":732
00747  * #ctypedef npy_int128     int128_t
00748  * 
00749  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
00750  * ctypedef npy_uint16     uint16_t
00751  * ctypedef npy_uint32     uint32_t
00752  */
00753 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
00754 
00755 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":733
00756  * 
00757  * ctypedef npy_uint8      uint8_t
00758  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
00759  * ctypedef npy_uint32     uint32_t
00760  * ctypedef npy_uint64     uint64_t
00761  */
00762 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
00763 
00764 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":734
00765  * ctypedef npy_uint8      uint8_t
00766  * ctypedef npy_uint16     uint16_t
00767  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
00768  * ctypedef npy_uint64     uint64_t
00769  * #ctypedef npy_uint96     uint96_t
00770  */
00771 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
00772 
00773 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":735
00774  * ctypedef npy_uint16     uint16_t
00775  * ctypedef npy_uint32     uint32_t
00776  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
00777  * #ctypedef npy_uint96     uint96_t
00778  * #ctypedef npy_uint128    uint128_t
00779  */
00780 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
00781 
00782 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":739
00783  * #ctypedef npy_uint128    uint128_t
00784  * 
00785  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
00786  * ctypedef npy_float64    float64_t
00787  * #ctypedef npy_float80    float80_t
00788  */
00789 typedef npy_float32 __pyx_t_5numpy_float32_t;
00790 
00791 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":740
00792  * 
00793  * ctypedef npy_float32    float32_t
00794  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
00795  * #ctypedef npy_float80    float80_t
00796  * #ctypedef npy_float128   float128_t
00797  */
00798 typedef npy_float64 __pyx_t_5numpy_float64_t;
00799 
00800 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":749
00801  * # The int types are mapped a bit surprising --
00802  * # numpy.int corresponds to 'l' and numpy.long to 'q'
00803  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
00804  * ctypedef npy_longlong   long_t
00805  * ctypedef npy_longlong   longlong_t
00806  */
00807 typedef npy_long __pyx_t_5numpy_int_t;
00808 
00809 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":750
00810  * # numpy.int corresponds to 'l' and numpy.long to 'q'
00811  * ctypedef npy_long       int_t
00812  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
00813  * ctypedef npy_longlong   longlong_t
00814  * 
00815  */
00816 typedef npy_longlong __pyx_t_5numpy_long_t;
00817 
00818 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":751
00819  * ctypedef npy_long       int_t
00820  * ctypedef npy_longlong   long_t
00821  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
00822  * 
00823  * ctypedef npy_ulong      uint_t
00824  */
00825 typedef npy_longlong __pyx_t_5numpy_longlong_t;
00826 
00827 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":753
00828  * ctypedef npy_longlong   longlong_t
00829  * 
00830  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
00831  * ctypedef npy_ulonglong  ulong_t
00832  * ctypedef npy_ulonglong  ulonglong_t
00833  */
00834 typedef npy_ulong __pyx_t_5numpy_uint_t;
00835 
00836 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":754
00837  * 
00838  * ctypedef npy_ulong      uint_t
00839  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
00840  * ctypedef npy_ulonglong  ulonglong_t
00841  * 
00842  */
00843 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
00844 
00845 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":755
00846  * ctypedef npy_ulong      uint_t
00847  * ctypedef npy_ulonglong  ulong_t
00848  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
00849  * 
00850  * ctypedef npy_intp       intp_t
00851  */
00852 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
00853 
00854 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":757
00855  * ctypedef npy_ulonglong  ulonglong_t
00856  * 
00857  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
00858  * ctypedef npy_uintp      uintp_t
00859  * 
00860  */
00861 typedef npy_intp __pyx_t_5numpy_intp_t;
00862 
00863 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":758
00864  * 
00865  * ctypedef npy_intp       intp_t
00866  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
00867  * 
00868  * ctypedef npy_double     float_t
00869  */
00870 typedef npy_uintp __pyx_t_5numpy_uintp_t;
00871 
00872 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":760
00873  * ctypedef npy_uintp      uintp_t
00874  * 
00875  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
00876  * ctypedef npy_double     double_t
00877  * ctypedef npy_longdouble longdouble_t
00878  */
00879 typedef npy_double __pyx_t_5numpy_float_t;
00880 
00881 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":761
00882  * 
00883  * ctypedef npy_double     float_t
00884  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
00885  * ctypedef npy_longdouble longdouble_t
00886  * 
00887  */
00888 typedef npy_double __pyx_t_5numpy_double_t;
00889 
00890 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":762
00891  * ctypedef npy_double     float_t
00892  * ctypedef npy_double     double_t
00893  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
00894  * 
00895  * ctypedef npy_cfloat      cfloat_t
00896  */
00897 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
00898 /* Declarations.proto */
00899 #if CYTHON_CCOMPLEX
00900   #ifdef __cplusplus
00901     typedef ::std::complex< float > __pyx_t_float_complex;
00902   #else
00903     typedef float _Complex __pyx_t_float_complex;
00904   #endif
00905 #else
00906     typedef struct { float real, imag; } __pyx_t_float_complex;
00907 #endif
00908 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
00909 
00910 /* Declarations.proto */
00911 #if CYTHON_CCOMPLEX
00912   #ifdef __cplusplus
00913     typedef ::std::complex< double > __pyx_t_double_complex;
00914   #else
00915     typedef double _Complex __pyx_t_double_complex;
00916   #endif
00917 #else
00918     typedef struct { double real, imag; } __pyx_t_double_complex;
00919 #endif
00920 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
00921 
00922 
00923 /*--- Type declarations ---*/
00924 
00925 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":764
00926  * ctypedef npy_longdouble longdouble_t
00927  * 
00928  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
00929  * ctypedef npy_cdouble     cdouble_t
00930  * ctypedef npy_clongdouble clongdouble_t
00931  */
00932 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
00933 
00934 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":765
00935  * 
00936  * ctypedef npy_cfloat      cfloat_t
00937  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
00938  * ctypedef npy_clongdouble clongdouble_t
00939  * 
00940  */
00941 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
00942 
00943 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":766
00944  * ctypedef npy_cfloat      cfloat_t
00945  * ctypedef npy_cdouble     cdouble_t
00946  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
00947  * 
00948  * ctypedef npy_cdouble     complex_t
00949  */
00950 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
00951 
00952 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":768
00953  * ctypedef npy_clongdouble clongdouble_t
00954  * 
00955  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
00956  * 
00957  * cdef inline object PyArray_MultiIterNew1(a):
00958  */
00959 typedef npy_cdouble __pyx_t_5numpy_complex_t;
00960 
00961 /* --- Runtime support code (head) --- */
00962 /* Refnanny.proto */
00963 #ifndef CYTHON_REFNANNY
00964   #define CYTHON_REFNANNY 0
00965 #endif
00966 #if CYTHON_REFNANNY
00967   typedef struct {
00968     void (*INCREF)(void*, PyObject*, int);
00969     void (*DECREF)(void*, PyObject*, int);
00970     void (*GOTREF)(void*, PyObject*, int);
00971     void (*GIVEREF)(void*, PyObject*, int);
00972     void* (*SetupContext)(const char*, int, const char*);
00973     void (*FinishContext)(void**);
00974   } __Pyx_RefNannyAPIStruct;
00975   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
00976   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
00977   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
00978 #ifdef WITH_THREAD
00979   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
00980           if (acquire_gil) {\
00981               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
00982               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
00983               PyGILState_Release(__pyx_gilstate_save);\
00984           } else {\
00985               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
00986           }
00987 #else
00988   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
00989           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
00990 #endif
00991   #define __Pyx_RefNannyFinishContext()\
00992           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
00993   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
00994   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
00995   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
00996   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
00997   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
00998   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
00999   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
01000   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
01001 #else
01002   #define __Pyx_RefNannyDeclarations
01003   #define __Pyx_RefNannySetupContext(name, acquire_gil)
01004   #define __Pyx_RefNannyFinishContext()
01005   #define __Pyx_INCREF(r) Py_INCREF(r)
01006   #define __Pyx_DECREF(r) Py_DECREF(r)
01007   #define __Pyx_GOTREF(r)
01008   #define __Pyx_GIVEREF(r)
01009   #define __Pyx_XINCREF(r) Py_XINCREF(r)
01010   #define __Pyx_XDECREF(r) Py_XDECREF(r)
01011   #define __Pyx_XGOTREF(r)
01012   #define __Pyx_XGIVEREF(r)
01013 #endif
01014 #define __Pyx_XDECREF_SET(r, v) do {\
01015         PyObject *tmp = (PyObject *) r;\
01016         r = v; __Pyx_XDECREF(tmp);\
01017     } while (0)
01018 #define __Pyx_DECREF_SET(r, v) do {\
01019         PyObject *tmp = (PyObject *) r;\
01020         r = v; __Pyx_DECREF(tmp);\
01021     } while (0)
01022 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
01023 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
01024 
01025 /* RaiseArgTupleInvalid.proto */
01026 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
01027     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
01028 
01029 /* RaiseDoubleKeywords.proto */
01030 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
01031 
01032 /* ParseKeywords.proto */
01033 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
01034     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
01035     const char* function_name);
01036 
01037 /* ArgTypeTest.proto */
01038 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
01039     const char *name, int exact);
01040 
01041 /* BufferFormatCheck.proto */
01042 static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
01043     __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
01044 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
01045 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
01046 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
01047                               __Pyx_BufFmt_StackElem* stack,
01048                               __Pyx_TypeInfo* type); // PROTO
01049 
01050 /* PyObjectGetAttrStr.proto */
01051 #if CYTHON_USE_TYPE_SLOTS
01052 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
01053     PyTypeObject* tp = Py_TYPE(obj);
01054     if (likely(tp->tp_getattro))
01055         return tp->tp_getattro(obj, attr_name);
01056 #if PY_MAJOR_VERSION < 3
01057     if (likely(tp->tp_getattr))
01058         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
01059 #endif
01060     return PyObject_GetAttr(obj, attr_name);
01061 }
01062 #else
01063 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
01064 #endif
01065 
01066 /* GetBuiltinName.proto */
01067 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
01068 
01069 /* GetModuleGlobalName.proto */
01070 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
01071 
01072 /* PyObjectCall.proto */
01073 #if CYTHON_COMPILING_IN_CPYTHON
01074 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
01075 #else
01076 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
01077 #endif
01078 
01079 /* ExtTypeTest.proto */
01080 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
01081 
01082 /* PyCFunctionFastCall.proto */
01083 #if CYTHON_FAST_PYCCALL
01084 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
01085 #else
01086 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
01087 #endif
01088 
01089 /* PyFunctionFastCall.proto */
01090 #if CYTHON_FAST_PYCALL
01091 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
01092     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
01093 #if 1 || PY_VERSION_HEX < 0x030600B1
01094 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
01095 #else
01096 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
01097 #endif
01098 #endif
01099 
01100 /* PyObjectCallMethO.proto */
01101 #if CYTHON_COMPILING_IN_CPYTHON
01102 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
01103 #endif
01104 
01105 /* PyObjectCallOneArg.proto */
01106 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
01107 
01108 /* PyObjectCallNoArg.proto */
01109 #if CYTHON_COMPILING_IN_CPYTHON
01110 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
01111 #else
01112 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
01113 #endif
01114 
01115 /* BufferIndexError.proto */
01116 static void __Pyx_RaiseBufferIndexError(int axis);
01117 
01118 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
01119 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
01120 /* SliceObject.proto */
01121 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
01122         PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
01123         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
01124         int has_cstart, int has_cstop, int wraparound);
01125 
01126 /* BufferFallbackError.proto */
01127 static void __Pyx_RaiseBufferFallbackError(void);
01128 
01129 /* PyThreadStateGet.proto */
01130 #if CYTHON_FAST_THREAD_STATE
01131 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
01132 #define __Pyx_PyThreadState_assign  __pyx_tstate = PyThreadState_GET();
01133 #else
01134 #define __Pyx_PyThreadState_declare
01135 #define __Pyx_PyThreadState_assign
01136 #endif
01137 
01138 /* PyErrFetchRestore.proto */
01139 #if CYTHON_FAST_THREAD_STATE
01140 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
01141 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
01142 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
01143 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
01144 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
01145 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
01146 #else
01147 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
01148 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
01149 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
01150 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
01151 #endif
01152 
01153 /* RaiseException.proto */
01154 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
01155 
01156 /* DictGetItem.proto */
01157 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
01158 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
01159     PyObject *value;
01160     value = PyDict_GetItemWithError(d, key);
01161     if (unlikely(!value)) {
01162         if (!PyErr_Occurred()) {
01163             PyObject* args = PyTuple_Pack(1, key);
01164             if (likely(args))
01165                 PyErr_SetObject(PyExc_KeyError, args);
01166             Py_XDECREF(args);
01167         }
01168         return NULL;
01169     }
01170     Py_INCREF(value);
01171     return value;
01172 }
01173 #else
01174     #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
01175 #endif
01176 
01177 /* RaiseTooManyValuesToUnpack.proto */
01178 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
01179 
01180 /* RaiseNeedMoreValuesToUnpack.proto */
01181 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
01182 
01183 /* RaiseNoneIterError.proto */
01184 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
01185 
01186 /* SaveResetException.proto */
01187 #if CYTHON_FAST_THREAD_STATE
01188 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
01189 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
01190 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
01191 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
01192 #else
01193 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
01194 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
01195 #endif
01196 
01197 /* PyErrExceptionMatches.proto */
01198 #if CYTHON_FAST_THREAD_STATE
01199 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
01200 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
01201 #else
01202 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
01203 #endif
01204 
01205 /* GetException.proto */
01206 #if CYTHON_FAST_THREAD_STATE
01207 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
01208 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
01209 #else
01210 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
01211 #endif
01212 
01213 /* Import.proto */
01214 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
01215 
01216 /* CodeObjectCache.proto */
01217 typedef struct {
01218     PyCodeObject* code_object;
01219     int code_line;
01220 } __Pyx_CodeObjectCacheEntry;
01221 struct __Pyx_CodeObjectCache {
01222     int count;
01223     int max_count;
01224     __Pyx_CodeObjectCacheEntry* entries;
01225 };
01226 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
01227 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
01228 static PyCodeObject *__pyx_find_code_object(int code_line);
01229 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
01230 
01231 /* AddTraceback.proto */
01232 static void __Pyx_AddTraceback(const char *funcname, int c_line,
01233                                int py_line, const char *filename);
01234 
01235 /* BufferStructDeclare.proto */
01236 typedef struct {
01237   Py_ssize_t shape, strides, suboffsets;
01238 } __Pyx_Buf_DimInfo;
01239 typedef struct {
01240   size_t refcount;
01241   Py_buffer pybuffer;
01242 } __Pyx_Buffer;
01243 typedef struct {
01244   __Pyx_Buffer *rcbuffer;
01245   char *data;
01246   __Pyx_Buf_DimInfo diminfo[8];
01247 } __Pyx_LocalBuf_ND;
01248 
01249 #if PY_MAJOR_VERSION < 3
01250     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
01251     static void __Pyx_ReleaseBuffer(Py_buffer *view);
01252 #else
01253     #define __Pyx_GetBuffer PyObject_GetBuffer
01254     #define __Pyx_ReleaseBuffer PyBuffer_Release
01255 #endif
01256 
01257 
01258 /* None.proto */
01259 static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
01260 static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
01261 
01262 /* CIntToPy.proto */
01263 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
01264 
01265 /* RealImag.proto */
01266 #if CYTHON_CCOMPLEX
01267   #ifdef __cplusplus
01268     #define __Pyx_CREAL(z) ((z).real())
01269     #define __Pyx_CIMAG(z) ((z).imag())
01270   #else
01271     #define __Pyx_CREAL(z) (__real__(z))
01272     #define __Pyx_CIMAG(z) (__imag__(z))
01273   #endif
01274 #else
01275     #define __Pyx_CREAL(z) ((z).real)
01276     #define __Pyx_CIMAG(z) ((z).imag)
01277 #endif
01278 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
01279         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
01280     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
01281     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
01282 #else
01283     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
01284     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
01285 #endif
01286 
01287 /* Arithmetic.proto */
01288 #if CYTHON_CCOMPLEX
01289     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
01290     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
01291     #define __Pyx_c_diff_float(a, b) ((a)-(b))
01292     #define __Pyx_c_prod_float(a, b) ((a)*(b))
01293     #define __Pyx_c_quot_float(a, b) ((a)/(b))
01294     #define __Pyx_c_neg_float(a)     (-(a))
01295   #ifdef __cplusplus
01296     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
01297     #define __Pyx_c_conj_float(z)    (::std::conj(z))
01298     #if 1
01299         #define __Pyx_c_abs_float(z)     (::std::abs(z))
01300         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
01301     #endif
01302   #else
01303     #define __Pyx_c_is_zero_float(z) ((z)==0)
01304     #define __Pyx_c_conj_float(z)    (conjf(z))
01305     #if 1
01306         #define __Pyx_c_abs_float(z)     (cabsf(z))
01307         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
01308     #endif
01309  #endif
01310 #else
01311     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
01312     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
01313     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
01314     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
01315     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
01316     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
01317     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
01318     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
01319     #if 1
01320         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
01321         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
01322     #endif
01323 #endif
01324 
01325 /* Arithmetic.proto */
01326 #if CYTHON_CCOMPLEX
01327     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
01328     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
01329     #define __Pyx_c_diff_double(a, b) ((a)-(b))
01330     #define __Pyx_c_prod_double(a, b) ((a)*(b))
01331     #define __Pyx_c_quot_double(a, b) ((a)/(b))
01332     #define __Pyx_c_neg_double(a)     (-(a))
01333   #ifdef __cplusplus
01334     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
01335     #define __Pyx_c_conj_double(z)    (::std::conj(z))
01336     #if 1
01337         #define __Pyx_c_abs_double(z)     (::std::abs(z))
01338         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
01339     #endif
01340   #else
01341     #define __Pyx_c_is_zero_double(z) ((z)==0)
01342     #define __Pyx_c_conj_double(z)    (conj(z))
01343     #if 1
01344         #define __Pyx_c_abs_double(z)     (cabs(z))
01345         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
01346     #endif
01347  #endif
01348 #else
01349     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
01350     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
01351     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
01352     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
01353     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
01354     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
01355     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
01356     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
01357     #if 1
01358         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
01359         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
01360     #endif
01361 #endif
01362 
01363 /* CIntToPy.proto */
01364 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
01365 
01366 /* CIntFromPy.proto */
01367 static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *);
01368 
01369 /* CIntFromPy.proto */
01370 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
01371 
01372 /* CIntToPy.proto */
01373 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
01374 
01375 /* CIntFromPy.proto */
01376 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
01377 
01378 /* CheckBinaryVersion.proto */
01379 static int __Pyx_check_binary_version(void);
01380 
01381 /* PyIdentifierFromString.proto */
01382 #if !defined(__Pyx_PyIdentifier_FromString)
01383 #if PY_MAJOR_VERSION < 3
01384   #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
01385 #else
01386   #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
01387 #endif
01388 #endif
01389 
01390 /* ModuleImport.proto */
01391 static PyObject *__Pyx_ImportModule(const char *name);
01392 
01393 /* TypeImport.proto */
01394 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
01395 
01396 /* InitStrings.proto */
01397 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
01398 
01399 
01400 /* Module declarations from 'cpython.buffer' */
01401 
01402 /* Module declarations from 'libc.string' */
01403 
01404 /* Module declarations from 'libc.stdio' */
01405 
01406 /* Module declarations from '__builtin__' */
01407 
01408 /* Module declarations from 'cpython.type' */
01409 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
01410 
01411 /* Module declarations from 'cpython' */
01412 
01413 /* Module declarations from 'cpython.object' */
01414 
01415 /* Module declarations from 'cpython.ref' */
01416 
01417 /* Module declarations from 'libc.stdlib' */
01418 
01419 /* Module declarations from 'numpy' */
01420 
01421 /* Module declarations from 'numpy' */
01422 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
01423 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
01424 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
01425 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
01426 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
01427 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
01428 
01429 /* Module declarations from 'gpu_nms' */
01430 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), { 0 }, 0, 'R', 0, 0 };
01431 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 };
01432 #define __Pyx_MODULE_NAME "gpu_nms"
01433 int __pyx_module_is_main_gpu_nms = 0;
01434 
01435 /* Implementation of 'gpu_nms' */
01436 static PyObject *__pyx_builtin_ValueError;
01437 static PyObject *__pyx_builtin_range;
01438 static PyObject *__pyx_builtin_RuntimeError;
01439 static PyObject *__pyx_builtin_ImportError;
01440 static const char __pyx_k_np[] = "np";
01441 static const char __pyx_k_dets[] = "dets";
01442 static const char __pyx_k_keep[] = "keep";
01443 static const char __pyx_k_main[] = "__main__";
01444 static const char __pyx_k_test[] = "__test__";
01445 static const char __pyx_k_dtype[] = "dtype";
01446 static const char __pyx_k_int32[] = "int32";
01447 static const char __pyx_k_numpy[] = "numpy";
01448 static const char __pyx_k_order[] = "order";
01449 static const char __pyx_k_range[] = "range";
01450 static const char __pyx_k_zeros[] = "zeros";
01451 static const char __pyx_k_astype[] = "astype";
01452 static const char __pyx_k_import[] = "__import__";
01453 static const char __pyx_k_scores[] = "scores";
01454 static const char __pyx_k_thresh[] = "thresh";
01455 static const char __pyx_k_argsort[] = "argsort";
01456 static const char __pyx_k_gpu_nms[] = "gpu_nms";
01457 static const char __pyx_k_num_out[] = "num_out";
01458 static const char __pyx_k_boxes_dim[] = "boxes_dim";
01459 static const char __pyx_k_boxes_num[] = "boxes_num";
01460 static const char __pyx_k_device_id[] = "device_id";
01461 static const char __pyx_k_ValueError[] = "ValueError";
01462 static const char __pyx_k_ImportError[] = "ImportError";
01463 static const char __pyx_k_sorted_dets[] = "sorted_dets";
01464 static const char __pyx_k_RuntimeError[] = "RuntimeError";
01465 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
01466 static const char __pyx_k_home_andrewsilva_Deformable_Con[] = "/home/andrewsilva/Deformable_ConvNets/Deformable-ConvNets/lib/nms/gpu_nms.pyx";
01467 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
01468 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
01469 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
01470 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
01471 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
01472 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
01473 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
01474 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
01475 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
01476 static PyObject *__pyx_n_s_ImportError;
01477 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
01478 static PyObject *__pyx_n_s_RuntimeError;
01479 static PyObject *__pyx_n_s_ValueError;
01480 static PyObject *__pyx_n_s_argsort;
01481 static PyObject *__pyx_n_s_astype;
01482 static PyObject *__pyx_n_s_boxes_dim;
01483 static PyObject *__pyx_n_s_boxes_num;
01484 static PyObject *__pyx_n_s_dets;
01485 static PyObject *__pyx_n_s_device_id;
01486 static PyObject *__pyx_n_s_dtype;
01487 static PyObject *__pyx_n_s_gpu_nms;
01488 static PyObject *__pyx_kp_s_home_andrewsilva_Deformable_Con;
01489 static PyObject *__pyx_n_s_import;
01490 static PyObject *__pyx_n_s_int32;
01491 static PyObject *__pyx_n_s_keep;
01492 static PyObject *__pyx_n_s_main;
01493 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
01494 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
01495 static PyObject *__pyx_n_s_np;
01496 static PyObject *__pyx_n_s_num_out;
01497 static PyObject *__pyx_n_s_numpy;
01498 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
01499 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
01500 static PyObject *__pyx_n_s_order;
01501 static PyObject *__pyx_n_s_range;
01502 static PyObject *__pyx_n_s_scores;
01503 static PyObject *__pyx_n_s_sorted_dets;
01504 static PyObject *__pyx_n_s_test;
01505 static PyObject *__pyx_n_s_thresh;
01506 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
01507 static PyObject *__pyx_n_s_zeros;
01508 static PyObject *__pyx_pf_7gpu_nms_gpu_nms(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dets, PyObject *__pyx_v_thresh, __pyx_t_5numpy_int32_t __pyx_v_device_id); /* proto */
01509 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
01510 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
01511 static PyObject *__pyx_int_4;
01512 static PyObject *__pyx_int_neg_1;
01513 static PyObject *__pyx_slice_;
01514 static PyObject *__pyx_slice__3;
01515 static PyObject *__pyx_slice__4;
01516 static PyObject *__pyx_tuple__2;
01517 static PyObject *__pyx_tuple__5;
01518 static PyObject *__pyx_tuple__6;
01519 static PyObject *__pyx_tuple__7;
01520 static PyObject *__pyx_tuple__8;
01521 static PyObject *__pyx_tuple__9;
01522 static PyObject *__pyx_tuple__10;
01523 static PyObject *__pyx_tuple__11;
01524 static PyObject *__pyx_tuple__12;
01525 static PyObject *__pyx_tuple__13;
01526 static PyObject *__pyx_tuple__14;
01527 static PyObject *__pyx_codeobj__15;
01528 
01529 /* "gpu_nms.pyx":16
01530  *     void _nms(np.int32_t*, int*, np.float32_t*, int, int, float, int)
01531  * 
01532  * def gpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh,             # <<<<<<<<<<<<<<
01533  *             np.int32_t device_id=0):
01534  *     cdef int boxes_num = dets.shape[0]
01535  */
01536 
01537 /* Python wrapper */
01538 static PyObject *__pyx_pw_7gpu_nms_1gpu_nms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
01539 static PyMethodDef __pyx_mdef_7gpu_nms_1gpu_nms = {"gpu_nms", (PyCFunction)__pyx_pw_7gpu_nms_1gpu_nms, METH_VARARGS|METH_KEYWORDS, 0};
01540 static PyObject *__pyx_pw_7gpu_nms_1gpu_nms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
01541   PyArrayObject *__pyx_v_dets = 0;
01542   PyObject *__pyx_v_thresh = 0;
01543   __pyx_t_5numpy_int32_t __pyx_v_device_id;
01544   PyObject *__pyx_r = 0;
01545   __Pyx_RefNannyDeclarations
01546   __Pyx_RefNannySetupContext("gpu_nms (wrapper)", 0);
01547   {
01548     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dets,&__pyx_n_s_thresh,&__pyx_n_s_device_id,0};
01549     PyObject* values[3] = {0,0,0};
01550     if (unlikely(__pyx_kwds)) {
01551       Py_ssize_t kw_args;
01552       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
01553       switch (pos_args) {
01554         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
01555         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
01556         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
01557         case  0: break;
01558         default: goto __pyx_L5_argtuple_error;
01559       }
01560       kw_args = PyDict_Size(__pyx_kwds);
01561       switch (pos_args) {
01562         case  0:
01563         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dets)) != 0)) kw_args--;
01564         else goto __pyx_L5_argtuple_error;
01565         case  1:
01566         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_thresh)) != 0)) kw_args--;
01567         else {
01568           __Pyx_RaiseArgtupleInvalid("gpu_nms", 0, 2, 3, 1); __PYX_ERR(0, 16, __pyx_L3_error)
01569         }
01570         case  2:
01571         if (kw_args > 0) {
01572           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_device_id);
01573           if (value) { values[2] = value; kw_args--; }
01574         }
01575       }
01576       if (unlikely(kw_args > 0)) {
01577         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gpu_nms") < 0)) __PYX_ERR(0, 16, __pyx_L3_error)
01578       }
01579     } else {
01580       switch (PyTuple_GET_SIZE(__pyx_args)) {
01581         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
01582         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
01583         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
01584         break;
01585         default: goto __pyx_L5_argtuple_error;
01586       }
01587     }
01588     __pyx_v_dets = ((PyArrayObject *)values[0]);
01589     __pyx_v_thresh = ((PyObject*)values[1]);
01590     if (values[2]) {
01591       __pyx_v_device_id = __Pyx_PyInt_As_npy_int32(values[2]); if (unlikely((__pyx_v_device_id == ((npy_int32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L3_error)
01592     } else {
01593       __pyx_v_device_id = ((__pyx_t_5numpy_int32_t)0);
01594     }
01595   }
01596   goto __pyx_L4_argument_unpacking_done;
01597   __pyx_L5_argtuple_error:;
01598   __Pyx_RaiseArgtupleInvalid("gpu_nms", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 16, __pyx_L3_error)
01599   __pyx_L3_error:;
01600   __Pyx_AddTraceback("gpu_nms.gpu_nms", __pyx_clineno, __pyx_lineno, __pyx_filename);
01601   __Pyx_RefNannyFinishContext();
01602   return NULL;
01603   __pyx_L4_argument_unpacking_done:;
01604   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dets), __pyx_ptype_5numpy_ndarray, 1, "dets", 0))) __PYX_ERR(0, 16, __pyx_L1_error)
01605   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thresh), (&PyFloat_Type), 1, "thresh", 1))) __PYX_ERR(0, 16, __pyx_L1_error)
01606   __pyx_r = __pyx_pf_7gpu_nms_gpu_nms(__pyx_self, __pyx_v_dets, __pyx_v_thresh, __pyx_v_device_id);
01607 
01608   /* function exit code */
01609   goto __pyx_L0;
01610   __pyx_L1_error:;
01611   __pyx_r = NULL;
01612   __pyx_L0:;
01613   __Pyx_RefNannyFinishContext();
01614   return __pyx_r;
01615 }
01616 
01617 static PyObject *__pyx_pf_7gpu_nms_gpu_nms(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dets, PyObject *__pyx_v_thresh, __pyx_t_5numpy_int32_t __pyx_v_device_id) {
01618   int __pyx_v_boxes_num;
01619   int __pyx_v_boxes_dim;
01620   int __pyx_v_num_out;
01621   PyArrayObject *__pyx_v_keep = 0;
01622   PyArrayObject *__pyx_v_scores = 0;
01623   PyArrayObject *__pyx_v_order = 0;
01624   PyArrayObject *__pyx_v_sorted_dets = 0;
01625   __Pyx_LocalBuf_ND __pyx_pybuffernd_dets;
01626   __Pyx_Buffer __pyx_pybuffer_dets;
01627   __Pyx_LocalBuf_ND __pyx_pybuffernd_keep;
01628   __Pyx_Buffer __pyx_pybuffer_keep;
01629   __Pyx_LocalBuf_ND __pyx_pybuffernd_order;
01630   __Pyx_Buffer __pyx_pybuffer_order;
01631   __Pyx_LocalBuf_ND __pyx_pybuffernd_scores;
01632   __Pyx_Buffer __pyx_pybuffer_scores;
01633   __Pyx_LocalBuf_ND __pyx_pybuffernd_sorted_dets;
01634   __Pyx_Buffer __pyx_pybuffer_sorted_dets;
01635   PyObject *__pyx_r = NULL;
01636   __Pyx_RefNannyDeclarations
01637   PyObject *__pyx_t_1 = NULL;
01638   PyObject *__pyx_t_2 = NULL;
01639   PyObject *__pyx_t_3 = NULL;
01640   PyObject *__pyx_t_4 = NULL;
01641   PyObject *__pyx_t_5 = NULL;
01642   PyArrayObject *__pyx_t_6 = NULL;
01643   PyArrayObject *__pyx_t_7 = NULL;
01644   PyArrayObject *__pyx_t_8 = NULL;
01645   PyArrayObject *__pyx_t_9 = NULL;
01646   Py_ssize_t __pyx_t_10;
01647   int __pyx_t_11;
01648   Py_ssize_t __pyx_t_12;
01649   Py_ssize_t __pyx_t_13;
01650   float __pyx_t_14;
01651   PyObject *__pyx_t_15 = NULL;
01652   PyObject *__pyx_t_16 = NULL;
01653   PyObject *__pyx_t_17 = NULL;
01654   __Pyx_RefNannySetupContext("gpu_nms", 0);
01655   __pyx_pybuffer_keep.pybuffer.buf = NULL;
01656   __pyx_pybuffer_keep.refcount = 0;
01657   __pyx_pybuffernd_keep.data = NULL;
01658   __pyx_pybuffernd_keep.rcbuffer = &__pyx_pybuffer_keep;
01659   __pyx_pybuffer_scores.pybuffer.buf = NULL;
01660   __pyx_pybuffer_scores.refcount = 0;
01661   __pyx_pybuffernd_scores.data = NULL;
01662   __pyx_pybuffernd_scores.rcbuffer = &__pyx_pybuffer_scores;
01663   __pyx_pybuffer_order.pybuffer.buf = NULL;
01664   __pyx_pybuffer_order.refcount = 0;
01665   __pyx_pybuffernd_order.data = NULL;
01666   __pyx_pybuffernd_order.rcbuffer = &__pyx_pybuffer_order;
01667   __pyx_pybuffer_sorted_dets.pybuffer.buf = NULL;
01668   __pyx_pybuffer_sorted_dets.refcount = 0;
01669   __pyx_pybuffernd_sorted_dets.data = NULL;
01670   __pyx_pybuffernd_sorted_dets.rcbuffer = &__pyx_pybuffer_sorted_dets;
01671   __pyx_pybuffer_dets.pybuffer.buf = NULL;
01672   __pyx_pybuffer_dets.refcount = 0;
01673   __pyx_pybuffernd_dets.data = NULL;
01674   __pyx_pybuffernd_dets.rcbuffer = &__pyx_pybuffer_dets;
01675   {
01676     __Pyx_BufFmt_StackElem __pyx_stack[1];
01677     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dets.rcbuffer->pybuffer, (PyObject*)__pyx_v_dets, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 16, __pyx_L1_error)
01678   }
01679   __pyx_pybuffernd_dets.diminfo[0].strides = __pyx_pybuffernd_dets.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dets.diminfo[0].shape = __pyx_pybuffernd_dets.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dets.diminfo[1].strides = __pyx_pybuffernd_dets.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dets.diminfo[1].shape = __pyx_pybuffernd_dets.rcbuffer->pybuffer.shape[1];
01680 
01681   /* "gpu_nms.pyx":18
01682  * def gpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh,
01683  *             np.int32_t device_id=0):
01684  *     cdef int boxes_num = dets.shape[0]             # <<<<<<<<<<<<<<
01685  *     cdef int boxes_dim = dets.shape[1]
01686  *     cdef int num_out
01687  */
01688   __pyx_v_boxes_num = (__pyx_v_dets->dimensions[0]);
01689 
01690   /* "gpu_nms.pyx":19
01691  *             np.int32_t device_id=0):
01692  *     cdef int boxes_num = dets.shape[0]
01693  *     cdef int boxes_dim = dets.shape[1]             # <<<<<<<<<<<<<<
01694  *     cdef int num_out
01695  *     cdef np.ndarray[np.int32_t, ndim=1] \
01696  */
01697   __pyx_v_boxes_dim = (__pyx_v_dets->dimensions[1]);
01698 
01699   /* "gpu_nms.pyx":22
01700  *     cdef int num_out
01701  *     cdef np.ndarray[np.int32_t, ndim=1] \
01702  *         keep = np.zeros(boxes_num, dtype=np.int32)             # <<<<<<<<<<<<<<
01703  *     cdef np.ndarray[np.float32_t, ndim=1] \
01704  *         scores = dets[:, 4]
01705  */
01706   __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
01707   __Pyx_GOTREF(__pyx_t_1);
01708   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
01709   __Pyx_GOTREF(__pyx_t_2);
01710   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
01711   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_boxes_num); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
01712   __Pyx_GOTREF(__pyx_t_1);
01713   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error)
01714   __Pyx_GOTREF(__pyx_t_3);
01715   __Pyx_GIVEREF(__pyx_t_1);
01716   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
01717   __pyx_t_1 = 0;
01718   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
01719   __Pyx_GOTREF(__pyx_t_1);
01720   __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 22, __pyx_L1_error)
01721   __Pyx_GOTREF(__pyx_t_4);
01722   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error)
01723   __Pyx_GOTREF(__pyx_t_5);
01724   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
01725   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
01726   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
01727   __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error)
01728   __Pyx_GOTREF(__pyx_t_5);
01729   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
01730   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
01731   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
01732   if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 22, __pyx_L1_error)
01733   __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
01734   {
01735     __Pyx_BufFmt_StackElem __pyx_stack[1];
01736     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_keep.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
01737       __pyx_v_keep = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_keep.rcbuffer->pybuffer.buf = NULL;
01738       __PYX_ERR(0, 21, __pyx_L1_error)
01739     } else {__pyx_pybuffernd_keep.diminfo[0].strides = __pyx_pybuffernd_keep.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_keep.diminfo[0].shape = __pyx_pybuffernd_keep.rcbuffer->pybuffer.shape[0];
01740     }
01741   }
01742   __pyx_t_6 = 0;
01743   __pyx_v_keep = ((PyArrayObject *)__pyx_t_5);
01744   __pyx_t_5 = 0;
01745 
01746   /* "gpu_nms.pyx":24
01747  *         keep = np.zeros(boxes_num, dtype=np.int32)
01748  *     cdef np.ndarray[np.float32_t, ndim=1] \
01749  *         scores = dets[:, 4]             # <<<<<<<<<<<<<<
01750  *     cdef np.ndarray[np.int32_t, ndim=1] \
01751  *         order = scores.argsort()[::-1].astype(np.int32)
01752  */
01753   __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_dets), __pyx_tuple__2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)
01754   __Pyx_GOTREF(__pyx_t_5);
01755   if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 24, __pyx_L1_error)
01756   __pyx_t_7 = ((PyArrayObject *)__pyx_t_5);
01757   {
01758     __Pyx_BufFmt_StackElem __pyx_stack[1];
01759     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scores.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
01760       __pyx_v_scores = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_scores.rcbuffer->pybuffer.buf = NULL;
01761       __PYX_ERR(0, 23, __pyx_L1_error)
01762     } else {__pyx_pybuffernd_scores.diminfo[0].strides = __pyx_pybuffernd_scores.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_scores.diminfo[0].shape = __pyx_pybuffernd_scores.rcbuffer->pybuffer.shape[0];
01763     }
01764   }
01765   __pyx_t_7 = 0;
01766   __pyx_v_scores = ((PyArrayObject *)__pyx_t_5);
01767   __pyx_t_5 = 0;
01768 
01769   /* "gpu_nms.pyx":26
01770  *         scores = dets[:, 4]
01771  *     cdef np.ndarray[np.int32_t, ndim=1] \
01772  *         order = scores.argsort()[::-1].astype(np.int32)             # <<<<<<<<<<<<<<
01773  *     cdef np.ndarray[np.float32_t, ndim=2] \
01774  *         sorted_dets = dets[order, :]
01775  */
01776   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_scores), __pyx_n_s_argsort); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)
01777   __Pyx_GOTREF(__pyx_t_3);
01778   __pyx_t_2 = NULL;
01779   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
01780     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
01781     if (likely(__pyx_t_2)) {
01782       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
01783       __Pyx_INCREF(__pyx_t_2);
01784       __Pyx_INCREF(function);
01785       __Pyx_DECREF_SET(__pyx_t_3, function);
01786     }
01787   }
01788   if (__pyx_t_2) {
01789     __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
01790     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
01791   } else {
01792     __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
01793   }
01794   __Pyx_GOTREF(__pyx_t_1);
01795   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
01796   __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_slice__3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)
01797   __Pyx_GOTREF(__pyx_t_3);
01798   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
01799   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_astype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
01800   __Pyx_GOTREF(__pyx_t_1);
01801   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
01802   __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)
01803   __Pyx_GOTREF(__pyx_t_3);
01804   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
01805   __Pyx_GOTREF(__pyx_t_2);
01806   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
01807   __pyx_t_3 = NULL;
01808   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
01809     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
01810     if (likely(__pyx_t_3)) {
01811       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
01812       __Pyx_INCREF(__pyx_t_3);
01813       __Pyx_INCREF(function);
01814       __Pyx_DECREF_SET(__pyx_t_1, function);
01815     }
01816   }
01817   if (!__pyx_t_3) {
01818     __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error)
01819     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
01820     __Pyx_GOTREF(__pyx_t_5);
01821   } else {
01822     #if CYTHON_FAST_PYCALL
01823     if (PyFunction_Check(__pyx_t_1)) {
01824       PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
01825       __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error)
01826       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
01827       __Pyx_GOTREF(__pyx_t_5);
01828       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
01829     } else
01830     #endif
01831     #if CYTHON_FAST_PYCCALL
01832     if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
01833       PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
01834       __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error)
01835       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
01836       __Pyx_GOTREF(__pyx_t_5);
01837       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
01838     } else
01839     #endif
01840     {
01841       __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error)
01842       __Pyx_GOTREF(__pyx_t_4);
01843       __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
01844       __Pyx_GIVEREF(__pyx_t_2);
01845       PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_2);
01846       __pyx_t_2 = 0;
01847       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error)
01848       __Pyx_GOTREF(__pyx_t_5);
01849       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
01850     }
01851   }
01852   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
01853   if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 26, __pyx_L1_error)
01854   __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
01855   {
01856     __Pyx_BufFmt_StackElem __pyx_stack[1];
01857     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
01858       __pyx_v_order = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_order.rcbuffer->pybuffer.buf = NULL;
01859       __PYX_ERR(0, 25, __pyx_L1_error)
01860     } else {__pyx_pybuffernd_order.diminfo[0].strides = __pyx_pybuffernd_order.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_order.diminfo[0].shape = __pyx_pybuffernd_order.rcbuffer->pybuffer.shape[0];
01861     }
01862   }
01863   __pyx_t_8 = 0;
01864   __pyx_v_order = ((PyArrayObject *)__pyx_t_5);
01865   __pyx_t_5 = 0;
01866 
01867   /* "gpu_nms.pyx":28
01868  *         order = scores.argsort()[::-1].astype(np.int32)
01869  *     cdef np.ndarray[np.float32_t, ndim=2] \
01870  *         sorted_dets = dets[order, :]             # <<<<<<<<<<<<<<
01871  *     _nms(&keep[0], &num_out, &sorted_dets[0, 0], boxes_num, boxes_dim, thresh, device_id)
01872  *     keep = keep[:num_out]
01873  */
01874   __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __pyx_L1_error)
01875   __Pyx_GOTREF(__pyx_t_5);
01876   __Pyx_INCREF(((PyObject *)__pyx_v_order));
01877   __Pyx_GIVEREF(((PyObject *)__pyx_v_order));
01878   PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_order));
01879   __Pyx_INCREF(__pyx_slice__4);
01880   __Pyx_GIVEREF(__pyx_slice__4);
01881   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_slice__4);
01882   __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_dets), __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
01883   __Pyx_GOTREF(__pyx_t_1);
01884   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
01885   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 28, __pyx_L1_error)
01886   __pyx_t_9 = ((PyArrayObject *)__pyx_t_1);
01887   {
01888     __Pyx_BufFmt_StackElem __pyx_stack[1];
01889     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
01890       __pyx_v_sorted_dets = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer.buf = NULL;
01891       __PYX_ERR(0, 27, __pyx_L1_error)
01892     } else {__pyx_pybuffernd_sorted_dets.diminfo[0].strides = __pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sorted_dets.diminfo[0].shape = __pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sorted_dets.diminfo[1].strides = __pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sorted_dets.diminfo[1].shape = __pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer.shape[1];
01893     }
01894   }
01895   __pyx_t_9 = 0;
01896   __pyx_v_sorted_dets = ((PyArrayObject *)__pyx_t_1);
01897   __pyx_t_1 = 0;
01898 
01899   /* "gpu_nms.pyx":29
01900  *     cdef np.ndarray[np.float32_t, ndim=2] \
01901  *         sorted_dets = dets[order, :]
01902  *     _nms(&keep[0], &num_out, &sorted_dets[0, 0], boxes_num, boxes_dim, thresh, device_id)             # <<<<<<<<<<<<<<
01903  *     keep = keep[:num_out]
01904  *     return list(order[keep])
01905  */
01906   __pyx_t_10 = 0;
01907   __pyx_t_11 = -1;
01908   if (__pyx_t_10 < 0) {
01909     __pyx_t_10 += __pyx_pybuffernd_keep.diminfo[0].shape;
01910     if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
01911   } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_keep.diminfo[0].shape)) __pyx_t_11 = 0;
01912   if (unlikely(__pyx_t_11 != -1)) {
01913     __Pyx_RaiseBufferIndexError(__pyx_t_11);
01914     __PYX_ERR(0, 29, __pyx_L1_error)
01915   }
01916   __pyx_t_12 = 0;
01917   __pyx_t_13 = 0;
01918   __pyx_t_11 = -1;
01919   if (__pyx_t_12 < 0) {
01920     __pyx_t_12 += __pyx_pybuffernd_sorted_dets.diminfo[0].shape;
01921     if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
01922   } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_sorted_dets.diminfo[0].shape)) __pyx_t_11 = 0;
01923   if (__pyx_t_13 < 0) {
01924     __pyx_t_13 += __pyx_pybuffernd_sorted_dets.diminfo[1].shape;
01925     if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
01926   } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_sorted_dets.diminfo[1].shape)) __pyx_t_11 = 1;
01927   if (unlikely(__pyx_t_11 != -1)) {
01928     __Pyx_RaiseBufferIndexError(__pyx_t_11);
01929     __PYX_ERR(0, 29, __pyx_L1_error)
01930   }
01931   __pyx_t_14 = __pyx_PyFloat_AsFloat(__pyx_v_thresh); if (unlikely((__pyx_t_14 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L1_error)
01932   _nms((&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_keep.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_keep.diminfo[0].strides))), (&__pyx_v_num_out), (&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_sorted_dets.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_sorted_dets.diminfo[1].strides))), __pyx_v_boxes_num, __pyx_v_boxes_dim, __pyx_t_14, __pyx_v_device_id);
01933 
01934   /* "gpu_nms.pyx":30
01935  *         sorted_dets = dets[order, :]
01936  *     _nms(&keep[0], &num_out, &sorted_dets[0, 0], boxes_num, boxes_dim, thresh, device_id)
01937  *     keep = keep[:num_out]             # <<<<<<<<<<<<<<
01938  *     return list(order[keep])
01939  */
01940   __pyx_t_1 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_keep), 0, __pyx_v_num_out, NULL, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
01941   __Pyx_GOTREF(__pyx_t_1);
01942   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 30, __pyx_L1_error)
01943   __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
01944   {
01945     __Pyx_BufFmt_StackElem __pyx_stack[1];
01946     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_keep.rcbuffer->pybuffer);
01947     __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_keep.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
01948     if (unlikely(__pyx_t_11 < 0)) {
01949       PyErr_Fetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
01950       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_keep.rcbuffer->pybuffer, (PyObject*)__pyx_v_keep, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
01951         Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17);
01952         __Pyx_RaiseBufferFallbackError();
01953       } else {
01954         PyErr_Restore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
01955       }
01956     }
01957     __pyx_pybuffernd_keep.diminfo[0].strides = __pyx_pybuffernd_keep.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_keep.diminfo[0].shape = __pyx_pybuffernd_keep.rcbuffer->pybuffer.shape[0];
01958     if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 30, __pyx_L1_error)
01959   }
01960   __pyx_t_6 = 0;
01961   __Pyx_DECREF_SET(__pyx_v_keep, ((PyArrayObject *)__pyx_t_1));
01962   __pyx_t_1 = 0;
01963 
01964   /* "gpu_nms.pyx":31
01965  *     _nms(&keep[0], &num_out, &sorted_dets[0, 0], boxes_num, boxes_dim, thresh, device_id)
01966  *     keep = keep[:num_out]
01967  *     return list(order[keep])             # <<<<<<<<<<<<<<
01968  */
01969   __Pyx_XDECREF(__pyx_r);
01970   __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_order), ((PyObject *)__pyx_v_keep)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
01971   __Pyx_GOTREF(__pyx_t_1);
01972   __pyx_t_5 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error)
01973   __Pyx_GOTREF(__pyx_t_5);
01974   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
01975   __pyx_r = __pyx_t_5;
01976   __pyx_t_5 = 0;
01977   goto __pyx_L0;
01978 
01979   /* "gpu_nms.pyx":16
01980  *     void _nms(np.int32_t*, int*, np.float32_t*, int, int, float, int)
01981  * 
01982  * def gpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh,             # <<<<<<<<<<<<<<
01983  *             np.int32_t device_id=0):
01984  *     cdef int boxes_num = dets.shape[0]
01985  */
01986 
01987   /* function exit code */
01988   __pyx_L1_error:;
01989   __Pyx_XDECREF(__pyx_t_1);
01990   __Pyx_XDECREF(__pyx_t_2);
01991   __Pyx_XDECREF(__pyx_t_3);
01992   __Pyx_XDECREF(__pyx_t_4);
01993   __Pyx_XDECREF(__pyx_t_5);
01994   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
01995     __Pyx_PyThreadState_declare
01996     __Pyx_PyThreadState_assign
01997     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
01998     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dets.rcbuffer->pybuffer);
01999     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_keep.rcbuffer->pybuffer);
02000     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_order.rcbuffer->pybuffer);
02001     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scores.rcbuffer->pybuffer);
02002     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer);
02003   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
02004   __Pyx_AddTraceback("gpu_nms.gpu_nms", __pyx_clineno, __pyx_lineno, __pyx_filename);
02005   __pyx_r = NULL;
02006   goto __pyx_L2;
02007   __pyx_L0:;
02008   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dets.rcbuffer->pybuffer);
02009   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_keep.rcbuffer->pybuffer);
02010   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_order.rcbuffer->pybuffer);
02011   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scores.rcbuffer->pybuffer);
02012   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorted_dets.rcbuffer->pybuffer);
02013   __pyx_L2:;
02014   __Pyx_XDECREF((PyObject *)__pyx_v_keep);
02015   __Pyx_XDECREF((PyObject *)__pyx_v_scores);
02016   __Pyx_XDECREF((PyObject *)__pyx_v_order);
02017   __Pyx_XDECREF((PyObject *)__pyx_v_sorted_dets);
02018   __Pyx_XGIVEREF(__pyx_r);
02019   __Pyx_RefNannyFinishContext();
02020   return __pyx_r;
02021 }
02022 
02023 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":197
02024  *         # experimental exception made for __getbuffer__ and __releasebuffer__
02025  *         # -- the details of this may change.
02026  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
02027  *             # This implementation of getbuffer is geared towards Cython
02028  *             # requirements, and does not yet fullfill the PEP.
02029  */
02030 
02031 /* Python wrapper */
02032 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
02033 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
02034   int __pyx_r;
02035   __Pyx_RefNannyDeclarations
02036   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
02037   __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
02038 
02039   /* function exit code */
02040   __Pyx_RefNannyFinishContext();
02041   return __pyx_r;
02042 }
02043 
02044 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
02045   int __pyx_v_copy_shape;
02046   int __pyx_v_i;
02047   int __pyx_v_ndim;
02048   int __pyx_v_endian_detector;
02049   int __pyx_v_little_endian;
02050   int __pyx_v_t;
02051   char *__pyx_v_f;
02052   PyArray_Descr *__pyx_v_descr = 0;
02053   int __pyx_v_offset;
02054   int __pyx_v_hasfields;
02055   int __pyx_r;
02056   __Pyx_RefNannyDeclarations
02057   int __pyx_t_1;
02058   int __pyx_t_2;
02059   PyObject *__pyx_t_3 = NULL;
02060   int __pyx_t_4;
02061   int __pyx_t_5;
02062   PyObject *__pyx_t_6 = NULL;
02063   char *__pyx_t_7;
02064   __Pyx_RefNannySetupContext("__getbuffer__", 0);
02065   if (__pyx_v_info != NULL) {
02066     __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
02067     __Pyx_GIVEREF(__pyx_v_info->obj);
02068   }
02069 
02070   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":203
02071  *             # of flags
02072  * 
02073  *             if info == NULL: return             # <<<<<<<<<<<<<<
02074  * 
02075  *             cdef int copy_shape, i, ndim
02076  */
02077   __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
02078   if (__pyx_t_1) {
02079     __pyx_r = 0;
02080     goto __pyx_L0;
02081   }
02082 
02083   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":206
02084  * 
02085  *             cdef int copy_shape, i, ndim
02086  *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
02087  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
02088  * 
02089  */
02090   __pyx_v_endian_detector = 1;
02091 
02092   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":207
02093  *             cdef int copy_shape, i, ndim
02094  *             cdef int endian_detector = 1
02095  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
02096  * 
02097  *             ndim = PyArray_NDIM(self)
02098  */
02099   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
02100 
02101   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":209
02102  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
02103  * 
02104  *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
02105  * 
02106  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
02107  */
02108   __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
02109 
02110   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":211
02111  *             ndim = PyArray_NDIM(self)
02112  * 
02113  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
02114  *                 copy_shape = 1
02115  *             else:
02116  */
02117   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
02118   if (__pyx_t_1) {
02119 
02120     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":212
02121  * 
02122  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
02123  *                 copy_shape = 1             # <<<<<<<<<<<<<<
02124  *             else:
02125  *                 copy_shape = 0
02126  */
02127     __pyx_v_copy_shape = 1;
02128 
02129     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":211
02130  *             ndim = PyArray_NDIM(self)
02131  * 
02132  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
02133  *                 copy_shape = 1
02134  *             else:
02135  */
02136     goto __pyx_L4;
02137   }
02138 
02139   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":214
02140  *                 copy_shape = 1
02141  *             else:
02142  *                 copy_shape = 0             # <<<<<<<<<<<<<<
02143  * 
02144  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
02145  */
02146   /*else*/ {
02147     __pyx_v_copy_shape = 0;
02148   }
02149   __pyx_L4:;
02150 
02151   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216
02152  *                 copy_shape = 0
02153  * 
02154  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
02155  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
02156  *                 raise ValueError(u"ndarray is not C contiguous")
02157  */
02158   __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
02159   if (__pyx_t_2) {
02160   } else {
02161     __pyx_t_1 = __pyx_t_2;
02162     goto __pyx_L6_bool_binop_done;
02163   }
02164 
02165   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":217
02166  * 
02167  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
02168  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
02169  *                 raise ValueError(u"ndarray is not C contiguous")
02170  * 
02171  */
02172   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
02173   __pyx_t_1 = __pyx_t_2;
02174   __pyx_L6_bool_binop_done:;
02175 
02176   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216
02177  *                 copy_shape = 0
02178  * 
02179  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
02180  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
02181  *                 raise ValueError(u"ndarray is not C contiguous")
02182  */
02183   if (__pyx_t_1) {
02184 
02185     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218
02186  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
02187  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
02188  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
02189  * 
02190  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
02191  */
02192     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __pyx_L1_error)
02193     __Pyx_GOTREF(__pyx_t_3);
02194     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
02195     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
02196     __PYX_ERR(1, 218, __pyx_L1_error)
02197 
02198     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216
02199  *                 copy_shape = 0
02200  * 
02201  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
02202  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
02203  *                 raise ValueError(u"ndarray is not C contiguous")
02204  */
02205   }
02206 
02207   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220
02208  *                 raise ValueError(u"ndarray is not C contiguous")
02209  * 
02210  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
02211  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
02212  *                 raise ValueError(u"ndarray is not Fortran contiguous")
02213  */
02214   __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
02215   if (__pyx_t_2) {
02216   } else {
02217     __pyx_t_1 = __pyx_t_2;
02218     goto __pyx_L9_bool_binop_done;
02219   }
02220 
02221   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":221
02222  * 
02223  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
02224  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
02225  *                 raise ValueError(u"ndarray is not Fortran contiguous")
02226  * 
02227  */
02228   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
02229   __pyx_t_1 = __pyx_t_2;
02230   __pyx_L9_bool_binop_done:;
02231 
02232   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220
02233  *                 raise ValueError(u"ndarray is not C contiguous")
02234  * 
02235  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
02236  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
02237  *                 raise ValueError(u"ndarray is not Fortran contiguous")
02238  */
02239   if (__pyx_t_1) {
02240 
02241     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222
02242  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
02243  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
02244  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
02245  * 
02246  *             info.buf = PyArray_DATA(self)
02247  */
02248     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 222, __pyx_L1_error)
02249     __Pyx_GOTREF(__pyx_t_3);
02250     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
02251     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
02252     __PYX_ERR(1, 222, __pyx_L1_error)
02253 
02254     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220
02255  *                 raise ValueError(u"ndarray is not C contiguous")
02256  * 
02257  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
02258  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
02259  *                 raise ValueError(u"ndarray is not Fortran contiguous")
02260  */
02261   }
02262 
02263   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":224
02264  *                 raise ValueError(u"ndarray is not Fortran contiguous")
02265  * 
02266  *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
02267  *             info.ndim = ndim
02268  *             if copy_shape:
02269  */
02270   __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
02271 
02272   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":225
02273  * 
02274  *             info.buf = PyArray_DATA(self)
02275  *             info.ndim = ndim             # <<<<<<<<<<<<<<
02276  *             if copy_shape:
02277  *                 # Allocate new buffer for strides and shape info.
02278  */
02279   __pyx_v_info->ndim = __pyx_v_ndim;
02280 
02281   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":226
02282  *             info.buf = PyArray_DATA(self)
02283  *             info.ndim = ndim
02284  *             if copy_shape:             # <<<<<<<<<<<<<<
02285  *                 # Allocate new buffer for strides and shape info.
02286  *                 # This is allocated as one block, strides first.
02287  */
02288   __pyx_t_1 = (__pyx_v_copy_shape != 0);
02289   if (__pyx_t_1) {
02290 
02291     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":229
02292  *                 # Allocate new buffer for strides and shape info.
02293  *                 # This is allocated as one block, strides first.
02294  *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)             # <<<<<<<<<<<<<<
02295  *                 info.shape = info.strides + ndim
02296  *                 for i in range(ndim):
02297  */
02298     __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
02299 
02300     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":230
02301  *                 # This is allocated as one block, strides first.
02302  *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
02303  *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
02304  *                 for i in range(ndim):
02305  *                     info.strides[i] = PyArray_STRIDES(self)[i]
02306  */
02307     __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
02308 
02309     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":231
02310  *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
02311  *                 info.shape = info.strides + ndim
02312  *                 for i in range(ndim):             # <<<<<<<<<<<<<<
02313  *                     info.strides[i] = PyArray_STRIDES(self)[i]
02314  *                     info.shape[i] = PyArray_DIMS(self)[i]
02315  */
02316     __pyx_t_4 = __pyx_v_ndim;
02317     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
02318       __pyx_v_i = __pyx_t_5;
02319 
02320       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":232
02321  *                 info.shape = info.strides + ndim
02322  *                 for i in range(ndim):
02323  *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
02324  *                     info.shape[i] = PyArray_DIMS(self)[i]
02325  *             else:
02326  */
02327       (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
02328 
02329       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":233
02330  *                 for i in range(ndim):
02331  *                     info.strides[i] = PyArray_STRIDES(self)[i]
02332  *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
02333  *             else:
02334  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
02335  */
02336       (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
02337     }
02338 
02339     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":226
02340  *             info.buf = PyArray_DATA(self)
02341  *             info.ndim = ndim
02342  *             if copy_shape:             # <<<<<<<<<<<<<<
02343  *                 # Allocate new buffer for strides and shape info.
02344  *                 # This is allocated as one block, strides first.
02345  */
02346     goto __pyx_L11;
02347   }
02348 
02349   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":235
02350  *                     info.shape[i] = PyArray_DIMS(self)[i]
02351  *             else:
02352  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
02353  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
02354  *             info.suboffsets = NULL
02355  */
02356   /*else*/ {
02357     __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
02358 
02359     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":236
02360  *             else:
02361  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
02362  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
02363  *             info.suboffsets = NULL
02364  *             info.itemsize = PyArray_ITEMSIZE(self)
02365  */
02366     __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
02367   }
02368   __pyx_L11:;
02369 
02370   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":237
02371  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
02372  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
02373  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
02374  *             info.itemsize = PyArray_ITEMSIZE(self)
02375  *             info.readonly = not PyArray_ISWRITEABLE(self)
02376  */
02377   __pyx_v_info->suboffsets = NULL;
02378 
02379   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":238
02380  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
02381  *             info.suboffsets = NULL
02382  *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
02383  *             info.readonly = not PyArray_ISWRITEABLE(self)
02384  * 
02385  */
02386   __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
02387 
02388   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":239
02389  *             info.suboffsets = NULL
02390  *             info.itemsize = PyArray_ITEMSIZE(self)
02391  *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
02392  * 
02393  *             cdef int t
02394  */
02395   __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
02396 
02397   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":242
02398  * 
02399  *             cdef int t
02400  *             cdef char* f = NULL             # <<<<<<<<<<<<<<
02401  *             cdef dtype descr = self.descr
02402  *             cdef int offset
02403  */
02404   __pyx_v_f = NULL;
02405 
02406   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":243
02407  *             cdef int t
02408  *             cdef char* f = NULL
02409  *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
02410  *             cdef int offset
02411  * 
02412  */
02413   __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
02414   __Pyx_INCREF(__pyx_t_3);
02415   __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
02416   __pyx_t_3 = 0;
02417 
02418   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":246
02419  *             cdef int offset
02420  * 
02421  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
02422  * 
02423  *             if not hasfields and not copy_shape:
02424  */
02425   __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
02426 
02427   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":248
02428  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
02429  * 
02430  *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
02431  *                 # do not call releasebuffer
02432  *                 info.obj = None
02433  */
02434   __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
02435   if (__pyx_t_2) {
02436   } else {
02437     __pyx_t_1 = __pyx_t_2;
02438     goto __pyx_L15_bool_binop_done;
02439   }
02440   __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
02441   __pyx_t_1 = __pyx_t_2;
02442   __pyx_L15_bool_binop_done:;
02443   if (__pyx_t_1) {
02444 
02445     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":250
02446  *             if not hasfields and not copy_shape:
02447  *                 # do not call releasebuffer
02448  *                 info.obj = None             # <<<<<<<<<<<<<<
02449  *             else:
02450  *                 # need to call releasebuffer
02451  */
02452     __Pyx_INCREF(Py_None);
02453     __Pyx_GIVEREF(Py_None);
02454     __Pyx_GOTREF(__pyx_v_info->obj);
02455     __Pyx_DECREF(__pyx_v_info->obj);
02456     __pyx_v_info->obj = Py_None;
02457 
02458     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":248
02459  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
02460  * 
02461  *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
02462  *                 # do not call releasebuffer
02463  *                 info.obj = None
02464  */
02465     goto __pyx_L14;
02466   }
02467 
02468   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":253
02469  *             else:
02470  *                 # need to call releasebuffer
02471  *                 info.obj = self             # <<<<<<<<<<<<<<
02472  * 
02473  *             if not hasfields:
02474  */
02475   /*else*/ {
02476     __Pyx_INCREF(((PyObject *)__pyx_v_self));
02477     __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
02478     __Pyx_GOTREF(__pyx_v_info->obj);
02479     __Pyx_DECREF(__pyx_v_info->obj);
02480     __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
02481   }
02482   __pyx_L14:;
02483 
02484   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":255
02485  *                 info.obj = self
02486  * 
02487  *             if not hasfields:             # <<<<<<<<<<<<<<
02488  *                 t = descr.type_num
02489  *                 if ((descr.byteorder == c'>' and little_endian) or
02490  */
02491   __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
02492   if (__pyx_t_1) {
02493 
02494     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":256
02495  * 
02496  *             if not hasfields:
02497  *                 t = descr.type_num             # <<<<<<<<<<<<<<
02498  *                 if ((descr.byteorder == c'>' and little_endian) or
02499  *                     (descr.byteorder == c'<' and not little_endian)):
02500  */
02501     __pyx_t_4 = __pyx_v_descr->type_num;
02502     __pyx_v_t = __pyx_t_4;
02503 
02504     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257
02505  *             if not hasfields:
02506  *                 t = descr.type_num
02507  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
02508  *                     (descr.byteorder == c'<' and not little_endian)):
02509  *                     raise ValueError(u"Non-native byte order not supported")
02510  */
02511     __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
02512     if (!__pyx_t_2) {
02513       goto __pyx_L20_next_or;
02514     } else {
02515     }
02516     __pyx_t_2 = (__pyx_v_little_endian != 0);
02517     if (!__pyx_t_2) {
02518     } else {
02519       __pyx_t_1 = __pyx_t_2;
02520       goto __pyx_L19_bool_binop_done;
02521     }
02522     __pyx_L20_next_or:;
02523 
02524     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":258
02525  *                 t = descr.type_num
02526  *                 if ((descr.byteorder == c'>' and little_endian) or
02527  *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
02528  *                     raise ValueError(u"Non-native byte order not supported")
02529  *                 if   t == NPY_BYTE:        f = "b"
02530  */
02531     __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
02532     if (__pyx_t_2) {
02533     } else {
02534       __pyx_t_1 = __pyx_t_2;
02535       goto __pyx_L19_bool_binop_done;
02536     }
02537     __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
02538     __pyx_t_1 = __pyx_t_2;
02539     __pyx_L19_bool_binop_done:;
02540 
02541     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257
02542  *             if not hasfields:
02543  *                 t = descr.type_num
02544  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
02545  *                     (descr.byteorder == c'<' and not little_endian)):
02546  *                     raise ValueError(u"Non-native byte order not supported")
02547  */
02548     if (__pyx_t_1) {
02549 
02550       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":259
02551  *                 if ((descr.byteorder == c'>' and little_endian) or
02552  *                     (descr.byteorder == c'<' and not little_endian)):
02553  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
02554  *                 if   t == NPY_BYTE:        f = "b"
02555  *                 elif t == NPY_UBYTE:       f = "B"
02556  */
02557       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 259, __pyx_L1_error)
02558       __Pyx_GOTREF(__pyx_t_3);
02559       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
02560       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
02561       __PYX_ERR(1, 259, __pyx_L1_error)
02562 
02563       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257
02564  *             if not hasfields:
02565  *                 t = descr.type_num
02566  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
02567  *                     (descr.byteorder == c'<' and not little_endian)):
02568  *                     raise ValueError(u"Non-native byte order not supported")
02569  */
02570     }
02571 
02572     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":260
02573  *                     (descr.byteorder == c'<' and not little_endian)):
02574  *                     raise ValueError(u"Non-native byte order not supported")
02575  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
02576  *                 elif t == NPY_UBYTE:       f = "B"
02577  *                 elif t == NPY_SHORT:       f = "h"
02578  */
02579     switch (__pyx_v_t) {
02580       case NPY_BYTE:
02581       __pyx_v_f = ((char *)"b");
02582       break;
02583 
02584       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":261
02585  *                     raise ValueError(u"Non-native byte order not supported")
02586  *                 if   t == NPY_BYTE:        f = "b"
02587  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
02588  *                 elif t == NPY_SHORT:       f = "h"
02589  *                 elif t == NPY_USHORT:      f = "H"
02590  */
02591       case NPY_UBYTE:
02592       __pyx_v_f = ((char *)"B");
02593       break;
02594 
02595       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":262
02596  *                 if   t == NPY_BYTE:        f = "b"
02597  *                 elif t == NPY_UBYTE:       f = "B"
02598  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
02599  *                 elif t == NPY_USHORT:      f = "H"
02600  *                 elif t == NPY_INT:         f = "i"
02601  */
02602       case NPY_SHORT:
02603       __pyx_v_f = ((char *)"h");
02604       break;
02605 
02606       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":263
02607  *                 elif t == NPY_UBYTE:       f = "B"
02608  *                 elif t == NPY_SHORT:       f = "h"
02609  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
02610  *                 elif t == NPY_INT:         f = "i"
02611  *                 elif t == NPY_UINT:        f = "I"
02612  */
02613       case NPY_USHORT:
02614       __pyx_v_f = ((char *)"H");
02615       break;
02616 
02617       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":264
02618  *                 elif t == NPY_SHORT:       f = "h"
02619  *                 elif t == NPY_USHORT:      f = "H"
02620  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
02621  *                 elif t == NPY_UINT:        f = "I"
02622  *                 elif t == NPY_LONG:        f = "l"
02623  */
02624       case NPY_INT:
02625       __pyx_v_f = ((char *)"i");
02626       break;
02627 
02628       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":265
02629  *                 elif t == NPY_USHORT:      f = "H"
02630  *                 elif t == NPY_INT:         f = "i"
02631  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
02632  *                 elif t == NPY_LONG:        f = "l"
02633  *                 elif t == NPY_ULONG:       f = "L"
02634  */
02635       case NPY_UINT:
02636       __pyx_v_f = ((char *)"I");
02637       break;
02638 
02639       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":266
02640  *                 elif t == NPY_INT:         f = "i"
02641  *                 elif t == NPY_UINT:        f = "I"
02642  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
02643  *                 elif t == NPY_ULONG:       f = "L"
02644  *                 elif t == NPY_LONGLONG:    f = "q"
02645  */
02646       case NPY_LONG:
02647       __pyx_v_f = ((char *)"l");
02648       break;
02649 
02650       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":267
02651  *                 elif t == NPY_UINT:        f = "I"
02652  *                 elif t == NPY_LONG:        f = "l"
02653  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
02654  *                 elif t == NPY_LONGLONG:    f = "q"
02655  *                 elif t == NPY_ULONGLONG:   f = "Q"
02656  */
02657       case NPY_ULONG:
02658       __pyx_v_f = ((char *)"L");
02659       break;
02660 
02661       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":268
02662  *                 elif t == NPY_LONG:        f = "l"
02663  *                 elif t == NPY_ULONG:       f = "L"
02664  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
02665  *                 elif t == NPY_ULONGLONG:   f = "Q"
02666  *                 elif t == NPY_FLOAT:       f = "f"
02667  */
02668       case NPY_LONGLONG:
02669       __pyx_v_f = ((char *)"q");
02670       break;
02671 
02672       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":269
02673  *                 elif t == NPY_ULONG:       f = "L"
02674  *                 elif t == NPY_LONGLONG:    f = "q"
02675  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
02676  *                 elif t == NPY_FLOAT:       f = "f"
02677  *                 elif t == NPY_DOUBLE:      f = "d"
02678  */
02679       case NPY_ULONGLONG:
02680       __pyx_v_f = ((char *)"Q");
02681       break;
02682 
02683       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":270
02684  *                 elif t == NPY_LONGLONG:    f = "q"
02685  *                 elif t == NPY_ULONGLONG:   f = "Q"
02686  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
02687  *                 elif t == NPY_DOUBLE:      f = "d"
02688  *                 elif t == NPY_LONGDOUBLE:  f = "g"
02689  */
02690       case NPY_FLOAT:
02691       __pyx_v_f = ((char *)"f");
02692       break;
02693 
02694       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":271
02695  *                 elif t == NPY_ULONGLONG:   f = "Q"
02696  *                 elif t == NPY_FLOAT:       f = "f"
02697  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
02698  *                 elif t == NPY_LONGDOUBLE:  f = "g"
02699  *                 elif t == NPY_CFLOAT:      f = "Zf"
02700  */
02701       case NPY_DOUBLE:
02702       __pyx_v_f = ((char *)"d");
02703       break;
02704 
02705       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":272
02706  *                 elif t == NPY_FLOAT:       f = "f"
02707  *                 elif t == NPY_DOUBLE:      f = "d"
02708  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
02709  *                 elif t == NPY_CFLOAT:      f = "Zf"
02710  *                 elif t == NPY_CDOUBLE:     f = "Zd"
02711  */
02712       case NPY_LONGDOUBLE:
02713       __pyx_v_f = ((char *)"g");
02714       break;
02715 
02716       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":273
02717  *                 elif t == NPY_DOUBLE:      f = "d"
02718  *                 elif t == NPY_LONGDOUBLE:  f = "g"
02719  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
02720  *                 elif t == NPY_CDOUBLE:     f = "Zd"
02721  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
02722  */
02723       case NPY_CFLOAT:
02724       __pyx_v_f = ((char *)"Zf");
02725       break;
02726 
02727       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":274
02728  *                 elif t == NPY_LONGDOUBLE:  f = "g"
02729  *                 elif t == NPY_CFLOAT:      f = "Zf"
02730  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
02731  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
02732  *                 elif t == NPY_OBJECT:      f = "O"
02733  */
02734       case NPY_CDOUBLE:
02735       __pyx_v_f = ((char *)"Zd");
02736       break;
02737 
02738       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":275
02739  *                 elif t == NPY_CFLOAT:      f = "Zf"
02740  *                 elif t == NPY_CDOUBLE:     f = "Zd"
02741  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
02742  *                 elif t == NPY_OBJECT:      f = "O"
02743  *                 else:
02744  */
02745       case NPY_CLONGDOUBLE:
02746       __pyx_v_f = ((char *)"Zg");
02747       break;
02748 
02749       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":276
02750  *                 elif t == NPY_CDOUBLE:     f = "Zd"
02751  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
02752  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
02753  *                 else:
02754  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
02755  */
02756       case NPY_OBJECT:
02757       __pyx_v_f = ((char *)"O");
02758       break;
02759       default:
02760 
02761       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":278
02762  *                 elif t == NPY_OBJECT:      f = "O"
02763  *                 else:
02764  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
02765  *                 info.format = f
02766  *                 return
02767  */
02768       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error)
02769       __Pyx_GOTREF(__pyx_t_3);
02770       __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)
02771       __Pyx_GOTREF(__pyx_t_6);
02772       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
02773       __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error)
02774       __Pyx_GOTREF(__pyx_t_3);
02775       __Pyx_GIVEREF(__pyx_t_6);
02776       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
02777       __pyx_t_6 = 0;
02778       __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)
02779       __Pyx_GOTREF(__pyx_t_6);
02780       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
02781       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
02782       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
02783       __PYX_ERR(1, 278, __pyx_L1_error)
02784       break;
02785     }
02786 
02787     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":279
02788  *                 else:
02789  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
02790  *                 info.format = f             # <<<<<<<<<<<<<<
02791  *                 return
02792  *             else:
02793  */
02794     __pyx_v_info->format = __pyx_v_f;
02795 
02796     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":280
02797  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
02798  *                 info.format = f
02799  *                 return             # <<<<<<<<<<<<<<
02800  *             else:
02801  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
02802  */
02803     __pyx_r = 0;
02804     goto __pyx_L0;
02805 
02806     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":255
02807  *                 info.obj = self
02808  * 
02809  *             if not hasfields:             # <<<<<<<<<<<<<<
02810  *                 t = descr.type_num
02811  *                 if ((descr.byteorder == c'>' and little_endian) or
02812  */
02813   }
02814 
02815   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":282
02816  *                 return
02817  *             else:
02818  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
02819  *                 info.format[0] = c'^' # Native data types, manual alignment
02820  *                 offset = 0
02821  */
02822   /*else*/ {
02823     __pyx_v_info->format = ((char *)malloc(0xFF));
02824 
02825     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":283
02826  *             else:
02827  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
02828  *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
02829  *                 offset = 0
02830  *                 f = _util_dtypestring(descr, info.format + 1,
02831  */
02832     (__pyx_v_info->format[0]) = '^';
02833 
02834     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":284
02835  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
02836  *                 info.format[0] = c'^' # Native data types, manual alignment
02837  *                 offset = 0             # <<<<<<<<<<<<<<
02838  *                 f = _util_dtypestring(descr, info.format + 1,
02839  *                                       info.format + _buffer_format_string_len,
02840  */
02841     __pyx_v_offset = 0;
02842 
02843     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":285
02844  *                 info.format[0] = c'^' # Native data types, manual alignment
02845  *                 offset = 0
02846  *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
02847  *                                       info.format + _buffer_format_string_len,
02848  *                                       &offset)
02849  */
02850     __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)
02851     __pyx_v_f = __pyx_t_7;
02852 
02853     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":288
02854  *                                       info.format + _buffer_format_string_len,
02855  *                                       &offset)
02856  *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
02857  * 
02858  *         def __releasebuffer__(ndarray self, Py_buffer* info):
02859  */
02860     (__pyx_v_f[0]) = '\x00';
02861   }
02862 
02863   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":197
02864  *         # experimental exception made for __getbuffer__ and __releasebuffer__
02865  *         # -- the details of this may change.
02866  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
02867  *             # This implementation of getbuffer is geared towards Cython
02868  *             # requirements, and does not yet fullfill the PEP.
02869  */
02870 
02871   /* function exit code */
02872   __pyx_r = 0;
02873   goto __pyx_L0;
02874   __pyx_L1_error:;
02875   __Pyx_XDECREF(__pyx_t_3);
02876   __Pyx_XDECREF(__pyx_t_6);
02877   __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
02878   __pyx_r = -1;
02879   if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
02880     __Pyx_GOTREF(__pyx_v_info->obj);
02881     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
02882   }
02883   goto __pyx_L2;
02884   __pyx_L0:;
02885   if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
02886     __Pyx_GOTREF(Py_None);
02887     __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
02888   }
02889   __pyx_L2:;
02890   __Pyx_XDECREF((PyObject *)__pyx_v_descr);
02891   __Pyx_RefNannyFinishContext();
02892   return __pyx_r;
02893 }
02894 
02895 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":290
02896  *                 f[0] = c'\0' # Terminate format string
02897  * 
02898  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
02899  *             if PyArray_HASFIELDS(self):
02900  *                 stdlib.free(info.format)
02901  */
02902 
02903 /* Python wrapper */
02904 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
02905 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
02906   __Pyx_RefNannyDeclarations
02907   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
02908   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
02909 
02910   /* function exit code */
02911   __Pyx_RefNannyFinishContext();
02912 }
02913 
02914 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
02915   __Pyx_RefNannyDeclarations
02916   int __pyx_t_1;
02917   __Pyx_RefNannySetupContext("__releasebuffer__", 0);
02918 
02919   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291
02920  * 
02921  *         def __releasebuffer__(ndarray self, Py_buffer* info):
02922  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
02923  *                 stdlib.free(info.format)
02924  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
02925  */
02926   __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
02927   if (__pyx_t_1) {
02928 
02929     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":292
02930  *         def __releasebuffer__(ndarray self, Py_buffer* info):
02931  *             if PyArray_HASFIELDS(self):
02932  *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
02933  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
02934  *                 stdlib.free(info.strides)
02935  */
02936     free(__pyx_v_info->format);
02937 
02938     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291
02939  * 
02940  *         def __releasebuffer__(ndarray self, Py_buffer* info):
02941  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
02942  *                 stdlib.free(info.format)
02943  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
02944  */
02945   }
02946 
02947   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":293
02948  *             if PyArray_HASFIELDS(self):
02949  *                 stdlib.free(info.format)
02950  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
02951  *                 stdlib.free(info.strides)
02952  *                 # info.shape was stored after info.strides in the same block
02953  */
02954   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
02955   if (__pyx_t_1) {
02956 
02957     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":294
02958  *                 stdlib.free(info.format)
02959  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
02960  *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
02961  *                 # info.shape was stored after info.strides in the same block
02962  * 
02963  */
02964     free(__pyx_v_info->strides);
02965 
02966     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":293
02967  *             if PyArray_HASFIELDS(self):
02968  *                 stdlib.free(info.format)
02969  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
02970  *                 stdlib.free(info.strides)
02971  *                 # info.shape was stored after info.strides in the same block
02972  */
02973   }
02974 
02975   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":290
02976  *                 f[0] = c'\0' # Terminate format string
02977  * 
02978  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
02979  *             if PyArray_HASFIELDS(self):
02980  *                 stdlib.free(info.format)
02981  */
02982 
02983   /* function exit code */
02984   __Pyx_RefNannyFinishContext();
02985 }
02986 
02987 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":770
02988  * ctypedef npy_cdouble     complex_t
02989  * 
02990  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
02991  *     return PyArray_MultiIterNew(1, <void*>a)
02992  * 
02993  */
02994 
02995 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
02996   PyObject *__pyx_r = NULL;
02997   __Pyx_RefNannyDeclarations
02998   PyObject *__pyx_t_1 = NULL;
02999   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
03000 
03001   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":771
03002  * 
03003  * cdef inline object PyArray_MultiIterNew1(a):
03004  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
03005  * 
03006  * cdef inline object PyArray_MultiIterNew2(a, b):
03007  */
03008   __Pyx_XDECREF(__pyx_r);
03009   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 771, __pyx_L1_error)
03010   __Pyx_GOTREF(__pyx_t_1);
03011   __pyx_r = __pyx_t_1;
03012   __pyx_t_1 = 0;
03013   goto __pyx_L0;
03014 
03015   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":770
03016  * ctypedef npy_cdouble     complex_t
03017  * 
03018  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
03019  *     return PyArray_MultiIterNew(1, <void*>a)
03020  * 
03021  */
03022 
03023   /* function exit code */
03024   __pyx_L1_error:;
03025   __Pyx_XDECREF(__pyx_t_1);
03026   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
03027   __pyx_r = 0;
03028   __pyx_L0:;
03029   __Pyx_XGIVEREF(__pyx_r);
03030   __Pyx_RefNannyFinishContext();
03031   return __pyx_r;
03032 }
03033 
03034 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":773
03035  *     return PyArray_MultiIterNew(1, <void*>a)
03036  * 
03037  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
03038  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
03039  * 
03040  */
03041 
03042 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
03043   PyObject *__pyx_r = NULL;
03044   __Pyx_RefNannyDeclarations
03045   PyObject *__pyx_t_1 = NULL;
03046   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
03047 
03048   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":774
03049  * 
03050  * cdef inline object PyArray_MultiIterNew2(a, b):
03051  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
03052  * 
03053  * cdef inline object PyArray_MultiIterNew3(a, b, c):
03054  */
03055   __Pyx_XDECREF(__pyx_r);
03056   __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)
03057   __Pyx_GOTREF(__pyx_t_1);
03058   __pyx_r = __pyx_t_1;
03059   __pyx_t_1 = 0;
03060   goto __pyx_L0;
03061 
03062   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":773
03063  *     return PyArray_MultiIterNew(1, <void*>a)
03064  * 
03065  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
03066  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
03067  * 
03068  */
03069 
03070   /* function exit code */
03071   __pyx_L1_error:;
03072   __Pyx_XDECREF(__pyx_t_1);
03073   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
03074   __pyx_r = 0;
03075   __pyx_L0:;
03076   __Pyx_XGIVEREF(__pyx_r);
03077   __Pyx_RefNannyFinishContext();
03078   return __pyx_r;
03079 }
03080 
03081 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":776
03082  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
03083  * 
03084  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
03085  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
03086  * 
03087  */
03088 
03089 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
03090   PyObject *__pyx_r = NULL;
03091   __Pyx_RefNannyDeclarations
03092   PyObject *__pyx_t_1 = NULL;
03093   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
03094 
03095   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":777
03096  * 
03097  * cdef inline object PyArray_MultiIterNew3(a, b, c):
03098  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
03099  * 
03100  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
03101  */
03102   __Pyx_XDECREF(__pyx_r);
03103   __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)
03104   __Pyx_GOTREF(__pyx_t_1);
03105   __pyx_r = __pyx_t_1;
03106   __pyx_t_1 = 0;
03107   goto __pyx_L0;
03108 
03109   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":776
03110  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
03111  * 
03112  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
03113  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
03114  * 
03115  */
03116 
03117   /* function exit code */
03118   __pyx_L1_error:;
03119   __Pyx_XDECREF(__pyx_t_1);
03120   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
03121   __pyx_r = 0;
03122   __pyx_L0:;
03123   __Pyx_XGIVEREF(__pyx_r);
03124   __Pyx_RefNannyFinishContext();
03125   return __pyx_r;
03126 }
03127 
03128 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":779
03129  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
03130  * 
03131  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
03132  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
03133  * 
03134  */
03135 
03136 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) {
03137   PyObject *__pyx_r = NULL;
03138   __Pyx_RefNannyDeclarations
03139   PyObject *__pyx_t_1 = NULL;
03140   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
03141 
03142   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":780
03143  * 
03144  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
03145  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
03146  * 
03147  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
03148  */
03149   __Pyx_XDECREF(__pyx_r);
03150   __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)
03151   __Pyx_GOTREF(__pyx_t_1);
03152   __pyx_r = __pyx_t_1;
03153   __pyx_t_1 = 0;
03154   goto __pyx_L0;
03155 
03156   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":779
03157  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
03158  * 
03159  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
03160  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
03161  * 
03162  */
03163 
03164   /* function exit code */
03165   __pyx_L1_error:;
03166   __Pyx_XDECREF(__pyx_t_1);
03167   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
03168   __pyx_r = 0;
03169   __pyx_L0:;
03170   __Pyx_XGIVEREF(__pyx_r);
03171   __Pyx_RefNannyFinishContext();
03172   return __pyx_r;
03173 }
03174 
03175 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":782
03176  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
03177  * 
03178  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
03179  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
03180  * 
03181  */
03182 
03183 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) {
03184   PyObject *__pyx_r = NULL;
03185   __Pyx_RefNannyDeclarations
03186   PyObject *__pyx_t_1 = NULL;
03187   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
03188 
03189   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":783
03190  * 
03191  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
03192  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
03193  * 
03194  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
03195  */
03196   __Pyx_XDECREF(__pyx_r);
03197   __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)
03198   __Pyx_GOTREF(__pyx_t_1);
03199   __pyx_r = __pyx_t_1;
03200   __pyx_t_1 = 0;
03201   goto __pyx_L0;
03202 
03203   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":782
03204  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
03205  * 
03206  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
03207  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
03208  * 
03209  */
03210 
03211   /* function exit code */
03212   __pyx_L1_error:;
03213   __Pyx_XDECREF(__pyx_t_1);
03214   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
03215   __pyx_r = 0;
03216   __pyx_L0:;
03217   __Pyx_XGIVEREF(__pyx_r);
03218   __Pyx_RefNannyFinishContext();
03219   return __pyx_r;
03220 }
03221 
03222 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":785
03223  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
03224  * 
03225  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
03226  *     # Recursive utility function used in __getbuffer__ to get format
03227  *     # string. The new location in the format string is returned.
03228  */
03229 
03230 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) {
03231   PyArray_Descr *__pyx_v_child = 0;
03232   int __pyx_v_endian_detector;
03233   int __pyx_v_little_endian;
03234   PyObject *__pyx_v_fields = 0;
03235   PyObject *__pyx_v_childname = NULL;
03236   PyObject *__pyx_v_new_offset = NULL;
03237   PyObject *__pyx_v_t = NULL;
03238   char *__pyx_r;
03239   __Pyx_RefNannyDeclarations
03240   PyObject *__pyx_t_1 = NULL;
03241   Py_ssize_t __pyx_t_2;
03242   PyObject *__pyx_t_3 = NULL;
03243   PyObject *__pyx_t_4 = NULL;
03244   int __pyx_t_5;
03245   int __pyx_t_6;
03246   int __pyx_t_7;
03247   long __pyx_t_8;
03248   char *__pyx_t_9;
03249   __Pyx_RefNannySetupContext("_util_dtypestring", 0);
03250 
03251   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":790
03252  * 
03253  *     cdef dtype child
03254  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
03255  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
03256  *     cdef tuple fields
03257  */
03258   __pyx_v_endian_detector = 1;
03259 
03260   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":791
03261  *     cdef dtype child
03262  *     cdef int endian_detector = 1
03263  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
03264  *     cdef tuple fields
03265  * 
03266  */
03267   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
03268 
03269   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":794
03270  *     cdef tuple fields
03271  * 
03272  *     for childname in descr.names:             # <<<<<<<<<<<<<<
03273  *         fields = descr.fields[childname]
03274  *         child, new_offset = fields
03275  */
03276   if (unlikely(__pyx_v_descr->names == Py_None)) {
03277     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
03278     __PYX_ERR(1, 794, __pyx_L1_error)
03279   }
03280   __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
03281   for (;;) {
03282     if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
03283     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
03284     __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)
03285     #else
03286     __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)
03287     __Pyx_GOTREF(__pyx_t_3);
03288     #endif
03289     __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
03290     __pyx_t_3 = 0;
03291 
03292     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":795
03293  * 
03294  *     for childname in descr.names:
03295  *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
03296  *         child, new_offset = fields
03297  * 
03298  */
03299     if (unlikely(__pyx_v_descr->fields == Py_None)) {
03300       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
03301       __PYX_ERR(1, 795, __pyx_L1_error)
03302     }
03303     __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)
03304     __Pyx_GOTREF(__pyx_t_3);
03305     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)
03306     __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
03307     __pyx_t_3 = 0;
03308 
03309     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":796
03310  *     for childname in descr.names:
03311  *         fields = descr.fields[childname]
03312  *         child, new_offset = fields             # <<<<<<<<<<<<<<
03313  * 
03314  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
03315  */
03316     if (likely(__pyx_v_fields != Py_None)) {
03317       PyObject* sequence = __pyx_v_fields;
03318       #if !CYTHON_COMPILING_IN_PYPY
03319       Py_ssize_t size = Py_SIZE(sequence);
03320       #else
03321       Py_ssize_t size = PySequence_Size(sequence);
03322       #endif
03323       if (unlikely(size != 2)) {
03324         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
03325         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
03326         __PYX_ERR(1, 796, __pyx_L1_error)
03327       }
03328       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
03329       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
03330       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
03331       __Pyx_INCREF(__pyx_t_3);
03332       __Pyx_INCREF(__pyx_t_4);
03333       #else
03334       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 796, __pyx_L1_error)
03335       __Pyx_GOTREF(__pyx_t_3);
03336       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 796, __pyx_L1_error)
03337       __Pyx_GOTREF(__pyx_t_4);
03338       #endif
03339     } else {
03340       __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 796, __pyx_L1_error)
03341     }
03342     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 796, __pyx_L1_error)
03343     __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
03344     __pyx_t_3 = 0;
03345     __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
03346     __pyx_t_4 = 0;
03347 
03348     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":798
03349  *         child, new_offset = fields
03350  * 
03351  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
03352  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
03353  * 
03354  */
03355     __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 798, __pyx_L1_error)
03356     __Pyx_GOTREF(__pyx_t_4);
03357     __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 798, __pyx_L1_error)
03358     __Pyx_GOTREF(__pyx_t_3);
03359     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03360     __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)
03361     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03362     __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
03363     if (__pyx_t_6) {
03364 
03365       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799
03366  * 
03367  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
03368  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
03369  * 
03370  *         if ((child.byteorder == c'>' and little_endian) or
03371  */
03372       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 799, __pyx_L1_error)
03373       __Pyx_GOTREF(__pyx_t_3);
03374       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
03375       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03376       __PYX_ERR(1, 799, __pyx_L1_error)
03377 
03378       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":798
03379  *         child, new_offset = fields
03380  * 
03381  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
03382  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
03383  * 
03384  */
03385     }
03386 
03387     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801
03388  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
03389  * 
03390  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
03391  *             (child.byteorder == c'<' and not little_endian)):
03392  *             raise ValueError(u"Non-native byte order not supported")
03393  */
03394     __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
03395     if (!__pyx_t_7) {
03396       goto __pyx_L8_next_or;
03397     } else {
03398     }
03399     __pyx_t_7 = (__pyx_v_little_endian != 0);
03400     if (!__pyx_t_7) {
03401     } else {
03402       __pyx_t_6 = __pyx_t_7;
03403       goto __pyx_L7_bool_binop_done;
03404     }
03405     __pyx_L8_next_or:;
03406 
03407     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":802
03408  * 
03409  *         if ((child.byteorder == c'>' and little_endian) or
03410  *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
03411  *             raise ValueError(u"Non-native byte order not supported")
03412  *             # One could encode it in the format string and have Cython
03413  */
03414     __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
03415     if (__pyx_t_7) {
03416     } else {
03417       __pyx_t_6 = __pyx_t_7;
03418       goto __pyx_L7_bool_binop_done;
03419     }
03420     __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
03421     __pyx_t_6 = __pyx_t_7;
03422     __pyx_L7_bool_binop_done:;
03423 
03424     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801
03425  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
03426  * 
03427  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
03428  *             (child.byteorder == c'<' and not little_endian)):
03429  *             raise ValueError(u"Non-native byte order not supported")
03430  */
03431     if (__pyx_t_6) {
03432 
03433       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803
03434  *         if ((child.byteorder == c'>' and little_endian) or
03435  *             (child.byteorder == c'<' and not little_endian)):
03436  *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
03437  *             # One could encode it in the format string and have Cython
03438  *             # complain instead, BUT: < and > in format strings also imply
03439  */
03440       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 803, __pyx_L1_error)
03441       __Pyx_GOTREF(__pyx_t_3);
03442       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
03443       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03444       __PYX_ERR(1, 803, __pyx_L1_error)
03445 
03446       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801
03447  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
03448  * 
03449  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
03450  *             (child.byteorder == c'<' and not little_endian)):
03451  *             raise ValueError(u"Non-native byte order not supported")
03452  */
03453     }
03454 
03455     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":813
03456  * 
03457  *         # Output padding bytes
03458  *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
03459  *             f[0] = 120 # "x"; pad byte
03460  *             f += 1
03461  */
03462     while (1) {
03463       __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 813, __pyx_L1_error)
03464       __Pyx_GOTREF(__pyx_t_3);
03465       __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)
03466       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03467       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 813, __pyx_L1_error)
03468       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03469       if (!__pyx_t_6) break;
03470 
03471       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":814
03472  *         # Output padding bytes
03473  *         while offset[0] < new_offset:
03474  *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
03475  *             f += 1
03476  *             offset[0] += 1
03477  */
03478       (__pyx_v_f[0]) = 0x78;
03479 
03480       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":815
03481  *         while offset[0] < new_offset:
03482  *             f[0] = 120 # "x"; pad byte
03483  *             f += 1             # <<<<<<<<<<<<<<
03484  *             offset[0] += 1
03485  * 
03486  */
03487       __pyx_v_f = (__pyx_v_f + 1);
03488 
03489       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":816
03490  *             f[0] = 120 # "x"; pad byte
03491  *             f += 1
03492  *             offset[0] += 1             # <<<<<<<<<<<<<<
03493  * 
03494  *         offset[0] += child.itemsize
03495  */
03496       __pyx_t_8 = 0;
03497       (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
03498     }
03499 
03500     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":818
03501  *             offset[0] += 1
03502  * 
03503  *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
03504  * 
03505  *         if not PyDataType_HASFIELDS(child):
03506  */
03507     __pyx_t_8 = 0;
03508     (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
03509 
03510     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":820
03511  *         offset[0] += child.itemsize
03512  * 
03513  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
03514  *             t = child.type_num
03515  *             if end - f < 5:
03516  */
03517     __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
03518     if (__pyx_t_6) {
03519 
03520       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":821
03521  * 
03522  *         if not PyDataType_HASFIELDS(child):
03523  *             t = child.type_num             # <<<<<<<<<<<<<<
03524  *             if end - f < 5:
03525  *                 raise RuntimeError(u"Format string allocated too short.")
03526  */
03527       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 821, __pyx_L1_error)
03528       __Pyx_GOTREF(__pyx_t_4);
03529       __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
03530       __pyx_t_4 = 0;
03531 
03532       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":822
03533  *         if not PyDataType_HASFIELDS(child):
03534  *             t = child.type_num
03535  *             if end - f < 5:             # <<<<<<<<<<<<<<
03536  *                 raise RuntimeError(u"Format string allocated too short.")
03537  * 
03538  */
03539       __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
03540       if (__pyx_t_6) {
03541 
03542         /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823
03543  *             t = child.type_num
03544  *             if end - f < 5:
03545  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
03546  * 
03547  *             # Until ticket #99 is fixed, use integers to avoid warnings
03548  */
03549         __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 823, __pyx_L1_error)
03550         __Pyx_GOTREF(__pyx_t_4);
03551         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
03552         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03553         __PYX_ERR(1, 823, __pyx_L1_error)
03554 
03555         /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":822
03556  *         if not PyDataType_HASFIELDS(child):
03557  *             t = child.type_num
03558  *             if end - f < 5:             # <<<<<<<<<<<<<<
03559  *                 raise RuntimeError(u"Format string allocated too short.")
03560  * 
03561  */
03562       }
03563 
03564       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":826
03565  * 
03566  *             # Until ticket #99 is fixed, use integers to avoid warnings
03567  *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
03568  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
03569  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
03570  */
03571       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 826, __pyx_L1_error)
03572       __Pyx_GOTREF(__pyx_t_4);
03573       __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)
03574       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03575       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 826, __pyx_L1_error)
03576       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03577       if (__pyx_t_6) {
03578         (__pyx_v_f[0]) = 98;
03579         goto __pyx_L15;
03580       }
03581 
03582       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":827
03583  *             # Until ticket #99 is fixed, use integers to avoid warnings
03584  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
03585  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
03586  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
03587  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
03588  */
03589       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 827, __pyx_L1_error)
03590       __Pyx_GOTREF(__pyx_t_3);
03591       __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)
03592       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03593       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 827, __pyx_L1_error)
03594       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03595       if (__pyx_t_6) {
03596         (__pyx_v_f[0]) = 66;
03597         goto __pyx_L15;
03598       }
03599 
03600       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":828
03601  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
03602  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
03603  *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
03604  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
03605  *             elif t == NPY_INT:         f[0] = 105 #"i"
03606  */
03607       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 828, __pyx_L1_error)
03608       __Pyx_GOTREF(__pyx_t_4);
03609       __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)
03610       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03611       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 828, __pyx_L1_error)
03612       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03613       if (__pyx_t_6) {
03614         (__pyx_v_f[0]) = 0x68;
03615         goto __pyx_L15;
03616       }
03617 
03618       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":829
03619  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
03620  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
03621  *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
03622  *             elif t == NPY_INT:         f[0] = 105 #"i"
03623  *             elif t == NPY_UINT:        f[0] =  73 #"I"
03624  */
03625       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 829, __pyx_L1_error)
03626       __Pyx_GOTREF(__pyx_t_3);
03627       __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)
03628       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03629       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 829, __pyx_L1_error)
03630       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03631       if (__pyx_t_6) {
03632         (__pyx_v_f[0]) = 72;
03633         goto __pyx_L15;
03634       }
03635 
03636       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":830
03637  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
03638  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
03639  *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
03640  *             elif t == NPY_UINT:        f[0] =  73 #"I"
03641  *             elif t == NPY_LONG:        f[0] = 108 #"l"
03642  */
03643       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 830, __pyx_L1_error)
03644       __Pyx_GOTREF(__pyx_t_4);
03645       __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)
03646       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03647       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 830, __pyx_L1_error)
03648       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03649       if (__pyx_t_6) {
03650         (__pyx_v_f[0]) = 0x69;
03651         goto __pyx_L15;
03652       }
03653 
03654       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":831
03655  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
03656  *             elif t == NPY_INT:         f[0] = 105 #"i"
03657  *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
03658  *             elif t == NPY_LONG:        f[0] = 108 #"l"
03659  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
03660  */
03661       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 831, __pyx_L1_error)
03662       __Pyx_GOTREF(__pyx_t_3);
03663       __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)
03664       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03665       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 831, __pyx_L1_error)
03666       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03667       if (__pyx_t_6) {
03668         (__pyx_v_f[0]) = 73;
03669         goto __pyx_L15;
03670       }
03671 
03672       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":832
03673  *             elif t == NPY_INT:         f[0] = 105 #"i"
03674  *             elif t == NPY_UINT:        f[0] =  73 #"I"
03675  *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
03676  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
03677  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
03678  */
03679       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error)
03680       __Pyx_GOTREF(__pyx_t_4);
03681       __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)
03682       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03683       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 832, __pyx_L1_error)
03684       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03685       if (__pyx_t_6) {
03686         (__pyx_v_f[0]) = 0x6C;
03687         goto __pyx_L15;
03688       }
03689 
03690       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":833
03691  *             elif t == NPY_UINT:        f[0] =  73 #"I"
03692  *             elif t == NPY_LONG:        f[0] = 108 #"l"
03693  *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
03694  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
03695  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
03696  */
03697       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 833, __pyx_L1_error)
03698       __Pyx_GOTREF(__pyx_t_3);
03699       __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)
03700       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03701       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 833, __pyx_L1_error)
03702       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03703       if (__pyx_t_6) {
03704         (__pyx_v_f[0]) = 76;
03705         goto __pyx_L15;
03706       }
03707 
03708       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":834
03709  *             elif t == NPY_LONG:        f[0] = 108 #"l"
03710  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
03711  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
03712  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
03713  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
03714  */
03715       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error)
03716       __Pyx_GOTREF(__pyx_t_4);
03717       __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)
03718       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03719       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 834, __pyx_L1_error)
03720       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03721       if (__pyx_t_6) {
03722         (__pyx_v_f[0]) = 0x71;
03723         goto __pyx_L15;
03724       }
03725 
03726       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":835
03727  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
03728  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
03729  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
03730  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
03731  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
03732  */
03733       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 835, __pyx_L1_error)
03734       __Pyx_GOTREF(__pyx_t_3);
03735       __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)
03736       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03737       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 835, __pyx_L1_error)
03738       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03739       if (__pyx_t_6) {
03740         (__pyx_v_f[0]) = 81;
03741         goto __pyx_L15;
03742       }
03743 
03744       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":836
03745  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
03746  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
03747  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
03748  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
03749  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
03750  */
03751       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 836, __pyx_L1_error)
03752       __Pyx_GOTREF(__pyx_t_4);
03753       __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)
03754       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03755       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 836, __pyx_L1_error)
03756       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03757       if (__pyx_t_6) {
03758         (__pyx_v_f[0]) = 0x66;
03759         goto __pyx_L15;
03760       }
03761 
03762       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":837
03763  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
03764  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
03765  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
03766  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
03767  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
03768  */
03769       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error)
03770       __Pyx_GOTREF(__pyx_t_3);
03771       __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)
03772       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03773       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error)
03774       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03775       if (__pyx_t_6) {
03776         (__pyx_v_f[0]) = 0x64;
03777         goto __pyx_L15;
03778       }
03779 
03780       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":838
03781  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
03782  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
03783  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
03784  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
03785  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
03786  */
03787       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error)
03788       __Pyx_GOTREF(__pyx_t_4);
03789       __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)
03790       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03791       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error)
03792       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03793       if (__pyx_t_6) {
03794         (__pyx_v_f[0]) = 0x67;
03795         goto __pyx_L15;
03796       }
03797 
03798       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":839
03799  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
03800  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
03801  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
03802  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
03803  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
03804  */
03805       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error)
03806       __Pyx_GOTREF(__pyx_t_3);
03807       __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)
03808       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03809       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error)
03810       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03811       if (__pyx_t_6) {
03812         (__pyx_v_f[0]) = 90;
03813         (__pyx_v_f[1]) = 0x66;
03814         __pyx_v_f = (__pyx_v_f + 1);
03815         goto __pyx_L15;
03816       }
03817 
03818       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":840
03819  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
03820  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
03821  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
03822  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
03823  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
03824  */
03825       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error)
03826       __Pyx_GOTREF(__pyx_t_4);
03827       __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)
03828       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03829       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error)
03830       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03831       if (__pyx_t_6) {
03832         (__pyx_v_f[0]) = 90;
03833         (__pyx_v_f[1]) = 0x64;
03834         __pyx_v_f = (__pyx_v_f + 1);
03835         goto __pyx_L15;
03836       }
03837 
03838       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":841
03839  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
03840  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
03841  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
03842  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
03843  *             else:
03844  */
03845       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error)
03846       __Pyx_GOTREF(__pyx_t_3);
03847       __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)
03848       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03849       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error)
03850       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03851       if (__pyx_t_6) {
03852         (__pyx_v_f[0]) = 90;
03853         (__pyx_v_f[1]) = 0x67;
03854         __pyx_v_f = (__pyx_v_f + 1);
03855         goto __pyx_L15;
03856       }
03857 
03858       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":842
03859  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
03860  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
03861  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
03862  *             else:
03863  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
03864  */
03865       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error)
03866       __Pyx_GOTREF(__pyx_t_4);
03867       __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)
03868       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03869       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error)
03870       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03871       if (__pyx_t_6) {
03872         (__pyx_v_f[0]) = 79;
03873         goto __pyx_L15;
03874       }
03875 
03876       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":844
03877  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
03878  *             else:
03879  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
03880  *             f += 1
03881  *         else:
03882  */
03883       /*else*/ {
03884         __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)
03885         __Pyx_GOTREF(__pyx_t_3);
03886         __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error)
03887         __Pyx_GOTREF(__pyx_t_4);
03888         __Pyx_GIVEREF(__pyx_t_3);
03889         PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
03890         __pyx_t_3 = 0;
03891         __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)
03892         __Pyx_GOTREF(__pyx_t_3);
03893         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
03894         __Pyx_Raise(__pyx_t_3, 0, 0, 0);
03895         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
03896         __PYX_ERR(1, 844, __pyx_L1_error)
03897       }
03898       __pyx_L15:;
03899 
03900       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":845
03901  *             else:
03902  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
03903  *             f += 1             # <<<<<<<<<<<<<<
03904  *         else:
03905  *             # Cython ignores struct boundary information ("T{...}"),
03906  */
03907       __pyx_v_f = (__pyx_v_f + 1);
03908 
03909       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":820
03910  *         offset[0] += child.itemsize
03911  * 
03912  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
03913  *             t = child.type_num
03914  *             if end - f < 5:
03915  */
03916       goto __pyx_L13;
03917     }
03918 
03919     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":849
03920  *             # Cython ignores struct boundary information ("T{...}"),
03921  *             # so don't output it
03922  *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
03923  *     return f
03924  * 
03925  */
03926     /*else*/ {
03927       __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)
03928       __pyx_v_f = __pyx_t_9;
03929     }
03930     __pyx_L13:;
03931 
03932     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":794
03933  *     cdef tuple fields
03934  * 
03935  *     for childname in descr.names:             # <<<<<<<<<<<<<<
03936  *         fields = descr.fields[childname]
03937  *         child, new_offset = fields
03938  */
03939   }
03940   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
03941 
03942   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":850
03943  *             # so don't output it
03944  *             f = _util_dtypestring(child, f, end, offset)
03945  *     return f             # <<<<<<<<<<<<<<
03946  * 
03947  * 
03948  */
03949   __pyx_r = __pyx_v_f;
03950   goto __pyx_L0;
03951 
03952   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":785
03953  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
03954  * 
03955  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
03956  *     # Recursive utility function used in __getbuffer__ to get format
03957  *     # string. The new location in the format string is returned.
03958  */
03959 
03960   /* function exit code */
03961   __pyx_L1_error:;
03962   __Pyx_XDECREF(__pyx_t_1);
03963   __Pyx_XDECREF(__pyx_t_3);
03964   __Pyx_XDECREF(__pyx_t_4);
03965   __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
03966   __pyx_r = NULL;
03967   __pyx_L0:;
03968   __Pyx_XDECREF((PyObject *)__pyx_v_child);
03969   __Pyx_XDECREF(__pyx_v_fields);
03970   __Pyx_XDECREF(__pyx_v_childname);
03971   __Pyx_XDECREF(__pyx_v_new_offset);
03972   __Pyx_XDECREF(__pyx_v_t);
03973   __Pyx_RefNannyFinishContext();
03974   return __pyx_r;
03975 }
03976 
03977 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966
03978  * 
03979  * 
03980  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
03981  *      cdef PyObject* baseptr
03982  *      if base is None:
03983  */
03984 
03985 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
03986   PyObject *__pyx_v_baseptr;
03987   __Pyx_RefNannyDeclarations
03988   int __pyx_t_1;
03989   int __pyx_t_2;
03990   __Pyx_RefNannySetupContext("set_array_base", 0);
03991 
03992   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":968
03993  * cdef inline void set_array_base(ndarray arr, object base):
03994  *      cdef PyObject* baseptr
03995  *      if base is None:             # <<<<<<<<<<<<<<
03996  *          baseptr = NULL
03997  *      else:
03998  */
03999   __pyx_t_1 = (__pyx_v_base == Py_None);
04000   __pyx_t_2 = (__pyx_t_1 != 0);
04001   if (__pyx_t_2) {
04002 
04003     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":969
04004  *      cdef PyObject* baseptr
04005  *      if base is None:
04006  *          baseptr = NULL             # <<<<<<<<<<<<<<
04007  *      else:
04008  *          Py_INCREF(base) # important to do this before decref below!
04009  */
04010     __pyx_v_baseptr = NULL;
04011 
04012     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":968
04013  * cdef inline void set_array_base(ndarray arr, object base):
04014  *      cdef PyObject* baseptr
04015  *      if base is None:             # <<<<<<<<<<<<<<
04016  *          baseptr = NULL
04017  *      else:
04018  */
04019     goto __pyx_L3;
04020   }
04021 
04022   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":971
04023  *          baseptr = NULL
04024  *      else:
04025  *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
04026  *          baseptr = <PyObject*>base
04027  *      Py_XDECREF(arr.base)
04028  */
04029   /*else*/ {
04030     Py_INCREF(__pyx_v_base);
04031 
04032     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":972
04033  *      else:
04034  *          Py_INCREF(base) # important to do this before decref below!
04035  *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
04036  *      Py_XDECREF(arr.base)
04037  *      arr.base = baseptr
04038  */
04039     __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
04040   }
04041   __pyx_L3:;
04042 
04043   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":973
04044  *          Py_INCREF(base) # important to do this before decref below!
04045  *          baseptr = <PyObject*>base
04046  *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
04047  *      arr.base = baseptr
04048  * 
04049  */
04050   Py_XDECREF(__pyx_v_arr->base);
04051 
04052   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":974
04053  *          baseptr = <PyObject*>base
04054  *      Py_XDECREF(arr.base)
04055  *      arr.base = baseptr             # <<<<<<<<<<<<<<
04056  * 
04057  * cdef inline object get_array_base(ndarray arr):
04058  */
04059   __pyx_v_arr->base = __pyx_v_baseptr;
04060 
04061   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966
04062  * 
04063  * 
04064  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
04065  *      cdef PyObject* baseptr
04066  *      if base is None:
04067  */
04068 
04069   /* function exit code */
04070   __Pyx_RefNannyFinishContext();
04071 }
04072 
04073 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976
04074  *      arr.base = baseptr
04075  * 
04076  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
04077  *     if arr.base is NULL:
04078  *         return None
04079  */
04080 
04081 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
04082   PyObject *__pyx_r = NULL;
04083   __Pyx_RefNannyDeclarations
04084   int __pyx_t_1;
04085   __Pyx_RefNannySetupContext("get_array_base", 0);
04086 
04087   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":977
04088  * 
04089  * cdef inline object get_array_base(ndarray arr):
04090  *     if arr.base is NULL:             # <<<<<<<<<<<<<<
04091  *         return None
04092  *     else:
04093  */
04094   __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
04095   if (__pyx_t_1) {
04096 
04097     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":978
04098  * cdef inline object get_array_base(ndarray arr):
04099  *     if arr.base is NULL:
04100  *         return None             # <<<<<<<<<<<<<<
04101  *     else:
04102  *         return <object>arr.base
04103  */
04104     __Pyx_XDECREF(__pyx_r);
04105     __Pyx_INCREF(Py_None);
04106     __pyx_r = Py_None;
04107     goto __pyx_L0;
04108 
04109     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":977
04110  * 
04111  * cdef inline object get_array_base(ndarray arr):
04112  *     if arr.base is NULL:             # <<<<<<<<<<<<<<
04113  *         return None
04114  *     else:
04115  */
04116   }
04117 
04118   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":980
04119  *         return None
04120  *     else:
04121  *         return <object>arr.base             # <<<<<<<<<<<<<<
04122  * 
04123  * 
04124  */
04125   /*else*/ {
04126     __Pyx_XDECREF(__pyx_r);
04127     __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
04128     __pyx_r = ((PyObject *)__pyx_v_arr->base);
04129     goto __pyx_L0;
04130   }
04131 
04132   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976
04133  *      arr.base = baseptr
04134  * 
04135  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
04136  *     if arr.base is NULL:
04137  *         return None
04138  */
04139 
04140   /* function exit code */
04141   __pyx_L0:;
04142   __Pyx_XGIVEREF(__pyx_r);
04143   __Pyx_RefNannyFinishContext();
04144   return __pyx_r;
04145 }
04146 
04147 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":985
04148  * # Versions of the import_* functions which are more suitable for
04149  * # Cython code.
04150  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
04151  *     try:
04152  *         _import_array()
04153  */
04154 
04155 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
04156   int __pyx_r;
04157   __Pyx_RefNannyDeclarations
04158   PyObject *__pyx_t_1 = NULL;
04159   PyObject *__pyx_t_2 = NULL;
04160   PyObject *__pyx_t_3 = NULL;
04161   int __pyx_t_4;
04162   PyObject *__pyx_t_5 = NULL;
04163   PyObject *__pyx_t_6 = NULL;
04164   PyObject *__pyx_t_7 = NULL;
04165   PyObject *__pyx_t_8 = NULL;
04166   __Pyx_RefNannySetupContext("import_array", 0);
04167 
04168   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":986
04169  * # Cython code.
04170  * cdef inline int import_array() except -1:
04171  *     try:             # <<<<<<<<<<<<<<
04172  *         _import_array()
04173  *     except Exception:
04174  */
04175   {
04176     __Pyx_PyThreadState_declare
04177     __Pyx_PyThreadState_assign
04178     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
04179     __Pyx_XGOTREF(__pyx_t_1);
04180     __Pyx_XGOTREF(__pyx_t_2);
04181     __Pyx_XGOTREF(__pyx_t_3);
04182     /*try:*/ {
04183 
04184       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":987
04185  * cdef inline int import_array() except -1:
04186  *     try:
04187  *         _import_array()             # <<<<<<<<<<<<<<
04188  *     except Exception:
04189  *         raise ImportError("numpy.core.multiarray failed to import")
04190  */
04191       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 987, __pyx_L3_error)
04192 
04193       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":986
04194  * # Cython code.
04195  * cdef inline int import_array() except -1:
04196  *     try:             # <<<<<<<<<<<<<<
04197  *         _import_array()
04198  *     except Exception:
04199  */
04200     }
04201     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
04202     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
04203     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
04204     goto __pyx_L10_try_end;
04205     __pyx_L3_error:;
04206     __Pyx_PyThreadState_assign
04207 
04208     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":988
04209  *     try:
04210  *         _import_array()
04211  *     except Exception:             # <<<<<<<<<<<<<<
04212  *         raise ImportError("numpy.core.multiarray failed to import")
04213  * 
04214  */
04215     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
04216     if (__pyx_t_4) {
04217       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
04218       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 988, __pyx_L5_except_error)
04219       __Pyx_GOTREF(__pyx_t_5);
04220       __Pyx_GOTREF(__pyx_t_6);
04221       __Pyx_GOTREF(__pyx_t_7);
04222 
04223       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":989
04224  *         _import_array()
04225  *     except Exception:
04226  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
04227  * 
04228  * cdef inline int import_umath() except -1:
04229  */
04230       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 989, __pyx_L5_except_error)
04231       __Pyx_GOTREF(__pyx_t_8);
04232       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
04233       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
04234       __PYX_ERR(1, 989, __pyx_L5_except_error)
04235     }
04236     goto __pyx_L5_except_error;
04237     __pyx_L5_except_error:;
04238 
04239     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":986
04240  * # Cython code.
04241  * cdef inline int import_array() except -1:
04242  *     try:             # <<<<<<<<<<<<<<
04243  *         _import_array()
04244  *     except Exception:
04245  */
04246     __Pyx_PyThreadState_assign
04247     __Pyx_XGIVEREF(__pyx_t_1);
04248     __Pyx_XGIVEREF(__pyx_t_2);
04249     __Pyx_XGIVEREF(__pyx_t_3);
04250     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
04251     goto __pyx_L1_error;
04252     __pyx_L10_try_end:;
04253   }
04254 
04255   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":985
04256  * # Versions of the import_* functions which are more suitable for
04257  * # Cython code.
04258  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
04259  *     try:
04260  *         _import_array()
04261  */
04262 
04263   /* function exit code */
04264   __pyx_r = 0;
04265   goto __pyx_L0;
04266   __pyx_L1_error:;
04267   __Pyx_XDECREF(__pyx_t_5);
04268   __Pyx_XDECREF(__pyx_t_6);
04269   __Pyx_XDECREF(__pyx_t_7);
04270   __Pyx_XDECREF(__pyx_t_8);
04271   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
04272   __pyx_r = -1;
04273   __pyx_L0:;
04274   __Pyx_RefNannyFinishContext();
04275   return __pyx_r;
04276 }
04277 
04278 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":991
04279  *         raise ImportError("numpy.core.multiarray failed to import")
04280  * 
04281  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
04282  *     try:
04283  *         _import_umath()
04284  */
04285 
04286 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
04287   int __pyx_r;
04288   __Pyx_RefNannyDeclarations
04289   PyObject *__pyx_t_1 = NULL;
04290   PyObject *__pyx_t_2 = NULL;
04291   PyObject *__pyx_t_3 = NULL;
04292   int __pyx_t_4;
04293   PyObject *__pyx_t_5 = NULL;
04294   PyObject *__pyx_t_6 = NULL;
04295   PyObject *__pyx_t_7 = NULL;
04296   PyObject *__pyx_t_8 = NULL;
04297   __Pyx_RefNannySetupContext("import_umath", 0);
04298 
04299   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":992
04300  * 
04301  * cdef inline int import_umath() except -1:
04302  *     try:             # <<<<<<<<<<<<<<
04303  *         _import_umath()
04304  *     except Exception:
04305  */
04306   {
04307     __Pyx_PyThreadState_declare
04308     __Pyx_PyThreadState_assign
04309     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
04310     __Pyx_XGOTREF(__pyx_t_1);
04311     __Pyx_XGOTREF(__pyx_t_2);
04312     __Pyx_XGOTREF(__pyx_t_3);
04313     /*try:*/ {
04314 
04315       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":993
04316  * cdef inline int import_umath() except -1:
04317  *     try:
04318  *         _import_umath()             # <<<<<<<<<<<<<<
04319  *     except Exception:
04320  *         raise ImportError("numpy.core.umath failed to import")
04321  */
04322       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 993, __pyx_L3_error)
04323 
04324       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":992
04325  * 
04326  * cdef inline int import_umath() except -1:
04327  *     try:             # <<<<<<<<<<<<<<
04328  *         _import_umath()
04329  *     except Exception:
04330  */
04331     }
04332     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
04333     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
04334     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
04335     goto __pyx_L10_try_end;
04336     __pyx_L3_error:;
04337     __Pyx_PyThreadState_assign
04338 
04339     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":994
04340  *     try:
04341  *         _import_umath()
04342  *     except Exception:             # <<<<<<<<<<<<<<
04343  *         raise ImportError("numpy.core.umath failed to import")
04344  * 
04345  */
04346     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
04347     if (__pyx_t_4) {
04348       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
04349       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 994, __pyx_L5_except_error)
04350       __Pyx_GOTREF(__pyx_t_5);
04351       __Pyx_GOTREF(__pyx_t_6);
04352       __Pyx_GOTREF(__pyx_t_7);
04353 
04354       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":995
04355  *         _import_umath()
04356  *     except Exception:
04357  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
04358  * 
04359  * cdef inline int import_ufunc() except -1:
04360  */
04361       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 995, __pyx_L5_except_error)
04362       __Pyx_GOTREF(__pyx_t_8);
04363       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
04364       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
04365       __PYX_ERR(1, 995, __pyx_L5_except_error)
04366     }
04367     goto __pyx_L5_except_error;
04368     __pyx_L5_except_error:;
04369 
04370     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":992
04371  * 
04372  * cdef inline int import_umath() except -1:
04373  *     try:             # <<<<<<<<<<<<<<
04374  *         _import_umath()
04375  *     except Exception:
04376  */
04377     __Pyx_PyThreadState_assign
04378     __Pyx_XGIVEREF(__pyx_t_1);
04379     __Pyx_XGIVEREF(__pyx_t_2);
04380     __Pyx_XGIVEREF(__pyx_t_3);
04381     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
04382     goto __pyx_L1_error;
04383     __pyx_L10_try_end:;
04384   }
04385 
04386   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":991
04387  *         raise ImportError("numpy.core.multiarray failed to import")
04388  * 
04389  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
04390  *     try:
04391  *         _import_umath()
04392  */
04393 
04394   /* function exit code */
04395   __pyx_r = 0;
04396   goto __pyx_L0;
04397   __pyx_L1_error:;
04398   __Pyx_XDECREF(__pyx_t_5);
04399   __Pyx_XDECREF(__pyx_t_6);
04400   __Pyx_XDECREF(__pyx_t_7);
04401   __Pyx_XDECREF(__pyx_t_8);
04402   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
04403   __pyx_r = -1;
04404   __pyx_L0:;
04405   __Pyx_RefNannyFinishContext();
04406   return __pyx_r;
04407 }
04408 
04409 /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":997
04410  *         raise ImportError("numpy.core.umath failed to import")
04411  * 
04412  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
04413  *     try:
04414  *         _import_umath()
04415  */
04416 
04417 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
04418   int __pyx_r;
04419   __Pyx_RefNannyDeclarations
04420   PyObject *__pyx_t_1 = NULL;
04421   PyObject *__pyx_t_2 = NULL;
04422   PyObject *__pyx_t_3 = NULL;
04423   int __pyx_t_4;
04424   PyObject *__pyx_t_5 = NULL;
04425   PyObject *__pyx_t_6 = NULL;
04426   PyObject *__pyx_t_7 = NULL;
04427   PyObject *__pyx_t_8 = NULL;
04428   __Pyx_RefNannySetupContext("import_ufunc", 0);
04429 
04430   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":998
04431  * 
04432  * cdef inline int import_ufunc() except -1:
04433  *     try:             # <<<<<<<<<<<<<<
04434  *         _import_umath()
04435  *     except Exception:
04436  */
04437   {
04438     __Pyx_PyThreadState_declare
04439     __Pyx_PyThreadState_assign
04440     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
04441     __Pyx_XGOTREF(__pyx_t_1);
04442     __Pyx_XGOTREF(__pyx_t_2);
04443     __Pyx_XGOTREF(__pyx_t_3);
04444     /*try:*/ {
04445 
04446       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":999
04447  * cdef inline int import_ufunc() except -1:
04448  *     try:
04449  *         _import_umath()             # <<<<<<<<<<<<<<
04450  *     except Exception:
04451  *         raise ImportError("numpy.core.umath failed to import")
04452  */
04453       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 999, __pyx_L3_error)
04454 
04455       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":998
04456  * 
04457  * cdef inline int import_ufunc() except -1:
04458  *     try:             # <<<<<<<<<<<<<<
04459  *         _import_umath()
04460  *     except Exception:
04461  */
04462     }
04463     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
04464     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
04465     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
04466     goto __pyx_L10_try_end;
04467     __pyx_L3_error:;
04468     __Pyx_PyThreadState_assign
04469 
04470     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":1000
04471  *     try:
04472  *         _import_umath()
04473  *     except Exception:             # <<<<<<<<<<<<<<
04474  *         raise ImportError("numpy.core.umath failed to import")
04475  */
04476     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
04477     if (__pyx_t_4) {
04478       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
04479       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1000, __pyx_L5_except_error)
04480       __Pyx_GOTREF(__pyx_t_5);
04481       __Pyx_GOTREF(__pyx_t_6);
04482       __Pyx_GOTREF(__pyx_t_7);
04483 
04484       /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":1001
04485  *         _import_umath()
04486  *     except Exception:
04487  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
04488  */
04489       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1001, __pyx_L5_except_error)
04490       __Pyx_GOTREF(__pyx_t_8);
04491       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
04492       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
04493       __PYX_ERR(1, 1001, __pyx_L5_except_error)
04494     }
04495     goto __pyx_L5_except_error;
04496     __pyx_L5_except_error:;
04497 
04498     /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":998
04499  * 
04500  * cdef inline int import_ufunc() except -1:
04501  *     try:             # <<<<<<<<<<<<<<
04502  *         _import_umath()
04503  *     except Exception:
04504  */
04505     __Pyx_PyThreadState_assign
04506     __Pyx_XGIVEREF(__pyx_t_1);
04507     __Pyx_XGIVEREF(__pyx_t_2);
04508     __Pyx_XGIVEREF(__pyx_t_3);
04509     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
04510     goto __pyx_L1_error;
04511     __pyx_L10_try_end:;
04512   }
04513 
04514   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":997
04515  *         raise ImportError("numpy.core.umath failed to import")
04516  * 
04517  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
04518  *     try:
04519  *         _import_umath()
04520  */
04521 
04522   /* function exit code */
04523   __pyx_r = 0;
04524   goto __pyx_L0;
04525   __pyx_L1_error:;
04526   __Pyx_XDECREF(__pyx_t_5);
04527   __Pyx_XDECREF(__pyx_t_6);
04528   __Pyx_XDECREF(__pyx_t_7);
04529   __Pyx_XDECREF(__pyx_t_8);
04530   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
04531   __pyx_r = -1;
04532   __pyx_L0:;
04533   __Pyx_RefNannyFinishContext();
04534   return __pyx_r;
04535 }
04536 
04537 static PyMethodDef __pyx_methods[] = {
04538   {0, 0, 0, 0}
04539 };
04540 
04541 #if PY_MAJOR_VERSION >= 3
04542 static struct PyModuleDef __pyx_moduledef = {
04543   #if PY_VERSION_HEX < 0x03020000
04544     { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
04545   #else
04546     PyModuleDef_HEAD_INIT,
04547   #endif
04548     "gpu_nms",
04549     0, /* m_doc */
04550     -1, /* m_size */
04551     __pyx_methods /* m_methods */,
04552     NULL, /* m_reload */
04553     NULL, /* m_traverse */
04554     NULL, /* m_clear */
04555     NULL /* m_free */
04556 };
04557 #endif
04558 
04559 static __Pyx_StringTabEntry __pyx_string_tab[] = {
04560   {&__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},
04561   {&__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},
04562   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
04563   {&__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},
04564   {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
04565   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
04566   {&__pyx_n_s_argsort, __pyx_k_argsort, sizeof(__pyx_k_argsort), 0, 0, 1, 1},
04567   {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
04568   {&__pyx_n_s_boxes_dim, __pyx_k_boxes_dim, sizeof(__pyx_k_boxes_dim), 0, 0, 1, 1},
04569   {&__pyx_n_s_boxes_num, __pyx_k_boxes_num, sizeof(__pyx_k_boxes_num), 0, 0, 1, 1},
04570   {&__pyx_n_s_dets, __pyx_k_dets, sizeof(__pyx_k_dets), 0, 0, 1, 1},
04571   {&__pyx_n_s_device_id, __pyx_k_device_id, sizeof(__pyx_k_device_id), 0, 0, 1, 1},
04572   {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
04573   {&__pyx_n_s_gpu_nms, __pyx_k_gpu_nms, sizeof(__pyx_k_gpu_nms), 0, 0, 1, 1},
04574   {&__pyx_kp_s_home_andrewsilva_Deformable_Con, __pyx_k_home_andrewsilva_Deformable_Con, sizeof(__pyx_k_home_andrewsilva_Deformable_Con), 0, 0, 1, 0},
04575   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
04576   {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
04577   {&__pyx_n_s_keep, __pyx_k_keep, sizeof(__pyx_k_keep), 0, 0, 1, 1},
04578   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
04579   {&__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},
04580   {&__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},
04581   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
04582   {&__pyx_n_s_num_out, __pyx_k_num_out, sizeof(__pyx_k_num_out), 0, 0, 1, 1},
04583   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
04584   {&__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},
04585   {&__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},
04586   {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1},
04587   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
04588   {&__pyx_n_s_scores, __pyx_k_scores, sizeof(__pyx_k_scores), 0, 0, 1, 1},
04589   {&__pyx_n_s_sorted_dets, __pyx_k_sorted_dets, sizeof(__pyx_k_sorted_dets), 0, 0, 1, 1},
04590   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
04591   {&__pyx_n_s_thresh, __pyx_k_thresh, sizeof(__pyx_k_thresh), 0, 0, 1, 1},
04592   {&__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},
04593   {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
04594   {0, 0, 0, 0, 0, 0, 0}
04595 };
04596 static int __Pyx_InitCachedBuiltins(void) {
04597   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 218, __pyx_L1_error)
04598   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 231, __pyx_L1_error)
04599   __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 799, __pyx_L1_error)
04600   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 989, __pyx_L1_error)
04601   return 0;
04602   __pyx_L1_error:;
04603   return -1;
04604 }
04605 
04606 static int __Pyx_InitCachedConstants(void) {
04607   __Pyx_RefNannyDeclarations
04608   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
04609 
04610   /* "gpu_nms.pyx":24
04611  *         keep = np.zeros(boxes_num, dtype=np.int32)
04612  *     cdef np.ndarray[np.float32_t, ndim=1] \
04613  *         scores = dets[:, 4]             # <<<<<<<<<<<<<<
04614  *     cdef np.ndarray[np.int32_t, ndim=1] \
04615  *         order = scores.argsort()[::-1].astype(np.int32)
04616  */
04617   __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 24, __pyx_L1_error)
04618   __Pyx_GOTREF(__pyx_slice_);
04619   __Pyx_GIVEREF(__pyx_slice_);
04620   __pyx_tuple__2 = PyTuple_Pack(2, __pyx_slice_, __pyx_int_4); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 24, __pyx_L1_error)
04621   __Pyx_GOTREF(__pyx_tuple__2);
04622   __Pyx_GIVEREF(__pyx_tuple__2);
04623 
04624   /* "gpu_nms.pyx":26
04625  *         scores = dets[:, 4]
04626  *     cdef np.ndarray[np.int32_t, ndim=1] \
04627  *         order = scores.argsort()[::-1].astype(np.int32)             # <<<<<<<<<<<<<<
04628  *     cdef np.ndarray[np.float32_t, ndim=2] \
04629  *         sorted_dets = dets[order, :]
04630  */
04631   __pyx_slice__3 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 26, __pyx_L1_error)
04632   __Pyx_GOTREF(__pyx_slice__3);
04633   __Pyx_GIVEREF(__pyx_slice__3);
04634 
04635   /* "gpu_nms.pyx":28
04636  *         order = scores.argsort()[::-1].astype(np.int32)
04637  *     cdef np.ndarray[np.float32_t, ndim=2] \
04638  *         sorted_dets = dets[order, :]             # <<<<<<<<<<<<<<
04639  *     _nms(&keep[0], &num_out, &sorted_dets[0, 0], boxes_num, boxes_dim, thresh, device_id)
04640  *     keep = keep[:num_out]
04641  */
04642   __pyx_slice__4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 28, __pyx_L1_error)
04643   __Pyx_GOTREF(__pyx_slice__4);
04644   __Pyx_GIVEREF(__pyx_slice__4);
04645 
04646   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218
04647  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
04648  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
04649  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
04650  * 
04651  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
04652  */
04653   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 218, __pyx_L1_error)
04654   __Pyx_GOTREF(__pyx_tuple__5);
04655   __Pyx_GIVEREF(__pyx_tuple__5);
04656 
04657   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222
04658  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
04659  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
04660  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
04661  * 
04662  *             info.buf = PyArray_DATA(self)
04663  */
04664   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 222, __pyx_L1_error)
04665   __Pyx_GOTREF(__pyx_tuple__6);
04666   __Pyx_GIVEREF(__pyx_tuple__6);
04667 
04668   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":259
04669  *                 if ((descr.byteorder == c'>' and little_endian) or
04670  *                     (descr.byteorder == c'<' and not little_endian)):
04671  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
04672  *                 if   t == NPY_BYTE:        f = "b"
04673  *                 elif t == NPY_UBYTE:       f = "B"
04674  */
04675   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 259, __pyx_L1_error)
04676   __Pyx_GOTREF(__pyx_tuple__7);
04677   __Pyx_GIVEREF(__pyx_tuple__7);
04678 
04679   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799
04680  * 
04681  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
04682  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
04683  * 
04684  *         if ((child.byteorder == c'>' and little_endian) or
04685  */
04686   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 799, __pyx_L1_error)
04687   __Pyx_GOTREF(__pyx_tuple__8);
04688   __Pyx_GIVEREF(__pyx_tuple__8);
04689 
04690   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803
04691  *         if ((child.byteorder == c'>' and little_endian) or
04692  *             (child.byteorder == c'<' and not little_endian)):
04693  *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
04694  *             # One could encode it in the format string and have Cython
04695  *             # complain instead, BUT: < and > in format strings also imply
04696  */
04697   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 803, __pyx_L1_error)
04698   __Pyx_GOTREF(__pyx_tuple__9);
04699   __Pyx_GIVEREF(__pyx_tuple__9);
04700 
04701   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823
04702  *             t = child.type_num
04703  *             if end - f < 5:
04704  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
04705  * 
04706  *             # Until ticket #99 is fixed, use integers to avoid warnings
04707  */
04708   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 823, __pyx_L1_error)
04709   __Pyx_GOTREF(__pyx_tuple__10);
04710   __Pyx_GIVEREF(__pyx_tuple__10);
04711 
04712   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":989
04713  *         _import_array()
04714  *     except Exception:
04715  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
04716  * 
04717  * cdef inline int import_umath() except -1:
04718  */
04719   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 989, __pyx_L1_error)
04720   __Pyx_GOTREF(__pyx_tuple__11);
04721   __Pyx_GIVEREF(__pyx_tuple__11);
04722 
04723   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":995
04724  *         _import_umath()
04725  *     except Exception:
04726  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
04727  * 
04728  * cdef inline int import_ufunc() except -1:
04729  */
04730   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 995, __pyx_L1_error)
04731   __Pyx_GOTREF(__pyx_tuple__12);
04732   __Pyx_GIVEREF(__pyx_tuple__12);
04733 
04734   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":1001
04735  *         _import_umath()
04736  *     except Exception:
04737  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
04738  */
04739   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 1001, __pyx_L1_error)
04740   __Pyx_GOTREF(__pyx_tuple__13);
04741   __Pyx_GIVEREF(__pyx_tuple__13);
04742 
04743   /* "gpu_nms.pyx":16
04744  *     void _nms(np.int32_t*, int*, np.float32_t*, int, int, float, int)
04745  * 
04746  * def gpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh,             # <<<<<<<<<<<<<<
04747  *             np.int32_t device_id=0):
04748  *     cdef int boxes_num = dets.shape[0]
04749  */
04750   __pyx_tuple__14 = PyTuple_Pack(10, __pyx_n_s_dets, __pyx_n_s_thresh, __pyx_n_s_device_id, __pyx_n_s_boxes_num, __pyx_n_s_boxes_dim, __pyx_n_s_num_out, __pyx_n_s_keep, __pyx_n_s_scores, __pyx_n_s_order, __pyx_n_s_sorted_dets); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 16, __pyx_L1_error)
04751   __Pyx_GOTREF(__pyx_tuple__14);
04752   __Pyx_GIVEREF(__pyx_tuple__14);
04753   __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_andrewsilva_Deformable_Con, __pyx_n_s_gpu_nms, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 16, __pyx_L1_error)
04754   __Pyx_RefNannyFinishContext();
04755   return 0;
04756   __pyx_L1_error:;
04757   __Pyx_RefNannyFinishContext();
04758   return -1;
04759 }
04760 
04761 static int __Pyx_InitGlobals(void) {
04762   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
04763   __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
04764   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
04765   return 0;
04766   __pyx_L1_error:;
04767   return -1;
04768 }
04769 
04770 #if PY_MAJOR_VERSION < 3
04771 PyMODINIT_FUNC initgpu_nms(void); /*proto*/
04772 PyMODINIT_FUNC initgpu_nms(void)
04773 #else
04774 PyMODINIT_FUNC PyInit_gpu_nms(void); /*proto*/
04775 PyMODINIT_FUNC PyInit_gpu_nms(void)
04776 #endif
04777 {
04778   PyObject *__pyx_t_1 = NULL;
04779   __Pyx_RefNannyDeclarations
04780   #if CYTHON_REFNANNY
04781   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
04782   if (!__Pyx_RefNanny) {
04783       PyErr_Clear();
04784       __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
04785       if (!__Pyx_RefNanny)
04786           Py_FatalError("failed to import 'refnanny' module");
04787   }
04788   #endif
04789   __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_gpu_nms(void)", 0);
04790   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04791   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
04792   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
04793   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
04794   #ifdef __Pyx_CyFunction_USED
04795   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04796   #endif
04797   #ifdef __Pyx_FusedFunction_USED
04798   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04799   #endif
04800   #ifdef __Pyx_Coroutine_USED
04801   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04802   #endif
04803   #ifdef __Pyx_Generator_USED
04804   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04805   #endif
04806   #ifdef __Pyx_StopAsyncIteration_USED
04807   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04808   #endif
04809   /*--- Library function declarations ---*/
04810   /*--- Threads initialization code ---*/
04811   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
04812   #ifdef WITH_THREAD /* Python build with threading support? */
04813   PyEval_InitThreads();
04814   #endif
04815   #endif
04816   /*--- Module creation code ---*/
04817   #if PY_MAJOR_VERSION < 3
04818   __pyx_m = Py_InitModule4("gpu_nms", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
04819   #else
04820   __pyx_m = PyModule_Create(&__pyx_moduledef);
04821   #endif
04822   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
04823   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
04824   Py_INCREF(__pyx_d);
04825   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
04826   #if CYTHON_COMPILING_IN_PYPY
04827   Py_INCREF(__pyx_b);
04828   #endif
04829   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
04830   /*--- Initialize various global constants etc. ---*/
04831   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04832   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
04833   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04834   #endif
04835   if (__pyx_module_is_main_gpu_nms) {
04836     if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04837   }
04838   #if PY_MAJOR_VERSION >= 3
04839   {
04840     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
04841     if (!PyDict_GetItemString(modules, "gpu_nms")) {
04842       if (unlikely(PyDict_SetItemString(modules, "gpu_nms", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
04843     }
04844   }
04845   #endif
04846   /*--- Builtin init code ---*/
04847   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04848   /*--- Constants init code ---*/
04849   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04850   /*--- Global init code ---*/
04851   /*--- Variable export code ---*/
04852   /*--- Function export code ---*/
04853   /*--- Type init code ---*/
04854   /*--- Type import code ---*/
04855   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
04856   #if CYTHON_COMPILING_IN_PYPY
04857   sizeof(PyTypeObject),
04858   #else
04859   sizeof(PyHeapTypeObject),
04860   #endif
04861   0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error)
04862   __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)
04863   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 168, __pyx_L1_error)
04864   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 172, __pyx_L1_error)
04865   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 181, __pyx_L1_error)
04866   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 861, __pyx_L1_error)
04867   /*--- Variable import code ---*/
04868   /*--- Function import code ---*/
04869   /*--- Execution code ---*/
04870   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
04871   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04872   #endif
04873 
04874   /* "gpu_nms.pyx":8
04875  * # --------------------------------------------------------
04876  * 
04877  * import numpy as np             # <<<<<<<<<<<<<<
04878  * cimport numpy as np
04879  * 
04880  */
04881   __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
04882   __Pyx_GOTREF(__pyx_t_1);
04883   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
04884   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
04885 
04886   /* "gpu_nms.pyx":11
04887  * cimport numpy as np
04888  * 
04889  * assert sizeof(int) == sizeof(np.int32_t)             # <<<<<<<<<<<<<<
04890  * 
04891  * cdef extern from "gpu_nms.hpp":
04892  */
04893   #ifndef CYTHON_WITHOUT_ASSERTIONS
04894   if (unlikely(!Py_OptimizeFlag)) {
04895     if (unlikely(!(((sizeof(int)) == (sizeof(__pyx_t_5numpy_int32_t))) != 0))) {
04896       PyErr_SetNone(PyExc_AssertionError);
04897       __PYX_ERR(0, 11, __pyx_L1_error)
04898     }
04899   }
04900   #endif
04901 
04902   /* "gpu_nms.pyx":16
04903  *     void _nms(np.int32_t*, int*, np.float32_t*, int, int, float, int)
04904  * 
04905  * def gpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh,             # <<<<<<<<<<<<<<
04906  *             np.int32_t device_id=0):
04907  *     cdef int boxes_num = dets.shape[0]
04908  */
04909   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7gpu_nms_1gpu_nms, NULL, __pyx_n_s_gpu_nms); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
04910   __Pyx_GOTREF(__pyx_t_1);
04911   if (PyDict_SetItem(__pyx_d, __pyx_n_s_gpu_nms, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
04912   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
04913 
04914   /* "gpu_nms.pyx":1
04915  * # --------------------------------------------------------             # <<<<<<<<<<<<<<
04916  * # Deformable Convolutional Networks
04917  * # Copyright (c) 2015 Microsoft
04918  */
04919   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
04920   __Pyx_GOTREF(__pyx_t_1);
04921   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
04922   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
04923 
04924   /* "../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":997
04925  *         raise ImportError("numpy.core.umath failed to import")
04926  * 
04927  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
04928  *     try:
04929  *         _import_umath()
04930  */
04931 
04932   /*--- Wrapped vars code ---*/
04933 
04934   goto __pyx_L0;
04935   __pyx_L1_error:;
04936   __Pyx_XDECREF(__pyx_t_1);
04937   if (__pyx_m) {
04938     if (__pyx_d) {
04939       __Pyx_AddTraceback("init gpu_nms", __pyx_clineno, __pyx_lineno, __pyx_filename);
04940     }
04941     Py_DECREF(__pyx_m); __pyx_m = 0;
04942   } else if (!PyErr_Occurred()) {
04943     PyErr_SetString(PyExc_ImportError, "init gpu_nms");
04944   }
04945   __pyx_L0:;
04946   __Pyx_RefNannyFinishContext();
04947   #if PY_MAJOR_VERSION < 3
04948   return;
04949   #else
04950   return __pyx_m;
04951   #endif
04952 }
04953 
04954 /* --- Runtime support code --- */
04955 /* Refnanny */
04956 #if CYTHON_REFNANNY
04957 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
04958     PyObject *m = NULL, *p = NULL;
04959     void *r = NULL;
04960     m = PyImport_ImportModule((char *)modname);
04961     if (!m) goto end;
04962     p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
04963     if (!p) goto end;
04964     r = PyLong_AsVoidPtr(p);
04965 end:
04966     Py_XDECREF(p);
04967     Py_XDECREF(m);
04968     return (__Pyx_RefNannyAPIStruct *)r;
04969 }
04970 #endif
04971 
04972 /* RaiseArgTupleInvalid */
04973 static void __Pyx_RaiseArgtupleInvalid(
04974     const char* func_name,
04975     int exact,
04976     Py_ssize_t num_min,
04977     Py_ssize_t num_max,
04978     Py_ssize_t num_found)
04979 {
04980     Py_ssize_t num_expected;
04981     const char *more_or_less;
04982     if (num_found < num_min) {
04983         num_expected = num_min;
04984         more_or_less = "at least";
04985     } else {
04986         num_expected = num_max;
04987         more_or_less = "at most";
04988     }
04989     if (exact) {
04990         more_or_less = "exactly";
04991     }
04992     PyErr_Format(PyExc_TypeError,
04993                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
04994                  func_name, more_or_less, num_expected,
04995                  (num_expected == 1) ? "" : "s", num_found);
04996 }
04997 
04998 /* RaiseDoubleKeywords */
04999 static void __Pyx_RaiseDoubleKeywordsError(
05000     const char* func_name,
05001     PyObject* kw_name)
05002 {
05003     PyErr_Format(PyExc_TypeError,
05004         #if PY_MAJOR_VERSION >= 3
05005         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
05006         #else
05007         "%s() got multiple values for keyword argument '%s'", func_name,
05008         PyString_AsString(kw_name));
05009         #endif
05010 }
05011 
05012 /* ParseKeywords */
05013 static int __Pyx_ParseOptionalKeywords(
05014     PyObject *kwds,
05015     PyObject **argnames[],
05016     PyObject *kwds2,
05017     PyObject *values[],
05018     Py_ssize_t num_pos_args,
05019     const char* function_name)
05020 {
05021     PyObject *key = 0, *value = 0;
05022     Py_ssize_t pos = 0;
05023     PyObject*** name;
05024     PyObject*** first_kw_arg = argnames + num_pos_args;
05025     while (PyDict_Next(kwds, &pos, &key, &value)) {
05026         name = first_kw_arg;
05027         while (*name && (**name != key)) name++;
05028         if (*name) {
05029             values[name-argnames] = value;
05030             continue;
05031         }
05032         name = first_kw_arg;
05033         #if PY_MAJOR_VERSION < 3
05034         if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
05035             while (*name) {
05036                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
05037                         && _PyString_Eq(**name, key)) {
05038                     values[name-argnames] = value;
05039                     break;
05040                 }
05041                 name++;
05042             }
05043             if (*name) continue;
05044             else {
05045                 PyObject*** argname = argnames;
05046                 while (argname != first_kw_arg) {
05047                     if ((**argname == key) || (
05048                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
05049                              && _PyString_Eq(**argname, key))) {
05050                         goto arg_passed_twice;
05051                     }
05052                     argname++;
05053                 }
05054             }
05055         } else
05056         #endif
05057         if (likely(PyUnicode_Check(key))) {
05058             while (*name) {
05059                 int cmp = (**name == key) ? 0 :
05060                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
05061                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
05062                 #endif
05063                     PyUnicode_Compare(**name, key);
05064                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
05065                 if (cmp == 0) {
05066                     values[name-argnames] = value;
05067                     break;
05068                 }
05069                 name++;
05070             }
05071             if (*name) continue;
05072             else {
05073                 PyObject*** argname = argnames;
05074                 while (argname != first_kw_arg) {
05075                     int cmp = (**argname == key) ? 0 :
05076                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
05077                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
05078                     #endif
05079                         PyUnicode_Compare(**argname, key);
05080                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
05081                     if (cmp == 0) goto arg_passed_twice;
05082                     argname++;
05083                 }
05084             }
05085         } else
05086             goto invalid_keyword_type;
05087         if (kwds2) {
05088             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
05089         } else {
05090             goto invalid_keyword;
05091         }
05092     }
05093     return 0;
05094 arg_passed_twice:
05095     __Pyx_RaiseDoubleKeywordsError(function_name, key);
05096     goto bad;
05097 invalid_keyword_type:
05098     PyErr_Format(PyExc_TypeError,
05099         "%.200s() keywords must be strings", function_name);
05100     goto bad;
05101 invalid_keyword:
05102     PyErr_Format(PyExc_TypeError,
05103     #if PY_MAJOR_VERSION < 3
05104         "%.200s() got an unexpected keyword argument '%.200s'",
05105         function_name, PyString_AsString(key));
05106     #else
05107         "%s() got an unexpected keyword argument '%U'",
05108         function_name, key);
05109     #endif
05110 bad:
05111     return -1;
05112 }
05113 
05114 /* ArgTypeTest */
05115 static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
05116     PyErr_Format(PyExc_TypeError,
05117         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
05118         name, type->tp_name, Py_TYPE(obj)->tp_name);
05119 }
05120 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
05121     const char *name, int exact)
05122 {
05123     if (unlikely(!type)) {
05124         PyErr_SetString(PyExc_SystemError, "Missing type object");
05125         return 0;
05126     }
05127     if (none_allowed && obj == Py_None) return 1;
05128     else if (exact) {
05129         if (likely(Py_TYPE(obj) == type)) return 1;
05130         #if PY_MAJOR_VERSION == 2
05131         else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
05132         #endif
05133     }
05134     else {
05135         if (likely(PyObject_TypeCheck(obj, type))) return 1;
05136     }
05137     __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
05138     return 0;
05139 }
05140 
05141 /* BufferFormatCheck */
05142 static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
05143   unsigned int n = 1;
05144   return *(unsigned char*)(&n) != 0;
05145 }
05146 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
05147                               __Pyx_BufFmt_StackElem* stack,
05148                               __Pyx_TypeInfo* type) {
05149   stack[0].field = &ctx->root;
05150   stack[0].parent_offset = 0;
05151   ctx->root.type = type;
05152   ctx->root.name = "buffer dtype";
05153   ctx->root.offset = 0;
05154   ctx->head = stack;
05155   ctx->head->field = &ctx->root;
05156   ctx->fmt_offset = 0;
05157   ctx->head->parent_offset = 0;
05158   ctx->new_packmode = '@';
05159   ctx->enc_packmode = '@';
05160   ctx->new_count = 1;
05161   ctx->enc_count = 0;
05162   ctx->enc_type = 0;
05163   ctx->is_complex = 0;
05164   ctx->is_valid_array = 0;
05165   ctx->struct_alignment = 0;
05166   while (type->typegroup == 'S') {
05167     ++ctx->head;
05168     ctx->head->field = type->fields;
05169     ctx->head->parent_offset = 0;
05170     type = type->fields->type;
05171   }
05172 }
05173 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
05174     int count;
05175     const char* t = *ts;
05176     if (*t < '0' || *t > '9') {
05177       return -1;
05178     } else {
05179         count = *t++ - '0';
05180         while (*t >= '0' && *t < '9') {
05181             count *= 10;
05182             count += *t++ - '0';
05183         }
05184     }
05185     *ts = t;
05186     return count;
05187 }
05188 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
05189     int number = __Pyx_BufFmt_ParseNumber(ts);
05190     if (number == -1)
05191         PyErr_Format(PyExc_ValueError,\
05192                      "Does not understand character buffer dtype format string ('%c')", **ts);
05193     return number;
05194 }
05195 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
05196   PyErr_Format(PyExc_ValueError,
05197                "Unexpected format string character: '%c'", ch);
05198 }
05199 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
05200   switch (ch) {
05201     case 'c': return "'char'";
05202     case 'b': return "'signed char'";
05203     case 'B': return "'unsigned char'";
05204     case 'h': return "'short'";
05205     case 'H': return "'unsigned short'";
05206     case 'i': return "'int'";
05207     case 'I': return "'unsigned int'";
05208     case 'l': return "'long'";
05209     case 'L': return "'unsigned long'";
05210     case 'q': return "'long long'";
05211     case 'Q': return "'unsigned long long'";
05212     case 'f': return (is_complex ? "'complex float'" : "'float'");
05213     case 'd': return (is_complex ? "'complex double'" : "'double'");
05214     case 'g': return (is_complex ? "'complex long double'" : "'long double'");
05215     case 'T': return "a struct";
05216     case 'O': return "Python object";
05217     case 'P': return "a pointer";
05218     case 's': case 'p': return "a string";
05219     case 0: return "end";
05220     default: return "unparseable format string";
05221   }
05222 }
05223 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
05224   switch (ch) {
05225     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
05226     case 'h': case 'H': return 2;
05227     case 'i': case 'I': case 'l': case 'L': return 4;
05228     case 'q': case 'Q': return 8;
05229     case 'f': return (is_complex ? 8 : 4);
05230     case 'd': return (is_complex ? 16 : 8);
05231     case 'g': {
05232       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
05233       return 0;
05234     }
05235     case 'O': case 'P': return sizeof(void*);
05236     default:
05237       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
05238       return 0;
05239     }
05240 }
05241 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
05242   switch (ch) {
05243     case 'c': case 'b': case 'B': case 's': case 'p': return 1;
05244     case 'h': case 'H': return sizeof(short);
05245     case 'i': case 'I': return sizeof(int);
05246     case 'l': case 'L': return sizeof(long);
05247     #ifdef HAVE_LONG_LONG
05248     case 'q': case 'Q': return sizeof(PY_LONG_LONG);
05249     #endif
05250     case 'f': return sizeof(float) * (is_complex ? 2 : 1);
05251     case 'd': return sizeof(double) * (is_complex ? 2 : 1);
05252     case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
05253     case 'O': case 'P': return sizeof(void*);
05254     default: {
05255       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
05256       return 0;
05257     }
05258   }
05259 }
05260 typedef struct { char c; short x; } __Pyx_st_short;
05261 typedef struct { char c; int x; } __Pyx_st_int;
05262 typedef struct { char c; long x; } __Pyx_st_long;
05263 typedef struct { char c; float x; } __Pyx_st_float;
05264 typedef struct { char c; double x; } __Pyx_st_double;
05265 typedef struct { char c; long double x; } __Pyx_st_longdouble;
05266 typedef struct { char c; void *x; } __Pyx_st_void_p;
05267 #ifdef HAVE_LONG_LONG
05268 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
05269 #endif
05270 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
05271   switch (ch) {
05272     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
05273     case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
05274     case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
05275     case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
05276 #ifdef HAVE_LONG_LONG
05277     case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
05278 #endif
05279     case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
05280     case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
05281     case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
05282     case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
05283     default:
05284       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
05285       return 0;
05286     }
05287 }
05288 /* These are for computing the padding at the end of the struct to align
05289    on the first member of the struct. This will probably the same as above,
05290    but we don't have any guarantees.
05291  */
05292 typedef struct { short x; char c; } __Pyx_pad_short;
05293 typedef struct { int x; char c; } __Pyx_pad_int;
05294 typedef struct { long x; char c; } __Pyx_pad_long;
05295 typedef struct { float x; char c; } __Pyx_pad_float;
05296 typedef struct { double x; char c; } __Pyx_pad_double;
05297 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
05298 typedef struct { void *x; char c; } __Pyx_pad_void_p;
05299 #ifdef HAVE_LONG_LONG
05300 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
05301 #endif
05302 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
05303   switch (ch) {
05304     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
05305     case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
05306     case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
05307     case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
05308 #ifdef HAVE_LONG_LONG
05309     case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
05310 #endif
05311     case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
05312     case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
05313     case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
05314     case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
05315     default:
05316       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
05317       return 0;
05318     }
05319 }
05320 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
05321   switch (ch) {
05322     case 'c':
05323         return 'H';
05324     case 'b': case 'h': case 'i':
05325     case 'l': case 'q': case 's': case 'p':
05326         return 'I';
05327     case 'B': case 'H': case 'I': case 'L': case 'Q':
05328         return 'U';
05329     case 'f': case 'd': case 'g':
05330         return (is_complex ? 'C' : 'R');
05331     case 'O':
05332         return 'O';
05333     case 'P':
05334         return 'P';
05335     default: {
05336       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
05337       return 0;
05338     }
05339   }
05340 }
05341 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
05342   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
05343     const char* expected;
05344     const char* quote;
05345     if (ctx->head == NULL) {
05346       expected = "end";
05347       quote = "";
05348     } else {
05349       expected = ctx->head->field->type->name;
05350       quote = "'";
05351     }
05352     PyErr_Format(PyExc_ValueError,
05353                  "Buffer dtype mismatch, expected %s%s%s but got %s",
05354                  quote, expected, quote,
05355                  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
05356   } else {
05357     __Pyx_StructField* field = ctx->head->field;
05358     __Pyx_StructField* parent = (ctx->head - 1)->field;
05359     PyErr_Format(PyExc_ValueError,
05360                  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
05361                  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
05362                  parent->type->name, field->name);
05363   }
05364 }
05365 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
05366   char group;
05367   size_t size, offset, arraysize = 1;
05368   if (ctx->enc_type == 0) return 0;
05369   if (ctx->head->field->type->arraysize[0]) {
05370     int i, ndim = 0;
05371     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
05372         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
05373         ndim = 1;
05374         if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
05375             PyErr_Format(PyExc_ValueError,
05376                          "Expected a dimension of size %zu, got %zu",
05377                          ctx->head->field->type->arraysize[0], ctx->enc_count);
05378             return -1;
05379         }
05380     }
05381     if (!ctx->is_valid_array) {
05382       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
05383                    ctx->head->field->type->ndim, ndim);
05384       return -1;
05385     }
05386     for (i = 0; i < ctx->head->field->type->ndim; i++) {
05387       arraysize *= ctx->head->field->type->arraysize[i];
05388     }
05389     ctx->is_valid_array = 0;
05390     ctx->enc_count = 1;
05391   }
05392   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
05393   do {
05394     __Pyx_StructField* field = ctx->head->field;
05395     __Pyx_TypeInfo* type = field->type;
05396     if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
05397       size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
05398     } else {
05399       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
05400     }
05401     if (ctx->enc_packmode == '@') {
05402       size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
05403       size_t align_mod_offset;
05404       if (align_at == 0) return -1;
05405       align_mod_offset = ctx->fmt_offset % align_at;
05406       if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
05407       if (ctx->struct_alignment == 0)
05408           ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
05409                                                                  ctx->is_complex);
05410     }
05411     if (type->size != size || type->typegroup != group) {
05412       if (type->typegroup == 'C' && type->fields != NULL) {
05413         size_t parent_offset = ctx->head->parent_offset + field->offset;
05414         ++ctx->head;
05415         ctx->head->field = type->fields;
05416         ctx->head->parent_offset = parent_offset;
05417         continue;
05418       }
05419       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
05420       } else {
05421           __Pyx_BufFmt_RaiseExpected(ctx);
05422           return -1;
05423       }
05424     }
05425     offset = ctx->head->parent_offset + field->offset;
05426     if (ctx->fmt_offset != offset) {
05427       PyErr_Format(PyExc_ValueError,
05428                    "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
05429                    (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
05430       return -1;
05431     }
05432     ctx->fmt_offset += size;
05433     if (arraysize)
05434       ctx->fmt_offset += (arraysize - 1) * size;
05435     --ctx->enc_count;
05436     while (1) {
05437       if (field == &ctx->root) {
05438         ctx->head = NULL;
05439         if (ctx->enc_count != 0) {
05440           __Pyx_BufFmt_RaiseExpected(ctx);
05441           return -1;
05442         }
05443         break;
05444       }
05445       ctx->head->field = ++field;
05446       if (field->type == NULL) {
05447         --ctx->head;
05448         field = ctx->head->field;
05449         continue;
05450       } else if (field->type->typegroup == 'S') {
05451         size_t parent_offset = ctx->head->parent_offset + field->offset;
05452         if (field->type->fields->type == NULL) continue;
05453         field = field->type->fields;
05454         ++ctx->head;
05455         ctx->head->field = field;
05456         ctx->head->parent_offset = parent_offset;
05457         break;
05458       } else {
05459         break;
05460       }
05461     }
05462   } while (ctx->enc_count);
05463   ctx->enc_type = 0;
05464   ctx->is_complex = 0;
05465   return 0;
05466 }
05467 static CYTHON_INLINE PyObject *
05468 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
05469 {
05470     const char *ts = *tsp;
05471     int i = 0, number;
05472     int ndim = ctx->head->field->type->ndim;
05473 ;
05474     ++ts;
05475     if (ctx->new_count != 1) {
05476         PyErr_SetString(PyExc_ValueError,
05477                         "Cannot handle repeated arrays in format string");
05478         return NULL;
05479     }
05480     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
05481     while (*ts && *ts != ')') {
05482         switch (*ts) {
05483             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
05484             default:  break;
05485         }
05486         number = __Pyx_BufFmt_ExpectNumber(&ts);
05487         if (number == -1) return NULL;
05488         if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
05489             return PyErr_Format(PyExc_ValueError,
05490                         "Expected a dimension of size %zu, got %d",
05491                         ctx->head->field->type->arraysize[i], number);
05492         if (*ts != ',' && *ts != ')')
05493             return PyErr_Format(PyExc_ValueError,
05494                                 "Expected a comma in format string, got '%c'", *ts);
05495         if (*ts == ',') ts++;
05496         i++;
05497     }
05498     if (i != ndim)
05499         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
05500                             ctx->head->field->type->ndim, i);
05501     if (!*ts) {
05502         PyErr_SetString(PyExc_ValueError,
05503                         "Unexpected end of format string, expected ')'");
05504         return NULL;
05505     }
05506     ctx->is_valid_array = 1;
05507     ctx->new_count = 1;
05508     *tsp = ++ts;
05509     return Py_None;
05510 }
05511 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
05512   int got_Z = 0;
05513   while (1) {
05514     switch(*ts) {
05515       case 0:
05516         if (ctx->enc_type != 0 && ctx->head == NULL) {
05517           __Pyx_BufFmt_RaiseExpected(ctx);
05518           return NULL;
05519         }
05520         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
05521         if (ctx->head != NULL) {
05522           __Pyx_BufFmt_RaiseExpected(ctx);
05523           return NULL;
05524         }
05525         return ts;
05526       case ' ':
05527       case '\r':
05528       case '\n':
05529         ++ts;
05530         break;
05531       case '<':
05532         if (!__Pyx_IsLittleEndian()) {
05533           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
05534           return NULL;
05535         }
05536         ctx->new_packmode = '=';
05537         ++ts;
05538         break;
05539       case '>':
05540       case '!':
05541         if (__Pyx_IsLittleEndian()) {
05542           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
05543           return NULL;
05544         }
05545         ctx->new_packmode = '=';
05546         ++ts;
05547         break;
05548       case '=':
05549       case '@':
05550       case '^':
05551         ctx->new_packmode = *ts++;
05552         break;
05553       case 'T':
05554         {
05555           const char* ts_after_sub;
05556           size_t i, struct_count = ctx->new_count;
05557           size_t struct_alignment = ctx->struct_alignment;
05558           ctx->new_count = 1;
05559           ++ts;
05560           if (*ts != '{') {
05561             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
05562             return NULL;
05563           }
05564           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
05565           ctx->enc_type = 0;
05566           ctx->enc_count = 0;
05567           ctx->struct_alignment = 0;
05568           ++ts;
05569           ts_after_sub = ts;
05570           for (i = 0; i != struct_count; ++i) {
05571             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
05572             if (!ts_after_sub) return NULL;
05573           }
05574           ts = ts_after_sub;
05575           if (struct_alignment) ctx->struct_alignment = struct_alignment;
05576         }
05577         break;
05578       case '}':
05579         {
05580           size_t alignment = ctx->struct_alignment;
05581           ++ts;
05582           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
05583           ctx->enc_type = 0;
05584           if (alignment && ctx->fmt_offset % alignment) {
05585             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
05586           }
05587         }
05588         return ts;
05589       case 'x':
05590         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
05591         ctx->fmt_offset += ctx->new_count;
05592         ctx->new_count = 1;
05593         ctx->enc_count = 0;
05594         ctx->enc_type = 0;
05595         ctx->enc_packmode = ctx->new_packmode;
05596         ++ts;
05597         break;
05598       case 'Z':
05599         got_Z = 1;
05600         ++ts;
05601         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
05602           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
05603           return NULL;
05604         }
05605       case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
05606       case 'l': case 'L': case 'q': case 'Q':
05607       case 'f': case 'd': case 'g':
05608       case 'O': case 'p':
05609         if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
05610             ctx->enc_packmode == ctx->new_packmode) {
05611           ctx->enc_count += ctx->new_count;
05612           ctx->new_count = 1;
05613           got_Z = 0;
05614           ++ts;
05615           break;
05616         }
05617       case 's':
05618         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
05619         ctx->enc_count = ctx->new_count;
05620         ctx->enc_packmode = ctx->new_packmode;
05621         ctx->enc_type = *ts;
05622         ctx->is_complex = got_Z;
05623         ++ts;
05624         ctx->new_count = 1;
05625         got_Z = 0;
05626         break;
05627       case ':':
05628         ++ts;
05629         while(*ts != ':') ++ts;
05630         ++ts;
05631         break;
05632       case '(':
05633         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
05634         break;
05635       default:
05636         {
05637           int number = __Pyx_BufFmt_ExpectNumber(&ts);
05638           if (number == -1) return NULL;
05639           ctx->new_count = (size_t)number;
05640         }
05641     }
05642   }
05643 }
05644 static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
05645   buf->buf = NULL;
05646   buf->obj = NULL;
05647   buf->strides = __Pyx_zeros;
05648   buf->shape = __Pyx_zeros;
05649   buf->suboffsets = __Pyx_minusones;
05650 }
05651 static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
05652         Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
05653         int nd, int cast, __Pyx_BufFmt_StackElem* stack)
05654 {
05655   if (obj == Py_None || obj == NULL) {
05656     __Pyx_ZeroBuffer(buf);
05657     return 0;
05658   }
05659   buf->buf = NULL;
05660   if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
05661   if (buf->ndim != nd) {
05662     PyErr_Format(PyExc_ValueError,
05663                  "Buffer has wrong number of dimensions (expected %d, got %d)",
05664                  nd, buf->ndim);
05665     goto fail;
05666   }
05667   if (!cast) {
05668     __Pyx_BufFmt_Context ctx;
05669     __Pyx_BufFmt_Init(&ctx, stack, dtype);
05670     if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
05671   }
05672   if ((unsigned)buf->itemsize != dtype->size) {
05673     PyErr_Format(PyExc_ValueError,
05674       "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
05675       buf->itemsize, (buf->itemsize > 1) ? "s" : "",
05676       dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
05677     goto fail;
05678   }
05679   if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
05680   return 0;
05681 fail:;
05682   __Pyx_ZeroBuffer(buf);
05683   return -1;
05684 }
05685 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
05686   if (info->buf == NULL) return;
05687   if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
05688   __Pyx_ReleaseBuffer(info);
05689 }
05690 
05691 /* GetBuiltinName */
05692   static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
05693     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
05694     if (unlikely(!result)) {
05695         PyErr_Format(PyExc_NameError,
05696 #if PY_MAJOR_VERSION >= 3
05697             "name '%U' is not defined", name);
05698 #else
05699             "name '%.200s' is not defined", PyString_AS_STRING(name));
05700 #endif
05701     }
05702     return result;
05703 }
05704 
05705 /* GetModuleGlobalName */
05706   static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
05707     PyObject *result;
05708 #if !CYTHON_AVOID_BORROWED_REFS
05709     result = PyDict_GetItem(__pyx_d, name);
05710     if (likely(result)) {
05711         Py_INCREF(result);
05712     } else {
05713 #else
05714     result = PyObject_GetItem(__pyx_d, name);
05715     if (!result) {
05716         PyErr_Clear();
05717 #endif
05718         result = __Pyx_GetBuiltinName(name);
05719     }
05720     return result;
05721 }
05722 
05723 /* PyObjectCall */
05724     #if CYTHON_COMPILING_IN_CPYTHON
05725 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
05726     PyObject *result;
05727     ternaryfunc call = func->ob_type->tp_call;
05728     if (unlikely(!call))
05729         return PyObject_Call(func, arg, kw);
05730     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
05731         return NULL;
05732     result = (*call)(func, arg, kw);
05733     Py_LeaveRecursiveCall();
05734     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
05735         PyErr_SetString(
05736             PyExc_SystemError,
05737             "NULL result without error in PyObject_Call");
05738     }
05739     return result;
05740 }
05741 #endif
05742 
05743 /* ExtTypeTest */
05744     static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
05745     if (unlikely(!type)) {
05746         PyErr_SetString(PyExc_SystemError, "Missing type object");
05747         return 0;
05748     }
05749     if (likely(PyObject_TypeCheck(obj, type)))
05750         return 1;
05751     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
05752                  Py_TYPE(obj)->tp_name, type->tp_name);
05753     return 0;
05754 }
05755 
05756 /* PyCFunctionFastCall */
05757     #if CYTHON_FAST_PYCCALL
05758 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
05759     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
05760     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
05761     PyObject *self = PyCFunction_GET_SELF(func);
05762     assert(PyCFunction_Check(func));
05763     assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
05764     assert(nargs >= 0);
05765     assert(nargs == 0 || args != NULL);
05766     /* _PyCFunction_FastCallDict() must not be called with an exception set,
05767        because it may clear it (directly or indirectly) and so the
05768        caller loses its exception */
05769     assert(!PyErr_Occurred());
05770     return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
05771 }
05772 #endif  // CYTHON_FAST_PYCCALL
05773 
05774 /* PyFunctionFastCall */
05775     #if CYTHON_FAST_PYCALL
05776 #include "frameobject.h"
05777 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
05778                                                PyObject *globals) {
05779     PyFrameObject *f;
05780     PyThreadState *tstate = PyThreadState_GET();
05781     PyObject **fastlocals;
05782     Py_ssize_t i;
05783     PyObject *result;
05784     assert(globals != NULL);
05785     /* XXX Perhaps we should create a specialized
05786        PyFrame_New() that doesn't take locals, but does
05787        take builtins without sanity checking them.
05788        */
05789     assert(tstate != NULL);
05790     f = PyFrame_New(tstate, co, globals, NULL);
05791     if (f == NULL) {
05792         return NULL;
05793     }
05794     fastlocals = f->f_localsplus;
05795     for (i = 0; i < na; i++) {
05796         Py_INCREF(*args);
05797         fastlocals[i] = *args++;
05798     }
05799     result = PyEval_EvalFrameEx(f,0);
05800     ++tstate->recursion_depth;
05801     Py_DECREF(f);
05802     --tstate->recursion_depth;
05803     return result;
05804 }
05805 #if 1 || PY_VERSION_HEX < 0x030600B1
05806 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
05807     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
05808     PyObject *globals = PyFunction_GET_GLOBALS(func);
05809     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
05810     PyObject *closure;
05811 #if PY_MAJOR_VERSION >= 3
05812     PyObject *kwdefs;
05813 #endif
05814     PyObject *kwtuple, **k;
05815     PyObject **d;
05816     Py_ssize_t nd;
05817     Py_ssize_t nk;
05818     PyObject *result;
05819     assert(kwargs == NULL || PyDict_Check(kwargs));
05820     nk = kwargs ? PyDict_Size(kwargs) : 0;
05821     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
05822         return NULL;
05823     }
05824     if (
05825 #if PY_MAJOR_VERSION >= 3
05826             co->co_kwonlyargcount == 0 &&
05827 #endif
05828             likely(kwargs == NULL || nk == 0) &&
05829             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
05830         if (argdefs == NULL && co->co_argcount == nargs) {
05831             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
05832             goto done;
05833         }
05834         else if (nargs == 0 && argdefs != NULL
05835                  && co->co_argcount == Py_SIZE(argdefs)) {
05836             /* function called with no arguments, but all parameters have
05837                a default value: use default values as arguments .*/
05838             args = &PyTuple_GET_ITEM(argdefs, 0);
05839             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
05840             goto done;
05841         }
05842     }
05843     if (kwargs != NULL) {
05844         Py_ssize_t pos, i;
05845         kwtuple = PyTuple_New(2 * nk);
05846         if (kwtuple == NULL) {
05847             result = NULL;
05848             goto done;
05849         }
05850         k = &PyTuple_GET_ITEM(kwtuple, 0);
05851         pos = i = 0;
05852         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
05853             Py_INCREF(k[i]);
05854             Py_INCREF(k[i+1]);
05855             i += 2;
05856         }
05857         nk = i / 2;
05858     }
05859     else {
05860         kwtuple = NULL;
05861         k = NULL;
05862     }
05863     closure = PyFunction_GET_CLOSURE(func);
05864 #if PY_MAJOR_VERSION >= 3
05865     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
05866 #endif
05867     if (argdefs != NULL) {
05868         d = &PyTuple_GET_ITEM(argdefs, 0);
05869         nd = Py_SIZE(argdefs);
05870     }
05871     else {
05872         d = NULL;
05873         nd = 0;
05874     }
05875 #if PY_MAJOR_VERSION >= 3
05876     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
05877                                args, nargs,
05878                                k, (int)nk,
05879                                d, (int)nd, kwdefs, closure);
05880 #else
05881     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
05882                                args, nargs,
05883                                k, (int)nk,
05884                                d, (int)nd, closure);
05885 #endif
05886     Py_XDECREF(kwtuple);
05887 done:
05888     Py_LeaveRecursiveCall();
05889     return result;
05890 }
05891 #endif  // CPython < 3.6
05892 #endif  // CYTHON_FAST_PYCALL
05893 
05894 /* PyObjectCallMethO */
05895     #if CYTHON_COMPILING_IN_CPYTHON
05896 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
05897     PyObject *self, *result;
05898     PyCFunction cfunc;
05899     cfunc = PyCFunction_GET_FUNCTION(func);
05900     self = PyCFunction_GET_SELF(func);
05901     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
05902         return NULL;
05903     result = cfunc(self, arg);
05904     Py_LeaveRecursiveCall();
05905     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
05906         PyErr_SetString(
05907             PyExc_SystemError,
05908             "NULL result without error in PyObject_Call");
05909     }
05910     return result;
05911 }
05912 #endif
05913 
05914 /* PyObjectCallOneArg */
05915     #if CYTHON_COMPILING_IN_CPYTHON
05916 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
05917     PyObject *result;
05918     PyObject *args = PyTuple_New(1);
05919     if (unlikely(!args)) return NULL;
05920     Py_INCREF(arg);
05921     PyTuple_SET_ITEM(args, 0, arg);
05922     result = __Pyx_PyObject_Call(func, args, NULL);
05923     Py_DECREF(args);
05924     return result;
05925 }
05926 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
05927 #if CYTHON_FAST_PYCALL
05928     if (PyFunction_Check(func)) {
05929         return __Pyx_PyFunction_FastCall(func, &arg, 1);
05930     }
05931 #endif
05932 #ifdef __Pyx_CyFunction_USED
05933     if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
05934 #else
05935     if (likely(PyCFunction_Check(func))) {
05936 #endif
05937         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
05938             return __Pyx_PyObject_CallMethO(func, arg);
05939 #if CYTHON_FAST_PYCCALL
05940         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
05941             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
05942 #endif
05943         }
05944     }
05945     return __Pyx__PyObject_CallOneArg(func, arg);
05946 }
05947 #else
05948 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
05949     PyObject *result;
05950     PyObject *args = PyTuple_Pack(1, arg);
05951     if (unlikely(!args)) return NULL;
05952     result = __Pyx_PyObject_Call(func, args, NULL);
05953     Py_DECREF(args);
05954     return result;
05955 }
05956 #endif
05957 
05958 /* PyObjectCallNoArg */
05959       #if CYTHON_COMPILING_IN_CPYTHON
05960 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
05961 #if CYTHON_FAST_PYCALL
05962     if (PyFunction_Check(func)) {
05963         return __Pyx_PyFunction_FastCall(func, NULL, 0);
05964     }
05965 #endif
05966 #ifdef __Pyx_CyFunction_USED
05967     if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
05968 #else
05969     if (likely(PyCFunction_Check(func))) {
05970 #endif
05971         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
05972             return __Pyx_PyObject_CallMethO(func, NULL);
05973         }
05974     }
05975     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
05976 }
05977 #endif
05978 
05979 /* BufferIndexError */
05980         static void __Pyx_RaiseBufferIndexError(int axis) {
05981   PyErr_Format(PyExc_IndexError,
05982      "Out of bounds on buffer access (axis %d)", axis);
05983 }
05984 
05985 /* SliceObject */
05986         static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
05987         Py_ssize_t cstart, Py_ssize_t cstop,
05988         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
05989         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
05990 #if CYTHON_USE_TYPE_SLOTS
05991     PyMappingMethods* mp;
05992 #if PY_MAJOR_VERSION < 3
05993     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
05994     if (likely(ms && ms->sq_slice)) {
05995         if (!has_cstart) {
05996             if (_py_start && (*_py_start != Py_None)) {
05997                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
05998                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
05999             } else
06000                 cstart = 0;
06001         }
06002         if (!has_cstop) {
06003             if (_py_stop && (*_py_stop != Py_None)) {
06004                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
06005                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
06006             } else
06007                 cstop = PY_SSIZE_T_MAX;
06008         }
06009         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
06010             Py_ssize_t l = ms->sq_length(obj);
06011             if (likely(l >= 0)) {
06012                 if (cstop < 0) {
06013                     cstop += l;
06014                     if (cstop < 0) cstop = 0;
06015                 }
06016                 if (cstart < 0) {
06017                     cstart += l;
06018                     if (cstart < 0) cstart = 0;
06019                 }
06020             } else {
06021                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
06022                     goto bad;
06023                 PyErr_Clear();
06024             }
06025         }
06026         return ms->sq_slice(obj, cstart, cstop);
06027     }
06028 #endif
06029     mp = Py_TYPE(obj)->tp_as_mapping;
06030     if (likely(mp && mp->mp_subscript))
06031 #endif
06032     {
06033         PyObject* result;
06034         PyObject *py_slice, *py_start, *py_stop;
06035         if (_py_slice) {
06036             py_slice = *_py_slice;
06037         } else {
06038             PyObject* owned_start = NULL;
06039             PyObject* owned_stop = NULL;
06040             if (_py_start) {
06041                 py_start = *_py_start;
06042             } else {
06043                 if (has_cstart) {
06044                     owned_start = py_start = PyInt_FromSsize_t(cstart);
06045                     if (unlikely(!py_start)) goto bad;
06046                 } else
06047                     py_start = Py_None;
06048             }
06049             if (_py_stop) {
06050                 py_stop = *_py_stop;
06051             } else {
06052                 if (has_cstop) {
06053                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
06054                     if (unlikely(!py_stop)) {
06055                         Py_XDECREF(owned_start);
06056                         goto bad;
06057                     }
06058                 } else
06059                     py_stop = Py_None;
06060             }
06061             py_slice = PySlice_New(py_start, py_stop, Py_None);
06062             Py_XDECREF(owned_start);
06063             Py_XDECREF(owned_stop);
06064             if (unlikely(!py_slice)) goto bad;
06065         }
06066 #if CYTHON_USE_TYPE_SLOTS
06067         result = mp->mp_subscript(obj, py_slice);
06068 #else
06069         result = PyObject_GetItem(obj, py_slice);
06070 #endif
06071         if (!_py_slice) {
06072             Py_DECREF(py_slice);
06073         }
06074         return result;
06075     }
06076     PyErr_Format(PyExc_TypeError,
06077         "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
06078 bad:
06079     return NULL;
06080 }
06081 
06082 /* BufferFallbackError */
06083         static void __Pyx_RaiseBufferFallbackError(void) {
06084   PyErr_SetString(PyExc_ValueError,
06085      "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
06086 }
06087 
06088 /* PyErrFetchRestore */
06089         #if CYTHON_FAST_THREAD_STATE
06090 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
06091     PyObject *tmp_type, *tmp_value, *tmp_tb;
06092     tmp_type = tstate->curexc_type;
06093     tmp_value = tstate->curexc_value;
06094     tmp_tb = tstate->curexc_traceback;
06095     tstate->curexc_type = type;
06096     tstate->curexc_value = value;
06097     tstate->curexc_traceback = tb;
06098     Py_XDECREF(tmp_type);
06099     Py_XDECREF(tmp_value);
06100     Py_XDECREF(tmp_tb);
06101 }
06102 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
06103     *type = tstate->curexc_type;
06104     *value = tstate->curexc_value;
06105     *tb = tstate->curexc_traceback;
06106     tstate->curexc_type = 0;
06107     tstate->curexc_value = 0;
06108     tstate->curexc_traceback = 0;
06109 }
06110 #endif
06111 
06112 /* RaiseException */
06113         #if PY_MAJOR_VERSION < 3
06114 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
06115                         CYTHON_UNUSED PyObject *cause) {
06116     __Pyx_PyThreadState_declare
06117     Py_XINCREF(type);
06118     if (!value || value == Py_None)
06119         value = NULL;
06120     else
06121         Py_INCREF(value);
06122     if (!tb || tb == Py_None)
06123         tb = NULL;
06124     else {
06125         Py_INCREF(tb);
06126         if (!PyTraceBack_Check(tb)) {
06127             PyErr_SetString(PyExc_TypeError,
06128                 "raise: arg 3 must be a traceback or None");
06129             goto raise_error;
06130         }
06131     }
06132     if (PyType_Check(type)) {
06133 #if CYTHON_COMPILING_IN_PYPY
06134         if (!value) {
06135             Py_INCREF(Py_None);
06136             value = Py_None;
06137         }
06138 #endif
06139         PyErr_NormalizeException(&type, &value, &tb);
06140     } else {
06141         if (value) {
06142             PyErr_SetString(PyExc_TypeError,
06143                 "instance exception may not have a separate value");
06144             goto raise_error;
06145         }
06146         value = type;
06147         type = (PyObject*) Py_TYPE(type);
06148         Py_INCREF(type);
06149         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
06150             PyErr_SetString(PyExc_TypeError,
06151                 "raise: exception class must be a subclass of BaseException");
06152             goto raise_error;
06153         }
06154     }
06155     __Pyx_PyThreadState_assign
06156     __Pyx_ErrRestore(type, value, tb);
06157     return;
06158 raise_error:
06159     Py_XDECREF(value);
06160     Py_XDECREF(type);
06161     Py_XDECREF(tb);
06162     return;
06163 }
06164 #else
06165 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
06166     PyObject* owned_instance = NULL;
06167     if (tb == Py_None) {
06168         tb = 0;
06169     } else if (tb && !PyTraceBack_Check(tb)) {
06170         PyErr_SetString(PyExc_TypeError,
06171             "raise: arg 3 must be a traceback or None");
06172         goto bad;
06173     }
06174     if (value == Py_None)
06175         value = 0;
06176     if (PyExceptionInstance_Check(type)) {
06177         if (value) {
06178             PyErr_SetString(PyExc_TypeError,
06179                 "instance exception may not have a separate value");
06180             goto bad;
06181         }
06182         value = type;
06183         type = (PyObject*) Py_TYPE(value);
06184     } else if (PyExceptionClass_Check(type)) {
06185         PyObject *instance_class = NULL;
06186         if (value && PyExceptionInstance_Check(value)) {
06187             instance_class = (PyObject*) Py_TYPE(value);
06188             if (instance_class != type) {
06189                 int is_subclass = PyObject_IsSubclass(instance_class, type);
06190                 if (!is_subclass) {
06191                     instance_class = NULL;
06192                 } else if (unlikely(is_subclass == -1)) {
06193                     goto bad;
06194                 } else {
06195                     type = instance_class;
06196                 }
06197             }
06198         }
06199         if (!instance_class) {
06200             PyObject *args;
06201             if (!value)
06202                 args = PyTuple_New(0);
06203             else if (PyTuple_Check(value)) {
06204                 Py_INCREF(value);
06205                 args = value;
06206             } else
06207                 args = PyTuple_Pack(1, value);
06208             if (!args)
06209                 goto bad;
06210             owned_instance = PyObject_Call(type, args, NULL);
06211             Py_DECREF(args);
06212             if (!owned_instance)
06213                 goto bad;
06214             value = owned_instance;
06215             if (!PyExceptionInstance_Check(value)) {
06216                 PyErr_Format(PyExc_TypeError,
06217                              "calling %R should have returned an instance of "
06218                              "BaseException, not %R",
06219                              type, Py_TYPE(value));
06220                 goto bad;
06221             }
06222         }
06223     } else {
06224         PyErr_SetString(PyExc_TypeError,
06225             "raise: exception class must be a subclass of BaseException");
06226         goto bad;
06227     }
06228 #if PY_VERSION_HEX >= 0x03030000
06229     if (cause) {
06230 #else
06231     if (cause && cause != Py_None) {
06232 #endif
06233         PyObject *fixed_cause;
06234         if (cause == Py_None) {
06235             fixed_cause = NULL;
06236         } else if (PyExceptionClass_Check(cause)) {
06237             fixed_cause = PyObject_CallObject(cause, NULL);
06238             if (fixed_cause == NULL)
06239                 goto bad;
06240         } else if (PyExceptionInstance_Check(cause)) {
06241             fixed_cause = cause;
06242             Py_INCREF(fixed_cause);
06243         } else {
06244             PyErr_SetString(PyExc_TypeError,
06245                             "exception causes must derive from "
06246                             "BaseException");
06247             goto bad;
06248         }
06249         PyException_SetCause(value, fixed_cause);
06250     }
06251     PyErr_SetObject(type, value);
06252     if (tb) {
06253 #if CYTHON_COMPILING_IN_PYPY
06254         PyObject *tmp_type, *tmp_value, *tmp_tb;
06255         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
06256         Py_INCREF(tb);
06257         PyErr_Restore(tmp_type, tmp_value, tb);
06258         Py_XDECREF(tmp_tb);
06259 #else
06260         PyThreadState *tstate = PyThreadState_GET();
06261         PyObject* tmp_tb = tstate->curexc_traceback;
06262         if (tb != tmp_tb) {
06263             Py_INCREF(tb);
06264             tstate->curexc_traceback = tb;
06265             Py_XDECREF(tmp_tb);
06266         }
06267 #endif
06268     }
06269 bad:
06270     Py_XDECREF(owned_instance);
06271     return;
06272 }
06273 #endif
06274 
06275 /* RaiseTooManyValuesToUnpack */
06276           static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
06277     PyErr_Format(PyExc_ValueError,
06278                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
06279 }
06280 
06281 /* RaiseNeedMoreValuesToUnpack */
06282           static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
06283     PyErr_Format(PyExc_ValueError,
06284                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
06285                  index, (index == 1) ? "" : "s");
06286 }
06287 
06288 /* RaiseNoneIterError */
06289           static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
06290     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
06291 }
06292 
06293 /* SaveResetException */
06294           #if CYTHON_FAST_THREAD_STATE
06295 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
06296     *type = tstate->exc_type;
06297     *value = tstate->exc_value;
06298     *tb = tstate->exc_traceback;
06299     Py_XINCREF(*type);
06300     Py_XINCREF(*value);
06301     Py_XINCREF(*tb);
06302 }
06303 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
06304     PyObject *tmp_type, *tmp_value, *tmp_tb;
06305     tmp_type = tstate->exc_type;
06306     tmp_value = tstate->exc_value;
06307     tmp_tb = tstate->exc_traceback;
06308     tstate->exc_type = type;
06309     tstate->exc_value = value;
06310     tstate->exc_traceback = tb;
06311     Py_XDECREF(tmp_type);
06312     Py_XDECREF(tmp_value);
06313     Py_XDECREF(tmp_tb);
06314 }
06315 #endif
06316 
06317 /* PyErrExceptionMatches */
06318           #if CYTHON_FAST_THREAD_STATE
06319 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
06320     PyObject *exc_type = tstate->curexc_type;
06321     if (exc_type == err) return 1;
06322     if (unlikely(!exc_type)) return 0;
06323     return PyErr_GivenExceptionMatches(exc_type, err);
06324 }
06325 #endif
06326 
06327 /* GetException */
06328           #if CYTHON_FAST_THREAD_STATE
06329 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
06330 #else
06331 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
06332 #endif
06333     PyObject *local_type, *local_value, *local_tb;
06334 #if CYTHON_FAST_THREAD_STATE
06335     PyObject *tmp_type, *tmp_value, *tmp_tb;
06336     local_type = tstate->curexc_type;
06337     local_value = tstate->curexc_value;
06338     local_tb = tstate->curexc_traceback;
06339     tstate->curexc_type = 0;
06340     tstate->curexc_value = 0;
06341     tstate->curexc_traceback = 0;
06342 #else
06343     PyErr_Fetch(&local_type, &local_value, &local_tb);
06344 #endif
06345     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
06346 #if CYTHON_FAST_THREAD_STATE
06347     if (unlikely(tstate->curexc_type))
06348 #else
06349     if (unlikely(PyErr_Occurred()))
06350 #endif
06351         goto bad;
06352     #if PY_MAJOR_VERSION >= 3
06353     if (local_tb) {
06354         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
06355             goto bad;
06356     }
06357     #endif
06358     Py_XINCREF(local_tb);
06359     Py_XINCREF(local_type);
06360     Py_XINCREF(local_value);
06361     *type = local_type;
06362     *value = local_value;
06363     *tb = local_tb;
06364 #if CYTHON_FAST_THREAD_STATE
06365     tmp_type = tstate->exc_type;
06366     tmp_value = tstate->exc_value;
06367     tmp_tb = tstate->exc_traceback;
06368     tstate->exc_type = local_type;
06369     tstate->exc_value = local_value;
06370     tstate->exc_traceback = local_tb;
06371     Py_XDECREF(tmp_type);
06372     Py_XDECREF(tmp_value);
06373     Py_XDECREF(tmp_tb);
06374 #else
06375     PyErr_SetExcInfo(local_type, local_value, local_tb);
06376 #endif
06377     return 0;
06378 bad:
06379     *type = 0;
06380     *value = 0;
06381     *tb = 0;
06382     Py_XDECREF(local_type);
06383     Py_XDECREF(local_value);
06384     Py_XDECREF(local_tb);
06385     return -1;
06386 }
06387 
06388 /* Import */
06389             static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
06390     PyObject *empty_list = 0;
06391     PyObject *module = 0;
06392     PyObject *global_dict = 0;
06393     PyObject *empty_dict = 0;
06394     PyObject *list;
06395     #if PY_VERSION_HEX < 0x03030000
06396     PyObject *py_import;
06397     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
06398     if (!py_import)
06399         goto bad;
06400     #endif
06401     if (from_list)
06402         list = from_list;
06403     else {
06404         empty_list = PyList_New(0);
06405         if (!empty_list)
06406             goto bad;
06407         list = empty_list;
06408     }
06409     global_dict = PyModule_GetDict(__pyx_m);
06410     if (!global_dict)
06411         goto bad;
06412     empty_dict = PyDict_New();
06413     if (!empty_dict)
06414         goto bad;
06415     {
06416         #if PY_MAJOR_VERSION >= 3
06417         if (level == -1) {
06418             if (strchr(__Pyx_MODULE_NAME, '.')) {
06419                 #if PY_VERSION_HEX < 0x03030000
06420                 PyObject *py_level = PyInt_FromLong(1);
06421                 if (!py_level)
06422                     goto bad;
06423                 module = PyObject_CallFunctionObjArgs(py_import,
06424                     name, global_dict, empty_dict, list, py_level, NULL);
06425                 Py_DECREF(py_level);
06426                 #else
06427                 module = PyImport_ImportModuleLevelObject(
06428                     name, global_dict, empty_dict, list, 1);
06429                 #endif
06430                 if (!module) {
06431                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
06432                         goto bad;
06433                     PyErr_Clear();
06434                 }
06435             }
06436             level = 0;
06437         }
06438         #endif
06439         if (!module) {
06440             #if PY_VERSION_HEX < 0x03030000
06441             PyObject *py_level = PyInt_FromLong(level);
06442             if (!py_level)
06443                 goto bad;
06444             module = PyObject_CallFunctionObjArgs(py_import,
06445                 name, global_dict, empty_dict, list, py_level, NULL);
06446             Py_DECREF(py_level);
06447             #else
06448             module = PyImport_ImportModuleLevelObject(
06449                 name, global_dict, empty_dict, list, level);
06450             #endif
06451         }
06452     }
06453 bad:
06454     #if PY_VERSION_HEX < 0x03030000
06455     Py_XDECREF(py_import);
06456     #endif
06457     Py_XDECREF(empty_list);
06458     Py_XDECREF(empty_dict);
06459     return module;
06460 }
06461 
06462 /* CodeObjectCache */
06463             static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
06464     int start = 0, mid = 0, end = count - 1;
06465     if (end >= 0 && code_line > entries[end].code_line) {
06466         return count;
06467     }
06468     while (start < end) {
06469         mid = start + (end - start) / 2;
06470         if (code_line < entries[mid].code_line) {
06471             end = mid;
06472         } else if (code_line > entries[mid].code_line) {
06473              start = mid + 1;
06474         } else {
06475             return mid;
06476         }
06477     }
06478     if (code_line <= entries[mid].code_line) {
06479         return mid;
06480     } else {
06481         return mid + 1;
06482     }
06483 }
06484 static PyCodeObject *__pyx_find_code_object(int code_line) {
06485     PyCodeObject* code_object;
06486     int pos;
06487     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
06488         return NULL;
06489     }
06490     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
06491     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
06492         return NULL;
06493     }
06494     code_object = __pyx_code_cache.entries[pos].code_object;
06495     Py_INCREF(code_object);
06496     return code_object;
06497 }
06498 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
06499     int pos, i;
06500     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
06501     if (unlikely(!code_line)) {
06502         return;
06503     }
06504     if (unlikely(!entries)) {
06505         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
06506         if (likely(entries)) {
06507             __pyx_code_cache.entries = entries;
06508             __pyx_code_cache.max_count = 64;
06509             __pyx_code_cache.count = 1;
06510             entries[0].code_line = code_line;
06511             entries[0].code_object = code_object;
06512             Py_INCREF(code_object);
06513         }
06514         return;
06515     }
06516     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
06517     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
06518         PyCodeObject* tmp = entries[pos].code_object;
06519         entries[pos].code_object = code_object;
06520         Py_DECREF(tmp);
06521         return;
06522     }
06523     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
06524         int new_max = __pyx_code_cache.max_count + 64;
06525         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
06526             __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
06527         if (unlikely(!entries)) {
06528             return;
06529         }
06530         __pyx_code_cache.entries = entries;
06531         __pyx_code_cache.max_count = new_max;
06532     }
06533     for (i=__pyx_code_cache.count; i>pos; i--) {
06534         entries[i] = entries[i-1];
06535     }
06536     entries[pos].code_line = code_line;
06537     entries[pos].code_object = code_object;
06538     __pyx_code_cache.count++;
06539     Py_INCREF(code_object);
06540 }
06541 
06542 /* AddTraceback */
06543             #include "compile.h"
06544 #include "frameobject.h"
06545 #include "traceback.h"
06546 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
06547             const char *funcname, int c_line,
06548             int py_line, const char *filename) {
06549     PyCodeObject *py_code = 0;
06550     PyObject *py_srcfile = 0;
06551     PyObject *py_funcname = 0;
06552     #if PY_MAJOR_VERSION < 3
06553     py_srcfile = PyString_FromString(filename);
06554     #else
06555     py_srcfile = PyUnicode_FromString(filename);
06556     #endif
06557     if (!py_srcfile) goto bad;
06558     if (c_line) {
06559         #if PY_MAJOR_VERSION < 3
06560         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
06561         #else
06562         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
06563         #endif
06564     }
06565     else {
06566         #if PY_MAJOR_VERSION < 3
06567         py_funcname = PyString_FromString(funcname);
06568         #else
06569         py_funcname = PyUnicode_FromString(funcname);
06570         #endif
06571     }
06572     if (!py_funcname) goto bad;
06573     py_code = __Pyx_PyCode_New(
06574         0,
06575         0,
06576         0,
06577         0,
06578         0,
06579         __pyx_empty_bytes, /*PyObject *code,*/
06580         __pyx_empty_tuple, /*PyObject *consts,*/
06581         __pyx_empty_tuple, /*PyObject *names,*/
06582         __pyx_empty_tuple, /*PyObject *varnames,*/
06583         __pyx_empty_tuple, /*PyObject *freevars,*/
06584         __pyx_empty_tuple, /*PyObject *cellvars,*/
06585         py_srcfile,   /*PyObject *filename,*/
06586         py_funcname,  /*PyObject *name,*/
06587         py_line,
06588         __pyx_empty_bytes  /*PyObject *lnotab*/
06589     );
06590     Py_DECREF(py_srcfile);
06591     Py_DECREF(py_funcname);
06592     return py_code;
06593 bad:
06594     Py_XDECREF(py_srcfile);
06595     Py_XDECREF(py_funcname);
06596     return NULL;
06597 }
06598 static void __Pyx_AddTraceback(const char *funcname, int c_line,
06599                                int py_line, const char *filename) {
06600     PyCodeObject *py_code = 0;
06601     PyFrameObject *py_frame = 0;
06602     py_code = __pyx_find_code_object(c_line ? c_line : py_line);
06603     if (!py_code) {
06604         py_code = __Pyx_CreateCodeObjectForTraceback(
06605             funcname, c_line, py_line, filename);
06606         if (!py_code) goto bad;
06607         __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
06608     }
06609     py_frame = PyFrame_New(
06610         PyThreadState_GET(), /*PyThreadState *tstate,*/
06611         py_code,             /*PyCodeObject *code,*/
06612         __pyx_d,      /*PyObject *globals,*/
06613         0                    /*PyObject *locals*/
06614     );
06615     if (!py_frame) goto bad;
06616     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
06617     PyTraceBack_Here(py_frame);
06618 bad:
06619     Py_XDECREF(py_code);
06620     Py_XDECREF(py_frame);
06621 }
06622 
06623 #if PY_MAJOR_VERSION < 3
06624 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
06625     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
06626         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
06627     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
06628     return -1;
06629 }
06630 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
06631     PyObject *obj = view->obj;
06632     if (!obj) return;
06633     if (PyObject_CheckBuffer(obj)) {
06634         PyBuffer_Release(view);
06635         return;
06636     }
06637         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
06638     Py_DECREF(obj);
06639     view->obj = NULL;
06640 }
06641 #endif
06642 
06643 
06644             /* CIntFromPyVerify */
06645             #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
06646     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
06647 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
06648     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
06649 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
06650     {\
06651         func_type value = func_value;\
06652         if (sizeof(target_type) < sizeof(func_type)) {\
06653             if (unlikely(value != (func_type) (target_type) value)) {\
06654                 func_type zero = 0;\
06655                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
06656                     return (target_type) -1;\
06657                 if (is_unsigned && unlikely(value < zero))\
06658                     goto raise_neg_overflow;\
06659                 else\
06660                     goto raise_overflow;\
06661             }\
06662         }\
06663         return (target_type) value;\
06664     }
06665 
06666 /* CIntToPy */
06667             static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
06668     const int neg_one = (int) -1, const_zero = (int) 0;
06669     const int is_unsigned = neg_one > const_zero;
06670     if (is_unsigned) {
06671         if (sizeof(int) < sizeof(long)) {
06672             return PyInt_FromLong((long) value);
06673         } else if (sizeof(int) <= sizeof(unsigned long)) {
06674             return PyLong_FromUnsignedLong((unsigned long) value);
06675 #ifdef HAVE_LONG_LONG
06676         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
06677             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
06678 #endif
06679         }
06680     } else {
06681         if (sizeof(int) <= sizeof(long)) {
06682             return PyInt_FromLong((long) value);
06683 #ifdef HAVE_LONG_LONG
06684         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
06685             return PyLong_FromLongLong((PY_LONG_LONG) value);
06686 #endif
06687         }
06688     }
06689     {
06690         int one = 1; int little = (int)*(unsigned char *)&one;
06691         unsigned char *bytes = (unsigned char *)&value;
06692         return _PyLong_FromByteArray(bytes, sizeof(int),
06693                                      little, !is_unsigned);
06694     }
06695 }
06696 
06697 /* Declarations */
06698             #if CYTHON_CCOMPLEX
06699   #ifdef __cplusplus
06700     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
06701       return ::std::complex< float >(x, y);
06702     }
06703   #else
06704     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
06705       return x + y*(__pyx_t_float_complex)_Complex_I;
06706     }
06707   #endif
06708 #else
06709     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
06710       __pyx_t_float_complex z;
06711       z.real = x;
06712       z.imag = y;
06713       return z;
06714     }
06715 #endif
06716 
06717 /* Arithmetic */
06718             #if CYTHON_CCOMPLEX
06719 #else
06720     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
06721        return (a.real == b.real) && (a.imag == b.imag);
06722     }
06723     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
06724         __pyx_t_float_complex z;
06725         z.real = a.real + b.real;
06726         z.imag = a.imag + b.imag;
06727         return z;
06728     }
06729     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
06730         __pyx_t_float_complex z;
06731         z.real = a.real - b.real;
06732         z.imag = a.imag - b.imag;
06733         return z;
06734     }
06735     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
06736         __pyx_t_float_complex z;
06737         z.real = a.real * b.real - a.imag * b.imag;
06738         z.imag = a.real * b.imag + a.imag * b.real;
06739         return z;
06740     }
06741     #if 1
06742     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
06743         if (b.imag == 0) {
06744             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
06745         } else if (fabsf(b.real) >= fabsf(b.imag)) {
06746             if (b.real == 0 && b.imag == 0) {
06747                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
06748             } else {
06749                 float r = b.imag / b.real;
06750                 float s = 1.0 / (b.real + b.imag * r);
06751                 return __pyx_t_float_complex_from_parts(
06752                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
06753             }
06754         } else {
06755             float r = b.real / b.imag;
06756             float s = 1.0 / (b.imag + b.real * r);
06757             return __pyx_t_float_complex_from_parts(
06758                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
06759         }
06760     }
06761     #else
06762     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
06763         if (b.imag == 0) {
06764             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
06765         } else {
06766             float denom = b.real * b.real + b.imag * b.imag;
06767             return __pyx_t_float_complex_from_parts(
06768                 (a.real * b.real + a.imag * b.imag) / denom,
06769                 (a.imag * b.real - a.real * b.imag) / denom);
06770         }
06771     }
06772     #endif
06773     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
06774         __pyx_t_float_complex z;
06775         z.real = -a.real;
06776         z.imag = -a.imag;
06777         return z;
06778     }
06779     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
06780        return (a.real == 0) && (a.imag == 0);
06781     }
06782     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
06783         __pyx_t_float_complex z;
06784         z.real =  a.real;
06785         z.imag = -a.imag;
06786         return z;
06787     }
06788     #if 1
06789         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
06790           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
06791             return sqrtf(z.real*z.real + z.imag*z.imag);
06792           #else
06793             return hypotf(z.real, z.imag);
06794           #endif
06795         }
06796         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
06797             __pyx_t_float_complex z;
06798             float r, lnr, theta, z_r, z_theta;
06799             if (b.imag == 0 && b.real == (int)b.real) {
06800                 if (b.real < 0) {
06801                     float denom = a.real * a.real + a.imag * a.imag;
06802                     a.real = a.real / denom;
06803                     a.imag = -a.imag / denom;
06804                     b.real = -b.real;
06805                 }
06806                 switch ((int)b.real) {
06807                     case 0:
06808                         z.real = 1;
06809                         z.imag = 0;
06810                         return z;
06811                     case 1:
06812                         return a;
06813                     case 2:
06814                         z = __Pyx_c_prod_float(a, a);
06815                         return __Pyx_c_prod_float(a, a);
06816                     case 3:
06817                         z = __Pyx_c_prod_float(a, a);
06818                         return __Pyx_c_prod_float(z, a);
06819                     case 4:
06820                         z = __Pyx_c_prod_float(a, a);
06821                         return __Pyx_c_prod_float(z, z);
06822                 }
06823             }
06824             if (a.imag == 0) {
06825                 if (a.real == 0) {
06826                     return a;
06827                 } else if (b.imag == 0) {
06828                     z.real = powf(a.real, b.real);
06829                     z.imag = 0;
06830                     return z;
06831                 } else if (a.real > 0) {
06832                     r = a.real;
06833                     theta = 0;
06834                 } else {
06835                     r = -a.real;
06836                     theta = atan2f(0, -1);
06837                 }
06838             } else {
06839                 r = __Pyx_c_abs_float(a);
06840                 theta = atan2f(a.imag, a.real);
06841             }
06842             lnr = logf(r);
06843             z_r = expf(lnr * b.real - theta * b.imag);
06844             z_theta = theta * b.real + lnr * b.imag;
06845             z.real = z_r * cosf(z_theta);
06846             z.imag = z_r * sinf(z_theta);
06847             return z;
06848         }
06849     #endif
06850 #endif
06851 
06852 /* Declarations */
06853             #if CYTHON_CCOMPLEX
06854   #ifdef __cplusplus
06855     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
06856       return ::std::complex< double >(x, y);
06857     }
06858   #else
06859     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
06860       return x + y*(__pyx_t_double_complex)_Complex_I;
06861     }
06862   #endif
06863 #else
06864     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
06865       __pyx_t_double_complex z;
06866       z.real = x;
06867       z.imag = y;
06868       return z;
06869     }
06870 #endif
06871 
06872 /* Arithmetic */
06873             #if CYTHON_CCOMPLEX
06874 #else
06875     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
06876        return (a.real == b.real) && (a.imag == b.imag);
06877     }
06878     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
06879         __pyx_t_double_complex z;
06880         z.real = a.real + b.real;
06881         z.imag = a.imag + b.imag;
06882         return z;
06883     }
06884     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
06885         __pyx_t_double_complex z;
06886         z.real = a.real - b.real;
06887         z.imag = a.imag - b.imag;
06888         return z;
06889     }
06890     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
06891         __pyx_t_double_complex z;
06892         z.real = a.real * b.real - a.imag * b.imag;
06893         z.imag = a.real * b.imag + a.imag * b.real;
06894         return z;
06895     }
06896     #if 1
06897     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
06898         if (b.imag == 0) {
06899             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
06900         } else if (fabs(b.real) >= fabs(b.imag)) {
06901             if (b.real == 0 && b.imag == 0) {
06902                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
06903             } else {
06904                 double r = b.imag / b.real;
06905                 double s = 1.0 / (b.real + b.imag * r);
06906                 return __pyx_t_double_complex_from_parts(
06907                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
06908             }
06909         } else {
06910             double r = b.real / b.imag;
06911             double s = 1.0 / (b.imag + b.real * r);
06912             return __pyx_t_double_complex_from_parts(
06913                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
06914         }
06915     }
06916     #else
06917     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
06918         if (b.imag == 0) {
06919             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
06920         } else {
06921             double denom = b.real * b.real + b.imag * b.imag;
06922             return __pyx_t_double_complex_from_parts(
06923                 (a.real * b.real + a.imag * b.imag) / denom,
06924                 (a.imag * b.real - a.real * b.imag) / denom);
06925         }
06926     }
06927     #endif
06928     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
06929         __pyx_t_double_complex z;
06930         z.real = -a.real;
06931         z.imag = -a.imag;
06932         return z;
06933     }
06934     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
06935        return (a.real == 0) && (a.imag == 0);
06936     }
06937     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
06938         __pyx_t_double_complex z;
06939         z.real =  a.real;
06940         z.imag = -a.imag;
06941         return z;
06942     }
06943     #if 1
06944         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
06945           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
06946             return sqrt(z.real*z.real + z.imag*z.imag);
06947           #else
06948             return hypot(z.real, z.imag);
06949           #endif
06950         }
06951         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
06952             __pyx_t_double_complex z;
06953             double r, lnr, theta, z_r, z_theta;
06954             if (b.imag == 0 && b.real == (int)b.real) {
06955                 if (b.real < 0) {
06956                     double denom = a.real * a.real + a.imag * a.imag;
06957                     a.real = a.real / denom;
06958                     a.imag = -a.imag / denom;
06959                     b.real = -b.real;
06960                 }
06961                 switch ((int)b.real) {
06962                     case 0:
06963                         z.real = 1;
06964                         z.imag = 0;
06965                         return z;
06966                     case 1:
06967                         return a;
06968                     case 2:
06969                         z = __Pyx_c_prod_double(a, a);
06970                         return __Pyx_c_prod_double(a, a);
06971                     case 3:
06972                         z = __Pyx_c_prod_double(a, a);
06973                         return __Pyx_c_prod_double(z, a);
06974                     case 4:
06975                         z = __Pyx_c_prod_double(a, a);
06976                         return __Pyx_c_prod_double(z, z);
06977                 }
06978             }
06979             if (a.imag == 0) {
06980                 if (a.real == 0) {
06981                     return a;
06982                 } else if (b.imag == 0) {
06983                     z.real = pow(a.real, b.real);
06984                     z.imag = 0;
06985                     return z;
06986                 } else if (a.real > 0) {
06987                     r = a.real;
06988                     theta = 0;
06989                 } else {
06990                     r = -a.real;
06991                     theta = atan2(0, -1);
06992                 }
06993             } else {
06994                 r = __Pyx_c_abs_double(a);
06995                 theta = atan2(a.imag, a.real);
06996             }
06997             lnr = log(r);
06998             z_r = exp(lnr * b.real - theta * b.imag);
06999             z_theta = theta * b.real + lnr * b.imag;
07000             z.real = z_r * cos(z_theta);
07001             z.imag = z_r * sin(z_theta);
07002             return z;
07003         }
07004     #endif
07005 #endif
07006 
07007 /* CIntToPy */
07008             static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
07009     const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0;
07010     const int is_unsigned = neg_one > const_zero;
07011     if (is_unsigned) {
07012         if (sizeof(enum NPY_TYPES) < sizeof(long)) {
07013             return PyInt_FromLong((long) value);
07014         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
07015             return PyLong_FromUnsignedLong((unsigned long) value);
07016 #ifdef HAVE_LONG_LONG
07017         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
07018             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
07019 #endif
07020         }
07021     } else {
07022         if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
07023             return PyInt_FromLong((long) value);
07024 #ifdef HAVE_LONG_LONG
07025         } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
07026             return PyLong_FromLongLong((PY_LONG_LONG) value);
07027 #endif
07028         }
07029     }
07030     {
07031         int one = 1; int little = (int)*(unsigned char *)&one;
07032         unsigned char *bytes = (unsigned char *)&value;
07033         return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
07034                                      little, !is_unsigned);
07035     }
07036 }
07037 
07038 /* CIntFromPy */
07039             static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *x) {
07040     const npy_int32 neg_one = (npy_int32) -1, const_zero = (npy_int32) 0;
07041     const int is_unsigned = neg_one > const_zero;
07042 #if PY_MAJOR_VERSION < 3
07043     if (likely(PyInt_Check(x))) {
07044         if (sizeof(npy_int32) < sizeof(long)) {
07045             __PYX_VERIFY_RETURN_INT(npy_int32, long, PyInt_AS_LONG(x))
07046         } else {
07047             long val = PyInt_AS_LONG(x);
07048             if (is_unsigned && unlikely(val < 0)) {
07049                 goto raise_neg_overflow;
07050             }
07051             return (npy_int32) val;
07052         }
07053     } else
07054 #endif
07055     if (likely(PyLong_Check(x))) {
07056         if (is_unsigned) {
07057 #if CYTHON_USE_PYLONG_INTERNALS
07058             const digit* digits = ((PyLongObject*)x)->ob_digit;
07059             switch (Py_SIZE(x)) {
07060                 case  0: return (npy_int32) 0;
07061                 case  1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, digits[0])
07062                 case 2:
07063                     if (8 * sizeof(npy_int32) > 1 * PyLong_SHIFT) {
07064                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
07065                             __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07066                         } else if (8 * sizeof(npy_int32) >= 2 * PyLong_SHIFT) {
07067                             return (npy_int32) (((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
07068                         }
07069                     }
07070                     break;
07071                 case 3:
07072                     if (8 * sizeof(npy_int32) > 2 * PyLong_SHIFT) {
07073                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
07074                             __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07075                         } else if (8 * sizeof(npy_int32) >= 3 * PyLong_SHIFT) {
07076                             return (npy_int32) (((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
07077                         }
07078                     }
07079                     break;
07080                 case 4:
07081                     if (8 * sizeof(npy_int32) > 3 * PyLong_SHIFT) {
07082                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
07083                             __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07084                         } else if (8 * sizeof(npy_int32) >= 4 * PyLong_SHIFT) {
07085                             return (npy_int32) (((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
07086                         }
07087                     }
07088                     break;
07089             }
07090 #endif
07091 #if CYTHON_COMPILING_IN_CPYTHON
07092             if (unlikely(Py_SIZE(x) < 0)) {
07093                 goto raise_neg_overflow;
07094             }
07095 #else
07096             {
07097                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
07098                 if (unlikely(result < 0))
07099                     return (npy_int32) -1;
07100                 if (unlikely(result == 1))
07101                     goto raise_neg_overflow;
07102             }
07103 #endif
07104             if (sizeof(npy_int32) <= sizeof(unsigned long)) {
07105                 __PYX_VERIFY_RETURN_INT_EXC(npy_int32, unsigned long, PyLong_AsUnsignedLong(x))
07106 #ifdef HAVE_LONG_LONG
07107             } else if (sizeof(npy_int32) <= sizeof(unsigned PY_LONG_LONG)) {
07108                 __PYX_VERIFY_RETURN_INT_EXC(npy_int32, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
07109 #endif
07110             }
07111         } else {
07112 #if CYTHON_USE_PYLONG_INTERNALS
07113             const digit* digits = ((PyLongObject*)x)->ob_digit;
07114             switch (Py_SIZE(x)) {
07115                 case  0: return (npy_int32) 0;
07116                 case -1: __PYX_VERIFY_RETURN_INT(npy_int32, sdigit, (sdigit) (-(sdigit)digits[0]))
07117                 case  1: __PYX_VERIFY_RETURN_INT(npy_int32,  digit, +digits[0])
07118                 case -2:
07119                     if (8 * sizeof(npy_int32) - 1 > 1 * PyLong_SHIFT) {
07120                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
07121                             __PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07122                         } else if (8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
07123                             return (npy_int32) (((npy_int32)-1)*(((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
07124                         }
07125                     }
07126                     break;
07127                 case 2:
07128                     if (8 * sizeof(npy_int32) > 1 * PyLong_SHIFT) {
07129                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
07130                             __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07131                         } else if (8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
07132                             return (npy_int32) ((((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
07133                         }
07134                     }
07135                     break;
07136                 case -3:
07137                     if (8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
07138                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
07139                             __PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07140                         } else if (8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
07141                             return (npy_int32) (((npy_int32)-1)*(((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
07142                         }
07143                     }
07144                     break;
07145                 case 3:
07146                     if (8 * sizeof(npy_int32) > 2 * PyLong_SHIFT) {
07147                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
07148                             __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07149                         } else if (8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
07150                             return (npy_int32) ((((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
07151                         }
07152                     }
07153                     break;
07154                 case -4:
07155                     if (8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
07156                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
07157                             __PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07158                         } else if (8 * sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) {
07159                             return (npy_int32) (((npy_int32)-1)*(((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
07160                         }
07161                     }
07162                     break;
07163                 case 4:
07164                     if (8 * sizeof(npy_int32) > 3 * PyLong_SHIFT) {
07165                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
07166                             __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07167                         } else if (8 * sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) {
07168                             return (npy_int32) ((((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
07169                         }
07170                     }
07171                     break;
07172             }
07173 #endif
07174             if (sizeof(npy_int32) <= sizeof(long)) {
07175                 __PYX_VERIFY_RETURN_INT_EXC(npy_int32, long, PyLong_AsLong(x))
07176 #ifdef HAVE_LONG_LONG
07177             } else if (sizeof(npy_int32) <= sizeof(PY_LONG_LONG)) {
07178                 __PYX_VERIFY_RETURN_INT_EXC(npy_int32, PY_LONG_LONG, PyLong_AsLongLong(x))
07179 #endif
07180             }
07181         }
07182         {
07183 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
07184             PyErr_SetString(PyExc_RuntimeError,
07185                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
07186 #else
07187             npy_int32 val;
07188             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
07189  #if PY_MAJOR_VERSION < 3
07190             if (likely(v) && !PyLong_Check(v)) {
07191                 PyObject *tmp = v;
07192                 v = PyNumber_Long(tmp);
07193                 Py_DECREF(tmp);
07194             }
07195  #endif
07196             if (likely(v)) {
07197                 int one = 1; int is_little = (int)*(unsigned char *)&one;
07198                 unsigned char *bytes = (unsigned char *)&val;
07199                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
07200                                               bytes, sizeof(val),
07201                                               is_little, !is_unsigned);
07202                 Py_DECREF(v);
07203                 if (likely(!ret))
07204                     return val;
07205             }
07206 #endif
07207             return (npy_int32) -1;
07208         }
07209     } else {
07210         npy_int32 val;
07211         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
07212         if (!tmp) return (npy_int32) -1;
07213         val = __Pyx_PyInt_As_npy_int32(tmp);
07214         Py_DECREF(tmp);
07215         return val;
07216     }
07217 raise_overflow:
07218     PyErr_SetString(PyExc_OverflowError,
07219         "value too large to convert to npy_int32");
07220     return (npy_int32) -1;
07221 raise_neg_overflow:
07222     PyErr_SetString(PyExc_OverflowError,
07223         "can't convert negative value to npy_int32");
07224     return (npy_int32) -1;
07225 }
07226 
07227 /* CIntFromPy */
07228             static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
07229     const int neg_one = (int) -1, const_zero = (int) 0;
07230     const int is_unsigned = neg_one > const_zero;
07231 #if PY_MAJOR_VERSION < 3
07232     if (likely(PyInt_Check(x))) {
07233         if (sizeof(int) < sizeof(long)) {
07234             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
07235         } else {
07236             long val = PyInt_AS_LONG(x);
07237             if (is_unsigned && unlikely(val < 0)) {
07238                 goto raise_neg_overflow;
07239             }
07240             return (int) val;
07241         }
07242     } else
07243 #endif
07244     if (likely(PyLong_Check(x))) {
07245         if (is_unsigned) {
07246 #if CYTHON_USE_PYLONG_INTERNALS
07247             const digit* digits = ((PyLongObject*)x)->ob_digit;
07248             switch (Py_SIZE(x)) {
07249                 case  0: return (int) 0;
07250                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
07251                 case 2:
07252                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
07253                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
07254                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07255                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
07256                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
07257                         }
07258                     }
07259                     break;
07260                 case 3:
07261                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
07262                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
07263                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07264                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
07265                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
07266                         }
07267                     }
07268                     break;
07269                 case 4:
07270                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
07271                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
07272                             __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])))
07273                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
07274                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
07275                         }
07276                     }
07277                     break;
07278             }
07279 #endif
07280 #if CYTHON_COMPILING_IN_CPYTHON
07281             if (unlikely(Py_SIZE(x) < 0)) {
07282                 goto raise_neg_overflow;
07283             }
07284 #else
07285             {
07286                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
07287                 if (unlikely(result < 0))
07288                     return (int) -1;
07289                 if (unlikely(result == 1))
07290                     goto raise_neg_overflow;
07291             }
07292 #endif
07293             if (sizeof(int) <= sizeof(unsigned long)) {
07294                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
07295 #ifdef HAVE_LONG_LONG
07296             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
07297                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
07298 #endif
07299             }
07300         } else {
07301 #if CYTHON_USE_PYLONG_INTERNALS
07302             const digit* digits = ((PyLongObject*)x)->ob_digit;
07303             switch (Py_SIZE(x)) {
07304                 case  0: return (int) 0;
07305                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
07306                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
07307                 case -2:
07308                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
07309                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
07310                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07311                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
07312                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
07313                         }
07314                     }
07315                     break;
07316                 case 2:
07317                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
07318                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
07319                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07320                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
07321                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
07322                         }
07323                     }
07324                     break;
07325                 case -3:
07326                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
07327                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
07328                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07329                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
07330                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
07331                         }
07332                     }
07333                     break;
07334                 case 3:
07335                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
07336                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
07337                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07338                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
07339                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
07340                         }
07341                     }
07342                     break;
07343                 case -4:
07344                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
07345                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
07346                             __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])))
07347                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
07348                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
07349                         }
07350                     }
07351                     break;
07352                 case 4:
07353                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
07354                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
07355                             __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])))
07356                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
07357                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
07358                         }
07359                     }
07360                     break;
07361             }
07362 #endif
07363             if (sizeof(int) <= sizeof(long)) {
07364                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
07365 #ifdef HAVE_LONG_LONG
07366             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
07367                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
07368 #endif
07369             }
07370         }
07371         {
07372 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
07373             PyErr_SetString(PyExc_RuntimeError,
07374                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
07375 #else
07376             int val;
07377             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
07378  #if PY_MAJOR_VERSION < 3
07379             if (likely(v) && !PyLong_Check(v)) {
07380                 PyObject *tmp = v;
07381                 v = PyNumber_Long(tmp);
07382                 Py_DECREF(tmp);
07383             }
07384  #endif
07385             if (likely(v)) {
07386                 int one = 1; int is_little = (int)*(unsigned char *)&one;
07387                 unsigned char *bytes = (unsigned char *)&val;
07388                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
07389                                               bytes, sizeof(val),
07390                                               is_little, !is_unsigned);
07391                 Py_DECREF(v);
07392                 if (likely(!ret))
07393                     return val;
07394             }
07395 #endif
07396             return (int) -1;
07397         }
07398     } else {
07399         int val;
07400         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
07401         if (!tmp) return (int) -1;
07402         val = __Pyx_PyInt_As_int(tmp);
07403         Py_DECREF(tmp);
07404         return val;
07405     }
07406 raise_overflow:
07407     PyErr_SetString(PyExc_OverflowError,
07408         "value too large to convert to int");
07409     return (int) -1;
07410 raise_neg_overflow:
07411     PyErr_SetString(PyExc_OverflowError,
07412         "can't convert negative value to int");
07413     return (int) -1;
07414 }
07415 
07416 /* CIntToPy */
07417             static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
07418     const long neg_one = (long) -1, const_zero = (long) 0;
07419     const int is_unsigned = neg_one > const_zero;
07420     if (is_unsigned) {
07421         if (sizeof(long) < sizeof(long)) {
07422             return PyInt_FromLong((long) value);
07423         } else if (sizeof(long) <= sizeof(unsigned long)) {
07424             return PyLong_FromUnsignedLong((unsigned long) value);
07425 #ifdef HAVE_LONG_LONG
07426         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
07427             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
07428 #endif
07429         }
07430     } else {
07431         if (sizeof(long) <= sizeof(long)) {
07432             return PyInt_FromLong((long) value);
07433 #ifdef HAVE_LONG_LONG
07434         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
07435             return PyLong_FromLongLong((PY_LONG_LONG) value);
07436 #endif
07437         }
07438     }
07439     {
07440         int one = 1; int little = (int)*(unsigned char *)&one;
07441         unsigned char *bytes = (unsigned char *)&value;
07442         return _PyLong_FromByteArray(bytes, sizeof(long),
07443                                      little, !is_unsigned);
07444     }
07445 }
07446 
07447 /* CIntFromPy */
07448             static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
07449     const long neg_one = (long) -1, const_zero = (long) 0;
07450     const int is_unsigned = neg_one > const_zero;
07451 #if PY_MAJOR_VERSION < 3
07452     if (likely(PyInt_Check(x))) {
07453         if (sizeof(long) < sizeof(long)) {
07454             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
07455         } else {
07456             long val = PyInt_AS_LONG(x);
07457             if (is_unsigned && unlikely(val < 0)) {
07458                 goto raise_neg_overflow;
07459             }
07460             return (long) val;
07461         }
07462     } else
07463 #endif
07464     if (likely(PyLong_Check(x))) {
07465         if (is_unsigned) {
07466 #if CYTHON_USE_PYLONG_INTERNALS
07467             const digit* digits = ((PyLongObject*)x)->ob_digit;
07468             switch (Py_SIZE(x)) {
07469                 case  0: return (long) 0;
07470                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
07471                 case 2:
07472                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
07473                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
07474                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07475                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
07476                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
07477                         }
07478                     }
07479                     break;
07480                 case 3:
07481                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
07482                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
07483                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07484                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
07485                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
07486                         }
07487                     }
07488                     break;
07489                 case 4:
07490                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
07491                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
07492                             __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])))
07493                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
07494                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
07495                         }
07496                     }
07497                     break;
07498             }
07499 #endif
07500 #if CYTHON_COMPILING_IN_CPYTHON
07501             if (unlikely(Py_SIZE(x) < 0)) {
07502                 goto raise_neg_overflow;
07503             }
07504 #else
07505             {
07506                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
07507                 if (unlikely(result < 0))
07508                     return (long) -1;
07509                 if (unlikely(result == 1))
07510                     goto raise_neg_overflow;
07511             }
07512 #endif
07513             if (sizeof(long) <= sizeof(unsigned long)) {
07514                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
07515 #ifdef HAVE_LONG_LONG
07516             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
07517                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
07518 #endif
07519             }
07520         } else {
07521 #if CYTHON_USE_PYLONG_INTERNALS
07522             const digit* digits = ((PyLongObject*)x)->ob_digit;
07523             switch (Py_SIZE(x)) {
07524                 case  0: return (long) 0;
07525                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
07526                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
07527                 case -2:
07528                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
07529                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
07530                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07531                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
07532                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
07533                         }
07534                     }
07535                     break;
07536                 case 2:
07537                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
07538                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
07539                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07540                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
07541                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
07542                         }
07543                     }
07544                     break;
07545                 case -3:
07546                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
07547                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
07548                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07549                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
07550                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
07551                         }
07552                     }
07553                     break;
07554                 case 3:
07555                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
07556                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
07557                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
07558                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
07559                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
07560                         }
07561                     }
07562                     break;
07563                 case -4:
07564                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
07565                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
07566                             __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])))
07567                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
07568                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
07569                         }
07570                     }
07571                     break;
07572                 case 4:
07573                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
07574                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
07575                             __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])))
07576                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
07577                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
07578                         }
07579                     }
07580                     break;
07581             }
07582 #endif
07583             if (sizeof(long) <= sizeof(long)) {
07584                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
07585 #ifdef HAVE_LONG_LONG
07586             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
07587                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
07588 #endif
07589             }
07590         }
07591         {
07592 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
07593             PyErr_SetString(PyExc_RuntimeError,
07594                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
07595 #else
07596             long val;
07597             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
07598  #if PY_MAJOR_VERSION < 3
07599             if (likely(v) && !PyLong_Check(v)) {
07600                 PyObject *tmp = v;
07601                 v = PyNumber_Long(tmp);
07602                 Py_DECREF(tmp);
07603             }
07604  #endif
07605             if (likely(v)) {
07606                 int one = 1; int is_little = (int)*(unsigned char *)&one;
07607                 unsigned char *bytes = (unsigned char *)&val;
07608                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
07609                                               bytes, sizeof(val),
07610                                               is_little, !is_unsigned);
07611                 Py_DECREF(v);
07612                 if (likely(!ret))
07613                     return val;
07614             }
07615 #endif
07616             return (long) -1;
07617         }
07618     } else {
07619         long val;
07620         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
07621         if (!tmp) return (long) -1;
07622         val = __Pyx_PyInt_As_long(tmp);
07623         Py_DECREF(tmp);
07624         return val;
07625     }
07626 raise_overflow:
07627     PyErr_SetString(PyExc_OverflowError,
07628         "value too large to convert to long");
07629     return (long) -1;
07630 raise_neg_overflow:
07631     PyErr_SetString(PyExc_OverflowError,
07632         "can't convert negative value to long");
07633     return (long) -1;
07634 }
07635 
07636 /* CheckBinaryVersion */
07637             static int __Pyx_check_binary_version(void) {
07638     char ctversion[4], rtversion[4];
07639     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
07640     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
07641     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
07642         char message[200];
07643         PyOS_snprintf(message, sizeof(message),
07644                       "compiletime version %s of module '%.100s' "
07645                       "does not match runtime version %s",
07646                       ctversion, __Pyx_MODULE_NAME, rtversion);
07647         return PyErr_WarnEx(NULL, message, 1);
07648     }
07649     return 0;
07650 }
07651 
07652 /* ModuleImport */
07653             #ifndef __PYX_HAVE_RT_ImportModule
07654 #define __PYX_HAVE_RT_ImportModule
07655 static PyObject *__Pyx_ImportModule(const char *name) {
07656     PyObject *py_name = 0;
07657     PyObject *py_module = 0;
07658     py_name = __Pyx_PyIdentifier_FromString(name);
07659     if (!py_name)
07660         goto bad;
07661     py_module = PyImport_Import(py_name);
07662     Py_DECREF(py_name);
07663     return py_module;
07664 bad:
07665     Py_XDECREF(py_name);
07666     return 0;
07667 }
07668 #endif
07669 
07670 /* TypeImport */
07671             #ifndef __PYX_HAVE_RT_ImportType
07672 #define __PYX_HAVE_RT_ImportType
07673 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
07674     size_t size, int strict)
07675 {
07676     PyObject *py_module = 0;
07677     PyObject *result = 0;
07678     PyObject *py_name = 0;
07679     char warning[200];
07680     Py_ssize_t basicsize;
07681 #ifdef Py_LIMITED_API
07682     PyObject *py_basicsize;
07683 #endif
07684     py_module = __Pyx_ImportModule(module_name);
07685     if (!py_module)
07686         goto bad;
07687     py_name = __Pyx_PyIdentifier_FromString(class_name);
07688     if (!py_name)
07689         goto bad;
07690     result = PyObject_GetAttr(py_module, py_name);
07691     Py_DECREF(py_name);
07692     py_name = 0;
07693     Py_DECREF(py_module);
07694     py_module = 0;
07695     if (!result)
07696         goto bad;
07697     if (!PyType_Check(result)) {
07698         PyErr_Format(PyExc_TypeError,
07699             "%.200s.%.200s is not a type object",
07700             module_name, class_name);
07701         goto bad;
07702     }
07703 #ifndef Py_LIMITED_API
07704     basicsize = ((PyTypeObject *)result)->tp_basicsize;
07705 #else
07706     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
07707     if (!py_basicsize)
07708         goto bad;
07709     basicsize = PyLong_AsSsize_t(py_basicsize);
07710     Py_DECREF(py_basicsize);
07711     py_basicsize = 0;
07712     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
07713         goto bad;
07714 #endif
07715     if (!strict && (size_t)basicsize > size) {
07716         PyOS_snprintf(warning, sizeof(warning),
07717             "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
07718             module_name, class_name, basicsize, size);
07719         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
07720     }
07721     else if ((size_t)basicsize != size) {
07722         PyErr_Format(PyExc_ValueError,
07723             "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
07724             module_name, class_name, basicsize, size);
07725         goto bad;
07726     }
07727     return (PyTypeObject *)result;
07728 bad:
07729     Py_XDECREF(py_module);
07730     Py_XDECREF(result);
07731     return NULL;
07732 }
07733 #endif
07734 
07735 /* InitStrings */
07736             static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
07737     while (t->p) {
07738         #if PY_MAJOR_VERSION < 3
07739         if (t->is_unicode) {
07740             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
07741         } else if (t->intern) {
07742             *t->p = PyString_InternFromString(t->s);
07743         } else {
07744             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
07745         }
07746         #else
07747         if (t->is_unicode | t->is_str) {
07748             if (t->intern) {
07749                 *t->p = PyUnicode_InternFromString(t->s);
07750             } else if (t->encoding) {
07751                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
07752             } else {
07753                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
07754             }
07755         } else {
07756             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
07757         }
07758         #endif
07759         if (!*t->p)
07760             return -1;
07761         ++t;
07762     }
07763     return 0;
07764 }
07765 
07766 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
07767     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
07768 }
07769 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
07770     Py_ssize_t ignore;
07771     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
07772 }
07773 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
07774 #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
07775     if (
07776 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
07777             __Pyx_sys_getdefaultencoding_not_ascii &&
07778 #endif
07779             PyUnicode_Check(o)) {
07780 #if PY_VERSION_HEX < 0x03030000
07781         char* defenc_c;
07782         PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
07783         if (!defenc) return NULL;
07784         defenc_c = PyBytes_AS_STRING(defenc);
07785 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
07786         {
07787             char* end = defenc_c + PyBytes_GET_SIZE(defenc);
07788             char* c;
07789             for (c = defenc_c; c < end; c++) {
07790                 if ((unsigned char) (*c) >= 128) {
07791                     PyUnicode_AsASCIIString(o);
07792                     return NULL;
07793                 }
07794             }
07795         }
07796 #endif
07797         *length = PyBytes_GET_SIZE(defenc);
07798         return defenc_c;
07799 #else
07800         if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
07801 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
07802         if (PyUnicode_IS_ASCII(o)) {
07803             *length = PyUnicode_GET_LENGTH(o);
07804             return PyUnicode_AsUTF8(o);
07805         } else {
07806             PyUnicode_AsASCIIString(o);
07807             return NULL;
07808         }
07809 #else
07810         return PyUnicode_AsUTF8AndSize(o, length);
07811 #endif
07812 #endif
07813     } else
07814 #endif
07815 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
07816     if (PyByteArray_Check(o)) {
07817         *length = PyByteArray_GET_SIZE(o);
07818         return PyByteArray_AS_STRING(o);
07819     } else
07820 #endif
07821     {
07822         char* result;
07823         int r = PyBytes_AsStringAndSize(o, &result, length);
07824         if (unlikely(r < 0)) {
07825             return NULL;
07826         } else {
07827             return result;
07828         }
07829     }
07830 }
07831 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
07832    int is_true = x == Py_True;
07833    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
07834    else return PyObject_IsTrue(x);
07835 }
07836 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
07837 #if CYTHON_USE_TYPE_SLOTS
07838   PyNumberMethods *m;
07839 #endif
07840   const char *name = NULL;
07841   PyObject *res = NULL;
07842 #if PY_MAJOR_VERSION < 3
07843   if (PyInt_Check(x) || PyLong_Check(x))
07844 #else
07845   if (PyLong_Check(x))
07846 #endif
07847     return __Pyx_NewRef(x);
07848 #if CYTHON_USE_TYPE_SLOTS
07849   m = Py_TYPE(x)->tp_as_number;
07850   #if PY_MAJOR_VERSION < 3
07851   if (m && m->nb_int) {
07852     name = "int";
07853     res = PyNumber_Int(x);
07854   }
07855   else if (m && m->nb_long) {
07856     name = "long";
07857     res = PyNumber_Long(x);
07858   }
07859   #else
07860   if (m && m->nb_int) {
07861     name = "int";
07862     res = PyNumber_Long(x);
07863   }
07864   #endif
07865 #else
07866   res = PyNumber_Int(x);
07867 #endif
07868   if (res) {
07869 #if PY_MAJOR_VERSION < 3
07870     if (!PyInt_Check(res) && !PyLong_Check(res)) {
07871 #else
07872     if (!PyLong_Check(res)) {
07873 #endif
07874       PyErr_Format(PyExc_TypeError,
07875                    "__%.4s__ returned non-%.4s (type %.200s)",
07876                    name, name, Py_TYPE(res)->tp_name);
07877       Py_DECREF(res);
07878       return NULL;
07879     }
07880   }
07881   else if (!PyErr_Occurred()) {
07882     PyErr_SetString(PyExc_TypeError,
07883                     "an integer is required");
07884   }
07885   return res;
07886 }
07887 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
07888   Py_ssize_t ival;
07889   PyObject *x;
07890 #if PY_MAJOR_VERSION < 3
07891   if (likely(PyInt_CheckExact(b))) {
07892     if (sizeof(Py_ssize_t) >= sizeof(long))
07893         return PyInt_AS_LONG(b);
07894     else
07895         return PyInt_AsSsize_t(x);
07896   }
07897 #endif
07898   if (likely(PyLong_CheckExact(b))) {
07899     #if CYTHON_USE_PYLONG_INTERNALS
07900     const digit* digits = ((PyLongObject*)b)->ob_digit;
07901     const Py_ssize_t size = Py_SIZE(b);
07902     if (likely(__Pyx_sst_abs(size) <= 1)) {
07903         ival = likely(size) ? digits[0] : 0;
07904         if (size == -1) ival = -ival;
07905         return ival;
07906     } else {
07907       switch (size) {
07908          case 2:
07909            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
07910              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
07911            }
07912            break;
07913          case -2:
07914            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
07915              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
07916            }
07917            break;
07918          case 3:
07919            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
07920              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
07921            }
07922            break;
07923          case -3:
07924            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
07925              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
07926            }
07927            break;
07928          case 4:
07929            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
07930              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]));
07931            }
07932            break;
07933          case -4:
07934            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
07935              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]));
07936            }
07937            break;
07938       }
07939     }
07940     #endif
07941     return PyLong_AsSsize_t(b);
07942   }
07943   x = PyNumber_Index(b);
07944   if (!x) return -1;
07945   ival = PyInt_AsSsize_t(x);
07946   Py_DECREF(x);
07947   return ival;
07948 }
07949 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
07950     return PyInt_FromSize_t(ival);
07951 }
07952 
07953 
07954 #endif /* Py_PYTHON_H */


rail_object_detector
Author(s):
autogenerated on Sat Jun 8 2019 20:26:30