Advertisement
Guest User

Untitled

a guest
Jul 26th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 409.53 KB | None | 0 0
  1. /* Generated by Cython 0.23.4 */
  2.  
  3. #define PY_SSIZE_T_CLEAN
  4. #include "Python.h"
  5. #ifndef Py_PYTHON_H
  6.     #error Python headers needed to compile C extensions, please install development version of Python.
  7. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
  8.     #error Cython requires Python 2.6+ or Python 3.2+.
  9. #else
  10. #define CYTHON_ABI "0_23_4"
  11. #include <stddef.h>
  12. #ifndef offsetof
  13. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  14. #endif
  15. #if !defined(WIN32) && !defined(MS_WINDOWS)
  16.   #ifndef __stdcall
  17.     #define __stdcall
  18.   #endif
  19.   #ifndef __cdecl
  20.     #define __cdecl
  21.   #endif
  22.   #ifndef __fastcall
  23.     #define __fastcall
  24.   #endif
  25. #endif
  26. #ifndef DL_IMPORT
  27.   #define DL_IMPORT(t) t
  28. #endif
  29. #ifndef DL_EXPORT
  30.   #define DL_EXPORT(t) t
  31. #endif
  32. #ifndef PY_LONG_LONG
  33.   #define PY_LONG_LONG LONG_LONG
  34. #endif
  35. #ifndef Py_HUGE_VAL
  36.   #define Py_HUGE_VAL HUGE_VAL
  37. #endif
  38. #ifdef PYPY_VERSION
  39. #define CYTHON_COMPILING_IN_PYPY 1
  40. #define CYTHON_COMPILING_IN_CPYTHON 0
  41. #else
  42. #define CYTHON_COMPILING_IN_PYPY 0
  43. #define CYTHON_COMPILING_IN_CPYTHON 1
  44. #endif
  45. #if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
  46. #define CYTHON_USE_PYLONG_INTERNALS 1
  47. #endif
  48. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  49. #define Py_OptimizeFlag 0
  50. #endif
  51. #define __PYX_BUILD_PY_SSIZE_T "n"
  52. #define CYTHON_FORMAT_SSIZE_T "z"
  53. #if PY_MAJOR_VERSION < 3
  54.   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  55.   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  56.           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  57.   #define __Pyx_DefaultClassType PyClass_Type
  58. #else
  59.   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  60.   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  61.           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  62.   #define __Pyx_DefaultClassType PyType_Type
  63. #endif
  64. #ifndef Py_TPFLAGS_CHECKTYPES
  65.   #define Py_TPFLAGS_CHECKTYPES 0
  66. #endif
  67. #ifndef Py_TPFLAGS_HAVE_INDEX
  68.   #define Py_TPFLAGS_HAVE_INDEX 0
  69. #endif
  70. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  71.   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  72. #endif
  73. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  74.   #define Py_TPFLAGS_HAVE_FINALIZE 0
  75. #endif
  76. #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  77.   #define CYTHON_PEP393_ENABLED 1
  78.   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
  79.                                               0 : _PyUnicode_Ready((PyObject *)(op)))
  80.   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  81.   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  82.   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  83.   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  84.   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  85. #else
  86.   #define CYTHON_PEP393_ENABLED 0
  87.   #define __Pyx_PyUnicode_READY(op)       (0)
  88.   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  89.   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  90.   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  91.   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  92.   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  93. #endif
  94. #if CYTHON_COMPILING_IN_PYPY
  95.   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  96.   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
  97. #else
  98.   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  99.   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  100.       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  101. #endif
  102. #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  103.   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
  104. #endif
  105. #define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
  106. #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  107. #if PY_MAJOR_VERSION >= 3
  108.   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
  109. #else
  110.   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
  111. #endif
  112. #if PY_MAJOR_VERSION >= 3
  113.   #define PyBaseString_Type            PyUnicode_Type
  114.   #define PyStringObject               PyUnicodeObject
  115.   #define PyString_Type                PyUnicode_Type
  116.   #define PyString_Check               PyUnicode_Check
  117.   #define PyString_CheckExact          PyUnicode_CheckExact
  118. #endif
  119. #if PY_MAJOR_VERSION >= 3
  120.   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  121.   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  122. #else
  123.   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  124.   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  125. #endif
  126. #ifndef PySet_CheckExact
  127.   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
  128. #endif
  129. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  130. #if PY_MAJOR_VERSION >= 3
  131.   #define PyIntObject                  PyLongObject
  132.   #define PyInt_Type                   PyLong_Type
  133.   #define PyInt_Check(op)              PyLong_Check(op)
  134.   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  135.   #define PyInt_FromString             PyLong_FromString
  136.   #define PyInt_FromUnicode            PyLong_FromUnicode
  137.   #define PyInt_FromLong               PyLong_FromLong
  138.   #define PyInt_FromSize_t             PyLong_FromSize_t
  139.   #define PyInt_FromSsize_t            PyLong_FromSsize_t
  140.   #define PyInt_AsLong                 PyLong_AsLong
  141.   #define PyInt_AS_LONG                PyLong_AS_LONG
  142.   #define PyInt_AsSsize_t              PyLong_AsSsize_t
  143.   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  144.   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  145.   #define PyNumber_Int                 PyNumber_Long
  146. #endif
  147. #if PY_MAJOR_VERSION >= 3
  148.   #define PyBoolObject                 PyLongObject
  149. #endif
  150. #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  151.   #ifndef PyUnicode_InternFromString
  152.     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  153.   #endif
  154. #endif
  155. #if PY_VERSION_HEX < 0x030200A4
  156.   typedef long Py_hash_t;
  157.   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  158.   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
  159. #else
  160.   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  161.   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
  162. #endif
  163. #if PY_MAJOR_VERSION >= 3
  164.   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
  165. #else
  166.   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
  167. #endif
  168. #if PY_VERSION_HEX >= 0x030500B1
  169. #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  170. #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  171. #elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  172. typedef struct {
  173.     unaryfunc am_await;
  174.     unaryfunc am_aiter;
  175.     unaryfunc am_anext;
  176. } __Pyx_PyAsyncMethodsStruct;
  177. #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  178. #else
  179. #define __Pyx_PyType_AsAsync(obj) NULL
  180. #endif
  181. #ifndef CYTHON_RESTRICT
  182.   #if defined(__GNUC__)
  183.     #define CYTHON_RESTRICT __restrict__
  184.   #elif defined(_MSC_VER) && _MSC_VER >= 1400
  185.     #define CYTHON_RESTRICT __restrict
  186.   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  187.     #define CYTHON_RESTRICT restrict
  188.   #else
  189.     #define CYTHON_RESTRICT
  190.   #endif
  191. #endif
  192. #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
  193.  
  194. #ifndef CYTHON_INLINE
  195.   #if defined(__GNUC__)
  196.     #define CYTHON_INLINE __inline__
  197.   #elif defined(_MSC_VER)
  198.     #define CYTHON_INLINE __inline
  199.   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  200.     #define CYTHON_INLINE inline
  201.   #else
  202.     #define CYTHON_INLINE
  203.   #endif
  204. #endif
  205.  
  206. #if defined(WIN32) || defined(MS_WINDOWS)
  207.   #define _USE_MATH_DEFINES
  208. #endif
  209. #include <math.h>
  210. #ifdef NAN
  211. #define __PYX_NAN() ((float) NAN)
  212. #else
  213. static CYTHON_INLINE float __PYX_NAN() {
  214.   float value;
  215.   memset(&value, 0xFF, sizeof(value));
  216.   return value;
  217. }
  218. #endif
  219.  
  220.  
  221. #if PY_MAJOR_VERSION >= 3
  222.   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  223.   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
  224. #else
  225.   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  226.   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
  227. #endif
  228.  
  229. #ifndef __PYX_EXTERN_C
  230.   #ifdef __cplusplus
  231.     #define __PYX_EXTERN_C extern "C"
  232.   #else
  233.     #define __PYX_EXTERN_C extern
  234.   #endif
  235. #endif
  236.  
  237. #define __PYX_HAVE__lemantic__zigzag
  238. #define __PYX_HAVE_API__lemantic__zigzag
  239. #include "string.h"
  240. #include "stdio.h"
  241. #include "stdlib.h"
  242. #include "numpy/arrayobject.h"
  243. #include "numpy/ufuncobject.h"
  244. #ifdef _OPENMP
  245. #include <omp.h>
  246. #endif /* _OPENMP */
  247.  
  248. #ifdef PYREX_WITHOUT_ASSERTIONS
  249. #define CYTHON_WITHOUT_ASSERTIONS
  250. #endif
  251.  
  252. #ifndef CYTHON_UNUSED
  253. # if defined(__GNUC__)
  254. #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  255. #     define CYTHON_UNUSED __attribute__ ((__unused__))
  256. #   else
  257. #     define CYTHON_UNUSED
  258. #   endif
  259. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  260. #   define CYTHON_UNUSED __attribute__ ((__unused__))
  261. # else
  262. #   define CYTHON_UNUSED
  263. # endif
  264. #endif
  265. #ifndef CYTHON_NCP_UNUSED
  266. # if CYTHON_COMPILING_IN_CPYTHON
  267. #  define CYTHON_NCP_UNUSED
  268. # else
  269. #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
  270. # endif
  271. #endif
  272. typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
  273.                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
  274.  
  275. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  276. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
  277. #define __PYX_DEFAULT_STRING_ENCODING ""
  278. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  279. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  280. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  281. #define __Pyx_long_cast(x) ((long)x)
  282. #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
  283.     (sizeof(type) < sizeof(Py_ssize_t))  ||\
  284.     (sizeof(type) > sizeof(Py_ssize_t) &&\
  285.           likely(v < (type)PY_SSIZE_T_MAX ||\
  286.                  v == (type)PY_SSIZE_T_MAX)  &&\
  287.           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  288.                                 v == (type)PY_SSIZE_T_MIN)))  ||\
  289.     (sizeof(type) == sizeof(Py_ssize_t) &&\
  290.           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  291.                                v == (type)PY_SSIZE_T_MAX)))  )
  292. #if defined (__cplusplus) && __cplusplus >= 201103L
  293.     #include <cstdlib>
  294.     #define __Pyx_sst_abs(value) std::abs(value)
  295. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  296.     #define __Pyx_sst_abs(value) abs(value)
  297. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  298.     #define __Pyx_sst_abs(value) labs(value)
  299. #elif defined (_MSC_VER) && defined (_M_X64)
  300.     #define __Pyx_sst_abs(value) _abs64(value)
  301. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  302.     #define __Pyx_sst_abs(value) llabs(value)
  303. #elif defined (__GNUC__)
  304.     #define __Pyx_sst_abs(value) __builtin_llabs(value)
  305. #else
  306.     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  307. #endif
  308. static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
  309. static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  310. #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
  311. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  312. #define __Pyx_PyBytes_FromString        PyBytes_FromString
  313. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  314. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  315. #if PY_MAJOR_VERSION < 3
  316.     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
  317.     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  318. #else
  319.     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
  320.     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  321. #endif
  322. #define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
  323. #define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
  324. #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
  325. #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
  326. #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
  327. #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
  328. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  329. #if PY_MAJOR_VERSION < 3
  330. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
  331. {
  332.     const Py_UNICODE *u_end = u;
  333.     while (*u_end++) ;
  334.     return (size_t)(u_end - u - 1);
  335. }
  336. #else
  337. #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
  338. #endif
  339. #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  340. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  341. #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
  342. #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
  343. #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
  344. #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
  345. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  346. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
  347. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  348. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  349. #if CYTHON_COMPILING_IN_CPYTHON
  350. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  351. #else
  352. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  353. #endif
  354. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  355. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  356. static int __Pyx_sys_getdefaultencoding_not_ascii;
  357. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  358.     PyObject* sys;
  359.     PyObject* default_encoding = NULL;
  360.     PyObject* ascii_chars_u = NULL;
  361.     PyObject* ascii_chars_b = NULL;
  362.     const char* default_encoding_c;
  363.     sys = PyImport_ImportModule("sys");
  364.     if (!sys) goto bad;
  365.     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
  366.     Py_DECREF(sys);
  367.     if (!default_encoding) goto bad;
  368.     default_encoding_c = PyBytes_AsString(default_encoding);
  369.     if (!default_encoding_c) goto bad;
  370.     if (strcmp(default_encoding_c, "ascii") == 0) {
  371.         __Pyx_sys_getdefaultencoding_not_ascii = 0;
  372.     } else {
  373.         char ascii_chars[128];
  374.         int c;
  375.         for (c = 0; c < 128; c++) {
  376.             ascii_chars[c] = c;
  377.         }
  378.         __Pyx_sys_getdefaultencoding_not_ascii = 1;
  379.         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  380.         if (!ascii_chars_u) goto bad;
  381.         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  382.         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  383.             PyErr_Format(
  384.                 PyExc_ValueError,
  385.                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  386.                 default_encoding_c);
  387.             goto bad;
  388.         }
  389.         Py_DECREF(ascii_chars_u);
  390.         Py_DECREF(ascii_chars_b);
  391.     }
  392.     Py_DECREF(default_encoding);
  393.     return 0;
  394. bad:
  395.     Py_XDECREF(default_encoding);
  396.     Py_XDECREF(ascii_chars_u);
  397.     Py_XDECREF(ascii_chars_b);
  398.     return -1;
  399. }
  400. #endif
  401. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  402. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  403. #else
  404. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  405. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  406. static char* __PYX_DEFAULT_STRING_ENCODING;
  407. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  408.     PyObject* sys;
  409.     PyObject* default_encoding = NULL;
  410.     char* default_encoding_c;
  411.     sys = PyImport_ImportModule("sys");
  412.     if (!sys) goto bad;
  413.     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  414.     Py_DECREF(sys);
  415.     if (!default_encoding) goto bad;
  416.     default_encoding_c = PyBytes_AsString(default_encoding);
  417.     if (!default_encoding_c) goto bad;
  418.     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
  419.     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
  420.     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  421.     Py_DECREF(default_encoding);
  422.     return 0;
  423. bad:
  424.     Py_XDECREF(default_encoding);
  425.     return -1;
  426. }
  427. #endif
  428. #endif
  429.  
  430.  
  431. /* Test for GCC > 2.95 */
  432. #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  433.   #define likely(x)   __builtin_expect(!!(x), 1)
  434.   #define unlikely(x) __builtin_expect(!!(x), 0)
  435. #else /* !__GNUC__ or GCC < 2.95 */
  436.   #define likely(x)   (x)
  437.   #define unlikely(x) (x)
  438. #endif /* __GNUC__ */
  439.  
  440. static PyObject *__pyx_m;
  441. static PyObject *__pyx_d;
  442. static PyObject *__pyx_b;
  443. static PyObject *__pyx_empty_tuple;
  444. static PyObject *__pyx_empty_bytes;
  445. static int __pyx_lineno;
  446. static int __pyx_clineno = 0;
  447. static const char * __pyx_cfilenm= __FILE__;
  448. static const char *__pyx_filename;
  449.  
  450. #if !defined(CYTHON_CCOMPLEX)
  451.   #if defined(__cplusplus)
  452.     #define CYTHON_CCOMPLEX 1
  453.   #elif defined(_Complex_I)
  454.     #define CYTHON_CCOMPLEX 1
  455.   #else
  456.     #define CYTHON_CCOMPLEX 0
  457.   #endif
  458. #endif
  459. #if CYTHON_CCOMPLEX
  460.   #ifdef __cplusplus
  461.     #include <complex>
  462.   #else
  463.     #include <complex.h>
  464.   #endif
  465. #endif
  466. #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  467.   #undef _Complex_I
  468.   #define _Complex_I 1.0fj
  469. #endif
  470.  
  471.  
  472. static const char *__pyx_f[] = {
  473.   "lemantic/zigzag.pyx",
  474.   "__init__.pxd",
  475.   "type.pxd",
  476. };
  477. #define IS_UNSIGNED(type) (((type) -1) > 0)
  478. struct __Pyx_StructField_;
  479. #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
  480. typedef struct {
  481.   const char* name;
  482.   struct __Pyx_StructField_* fields;
  483.   size_t size;
  484.   size_t arraysize[8];
  485.   int ndim;
  486.   char typegroup;
  487.   char is_unsigned;
  488.   int flags;
  489. } __Pyx_TypeInfo;
  490. typedef struct __Pyx_StructField_ {
  491.   __Pyx_TypeInfo* type;
  492.   const char* name;
  493.   size_t offset;
  494. } __Pyx_StructField;
  495. typedef struct {
  496.   __Pyx_StructField* field;
  497.   size_t parent_offset;
  498. } __Pyx_BufFmt_StackElem;
  499. typedef struct {
  500.   __Pyx_StructField root;
  501.   __Pyx_BufFmt_StackElem* head;
  502.   size_t fmt_offset;
  503.   size_t new_count, enc_count;
  504.   size_t struct_alignment;
  505.   int is_complex;
  506.   char enc_type;
  507.   char new_packmode;
  508.   char enc_packmode;
  509.   char is_valid_array;
  510. } __Pyx_BufFmt_Context;
  511.  
  512.  
  513. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":725
  514.  * # in Cython to enable them only on the right systems.
  515.  *
  516.  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
  517.  * ctypedef npy_int16      int16_t
  518.  * ctypedef npy_int32      int32_t
  519.  */
  520. typedef npy_int8 __pyx_t_5numpy_int8_t;
  521.  
  522. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":726
  523.  *
  524.  * ctypedef npy_int8       int8_t
  525.  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
  526.  * ctypedef npy_int32      int32_t
  527.  * ctypedef npy_int64      int64_t
  528.  */
  529. typedef npy_int16 __pyx_t_5numpy_int16_t;
  530.  
  531. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":727
  532.  * ctypedef npy_int8       int8_t
  533.  * ctypedef npy_int16      int16_t
  534.  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
  535.  * ctypedef npy_int64      int64_t
  536.  * #ctypedef npy_int96      int96_t
  537.  */
  538. typedef npy_int32 __pyx_t_5numpy_int32_t;
  539.  
  540. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":728
  541.  * ctypedef npy_int16      int16_t
  542.  * ctypedef npy_int32      int32_t
  543.  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
  544.  * #ctypedef npy_int96      int96_t
  545.  * #ctypedef npy_int128     int128_t
  546.  */
  547. typedef npy_int64 __pyx_t_5numpy_int64_t;
  548.  
  549. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":732
  550.  * #ctypedef npy_int128     int128_t
  551.  *
  552.  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
  553.  * ctypedef npy_uint16     uint16_t
  554.  * ctypedef npy_uint32     uint32_t
  555.  */
  556. typedef npy_uint8 __pyx_t_5numpy_uint8_t;
  557.  
  558. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":733
  559.  *
  560.  * ctypedef npy_uint8      uint8_t
  561.  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
  562.  * ctypedef npy_uint32     uint32_t
  563.  * ctypedef npy_uint64     uint64_t
  564.  */
  565. typedef npy_uint16 __pyx_t_5numpy_uint16_t;
  566.  
  567. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":734
  568.  * ctypedef npy_uint8      uint8_t
  569.  * ctypedef npy_uint16     uint16_t
  570.  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
  571.  * ctypedef npy_uint64     uint64_t
  572.  * #ctypedef npy_uint96     uint96_t
  573.  */
  574. typedef npy_uint32 __pyx_t_5numpy_uint32_t;
  575.  
  576. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":735
  577.  * ctypedef npy_uint16     uint16_t
  578.  * ctypedef npy_uint32     uint32_t
  579.  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
  580.  * #ctypedef npy_uint96     uint96_t
  581.  * #ctypedef npy_uint128    uint128_t
  582.  */
  583. typedef npy_uint64 __pyx_t_5numpy_uint64_t;
  584.  
  585. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":739
  586.  * #ctypedef npy_uint128    uint128_t
  587.  *
  588.  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
  589.  * ctypedef npy_float64    float64_t
  590.  * #ctypedef npy_float80    float80_t
  591.  */
  592. typedef npy_float32 __pyx_t_5numpy_float32_t;
  593.  
  594. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":740
  595.  *
  596.  * ctypedef npy_float32    float32_t
  597.  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
  598.  * #ctypedef npy_float80    float80_t
  599.  * #ctypedef npy_float128   float128_t
  600.  */
  601. typedef npy_float64 __pyx_t_5numpy_float64_t;
  602.  
  603. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":749
  604.  * # The int types are mapped a bit surprising --
  605.  * # numpy.int corresponds to 'l' and numpy.long to 'q'
  606.  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
  607.  * ctypedef npy_longlong   long_t
  608.  * ctypedef npy_longlong   longlong_t
  609.  */
  610. typedef npy_long __pyx_t_5numpy_int_t;
  611.  
  612. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":750
  613.  * # numpy.int corresponds to 'l' and numpy.long to 'q'
  614.  * ctypedef npy_long       int_t
  615.  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
  616.  * ctypedef npy_longlong   longlong_t
  617.  *
  618.  */
  619. typedef npy_longlong __pyx_t_5numpy_long_t;
  620.  
  621. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":751
  622.  * ctypedef npy_long       int_t
  623.  * ctypedef npy_longlong   long_t
  624.  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
  625.  *
  626.  * ctypedef npy_ulong      uint_t
  627.  */
  628. typedef npy_longlong __pyx_t_5numpy_longlong_t;
  629.  
  630. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":753
  631.  * ctypedef npy_longlong   longlong_t
  632.  *
  633.  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
  634.  * ctypedef npy_ulonglong  ulong_t
  635.  * ctypedef npy_ulonglong  ulonglong_t
  636.  */
  637. typedef npy_ulong __pyx_t_5numpy_uint_t;
  638.  
  639. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":754
  640.  *
  641.  * ctypedef npy_ulong      uint_t
  642.  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
  643.  * ctypedef npy_ulonglong  ulonglong_t
  644.  *
  645.  */
  646. typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
  647.  
  648. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":755
  649.  * ctypedef npy_ulong      uint_t
  650.  * ctypedef npy_ulonglong  ulong_t
  651.  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
  652.  *
  653.  * ctypedef npy_intp       intp_t
  654.  */
  655. typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
  656.  
  657. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":757
  658.  * ctypedef npy_ulonglong  ulonglong_t
  659.  *
  660.  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
  661.  * ctypedef npy_uintp      uintp_t
  662.  *
  663.  */
  664. typedef npy_intp __pyx_t_5numpy_intp_t;
  665.  
  666. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":758
  667.  *
  668.  * ctypedef npy_intp       intp_t
  669.  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
  670.  *
  671.  * ctypedef npy_double     float_t
  672.  */
  673. typedef npy_uintp __pyx_t_5numpy_uintp_t;
  674.  
  675. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":760
  676.  * ctypedef npy_uintp      uintp_t
  677.  *
  678.  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
  679.  * ctypedef npy_double     double_t
  680.  * ctypedef npy_longdouble longdouble_t
  681.  */
  682. typedef npy_double __pyx_t_5numpy_float_t;
  683.  
  684. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":761
  685.  *
  686.  * ctypedef npy_double     float_t
  687.  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
  688.  * ctypedef npy_longdouble longdouble_t
  689.  *
  690.  */
  691. typedef npy_double __pyx_t_5numpy_double_t;
  692.  
  693. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":762
  694.  * ctypedef npy_double     float_t
  695.  * ctypedef npy_double     double_t
  696.  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
  697.  *
  698.  * ctypedef npy_cfloat      cfloat_t
  699.  */
  700. typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
  701.  
  702. /* "lemantic/zigzag.pyx":6
  703.  * cimport cython
  704.  *
  705.  * ctypedef unsigned short uint16_t # TODO - Support different types             # <<<<<<<<<<<<<<
  706.  * ctypedef short int16_t
  707.  *
  708.  */
  709. typedef unsigned short __pyx_t_8lemantic_6zigzag_uint16_t;
  710.  
  711. /* "lemantic/zigzag.pyx":7
  712.  *
  713.  * ctypedef unsigned short uint16_t # TODO - Support different types
  714.  * ctypedef short int16_t             # <<<<<<<<<<<<<<
  715.  *
  716.  *
  717.  */
  718. typedef short __pyx_t_8lemantic_6zigzag_int16_t;
  719. #if CYTHON_CCOMPLEX
  720.   #ifdef __cplusplus
  721.     typedef ::std::complex< float > __pyx_t_float_complex;
  722.   #else
  723.     typedef float _Complex __pyx_t_float_complex;
  724.   #endif
  725. #else
  726.     typedef struct { float real, imag; } __pyx_t_float_complex;
  727. #endif
  728.  
  729. #if CYTHON_CCOMPLEX
  730.   #ifdef __cplusplus
  731.     typedef ::std::complex< double > __pyx_t_double_complex;
  732.   #else
  733.     typedef double _Complex __pyx_t_double_complex;
  734.   #endif
  735. #else
  736.     typedef struct { double real, imag; } __pyx_t_double_complex;
  737. #endif
  738.  
  739.  
  740. /*--- Type declarations ---*/
  741.  
  742. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":764
  743.  * ctypedef npy_longdouble longdouble_t
  744.  *
  745.  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
  746.  * ctypedef npy_cdouble     cdouble_t
  747.  * ctypedef npy_clongdouble clongdouble_t
  748.  */
  749. typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
  750.  
  751. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":765
  752.  *
  753.  * ctypedef npy_cfloat      cfloat_t
  754.  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
  755.  * ctypedef npy_clongdouble clongdouble_t
  756.  *
  757.  */
  758. typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
  759.  
  760. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":766
  761.  * ctypedef npy_cfloat      cfloat_t
  762.  * ctypedef npy_cdouble     cdouble_t
  763.  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
  764.  *
  765.  * ctypedef npy_cdouble     complex_t
  766.  */
  767. typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
  768.  
  769. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":768
  770.  * ctypedef npy_clongdouble clongdouble_t
  771.  *
  772.  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
  773.  *
  774.  * cdef inline object PyArray_MultiIterNew1(a):
  775.  */
  776. typedef npy_cdouble __pyx_t_5numpy_complex_t;
  777.  
  778. /* --- Runtime support code (head) --- */
  779. #ifndef CYTHON_REFNANNY
  780.   #define CYTHON_REFNANNY 0
  781. #endif
  782. #if CYTHON_REFNANNY
  783.   typedef struct {
  784.     void (*INCREF)(void*, PyObject*, int);
  785.     void (*DECREF)(void*, PyObject*, int);
  786.     void (*GOTREF)(void*, PyObject*, int);
  787.     void (*GIVEREF)(void*, PyObject*, int);
  788.     void* (*SetupContext)(const char*, int, const char*);
  789.     void (*FinishContext)(void**);
  790.   } __Pyx_RefNannyAPIStruct;
  791.   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  792.   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  793.   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  794. #ifdef WITH_THREAD
  795.   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  796.           if (acquire_gil) {\
  797.               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  798.               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  799.               PyGILState_Release(__pyx_gilstate_save);\
  800.           } else {\
  801.               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  802.           }
  803. #else
  804.   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  805.           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  806. #endif
  807.   #define __Pyx_RefNannyFinishContext()\
  808.           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  809.   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  810.   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  811.   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  812.   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  813.   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  814.   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  815.   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  816.   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  817. #else
  818.   #define __Pyx_RefNannyDeclarations
  819.   #define __Pyx_RefNannySetupContext(name, acquire_gil)
  820.   #define __Pyx_RefNannyFinishContext()
  821.   #define __Pyx_INCREF(r) Py_INCREF(r)
  822.   #define __Pyx_DECREF(r) Py_DECREF(r)
  823.   #define __Pyx_GOTREF(r)
  824.   #define __Pyx_GIVEREF(r)
  825.   #define __Pyx_XINCREF(r) Py_XINCREF(r)
  826.   #define __Pyx_XDECREF(r) Py_XDECREF(r)
  827.   #define __Pyx_XGOTREF(r)
  828.   #define __Pyx_XGIVEREF(r)
  829. #endif
  830. #define __Pyx_XDECREF_SET(r, v) do {\
  831.         PyObject *tmp = (PyObject *) r;\
  832.         r = v; __Pyx_XDECREF(tmp);\
  833.     } while (0)
  834. #define __Pyx_DECREF_SET(r, v) do {\
  835.         PyObject *tmp = (PyObject *) r;\
  836.         r = v; __Pyx_DECREF(tmp);\
  837.     } while (0)
  838. #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  839. #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  840.  
  841. #if CYTHON_COMPILING_IN_CPYTHON
  842. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  843.     PyTypeObject* tp = Py_TYPE(obj);
  844.     if (likely(tp->tp_getattro))
  845.         return tp->tp_getattro(obj, attr_name);
  846. #if PY_MAJOR_VERSION < 3
  847.     if (likely(tp->tp_getattr))
  848.         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  849. #endif
  850.     return PyObject_GetAttr(obj, attr_name);
  851. }
  852. #else
  853. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  854. #endif
  855.  
  856. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  857.  
  858. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  859.     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  860.  
  861. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  862.  
  863. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
  864.     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
  865.     const char* function_name);
  866.  
  867. static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
  868.     const char *name, int exact);
  869.  
  870. static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
  871.     __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
  872. static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
  873.  
  874. static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
  875.  
  876. #if CYTHON_COMPILING_IN_CPYTHON
  877. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  878. #else
  879. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  880. #endif
  881.  
  882. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
  883.  
  884. static void __Pyx_RaiseBufferIndexError(int axis);
  885.  
  886. #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
  887. static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
  888. static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
  889.  
  890. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  891.  
  892. #if CYTHON_COMPILING_IN_CPYTHON
  893. #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
  894. static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
  895.     PyTypeObject* tp = Py_TYPE(obj);
  896.     if (likely(tp->tp_setattro))
  897.         return tp->tp_setattro(obj, attr_name, value);
  898. #if PY_MAJOR_VERSION < 3
  899.     if (likely(tp->tp_setattr))
  900.         return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
  901. #endif
  902.     return PyObject_SetAttr(obj, attr_name, value);
  903. }
  904. #else
  905. #define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
  906. #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
  907. #endif
  908.  
  909. #if CYTHON_COMPILING_IN_CPYTHON
  910. static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
  911. #else
  912. #define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\
  913.     PyObject_RichCompare(op1, op2, Py_EQ)
  914.     #endif
  915.  
  916. #if CYTHON_COMPILING_IN_CPYTHON
  917. static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
  918. #else
  919. #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace)\
  920.     (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
  921. #endif
  922.  
  923. static double __Pyx__PyObject_AsDouble(PyObject* obj);
  924. #if CYTHON_COMPILING_IN_PYPY
  925. #define __Pyx_PyObject_AsDouble(obj)\
  926. (likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
  927.  likely(PyInt_CheckExact(obj)) ?\
  928.  PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
  929. #else
  930. #define __Pyx_PyObject_AsDouble(obj)\
  931. ((likely(PyFloat_CheckExact(obj))) ?\
  932.  PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
  933. #endif
  934.  
  935. #define __Pyx_PyNumber_Power2(a, b) PyNumber_Power(a, b, Py_None)
  936.  
  937. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  938.  
  939. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  940.  
  941. static CYTHON_INLINE int __Pyx_IterFinish(void);
  942.  
  943. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
  944.  
  945. #if CYTHON_COMPILING_IN_CPYTHON
  946. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  947. #endif
  948.  
  949. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  950.  
  951. #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
  952. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
  953.     PyObject *value;
  954.     value = PyDict_GetItemWithError(d, key);
  955.     if (unlikely(!value)) {
  956.         if (!PyErr_Occurred()) {
  957.             PyObject* args = PyTuple_Pack(1, key);
  958.             if (likely(args))
  959.                 PyErr_SetObject(PyExc_KeyError, args);
  960.             Py_XDECREF(args);
  961.         }
  962.         return NULL;
  963.     }
  964.     Py_INCREF(value);
  965.     return value;
  966. }
  967. #else
  968.     #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
  969. #endif
  970.  
  971. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
  972.  
  973. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
  974.  
  975. static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
  976.  
  977. static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
  978.  
  979. #define __Pyx_CyFunction_USED 1
  980. #include <structmember.h>
  981. #define __Pyx_CYFUNCTION_STATICMETHOD  0x01
  982. #define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
  983. #define __Pyx_CYFUNCTION_CCLASS        0x04
  984. #define __Pyx_CyFunction_GetClosure(f)\
  985.     (((__pyx_CyFunctionObject *) (f))->func_closure)
  986. #define __Pyx_CyFunction_GetClassObj(f)\
  987.     (((__pyx_CyFunctionObject *) (f))->func_classobj)
  988. #define __Pyx_CyFunction_Defaults(type, f)\
  989.     ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
  990. #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
  991.     ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
  992. typedef struct {
  993.     PyCFunctionObject func;
  994. #if PY_VERSION_HEX < 0x030500A0
  995.     PyObject *func_weakreflist;
  996. #endif
  997.     PyObject *func_dict;
  998.     PyObject *func_name;
  999.     PyObject *func_qualname;
  1000.     PyObject *func_doc;
  1001.     PyObject *func_globals;
  1002.     PyObject *func_code;
  1003.     PyObject *func_closure;
  1004.     PyObject *func_classobj;
  1005.     void *defaults;
  1006.     int defaults_pyobjects;
  1007.     int flags;
  1008.     PyObject *defaults_tuple;
  1009.     PyObject *defaults_kwdict;
  1010.     PyObject *(*defaults_getter)(PyObject *);
  1011.     PyObject *func_annotations;
  1012. } __pyx_CyFunctionObject;
  1013. static PyTypeObject *__pyx_CyFunctionType = 0;
  1014. #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
  1015.     __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
  1016. static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
  1017.                                       int flags, PyObject* qualname,
  1018.                                       PyObject *self,
  1019.                                       PyObject *module, PyObject *globals,
  1020.                                       PyObject* code);
  1021. static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
  1022.                                                          size_t size,
  1023.                                                          int pyobjects);
  1024. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
  1025.                                                             PyObject *tuple);
  1026. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
  1027.                                                              PyObject *dict);
  1028. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
  1029.                                                               PyObject *dict);
  1030. static int __pyx_CyFunction_init(void);
  1031.  
  1032. static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
  1033.                                            PyObject *mkw, PyObject *modname, PyObject *doc);
  1034. static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
  1035.                                       PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
  1036.  
  1037. typedef struct {
  1038.     int code_line;
  1039.     PyCodeObject* code_object;
  1040. } __Pyx_CodeObjectCacheEntry;
  1041. struct __Pyx_CodeObjectCache {
  1042.     int count;
  1043.     int max_count;
  1044.     __Pyx_CodeObjectCacheEntry* entries;
  1045. };
  1046. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  1047. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  1048. static PyCodeObject *__pyx_find_code_object(int code_line);
  1049. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  1050.  
  1051. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  1052.                                int py_line, const char *filename);
  1053.  
  1054. typedef struct {
  1055.   Py_ssize_t shape, strides, suboffsets;
  1056. } __Pyx_Buf_DimInfo;
  1057. typedef struct {
  1058.   size_t refcount;
  1059.   Py_buffer pybuffer;
  1060. } __Pyx_Buffer;
  1061. typedef struct {
  1062.   __Pyx_Buffer *rcbuffer;
  1063.   char *data;
  1064.   __Pyx_Buf_DimInfo diminfo[8];
  1065. } __Pyx_LocalBuf_ND;
  1066.  
  1067. #if PY_MAJOR_VERSION < 3
  1068.     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
  1069.     static void __Pyx_ReleaseBuffer(Py_buffer *view);
  1070. #else
  1071.     #define __Pyx_GetBuffer PyObject_GetBuffer
  1072.     #define __Pyx_ReleaseBuffer PyBuffer_Release
  1073. #endif
  1074.  
  1075.  
  1076. static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
  1077. static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
  1078.  
  1079. static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *);
  1080.  
  1081. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  1082.  
  1083. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_short(unsigned short value);
  1084.  
  1085. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
  1086.  
  1087. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value);
  1088.  
  1089. static int __Pyx_Print(PyObject*, PyObject *, int);
  1090. #if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
  1091. static PyObject* __pyx_print = 0;
  1092. static PyObject* __pyx_print_kwargs = 0;
  1093. #endif
  1094.  
  1095. static int __Pyx_PrintOne(PyObject* stream, PyObject *o);
  1096.  
  1097. #if CYTHON_CCOMPLEX
  1098.   #ifdef __cplusplus
  1099.     #define __Pyx_CREAL(z) ((z).real())
  1100.     #define __Pyx_CIMAG(z) ((z).imag())
  1101.   #else
  1102.     #define __Pyx_CREAL(z) (__real__(z))
  1103.     #define __Pyx_CIMAG(z) (__imag__(z))
  1104.   #endif
  1105. #else
  1106.     #define __Pyx_CREAL(z) ((z).real)
  1107.     #define __Pyx_CIMAG(z) ((z).imag)
  1108. #endif
  1109. #if (defined(_WIN32) || defined(__clang__)) && defined(__cplusplus) && CYTHON_CCOMPLEX
  1110.     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
  1111.     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
  1112. #else
  1113.     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
  1114.     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
  1115. #endif
  1116.  
  1117. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
  1118.  
  1119. #if CYTHON_CCOMPLEX
  1120.     #define __Pyx_c_eqf(a, b)   ((a)==(b))
  1121.     #define __Pyx_c_sumf(a, b)  ((a)+(b))
  1122.     #define __Pyx_c_difff(a, b) ((a)-(b))
  1123.     #define __Pyx_c_prodf(a, b) ((a)*(b))
  1124.     #define __Pyx_c_quotf(a, b) ((a)/(b))
  1125.     #define __Pyx_c_negf(a)     (-(a))
  1126.   #ifdef __cplusplus
  1127.     #define __Pyx_c_is_zerof(z) ((z)==(float)0)
  1128.     #define __Pyx_c_conjf(z)    (::std::conj(z))
  1129.     #if 1
  1130.         #define __Pyx_c_absf(z)     (::std::abs(z))
  1131.         #define __Pyx_c_powf(a, b)  (::std::pow(a, b))
  1132.     #endif
  1133.   #else
  1134.     #define __Pyx_c_is_zerof(z) ((z)==0)
  1135.     #define __Pyx_c_conjf(z)    (conjf(z))
  1136.     #if 1
  1137.         #define __Pyx_c_absf(z)     (cabsf(z))
  1138.         #define __Pyx_c_powf(a, b)  (cpowf(a, b))
  1139.     #endif
  1140.  #endif
  1141. #else
  1142.     static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
  1143.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
  1144.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
  1145.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
  1146.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
  1147.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
  1148.     static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
  1149.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
  1150.     #if 1
  1151.         static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
  1152.         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
  1153.     #endif
  1154. #endif
  1155.  
  1156. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
  1157.  
  1158. #if CYTHON_CCOMPLEX
  1159.     #define __Pyx_c_eq(a, b)   ((a)==(b))
  1160.     #define __Pyx_c_sum(a, b)  ((a)+(b))
  1161.     #define __Pyx_c_diff(a, b) ((a)-(b))
  1162.     #define __Pyx_c_prod(a, b) ((a)*(b))
  1163.     #define __Pyx_c_quot(a, b) ((a)/(b))
  1164.     #define __Pyx_c_neg(a)     (-(a))
  1165.   #ifdef __cplusplus
  1166.     #define __Pyx_c_is_zero(z) ((z)==(double)0)
  1167.     #define __Pyx_c_conj(z)    (::std::conj(z))
  1168.     #if 1
  1169.         #define __Pyx_c_abs(z)     (::std::abs(z))
  1170.         #define __Pyx_c_pow(a, b)  (::std::pow(a, b))
  1171.     #endif
  1172.   #else
  1173.     #define __Pyx_c_is_zero(z) ((z)==0)
  1174.     #define __Pyx_c_conj(z)    (conj(z))
  1175.     #if 1
  1176.         #define __Pyx_c_abs(z)     (cabs(z))
  1177.         #define __Pyx_c_pow(a, b)  (cpow(a, b))
  1178.     #endif
  1179.  #endif
  1180. #else
  1181.     static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
  1182.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
  1183.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
  1184.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
  1185.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
  1186.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
  1187.     static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
  1188.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
  1189.     #if 1
  1190.         static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
  1191.         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
  1192.     #endif
  1193. #endif
  1194.  
  1195. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
  1196.  
  1197. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
  1198.  
  1199. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  1200.  
  1201. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  1202.  
  1203. static int __Pyx_check_binary_version(void);
  1204.  
  1205. #if !defined(__Pyx_PyIdentifier_FromString)
  1206. #if PY_MAJOR_VERSION < 3
  1207.   #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
  1208. #else
  1209.   #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
  1210. #endif
  1211. #endif
  1212.  
  1213. static PyObject *__Pyx_ImportModule(const char *name);
  1214.  
  1215. static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
  1216.  
  1217. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
  1218.  
  1219.  
  1220. /* Module declarations from 'cpython.buffer' */
  1221.  
  1222. /* Module declarations from 'libc.string' */
  1223.  
  1224. /* Module declarations from 'libc.stdio' */
  1225.  
  1226. /* Module declarations from '__builtin__' */
  1227.  
  1228. /* Module declarations from 'cpython.type' */
  1229. static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
  1230.  
  1231. /* Module declarations from 'cpython' */
  1232.  
  1233. /* Module declarations from 'cpython.object' */
  1234.  
  1235. /* Module declarations from 'cpython.ref' */
  1236.  
  1237. /* Module declarations from 'libc.stdlib' */
  1238.  
  1239. /* Module declarations from 'numpy' */
  1240.  
  1241. /* Module declarations from 'numpy' */
  1242. static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
  1243. static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
  1244. static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
  1245. static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
  1246. static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
  1247. static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
  1248.  
  1249. /* Module declarations from 'cython' */
  1250.  
  1251. /* Module declarations from 'lemantic.zigzag' */
  1252. static __pyx_t_8lemantic_6zigzag_uint16_t __pyx_f_8lemantic_6zigzag__zig_zag(__pyx_t_8lemantic_6zigzag_int16_t, int __pyx_skip_dispatch); /*proto*/
  1253. static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_8lemantic_6zigzag_int16_t = { "int16_t", NULL, sizeof(__pyx_t_8lemantic_6zigzag_int16_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_8lemantic_6zigzag_int16_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_8lemantic_6zigzag_int16_t), 0 };
  1254. static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint16_t = { "uint16_t", NULL, sizeof(__pyx_t_5numpy_uint16_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint16_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint16_t), 0 };
  1255. #define __Pyx_MODULE_NAME "lemantic.zigzag"
  1256. int __pyx_module_is_main_lemantic__zigzag = 0;
  1257.  
  1258. /* Implementation of 'lemantic.zigzag' */
  1259. static PyObject *__pyx_builtin_object;
  1260. static PyObject *__pyx_builtin_property;
  1261. static PyObject *__pyx_builtin_xrange;
  1262. static PyObject *__pyx_builtin_Exception;
  1263. static PyObject *__pyx_builtin_ValueError;
  1264. static PyObject *__pyx_builtin_range;
  1265. static PyObject *__pyx_builtin_RuntimeError;
  1266. static char __pyx_k_B[] = "B";
  1267. static char __pyx_k_H[] = "H";
  1268. static char __pyx_k_I[] = "I";
  1269. static char __pyx_k_L[] = "L";
  1270. static char __pyx_k_O[] = "O";
  1271. static char __pyx_k_Q[] = "Q";
  1272. static char __pyx_k_b[] = "b";
  1273. static char __pyx_k_d[] = "d";
  1274. static char __pyx_k_f[] = "f";
  1275. static char __pyx_k_g[] = "g";
  1276. static char __pyx_k_h[] = "h";
  1277. static char __pyx_k_i[] = "i";
  1278. static char __pyx_k_l[] = "l";
  1279. static char __pyx_k_q[] = "q";
  1280. static char __pyx_k_Zd[] = "Zd";
  1281. static char __pyx_k_Zf[] = "Zf";
  1282. static char __pyx_k_Zg[] = "Zg";
  1283. static char __pyx_k_np[] = "np";
  1284. static char __pyx_k_abs[] = "abs";
  1285. static char __pyx_k_doc[] = "__doc__";
  1286. static char __pyx_k_end[] = "end";
  1287. static char __pyx_k_idx[] = "idx";
  1288. static char __pyx_k_log[] = "log";
  1289. static char __pyx_k_clip[] = "clip";
  1290. static char __pyx_k_file[] = "file";
  1291. static char __pyx_k_init[] = "__init__";
  1292. static char __pyx_k_main[] = "__main__";
  1293. static char __pyx_k_prev[] = "prev";
  1294. static char __pyx_k_self[] = "self";
  1295. static char __pyx_k_test[] = "__test__";
  1296. static char __pyx_k_dtype[] = "dtype";
  1297. static char __pyx_k_e_idx[] = "e_idx";
  1298. static char __pyx_k_empty[] = "empty";
  1299. static char __pyx_k_int16[] = "int16";
  1300. static char __pyx_k_int32[] = "int32";
  1301. static char __pyx_k_int64[] = "int64";
  1302. static char __pyx_k_items[] = "items";
  1303. static char __pyx_k_numpy[] = "numpy";
  1304. static char __pyx_k_print[] = "print";
  1305. static char __pyx_k_range[] = "range";
  1306. static char __pyx_k_ZigZag[] = "ZigZag";
  1307. static char __pyx_k_astype[] = "astype";
  1308. static char __pyx_k_bounds[] = "bounds";
  1309. static char __pyx_k_decode[] = "decode";
  1310. static char __pyx_k_encode[] = "encode";
  1311. static char __pyx_k_import[] = "__import__";
  1312. static char __pyx_k_module[] = "__module__";
  1313. static char __pyx_k_object[] = "object";
  1314. static char __pyx_k_scalar[] = "scalar";
  1315. static char __pyx_k_setter[] = "setter";
  1316. static char __pyx_k_uint16[] = "uint16";
  1317. static char __pyx_k_uint32[] = "uint32";
  1318. static char __pyx_k_uint64[] = "uint64";
  1319. static char __pyx_k_xrange[] = "xrange";
  1320. static char __pyx_k_dtype_2[] = "_dtype";
  1321. static char __pyx_k_encoded[] = "encoded";
  1322. static char __pyx_k_prepare[] = "__prepare__";
  1323. static char __pyx_k_bit_size[] = "bit_size";
  1324. static char __pyx_k_itemsize[] = "itemsize";
  1325. static char __pyx_k_property[] = "property";
  1326. static char __pyx_k_qualname[] = "__qualname__";
  1327. static char __pyx_k_Exception[] = "Exception";
  1328. static char __pyx_k_byte_size[] = "byte_size";
  1329. static char __pyx_k_dimension[] = "dimension";
  1330. static char __pyx_k_max_value[] = "_max_value";
  1331. static char __pyx_k_metaclass[] = "__metaclass__";
  1332. static char __pyx_k_pre_dtype[] = "_pre_dtype";
  1333. static char __pyx_k_quantized[] = "quantized";
  1334. static char __pyx_k_ValueError[] = "ValueError";
  1335. static char __pyx_k_bit_size_2[] = "_bit_size";
  1336. static char __pyx_k_max_bounds[] = "max_bounds";
  1337. static char __pyx_k_min_bounds[] = "min_bounds";
  1338. static char __pyx_k_pre_dtype_2[] = "pre_dtype";
  1339. static char __pyx_k_RuntimeError[] = "RuntimeError";
  1340. static char __pyx_k_ZigZag___init[] = "ZigZag.__init__";
  1341. static char __pyx_k_ZigZag_decode[] = "ZigZag.decode";
  1342. static char __pyx_k_ZigZag_encode[] = "ZigZag.encode";
  1343. static char __pyx_k_lemantic_zigzag[] = "lemantic.zigzag";
  1344. static char __pyx_k_ZigZag_byte_size[] = "ZigZag.byte_size";
  1345. static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
  1346. static char __pyx_k_home_batman_one_xx_projects_map[] = "/home/batman/one/xx/projects/map3d/lemantic/zigzag.pyx";
  1347. static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
  1348. static char __pyx_k_Bytes_size_d_is_not_a_power_of_2[] = "Bytes size %d is not a power of 2";
  1349. static char __pyx_k_Different_byte_sizes_have_yet_to[] = "Different byte sizes have yet to be implemented";
  1350. static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
  1351. static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
  1352. static char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
  1353. static char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
  1354. static PyObject *__pyx_kp_s_Bytes_size_d_is_not_a_power_of_2;
  1355. static PyObject *__pyx_kp_s_Different_byte_sizes_have_yet_to;
  1356. static PyObject *__pyx_n_s_Exception;
  1357. static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
  1358. static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
  1359. static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
  1360. static PyObject *__pyx_n_s_RuntimeError;
  1361. static PyObject *__pyx_n_s_ValueError;
  1362. static PyObject *__pyx_n_s_ZigZag;
  1363. static PyObject *__pyx_n_s_ZigZag___init;
  1364. static PyObject *__pyx_n_s_ZigZag_byte_size;
  1365. static PyObject *__pyx_n_s_ZigZag_decode;
  1366. static PyObject *__pyx_n_s_ZigZag_encode;
  1367. static PyObject *__pyx_n_s_abs;
  1368. static PyObject *__pyx_n_s_astype;
  1369. static PyObject *__pyx_n_s_bit_size;
  1370. static PyObject *__pyx_n_s_bit_size_2;
  1371. static PyObject *__pyx_n_s_bounds;
  1372. static PyObject *__pyx_n_s_byte_size;
  1373. static PyObject *__pyx_n_s_clip;
  1374. static PyObject *__pyx_n_s_decode;
  1375. static PyObject *__pyx_n_s_dimension;
  1376. static PyObject *__pyx_n_s_doc;
  1377. static PyObject *__pyx_n_s_dtype;
  1378. static PyObject *__pyx_n_s_dtype_2;
  1379. static PyObject *__pyx_n_s_e_idx;
  1380. static PyObject *__pyx_n_s_empty;
  1381. static PyObject *__pyx_n_s_encode;
  1382. static PyObject *__pyx_n_s_encoded;
  1383. static PyObject *__pyx_n_s_end;
  1384. static PyObject *__pyx_n_s_file;
  1385. static PyObject *__pyx_kp_s_home_batman_one_xx_projects_map;
  1386. static PyObject *__pyx_n_s_idx;
  1387. static PyObject *__pyx_n_s_import;
  1388. static PyObject *__pyx_n_s_init;
  1389. static PyObject *__pyx_n_s_int16;
  1390. static PyObject *__pyx_n_s_int32;
  1391. static PyObject *__pyx_n_s_int64;
  1392. static PyObject *__pyx_n_s_items;
  1393. static PyObject *__pyx_n_s_itemsize;
  1394. static PyObject *__pyx_n_s_lemantic_zigzag;
  1395. static PyObject *__pyx_n_s_log;
  1396. static PyObject *__pyx_n_s_main;
  1397. static PyObject *__pyx_n_s_max_bounds;
  1398. static PyObject *__pyx_n_s_max_value;
  1399. static PyObject *__pyx_n_s_metaclass;
  1400. static PyObject *__pyx_n_s_min_bounds;
  1401. static PyObject *__pyx_n_s_module;
  1402. static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
  1403. static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
  1404. static PyObject *__pyx_n_s_np;
  1405. static PyObject *__pyx_n_s_numpy;
  1406. static PyObject *__pyx_n_s_object;
  1407. static PyObject *__pyx_n_s_pre_dtype;
  1408. static PyObject *__pyx_n_s_pre_dtype_2;
  1409. static PyObject *__pyx_n_s_prepare;
  1410. static PyObject *__pyx_n_s_prev;
  1411. static PyObject *__pyx_n_s_print;
  1412. static PyObject *__pyx_n_s_property;
  1413. static PyObject *__pyx_n_s_qualname;
  1414. static PyObject *__pyx_n_s_quantized;
  1415. static PyObject *__pyx_n_s_range;
  1416. static PyObject *__pyx_n_s_scalar;
  1417. static PyObject *__pyx_n_s_self;
  1418. static PyObject *__pyx_n_s_setter;
  1419. static PyObject *__pyx_n_s_test;
  1420. static PyObject *__pyx_n_s_uint16;
  1421. static PyObject *__pyx_n_s_uint32;
  1422. static PyObject *__pyx_n_s_uint64;
  1423. static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
  1424. static PyObject *__pyx_n_s_xrange;
  1425. static PyObject *__pyx_pf_8lemantic_6zigzag__zig_zag(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_8lemantic_6zigzag_int16_t __pyx_v_value); /* proto */
  1426. static PyObject *__pyx_pf_8lemantic_6zigzag_2encode(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_items, CYTHON_UNUSED int __pyx_v_bit_size); /* proto */
  1427. static PyObject *__pyx_pf_8lemantic_6zigzag_4decode(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
  1428. static PyObject *__pyx_pf_8lemantic_6zigzag_6ZigZag___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_byte_size); /* proto */
  1429. static PyObject *__pyx_pf_8lemantic_6zigzag_6ZigZag_2byte_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
  1430. static PyObject *__pyx_pf_8lemantic_6zigzag_6ZigZag_4byte_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_byte_size); /* proto */
  1431. static PyObject *__pyx_pf_8lemantic_6zigzag_6ZigZag_6encode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_bounds, CYTHON_UNUSED PyObject *__pyx_v_log); /* proto */
  1432. static PyObject *__pyx_pf_8lemantic_6zigzag_6ZigZag_8decode(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
  1433. static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
  1434. static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
  1435. static PyObject *__pyx_int_0;
  1436. static PyObject *__pyx_int_1;
  1437. static PyObject *__pyx_int_2;
  1438. static PyObject *__pyx_int_4;
  1439. static PyObject *__pyx_int_8;
  1440. static PyObject *__pyx_tuple_;
  1441. static PyObject *__pyx_tuple__2;
  1442. static PyObject *__pyx_tuple__3;
  1443. static PyObject *__pyx_tuple__4;
  1444. static PyObject *__pyx_tuple__5;
  1445. static PyObject *__pyx_tuple__6;
  1446. static PyObject *__pyx_tuple__7;
  1447. static PyObject *__pyx_tuple__8;
  1448. static PyObject *__pyx_tuple__11;
  1449. static PyObject *__pyx_tuple__13;
  1450. static PyObject *__pyx_tuple__14;
  1451. static PyObject *__pyx_tuple__16;
  1452. static PyObject *__pyx_tuple__18;
  1453. static PyObject *__pyx_tuple__20;
  1454. static PyObject *__pyx_codeobj__9;
  1455. static PyObject *__pyx_codeobj__10;
  1456. static PyObject *__pyx_codeobj__12;
  1457. static PyObject *__pyx_codeobj__15;
  1458. static PyObject *__pyx_codeobj__17;
  1459. static PyObject *__pyx_codeobj__19;
  1460. static PyObject *__pyx_codeobj__21;
  1461.  
  1462. /* "lemantic/zigzag.pyx":10
  1463.  *
  1464.  *
  1465.  * cpdef uint16_t _zig_zag(int16_t value):             # <<<<<<<<<<<<<<
  1466.  *   return (value << 1) ^ (value >> 15) & 0xFFFF
  1467.  *
  1468.  */
  1469.  
  1470. static PyObject *__pyx_pw_8lemantic_6zigzag_1_zig_zag(PyObject *__pyx_self, PyObject *__pyx_arg_value); /*proto*/
  1471. static __pyx_t_8lemantic_6zigzag_uint16_t __pyx_f_8lemantic_6zigzag__zig_zag(__pyx_t_8lemantic_6zigzag_int16_t __pyx_v_value, CYTHON_UNUSED int __pyx_skip_dispatch) {
  1472.   __pyx_t_8lemantic_6zigzag_uint16_t __pyx_r;
  1473.   __Pyx_RefNannyDeclarations
  1474.   __Pyx_RefNannySetupContext("_zig_zag", 0);
  1475.  
  1476.   /* "lemantic/zigzag.pyx":11
  1477.  *
  1478.  * cpdef uint16_t _zig_zag(int16_t value):
  1479.  *   return (value << 1) ^ (value >> 15) & 0xFFFF             # <<<<<<<<<<<<<<
  1480.  *
  1481.  * #@cython.boundscheck(False) # turn off bounds-checking for entire function
  1482.  */
  1483.   __pyx_r = ((__pyx_v_value << 1) ^ ((__pyx_v_value >> 15) & 0xFFFF));
  1484.   goto __pyx_L0;
  1485.  
  1486.   /* "lemantic/zigzag.pyx":10
  1487.  *
  1488.  *
  1489.  * cpdef uint16_t _zig_zag(int16_t value):             # <<<<<<<<<<<<<<
  1490.  *   return (value << 1) ^ (value >> 15) & 0xFFFF
  1491.  *
  1492.  */
  1493.  
  1494.   /* function exit code */
  1495.   __pyx_L0:;
  1496.   __Pyx_RefNannyFinishContext();
  1497.   return __pyx_r;
  1498. }
  1499.  
  1500. /* Python wrapper */
  1501. static PyObject *__pyx_pw_8lemantic_6zigzag_1_zig_zag(PyObject *__pyx_self, PyObject *__pyx_arg_value); /*proto*/
  1502. static PyObject *__pyx_pw_8lemantic_6zigzag_1_zig_zag(PyObject *__pyx_self, PyObject *__pyx_arg_value) {
  1503.   __pyx_t_8lemantic_6zigzag_int16_t __pyx_v_value;
  1504.   int __pyx_lineno = 0;
  1505.   const char *__pyx_filename = NULL;
  1506.   int __pyx_clineno = 0;
  1507.   PyObject *__pyx_r = 0;
  1508.   __Pyx_RefNannyDeclarations
  1509.   __Pyx_RefNannySetupContext("_zig_zag (wrapper)", 0);
  1510.   assert(__pyx_arg_value); {
  1511.     __pyx_v_value = __Pyx_PyInt_As_short(__pyx_arg_value); if (unlikely((__pyx_v_value == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1512.   }
  1513.   goto __pyx_L4_argument_unpacking_done;
  1514.   __pyx_L3_error:;
  1515.   __Pyx_AddTraceback("lemantic.zigzag._zig_zag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1516.   __Pyx_RefNannyFinishContext();
  1517.   return NULL;
  1518.   __pyx_L4_argument_unpacking_done:;
  1519.   __pyx_r = __pyx_pf_8lemantic_6zigzag__zig_zag(__pyx_self, ((__pyx_t_8lemantic_6zigzag_int16_t)__pyx_v_value));
  1520.  
  1521.   /* function exit code */
  1522.   __Pyx_RefNannyFinishContext();
  1523.   return __pyx_r;
  1524. }
  1525.  
  1526. static PyObject *__pyx_pf_8lemantic_6zigzag__zig_zag(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_8lemantic_6zigzag_int16_t __pyx_v_value) {
  1527.   PyObject *__pyx_r = NULL;
  1528.   __Pyx_RefNannyDeclarations
  1529.   PyObject *__pyx_t_1 = NULL;
  1530.   int __pyx_lineno = 0;
  1531.   const char *__pyx_filename = NULL;
  1532.   int __pyx_clineno = 0;
  1533.   __Pyx_RefNannySetupContext("_zig_zag", 0);
  1534.   __Pyx_XDECREF(__pyx_r);
  1535.   __pyx_t_1 = __Pyx_PyInt_From_unsigned_short(__pyx_f_8lemantic_6zigzag__zig_zag(__pyx_v_value, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1536.   __Pyx_GOTREF(__pyx_t_1);
  1537.   __pyx_r = __pyx_t_1;
  1538.   __pyx_t_1 = 0;
  1539.   goto __pyx_L0;
  1540.  
  1541.   /* function exit code */
  1542.   __pyx_L1_error:;
  1543.   __Pyx_XDECREF(__pyx_t_1);
  1544.   __Pyx_AddTraceback("lemantic.zigzag._zig_zag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1545.   __pyx_r = NULL;
  1546.   __pyx_L0:;
  1547.   __Pyx_XGIVEREF(__pyx_r);
  1548.   __Pyx_RefNannyFinishContext();
  1549.   return __pyx_r;
  1550. }
  1551.  
  1552. /* "lemantic/zigzag.pyx":15
  1553.  * #@cython.boundscheck(False) # turn off bounds-checking for entire function
  1554.  * #@cython.wraparound(False)  # turn off negative index wrapping for entire function
  1555.  * def encode(np.ndarray[int16_t, ndim=1] items, int bit_size):             # <<<<<<<<<<<<<<
  1556.  *   cdef int16_t prev = 0
  1557.  *   cdef np.ndarray[np.uint16_t, ndim=1] encoded = np.empty(len(items), dtype=np.uint16)
  1558.  */
  1559.  
  1560. /* Python wrapper */
  1561. static PyObject *__pyx_pw_8lemantic_6zigzag_3encode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  1562. static PyMethodDef __pyx_mdef_8lemantic_6zigzag_3encode = {"encode", (PyCFunction)__pyx_pw_8lemantic_6zigzag_3encode, METH_VARARGS|METH_KEYWORDS, 0};
  1563. static PyObject *__pyx_pw_8lemantic_6zigzag_3encode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  1564.   PyArrayObject *__pyx_v_items = 0;
  1565.   CYTHON_UNUSED int __pyx_v_bit_size;
  1566.   int __pyx_lineno = 0;
  1567.   const char *__pyx_filename = NULL;
  1568.   int __pyx_clineno = 0;
  1569.   PyObject *__pyx_r = 0;
  1570.   __Pyx_RefNannyDeclarations
  1571.   __Pyx_RefNannySetupContext("encode (wrapper)", 0);
  1572.   {
  1573.     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_items,&__pyx_n_s_bit_size,0};
  1574.     PyObject* values[2] = {0,0};
  1575.     if (unlikely(__pyx_kwds)) {
  1576.       Py_ssize_t kw_args;
  1577.       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  1578.       switch (pos_args) {
  1579.         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1580.         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1581.         case  0: break;
  1582.         default: goto __pyx_L5_argtuple_error;
  1583.       }
  1584.       kw_args = PyDict_Size(__pyx_kwds);
  1585.       switch (pos_args) {
  1586.         case  0:
  1587.         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_items)) != 0)) kw_args--;
  1588.         else goto __pyx_L5_argtuple_error;
  1589.         case  1:
  1590.         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bit_size)) != 0)) kw_args--;
  1591.         else {
  1592.           __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1593.         }
  1594.       }
  1595.       if (unlikely(kw_args > 0)) {
  1596.         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1597.       }
  1598.     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
  1599.       goto __pyx_L5_argtuple_error;
  1600.     } else {
  1601.       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1602.       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1603.     }
  1604.     __pyx_v_items = ((PyArrayObject *)values[0]);
  1605.     __pyx_v_bit_size = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_bit_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1606.   }
  1607.   goto __pyx_L4_argument_unpacking_done;
  1608.   __pyx_L5_argtuple_error:;
  1609.   __Pyx_RaiseArgtupleInvalid("encode", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1610.   __pyx_L3_error:;
  1611.   __Pyx_AddTraceback("lemantic.zigzag.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1612.   __Pyx_RefNannyFinishContext();
  1613.   return NULL;
  1614.   __pyx_L4_argument_unpacking_done:;
  1615.   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_items), __pyx_ptype_5numpy_ndarray, 1, "items", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1616.   __pyx_r = __pyx_pf_8lemantic_6zigzag_2encode(__pyx_self, __pyx_v_items, __pyx_v_bit_size);
  1617.  
  1618.   /* function exit code */
  1619.   goto __pyx_L0;
  1620.   __pyx_L1_error:;
  1621.   __pyx_r = NULL;
  1622.   __pyx_L0:;
  1623.   __Pyx_RefNannyFinishContext();
  1624.   return __pyx_r;
  1625. }
  1626.  
  1627. static PyObject *__pyx_pf_8lemantic_6zigzag_2encode(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_items, CYTHON_UNUSED int __pyx_v_bit_size) {
  1628.   __pyx_t_8lemantic_6zigzag_int16_t __pyx_v_prev;
  1629.   PyArrayObject *__pyx_v_encoded = 0;
  1630.   Py_ssize_t __pyx_v_idx;
  1631.   Py_ssize_t __pyx_v_e_idx;
  1632.   __Pyx_LocalBuf_ND __pyx_pybuffernd_encoded;
  1633.   __Pyx_Buffer __pyx_pybuffer_encoded;
  1634.   __Pyx_LocalBuf_ND __pyx_pybuffernd_items;
  1635.   __Pyx_Buffer __pyx_pybuffer_items;
  1636.   PyObject *__pyx_r = NULL;
  1637.   __Pyx_RefNannyDeclarations
  1638.   PyObject *__pyx_t_1 = NULL;
  1639.   PyObject *__pyx_t_2 = NULL;
  1640.   Py_ssize_t __pyx_t_3;
  1641.   PyObject *__pyx_t_4 = NULL;
  1642.   PyObject *__pyx_t_5 = NULL;
  1643.   PyObject *__pyx_t_6 = NULL;
  1644.   PyArrayObject *__pyx_t_7 = NULL;
  1645.   npy_intp __pyx_t_8;
  1646.   Py_ssize_t __pyx_t_9;
  1647.   int __pyx_t_10;
  1648.   int __pyx_t_11;
  1649.   Py_ssize_t __pyx_t_12;
  1650.   Py_ssize_t __pyx_t_13;
  1651.   Py_ssize_t __pyx_t_14;
  1652.   Py_ssize_t __pyx_t_15;
  1653.   int __pyx_lineno = 0;
  1654.   const char *__pyx_filename = NULL;
  1655.   int __pyx_clineno = 0;
  1656.   __Pyx_RefNannySetupContext("encode", 0);
  1657.   __pyx_pybuffer_encoded.pybuffer.buf = NULL;
  1658.   __pyx_pybuffer_encoded.refcount = 0;
  1659.   __pyx_pybuffernd_encoded.data = NULL;
  1660.   __pyx_pybuffernd_encoded.rcbuffer = &__pyx_pybuffer_encoded;
  1661.   __pyx_pybuffer_items.pybuffer.buf = NULL;
  1662.   __pyx_pybuffer_items.refcount = 0;
  1663.   __pyx_pybuffernd_items.data = NULL;
  1664.   __pyx_pybuffernd_items.rcbuffer = &__pyx_pybuffer_items;
  1665.   {
  1666.     __Pyx_BufFmt_StackElem __pyx_stack[1];
  1667.     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_items.rcbuffer->pybuffer, (PyObject*)__pyx_v_items, &__Pyx_TypeInfo_nn___pyx_t_8lemantic_6zigzag_int16_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1668.   }
  1669.   __pyx_pybuffernd_items.diminfo[0].strides = __pyx_pybuffernd_items.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_items.diminfo[0].shape = __pyx_pybuffernd_items.rcbuffer->pybuffer.shape[0];
  1670.  
  1671.   /* "lemantic/zigzag.pyx":16
  1672.  * #@cython.wraparound(False)  # turn off negative index wrapping for entire function
  1673.  * def encode(np.ndarray[int16_t, ndim=1] items, int bit_size):
  1674.  *   cdef int16_t prev = 0             # <<<<<<<<<<<<<<
  1675.  *   cdef np.ndarray[np.uint16_t, ndim=1] encoded = np.empty(len(items), dtype=np.uint16)
  1676.  *
  1677.  */
  1678.   __pyx_v_prev = 0;
  1679.  
  1680.   /* "lemantic/zigzag.pyx":17
  1681.  * def encode(np.ndarray[int16_t, ndim=1] items, int bit_size):
  1682.  *   cdef int16_t prev = 0
  1683.  *   cdef np.ndarray[np.uint16_t, ndim=1] encoded = np.empty(len(items), dtype=np.uint16)             # <<<<<<<<<<<<<<
  1684.  *
  1685.  *   cdef Py_ssize_t idx = 0, e_idx = 0
  1686.  */
  1687.   __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1688.   __Pyx_GOTREF(__pyx_t_1);
  1689.   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1690.   __Pyx_GOTREF(__pyx_t_2);
  1691.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1692.   __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_items)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1693.   __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1694.   __Pyx_GOTREF(__pyx_t_1);
  1695.   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1696.   __Pyx_GOTREF(__pyx_t_4);
  1697.   __Pyx_GIVEREF(__pyx_t_1);
  1698.   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  1699.   __pyx_t_1 = 0;
  1700.   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1701.   __Pyx_GOTREF(__pyx_t_1);
  1702.   __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1703.   __Pyx_GOTREF(__pyx_t_5);
  1704.   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_uint16); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1705.   __Pyx_GOTREF(__pyx_t_6);
  1706.   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1707.   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1708.   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  1709.   __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1710.   __Pyx_GOTREF(__pyx_t_6);
  1711.   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1712.   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1713.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1714.   if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1715.   __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  1716.   {
  1717.     __Pyx_BufFmt_StackElem __pyx_stack[1];
  1718.     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_encoded.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint16_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
  1719.       __pyx_v_encoded = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_encoded.rcbuffer->pybuffer.buf = NULL;
  1720.       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1721.     } else {__pyx_pybuffernd_encoded.diminfo[0].strides = __pyx_pybuffernd_encoded.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_encoded.diminfo[0].shape = __pyx_pybuffernd_encoded.rcbuffer->pybuffer.shape[0];
  1722.     }
  1723.   }
  1724.   __pyx_t_7 = 0;
  1725.   __pyx_v_encoded = ((PyArrayObject *)__pyx_t_6);
  1726.   __pyx_t_6 = 0;
  1727.  
  1728.   /* "lemantic/zigzag.pyx":19
  1729.  *   cdef np.ndarray[np.uint16_t, ndim=1] encoded = np.empty(len(items), dtype=np.uint16)
  1730.  *
  1731.  *   cdef Py_ssize_t idx = 0, e_idx = 0             # <<<<<<<<<<<<<<
  1732.  *   for idx in xrange(items.shape[0]):
  1733.  *     if prev == items[idx]:
  1734.  */
  1735.   __pyx_v_idx = 0;
  1736.   __pyx_v_e_idx = 0;
  1737.  
  1738.   /* "lemantic/zigzag.pyx":20
  1739.  *
  1740.  *   cdef Py_ssize_t idx = 0, e_idx = 0
  1741.  *   for idx in xrange(items.shape[0]):             # <<<<<<<<<<<<<<
  1742.  *     if prev == items[idx]:
  1743.  *       print(prev, items[idx])
  1744.  */
  1745.   __pyx_t_8 = (__pyx_v_items->dimensions[0]);
  1746.   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_8; __pyx_t_3+=1) {
  1747.     __pyx_v_idx = __pyx_t_3;
  1748.  
  1749.     /* "lemantic/zigzag.pyx":21
  1750.  *   cdef Py_ssize_t idx = 0, e_idx = 0
  1751.  *   for idx in xrange(items.shape[0]):
  1752.  *     if prev == items[idx]:             # <<<<<<<<<<<<<<
  1753.  *       print(prev, items[idx])
  1754.  *       continue
  1755.  */
  1756.     __pyx_t_9 = __pyx_v_idx;
  1757.     __pyx_t_10 = -1;
  1758.     if (__pyx_t_9 < 0) {
  1759.       __pyx_t_9 += __pyx_pybuffernd_items.diminfo[0].shape;
  1760.       if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
  1761.     } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_items.diminfo[0].shape)) __pyx_t_10 = 0;
  1762.     if (unlikely(__pyx_t_10 != -1)) {
  1763.       __Pyx_RaiseBufferIndexError(__pyx_t_10);
  1764.       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1765.     }
  1766.     __pyx_t_11 = ((__pyx_v_prev == (*__Pyx_BufPtrStrided1d(__pyx_t_8lemantic_6zigzag_int16_t *, __pyx_pybuffernd_items.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_items.diminfo[0].strides))) != 0);
  1767.     if (__pyx_t_11) {
  1768.  
  1769.       /* "lemantic/zigzag.pyx":22
  1770.  *   for idx in xrange(items.shape[0]):
  1771.  *     if prev == items[idx]:
  1772.  *       print(prev, items[idx])             # <<<<<<<<<<<<<<
  1773.  *       continue
  1774.  *     encoded[e_idx] = _zig_zag(items[idx] - prev)
  1775.  */
  1776.       __pyx_t_6 = __Pyx_PyInt_From_short(__pyx_v_prev); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1777.       __Pyx_GOTREF(__pyx_t_6);
  1778.       __pyx_t_12 = __pyx_v_idx;
  1779.       __pyx_t_10 = -1;
  1780.       if (__pyx_t_12 < 0) {
  1781.         __pyx_t_12 += __pyx_pybuffernd_items.diminfo[0].shape;
  1782.         if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 0;
  1783.       } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_items.diminfo[0].shape)) __pyx_t_10 = 0;
  1784.       if (unlikely(__pyx_t_10 != -1)) {
  1785.         __Pyx_RaiseBufferIndexError(__pyx_t_10);
  1786.         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1787.       }
  1788.       __pyx_t_1 = __Pyx_PyInt_From_short((*__Pyx_BufPtrStrided1d(__pyx_t_8lemantic_6zigzag_int16_t *, __pyx_pybuffernd_items.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_items.diminfo[0].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1789.       __Pyx_GOTREF(__pyx_t_1);
  1790.       __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1791.       __Pyx_GOTREF(__pyx_t_4);
  1792.       __Pyx_GIVEREF(__pyx_t_6);
  1793.       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
  1794.       __Pyx_GIVEREF(__pyx_t_1);
  1795.       PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  1796.       __pyx_t_6 = 0;
  1797.       __pyx_t_1 = 0;
  1798.       if (__Pyx_PrintOne(0, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1799.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1800.  
  1801.       /* "lemantic/zigzag.pyx":23
  1802.  *     if prev == items[idx]:
  1803.  *       print(prev, items[idx])
  1804.  *       continue             # <<<<<<<<<<<<<<
  1805.  *     encoded[e_idx] = _zig_zag(items[idx] - prev)
  1806.  *     prev = items[idx]
  1807.  */
  1808.       goto __pyx_L3_continue;
  1809.  
  1810.       /* "lemantic/zigzag.pyx":21
  1811.  *   cdef Py_ssize_t idx = 0, e_idx = 0
  1812.  *   for idx in xrange(items.shape[0]):
  1813.  *     if prev == items[idx]:             # <<<<<<<<<<<<<<
  1814.  *       print(prev, items[idx])
  1815.  *       continue
  1816.  */
  1817.     }
  1818.  
  1819.     /* "lemantic/zigzag.pyx":24
  1820.  *       print(prev, items[idx])
  1821.  *       continue
  1822.  *     encoded[e_idx] = _zig_zag(items[idx] - prev)             # <<<<<<<<<<<<<<
  1823.  *     prev = items[idx]
  1824.  *     e_idx += 1
  1825.  */
  1826.     __pyx_t_13 = __pyx_v_idx;
  1827.     __pyx_t_10 = -1;
  1828.     if (__pyx_t_13 < 0) {
  1829.       __pyx_t_13 += __pyx_pybuffernd_items.diminfo[0].shape;
  1830.       if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 0;
  1831.     } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_items.diminfo[0].shape)) __pyx_t_10 = 0;
  1832.     if (unlikely(__pyx_t_10 != -1)) {
  1833.       __Pyx_RaiseBufferIndexError(__pyx_t_10);
  1834.       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1835.     }
  1836.     __pyx_t_14 = __pyx_v_e_idx;
  1837.     __pyx_t_10 = -1;
  1838.     if (__pyx_t_14 < 0) {
  1839.       __pyx_t_14 += __pyx_pybuffernd_encoded.diminfo[0].shape;
  1840.       if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 0;
  1841.     } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_encoded.diminfo[0].shape)) __pyx_t_10 = 0;
  1842.     if (unlikely(__pyx_t_10 != -1)) {
  1843.       __Pyx_RaiseBufferIndexError(__pyx_t_10);
  1844.       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1845.     }
  1846.     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint16_t *, __pyx_pybuffernd_encoded.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_encoded.diminfo[0].strides) = __pyx_f_8lemantic_6zigzag__zig_zag(((*__Pyx_BufPtrStrided1d(__pyx_t_8lemantic_6zigzag_int16_t *, __pyx_pybuffernd_items.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_items.diminfo[0].strides)) - __pyx_v_prev), 0);
  1847.  
  1848.     /* "lemantic/zigzag.pyx":25
  1849.  *       continue
  1850.  *     encoded[e_idx] = _zig_zag(items[idx] - prev)
  1851.  *     prev = items[idx]             # <<<<<<<<<<<<<<
  1852.  *     e_idx += 1
  1853.  *
  1854.  */
  1855.     __pyx_t_15 = __pyx_v_idx;
  1856.     __pyx_t_10 = -1;
  1857.     if (__pyx_t_15 < 0) {
  1858.       __pyx_t_15 += __pyx_pybuffernd_items.diminfo[0].shape;
  1859.       if (unlikely(__pyx_t_15 < 0)) __pyx_t_10 = 0;
  1860.     } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_items.diminfo[0].shape)) __pyx_t_10 = 0;
  1861.     if (unlikely(__pyx_t_10 != -1)) {
  1862.       __Pyx_RaiseBufferIndexError(__pyx_t_10);
  1863.       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1864.     }
  1865.     __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_8lemantic_6zigzag_int16_t *, __pyx_pybuffernd_items.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_items.diminfo[0].strides));
  1866.  
  1867.     /* "lemantic/zigzag.pyx":26
  1868.  *     encoded[e_idx] = _zig_zag(items[idx] - prev)
  1869.  *     prev = items[idx]
  1870.  *     e_idx += 1             # <<<<<<<<<<<<<<
  1871.  *
  1872.  *   return encoded
  1873.  */
  1874.     __pyx_v_e_idx = (__pyx_v_e_idx + 1);
  1875.     __pyx_L3_continue:;
  1876.   }
  1877.  
  1878.   /* "lemantic/zigzag.pyx":28
  1879.  *     e_idx += 1
  1880.  *
  1881.  *   return encoded             # <<<<<<<<<<<<<<
  1882.  *
  1883.  * def decode():
  1884.  */
  1885.   __Pyx_XDECREF(__pyx_r);
  1886.   __Pyx_INCREF(((PyObject *)__pyx_v_encoded));
  1887.   __pyx_r = ((PyObject *)__pyx_v_encoded);
  1888.   goto __pyx_L0;
  1889.  
  1890.   /* "lemantic/zigzag.pyx":15
  1891.  * #@cython.boundscheck(False) # turn off bounds-checking for entire function
  1892.  * #@cython.wraparound(False)  # turn off negative index wrapping for entire function
  1893.  * def encode(np.ndarray[int16_t, ndim=1] items, int bit_size):             # <<<<<<<<<<<<<<
  1894.  *   cdef int16_t prev = 0
  1895.  *   cdef np.ndarray[np.uint16_t, ndim=1] encoded = np.empty(len(items), dtype=np.uint16)
  1896.  */
  1897.  
  1898.   /* function exit code */
  1899.   __pyx_L1_error:;
  1900.   __Pyx_XDECREF(__pyx_t_1);
  1901.   __Pyx_XDECREF(__pyx_t_2);
  1902.   __Pyx_XDECREF(__pyx_t_4);
  1903.   __Pyx_XDECREF(__pyx_t_5);
  1904.   __Pyx_XDECREF(__pyx_t_6);
  1905.   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
  1906.     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
  1907.     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_encoded.rcbuffer->pybuffer);
  1908.     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_items.rcbuffer->pybuffer);
  1909.   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  1910.   __Pyx_AddTraceback("lemantic.zigzag.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1911.   __pyx_r = NULL;
  1912.   goto __pyx_L2;
  1913.   __pyx_L0:;
  1914.   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_encoded.rcbuffer->pybuffer);
  1915.   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_items.rcbuffer->pybuffer);
  1916.   __pyx_L2:;
  1917.   __Pyx_XDECREF((PyObject *)__pyx_v_encoded);
  1918.   __Pyx_XGIVEREF(__pyx_r);
  1919.   __Pyx_RefNannyFinishContext();
  1920.   return __pyx_r;
  1921. }
  1922.  
  1923. /* "lemantic/zigzag.pyx":30
  1924.  *   return encoded
  1925.  *
  1926.  * def decode():             # <<<<<<<<<<<<<<
  1927.  *   pass
  1928.  *
  1929.  */
  1930.  
  1931. /* Python wrapper */
  1932. static PyObject *__pyx_pw_8lemantic_6zigzag_5decode(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  1933. static PyMethodDef __pyx_mdef_8lemantic_6zigzag_5decode = {"decode", (PyCFunction)__pyx_pw_8lemantic_6zigzag_5decode, METH_NOARGS, 0};
  1934. static PyObject *__pyx_pw_8lemantic_6zigzag_5decode(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  1935.   PyObject *__pyx_r = 0;
  1936.   __Pyx_RefNannyDeclarations
  1937.   __Pyx_RefNannySetupContext("decode (wrapper)", 0);
  1938.   __pyx_r = __pyx_pf_8lemantic_6zigzag_4decode(__pyx_self);
  1939.  
  1940.   /* function exit code */
  1941.   __Pyx_RefNannyFinishContext();
  1942.   return __pyx_r;
  1943. }
  1944.  
  1945. static PyObject *__pyx_pf_8lemantic_6zigzag_4decode(CYTHON_UNUSED PyObject *__pyx_self) {
  1946.   PyObject *__pyx_r = NULL;
  1947.   __Pyx_RefNannyDeclarations
  1948.   __Pyx_RefNannySetupContext("decode", 0);
  1949.  
  1950.   /* function exit code */
  1951.   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  1952.   __Pyx_XGIVEREF(__pyx_r);
  1953.   __Pyx_RefNannyFinishContext();
  1954.   return __pyx_r;
  1955. }
  1956.  
  1957. /* "lemantic/zigzag.pyx":35
  1958.  * class ZigZag(object):
  1959.  *
  1960.  *   def __init__(self, byte_size=2):             # <<<<<<<<<<<<<<
  1961.  *     if byte_size != 2:
  1962.  *       raise Exception('Different byte sizes have yet to be implemented')
  1963.  */
  1964.  
  1965. /* Python wrapper */
  1966. static PyObject *__pyx_pw_8lemantic_6zigzag_6ZigZag_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  1967. static PyMethodDef __pyx_mdef_8lemantic_6zigzag_6ZigZag_1__init__ = {"__init__", (PyCFunction)__pyx_pw_8lemantic_6zigzag_6ZigZag_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
  1968. static PyObject *__pyx_pw_8lemantic_6zigzag_6ZigZag_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  1969.   PyObject *__pyx_v_self = 0;
  1970.   PyObject *__pyx_v_byte_size = 0;
  1971.   int __pyx_lineno = 0;
  1972.   const char *__pyx_filename = NULL;
  1973.   int __pyx_clineno = 0;
  1974.   PyObject *__pyx_r = 0;
  1975.   __Pyx_RefNannyDeclarations
  1976.   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  1977.   {
  1978.     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_byte_size,0};
  1979.     PyObject* values[2] = {0,0};
  1980.     values[1] = ((PyObject *)((PyObject *)__pyx_int_2));
  1981.     if (unlikely(__pyx_kwds)) {
  1982.       Py_ssize_t kw_args;
  1983.       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  1984.       switch (pos_args) {
  1985.         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1986.         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1987.         case  0: break;
  1988.         default: goto __pyx_L5_argtuple_error;
  1989.       }
  1990.       kw_args = PyDict_Size(__pyx_kwds);
  1991.       switch (pos_args) {
  1992.         case  0:
  1993.         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
  1994.         else goto __pyx_L5_argtuple_error;
  1995.         case  1:
  1996.         if (kw_args > 0) {
  1997.           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_byte_size);
  1998.           if (value) { values[1] = value; kw_args--; }
  1999.         }
  2000.       }
  2001.       if (unlikely(kw_args > 0)) {
  2002.         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2003.       }
  2004.     } else {
  2005.       switch (PyTuple_GET_SIZE(__pyx_args)) {
  2006.         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2007.         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2008.         break;
  2009.         default: goto __pyx_L5_argtuple_error;
  2010.       }
  2011.     }
  2012.     __pyx_v_self = values[0];
  2013.     __pyx_v_byte_size = values[1];
  2014.   }
  2015.   goto __pyx_L4_argument_unpacking_done;
  2016.   __pyx_L5_argtuple_error:;
  2017.   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2018.   __pyx_L3_error:;
  2019.   __Pyx_AddTraceback("lemantic.zigzag.ZigZag.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2020.   __Pyx_RefNannyFinishContext();
  2021.   return NULL;
  2022.   __pyx_L4_argument_unpacking_done:;
  2023.   __pyx_r = __pyx_pf_8lemantic_6zigzag_6ZigZag___init__(__pyx_self, __pyx_v_self, __pyx_v_byte_size);
  2024.  
  2025.   /* function exit code */
  2026.   __Pyx_RefNannyFinishContext();
  2027.   return __pyx_r;
  2028. }
  2029.  
  2030. static PyObject *__pyx_pf_8lemantic_6zigzag_6ZigZag___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_byte_size) {
  2031.   PyObject *__pyx_r = NULL;
  2032.   __Pyx_RefNannyDeclarations
  2033.   PyObject *__pyx_t_1 = NULL;
  2034.   int __pyx_t_2;
  2035.   int __pyx_lineno = 0;
  2036.   const char *__pyx_filename = NULL;
  2037.   int __pyx_clineno = 0;
  2038.   __Pyx_RefNannySetupContext("__init__", 0);
  2039.  
  2040.   /* "lemantic/zigzag.pyx":36
  2041.  *
  2042.  *   def __init__(self, byte_size=2):
  2043.  *     if byte_size != 2:             # <<<<<<<<<<<<<<
  2044.  *       raise Exception('Different byte sizes have yet to be implemented')
  2045.  *     self.byte_size = byte_size
  2046.  */
  2047.   __pyx_t_1 = PyObject_RichCompare(__pyx_v_byte_size, __pyx_int_2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2048.   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2049.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2050.   if (__pyx_t_2) {
  2051.  
  2052.     /* "lemantic/zigzag.pyx":37
  2053.  *   def __init__(self, byte_size=2):
  2054.  *     if byte_size != 2:
  2055.  *       raise Exception('Different byte sizes have yet to be implemented')             # <<<<<<<<<<<<<<
  2056.  *     self.byte_size = byte_size
  2057.  *
  2058.  */
  2059.     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2060.     __Pyx_GOTREF(__pyx_t_1);
  2061.     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  2062.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2063.     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2064.  
  2065.     /* "lemantic/zigzag.pyx":36
  2066.  *
  2067.  *   def __init__(self, byte_size=2):
  2068.  *     if byte_size != 2:             # <<<<<<<<<<<<<<
  2069.  *       raise Exception('Different byte sizes have yet to be implemented')
  2070.  *     self.byte_size = byte_size
  2071.  */
  2072.   }
  2073.  
  2074.   /* "lemantic/zigzag.pyx":38
  2075.  *     if byte_size != 2:
  2076.  *       raise Exception('Different byte sizes have yet to be implemented')
  2077.  *     self.byte_size = byte_size             # <<<<<<<<<<<<<<
  2078.  *
  2079.  *   @property
  2080.  */
  2081.   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_byte_size, __pyx_v_byte_size) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2082.  
  2083.   /* "lemantic/zigzag.pyx":35
  2084.  * class ZigZag(object):
  2085.  *
  2086.  *   def __init__(self, byte_size=2):             # <<<<<<<<<<<<<<
  2087.  *     if byte_size != 2:
  2088.  *       raise Exception('Different byte sizes have yet to be implemented')
  2089.  */
  2090.  
  2091.   /* function exit code */
  2092.   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  2093.   goto __pyx_L0;
  2094.   __pyx_L1_error:;
  2095.   __Pyx_XDECREF(__pyx_t_1);
  2096.   __Pyx_AddTraceback("lemantic.zigzag.ZigZag.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2097.   __pyx_r = NULL;
  2098.   __pyx_L0:;
  2099.   __Pyx_XGIVEREF(__pyx_r);
  2100.   __Pyx_RefNannyFinishContext();
  2101.   return __pyx_r;
  2102. }
  2103.  
  2104. /* "lemantic/zigzag.pyx":41
  2105.  *
  2106.  *   @property
  2107.  *   def byte_size(self):             # <<<<<<<<<<<<<<
  2108.  *     return self._dtype.itemsize
  2109.  *
  2110.  */
  2111.  
  2112. /* Python wrapper */
  2113. static PyObject *__pyx_pw_8lemantic_6zigzag_6ZigZag_3byte_size(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
  2114. static PyMethodDef __pyx_mdef_8lemantic_6zigzag_6ZigZag_3byte_size = {"byte_size", (PyCFunction)__pyx_pw_8lemantic_6zigzag_6ZigZag_3byte_size, METH_O, 0};
  2115. static PyObject *__pyx_pw_8lemantic_6zigzag_6ZigZag_3byte_size(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  2116.   PyObject *__pyx_r = 0;
  2117.   __Pyx_RefNannyDeclarations
  2118.   __Pyx_RefNannySetupContext("byte_size (wrapper)", 0);
  2119.   __pyx_r = __pyx_pf_8lemantic_6zigzag_6ZigZag_2byte_size(__pyx_self, ((PyObject *)__pyx_v_self));
  2120.  
  2121.   /* function exit code */
  2122.   __Pyx_RefNannyFinishContext();
  2123.   return __pyx_r;
  2124. }
  2125.  
  2126. static PyObject *__pyx_pf_8lemantic_6zigzag_6ZigZag_2byte_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  2127.   PyObject *__pyx_r = NULL;
  2128.   __Pyx_RefNannyDeclarations
  2129.   PyObject *__pyx_t_1 = NULL;
  2130.   PyObject *__pyx_t_2 = NULL;
  2131.   int __pyx_lineno = 0;
  2132.   const char *__pyx_filename = NULL;
  2133.   int __pyx_clineno = 0;
  2134.   __Pyx_RefNannySetupContext("byte_size", 0);
  2135.  
  2136.   /* "lemantic/zigzag.pyx":42
  2137.  *   @property
  2138.  *   def byte_size(self):
  2139.  *     return self._dtype.itemsize             # <<<<<<<<<<<<<<
  2140.  *
  2141.  *   @byte_size.setter
  2142.  */
  2143.   __Pyx_XDECREF(__pyx_r);
  2144.   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2145.   __Pyx_GOTREF(__pyx_t_1);
  2146.   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2147.   __Pyx_GOTREF(__pyx_t_2);
  2148.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2149.   __pyx_r = __pyx_t_2;
  2150.   __pyx_t_2 = 0;
  2151.   goto __pyx_L0;
  2152.  
  2153.   /* "lemantic/zigzag.pyx":41
  2154.  *
  2155.  *   @property
  2156.  *   def byte_size(self):             # <<<<<<<<<<<<<<
  2157.  *     return self._dtype.itemsize
  2158.  *
  2159.  */
  2160.  
  2161.   /* function exit code */
  2162.   __pyx_L1_error:;
  2163.   __Pyx_XDECREF(__pyx_t_1);
  2164.   __Pyx_XDECREF(__pyx_t_2);
  2165.   __Pyx_AddTraceback("lemantic.zigzag.ZigZag.byte_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2166.   __pyx_r = NULL;
  2167.   __pyx_L0:;
  2168.   __Pyx_XGIVEREF(__pyx_r);
  2169.   __Pyx_RefNannyFinishContext();
  2170.   return __pyx_r;
  2171. }
  2172.  
  2173. /* "lemantic/zigzag.pyx":45
  2174.  *
  2175.  *   @byte_size.setter
  2176.  *   def byte_size(self, byte_size):             # <<<<<<<<<<<<<<
  2177.  *     if byte_size == 2:
  2178.  *       pre_dtype = np.dtype(np.int16)
  2179.  */
  2180.  
  2181. /* Python wrapper */
  2182. static PyObject *__pyx_pw_8lemantic_6zigzag_6ZigZag_5byte_size(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2183. static PyMethodDef __pyx_mdef_8lemantic_6zigzag_6ZigZag_5byte_size = {"byte_size", (PyCFunction)__pyx_pw_8lemantic_6zigzag_6ZigZag_5byte_size, METH_VARARGS|METH_KEYWORDS, 0};
  2184. static PyObject *__pyx_pw_8lemantic_6zigzag_6ZigZag_5byte_size(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2185.   PyObject *__pyx_v_self = 0;
  2186.   PyObject *__pyx_v_byte_size = 0;
  2187.   int __pyx_lineno = 0;
  2188.   const char *__pyx_filename = NULL;
  2189.   int __pyx_clineno = 0;
  2190.   PyObject *__pyx_r = 0;
  2191.   __Pyx_RefNannyDeclarations
  2192.   __Pyx_RefNannySetupContext("byte_size (wrapper)", 0);
  2193.   {
  2194.     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_byte_size,0};
  2195.     PyObject* values[2] = {0,0};
  2196.     if (unlikely(__pyx_kwds)) {
  2197.       Py_ssize_t kw_args;
  2198.       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  2199.       switch (pos_args) {
  2200.         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2201.         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2202.         case  0: break;
  2203.         default: goto __pyx_L5_argtuple_error;
  2204.       }
  2205.       kw_args = PyDict_Size(__pyx_kwds);
  2206.       switch (pos_args) {
  2207.         case  0:
  2208.         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
  2209.         else goto __pyx_L5_argtuple_error;
  2210.         case  1:
  2211.         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_byte_size)) != 0)) kw_args--;
  2212.         else {
  2213.           __Pyx_RaiseArgtupleInvalid("byte_size", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2214.         }
  2215.       }
  2216.       if (unlikely(kw_args > 0)) {
  2217.         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "byte_size") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2218.       }
  2219.     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
  2220.       goto __pyx_L5_argtuple_error;
  2221.     } else {
  2222.       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2223.       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2224.     }
  2225.     __pyx_v_self = values[0];
  2226.     __pyx_v_byte_size = values[1];
  2227.   }
  2228.   goto __pyx_L4_argument_unpacking_done;
  2229.   __pyx_L5_argtuple_error:;
  2230.   __Pyx_RaiseArgtupleInvalid("byte_size", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2231.   __pyx_L3_error:;
  2232.   __Pyx_AddTraceback("lemantic.zigzag.ZigZag.byte_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2233.   __Pyx_RefNannyFinishContext();
  2234.   return NULL;
  2235.   __pyx_L4_argument_unpacking_done:;
  2236.   __pyx_r = __pyx_pf_8lemantic_6zigzag_6ZigZag_4byte_size(__pyx_self, __pyx_v_self, __pyx_v_byte_size);
  2237.  
  2238.   /* function exit code */
  2239.   __Pyx_RefNannyFinishContext();
  2240.   return __pyx_r;
  2241. }
  2242.  
  2243. static PyObject *__pyx_pf_8lemantic_6zigzag_6ZigZag_4byte_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_byte_size) {
  2244.   PyObject *__pyx_v_pre_dtype = NULL;
  2245.   PyObject *__pyx_v_dtype = NULL;
  2246.   PyObject *__pyx_r = NULL;
  2247.   __Pyx_RefNannyDeclarations
  2248.   PyObject *__pyx_t_1 = NULL;
  2249.   int __pyx_t_2;
  2250.   PyObject *__pyx_t_3 = NULL;
  2251.   double __pyx_t_4;
  2252.   int __pyx_lineno = 0;
  2253.   const char *__pyx_filename = NULL;
  2254.   int __pyx_clineno = 0;
  2255.   __Pyx_RefNannySetupContext("byte_size", 0);
  2256.  
  2257.   /* "lemantic/zigzag.pyx":46
  2258.  *   @byte_size.setter
  2259.  *   def byte_size(self, byte_size):
  2260.  *     if byte_size == 2:             # <<<<<<<<<<<<<<
  2261.  *       pre_dtype = np.dtype(np.int16)
  2262.  *       dtype = np.dtype(np.uint16)
  2263.  */
  2264.   __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_byte_size, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2265.   __Pyx_GOTREF(__pyx_t_1);
  2266.   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2267.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2268.   if (__pyx_t_2) {
  2269.  
  2270.     /* "lemantic/zigzag.pyx":47
  2271.  *   def byte_size(self, byte_size):
  2272.  *     if byte_size == 2:
  2273.  *       pre_dtype = np.dtype(np.int16)             # <<<<<<<<<<<<<<
  2274.  *       dtype = np.dtype(np.uint16)
  2275.  *     elif byte_size == 4:
  2276.  */
  2277.     __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2278.     __Pyx_GOTREF(__pyx_t_1);
  2279.     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int16); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2280.     __Pyx_GOTREF(__pyx_t_3);
  2281.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2282.     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2283.     __Pyx_GOTREF(__pyx_t_1);
  2284.     __Pyx_GIVEREF(__pyx_t_3);
  2285.     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  2286.     __pyx_t_3 = 0;
  2287.     __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2288.     __Pyx_GOTREF(__pyx_t_3);
  2289.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2290.     __pyx_v_pre_dtype = __pyx_t_3;
  2291.     __pyx_t_3 = 0;
  2292.  
  2293.     /* "lemantic/zigzag.pyx":48
  2294.  *     if byte_size == 2:
  2295.  *       pre_dtype = np.dtype(np.int16)
  2296.  *       dtype = np.dtype(np.uint16)             # <<<<<<<<<<<<<<
  2297.  *     elif byte_size == 4:
  2298.  *       pre_dtype = np.dtype(np.int32)
  2299.  */
  2300.     __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2301.     __Pyx_GOTREF(__pyx_t_3);
  2302.     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint16); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2303.     __Pyx_GOTREF(__pyx_t_1);
  2304.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2305.     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2306.     __Pyx_GOTREF(__pyx_t_3);
  2307.     __Pyx_GIVEREF(__pyx_t_1);
  2308.     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2309.     __pyx_t_1 = 0;
  2310.     __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2311.     __Pyx_GOTREF(__pyx_t_1);
  2312.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2313.     __pyx_v_dtype = __pyx_t_1;
  2314.     __pyx_t_1 = 0;
  2315.  
  2316.     /* "lemantic/zigzag.pyx":46
  2317.  *   @byte_size.setter
  2318.  *   def byte_size(self, byte_size):
  2319.  *     if byte_size == 2:             # <<<<<<<<<<<<<<
  2320.  *       pre_dtype = np.dtype(np.int16)
  2321.  *       dtype = np.dtype(np.uint16)
  2322.  */
  2323.     goto __pyx_L3;
  2324.   }
  2325.  
  2326.   /* "lemantic/zigzag.pyx":49
  2327.  *       pre_dtype = np.dtype(np.int16)
  2328.  *       dtype = np.dtype(np.uint16)
  2329.  *     elif byte_size == 4:             # <<<<<<<<<<<<<<
  2330.  *       pre_dtype = np.dtype(np.int32)
  2331.  *       dtype = np.dtype(np.uint32)
  2332.  */
  2333.   __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_byte_size, __pyx_int_4, 4, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2334.   __Pyx_GOTREF(__pyx_t_1);
  2335.   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2336.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2337.   if (__pyx_t_2) {
  2338.  
  2339.     /* "lemantic/zigzag.pyx":50
  2340.  *       dtype = np.dtype(np.uint16)
  2341.  *     elif byte_size == 4:
  2342.  *       pre_dtype = np.dtype(np.int32)             # <<<<<<<<<<<<<<
  2343.  *       dtype = np.dtype(np.uint32)
  2344.  *     elif byte_size == 8:
  2345.  */
  2346.     __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2347.     __Pyx_GOTREF(__pyx_t_1);
  2348.     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2349.     __Pyx_GOTREF(__pyx_t_3);
  2350.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2351.     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2352.     __Pyx_GOTREF(__pyx_t_1);
  2353.     __Pyx_GIVEREF(__pyx_t_3);
  2354.     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  2355.     __pyx_t_3 = 0;
  2356.     __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2357.     __Pyx_GOTREF(__pyx_t_3);
  2358.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2359.     __pyx_v_pre_dtype = __pyx_t_3;
  2360.     __pyx_t_3 = 0;
  2361.  
  2362.     /* "lemantic/zigzag.pyx":51
  2363.  *     elif byte_size == 4:
  2364.  *       pre_dtype = np.dtype(np.int32)
  2365.  *       dtype = np.dtype(np.uint32)             # <<<<<<<<<<<<<<
  2366.  *     elif byte_size == 8:
  2367.  *       pre_dtype = np.dtype(np.int64)
  2368.  */
  2369.     __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2370.     __Pyx_GOTREF(__pyx_t_3);
  2371.     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2372.     __Pyx_GOTREF(__pyx_t_1);
  2373.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2374.     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2375.     __Pyx_GOTREF(__pyx_t_3);
  2376.     __Pyx_GIVEREF(__pyx_t_1);
  2377.     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2378.     __pyx_t_1 = 0;
  2379.     __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2380.     __Pyx_GOTREF(__pyx_t_1);
  2381.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2382.     __pyx_v_dtype = __pyx_t_1;
  2383.     __pyx_t_1 = 0;
  2384.  
  2385.     /* "lemantic/zigzag.pyx":49
  2386.  *       pre_dtype = np.dtype(np.int16)
  2387.  *       dtype = np.dtype(np.uint16)
  2388.  *     elif byte_size == 4:             # <<<<<<<<<<<<<<
  2389.  *       pre_dtype = np.dtype(np.int32)
  2390.  *       dtype = np.dtype(np.uint32)
  2391.  */
  2392.     goto __pyx_L3;
  2393.   }
  2394.  
  2395.   /* "lemantic/zigzag.pyx":52
  2396.  *       pre_dtype = np.dtype(np.int32)
  2397.  *       dtype = np.dtype(np.uint32)
  2398.  *     elif byte_size == 8:             # <<<<<<<<<<<<<<
  2399.  *       pre_dtype = np.dtype(np.int64)
  2400.  *       dtype = np.dtype(np.uint64)
  2401.  */
  2402.   __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_byte_size, __pyx_int_8, 8, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2403.   __Pyx_GOTREF(__pyx_t_1);
  2404.   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2405.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2406.   if (__pyx_t_2) {
  2407.  
  2408.     /* "lemantic/zigzag.pyx":53
  2409.  *       dtype = np.dtype(np.uint32)
  2410.  *     elif byte_size == 8:
  2411.  *       pre_dtype = np.dtype(np.int64)             # <<<<<<<<<<<<<<
  2412.  *       dtype = np.dtype(np.uint64)
  2413.  *     else:
  2414.  */
  2415.     __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2416.     __Pyx_GOTREF(__pyx_t_1);
  2417.     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2418.     __Pyx_GOTREF(__pyx_t_3);
  2419.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2420.     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2421.     __Pyx_GOTREF(__pyx_t_1);
  2422.     __Pyx_GIVEREF(__pyx_t_3);
  2423.     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  2424.     __pyx_t_3 = 0;
  2425.     __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2426.     __Pyx_GOTREF(__pyx_t_3);
  2427.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2428.     __pyx_v_pre_dtype = __pyx_t_3;
  2429.     __pyx_t_3 = 0;
  2430.  
  2431.     /* "lemantic/zigzag.pyx":54
  2432.  *     elif byte_size == 8:
  2433.  *       pre_dtype = np.dtype(np.int64)
  2434.  *       dtype = np.dtype(np.uint64)             # <<<<<<<<<<<<<<
  2435.  *     else:
  2436.  *       raise Exception('Bytes size %d is not a power of 2' % byte_size)
  2437.  */
  2438.     __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2439.     __Pyx_GOTREF(__pyx_t_3);
  2440.     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2441.     __Pyx_GOTREF(__pyx_t_1);
  2442.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2443.     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2444.     __Pyx_GOTREF(__pyx_t_3);
  2445.     __Pyx_GIVEREF(__pyx_t_1);
  2446.     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2447.     __pyx_t_1 = 0;
  2448.     __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5numpy_dtype), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2449.     __Pyx_GOTREF(__pyx_t_1);
  2450.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2451.     __pyx_v_dtype = __pyx_t_1;
  2452.     __pyx_t_1 = 0;
  2453.  
  2454.     /* "lemantic/zigzag.pyx":52
  2455.  *       pre_dtype = np.dtype(np.int32)
  2456.  *       dtype = np.dtype(np.uint32)
  2457.  *     elif byte_size == 8:             # <<<<<<<<<<<<<<
  2458.  *       pre_dtype = np.dtype(np.int64)
  2459.  *       dtype = np.dtype(np.uint64)
  2460.  */
  2461.     goto __pyx_L3;
  2462.   }
  2463.  
  2464.   /* "lemantic/zigzag.pyx":56
  2465.  *       dtype = np.dtype(np.uint64)
  2466.  *     else:
  2467.  *       raise Exception('Bytes size %d is not a power of 2' % byte_size)             # <<<<<<<<<<<<<<
  2468.  *
  2469.  *     # Calcualte zig zag values
  2470.  */
  2471.   /*else*/ {
  2472.     __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Bytes_size_d_is_not_a_power_of_2, __pyx_v_byte_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2473.     __Pyx_GOTREF(__pyx_t_1);
  2474.     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2475.     __Pyx_GOTREF(__pyx_t_3);
  2476.     __Pyx_GIVEREF(__pyx_t_1);
  2477.     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2478.     __pyx_t_1 = 0;
  2479.     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2480.     __Pyx_GOTREF(__pyx_t_1);
  2481.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2482.     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  2483.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2484.     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2485.   }
  2486.   __pyx_L3:;
  2487.  
  2488.   /* "lemantic/zigzag.pyx":59
  2489.  *
  2490.  *     # Calcualte zig zag values
  2491.  *     self._dtype =  dtype             # <<<<<<<<<<<<<<
  2492.  *     self._pre_dtype = pre_dtype
  2493.  *     self._bit_size = ( dtype.itemsize * 8 ) - 1
  2494.  */
  2495.   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dtype_2, __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2496.  
  2497.   /* "lemantic/zigzag.pyx":60
  2498.  *     # Calcualte zig zag values
  2499.  *     self._dtype =  dtype
  2500.  *     self._pre_dtype = pre_dtype             # <<<<<<<<<<<<<<
  2501.  *     self._bit_size = ( dtype.itemsize * 8 ) - 1
  2502.  *     self._max_value = float(pow(2, self._bit_size) - 1)
  2503.  */
  2504.   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pre_dtype, __pyx_v_pre_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2505.  
  2506.   /* "lemantic/zigzag.pyx":61
  2507.  *     self._dtype =  dtype
  2508.  *     self._pre_dtype = pre_dtype
  2509.  *     self._bit_size = ( dtype.itemsize * 8 ) - 1             # <<<<<<<<<<<<<<
  2510.  *     self._max_value = float(pow(2, self._bit_size) - 1)
  2511.  *
  2512.  */
  2513.   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2514.   __Pyx_GOTREF(__pyx_t_1);
  2515.   __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_int_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2516.   __Pyx_GOTREF(__pyx_t_3);
  2517.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2518.   __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2519.   __Pyx_GOTREF(__pyx_t_1);
  2520.   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2521.   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bit_size_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2522.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2523.  
  2524.   /* "lemantic/zigzag.pyx":62
  2525.  *     self._pre_dtype = pre_dtype
  2526.  *     self._bit_size = ( dtype.itemsize * 8 ) - 1
  2527.  *     self._max_value = float(pow(2, self._bit_size) - 1)             # <<<<<<<<<<<<<<
  2528.  *
  2529.  *   def encode(self, items, bounds, log=False):
  2530.  */
  2531.   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bit_size_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2532.   __Pyx_GOTREF(__pyx_t_1);
  2533.   __pyx_t_3 = __Pyx_PyNumber_Power2(__pyx_int_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2534.   __Pyx_GOTREF(__pyx_t_3);
  2535.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2536.   __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2537.   __Pyx_GOTREF(__pyx_t_1);
  2538.   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2539.   __pyx_t_4 = __Pyx_PyObject_AsDouble(__pyx_t_1); if (unlikely(__pyx_t_4 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2540.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2541.   __pyx_t_1 = PyFloat_FromDouble(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2542.   __Pyx_GOTREF(__pyx_t_1);
  2543.   if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_max_value, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2544.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2545.  
  2546.   /* "lemantic/zigzag.pyx":45
  2547.  *
  2548.  *   @byte_size.setter
  2549.  *   def byte_size(self, byte_size):             # <<<<<<<<<<<<<<
  2550.  *     if byte_size == 2:
  2551.  *       pre_dtype = np.dtype(np.int16)
  2552.  */
  2553.  
  2554.   /* function exit code */
  2555.   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  2556.   goto __pyx_L0;
  2557.   __pyx_L1_error:;
  2558.   __Pyx_XDECREF(__pyx_t_1);
  2559.   __Pyx_XDECREF(__pyx_t_3);
  2560.   __Pyx_AddTraceback("lemantic.zigzag.ZigZag.byte_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2561.   __pyx_r = NULL;
  2562.   __pyx_L0:;
  2563.   __Pyx_XDECREF(__pyx_v_pre_dtype);
  2564.   __Pyx_XDECREF(__pyx_v_dtype);
  2565.   __Pyx_XGIVEREF(__pyx_r);
  2566.   __Pyx_RefNannyFinishContext();
  2567.   return __pyx_r;
  2568. }
  2569.  
  2570. /* "lemantic/zigzag.pyx":64
  2571.  *     self._max_value = float(pow(2, self._bit_size) - 1)
  2572.  *
  2573.  *   def encode(self, items, bounds, log=False):             # <<<<<<<<<<<<<<
  2574.  *     # Find bounds and scalar
  2575.  *     [ min_bounds, max_bounds ] = bounds
  2576.  */
  2577.  
  2578. /* Python wrapper */
  2579. static PyObject *__pyx_pw_8lemantic_6zigzag_6ZigZag_7encode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2580. static PyMethodDef __pyx_mdef_8lemantic_6zigzag_6ZigZag_7encode = {"encode", (PyCFunction)__pyx_pw_8lemantic_6zigzag_6ZigZag_7encode, METH_VARARGS|METH_KEYWORDS, 0};
  2581. static PyObject *__pyx_pw_8lemantic_6zigzag_6ZigZag_7encode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2582.   PyObject *__pyx_v_self = 0;
  2583.   PyObject *__pyx_v_items = 0;
  2584.   PyObject *__pyx_v_bounds = 0;
  2585.   CYTHON_UNUSED PyObject *__pyx_v_log = 0;
  2586.   int __pyx_lineno = 0;
  2587.   const char *__pyx_filename = NULL;
  2588.   int __pyx_clineno = 0;
  2589.   PyObject *__pyx_r = 0;
  2590.   __Pyx_RefNannyDeclarations
  2591.   __Pyx_RefNannySetupContext("encode (wrapper)", 0);
  2592.   {
  2593.     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_items,&__pyx_n_s_bounds,&__pyx_n_s_log,0};
  2594.     PyObject* values[4] = {0,0,0,0};
  2595.     values[3] = ((PyObject *)((PyObject *)Py_False));
  2596.     if (unlikely(__pyx_kwds)) {
  2597.       Py_ssize_t kw_args;
  2598.       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  2599.       switch (pos_args) {
  2600.         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2601.         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2602.         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2603.         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2604.         case  0: break;
  2605.         default: goto __pyx_L5_argtuple_error;
  2606.       }
  2607.       kw_args = PyDict_Size(__pyx_kwds);
  2608.       switch (pos_args) {
  2609.         case  0:
  2610.         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
  2611.         else goto __pyx_L5_argtuple_error;
  2612.         case  1:
  2613.         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_items)) != 0)) kw_args--;
  2614.         else {
  2615.           __Pyx_RaiseArgtupleInvalid("encode", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2616.         }
  2617.         case  2:
  2618.         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bounds)) != 0)) kw_args--;
  2619.         else {
  2620.           __Pyx_RaiseArgtupleInvalid("encode", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2621.         }
  2622.         case  3:
  2623.         if (kw_args > 0) {
  2624.           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_log);
  2625.           if (value) { values[3] = value; kw_args--; }
  2626.         }
  2627.       }
  2628.       if (unlikely(kw_args > 0)) {
  2629.         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2630.       }
  2631.     } else {
  2632.       switch (PyTuple_GET_SIZE(__pyx_args)) {
  2633.         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2634.         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2635.         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2636.         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2637.         break;
  2638.         default: goto __pyx_L5_argtuple_error;
  2639.       }
  2640.     }
  2641.     __pyx_v_self = values[0];
  2642.     __pyx_v_items = values[1];
  2643.     __pyx_v_bounds = values[2];
  2644.     __pyx_v_log = values[3];
  2645.   }
  2646.   goto __pyx_L4_argument_unpacking_done;
  2647.   __pyx_L5_argtuple_error:;
  2648.   __Pyx_RaiseArgtupleInvalid("encode", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2649.   __pyx_L3_error:;
  2650.   __Pyx_AddTraceback("lemantic.zigzag.ZigZag.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2651.   __Pyx_RefNannyFinishContext();
  2652.   return NULL;
  2653.   __pyx_L4_argument_unpacking_done:;
  2654.   __pyx_r = __pyx_pf_8lemantic_6zigzag_6ZigZag_6encode(__pyx_self, __pyx_v_self, __pyx_v_items, __pyx_v_bounds, __pyx_v_log);
  2655.  
  2656.   /* function exit code */
  2657.   __Pyx_RefNannyFinishContext();
  2658.   return __pyx_r;
  2659. }
  2660.  
  2661. static PyObject *__pyx_pf_8lemantic_6zigzag_6ZigZag_6encode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_bounds, CYTHON_UNUSED PyObject *__pyx_v_log) {
  2662.   PyObject *__pyx_v_min_bounds = NULL;
  2663.   PyObject *__pyx_v_max_bounds = NULL;
  2664.   PyObject *__pyx_v_dimension = NULL;
  2665.   PyObject *__pyx_v_scalar = NULL;
  2666.   PyObject *__pyx_v_quantized = NULL;
  2667.   PyObject *__pyx_r = NULL;
  2668.   __Pyx_RefNannyDeclarations
  2669.   PyObject *__pyx_t_1 = NULL;
  2670.   PyObject *__pyx_t_2 = NULL;
  2671.   PyObject *__pyx_t_3 = NULL;
  2672.   PyObject *(*__pyx_t_4)(PyObject *);
  2673.   PyObject *__pyx_t_5 = NULL;
  2674.   PyObject *__pyx_t_6 = NULL;
  2675.   int __pyx_t_7;
  2676.   PyObject *__pyx_t_8 = NULL;
  2677.   Py_ssize_t __pyx_t_9;
  2678.   int __pyx_lineno = 0;
  2679.   const char *__pyx_filename = NULL;
  2680.   int __pyx_clineno = 0;
  2681.   __Pyx_RefNannySetupContext("encode", 0);
  2682.  
  2683.   /* "lemantic/zigzag.pyx":66
  2684.  *   def encode(self, items, bounds, log=False):
  2685.  *     # Find bounds and scalar
  2686.  *     [ min_bounds, max_bounds ] = bounds             # <<<<<<<<<<<<<<
  2687.  *     dimension = np.abs(max_bounds - min_bounds)
  2688.  *     if dimension != 0:
  2689.  */
  2690.   if ((likely(PyTuple_CheckExact(__pyx_v_bounds))) || (PyList_CheckExact(__pyx_v_bounds))) {
  2691.     PyObject* sequence = __pyx_v_bounds;
  2692.     #if CYTHON_COMPILING_IN_CPYTHON
  2693.     Py_ssize_t size = Py_SIZE(sequence);
  2694.     #else
  2695.     Py_ssize_t size = PySequence_Size(sequence);
  2696.     #endif
  2697.     if (unlikely(size != 2)) {
  2698.       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  2699.       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  2700.       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2701.     }
  2702.     #if CYTHON_COMPILING_IN_CPYTHON
  2703.     if (likely(PyTuple_CheckExact(sequence))) {
  2704.       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  2705.       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  2706.     } else {
  2707.       __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
  2708.       __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
  2709.     }
  2710.     __Pyx_INCREF(__pyx_t_1);
  2711.     __Pyx_INCREF(__pyx_t_2);
  2712.     #else
  2713.     __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2714.     __Pyx_GOTREF(__pyx_t_1);
  2715.     __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2716.     __Pyx_GOTREF(__pyx_t_2);
  2717.     #endif
  2718.   } else {
  2719.     Py_ssize_t index = -1;
  2720.     __pyx_t_3 = PyObject_GetIter(__pyx_v_bounds); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2721.     __Pyx_GOTREF(__pyx_t_3);
  2722.     __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
  2723.     index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  2724.     __Pyx_GOTREF(__pyx_t_1);
  2725.     index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  2726.     __Pyx_GOTREF(__pyx_t_2);
  2727.     if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2728.     __pyx_t_4 = NULL;
  2729.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2730.     goto __pyx_L4_unpacking_done;
  2731.     __pyx_L3_unpacking_failed:;
  2732.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2733.     __pyx_t_4 = NULL;
  2734.     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  2735.     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2736.     __pyx_L4_unpacking_done:;
  2737.   }
  2738.   __pyx_v_min_bounds = __pyx_t_1;
  2739.   __pyx_t_1 = 0;
  2740.   __pyx_v_max_bounds = __pyx_t_2;
  2741.   __pyx_t_2 = 0;
  2742.  
  2743.   /* "lemantic/zigzag.pyx":67
  2744.  *     # Find bounds and scalar
  2745.  *     [ min_bounds, max_bounds ] = bounds
  2746.  *     dimension = np.abs(max_bounds - min_bounds)             # <<<<<<<<<<<<<<
  2747.  *     if dimension != 0:
  2748.  *       scalar = self._max_value / np.abs(max_bounds - min_bounds)
  2749.  */
  2750.   __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2751.   __Pyx_GOTREF(__pyx_t_1);
  2752.   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_abs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2753.   __Pyx_GOTREF(__pyx_t_3);
  2754.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2755.   __pyx_t_1 = PyNumber_Subtract(__pyx_v_max_bounds, __pyx_v_min_bounds); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2756.   __Pyx_GOTREF(__pyx_t_1);
  2757.   __pyx_t_5 = NULL;
  2758.   if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
  2759.     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
  2760.     if (likely(__pyx_t_5)) {
  2761.       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  2762.       __Pyx_INCREF(__pyx_t_5);
  2763.       __Pyx_INCREF(function);
  2764.       __Pyx_DECREF_SET(__pyx_t_3, function);
  2765.     }
  2766.   }
  2767.   if (!__pyx_t_5) {
  2768.     __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2769.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2770.     __Pyx_GOTREF(__pyx_t_2);
  2771.   } else {
  2772.     __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2773.     __Pyx_GOTREF(__pyx_t_6);
  2774.     __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
  2775.     __Pyx_GIVEREF(__pyx_t_1);
  2776.     PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_1);
  2777.     __pyx_t_1 = 0;
  2778.     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2779.     __Pyx_GOTREF(__pyx_t_2);
  2780.     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2781.   }
  2782.   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2783.   __pyx_v_dimension = __pyx_t_2;
  2784.   __pyx_t_2 = 0;
  2785.  
  2786.   /* "lemantic/zigzag.pyx":68
  2787.  *     [ min_bounds, max_bounds ] = bounds
  2788.  *     dimension = np.abs(max_bounds - min_bounds)
  2789.  *     if dimension != 0:             # <<<<<<<<<<<<<<
  2790.  *       scalar = self._max_value / np.abs(max_bounds - min_bounds)
  2791.  *     else:
  2792.  */
  2793.   __pyx_t_2 = PyObject_RichCompare(__pyx_v_dimension, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2794.   __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2795.   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2796.   if (__pyx_t_7) {
  2797.  
  2798.     /* "lemantic/zigzag.pyx":69
  2799.  *     dimension = np.abs(max_bounds - min_bounds)
  2800.  *     if dimension != 0:
  2801.  *       scalar = self._max_value / np.abs(max_bounds - min_bounds)             # <<<<<<<<<<<<<<
  2802.  *     else:
  2803.  *       scalar = 0
  2804.  */
  2805.     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2806.     __Pyx_GOTREF(__pyx_t_2);
  2807.     __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2808.     __Pyx_GOTREF(__pyx_t_6);
  2809.     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_abs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2810.     __Pyx_GOTREF(__pyx_t_1);
  2811.     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2812.     __pyx_t_6 = PyNumber_Subtract(__pyx_v_max_bounds, __pyx_v_min_bounds); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2813.     __Pyx_GOTREF(__pyx_t_6);
  2814.     __pyx_t_5 = NULL;
  2815.     if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
  2816.       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
  2817.       if (likely(__pyx_t_5)) {
  2818.         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
  2819.         __Pyx_INCREF(__pyx_t_5);
  2820.         __Pyx_INCREF(function);
  2821.         __Pyx_DECREF_SET(__pyx_t_1, function);
  2822.       }
  2823.     }
  2824.     if (!__pyx_t_5) {
  2825.       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2826.       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2827.       __Pyx_GOTREF(__pyx_t_3);
  2828.     } else {
  2829.       __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2830.       __Pyx_GOTREF(__pyx_t_8);
  2831.       __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
  2832.       __Pyx_GIVEREF(__pyx_t_6);
  2833.       PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
  2834.       __pyx_t_6 = 0;
  2835.       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2836.       __Pyx_GOTREF(__pyx_t_3);
  2837.       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  2838.     }
  2839.     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2840.     __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2841.     __Pyx_GOTREF(__pyx_t_1);
  2842.     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2843.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2844.     __pyx_v_scalar = __pyx_t_1;
  2845.     __pyx_t_1 = 0;
  2846.  
  2847.     /* "lemantic/zigzag.pyx":68
  2848.  *     [ min_bounds, max_bounds ] = bounds
  2849.  *     dimension = np.abs(max_bounds - min_bounds)
  2850.  *     if dimension != 0:             # <<<<<<<<<<<<<<
  2851.  *       scalar = self._max_value / np.abs(max_bounds - min_bounds)
  2852.  *     else:
  2853.  */
  2854.     goto __pyx_L5;
  2855.   }
  2856.  
  2857.   /* "lemantic/zigzag.pyx":71
  2858.  *       scalar = self._max_value / np.abs(max_bounds - min_bounds)
  2859.  *     else:
  2860.  *       scalar = 0             # <<<<<<<<<<<<<<
  2861.  *
  2862.  *     #  Quantize data
  2863.  */
  2864.   /*else*/ {
  2865.     __Pyx_INCREF(__pyx_int_0);
  2866.     __pyx_v_scalar = __pyx_int_0;
  2867.   }
  2868.   __pyx_L5:;
  2869.  
  2870.   /* "lemantic/zigzag.pyx":74
  2871.  *
  2872.  *     #  Quantize data
  2873.  *     quantized = ((items - min_bounds) * scalar)\             # <<<<<<<<<<<<<<
  2874.  *       .clip(0, self._max_value)\
  2875.  *       .astype(self._pre_dtype) # subtract by min
  2876.  */
  2877.   __pyx_t_2 = PyNumber_Subtract(__pyx_v_items, __pyx_v_min_bounds); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2878.   __Pyx_GOTREF(__pyx_t_2);
  2879.   __pyx_t_8 = PyNumber_Multiply(__pyx_t_2, __pyx_v_scalar); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2880.   __Pyx_GOTREF(__pyx_t_8);
  2881.   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2882.  
  2883.   /* "lemantic/zigzag.pyx":75
  2884.  *     #  Quantize data
  2885.  *     quantized = ((items - min_bounds) * scalar)\
  2886.  *       .clip(0, self._max_value)\             # <<<<<<<<<<<<<<
  2887.  *       .astype(self._pre_dtype) # subtract by min
  2888.  *
  2889.  */
  2890.   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_clip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2891.   __Pyx_GOTREF(__pyx_t_2);
  2892.   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  2893.   __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_value); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2894.   __Pyx_GOTREF(__pyx_t_8);
  2895.   __pyx_t_6 = NULL;
  2896.   __pyx_t_9 = 0;
  2897.   if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
  2898.     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
  2899.     if (likely(__pyx_t_6)) {
  2900.       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  2901.       __Pyx_INCREF(__pyx_t_6);
  2902.       __Pyx_INCREF(function);
  2903.       __Pyx_DECREF_SET(__pyx_t_2, function);
  2904.       __pyx_t_9 = 1;
  2905.     }
  2906.   }
  2907.   __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2908.   __Pyx_GOTREF(__pyx_t_5);
  2909.   if (__pyx_t_6) {
  2910.     __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
  2911.   }
  2912.   __Pyx_INCREF(__pyx_int_0);
  2913.   __Pyx_GIVEREF(__pyx_int_0);
  2914.   PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_int_0);
  2915.   __Pyx_GIVEREF(__pyx_t_8);
  2916.   PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_t_8);
  2917.   __pyx_t_8 = 0;
  2918.   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2919.   __Pyx_GOTREF(__pyx_t_3);
  2920.   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2921.   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2922.  
  2923.   /* "lemantic/zigzag.pyx":76
  2924.  *     quantized = ((items - min_bounds) * scalar)\
  2925.  *       .clip(0, self._max_value)\
  2926.  *       .astype(self._pre_dtype) # subtract by min             # <<<<<<<<<<<<<<
  2927.  *
  2928.  *     return encode(quantized, self._bit_size).astype(self._dtype)
  2929.  */
  2930.   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2931.   __Pyx_GOTREF(__pyx_t_2);
  2932.   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2933.   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pre_dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2934.   __Pyx_GOTREF(__pyx_t_3);
  2935.   __pyx_t_5 = NULL;
  2936.   if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
  2937.     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  2938.     if (likely(__pyx_t_5)) {
  2939.       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  2940.       __Pyx_INCREF(__pyx_t_5);
  2941.       __Pyx_INCREF(function);
  2942.       __Pyx_DECREF_SET(__pyx_t_2, function);
  2943.     }
  2944.   }
  2945.   if (!__pyx_t_5) {
  2946.     __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2947.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2948.     __Pyx_GOTREF(__pyx_t_1);
  2949.   } else {
  2950.     __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2951.     __Pyx_GOTREF(__pyx_t_8);
  2952.     __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
  2953.     __Pyx_GIVEREF(__pyx_t_3);
  2954.     PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_3);
  2955.     __pyx_t_3 = 0;
  2956.     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2957.     __Pyx_GOTREF(__pyx_t_1);
  2958.     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  2959.   }
  2960.   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2961.   __pyx_v_quantized = __pyx_t_1;
  2962.   __pyx_t_1 = 0;
  2963.  
  2964.   /* "lemantic/zigzag.pyx":78
  2965.  *       .astype(self._pre_dtype) # subtract by min
  2966.  *
  2967.  *     return encode(quantized, self._bit_size).astype(self._dtype)             # <<<<<<<<<<<<<<
  2968.  *
  2969.  *   def decode():
  2970.  */
  2971.   __Pyx_XDECREF(__pyx_r);
  2972.   __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_encode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2973.   __Pyx_GOTREF(__pyx_t_8);
  2974.   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bit_size_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2975.   __Pyx_GOTREF(__pyx_t_3);
  2976.   __pyx_t_5 = NULL;
  2977.   __pyx_t_9 = 0;
  2978.   if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
  2979.     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
  2980.     if (likely(__pyx_t_5)) {
  2981.       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
  2982.       __Pyx_INCREF(__pyx_t_5);
  2983.       __Pyx_INCREF(function);
  2984.       __Pyx_DECREF_SET(__pyx_t_8, function);
  2985.       __pyx_t_9 = 1;
  2986.     }
  2987.   }
  2988.   __pyx_t_6 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2989.   __Pyx_GOTREF(__pyx_t_6);
  2990.   if (__pyx_t_5) {
  2991.     __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
  2992.   }
  2993.   __Pyx_INCREF(__pyx_v_quantized);
  2994.   __Pyx_GIVEREF(__pyx_v_quantized);
  2995.   PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_v_quantized);
  2996.   __Pyx_GIVEREF(__pyx_t_3);
  2997.   PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_t_3);
  2998.   __pyx_t_3 = 0;
  2999.   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3000.   __Pyx_GOTREF(__pyx_t_2);
  3001.   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3002.   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3003.   __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3004.   __Pyx_GOTREF(__pyx_t_8);
  3005.   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3006.   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3007.   __Pyx_GOTREF(__pyx_t_2);
  3008.   __pyx_t_6 = NULL;
  3009.   if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
  3010.     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
  3011.     if (likely(__pyx_t_6)) {
  3012.       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
  3013.       __Pyx_INCREF(__pyx_t_6);
  3014.       __Pyx_INCREF(function);
  3015.       __Pyx_DECREF_SET(__pyx_t_8, function);
  3016.     }
  3017.   }
  3018.   if (!__pyx_t_6) {
  3019.     __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3020.     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3021.     __Pyx_GOTREF(__pyx_t_1);
  3022.   } else {
  3023.     __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3024.     __Pyx_GOTREF(__pyx_t_3);
  3025.     __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
  3026.     __Pyx_GIVEREF(__pyx_t_2);
  3027.     PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_2);
  3028.     __pyx_t_2 = 0;
  3029.     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3030.     __Pyx_GOTREF(__pyx_t_1);
  3031.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3032.   }
  3033.   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3034.   __pyx_r = __pyx_t_1;
  3035.   __pyx_t_1 = 0;
  3036.   goto __pyx_L0;
  3037.  
  3038.   /* "lemantic/zigzag.pyx":64
  3039.  *     self._max_value = float(pow(2, self._bit_size) - 1)
  3040.  *
  3041.  *   def encode(self, items, bounds, log=False):             # <<<<<<<<<<<<<<
  3042.  *     # Find bounds and scalar
  3043.  *     [ min_bounds, max_bounds ] = bounds
  3044.  */
  3045.  
  3046.   /* function exit code */
  3047.   __pyx_L1_error:;
  3048.   __Pyx_XDECREF(__pyx_t_1);
  3049.   __Pyx_XDECREF(__pyx_t_2);
  3050.   __Pyx_XDECREF(__pyx_t_3);
  3051.   __Pyx_XDECREF(__pyx_t_5);
  3052.   __Pyx_XDECREF(__pyx_t_6);
  3053.   __Pyx_XDECREF(__pyx_t_8);
  3054.   __Pyx_AddTraceback("lemantic.zigzag.ZigZag.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3055.   __pyx_r = NULL;
  3056.   __pyx_L0:;
  3057.   __Pyx_XDECREF(__pyx_v_min_bounds);
  3058.   __Pyx_XDECREF(__pyx_v_max_bounds);
  3059.   __Pyx_XDECREF(__pyx_v_dimension);
  3060.   __Pyx_XDECREF(__pyx_v_scalar);
  3061.   __Pyx_XDECREF(__pyx_v_quantized);
  3062.   __Pyx_XGIVEREF(__pyx_r);
  3063.   __Pyx_RefNannyFinishContext();
  3064.   return __pyx_r;
  3065. }
  3066.  
  3067. /* "lemantic/zigzag.pyx":80
  3068.  *     return encode(quantized, self._bit_size).astype(self._dtype)
  3069.  *
  3070.  *   def decode():             # <<<<<<<<<<<<<<
  3071.  *     pass
  3072.  */
  3073.  
  3074. /* Python wrapper */
  3075. static PyObject *__pyx_pw_8lemantic_6zigzag_6ZigZag_9decode(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  3076. static PyMethodDef __pyx_mdef_8lemantic_6zigzag_6ZigZag_9decode = {"decode", (PyCFunction)__pyx_pw_8lemantic_6zigzag_6ZigZag_9decode, METH_NOARGS, 0};
  3077. static PyObject *__pyx_pw_8lemantic_6zigzag_6ZigZag_9decode(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  3078.   PyObject *__pyx_r = 0;
  3079.   __Pyx_RefNannyDeclarations
  3080.   __Pyx_RefNannySetupContext("decode (wrapper)", 0);
  3081.   __pyx_r = __pyx_pf_8lemantic_6zigzag_6ZigZag_8decode(__pyx_self);
  3082.  
  3083.   /* function exit code */
  3084.   __Pyx_RefNannyFinishContext();
  3085.   return __pyx_r;
  3086. }
  3087.  
  3088. static PyObject *__pyx_pf_8lemantic_6zigzag_6ZigZag_8decode(CYTHON_UNUSED PyObject *__pyx_self) {
  3089.   PyObject *__pyx_r = NULL;
  3090.   __Pyx_RefNannyDeclarations
  3091.   __Pyx_RefNannySetupContext("decode", 0);
  3092.  
  3093.   /* function exit code */
  3094.   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  3095.   __Pyx_XGIVEREF(__pyx_r);
  3096.   __Pyx_RefNannyFinishContext();
  3097.   return __pyx_r;
  3098. }
  3099.  
  3100. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":197
  3101.  *         # experimental exception made for __getbuffer__ and __releasebuffer__
  3102.  *         # -- the details of this may change.
  3103.  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
  3104.  *             # This implementation of getbuffer is geared towards Cython
  3105.  *             # requirements, and does not yet fullfill the PEP.
  3106.  */
  3107.  
  3108. /* Python wrapper */
  3109. static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  3110. static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  3111.   int __pyx_r;
  3112.   __Pyx_RefNannyDeclarations
  3113.   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  3114.   __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  3115.  
  3116.   /* function exit code */
  3117.   __Pyx_RefNannyFinishContext();
  3118.   return __pyx_r;
  3119. }
  3120.  
  3121. static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  3122.   int __pyx_v_copy_shape;
  3123.   int __pyx_v_i;
  3124.   int __pyx_v_ndim;
  3125.   int __pyx_v_endian_detector;
  3126.   int __pyx_v_little_endian;
  3127.   int __pyx_v_t;
  3128.   char *__pyx_v_f;
  3129.   PyArray_Descr *__pyx_v_descr = 0;
  3130.   int __pyx_v_offset;
  3131.   int __pyx_v_hasfields;
  3132.   int __pyx_r;
  3133.   __Pyx_RefNannyDeclarations
  3134.   int __pyx_t_1;
  3135.   int __pyx_t_2;
  3136.   PyObject *__pyx_t_3 = NULL;
  3137.   int __pyx_t_4;
  3138.   int __pyx_t_5;
  3139.   PyObject *__pyx_t_6 = NULL;
  3140.   char *__pyx_t_7;
  3141.   int __pyx_lineno = 0;
  3142.   const char *__pyx_filename = NULL;
  3143.   int __pyx_clineno = 0;
  3144.   __Pyx_RefNannySetupContext("__getbuffer__", 0);
  3145.   if (__pyx_v_info != NULL) {
  3146.     __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  3147.     __Pyx_GIVEREF(__pyx_v_info->obj);
  3148.   }
  3149.  
  3150.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":203
  3151.  *             # of flags
  3152.  *
  3153.  *             if info == NULL: return             # <<<<<<<<<<<<<<
  3154.  *
  3155.  *             cdef int copy_shape, i, ndim
  3156.  */
  3157.   __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
  3158.   if (__pyx_t_1) {
  3159.     __pyx_r = 0;
  3160.     goto __pyx_L0;
  3161.   }
  3162.  
  3163.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":206
  3164.  *
  3165.  *             cdef int copy_shape, i, ndim
  3166.  *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
  3167.  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  3168.  *
  3169.  */
  3170.   __pyx_v_endian_detector = 1;
  3171.  
  3172.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":207
  3173.  *             cdef int copy_shape, i, ndim
  3174.  *             cdef int endian_detector = 1
  3175.  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
  3176.  *
  3177.  *             ndim = PyArray_NDIM(self)
  3178.  */
  3179.   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
  3180.  
  3181.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":209
  3182.  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  3183.  *
  3184.  *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
  3185.  *
  3186.  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  3187.  */
  3188.   __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
  3189.  
  3190.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":211
  3191.  *             ndim = PyArray_NDIM(self)
  3192.  *
  3193.  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
  3194.  *                 copy_shape = 1
  3195.  *             else:
  3196.  */
  3197.   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  3198.   if (__pyx_t_1) {
  3199.  
  3200.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":212
  3201.  *
  3202.  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  3203.  *                 copy_shape = 1             # <<<<<<<<<<<<<<
  3204.  *             else:
  3205.  *                 copy_shape = 0
  3206.  */
  3207.     __pyx_v_copy_shape = 1;
  3208.  
  3209.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":211
  3210.  *             ndim = PyArray_NDIM(self)
  3211.  *
  3212.  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
  3213.  *                 copy_shape = 1
  3214.  *             else:
  3215.  */
  3216.     goto __pyx_L4;
  3217.   }
  3218.  
  3219.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":214
  3220.  *                 copy_shape = 1
  3221.  *             else:
  3222.  *                 copy_shape = 0             # <<<<<<<<<<<<<<
  3223.  *
  3224.  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  3225.  */
  3226.   /*else*/ {
  3227.     __pyx_v_copy_shape = 0;
  3228.   }
  3229.   __pyx_L4:;
  3230.  
  3231.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216
  3232.  *                 copy_shape = 0
  3233.  *
  3234.  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
  3235.  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  3236.  *                 raise ValueError(u"ndarray is not C contiguous")
  3237.  */
  3238.   __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
  3239.   if (__pyx_t_2) {
  3240.   } else {
  3241.     __pyx_t_1 = __pyx_t_2;
  3242.     goto __pyx_L6_bool_binop_done;
  3243.   }
  3244.  
  3245.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":217
  3246.  *
  3247.  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  3248.  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
  3249.  *                 raise ValueError(u"ndarray is not C contiguous")
  3250.  *
  3251.  */
  3252.   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
  3253.   __pyx_t_1 = __pyx_t_2;
  3254.   __pyx_L6_bool_binop_done:;
  3255.  
  3256.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216
  3257.  *                 copy_shape = 0
  3258.  *
  3259.  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
  3260.  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  3261.  *                 raise ValueError(u"ndarray is not C contiguous")
  3262.  */
  3263.   if (__pyx_t_1) {
  3264.  
  3265.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218
  3266.  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  3267.  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  3268.  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
  3269.  *
  3270.  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  3271.  */
  3272.     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3273.     __Pyx_GOTREF(__pyx_t_3);
  3274.     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  3275.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3276.     {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3277.  
  3278.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216
  3279.  *                 copy_shape = 0
  3280.  *
  3281.  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
  3282.  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  3283.  *                 raise ValueError(u"ndarray is not C contiguous")
  3284.  */
  3285.   }
  3286.  
  3287.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220
  3288.  *                 raise ValueError(u"ndarray is not C contiguous")
  3289.  *
  3290.  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
  3291.  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  3292.  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  3293.  */
  3294.   __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
  3295.   if (__pyx_t_2) {
  3296.   } else {
  3297.     __pyx_t_1 = __pyx_t_2;
  3298.     goto __pyx_L9_bool_binop_done;
  3299.   }
  3300.  
  3301.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":221
  3302.  *
  3303.  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  3304.  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
  3305.  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  3306.  *
  3307.  */
  3308.   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
  3309.   __pyx_t_1 = __pyx_t_2;
  3310.   __pyx_L9_bool_binop_done:;
  3311.  
  3312.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220
  3313.  *                 raise ValueError(u"ndarray is not C contiguous")
  3314.  *
  3315.  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
  3316.  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  3317.  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  3318.  */
  3319.   if (__pyx_t_1) {
  3320.  
  3321.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222
  3322.  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  3323.  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  3324.  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
  3325.  *
  3326.  *             info.buf = PyArray_DATA(self)
  3327.  */
  3328.     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3329.     __Pyx_GOTREF(__pyx_t_3);
  3330.     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  3331.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3332.     {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3333.  
  3334.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220
  3335.  *                 raise ValueError(u"ndarray is not C contiguous")
  3336.  *
  3337.  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
  3338.  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  3339.  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  3340.  */
  3341.   }
  3342.  
  3343.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":224
  3344.  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  3345.  *
  3346.  *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
  3347.  *             info.ndim = ndim
  3348.  *             if copy_shape:
  3349.  */
  3350.   __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
  3351.  
  3352.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":225
  3353.  *
  3354.  *             info.buf = PyArray_DATA(self)
  3355.  *             info.ndim = ndim             # <<<<<<<<<<<<<<
  3356.  *             if copy_shape:
  3357.  *                 # Allocate new buffer for strides and shape info.
  3358.  */
  3359.   __pyx_v_info->ndim = __pyx_v_ndim;
  3360.  
  3361.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":226
  3362.  *             info.buf = PyArray_DATA(self)
  3363.  *             info.ndim = ndim
  3364.  *             if copy_shape:             # <<<<<<<<<<<<<<
  3365.  *                 # Allocate new buffer for strides and shape info.
  3366.  *                 # This is allocated as one block, strides first.
  3367.  */
  3368.   __pyx_t_1 = (__pyx_v_copy_shape != 0);
  3369.   if (__pyx_t_1) {
  3370.  
  3371.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":229
  3372.  *                 # Allocate new buffer for strides and shape info.
  3373.  *                 # This is allocated as one block, strides first.
  3374.  *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)             # <<<<<<<<<<<<<<
  3375.  *                 info.shape = info.strides + ndim
  3376.  *                 for i in range(ndim):
  3377.  */
  3378.     __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
  3379.  
  3380.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":230
  3381.  *                 # This is allocated as one block, strides first.
  3382.  *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
  3383.  *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
  3384.  *                 for i in range(ndim):
  3385.  *                     info.strides[i] = PyArray_STRIDES(self)[i]
  3386.  */
  3387.     __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
  3388.  
  3389.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":231
  3390.  *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
  3391.  *                 info.shape = info.strides + ndim
  3392.  *                 for i in range(ndim):             # <<<<<<<<<<<<<<
  3393.  *                     info.strides[i] = PyArray_STRIDES(self)[i]
  3394.  *                     info.shape[i] = PyArray_DIMS(self)[i]
  3395.  */
  3396.     __pyx_t_4 = __pyx_v_ndim;
  3397.     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
  3398.       __pyx_v_i = __pyx_t_5;
  3399.  
  3400.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":232
  3401.  *                 info.shape = info.strides + ndim
  3402.  *                 for i in range(ndim):
  3403.  *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
  3404.  *                     info.shape[i] = PyArray_DIMS(self)[i]
  3405.  *             else:
  3406.  */
  3407.       (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
  3408.  
  3409.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":233
  3410.  *                 for i in range(ndim):
  3411.  *                     info.strides[i] = PyArray_STRIDES(self)[i]
  3412.  *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
  3413.  *             else:
  3414.  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  3415.  */
  3416.       (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
  3417.     }
  3418.  
  3419.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":226
  3420.  *             info.buf = PyArray_DATA(self)
  3421.  *             info.ndim = ndim
  3422.  *             if copy_shape:             # <<<<<<<<<<<<<<
  3423.  *                 # Allocate new buffer for strides and shape info.
  3424.  *                 # This is allocated as one block, strides first.
  3425.  */
  3426.     goto __pyx_L11;
  3427.   }
  3428.  
  3429.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":235
  3430.  *                     info.shape[i] = PyArray_DIMS(self)[i]
  3431.  *             else:
  3432.  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
  3433.  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  3434.  *             info.suboffsets = NULL
  3435.  */
  3436.   /*else*/ {
  3437.     __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
  3438.  
  3439.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":236
  3440.  *             else:
  3441.  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  3442.  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
  3443.  *             info.suboffsets = NULL
  3444.  *             info.itemsize = PyArray_ITEMSIZE(self)
  3445.  */
  3446.     __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  3447.   }
  3448.   __pyx_L11:;
  3449.  
  3450.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":237
  3451.  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  3452.  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  3453.  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
  3454.  *             info.itemsize = PyArray_ITEMSIZE(self)
  3455.  *             info.readonly = not PyArray_ISWRITEABLE(self)
  3456.  */
  3457.   __pyx_v_info->suboffsets = NULL;
  3458.  
  3459.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":238
  3460.  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  3461.  *             info.suboffsets = NULL
  3462.  *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
  3463.  *             info.readonly = not PyArray_ISWRITEABLE(self)
  3464.  *
  3465.  */
  3466.   __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
  3467.  
  3468.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":239
  3469.  *             info.suboffsets = NULL
  3470.  *             info.itemsize = PyArray_ITEMSIZE(self)
  3471.  *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
  3472.  *
  3473.  *             cdef int t
  3474.  */
  3475.   __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
  3476.  
  3477.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":242
  3478.  *
  3479.  *             cdef int t
  3480.  *             cdef char* f = NULL             # <<<<<<<<<<<<<<
  3481.  *             cdef dtype descr = self.descr
  3482.  *             cdef int offset
  3483.  */
  3484.   __pyx_v_f = NULL;
  3485.  
  3486.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":243
  3487.  *             cdef int t
  3488.  *             cdef char* f = NULL
  3489.  *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
  3490.  *             cdef int offset
  3491.  *
  3492.  */
  3493.   __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
  3494.   __Pyx_INCREF(__pyx_t_3);
  3495.   __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
  3496.   __pyx_t_3 = 0;
  3497.  
  3498.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":246
  3499.  *             cdef int offset
  3500.  *
  3501.  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
  3502.  *
  3503.  *             if not hasfields and not copy_shape:
  3504.  */
  3505.   __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
  3506.  
  3507.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":248
  3508.  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
  3509.  *
  3510.  *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
  3511.  *                 # do not call releasebuffer
  3512.  *                 info.obj = None
  3513.  */
  3514.   __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
  3515.   if (__pyx_t_2) {
  3516.   } else {
  3517.     __pyx_t_1 = __pyx_t_2;
  3518.     goto __pyx_L15_bool_binop_done;
  3519.   }
  3520.   __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
  3521.   __pyx_t_1 = __pyx_t_2;
  3522.   __pyx_L15_bool_binop_done:;
  3523.   if (__pyx_t_1) {
  3524.  
  3525.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":250
  3526.  *             if not hasfields and not copy_shape:
  3527.  *                 # do not call releasebuffer
  3528.  *                 info.obj = None             # <<<<<<<<<<<<<<
  3529.  *             else:
  3530.  *                 # need to call releasebuffer
  3531.  */
  3532.     __Pyx_INCREF(Py_None);
  3533.     __Pyx_GIVEREF(Py_None);
  3534.     __Pyx_GOTREF(__pyx_v_info->obj);
  3535.     __Pyx_DECREF(__pyx_v_info->obj);
  3536.     __pyx_v_info->obj = Py_None;
  3537.  
  3538.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":248
  3539.  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
  3540.  *
  3541.  *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
  3542.  *                 # do not call releasebuffer
  3543.  *                 info.obj = None
  3544.  */
  3545.     goto __pyx_L14;
  3546.   }
  3547.  
  3548.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":253
  3549.  *             else:
  3550.  *                 # need to call releasebuffer
  3551.  *                 info.obj = self             # <<<<<<<<<<<<<<
  3552.  *
  3553.  *             if not hasfields:
  3554.  */
  3555.   /*else*/ {
  3556.     __Pyx_INCREF(((PyObject *)__pyx_v_self));
  3557.     __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  3558.     __Pyx_GOTREF(__pyx_v_info->obj);
  3559.     __Pyx_DECREF(__pyx_v_info->obj);
  3560.     __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  3561.   }
  3562.   __pyx_L14:;
  3563.  
  3564.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":255
  3565.  *                 info.obj = self
  3566.  *
  3567.  *             if not hasfields:             # <<<<<<<<<<<<<<
  3568.  *                 t = descr.type_num
  3569.  *                 if ((descr.byteorder == c'>' and little_endian) or
  3570.  */
  3571.   __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
  3572.   if (__pyx_t_1) {
  3573.  
  3574.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":256
  3575.  *
  3576.  *             if not hasfields:
  3577.  *                 t = descr.type_num             # <<<<<<<<<<<<<<
  3578.  *                 if ((descr.byteorder == c'>' and little_endian) or
  3579.  *                     (descr.byteorder == c'<' and not little_endian)):
  3580.  */
  3581.     __pyx_t_4 = __pyx_v_descr->type_num;
  3582.     __pyx_v_t = __pyx_t_4;
  3583.  
  3584.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257
  3585.  *             if not hasfields:
  3586.  *                 t = descr.type_num
  3587.  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
  3588.  *                     (descr.byteorder == c'<' and not little_endian)):
  3589.  *                     raise ValueError(u"Non-native byte order not supported")
  3590.  */
  3591.     __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
  3592.     if (!__pyx_t_2) {
  3593.       goto __pyx_L20_next_or;
  3594.     } else {
  3595.     }
  3596.     __pyx_t_2 = (__pyx_v_little_endian != 0);
  3597.     if (!__pyx_t_2) {
  3598.     } else {
  3599.       __pyx_t_1 = __pyx_t_2;
  3600.       goto __pyx_L19_bool_binop_done;
  3601.     }
  3602.     __pyx_L20_next_or:;
  3603.  
  3604.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":258
  3605.  *                 t = descr.type_num
  3606.  *                 if ((descr.byteorder == c'>' and little_endian) or
  3607.  *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
  3608.  *                     raise ValueError(u"Non-native byte order not supported")
  3609.  *                 if   t == NPY_BYTE:        f = "b"
  3610.  */
  3611.     __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
  3612.     if (__pyx_t_2) {
  3613.     } else {
  3614.       __pyx_t_1 = __pyx_t_2;
  3615.       goto __pyx_L19_bool_binop_done;
  3616.     }
  3617.     __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
  3618.     __pyx_t_1 = __pyx_t_2;
  3619.     __pyx_L19_bool_binop_done:;
  3620.  
  3621.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257
  3622.  *             if not hasfields:
  3623.  *                 t = descr.type_num
  3624.  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
  3625.  *                     (descr.byteorder == c'<' and not little_endian)):
  3626.  *                     raise ValueError(u"Non-native byte order not supported")
  3627.  */
  3628.     if (__pyx_t_1) {
  3629.  
  3630.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":259
  3631.  *                 if ((descr.byteorder == c'>' and little_endian) or
  3632.  *                     (descr.byteorder == c'<' and not little_endian)):
  3633.  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
  3634.  *                 if   t == NPY_BYTE:        f = "b"
  3635.  *                 elif t == NPY_UBYTE:       f = "B"
  3636.  */
  3637.       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3638.       __Pyx_GOTREF(__pyx_t_3);
  3639.       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  3640.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3641.       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3642.  
  3643.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257
  3644.  *             if not hasfields:
  3645.  *                 t = descr.type_num
  3646.  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
  3647.  *                     (descr.byteorder == c'<' and not little_endian)):
  3648.  *                     raise ValueError(u"Non-native byte order not supported")
  3649.  */
  3650.     }
  3651.  
  3652.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":260
  3653.  *                     (descr.byteorder == c'<' and not little_endian)):
  3654.  *                     raise ValueError(u"Non-native byte order not supported")
  3655.  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
  3656.  *                 elif t == NPY_UBYTE:       f = "B"
  3657.  *                 elif t == NPY_SHORT:       f = "h"
  3658.  */
  3659.     switch (__pyx_v_t) {
  3660.       case NPY_BYTE:
  3661.       __pyx_v_f = __pyx_k_b;
  3662.       break;
  3663.  
  3664.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":261
  3665.  *                     raise ValueError(u"Non-native byte order not supported")
  3666.  *                 if   t == NPY_BYTE:        f = "b"
  3667.  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
  3668.  *                 elif t == NPY_SHORT:       f = "h"
  3669.  *                 elif t == NPY_USHORT:      f = "H"
  3670.  */
  3671.       case NPY_UBYTE:
  3672.       __pyx_v_f = __pyx_k_B;
  3673.       break;
  3674.  
  3675.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":262
  3676.  *                 if   t == NPY_BYTE:        f = "b"
  3677.  *                 elif t == NPY_UBYTE:       f = "B"
  3678.  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
  3679.  *                 elif t == NPY_USHORT:      f = "H"
  3680.  *                 elif t == NPY_INT:         f = "i"
  3681.  */
  3682.       case NPY_SHORT:
  3683.       __pyx_v_f = __pyx_k_h;
  3684.       break;
  3685.  
  3686.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":263
  3687.  *                 elif t == NPY_UBYTE:       f = "B"
  3688.  *                 elif t == NPY_SHORT:       f = "h"
  3689.  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
  3690.  *                 elif t == NPY_INT:         f = "i"
  3691.  *                 elif t == NPY_UINT:        f = "I"
  3692.  */
  3693.       case NPY_USHORT:
  3694.       __pyx_v_f = __pyx_k_H;
  3695.       break;
  3696.  
  3697.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":264
  3698.  *                 elif t == NPY_SHORT:       f = "h"
  3699.  *                 elif t == NPY_USHORT:      f = "H"
  3700.  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
  3701.  *                 elif t == NPY_UINT:        f = "I"
  3702.  *                 elif t == NPY_LONG:        f = "l"
  3703.  */
  3704.       case NPY_INT:
  3705.       __pyx_v_f = __pyx_k_i;
  3706.       break;
  3707.  
  3708.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":265
  3709.  *                 elif t == NPY_USHORT:      f = "H"
  3710.  *                 elif t == NPY_INT:         f = "i"
  3711.  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
  3712.  *                 elif t == NPY_LONG:        f = "l"
  3713.  *                 elif t == NPY_ULONG:       f = "L"
  3714.  */
  3715.       case NPY_UINT:
  3716.       __pyx_v_f = __pyx_k_I;
  3717.       break;
  3718.  
  3719.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":266
  3720.  *                 elif t == NPY_INT:         f = "i"
  3721.  *                 elif t == NPY_UINT:        f = "I"
  3722.  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
  3723.  *                 elif t == NPY_ULONG:       f = "L"
  3724.  *                 elif t == NPY_LONGLONG:    f = "q"
  3725.  */
  3726.       case NPY_LONG:
  3727.       __pyx_v_f = __pyx_k_l;
  3728.       break;
  3729.  
  3730.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":267
  3731.  *                 elif t == NPY_UINT:        f = "I"
  3732.  *                 elif t == NPY_LONG:        f = "l"
  3733.  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
  3734.  *                 elif t == NPY_LONGLONG:    f = "q"
  3735.  *                 elif t == NPY_ULONGLONG:   f = "Q"
  3736.  */
  3737.       case NPY_ULONG:
  3738.       __pyx_v_f = __pyx_k_L;
  3739.       break;
  3740.  
  3741.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":268
  3742.  *                 elif t == NPY_LONG:        f = "l"
  3743.  *                 elif t == NPY_ULONG:       f = "L"
  3744.  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
  3745.  *                 elif t == NPY_ULONGLONG:   f = "Q"
  3746.  *                 elif t == NPY_FLOAT:       f = "f"
  3747.  */
  3748.       case NPY_LONGLONG:
  3749.       __pyx_v_f = __pyx_k_q;
  3750.       break;
  3751.  
  3752.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":269
  3753.  *                 elif t == NPY_ULONG:       f = "L"
  3754.  *                 elif t == NPY_LONGLONG:    f = "q"
  3755.  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
  3756.  *                 elif t == NPY_FLOAT:       f = "f"
  3757.  *                 elif t == NPY_DOUBLE:      f = "d"
  3758.  */
  3759.       case NPY_ULONGLONG:
  3760.       __pyx_v_f = __pyx_k_Q;
  3761.       break;
  3762.  
  3763.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":270
  3764.  *                 elif t == NPY_LONGLONG:    f = "q"
  3765.  *                 elif t == NPY_ULONGLONG:   f = "Q"
  3766.  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
  3767.  *                 elif t == NPY_DOUBLE:      f = "d"
  3768.  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  3769.  */
  3770.       case NPY_FLOAT:
  3771.       __pyx_v_f = __pyx_k_f;
  3772.       break;
  3773.  
  3774.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":271
  3775.  *                 elif t == NPY_ULONGLONG:   f = "Q"
  3776.  *                 elif t == NPY_FLOAT:       f = "f"
  3777.  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
  3778.  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  3779.  *                 elif t == NPY_CFLOAT:      f = "Zf"
  3780.  */
  3781.       case NPY_DOUBLE:
  3782.       __pyx_v_f = __pyx_k_d;
  3783.       break;
  3784.  
  3785.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":272
  3786.  *                 elif t == NPY_FLOAT:       f = "f"
  3787.  *                 elif t == NPY_DOUBLE:      f = "d"
  3788.  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
  3789.  *                 elif t == NPY_CFLOAT:      f = "Zf"
  3790.  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  3791.  */
  3792.       case NPY_LONGDOUBLE:
  3793.       __pyx_v_f = __pyx_k_g;
  3794.       break;
  3795.  
  3796.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":273
  3797.  *                 elif t == NPY_DOUBLE:      f = "d"
  3798.  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  3799.  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
  3800.  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  3801.  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  3802.  */
  3803.       case NPY_CFLOAT:
  3804.       __pyx_v_f = __pyx_k_Zf;
  3805.       break;
  3806.  
  3807.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":274
  3808.  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  3809.  *                 elif t == NPY_CFLOAT:      f = "Zf"
  3810.  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
  3811.  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  3812.  *                 elif t == NPY_OBJECT:      f = "O"
  3813.  */
  3814.       case NPY_CDOUBLE:
  3815.       __pyx_v_f = __pyx_k_Zd;
  3816.       break;
  3817.  
  3818.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":275
  3819.  *                 elif t == NPY_CFLOAT:      f = "Zf"
  3820.  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  3821.  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
  3822.  *                 elif t == NPY_OBJECT:      f = "O"
  3823.  *                 else:
  3824.  */
  3825.       case NPY_CLONGDOUBLE:
  3826.       __pyx_v_f = __pyx_k_Zg;
  3827.       break;
  3828.  
  3829.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":276
  3830.  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  3831.  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  3832.  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
  3833.  *                 else:
  3834.  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  3835.  */
  3836.       case NPY_OBJECT:
  3837.       __pyx_v_f = __pyx_k_O;
  3838.       break;
  3839.       default:
  3840.  
  3841.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":278
  3842.  *                 elif t == NPY_OBJECT:      f = "O"
  3843.  *                 else:
  3844.  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
  3845.  *                 info.format = f
  3846.  *                 return
  3847.  */
  3848.       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3849.       __Pyx_GOTREF(__pyx_t_3);
  3850.       __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3851.       __Pyx_GOTREF(__pyx_t_6);
  3852.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3853.       __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3854.       __Pyx_GOTREF(__pyx_t_3);
  3855.       __Pyx_GIVEREF(__pyx_t_6);
  3856.       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
  3857.       __pyx_t_6 = 0;
  3858.       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3859.       __Pyx_GOTREF(__pyx_t_6);
  3860.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3861.       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
  3862.       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3863.       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3864.       break;
  3865.     }
  3866.  
  3867.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":279
  3868.  *                 else:
  3869.  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  3870.  *                 info.format = f             # <<<<<<<<<<<<<<
  3871.  *                 return
  3872.  *             else:
  3873.  */
  3874.     __pyx_v_info->format = __pyx_v_f;
  3875.  
  3876.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":280
  3877.  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  3878.  *                 info.format = f
  3879.  *                 return             # <<<<<<<<<<<<<<
  3880.  *             else:
  3881.  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
  3882.  */
  3883.     __pyx_r = 0;
  3884.     goto __pyx_L0;
  3885.  
  3886.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":255
  3887.  *                 info.obj = self
  3888.  *
  3889.  *             if not hasfields:             # <<<<<<<<<<<<<<
  3890.  *                 t = descr.type_num
  3891.  *                 if ((descr.byteorder == c'>' and little_endian) or
  3892.  */
  3893.   }
  3894.  
  3895.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":282
  3896.  *                 return
  3897.  *             else:
  3898.  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
  3899.  *                 info.format[0] = c'^' # Native data types, manual alignment
  3900.  *                 offset = 0
  3901.  */
  3902.   /*else*/ {
  3903.     __pyx_v_info->format = ((char *)malloc(0xFF));
  3904.  
  3905.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":283
  3906.  *             else:
  3907.  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
  3908.  *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
  3909.  *                 offset = 0
  3910.  *                 f = _util_dtypestring(descr, info.format + 1,
  3911.  */
  3912.     (__pyx_v_info->format[0]) = '^';
  3913.  
  3914.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":284
  3915.  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
  3916.  *                 info.format[0] = c'^' # Native data types, manual alignment
  3917.  *                 offset = 0             # <<<<<<<<<<<<<<
  3918.  *                 f = _util_dtypestring(descr, info.format + 1,
  3919.  *                                       info.format + _buffer_format_string_len,
  3920.  */
  3921.     __pyx_v_offset = 0;
  3922.  
  3923.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":285
  3924.  *                 info.format[0] = c'^' # Native data types, manual alignment
  3925.  *                 offset = 0
  3926.  *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
  3927.  *                                       info.format + _buffer_format_string_len,
  3928.  *                                       &offset)
  3929.  */
  3930.     __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_filename = __pyx_f[1]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3931.     __pyx_v_f = __pyx_t_7;
  3932.  
  3933.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":288
  3934.  *                                       info.format + _buffer_format_string_len,
  3935.  *                                       &offset)
  3936.  *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
  3937.  *
  3938.  *         def __releasebuffer__(ndarray self, Py_buffer* info):
  3939.  */
  3940.     (__pyx_v_f[0]) = '\x00';
  3941.   }
  3942.  
  3943.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":197
  3944.  *         # experimental exception made for __getbuffer__ and __releasebuffer__
  3945.  *         # -- the details of this may change.
  3946.  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
  3947.  *             # This implementation of getbuffer is geared towards Cython
  3948.  *             # requirements, and does not yet fullfill the PEP.
  3949.  */
  3950.  
  3951.   /* function exit code */
  3952.   __pyx_r = 0;
  3953.   goto __pyx_L0;
  3954.   __pyx_L1_error:;
  3955.   __Pyx_XDECREF(__pyx_t_3);
  3956.   __Pyx_XDECREF(__pyx_t_6);
  3957.   __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3958.   __pyx_r = -1;
  3959.   if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
  3960.     __Pyx_GOTREF(__pyx_v_info->obj);
  3961.     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  3962.   }
  3963.   goto __pyx_L2;
  3964.   __pyx_L0:;
  3965.   if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
  3966.     __Pyx_GOTREF(Py_None);
  3967.     __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  3968.   }
  3969.   __pyx_L2:;
  3970.   __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  3971.   __Pyx_RefNannyFinishContext();
  3972.   return __pyx_r;
  3973. }
  3974.  
  3975. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":290
  3976.  *                 f[0] = c'\0' # Terminate format string
  3977.  *
  3978.  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
  3979.  *             if PyArray_HASFIELDS(self):
  3980.  *                 stdlib.free(info.format)
  3981.  */
  3982.  
  3983. /* Python wrapper */
  3984. static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
  3985. static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  3986.   __Pyx_RefNannyDeclarations
  3987.   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  3988.   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
  3989.  
  3990.   /* function exit code */
  3991.   __Pyx_RefNannyFinishContext();
  3992. }
  3993.  
  3994. static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  3995.   __Pyx_RefNannyDeclarations
  3996.   int __pyx_t_1;
  3997.   __Pyx_RefNannySetupContext("__releasebuffer__", 0);
  3998.  
  3999.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291
  4000.  *
  4001.  *         def __releasebuffer__(ndarray self, Py_buffer* info):
  4002.  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
  4003.  *                 stdlib.free(info.format)
  4004.  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  4005.  */
  4006.   __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  4007.   if (__pyx_t_1) {
  4008.  
  4009.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":292
  4010.  *         def __releasebuffer__(ndarray self, Py_buffer* info):
  4011.  *             if PyArray_HASFIELDS(self):
  4012.  *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
  4013.  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  4014.  *                 stdlib.free(info.strides)
  4015.  */
  4016.     free(__pyx_v_info->format);
  4017.  
  4018.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291
  4019.  *
  4020.  *         def __releasebuffer__(ndarray self, Py_buffer* info):
  4021.  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
  4022.  *                 stdlib.free(info.format)
  4023.  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  4024.  */
  4025.   }
  4026.  
  4027.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":293
  4028.  *             if PyArray_HASFIELDS(self):
  4029.  *                 stdlib.free(info.format)
  4030.  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
  4031.  *                 stdlib.free(info.strides)
  4032.  *                 # info.shape was stored after info.strides in the same block
  4033.  */
  4034.   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  4035.   if (__pyx_t_1) {
  4036.  
  4037.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":294
  4038.  *                 stdlib.free(info.format)
  4039.  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  4040.  *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
  4041.  *                 # info.shape was stored after info.strides in the same block
  4042.  *
  4043.  */
  4044.     free(__pyx_v_info->strides);
  4045.  
  4046.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":293
  4047.  *             if PyArray_HASFIELDS(self):
  4048.  *                 stdlib.free(info.format)
  4049.  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
  4050.  *                 stdlib.free(info.strides)
  4051.  *                 # info.shape was stored after info.strides in the same block
  4052.  */
  4053.   }
  4054.  
  4055.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":290
  4056.  *                 f[0] = c'\0' # Terminate format string
  4057.  *
  4058.  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
  4059.  *             if PyArray_HASFIELDS(self):
  4060.  *                 stdlib.free(info.format)
  4061.  */
  4062.  
  4063.   /* function exit code */
  4064.   __Pyx_RefNannyFinishContext();
  4065. }
  4066.  
  4067. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":770
  4068.  * ctypedef npy_cdouble     complex_t
  4069.  *
  4070.  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
  4071.  *     return PyArray_MultiIterNew(1, <void*>a)
  4072.  *
  4073.  */
  4074.  
  4075. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  4076.   PyObject *__pyx_r = NULL;
  4077.   __Pyx_RefNannyDeclarations
  4078.   PyObject *__pyx_t_1 = NULL;
  4079.   int __pyx_lineno = 0;
  4080.   const char *__pyx_filename = NULL;
  4081.   int __pyx_clineno = 0;
  4082.   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
  4083.  
  4084.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":771
  4085.  *
  4086.  * cdef inline object PyArray_MultiIterNew1(a):
  4087.  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
  4088.  *
  4089.  * cdef inline object PyArray_MultiIterNew2(a, b):
  4090.  */
  4091.   __Pyx_XDECREF(__pyx_r);
  4092.   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4093.   __Pyx_GOTREF(__pyx_t_1);
  4094.   __pyx_r = __pyx_t_1;
  4095.   __pyx_t_1 = 0;
  4096.   goto __pyx_L0;
  4097.  
  4098.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":770
  4099.  * ctypedef npy_cdouble     complex_t
  4100.  *
  4101.  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
  4102.  *     return PyArray_MultiIterNew(1, <void*>a)
  4103.  *
  4104.  */
  4105.  
  4106.   /* function exit code */
  4107.   __pyx_L1_error:;
  4108.   __Pyx_XDECREF(__pyx_t_1);
  4109.   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4110.   __pyx_r = 0;
  4111.   __pyx_L0:;
  4112.   __Pyx_XGIVEREF(__pyx_r);
  4113.   __Pyx_RefNannyFinishContext();
  4114.   return __pyx_r;
  4115. }
  4116.  
  4117. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":773
  4118.  *     return PyArray_MultiIterNew(1, <void*>a)
  4119.  *
  4120.  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
  4121.  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  4122.  *
  4123.  */
  4124.  
  4125. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  4126.   PyObject *__pyx_r = NULL;
  4127.   __Pyx_RefNannyDeclarations
  4128.   PyObject *__pyx_t_1 = NULL;
  4129.   int __pyx_lineno = 0;
  4130.   const char *__pyx_filename = NULL;
  4131.   int __pyx_clineno = 0;
  4132.   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
  4133.  
  4134.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":774
  4135.  *
  4136.  * cdef inline object PyArray_MultiIterNew2(a, b):
  4137.  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
  4138.  *
  4139.  * cdef inline object PyArray_MultiIterNew3(a, b, c):
  4140.  */
  4141.   __Pyx_XDECREF(__pyx_r);
  4142.   __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4143.   __Pyx_GOTREF(__pyx_t_1);
  4144.   __pyx_r = __pyx_t_1;
  4145.   __pyx_t_1 = 0;
  4146.   goto __pyx_L0;
  4147.  
  4148.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":773
  4149.  *     return PyArray_MultiIterNew(1, <void*>a)
  4150.  *
  4151.  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
  4152.  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  4153.  *
  4154.  */
  4155.  
  4156.   /* function exit code */
  4157.   __pyx_L1_error:;
  4158.   __Pyx_XDECREF(__pyx_t_1);
  4159.   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4160.   __pyx_r = 0;
  4161.   __pyx_L0:;
  4162.   __Pyx_XGIVEREF(__pyx_r);
  4163.   __Pyx_RefNannyFinishContext();
  4164.   return __pyx_r;
  4165. }
  4166.  
  4167. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":776
  4168.  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  4169.  *
  4170.  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
  4171.  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  4172.  *
  4173.  */
  4174.  
  4175. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  4176.   PyObject *__pyx_r = NULL;
  4177.   __Pyx_RefNannyDeclarations
  4178.   PyObject *__pyx_t_1 = NULL;
  4179.   int __pyx_lineno = 0;
  4180.   const char *__pyx_filename = NULL;
  4181.   int __pyx_clineno = 0;
  4182.   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
  4183.  
  4184.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":777
  4185.  *
  4186.  * cdef inline object PyArray_MultiIterNew3(a, b, c):
  4187.  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
  4188.  *
  4189.  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  4190.  */
  4191.   __Pyx_XDECREF(__pyx_r);
  4192.   __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4193.   __Pyx_GOTREF(__pyx_t_1);
  4194.   __pyx_r = __pyx_t_1;
  4195.   __pyx_t_1 = 0;
  4196.   goto __pyx_L0;
  4197.  
  4198.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":776
  4199.  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  4200.  *
  4201.  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
  4202.  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  4203.  *
  4204.  */
  4205.  
  4206.   /* function exit code */
  4207.   __pyx_L1_error:;
  4208.   __Pyx_XDECREF(__pyx_t_1);
  4209.   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4210.   __pyx_r = 0;
  4211.   __pyx_L0:;
  4212.   __Pyx_XGIVEREF(__pyx_r);
  4213.   __Pyx_RefNannyFinishContext();
  4214.   return __pyx_r;
  4215. }
  4216.  
  4217. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":779
  4218.  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  4219.  *
  4220.  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
  4221.  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  4222.  *
  4223.  */
  4224.  
  4225. 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) {
  4226.   PyObject *__pyx_r = NULL;
  4227.   __Pyx_RefNannyDeclarations
  4228.   PyObject *__pyx_t_1 = NULL;
  4229.   int __pyx_lineno = 0;
  4230.   const char *__pyx_filename = NULL;
  4231.   int __pyx_clineno = 0;
  4232.   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
  4233.  
  4234.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":780
  4235.  *
  4236.  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  4237.  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
  4238.  *
  4239.  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  4240.  */
  4241.   __Pyx_XDECREF(__pyx_r);
  4242.   __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_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4243.   __Pyx_GOTREF(__pyx_t_1);
  4244.   __pyx_r = __pyx_t_1;
  4245.   __pyx_t_1 = 0;
  4246.   goto __pyx_L0;
  4247.  
  4248.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":779
  4249.  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  4250.  *
  4251.  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
  4252.  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  4253.  *
  4254.  */
  4255.  
  4256.   /* function exit code */
  4257.   __pyx_L1_error:;
  4258.   __Pyx_XDECREF(__pyx_t_1);
  4259.   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4260.   __pyx_r = 0;
  4261.   __pyx_L0:;
  4262.   __Pyx_XGIVEREF(__pyx_r);
  4263.   __Pyx_RefNannyFinishContext();
  4264.   return __pyx_r;
  4265. }
  4266.  
  4267. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":782
  4268.  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  4269.  *
  4270.  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
  4271.  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  4272.  *
  4273.  */
  4274.  
  4275. 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) {
  4276.   PyObject *__pyx_r = NULL;
  4277.   __Pyx_RefNannyDeclarations
  4278.   PyObject *__pyx_t_1 = NULL;
  4279.   int __pyx_lineno = 0;
  4280.   const char *__pyx_filename = NULL;
  4281.   int __pyx_clineno = 0;
  4282.   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
  4283.  
  4284.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":783
  4285.  *
  4286.  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  4287.  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
  4288.  *
  4289.  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
  4290.  */
  4291.   __Pyx_XDECREF(__pyx_r);
  4292.   __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_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4293.   __Pyx_GOTREF(__pyx_t_1);
  4294.   __pyx_r = __pyx_t_1;
  4295.   __pyx_t_1 = 0;
  4296.   goto __pyx_L0;
  4297.  
  4298.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":782
  4299.  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  4300.  *
  4301.  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
  4302.  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  4303.  *
  4304.  */
  4305.  
  4306.   /* function exit code */
  4307.   __pyx_L1_error:;
  4308.   __Pyx_XDECREF(__pyx_t_1);
  4309.   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4310.   __pyx_r = 0;
  4311.   __pyx_L0:;
  4312.   __Pyx_XGIVEREF(__pyx_r);
  4313.   __Pyx_RefNannyFinishContext();
  4314.   return __pyx_r;
  4315. }
  4316.  
  4317. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":785
  4318.  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  4319.  *
  4320.  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
  4321.  *     # Recursive utility function used in __getbuffer__ to get format
  4322.  *     # string. The new location in the format string is returned.
  4323.  */
  4324.  
  4325. 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) {
  4326.   PyArray_Descr *__pyx_v_child = 0;
  4327.   int __pyx_v_endian_detector;
  4328.   int __pyx_v_little_endian;
  4329.   PyObject *__pyx_v_fields = 0;
  4330.   PyObject *__pyx_v_childname = NULL;
  4331.   PyObject *__pyx_v_new_offset = NULL;
  4332.   PyObject *__pyx_v_t = NULL;
  4333.   char *__pyx_r;
  4334.   __Pyx_RefNannyDeclarations
  4335.   PyObject *__pyx_t_1 = NULL;
  4336.   Py_ssize_t __pyx_t_2;
  4337.   PyObject *__pyx_t_3 = NULL;
  4338.   PyObject *__pyx_t_4 = NULL;
  4339.   int __pyx_t_5;
  4340.   int __pyx_t_6;
  4341.   int __pyx_t_7;
  4342.   long __pyx_t_8;
  4343.   char *__pyx_t_9;
  4344.   int __pyx_lineno = 0;
  4345.   const char *__pyx_filename = NULL;
  4346.   int __pyx_clineno = 0;
  4347.   __Pyx_RefNannySetupContext("_util_dtypestring", 0);
  4348.  
  4349.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":790
  4350.  *
  4351.  *     cdef dtype child
  4352.  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
  4353.  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  4354.  *     cdef tuple fields
  4355.  */
  4356.   __pyx_v_endian_detector = 1;
  4357.  
  4358.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":791
  4359.  *     cdef dtype child
  4360.  *     cdef int endian_detector = 1
  4361.  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
  4362.  *     cdef tuple fields
  4363.  *
  4364.  */
  4365.   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
  4366.  
  4367.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":794
  4368.  *     cdef tuple fields
  4369.  *
  4370.  *     for childname in descr.names:             # <<<<<<<<<<<<<<
  4371.  *         fields = descr.fields[childname]
  4372.  *         child, new_offset = fields
  4373.  */
  4374.   if (unlikely(__pyx_v_descr->names == Py_None)) {
  4375.     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  4376.     {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4377.   }
  4378.   __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  4379.   for (;;) {
  4380.     if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  4381.     #if CYTHON_COMPILING_IN_CPYTHON
  4382.     __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_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4383.     #else
  4384.     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4385.     __Pyx_GOTREF(__pyx_t_3);
  4386.     #endif
  4387.     __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
  4388.     __pyx_t_3 = 0;
  4389.  
  4390.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":795
  4391.  *
  4392.  *     for childname in descr.names:
  4393.  *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
  4394.  *         child, new_offset = fields
  4395.  *
  4396.  */
  4397.     if (unlikely(__pyx_v_descr->fields == Py_None)) {
  4398.       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  4399.       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4400.     }
  4401.     __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  4402.     __Pyx_GOTREF(__pyx_t_3);
  4403.     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_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4404.     __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
  4405.     __pyx_t_3 = 0;
  4406.  
  4407.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":796
  4408.  *     for childname in descr.names:
  4409.  *         fields = descr.fields[childname]
  4410.  *         child, new_offset = fields             # <<<<<<<<<<<<<<
  4411.  *
  4412.  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
  4413.  */
  4414.     if (likely(__pyx_v_fields != Py_None)) {
  4415.       PyObject* sequence = __pyx_v_fields;
  4416.       #if CYTHON_COMPILING_IN_CPYTHON
  4417.       Py_ssize_t size = Py_SIZE(sequence);
  4418.       #else
  4419.       Py_ssize_t size = PySequence_Size(sequence);
  4420.       #endif
  4421.       if (unlikely(size != 2)) {
  4422.         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  4423.         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  4424.         {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4425.       }
  4426.       #if CYTHON_COMPILING_IN_CPYTHON
  4427.       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  4428.       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
  4429.       __Pyx_INCREF(__pyx_t_3);
  4430.       __Pyx_INCREF(__pyx_t_4);
  4431.       #else
  4432.       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4433.       __Pyx_GOTREF(__pyx_t_3);
  4434.       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4435.       __Pyx_GOTREF(__pyx_t_4);
  4436.       #endif
  4437.     } else {
  4438.       __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4439.     }
  4440.     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4441.     __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
  4442.     __pyx_t_3 = 0;
  4443.     __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
  4444.     __pyx_t_4 = 0;
  4445.  
  4446.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":798
  4447.  *         child, new_offset = fields
  4448.  *
  4449.  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
  4450.  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  4451.  *
  4452.  */
  4453.     __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4454.     __Pyx_GOTREF(__pyx_t_4);
  4455.     __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4456.     __Pyx_GOTREF(__pyx_t_3);
  4457.     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4458.     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4459.     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4460.     __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
  4461.     if (__pyx_t_6) {
  4462.  
  4463.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799
  4464.  *
  4465.  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
  4466.  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
  4467.  *
  4468.  *         if ((child.byteorder == c'>' and little_endian) or
  4469.  */
  4470.       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4471.       __Pyx_GOTREF(__pyx_t_3);
  4472.       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  4473.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4474.       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4475.  
  4476.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":798
  4477.  *         child, new_offset = fields
  4478.  *
  4479.  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
  4480.  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  4481.  *
  4482.  */
  4483.     }
  4484.  
  4485.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801
  4486.  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  4487.  *
  4488.  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
  4489.  *             (child.byteorder == c'<' and not little_endian)):
  4490.  *             raise ValueError(u"Non-native byte order not supported")
  4491.  */
  4492.     __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
  4493.     if (!__pyx_t_7) {
  4494.       goto __pyx_L8_next_or;
  4495.     } else {
  4496.     }
  4497.     __pyx_t_7 = (__pyx_v_little_endian != 0);
  4498.     if (!__pyx_t_7) {
  4499.     } else {
  4500.       __pyx_t_6 = __pyx_t_7;
  4501.       goto __pyx_L7_bool_binop_done;
  4502.     }
  4503.     __pyx_L8_next_or:;
  4504.  
  4505.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":802
  4506.  *
  4507.  *         if ((child.byteorder == c'>' and little_endian) or
  4508.  *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
  4509.  *             raise ValueError(u"Non-native byte order not supported")
  4510.  *             # One could encode it in the format string and have Cython
  4511.  */
  4512.     __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
  4513.     if (__pyx_t_7) {
  4514.     } else {
  4515.       __pyx_t_6 = __pyx_t_7;
  4516.       goto __pyx_L7_bool_binop_done;
  4517.     }
  4518.     __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
  4519.     __pyx_t_6 = __pyx_t_7;
  4520.     __pyx_L7_bool_binop_done:;
  4521.  
  4522.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801
  4523.  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  4524.  *
  4525.  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
  4526.  *             (child.byteorder == c'<' and not little_endian)):
  4527.  *             raise ValueError(u"Non-native byte order not supported")
  4528.  */
  4529.     if (__pyx_t_6) {
  4530.  
  4531.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803
  4532.  *         if ((child.byteorder == c'>' and little_endian) or
  4533.  *             (child.byteorder == c'<' and not little_endian)):
  4534.  *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
  4535.  *             # One could encode it in the format string and have Cython
  4536.  *             # complain instead, BUT: < and > in format strings also imply
  4537.  */
  4538.       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4539.       __Pyx_GOTREF(__pyx_t_3);
  4540.       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  4541.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4542.       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4543.  
  4544.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801
  4545.  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  4546.  *
  4547.  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
  4548.  *             (child.byteorder == c'<' and not little_endian)):
  4549.  *             raise ValueError(u"Non-native byte order not supported")
  4550.  */
  4551.     }
  4552.  
  4553.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":813
  4554.  *
  4555.  *         # Output padding bytes
  4556.  *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
  4557.  *             f[0] = 120 # "x"; pad byte
  4558.  *             f += 1
  4559.  */
  4560.     while (1) {
  4561.       __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4562.       __Pyx_GOTREF(__pyx_t_3);
  4563.       __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_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4564.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4565.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4566.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4567.       if (!__pyx_t_6) break;
  4568.  
  4569.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":814
  4570.  *         # Output padding bytes
  4571.  *         while offset[0] < new_offset:
  4572.  *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
  4573.  *             f += 1
  4574.  *             offset[0] += 1
  4575.  */
  4576.       (__pyx_v_f[0]) = 0x78;
  4577.  
  4578.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":815
  4579.  *         while offset[0] < new_offset:
  4580.  *             f[0] = 120 # "x"; pad byte
  4581.  *             f += 1             # <<<<<<<<<<<<<<
  4582.  *             offset[0] += 1
  4583.  *
  4584.  */
  4585.       __pyx_v_f = (__pyx_v_f + 1);
  4586.  
  4587.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":816
  4588.  *             f[0] = 120 # "x"; pad byte
  4589.  *             f += 1
  4590.  *             offset[0] += 1             # <<<<<<<<<<<<<<
  4591.  *
  4592.  *         offset[0] += child.itemsize
  4593.  */
  4594.       __pyx_t_8 = 0;
  4595.       (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
  4596.     }
  4597.  
  4598.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":818
  4599.  *             offset[0] += 1
  4600.  *
  4601.  *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
  4602.  *
  4603.  *         if not PyDataType_HASFIELDS(child):
  4604.  */
  4605.     __pyx_t_8 = 0;
  4606.     (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
  4607.  
  4608.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":820
  4609.  *         offset[0] += child.itemsize
  4610.  *
  4611.  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
  4612.  *             t = child.type_num
  4613.  *             if end - f < 5:
  4614.  */
  4615.     __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
  4616.     if (__pyx_t_6) {
  4617.  
  4618.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":821
  4619.  *
  4620.  *         if not PyDataType_HASFIELDS(child):
  4621.  *             t = child.type_num             # <<<<<<<<<<<<<<
  4622.  *             if end - f < 5:
  4623.  *                 raise RuntimeError(u"Format string allocated too short.")
  4624.  */
  4625.       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4626.       __Pyx_GOTREF(__pyx_t_4);
  4627.       __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
  4628.       __pyx_t_4 = 0;
  4629.  
  4630.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":822
  4631.  *         if not PyDataType_HASFIELDS(child):
  4632.  *             t = child.type_num
  4633.  *             if end - f < 5:             # <<<<<<<<<<<<<<
  4634.  *                 raise RuntimeError(u"Format string allocated too short.")
  4635.  *
  4636.  */
  4637.       __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
  4638.       if (__pyx_t_6) {
  4639.  
  4640.         /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823
  4641.  *             t = child.type_num
  4642.  *             if end - f < 5:
  4643.  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
  4644.  *
  4645.  *             # Until ticket #99 is fixed, use integers to avoid warnings
  4646.  */
  4647.         __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4648.         __Pyx_GOTREF(__pyx_t_4);
  4649.         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  4650.         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4651.         {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4652.  
  4653.         /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":822
  4654.  *         if not PyDataType_HASFIELDS(child):
  4655.  *             t = child.type_num
  4656.  *             if end - f < 5:             # <<<<<<<<<<<<<<
  4657.  *                 raise RuntimeError(u"Format string allocated too short.")
  4658.  *
  4659.  */
  4660.       }
  4661.  
  4662.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":826
  4663.  *
  4664.  *             # Until ticket #99 is fixed, use integers to avoid warnings
  4665.  *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
  4666.  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
  4667.  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
  4668.  */
  4669.       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4670.       __Pyx_GOTREF(__pyx_t_4);
  4671.       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4672.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4673.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4674.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4675.       if (__pyx_t_6) {
  4676.         (__pyx_v_f[0]) = 98;
  4677.         goto __pyx_L15;
  4678.       }
  4679.  
  4680.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":827
  4681.  *             # Until ticket #99 is fixed, use integers to avoid warnings
  4682.  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
  4683.  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
  4684.  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
  4685.  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
  4686.  */
  4687.       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4688.       __Pyx_GOTREF(__pyx_t_3);
  4689.       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4690.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4691.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4692.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4693.       if (__pyx_t_6) {
  4694.         (__pyx_v_f[0]) = 66;
  4695.         goto __pyx_L15;
  4696.       }
  4697.  
  4698.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":828
  4699.  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
  4700.  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
  4701.  *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
  4702.  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
  4703.  *             elif t == NPY_INT:         f[0] = 105 #"i"
  4704.  */
  4705.       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4706.       __Pyx_GOTREF(__pyx_t_4);
  4707.       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4708.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4709.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4710.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4711.       if (__pyx_t_6) {
  4712.         (__pyx_v_f[0]) = 0x68;
  4713.         goto __pyx_L15;
  4714.       }
  4715.  
  4716.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":829
  4717.  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
  4718.  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
  4719.  *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
  4720.  *             elif t == NPY_INT:         f[0] = 105 #"i"
  4721.  *             elif t == NPY_UINT:        f[0] =  73 #"I"
  4722.  */
  4723.       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4724.       __Pyx_GOTREF(__pyx_t_3);
  4725.       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4726.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4727.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4728.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4729.       if (__pyx_t_6) {
  4730.         (__pyx_v_f[0]) = 72;
  4731.         goto __pyx_L15;
  4732.       }
  4733.  
  4734.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":830
  4735.  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
  4736.  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
  4737.  *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
  4738.  *             elif t == NPY_UINT:        f[0] =  73 #"I"
  4739.  *             elif t == NPY_LONG:        f[0] = 108 #"l"
  4740.  */
  4741.       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4742.       __Pyx_GOTREF(__pyx_t_4);
  4743.       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4744.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4745.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4746.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4747.       if (__pyx_t_6) {
  4748.         (__pyx_v_f[0]) = 0x69;
  4749.         goto __pyx_L15;
  4750.       }
  4751.  
  4752.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":831
  4753.  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
  4754.  *             elif t == NPY_INT:         f[0] = 105 #"i"
  4755.  *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
  4756.  *             elif t == NPY_LONG:        f[0] = 108 #"l"
  4757.  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
  4758.  */
  4759.       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4760.       __Pyx_GOTREF(__pyx_t_3);
  4761.       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4762.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4763.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4764.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4765.       if (__pyx_t_6) {
  4766.         (__pyx_v_f[0]) = 73;
  4767.         goto __pyx_L15;
  4768.       }
  4769.  
  4770.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":832
  4771.  *             elif t == NPY_INT:         f[0] = 105 #"i"
  4772.  *             elif t == NPY_UINT:        f[0] =  73 #"I"
  4773.  *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
  4774.  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
  4775.  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
  4776.  */
  4777.       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4778.       __Pyx_GOTREF(__pyx_t_4);
  4779.       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4780.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4781.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4782.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4783.       if (__pyx_t_6) {
  4784.         (__pyx_v_f[0]) = 0x6C;
  4785.         goto __pyx_L15;
  4786.       }
  4787.  
  4788.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":833
  4789.  *             elif t == NPY_UINT:        f[0] =  73 #"I"
  4790.  *             elif t == NPY_LONG:        f[0] = 108 #"l"
  4791.  *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
  4792.  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
  4793.  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
  4794.  */
  4795.       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4796.       __Pyx_GOTREF(__pyx_t_3);
  4797.       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4798.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4799.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4800.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4801.       if (__pyx_t_6) {
  4802.         (__pyx_v_f[0]) = 76;
  4803.         goto __pyx_L15;
  4804.       }
  4805.  
  4806.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":834
  4807.  *             elif t == NPY_LONG:        f[0] = 108 #"l"
  4808.  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
  4809.  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
  4810.  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
  4811.  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
  4812.  */
  4813.       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4814.       __Pyx_GOTREF(__pyx_t_4);
  4815.       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4816.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4817.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4818.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4819.       if (__pyx_t_6) {
  4820.         (__pyx_v_f[0]) = 0x71;
  4821.         goto __pyx_L15;
  4822.       }
  4823.  
  4824.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":835
  4825.  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
  4826.  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
  4827.  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
  4828.  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
  4829.  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
  4830.  */
  4831.       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4832.       __Pyx_GOTREF(__pyx_t_3);
  4833.       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4834.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4835.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4836.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4837.       if (__pyx_t_6) {
  4838.         (__pyx_v_f[0]) = 81;
  4839.         goto __pyx_L15;
  4840.       }
  4841.  
  4842.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":836
  4843.  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
  4844.  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
  4845.  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
  4846.  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
  4847.  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
  4848.  */
  4849.       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4850.       __Pyx_GOTREF(__pyx_t_4);
  4851.       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4852.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4853.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4854.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4855.       if (__pyx_t_6) {
  4856.         (__pyx_v_f[0]) = 0x66;
  4857.         goto __pyx_L15;
  4858.       }
  4859.  
  4860.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":837
  4861.  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
  4862.  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
  4863.  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
  4864.  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
  4865.  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
  4866.  */
  4867.       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4868.       __Pyx_GOTREF(__pyx_t_3);
  4869.       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4870.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4871.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4872.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4873.       if (__pyx_t_6) {
  4874.         (__pyx_v_f[0]) = 0x64;
  4875.         goto __pyx_L15;
  4876.       }
  4877.  
  4878.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":838
  4879.  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
  4880.  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
  4881.  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
  4882.  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
  4883.  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
  4884.  */
  4885.       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4886.       __Pyx_GOTREF(__pyx_t_4);
  4887.       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4888.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4889.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4890.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4891.       if (__pyx_t_6) {
  4892.         (__pyx_v_f[0]) = 0x67;
  4893.         goto __pyx_L15;
  4894.       }
  4895.  
  4896.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":839
  4897.  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
  4898.  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
  4899.  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
  4900.  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
  4901.  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  4902.  */
  4903.       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4904.       __Pyx_GOTREF(__pyx_t_3);
  4905.       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4906.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4907.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4908.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4909.       if (__pyx_t_6) {
  4910.         (__pyx_v_f[0]) = 90;
  4911.         (__pyx_v_f[1]) = 0x66;
  4912.         __pyx_v_f = (__pyx_v_f + 1);
  4913.         goto __pyx_L15;
  4914.       }
  4915.  
  4916.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":840
  4917.  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
  4918.  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
  4919.  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
  4920.  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  4921.  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
  4922.  */
  4923.       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4924.       __Pyx_GOTREF(__pyx_t_4);
  4925.       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4926.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4927.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4928.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4929.       if (__pyx_t_6) {
  4930.         (__pyx_v_f[0]) = 90;
  4931.         (__pyx_v_f[1]) = 0x64;
  4932.         __pyx_v_f = (__pyx_v_f + 1);
  4933.         goto __pyx_L15;
  4934.       }
  4935.  
  4936.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":841
  4937.  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
  4938.  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
  4939.  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
  4940.  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
  4941.  *             else:
  4942.  */
  4943.       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4944.       __Pyx_GOTREF(__pyx_t_3);
  4945.       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4946.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4947.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4948.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4949.       if (__pyx_t_6) {
  4950.         (__pyx_v_f[0]) = 90;
  4951.         (__pyx_v_f[1]) = 0x67;
  4952.         __pyx_v_f = (__pyx_v_f + 1);
  4953.         goto __pyx_L15;
  4954.       }
  4955.  
  4956.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":842
  4957.  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
  4958.  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  4959.  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
  4960.  *             else:
  4961.  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  4962.  */
  4963.       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4964.       __Pyx_GOTREF(__pyx_t_4);
  4965.       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4966.       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4967.       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4968.       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4969.       if (__pyx_t_6) {
  4970.         (__pyx_v_f[0]) = 79;
  4971.         goto __pyx_L15;
  4972.       }
  4973.  
  4974.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":844
  4975.  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
  4976.  *             else:
  4977.  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
  4978.  *             f += 1
  4979.  *         else:
  4980.  */
  4981.       /*else*/ {
  4982.         __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4983.         __Pyx_GOTREF(__pyx_t_3);
  4984.         __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4985.         __Pyx_GOTREF(__pyx_t_4);
  4986.         __Pyx_GIVEREF(__pyx_t_3);
  4987.         PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  4988.         __pyx_t_3 = 0;
  4989.         __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4990.         __Pyx_GOTREF(__pyx_t_3);
  4991.         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4992.         __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  4993.         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4994.         {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4995.       }
  4996.       __pyx_L15:;
  4997.  
  4998.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":845
  4999.  *             else:
  5000.  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  5001.  *             f += 1             # <<<<<<<<<<<<<<
  5002.  *         else:
  5003.  *             # Cython ignores struct boundary information ("T{...}"),
  5004.  */
  5005.       __pyx_v_f = (__pyx_v_f + 1);
  5006.  
  5007.       /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":820
  5008.  *         offset[0] += child.itemsize
  5009.  *
  5010.  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
  5011.  *             t = child.type_num
  5012.  *             if end - f < 5:
  5013.  */
  5014.       goto __pyx_L13;
  5015.     }
  5016.  
  5017.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":849
  5018.  *             # Cython ignores struct boundary information ("T{...}"),
  5019.  *             # so don't output it
  5020.  *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
  5021.  *     return f
  5022.  *
  5023.  */
  5024.     /*else*/ {
  5025.       __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_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5026.       __pyx_v_f = __pyx_t_9;
  5027.     }
  5028.     __pyx_L13:;
  5029.  
  5030.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":794
  5031.  *     cdef tuple fields
  5032.  *
  5033.  *     for childname in descr.names:             # <<<<<<<<<<<<<<
  5034.  *         fields = descr.fields[childname]
  5035.  *         child, new_offset = fields
  5036.  */
  5037.   }
  5038.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5039.  
  5040.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":850
  5041.  *             # so don't output it
  5042.  *             f = _util_dtypestring(child, f, end, offset)
  5043.  *     return f             # <<<<<<<<<<<<<<
  5044.  *
  5045.  *
  5046.  */
  5047.   __pyx_r = __pyx_v_f;
  5048.   goto __pyx_L0;
  5049.  
  5050.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":785
  5051.  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  5052.  *
  5053.  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
  5054.  *     # Recursive utility function used in __getbuffer__ to get format
  5055.  *     # string. The new location in the format string is returned.
  5056.  */
  5057.  
  5058.   /* function exit code */
  5059.   __pyx_L1_error:;
  5060.   __Pyx_XDECREF(__pyx_t_1);
  5061.   __Pyx_XDECREF(__pyx_t_3);
  5062.   __Pyx_XDECREF(__pyx_t_4);
  5063.   __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5064.   __pyx_r = NULL;
  5065.   __pyx_L0:;
  5066.   __Pyx_XDECREF((PyObject *)__pyx_v_child);
  5067.   __Pyx_XDECREF(__pyx_v_fields);
  5068.   __Pyx_XDECREF(__pyx_v_childname);
  5069.   __Pyx_XDECREF(__pyx_v_new_offset);
  5070.   __Pyx_XDECREF(__pyx_v_t);
  5071.   __Pyx_RefNannyFinishContext();
  5072.   return __pyx_r;
  5073. }
  5074.  
  5075. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966
  5076.  *
  5077.  *
  5078.  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
  5079.  *      cdef PyObject* baseptr
  5080.  *      if base is None:
  5081.  */
  5082.  
  5083. static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  5084.   PyObject *__pyx_v_baseptr;
  5085.   __Pyx_RefNannyDeclarations
  5086.   int __pyx_t_1;
  5087.   int __pyx_t_2;
  5088.   __Pyx_RefNannySetupContext("set_array_base", 0);
  5089.  
  5090.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":968
  5091.  * cdef inline void set_array_base(ndarray arr, object base):
  5092.  *      cdef PyObject* baseptr
  5093.  *      if base is None:             # <<<<<<<<<<<<<<
  5094.  *          baseptr = NULL
  5095.  *      else:
  5096.  */
  5097.   __pyx_t_1 = (__pyx_v_base == Py_None);
  5098.   __pyx_t_2 = (__pyx_t_1 != 0);
  5099.   if (__pyx_t_2) {
  5100.  
  5101.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":969
  5102.  *      cdef PyObject* baseptr
  5103.  *      if base is None:
  5104.  *          baseptr = NULL             # <<<<<<<<<<<<<<
  5105.  *      else:
  5106.  *          Py_INCREF(base) # important to do this before decref below!
  5107.  */
  5108.     __pyx_v_baseptr = NULL;
  5109.  
  5110.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":968
  5111.  * cdef inline void set_array_base(ndarray arr, object base):
  5112.  *      cdef PyObject* baseptr
  5113.  *      if base is None:             # <<<<<<<<<<<<<<
  5114.  *          baseptr = NULL
  5115.  *      else:
  5116.  */
  5117.     goto __pyx_L3;
  5118.   }
  5119.  
  5120.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":971
  5121.  *          baseptr = NULL
  5122.  *      else:
  5123.  *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
  5124.  *          baseptr = <PyObject*>base
  5125.  *      Py_XDECREF(arr.base)
  5126.  */
  5127.   /*else*/ {
  5128.     Py_INCREF(__pyx_v_base);
  5129.  
  5130.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":972
  5131.  *      else:
  5132.  *          Py_INCREF(base) # important to do this before decref below!
  5133.  *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
  5134.  *      Py_XDECREF(arr.base)
  5135.  *      arr.base = baseptr
  5136.  */
  5137.     __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  5138.   }
  5139.   __pyx_L3:;
  5140.  
  5141.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":973
  5142.  *          Py_INCREF(base) # important to do this before decref below!
  5143.  *          baseptr = <PyObject*>base
  5144.  *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
  5145.  *      arr.base = baseptr
  5146.  *
  5147.  */
  5148.   Py_XDECREF(__pyx_v_arr->base);
  5149.  
  5150.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":974
  5151.  *          baseptr = <PyObject*>base
  5152.  *      Py_XDECREF(arr.base)
  5153.  *      arr.base = baseptr             # <<<<<<<<<<<<<<
  5154.  *
  5155.  * cdef inline object get_array_base(ndarray arr):
  5156.  */
  5157.   __pyx_v_arr->base = __pyx_v_baseptr;
  5158.  
  5159.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966
  5160.  *
  5161.  *
  5162.  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
  5163.  *      cdef PyObject* baseptr
  5164.  *      if base is None:
  5165.  */
  5166.  
  5167.   /* function exit code */
  5168.   __Pyx_RefNannyFinishContext();
  5169. }
  5170.  
  5171. /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976
  5172.  *      arr.base = baseptr
  5173.  *
  5174.  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
  5175.  *     if arr.base is NULL:
  5176.  *         return None
  5177.  */
  5178.  
  5179. static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  5180.   PyObject *__pyx_r = NULL;
  5181.   __Pyx_RefNannyDeclarations
  5182.   int __pyx_t_1;
  5183.   __Pyx_RefNannySetupContext("get_array_base", 0);
  5184.  
  5185.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":977
  5186.  *
  5187.  * cdef inline object get_array_base(ndarray arr):
  5188.  *     if arr.base is NULL:             # <<<<<<<<<<<<<<
  5189.  *         return None
  5190.  *     else:
  5191.  */
  5192.   __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
  5193.   if (__pyx_t_1) {
  5194.  
  5195.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":978
  5196.  * cdef inline object get_array_base(ndarray arr):
  5197.  *     if arr.base is NULL:
  5198.  *         return None             # <<<<<<<<<<<<<<
  5199.  *     else:
  5200.  *         return <object>arr.base
  5201.  */
  5202.     __Pyx_XDECREF(__pyx_r);
  5203.     __Pyx_INCREF(Py_None);
  5204.     __pyx_r = Py_None;
  5205.     goto __pyx_L0;
  5206.  
  5207.     /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":977
  5208.  *
  5209.  * cdef inline object get_array_base(ndarray arr):
  5210.  *     if arr.base is NULL:             # <<<<<<<<<<<<<<
  5211.  *         return None
  5212.  *     else:
  5213.  */
  5214.   }
  5215.  
  5216.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":980
  5217.  *         return None
  5218.  *     else:
  5219.  *         return <object>arr.base             # <<<<<<<<<<<<<<
  5220.  */
  5221.   /*else*/ {
  5222.     __Pyx_XDECREF(__pyx_r);
  5223.     __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
  5224.     __pyx_r = ((PyObject *)__pyx_v_arr->base);
  5225.     goto __pyx_L0;
  5226.   }
  5227.  
  5228.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976
  5229.  *      arr.base = baseptr
  5230.  *
  5231.  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
  5232.  *     if arr.base is NULL:
  5233.  *         return None
  5234.  */
  5235.  
  5236.   /* function exit code */
  5237.   __pyx_L0:;
  5238.   __Pyx_XGIVEREF(__pyx_r);
  5239.   __Pyx_RefNannyFinishContext();
  5240.   return __pyx_r;
  5241. }
  5242.  
  5243. static PyMethodDef __pyx_methods[] = {
  5244.   {"_zig_zag", (PyCFunction)__pyx_pw_8lemantic_6zigzag_1_zig_zag, METH_O, 0},
  5245.   {0, 0, 0, 0}
  5246. };
  5247.  
  5248. #if PY_MAJOR_VERSION >= 3
  5249. static struct PyModuleDef __pyx_moduledef = {
  5250.   #if PY_VERSION_HEX < 0x03020000
  5251.     { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  5252.   #else
  5253.     PyModuleDef_HEAD_INIT,
  5254.   #endif
  5255.     "zigzag",
  5256.     0, /* m_doc */
  5257.     -1, /* m_size */
  5258.     __pyx_methods /* m_methods */,
  5259.     NULL, /* m_reload */
  5260.     NULL, /* m_traverse */
  5261.     NULL, /* m_clear */
  5262.     NULL /* m_free */
  5263. };
  5264. #endif
  5265.  
  5266. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  5267.   {&__pyx_kp_s_Bytes_size_d_is_not_a_power_of_2, __pyx_k_Bytes_size_d_is_not_a_power_of_2, sizeof(__pyx_k_Bytes_size_d_is_not_a_power_of_2), 0, 0, 1, 0},
  5268.   {&__pyx_kp_s_Different_byte_sizes_have_yet_to, __pyx_k_Different_byte_sizes_have_yet_to, sizeof(__pyx_k_Different_byte_sizes_have_yet_to), 0, 0, 1, 0},
  5269.   {&__pyx_n_s_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 0, 0, 1, 1},
  5270.   {&__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},
  5271.   {&__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},
  5272.   {&__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},
  5273.   {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  5274.   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  5275.   {&__pyx_n_s_ZigZag, __pyx_k_ZigZag, sizeof(__pyx_k_ZigZag), 0, 0, 1, 1},
  5276.   {&__pyx_n_s_ZigZag___init, __pyx_k_ZigZag___init, sizeof(__pyx_k_ZigZag___init), 0, 0, 1, 1},
  5277.   {&__pyx_n_s_ZigZag_byte_size, __pyx_k_ZigZag_byte_size, sizeof(__pyx_k_ZigZag_byte_size), 0, 0, 1, 1},
  5278.   {&__pyx_n_s_ZigZag_decode, __pyx_k_ZigZag_decode, sizeof(__pyx_k_ZigZag_decode), 0, 0, 1, 1},
  5279.   {&__pyx_n_s_ZigZag_encode, __pyx_k_ZigZag_encode, sizeof(__pyx_k_ZigZag_encode), 0, 0, 1, 1},
  5280.   {&__pyx_n_s_abs, __pyx_k_abs, sizeof(__pyx_k_abs), 0, 0, 1, 1},
  5281.   {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
  5282.   {&__pyx_n_s_bit_size, __pyx_k_bit_size, sizeof(__pyx_k_bit_size), 0, 0, 1, 1},
  5283.   {&__pyx_n_s_bit_size_2, __pyx_k_bit_size_2, sizeof(__pyx_k_bit_size_2), 0, 0, 1, 1},
  5284.   {&__pyx_n_s_bounds, __pyx_k_bounds, sizeof(__pyx_k_bounds), 0, 0, 1, 1},
  5285.   {&__pyx_n_s_byte_size, __pyx_k_byte_size, sizeof(__pyx_k_byte_size), 0, 0, 1, 1},
  5286.   {&__pyx_n_s_clip, __pyx_k_clip, sizeof(__pyx_k_clip), 0, 0, 1, 1},
  5287.   {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  5288.   {&__pyx_n_s_dimension, __pyx_k_dimension, sizeof(__pyx_k_dimension), 0, 0, 1, 1},
  5289.   {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  5290.   {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  5291.   {&__pyx_n_s_dtype_2, __pyx_k_dtype_2, sizeof(__pyx_k_dtype_2), 0, 0, 1, 1},
  5292.   {&__pyx_n_s_e_idx, __pyx_k_e_idx, sizeof(__pyx_k_e_idx), 0, 0, 1, 1},
  5293.   {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
  5294.   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  5295.   {&__pyx_n_s_encoded, __pyx_k_encoded, sizeof(__pyx_k_encoded), 0, 0, 1, 1},
  5296.   {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  5297.   {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
  5298.   {&__pyx_kp_s_home_batman_one_xx_projects_map, __pyx_k_home_batman_one_xx_projects_map, sizeof(__pyx_k_home_batman_one_xx_projects_map), 0, 0, 1, 0},
  5299.   {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1},
  5300.   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  5301.   {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  5302.   {&__pyx_n_s_int16, __pyx_k_int16, sizeof(__pyx_k_int16), 0, 0, 1, 1},
  5303.   {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
  5304.   {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1},
  5305.   {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  5306.   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
  5307.   {&__pyx_n_s_lemantic_zigzag, __pyx_k_lemantic_zigzag, sizeof(__pyx_k_lemantic_zigzag), 0, 0, 1, 1},
  5308.   {&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1},
  5309.   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  5310.   {&__pyx_n_s_max_bounds, __pyx_k_max_bounds, sizeof(__pyx_k_max_bounds), 0, 0, 1, 1},
  5311.   {&__pyx_n_s_max_value, __pyx_k_max_value, sizeof(__pyx_k_max_value), 0, 0, 1, 1},
  5312.   {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  5313.   {&__pyx_n_s_min_bounds, __pyx_k_min_bounds, sizeof(__pyx_k_min_bounds), 0, 0, 1, 1},
  5314.   {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  5315.   {&__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},
  5316.   {&__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},
  5317.   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  5318.   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  5319.   {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  5320.   {&__pyx_n_s_pre_dtype, __pyx_k_pre_dtype, sizeof(__pyx_k_pre_dtype), 0, 0, 1, 1},
  5321.   {&__pyx_n_s_pre_dtype_2, __pyx_k_pre_dtype_2, sizeof(__pyx_k_pre_dtype_2), 0, 0, 1, 1},
  5322.   {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  5323.   {&__pyx_n_s_prev, __pyx_k_prev, sizeof(__pyx_k_prev), 0, 0, 1, 1},
  5324.   {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
  5325.   {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
  5326.   {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  5327.   {&__pyx_n_s_quantized, __pyx_k_quantized, sizeof(__pyx_k_quantized), 0, 0, 1, 1},
  5328.   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  5329.   {&__pyx_n_s_scalar, __pyx_k_scalar, sizeof(__pyx_k_scalar), 0, 0, 1, 1},
  5330.   {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  5331.   {&__pyx_n_s_setter, __pyx_k_setter, sizeof(__pyx_k_setter), 0, 0, 1, 1},
  5332.   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  5333.   {&__pyx_n_s_uint16, __pyx_k_uint16, sizeof(__pyx_k_uint16), 0, 0, 1, 1},
  5334.   {&__pyx_n_s_uint32, __pyx_k_uint32, sizeof(__pyx_k_uint32), 0, 0, 1, 1},
  5335.   {&__pyx_n_s_uint64, __pyx_k_uint64, sizeof(__pyx_k_uint64), 0, 0, 1, 1},
  5336.   {&__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},
  5337.   {&__pyx_n_s_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1},
  5338.   {0, 0, 0, 0, 0, 0, 0}
  5339. };
  5340. static int __Pyx_InitCachedBuiltins(void) {
  5341.   __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5342.   __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5343.   #if PY_MAJOR_VERSION >= 3
  5344.   __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5345.   #else
  5346.   __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5347.   #endif
  5348.   __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5349.   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5350.   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5351.   __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5352.   return 0;
  5353.   __pyx_L1_error:;
  5354.   return -1;
  5355. }
  5356.  
  5357. static int __Pyx_InitCachedConstants(void) {
  5358.   __Pyx_RefNannyDeclarations
  5359.   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  5360.  
  5361.   /* "lemantic/zigzag.pyx":37
  5362.  *   def __init__(self, byte_size=2):
  5363.  *     if byte_size != 2:
  5364.  *       raise Exception('Different byte sizes have yet to be implemented')             # <<<<<<<<<<<<<<
  5365.  *     self.byte_size = byte_size
  5366.  *
  5367.  */
  5368.   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Different_byte_sizes_have_yet_to); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5369.   __Pyx_GOTREF(__pyx_tuple_);
  5370.   __Pyx_GIVEREF(__pyx_tuple_);
  5371.  
  5372.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218
  5373.  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  5374.  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  5375.  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
  5376.  *
  5377.  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  5378.  */
  5379.   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5380.   __Pyx_GOTREF(__pyx_tuple__2);
  5381.   __Pyx_GIVEREF(__pyx_tuple__2);
  5382.  
  5383.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222
  5384.  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  5385.  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  5386.  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
  5387.  *
  5388.  *             info.buf = PyArray_DATA(self)
  5389.  */
  5390.   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5391.   __Pyx_GOTREF(__pyx_tuple__3);
  5392.   __Pyx_GIVEREF(__pyx_tuple__3);
  5393.  
  5394.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":259
  5395.  *                 if ((descr.byteorder == c'>' and little_endian) or
  5396.  *                     (descr.byteorder == c'<' and not little_endian)):
  5397.  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
  5398.  *                 if   t == NPY_BYTE:        f = "b"
  5399.  *                 elif t == NPY_UBYTE:       f = "B"
  5400.  */
  5401.   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5402.   __Pyx_GOTREF(__pyx_tuple__4);
  5403.   __Pyx_GIVEREF(__pyx_tuple__4);
  5404.  
  5405.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799
  5406.  *
  5407.  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
  5408.  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
  5409.  *
  5410.  *         if ((child.byteorder == c'>' and little_endian) or
  5411.  */
  5412.   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5413.   __Pyx_GOTREF(__pyx_tuple__5);
  5414.   __Pyx_GIVEREF(__pyx_tuple__5);
  5415.  
  5416.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803
  5417.  *         if ((child.byteorder == c'>' and little_endian) or
  5418.  *             (child.byteorder == c'<' and not little_endian)):
  5419.  *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
  5420.  *             # One could encode it in the format string and have Cython
  5421.  *             # complain instead, BUT: < and > in format strings also imply
  5422.  */
  5423.   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5424.   __Pyx_GOTREF(__pyx_tuple__6);
  5425.   __Pyx_GIVEREF(__pyx_tuple__6);
  5426.  
  5427.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823
  5428.  *             t = child.type_num
  5429.  *             if end - f < 5:
  5430.  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
  5431.  *
  5432.  *             # Until ticket #99 is fixed, use integers to avoid warnings
  5433.  */
  5434.   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5435.   __Pyx_GOTREF(__pyx_tuple__7);
  5436.   __Pyx_GIVEREF(__pyx_tuple__7);
  5437.  
  5438.   /* "lemantic/zigzag.pyx":15
  5439.  * #@cython.boundscheck(False) # turn off bounds-checking for entire function
  5440.  * #@cython.wraparound(False)  # turn off negative index wrapping for entire function
  5441.  * def encode(np.ndarray[int16_t, ndim=1] items, int bit_size):             # <<<<<<<<<<<<<<
  5442.  *   cdef int16_t prev = 0
  5443.  *   cdef np.ndarray[np.uint16_t, ndim=1] encoded = np.empty(len(items), dtype=np.uint16)
  5444.  */
  5445.   __pyx_tuple__8 = PyTuple_Pack(6, __pyx_n_s_items, __pyx_n_s_bit_size, __pyx_n_s_prev, __pyx_n_s_encoded, __pyx_n_s_idx, __pyx_n_s_e_idx); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5446.   __Pyx_GOTREF(__pyx_tuple__8);
  5447.   __Pyx_GIVEREF(__pyx_tuple__8);
  5448.   __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_batman_one_xx_projects_map, __pyx_n_s_encode, 15, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5449.  
  5450.   /* "lemantic/zigzag.pyx":30
  5451.  *   return encoded
  5452.  *
  5453.  * def decode():             # <<<<<<<<<<<<<<
  5454.  *   pass
  5455.  *
  5456.  */
  5457.   __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_batman_one_xx_projects_map, __pyx_n_s_decode, 30, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5458.  
  5459.   /* "lemantic/zigzag.pyx":35
  5460.  * class ZigZag(object):
  5461.  *
  5462.  *   def __init__(self, byte_size=2):             # <<<<<<<<<<<<<<
  5463.  *     if byte_size != 2:
  5464.  *       raise Exception('Different byte sizes have yet to be implemented')
  5465.  */
  5466.   __pyx_tuple__11 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_byte_size); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5467.   __Pyx_GOTREF(__pyx_tuple__11);
  5468.   __Pyx_GIVEREF(__pyx_tuple__11);
  5469.   __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_batman_one_xx_projects_map, __pyx_n_s_init, 35, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5470.   __pyx_tuple__13 = PyTuple_Pack(1, ((PyObject *)__pyx_int_2)); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5471.   __Pyx_GOTREF(__pyx_tuple__13);
  5472.   __Pyx_GIVEREF(__pyx_tuple__13);
  5473.  
  5474.   /* "lemantic/zigzag.pyx":41
  5475.  *
  5476.  *   @property
  5477.  *   def byte_size(self):             # <<<<<<<<<<<<<<
  5478.  *     return self._dtype.itemsize
  5479.  *
  5480.  */
  5481.   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5482.   __Pyx_GOTREF(__pyx_tuple__14);
  5483.   __Pyx_GIVEREF(__pyx_tuple__14);
  5484.   __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_batman_one_xx_projects_map, __pyx_n_s_byte_size, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5485.  
  5486.   /* "lemantic/zigzag.pyx":45
  5487.  *
  5488.  *   @byte_size.setter
  5489.  *   def byte_size(self, byte_size):             # <<<<<<<<<<<<<<
  5490.  *     if byte_size == 2:
  5491.  *       pre_dtype = np.dtype(np.int16)
  5492.  */
  5493.   __pyx_tuple__16 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_byte_size, __pyx_n_s_pre_dtype_2, __pyx_n_s_dtype); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5494.   __Pyx_GOTREF(__pyx_tuple__16);
  5495.   __Pyx_GIVEREF(__pyx_tuple__16);
  5496.   __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_batman_one_xx_projects_map, __pyx_n_s_byte_size, 45, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5497.  
  5498.   /* "lemantic/zigzag.pyx":64
  5499.  *     self._max_value = float(pow(2, self._bit_size) - 1)
  5500.  *
  5501.  *   def encode(self, items, bounds, log=False):             # <<<<<<<<<<<<<<
  5502.  *     # Find bounds and scalar
  5503.  *     [ min_bounds, max_bounds ] = bounds
  5504.  */
  5505.   __pyx_tuple__18 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_items, __pyx_n_s_bounds, __pyx_n_s_log, __pyx_n_s_min_bounds, __pyx_n_s_max_bounds, __pyx_n_s_dimension, __pyx_n_s_scalar, __pyx_n_s_quantized); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5506.   __Pyx_GOTREF(__pyx_tuple__18);
  5507.   __Pyx_GIVEREF(__pyx_tuple__18);
  5508.   __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_batman_one_xx_projects_map, __pyx_n_s_encode, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5509.   __pyx_tuple__20 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5510.   __Pyx_GOTREF(__pyx_tuple__20);
  5511.   __Pyx_GIVEREF(__pyx_tuple__20);
  5512.  
  5513.   /* "lemantic/zigzag.pyx":80
  5514.  *     return encode(quantized, self._bit_size).astype(self._dtype)
  5515.  *
  5516.  *   def decode():             # <<<<<<<<<<<<<<
  5517.  *     pass
  5518.  */
  5519.   __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_batman_one_xx_projects_map, __pyx_n_s_decode, 80, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5520.   __Pyx_RefNannyFinishContext();
  5521.   return 0;
  5522.   __pyx_L1_error:;
  5523.   __Pyx_RefNannyFinishContext();
  5524.   return -1;
  5525. }
  5526.  
  5527. static int __Pyx_InitGlobals(void) {
  5528.   if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  5529.   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5530.   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5531.   __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5532.   __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5533.   __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5534.   return 0;
  5535.   __pyx_L1_error:;
  5536.   return -1;
  5537. }
  5538.  
  5539. #if PY_MAJOR_VERSION < 3
  5540. PyMODINIT_FUNC initzigzag(void); /*proto*/
  5541. PyMODINIT_FUNC initzigzag(void)
  5542. #else
  5543. PyMODINIT_FUNC PyInit_zigzag(void); /*proto*/
  5544. PyMODINIT_FUNC PyInit_zigzag(void)
  5545. #endif
  5546. {
  5547.   PyObject *__pyx_t_1 = NULL;
  5548.   PyObject *__pyx_t_2 = NULL;
  5549.   PyObject *__pyx_t_3 = NULL;
  5550.   PyObject *__pyx_t_4 = NULL;
  5551.   PyObject *__pyx_t_5 = NULL;
  5552.   PyObject *__pyx_t_6 = NULL;
  5553.   PyObject *__pyx_t_7 = NULL;
  5554.   PyObject *__pyx_t_8 = NULL;
  5555.   int __pyx_lineno = 0;
  5556.   const char *__pyx_filename = NULL;
  5557.   int __pyx_clineno = 0;
  5558.   __Pyx_RefNannyDeclarations
  5559.   #if CYTHON_REFNANNY
  5560.   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  5561.   if (!__Pyx_RefNanny) {
  5562.       PyErr_Clear();
  5563.       __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  5564.       if (!__Pyx_RefNanny)
  5565.           Py_FatalError("failed to import 'refnanny' module");
  5566.   }
  5567.   #endif
  5568.   __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_zigzag(void)", 0);
  5569.   if (__Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5570.   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5571.   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5572.   #ifdef __Pyx_CyFunction_USED
  5573.   if (__pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5574.   #endif
  5575.   #ifdef __Pyx_FusedFunction_USED
  5576.   if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5577.   #endif
  5578.   #ifdef __Pyx_Coroutine_USED
  5579.   if (__pyx_Coroutine_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5580.   #endif
  5581.   #ifdef __Pyx_Generator_USED
  5582.   if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5583.   #endif
  5584.   #ifdef __Pyx_StopAsyncIteration_USED
  5585.   if (__pyx_StopAsyncIteration_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5586.   #endif
  5587.   /*--- Library function declarations ---*/
  5588.   /*--- Threads initialization code ---*/
  5589.   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  5590.   #ifdef WITH_THREAD /* Python build with threading support? */
  5591.   PyEval_InitThreads();
  5592.   #endif
  5593.   #endif
  5594.   /*--- Module creation code ---*/
  5595.   #if PY_MAJOR_VERSION < 3
  5596.   __pyx_m = Py_InitModule4("zigzag", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  5597.   #else
  5598.   __pyx_m = PyModule_Create(&__pyx_moduledef);
  5599.   #endif
  5600.   if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5601.   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5602.   Py_INCREF(__pyx_d);
  5603.   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5604.   #if CYTHON_COMPILING_IN_PYPY
  5605.   Py_INCREF(__pyx_b);
  5606.   #endif
  5607.   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  5608.   /*--- Initialize various global constants etc. ---*/
  5609.   if (__Pyx_InitGlobals() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5610.   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  5611.   if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5612.   #endif
  5613.   if (__pyx_module_is_main_lemantic__zigzag) {
  5614.     if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5615.   }
  5616.   #if PY_MAJOR_VERSION >= 3
  5617.   {
  5618.     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5619.     if (!PyDict_GetItemString(modules, "lemantic.zigzag")) {
  5620.       if (unlikely(PyDict_SetItemString(modules, "lemantic.zigzag", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5621.     }
  5622.   }
  5623.   #endif
  5624.   /*--- Builtin init code ---*/
  5625.   if (__Pyx_InitCachedBuiltins() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5626.   /*--- Constants init code ---*/
  5627.   if (__Pyx_InitCachedConstants() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5628.   /*--- Global init code ---*/
  5629.   /*--- Variable export code ---*/
  5630.   /*--- Function export code ---*/
  5631.   /*--- Type init code ---*/
  5632.   /*--- Type import code ---*/
  5633.   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
  5634.   #if CYTHON_COMPILING_IN_PYPY
  5635.   sizeof(PyTypeObject),
  5636.   #else
  5637.   sizeof(PyHeapTypeObject),
  5638.   #endif
  5639.   0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5640.   __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5641.   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5642.   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5643.   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5644.   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5645.   /*--- Variable import code ---*/
  5646.   /*--- Function import code ---*/
  5647.   /*--- Execution code ---*/
  5648.   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  5649.   if (__Pyx_patch_abc() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5650.   #endif
  5651.  
  5652.   /* "lemantic/zigzag.pyx":1
  5653.  * import numpy as np             # <<<<<<<<<<<<<<
  5654.  *
  5655.  * cimport numpy as np
  5656.  */
  5657.   __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5658.   __Pyx_GOTREF(__pyx_t_1);
  5659.   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5660.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5661.  
  5662.   /* "lemantic/zigzag.pyx":15
  5663.  * #@cython.boundscheck(False) # turn off bounds-checking for entire function
  5664.  * #@cython.wraparound(False)  # turn off negative index wrapping for entire function
  5665.  * def encode(np.ndarray[int16_t, ndim=1] items, int bit_size):             # <<<<<<<<<<<<<<
  5666.  *   cdef int16_t prev = 0
  5667.  *   cdef np.ndarray[np.uint16_t, ndim=1] encoded = np.empty(len(items), dtype=np.uint16)
  5668.  */
  5669.   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8lemantic_6zigzag_3encode, NULL, __pyx_n_s_lemantic_zigzag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5670.   __Pyx_GOTREF(__pyx_t_1);
  5671.   if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5672.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5673.  
  5674.   /* "lemantic/zigzag.pyx":30
  5675.  *   return encoded
  5676.  *
  5677.  * def decode():             # <<<<<<<<<<<<<<
  5678.  *   pass
  5679.  *
  5680.  */
  5681.   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8lemantic_6zigzag_5decode, NULL, __pyx_n_s_lemantic_zigzag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5682.   __Pyx_GOTREF(__pyx_t_1);
  5683.   if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5684.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5685.  
  5686.   /* "lemantic/zigzag.pyx":33
  5687.  *   pass
  5688.  *
  5689.  * class ZigZag(object):             # <<<<<<<<<<<<<<
  5690.  *
  5691.  *   def __init__(self, byte_size=2):
  5692.  */
  5693.   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5694.   __Pyx_GOTREF(__pyx_t_1);
  5695.   __Pyx_INCREF(__pyx_builtin_object);
  5696.   __Pyx_GIVEREF(__pyx_builtin_object);
  5697.   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  5698.   __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5699.   __Pyx_GOTREF(__pyx_t_2);
  5700.   __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_ZigZag, __pyx_n_s_ZigZag, (PyObject *) NULL, __pyx_n_s_lemantic_zigzag, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5701.   __Pyx_GOTREF(__pyx_t_3);
  5702.  
  5703.   /* "lemantic/zigzag.pyx":35
  5704.  * class ZigZag(object):
  5705.  *
  5706.  *   def __init__(self, byte_size=2):             # <<<<<<<<<<<<<<
  5707.  *     if byte_size != 2:
  5708.  *       raise Exception('Different byte sizes have yet to be implemented')
  5709.  */
  5710.   __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8lemantic_6zigzag_6ZigZag_1__init__, 0, __pyx_n_s_ZigZag___init, NULL, __pyx_n_s_lemantic_zigzag, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5711.   __Pyx_GOTREF(__pyx_t_4);
  5712.   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__13);
  5713.   if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5714.   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5715.  
  5716.   /* "lemantic/zigzag.pyx":41
  5717.  *
  5718.  *   @property
  5719.  *   def byte_size(self):             # <<<<<<<<<<<<<<
  5720.  *     return self._dtype.itemsize
  5721.  *
  5722.  */
  5723.   __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8lemantic_6zigzag_6ZigZag_3byte_size, 0, __pyx_n_s_ZigZag_byte_size, NULL, __pyx_n_s_lemantic_zigzag, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5724.   __Pyx_GOTREF(__pyx_t_4);
  5725.  
  5726.   /* "lemantic/zigzag.pyx":40
  5727.  *     self.byte_size = byte_size
  5728.  *
  5729.  *   @property             # <<<<<<<<<<<<<<
  5730.  *   def byte_size(self):
  5731.  *     return self._dtype.itemsize
  5732.  */
  5733.   __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5734.   __Pyx_GOTREF(__pyx_t_5);
  5735.   __Pyx_GIVEREF(__pyx_t_4);
  5736.   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  5737.   __pyx_t_4 = 0;
  5738.   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5739.   __Pyx_GOTREF(__pyx_t_4);
  5740.   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5741.   if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_byte_size, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5742.   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5743.  
  5744.   /* "lemantic/zigzag.pyx":44
  5745.  *     return self._dtype.itemsize
  5746.  *
  5747.  *   @byte_size.setter             # <<<<<<<<<<<<<<
  5748.  *   def byte_size(self, byte_size):
  5749.  *     if byte_size == 2:
  5750.  */
  5751.   __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_byte_size);
  5752.   if (unlikely(!__pyx_t_5)) {
  5753.     PyErr_Clear();
  5754.     __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_byte_size);
  5755.   }
  5756.   if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5757.   __Pyx_GOTREF(__pyx_t_5);
  5758.   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setter); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5759.   __Pyx_GOTREF(__pyx_t_6);
  5760.   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5761.  
  5762.   /* "lemantic/zigzag.pyx":45
  5763.  *
  5764.  *   @byte_size.setter
  5765.  *   def byte_size(self, byte_size):             # <<<<<<<<<<<<<<
  5766.  *     if byte_size == 2:
  5767.  *       pre_dtype = np.dtype(np.int16)
  5768.  */
  5769.   __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8lemantic_6zigzag_6ZigZag_5byte_size, 0, __pyx_n_s_ZigZag_byte_size, NULL, __pyx_n_s_lemantic_zigzag, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5770.   __Pyx_GOTREF(__pyx_t_5);
  5771.   __pyx_t_7 = NULL;
  5772.   if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
  5773.     __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
  5774.     if (likely(__pyx_t_7)) {
  5775.       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  5776.       __Pyx_INCREF(__pyx_t_7);
  5777.       __Pyx_INCREF(function);
  5778.       __Pyx_DECREF_SET(__pyx_t_6, function);
  5779.     }
  5780.   }
  5781.   if (!__pyx_t_7) {
  5782.     __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5783.     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5784.     __Pyx_GOTREF(__pyx_t_4);
  5785.   } else {
  5786.     __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5787.     __Pyx_GOTREF(__pyx_t_8);
  5788.     __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
  5789.     __Pyx_GIVEREF(__pyx_t_5);
  5790.     PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5);
  5791.     __pyx_t_5 = 0;
  5792.     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5793.     __Pyx_GOTREF(__pyx_t_4);
  5794.     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  5795.   }
  5796.   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5797.   if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_byte_size, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5798.   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5799.  
  5800.   /* "lemantic/zigzag.pyx":64
  5801.  *     self._max_value = float(pow(2, self._bit_size) - 1)
  5802.  *
  5803.  *   def encode(self, items, bounds, log=False):             # <<<<<<<<<<<<<<
  5804.  *     # Find bounds and scalar
  5805.  *     [ min_bounds, max_bounds ] = bounds
  5806.  */
  5807.   __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8lemantic_6zigzag_6ZigZag_7encode, 0, __pyx_n_s_ZigZag_encode, NULL, __pyx_n_s_lemantic_zigzag, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5808.   __Pyx_GOTREF(__pyx_t_4);
  5809.   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__20);
  5810.   if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_encode, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5811.   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5812.  
  5813.   /* "lemantic/zigzag.pyx":80
  5814.  *     return encode(quantized, self._bit_size).astype(self._dtype)
  5815.  *
  5816.  *   def decode():             # <<<<<<<<<<<<<<
  5817.  *     pass
  5818.  */
  5819.   __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8lemantic_6zigzag_6ZigZag_9decode, 0, __pyx_n_s_ZigZag_decode, NULL, __pyx_n_s_lemantic_zigzag, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5820.   __Pyx_GOTREF(__pyx_t_4);
  5821.   if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_decode, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5822.   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5823.  
  5824.   /* "lemantic/zigzag.pyx":33
  5825.  *   pass
  5826.  *
  5827.  * class ZigZag(object):             # <<<<<<<<<<<<<<
  5828.  *
  5829.  *   def __init__(self, byte_size=2):
  5830.  */
  5831.   __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_ZigZag, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5832.   __Pyx_GOTREF(__pyx_t_4);
  5833.   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ZigZag, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5834.   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5835.   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5836.   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5837.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5838.  
  5839.   /* "lemantic/zigzag.pyx":1
  5840.  * import numpy as np             # <<<<<<<<<<<<<<
  5841.  *
  5842.  * cimport numpy as np
  5843.  */
  5844.   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5845.   __Pyx_GOTREF(__pyx_t_1);
  5846.   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5847.   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5848.  
  5849.   /* "../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976
  5850.  *      arr.base = baseptr
  5851.  *
  5852.  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
  5853.  *     if arr.base is NULL:
  5854.  *         return None
  5855.  */
  5856.  
  5857.   /*--- Wrapped vars code ---*/
  5858.  
  5859.   goto __pyx_L0;
  5860.   __pyx_L1_error:;
  5861.   __Pyx_XDECREF(__pyx_t_1);
  5862.   __Pyx_XDECREF(__pyx_t_2);
  5863.   __Pyx_XDECREF(__pyx_t_3);
  5864.   __Pyx_XDECREF(__pyx_t_4);
  5865.   __Pyx_XDECREF(__pyx_t_5);
  5866.   __Pyx_XDECREF(__pyx_t_6);
  5867.   __Pyx_XDECREF(__pyx_t_7);
  5868.   __Pyx_XDECREF(__pyx_t_8);
  5869.   if (__pyx_m) {
  5870.     if (__pyx_d) {
  5871.       __Pyx_AddTraceback("init lemantic.zigzag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5872.     }
  5873.     Py_DECREF(__pyx_m); __pyx_m = 0;
  5874.   } else if (!PyErr_Occurred()) {
  5875.     PyErr_SetString(PyExc_ImportError, "init lemantic.zigzag");
  5876.   }
  5877.   __pyx_L0:;
  5878.   __Pyx_RefNannyFinishContext();
  5879.   #if PY_MAJOR_VERSION < 3
  5880.   return;
  5881.   #else
  5882.   return __pyx_m;
  5883.   #endif
  5884. }
  5885.  
  5886. /* --- Runtime support code --- */
  5887. #if CYTHON_REFNANNY
  5888. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  5889.     PyObject *m = NULL, *p = NULL;
  5890.     void *r = NULL;
  5891.     m = PyImport_ImportModule((char *)modname);
  5892.     if (!m) goto end;
  5893.     p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
  5894.     if (!p) goto end;
  5895.     r = PyLong_AsVoidPtr(p);
  5896. end:
  5897.     Py_XDECREF(p);
  5898.     Py_XDECREF(m);
  5899.     return (__Pyx_RefNannyAPIStruct *)r;
  5900. }
  5901. #endif
  5902.  
  5903. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  5904.     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
  5905.     if (unlikely(!result)) {
  5906.         PyErr_Format(PyExc_NameError,
  5907. #if PY_MAJOR_VERSION >= 3
  5908.             "name '%U' is not defined", name);
  5909. #else
  5910.             "name '%.200s' is not defined", PyString_AS_STRING(name));
  5911. #endif
  5912.     }
  5913.     return result;
  5914. }
  5915.  
  5916. static void __Pyx_RaiseArgtupleInvalid(
  5917.     const char* func_name,
  5918.     int exact,
  5919.     Py_ssize_t num_min,
  5920.     Py_ssize_t num_max,
  5921.     Py_ssize_t num_found)
  5922. {
  5923.     Py_ssize_t num_expected;
  5924.     const char *more_or_less;
  5925.     if (num_found < num_min) {
  5926.         num_expected = num_min;
  5927.         more_or_less = "at least";
  5928.     } else {
  5929.         num_expected = num_max;
  5930.         more_or_less = "at most";
  5931.     }
  5932.     if (exact) {
  5933.         more_or_less = "exactly";
  5934.     }
  5935.     PyErr_Format(PyExc_TypeError,
  5936.                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  5937.                  func_name, more_or_less, num_expected,
  5938.                  (num_expected == 1) ? "" : "s", num_found);
  5939. }
  5940.  
  5941. static void __Pyx_RaiseDoubleKeywordsError(
  5942.     const char* func_name,
  5943.     PyObject* kw_name)
  5944. {
  5945.     PyErr_Format(PyExc_TypeError,
  5946.         #if PY_MAJOR_VERSION >= 3
  5947.         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  5948.         #else
  5949.         "%s() got multiple values for keyword argument '%s'", func_name,
  5950.         PyString_AsString(kw_name));
  5951.         #endif
  5952. }
  5953.  
  5954. static int __Pyx_ParseOptionalKeywords(
  5955.     PyObject *kwds,
  5956.     PyObject **argnames[],
  5957.     PyObject *kwds2,
  5958.     PyObject *values[],
  5959.     Py_ssize_t num_pos_args,
  5960.     const char* function_name)
  5961. {
  5962.     PyObject *key = 0, *value = 0;
  5963.     Py_ssize_t pos = 0;
  5964.     PyObject*** name;
  5965.     PyObject*** first_kw_arg = argnames + num_pos_args;
  5966.     while (PyDict_Next(kwds, &pos, &key, &value)) {
  5967.         name = first_kw_arg;
  5968.         while (*name && (**name != key)) name++;
  5969.         if (*name) {
  5970.             values[name-argnames] = value;
  5971.             continue;
  5972.         }
  5973.         name = first_kw_arg;
  5974.         #if PY_MAJOR_VERSION < 3
  5975.         if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
  5976.             while (*name) {
  5977.                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  5978.                         && _PyString_Eq(**name, key)) {
  5979.                     values[name-argnames] = value;
  5980.                     break;
  5981.                 }
  5982.                 name++;
  5983.             }
  5984.             if (*name) continue;
  5985.             else {
  5986.                 PyObject*** argname = argnames;
  5987.                 while (argname != first_kw_arg) {
  5988.                     if ((**argname == key) || (
  5989.                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  5990.                              && _PyString_Eq(**argname, key))) {
  5991.                         goto arg_passed_twice;
  5992.                     }
  5993.                     argname++;
  5994.                 }
  5995.             }
  5996.         } else
  5997.         #endif
  5998.         if (likely(PyUnicode_Check(key))) {
  5999.             while (*name) {
  6000.                 int cmp = (**name == key) ? 0 :
  6001.                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  6002.                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
  6003.                 #endif
  6004.                     PyUnicode_Compare(**name, key);
  6005.                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  6006.                 if (cmp == 0) {
  6007.                     values[name-argnames] = value;
  6008.                     break;
  6009.                 }
  6010.                 name++;
  6011.             }
  6012.             if (*name) continue;
  6013.             else {
  6014.                 PyObject*** argname = argnames;
  6015.                 while (argname != first_kw_arg) {
  6016.                     int cmp = (**argname == key) ? 0 :
  6017.                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  6018.                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
  6019.                     #endif
  6020.                         PyUnicode_Compare(**argname, key);
  6021.                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  6022.                     if (cmp == 0) goto arg_passed_twice;
  6023.                     argname++;
  6024.                 }
  6025.             }
  6026.         } else
  6027.             goto invalid_keyword_type;
  6028.         if (kwds2) {
  6029.             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  6030.         } else {
  6031.             goto invalid_keyword;
  6032.         }
  6033.     }
  6034.     return 0;
  6035. arg_passed_twice:
  6036.     __Pyx_RaiseDoubleKeywordsError(function_name, key);
  6037.     goto bad;
  6038. invalid_keyword_type:
  6039.     PyErr_Format(PyExc_TypeError,
  6040.         "%.200s() keywords must be strings", function_name);
  6041.     goto bad;
  6042. invalid_keyword:
  6043.     PyErr_Format(PyExc_TypeError,
  6044.     #if PY_MAJOR_VERSION < 3
  6045.         "%.200s() got an unexpected keyword argument '%.200s'",
  6046.         function_name, PyString_AsString(key));
  6047.     #else
  6048.         "%s() got an unexpected keyword argument '%U'",
  6049.         function_name, key);
  6050.     #endif
  6051. bad:
  6052.     return -1;
  6053. }
  6054.  
  6055. static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
  6056.     PyErr_Format(PyExc_TypeError,
  6057.         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
  6058.         name, type->tp_name, Py_TYPE(obj)->tp_name);
  6059. }
  6060. static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
  6061.     const char *name, int exact)
  6062. {
  6063.     if (unlikely(!type)) {
  6064.         PyErr_SetString(PyExc_SystemError, "Missing type object");
  6065.         return 0;
  6066.     }
  6067.     if (none_allowed && obj == Py_None) return 1;
  6068.     else if (exact) {
  6069.         if (likely(Py_TYPE(obj) == type)) return 1;
  6070.         #if PY_MAJOR_VERSION == 2
  6071.         else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
  6072.         #endif
  6073.     }
  6074.     else {
  6075.         if (likely(PyObject_TypeCheck(obj, type))) return 1;
  6076.     }
  6077.     __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
  6078.     return 0;
  6079. }
  6080.  
  6081. static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
  6082.   unsigned int n = 1;
  6083.   return *(unsigned char*)(&n) != 0;
  6084. }
  6085. static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
  6086.                               __Pyx_BufFmt_StackElem* stack,
  6087.                               __Pyx_TypeInfo* type) {
  6088.   stack[0].field = &ctx->root;
  6089.   stack[0].parent_offset = 0;
  6090.   ctx->root.type = type;
  6091.   ctx->root.name = "buffer dtype";
  6092.   ctx->root.offset = 0;
  6093.   ctx->head = stack;
  6094.   ctx->head->field = &ctx->root;
  6095.   ctx->fmt_offset = 0;
  6096.   ctx->head->parent_offset = 0;
  6097.   ctx->new_packmode = '@';
  6098.   ctx->enc_packmode = '@';
  6099.   ctx->new_count = 1;
  6100.   ctx->enc_count = 0;
  6101.   ctx->enc_type = 0;
  6102.   ctx->is_complex = 0;
  6103.   ctx->is_valid_array = 0;
  6104.   ctx->struct_alignment = 0;
  6105.   while (type->typegroup == 'S') {
  6106.     ++ctx->head;
  6107.     ctx->head->field = type->fields;
  6108.     ctx->head->parent_offset = 0;
  6109.     type = type->fields->type;
  6110.   }
  6111. }
  6112. static int __Pyx_BufFmt_ParseNumber(const char** ts) {
  6113.     int count;
  6114.     const char* t = *ts;
  6115.     if (*t < '0' || *t > '9') {
  6116.       return -1;
  6117.     } else {
  6118.         count = *t++ - '0';
  6119.         while (*t >= '0' && *t < '9') {
  6120.             count *= 10;
  6121.             count += *t++ - '0';
  6122.         }
  6123.     }
  6124.     *ts = t;
  6125.     return count;
  6126. }
  6127. static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
  6128.     int number = __Pyx_BufFmt_ParseNumber(ts);
  6129.     if (number == -1)
  6130.         PyErr_Format(PyExc_ValueError,\
  6131.                      "Does not understand character buffer dtype format string ('%c')", **ts);
  6132.     return number;
  6133. }
  6134. static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  6135.   PyErr_Format(PyExc_ValueError,
  6136.                "Unexpected format string character: '%c'", ch);
  6137. }
  6138. static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  6139.   switch (ch) {
  6140.     case 'c': return "'char'";
  6141.     case 'b': return "'signed char'";
  6142.     case 'B': return "'unsigned char'";
  6143.     case 'h': return "'short'";
  6144.     case 'H': return "'unsigned short'";
  6145.     case 'i': return "'int'";
  6146.     case 'I': return "'unsigned int'";
  6147.     case 'l': return "'long'";
  6148.     case 'L': return "'unsigned long'";
  6149.     case 'q': return "'long long'";
  6150.     case 'Q': return "'unsigned long long'";
  6151.     case 'f': return (is_complex ? "'complex float'" : "'float'");
  6152.     case 'd': return (is_complex ? "'complex double'" : "'double'");
  6153.     case 'g': return (is_complex ? "'complex long double'" : "'long double'");
  6154.     case 'T': return "a struct";
  6155.     case 'O': return "Python object";
  6156.     case 'P': return "a pointer";
  6157.     case 's': case 'p': return "a string";
  6158.     case 0: return "end";
  6159.     default: return "unparseable format string";
  6160.   }
  6161. }
  6162. static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  6163.   switch (ch) {
  6164.     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  6165.     case 'h': case 'H': return 2;
  6166.     case 'i': case 'I': case 'l': case 'L': return 4;
  6167.     case 'q': case 'Q': return 8;
  6168.     case 'f': return (is_complex ? 8 : 4);
  6169.     case 'd': return (is_complex ? 16 : 8);
  6170.     case 'g': {
  6171.       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
  6172.       return 0;
  6173.     }
  6174.     case 'O': case 'P': return sizeof(void*);
  6175.     default:
  6176.       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  6177.       return 0;
  6178.     }
  6179. }
  6180. static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  6181.   switch (ch) {
  6182.     case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  6183.     case 'h': case 'H': return sizeof(short);
  6184.     case 'i': case 'I': return sizeof(int);
  6185.     case 'l': case 'L': return sizeof(long);
  6186.     #ifdef HAVE_LONG_LONG
  6187.     case 'q': case 'Q': return sizeof(PY_LONG_LONG);
  6188.     #endif
  6189.     case 'f': return sizeof(float) * (is_complex ? 2 : 1);
  6190.     case 'd': return sizeof(double) * (is_complex ? 2 : 1);
  6191.     case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
  6192.     case 'O': case 'P': return sizeof(void*);
  6193.     default: {
  6194.       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  6195.       return 0;
  6196.     }
  6197.   }
  6198. }
  6199. typedef struct { char c; short x; } __Pyx_st_short;
  6200. typedef struct { char c; int x; } __Pyx_st_int;
  6201. typedef struct { char c; long x; } __Pyx_st_long;
  6202. typedef struct { char c; float x; } __Pyx_st_float;
  6203. typedef struct { char c; double x; } __Pyx_st_double;
  6204. typedef struct { char c; long double x; } __Pyx_st_longdouble;
  6205. typedef struct { char c; void *x; } __Pyx_st_void_p;
  6206. #ifdef HAVE_LONG_LONG
  6207. typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
  6208. #endif
  6209. static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  6210.   switch (ch) {
  6211.     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  6212.     case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
  6213.     case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
  6214.     case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
  6215. #ifdef HAVE_LONG_LONG
  6216.     case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
  6217. #endif
  6218.     case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
  6219.     case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
  6220.     case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
  6221.     case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
  6222.     default:
  6223.       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  6224.       return 0;
  6225.     }
  6226. }
  6227. /* These are for computing the padding at the end of the struct to align
  6228.    on the first member of the struct. This will probably the same as above,
  6229.    but we don't have any guarantees.
  6230.  */
  6231. typedef struct { short x; char c; } __Pyx_pad_short;
  6232. typedef struct { int x; char c; } __Pyx_pad_int;
  6233. typedef struct { long x; char c; } __Pyx_pad_long;
  6234. typedef struct { float x; char c; } __Pyx_pad_float;
  6235. typedef struct { double x; char c; } __Pyx_pad_double;
  6236. typedef struct { long double x; char c; } __Pyx_pad_longdouble;
  6237. typedef struct { void *x; char c; } __Pyx_pad_void_p;
  6238. #ifdef HAVE_LONG_LONG
  6239. typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
  6240. #endif
  6241. static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  6242.   switch (ch) {
  6243.     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  6244.     case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
  6245.     case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
  6246.     case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
  6247. #ifdef HAVE_LONG_LONG
  6248.     case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
  6249. #endif
  6250.     case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
  6251.     case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
  6252.     case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
  6253.     case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
  6254.     default:
  6255.       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  6256.       return 0;
  6257.     }
  6258. }
  6259. static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  6260.   switch (ch) {
  6261.     case 'c':
  6262.         return 'H';
  6263.     case 'b': case 'h': case 'i':
  6264.     case 'l': case 'q': case 's': case 'p':
  6265.         return 'I';
  6266.     case 'B': case 'H': case 'I': case 'L': case 'Q':
  6267.         return 'U';
  6268.     case 'f': case 'd': case 'g':
  6269.         return (is_complex ? 'C' : 'R');
  6270.     case 'O':
  6271.         return 'O';
  6272.     case 'P':
  6273.         return 'P';
  6274.     default: {
  6275.       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  6276.       return 0;
  6277.     }
  6278.   }
  6279. }
  6280. static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  6281.   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
  6282.     const char* expected;
  6283.     const char* quote;
  6284.     if (ctx->head == NULL) {
  6285.       expected = "end";
  6286.       quote = "";
  6287.     } else {
  6288.       expected = ctx->head->field->type->name;
  6289.       quote = "'";
  6290.     }
  6291.     PyErr_Format(PyExc_ValueError,
  6292.                  "Buffer dtype mismatch, expected %s%s%s but got %s",
  6293.                  quote, expected, quote,
  6294.                  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  6295.   } else {
  6296.     __Pyx_StructField* field = ctx->head->field;
  6297.     __Pyx_StructField* parent = (ctx->head - 1)->field;
  6298.     PyErr_Format(PyExc_ValueError,
  6299.                  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
  6300.                  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
  6301.                  parent->type->name, field->name);
  6302.   }
  6303. }
  6304. static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  6305.   char group;
  6306.   size_t size, offset, arraysize = 1;
  6307.   if (ctx->enc_type == 0) return 0;
  6308.   if (ctx->head->field->type->arraysize[0]) {
  6309.     int i, ndim = 0;
  6310.     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
  6311.         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
  6312.         ndim = 1;
  6313.         if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
  6314.             PyErr_Format(PyExc_ValueError,
  6315.                          "Expected a dimension of size %zu, got %zu",
  6316.                          ctx->head->field->type->arraysize[0], ctx->enc_count);
  6317.             return -1;
  6318.         }
  6319.     }
  6320.     if (!ctx->is_valid_array) {
  6321.       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
  6322.                    ctx->head->field->type->ndim, ndim);
  6323.       return -1;
  6324.     }
  6325.     for (i = 0; i < ctx->head->field->type->ndim; i++) {
  6326.       arraysize *= ctx->head->field->type->arraysize[i];
  6327.     }
  6328.     ctx->is_valid_array = 0;
  6329.     ctx->enc_count = 1;
  6330.   }
  6331.   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  6332.   do {
  6333.     __Pyx_StructField* field = ctx->head->field;
  6334.     __Pyx_TypeInfo* type = field->type;
  6335.     if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
  6336.       size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
  6337.     } else {
  6338.       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
  6339.     }
  6340.     if (ctx->enc_packmode == '@') {
  6341.       size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
  6342.       size_t align_mod_offset;
  6343.       if (align_at == 0) return -1;
  6344.       align_mod_offset = ctx->fmt_offset % align_at;
  6345.       if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
  6346.       if (ctx->struct_alignment == 0)
  6347.           ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
  6348.                                                                  ctx->is_complex);
  6349.     }
  6350.     if (type->size != size || type->typegroup != group) {
  6351.       if (type->typegroup == 'C' && type->fields != NULL) {
  6352.         size_t parent_offset = ctx->head->parent_offset + field->offset;
  6353.         ++ctx->head;
  6354.         ctx->head->field = type->fields;
  6355.         ctx->head->parent_offset = parent_offset;
  6356.         continue;
  6357.       }
  6358.       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
  6359.       } else {
  6360.           __Pyx_BufFmt_RaiseExpected(ctx);
  6361.           return -1;
  6362.       }
  6363.     }
  6364.     offset = ctx->head->parent_offset + field->offset;
  6365.     if (ctx->fmt_offset != offset) {
  6366.       PyErr_Format(PyExc_ValueError,
  6367.                    "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
  6368.                    (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
  6369.       return -1;
  6370.     }
  6371.     ctx->fmt_offset += size;
  6372.     if (arraysize)
  6373.       ctx->fmt_offset += (arraysize - 1) * size;
  6374.     --ctx->enc_count;
  6375.     while (1) {
  6376.       if (field == &ctx->root) {
  6377.         ctx->head = NULL;
  6378.         if (ctx->enc_count != 0) {
  6379.           __Pyx_BufFmt_RaiseExpected(ctx);
  6380.           return -1;
  6381.         }
  6382.         break;
  6383.       }
  6384.       ctx->head->field = ++field;
  6385.       if (field->type == NULL) {
  6386.         --ctx->head;
  6387.         field = ctx->head->field;
  6388.         continue;
  6389.       } else if (field->type->typegroup == 'S') {
  6390.         size_t parent_offset = ctx->head->parent_offset + field->offset;
  6391.         if (field->type->fields->type == NULL) continue;
  6392.         field = field->type->fields;
  6393.         ++ctx->head;
  6394.         ctx->head->field = field;
  6395.         ctx->head->parent_offset = parent_offset;
  6396.         break;
  6397.       } else {
  6398.         break;
  6399.       }
  6400.     }
  6401.   } while (ctx->enc_count);
  6402.   ctx->enc_type = 0;
  6403.   ctx->is_complex = 0;
  6404.   return 0;
  6405. }
  6406. static CYTHON_INLINE PyObject *
  6407. __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
  6408. {
  6409.     const char *ts = *tsp;
  6410.     int i = 0, number;
  6411.     int ndim = ctx->head->field->type->ndim;
  6412. ;
  6413.     ++ts;
  6414.     if (ctx->new_count != 1) {
  6415.         PyErr_SetString(PyExc_ValueError,
  6416.                         "Cannot handle repeated arrays in format string");
  6417.         return NULL;
  6418.     }
  6419.     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  6420.     while (*ts && *ts != ')') {
  6421.         switch (*ts) {
  6422.             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
  6423.             default:  break;
  6424.         }
  6425.         number = __Pyx_BufFmt_ExpectNumber(&ts);
  6426.         if (number == -1) return NULL;
  6427.         if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
  6428.             return PyErr_Format(PyExc_ValueError,
  6429.                         "Expected a dimension of size %zu, got %d",
  6430.                         ctx->head->field->type->arraysize[i], number);
  6431.         if (*ts != ',' && *ts != ')')
  6432.             return PyErr_Format(PyExc_ValueError,
  6433.                                 "Expected a comma in format string, got '%c'", *ts);
  6434.         if (*ts == ',') ts++;
  6435.         i++;
  6436.     }
  6437.     if (i != ndim)
  6438.         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
  6439.                             ctx->head->field->type->ndim, i);
  6440.     if (!*ts) {
  6441.         PyErr_SetString(PyExc_ValueError,
  6442.                         "Unexpected end of format string, expected ')'");
  6443.         return NULL;
  6444.     }
  6445.     ctx->is_valid_array = 1;
  6446.     ctx->new_count = 1;
  6447.     *tsp = ++ts;
  6448.     return Py_None;
  6449. }
  6450. static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  6451.   int got_Z = 0;
  6452.   while (1) {
  6453.     switch(*ts) {
  6454.       case 0:
  6455.         if (ctx->enc_type != 0 && ctx->head == NULL) {
  6456.           __Pyx_BufFmt_RaiseExpected(ctx);
  6457.           return NULL;
  6458.         }
  6459.         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  6460.         if (ctx->head != NULL) {
  6461.           __Pyx_BufFmt_RaiseExpected(ctx);
  6462.           return NULL;
  6463.         }
  6464.         return ts;
  6465.       case ' ':
  6466.       case '\r':
  6467.       case '\n':
  6468.         ++ts;
  6469.         break;
  6470.       case '<':
  6471.         if (!__Pyx_IsLittleEndian()) {
  6472.           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
  6473.           return NULL;
  6474.         }
  6475.         ctx->new_packmode = '=';
  6476.         ++ts;
  6477.         break;
  6478.       case '>':
  6479.       case '!':
  6480.         if (__Pyx_IsLittleEndian()) {
  6481.           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
  6482.           return NULL;
  6483.         }
  6484.         ctx->new_packmode = '=';
  6485.         ++ts;
  6486.         break;
  6487.       case '=':
  6488.       case '@':
  6489.       case '^':
  6490.         ctx->new_packmode = *ts++;
  6491.         break;
  6492.       case 'T':
  6493.         {
  6494.           const char* ts_after_sub;
  6495.           size_t i, struct_count = ctx->new_count;
  6496.           size_t struct_alignment = ctx->struct_alignment;
  6497.           ctx->new_count = 1;
  6498.           ++ts;
  6499.           if (*ts != '{') {
  6500.             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
  6501.             return NULL;
  6502.           }
  6503.           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  6504.           ctx->enc_type = 0;
  6505.           ctx->enc_count = 0;
  6506.           ctx->struct_alignment = 0;
  6507.           ++ts;
  6508.           ts_after_sub = ts;
  6509.           for (i = 0; i != struct_count; ++i) {
  6510.             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
  6511.             if (!ts_after_sub) return NULL;
  6512.           }
  6513.           ts = ts_after_sub;
  6514.           if (struct_alignment) ctx->struct_alignment = struct_alignment;
  6515.         }
  6516.         break;
  6517.       case '}':
  6518.         {
  6519.           size_t alignment = ctx->struct_alignment;
  6520.           ++ts;
  6521.           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  6522.           ctx->enc_type = 0;
  6523.           if (alignment && ctx->fmt_offset % alignment) {
  6524.             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
  6525.           }
  6526.         }
  6527.         return ts;
  6528.       case 'x':
  6529.         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  6530.         ctx->fmt_offset += ctx->new_count;
  6531.         ctx->new_count = 1;
  6532.         ctx->enc_count = 0;
  6533.         ctx->enc_type = 0;
  6534.         ctx->enc_packmode = ctx->new_packmode;
  6535.         ++ts;
  6536.         break;
  6537.       case 'Z':
  6538.         got_Z = 1;
  6539.         ++ts;
  6540.         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
  6541.           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
  6542.           return NULL;
  6543.         }
  6544.       case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
  6545.       case 'l': case 'L': case 'q': case 'Q':
  6546.       case 'f': case 'd': case 'g':
  6547.       case 'O': case 'p':
  6548.         if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
  6549.             ctx->enc_packmode == ctx->new_packmode) {
  6550.           ctx->enc_count += ctx->new_count;
  6551.           ctx->new_count = 1;
  6552.           got_Z = 0;
  6553.           ++ts;
  6554.           break;
  6555.         }
  6556.       case 's':
  6557.         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  6558.         ctx->enc_count = ctx->new_count;
  6559.         ctx->enc_packmode = ctx->new_packmode;
  6560.         ctx->enc_type = *ts;
  6561.         ctx->is_complex = got_Z;
  6562.         ++ts;
  6563.         ctx->new_count = 1;
  6564.         got_Z = 0;
  6565.         break;
  6566.       case ':':
  6567.         ++ts;
  6568.         while(*ts != ':') ++ts;
  6569.         ++ts;
  6570.         break;
  6571.       case '(':
  6572.         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
  6573.         break;
  6574.       default:
  6575.         {
  6576.           int number = __Pyx_BufFmt_ExpectNumber(&ts);
  6577.           if (number == -1) return NULL;
  6578.           ctx->new_count = (size_t)number;
  6579.         }
  6580.     }
  6581.   }
  6582. }
  6583. static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
  6584.   buf->buf = NULL;
  6585.   buf->obj = NULL;
  6586.   buf->strides = __Pyx_zeros;
  6587.   buf->shape = __Pyx_zeros;
  6588.   buf->suboffsets = __Pyx_minusones;
  6589. }
  6590. static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
  6591.         Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
  6592.         int nd, int cast, __Pyx_BufFmt_StackElem* stack)
  6593. {
  6594.   if (obj == Py_None || obj == NULL) {
  6595.     __Pyx_ZeroBuffer(buf);
  6596.     return 0;
  6597.   }
  6598.   buf->buf = NULL;
  6599.   if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  6600.   if (buf->ndim != nd) {
  6601.     PyErr_Format(PyExc_ValueError,
  6602.                  "Buffer has wrong number of dimensions (expected %d, got %d)",
  6603.                  nd, buf->ndim);
  6604.     goto fail;
  6605.   }
  6606.   if (!cast) {
  6607.     __Pyx_BufFmt_Context ctx;
  6608.     __Pyx_BufFmt_Init(&ctx, stack, dtype);
  6609.     if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  6610.   }
  6611.   if ((unsigned)buf->itemsize != dtype->size) {
  6612.     PyErr_Format(PyExc_ValueError,
  6613.       "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
  6614.       buf->itemsize, (buf->itemsize > 1) ? "s" : "",
  6615.       dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
  6616.     goto fail;
  6617.   }
  6618.   if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  6619.   return 0;
  6620. fail:;
  6621.   __Pyx_ZeroBuffer(buf);
  6622.   return -1;
  6623. }
  6624. static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  6625.   if (info->buf == NULL) return;
  6626.   if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  6627.   __Pyx_ReleaseBuffer(info);
  6628. }
  6629.  
  6630. static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
  6631.     PyObject *result;
  6632. #if CYTHON_COMPILING_IN_CPYTHON
  6633.     result = PyDict_GetItem(__pyx_d, name);
  6634.     if (likely(result)) {
  6635.         Py_INCREF(result);
  6636.     } else {
  6637. #else
  6638.     result = PyObject_GetItem(__pyx_d, name);
  6639.     if (!result) {
  6640.         PyErr_Clear();
  6641. #endif
  6642.         result = __Pyx_GetBuiltinName(name);
  6643.     }
  6644.     return result;
  6645. }
  6646.  
  6647. #if CYTHON_COMPILING_IN_CPYTHON
  6648. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  6649.     PyObject *result;
  6650.     ternaryfunc call = func->ob_type->tp_call;
  6651.     if (unlikely(!call))
  6652.         return PyObject_Call(func, arg, kw);
  6653.     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  6654.         return NULL;
  6655.     result = (*call)(func, arg, kw);
  6656.     Py_LeaveRecursiveCall();
  6657.     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  6658.         PyErr_SetString(
  6659.             PyExc_SystemError,
  6660.             "NULL result without error in PyObject_Call");
  6661.     }
  6662.     return result;
  6663. }
  6664. #endif
  6665.  
  6666. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
  6667.     if (unlikely(!type)) {
  6668.         PyErr_SetString(PyExc_SystemError, "Missing type object");
  6669.         return 0;
  6670.     }
  6671.     if (likely(PyObject_TypeCheck(obj, type)))
  6672.         return 1;
  6673.     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
  6674.                  Py_TYPE(obj)->tp_name, type->tp_name);
  6675.     return 0;
  6676. }
  6677.  
  6678. static void __Pyx_RaiseBufferIndexError(int axis) {
  6679.   PyErr_Format(PyExc_IndexError,
  6680.      "Out of bounds on buffer access (axis %d)", axis);
  6681. }
  6682.  
  6683. static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
  6684. #if CYTHON_COMPILING_IN_CPYTHON
  6685.     PyObject *tmp_type, *tmp_value, *tmp_tb;
  6686.     PyThreadState *tstate = PyThreadState_GET();
  6687.     tmp_type = tstate->curexc_type;
  6688.     tmp_value = tstate->curexc_value;
  6689.     tmp_tb = tstate->curexc_traceback;
  6690.     tstate->curexc_type = type;
  6691.     tstate->curexc_value = value;
  6692.     tstate->curexc_traceback = tb;
  6693.     Py_XDECREF(tmp_type);
  6694.     Py_XDECREF(tmp_value);
  6695.     Py_XDECREF(tmp_tb);
  6696. #else
  6697.     PyErr_Restore(type, value, tb);
  6698. #endif
  6699. }
  6700. static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
  6701. #if CYTHON_COMPILING_IN_CPYTHON
  6702.     PyThreadState *tstate = PyThreadState_GET();
  6703.     *type = tstate->curexc_type;
  6704.     *value = tstate->curexc_value;
  6705.     *tb = tstate->curexc_traceback;
  6706.     tstate->curexc_type = 0;
  6707.     tstate->curexc_value = 0;
  6708.     tstate->curexc_traceback = 0;
  6709. #else
  6710.     PyErr_Fetch(type, value, tb);
  6711. #endif
  6712. }
  6713.  
  6714. #if PY_MAJOR_VERSION < 3
  6715. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
  6716.                         CYTHON_UNUSED PyObject *cause) {
  6717.     Py_XINCREF(type);
  6718.     if (!value || value == Py_None)
  6719.         value = NULL;
  6720.     else
  6721.         Py_INCREF(value);
  6722.     if (!tb || tb == Py_None)
  6723.         tb = NULL;
  6724.     else {
  6725.         Py_INCREF(tb);
  6726.         if (!PyTraceBack_Check(tb)) {
  6727.             PyErr_SetString(PyExc_TypeError,
  6728.                 "raise: arg 3 must be a traceback or None");
  6729.             goto raise_error;
  6730.         }
  6731.     }
  6732.     if (PyType_Check(type)) {
  6733. #if CYTHON_COMPILING_IN_PYPY
  6734.         if (!value) {
  6735.             Py_INCREF(Py_None);
  6736.             value = Py_None;
  6737.         }
  6738. #endif
  6739.         PyErr_NormalizeException(&type, &value, &tb);
  6740.     } else {
  6741.         if (value) {
  6742.             PyErr_SetString(PyExc_TypeError,
  6743.                 "instance exception may not have a separate value");
  6744.             goto raise_error;
  6745.         }
  6746.         value = type;
  6747.         type = (PyObject*) Py_TYPE(type);
  6748.         Py_INCREF(type);
  6749.         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  6750.             PyErr_SetString(PyExc_TypeError,
  6751.                 "raise: exception class must be a subclass of BaseException");
  6752.             goto raise_error;
  6753.         }
  6754.     }
  6755.     __Pyx_ErrRestore(type, value, tb);
  6756.     return;
  6757. raise_error:
  6758.     Py_XDECREF(value);
  6759.     Py_XDECREF(type);
  6760.     Py_XDECREF(tb);
  6761.     return;
  6762. }
  6763. #else
  6764. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  6765.     PyObject* owned_instance = NULL;
  6766.     if (tb == Py_None) {
  6767.         tb = 0;
  6768.     } else if (tb && !PyTraceBack_Check(tb)) {
  6769.         PyErr_SetString(PyExc_TypeError,
  6770.             "raise: arg 3 must be a traceback or None");
  6771.         goto bad;
  6772.     }
  6773.     if (value == Py_None)
  6774.         value = 0;
  6775.     if (PyExceptionInstance_Check(type)) {
  6776.         if (value) {
  6777.             PyErr_SetString(PyExc_TypeError,
  6778.                 "instance exception may not have a separate value");
  6779.             goto bad;
  6780.         }
  6781.         value = type;
  6782.         type = (PyObject*) Py_TYPE(value);
  6783.     } else if (PyExceptionClass_Check(type)) {
  6784.         PyObject *instance_class = NULL;
  6785.         if (value && PyExceptionInstance_Check(value)) {
  6786.             instance_class = (PyObject*) Py_TYPE(value);
  6787.             if (instance_class != type) {
  6788.                 int is_subclass = PyObject_IsSubclass(instance_class, type);
  6789.                 if (!is_subclass) {
  6790.                     instance_class = NULL;
  6791.                 } else if (unlikely(is_subclass == -1)) {
  6792.                     goto bad;
  6793.                 } else {
  6794.                     type = instance_class;
  6795.                 }
  6796.             }
  6797.         }
  6798.         if (!instance_class) {
  6799.             PyObject *args;
  6800.             if (!value)
  6801.                 args = PyTuple_New(0);
  6802.             else if (PyTuple_Check(value)) {
  6803.                 Py_INCREF(value);
  6804.                 args = value;
  6805.             } else
  6806.                 args = PyTuple_Pack(1, value);
  6807.             if (!args)
  6808.                 goto bad;
  6809.             owned_instance = PyObject_Call(type, args, NULL);
  6810.             Py_DECREF(args);
  6811.             if (!owned_instance)
  6812.                 goto bad;
  6813.             value = owned_instance;
  6814.             if (!PyExceptionInstance_Check(value)) {
  6815.                 PyErr_Format(PyExc_TypeError,
  6816.                              "calling %R should have returned an instance of "
  6817.                              "BaseException, not %R",
  6818.                              type, Py_TYPE(value));
  6819.                 goto bad;
  6820.             }
  6821.         }
  6822.     } else {
  6823.         PyErr_SetString(PyExc_TypeError,
  6824.             "raise: exception class must be a subclass of BaseException");
  6825.         goto bad;
  6826.     }
  6827. #if PY_VERSION_HEX >= 0x03030000
  6828.     if (cause) {
  6829. #else
  6830.     if (cause && cause != Py_None) {
  6831. #endif
  6832.         PyObject *fixed_cause;
  6833.         if (cause == Py_None) {
  6834.             fixed_cause = NULL;
  6835.         } else if (PyExceptionClass_Check(cause)) {
  6836.             fixed_cause = PyObject_CallObject(cause, NULL);
  6837.             if (fixed_cause == NULL)
  6838.                 goto bad;
  6839.         } else if (PyExceptionInstance_Check(cause)) {
  6840.             fixed_cause = cause;
  6841.             Py_INCREF(fixed_cause);
  6842.         } else {
  6843.             PyErr_SetString(PyExc_TypeError,
  6844.                             "exception causes must derive from "
  6845.                             "BaseException");
  6846.             goto bad;
  6847.         }
  6848.         PyException_SetCause(value, fixed_cause);
  6849.     }
  6850.     PyErr_SetObject(type, value);
  6851.     if (tb) {
  6852. #if CYTHON_COMPILING_IN_PYPY
  6853.         PyObject *tmp_type, *tmp_value, *tmp_tb;
  6854.         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  6855.         Py_INCREF(tb);
  6856.         PyErr_Restore(tmp_type, tmp_value, tb);
  6857.         Py_XDECREF(tmp_tb);
  6858. #else
  6859.         PyThreadState *tstate = PyThreadState_GET();
  6860.         PyObject* tmp_tb = tstate->curexc_traceback;
  6861.         if (tb != tmp_tb) {
  6862.             Py_INCREF(tb);
  6863.             tstate->curexc_traceback = tb;
  6864.             Py_XDECREF(tmp_tb);
  6865.         }
  6866. #endif
  6867.     }
  6868. bad:
  6869.     Py_XDECREF(owned_instance);
  6870.     return;
  6871. }
  6872. #endif
  6873.  
  6874. #if CYTHON_USE_PYLONG_INTERNALS
  6875.   #include "longintrepr.h"
  6876. #endif
  6877.  
  6878. #if CYTHON_COMPILING_IN_CPYTHON
  6879. static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
  6880.     if (op1 == op2) {
  6881.         Py_RETURN_TRUE;
  6882.     }
  6883.     #if PY_MAJOR_VERSION < 3
  6884.     if (likely(PyInt_CheckExact(op1))) {
  6885.         const long b = intval;
  6886.         long a = PyInt_AS_LONG(op1);
  6887.         if (a == b) {
  6888.             Py_RETURN_TRUE;
  6889.         } else {
  6890.             Py_RETURN_FALSE;
  6891.         }
  6892.     }
  6893.     #endif
  6894.     #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3
  6895.     if (likely(PyLong_CheckExact(op1))) {
  6896.         const long b = intval;
  6897.         long a;
  6898.         const digit* digits = ((PyLongObject*)op1)->ob_digit;
  6899.         const Py_ssize_t size = Py_SIZE(op1);
  6900.         if (likely(__Pyx_sst_abs(size) <= 1)) {
  6901.             a = likely(size) ? digits[0] : 0;
  6902.             if (size == -1) a = -a;
  6903.         } else {
  6904.             switch (size) {
  6905.                 case -2:
  6906.                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  6907.                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  6908.                         break;
  6909.                     }
  6910.                 case 2:
  6911.                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  6912.                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  6913.                         break;
  6914.                     }
  6915.                 case -3:
  6916.                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  6917.                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  6918.                         break;
  6919.                     }
  6920.                 case 3:
  6921.                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  6922.                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  6923.                         break;
  6924.                     }
  6925.                 case -4:
  6926.                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  6927.                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  6928.                         break;
  6929.                     }
  6930.                 case 4:
  6931.                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  6932.                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  6933.                         break;
  6934.                     }
  6935.                 #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15
  6936.                 default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ);
  6937.                 #else
  6938.                 default: Py_RETURN_FALSE;
  6939.                 #endif
  6940.             }
  6941.         }
  6942.             if (a == b) {
  6943.                 Py_RETURN_TRUE;
  6944.             } else {
  6945.                 Py_RETURN_FALSE;
  6946.             }
  6947.     }
  6948.     #endif
  6949.     if (PyFloat_CheckExact(op1)) {
  6950.         const long b = intval;
  6951.         double a = PyFloat_AS_DOUBLE(op1);
  6952.             if ((double)a == (double)b) {
  6953.                 Py_RETURN_TRUE;
  6954.             } else {
  6955.                 Py_RETURN_FALSE;
  6956.             }
  6957.     }
  6958.     return PyObject_RichCompare(op1, op2, Py_EQ);
  6959. }
  6960. #endif
  6961.  
  6962. #if CYTHON_COMPILING_IN_CPYTHON
  6963. static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
  6964.     #if PY_MAJOR_VERSION < 3
  6965.     if (likely(PyInt_CheckExact(op1))) {
  6966.         const long b = intval;
  6967.         long x;
  6968.         long a = PyInt_AS_LONG(op1);
  6969.             x = (long)((unsigned long)a - b);
  6970.             if (likely((x^a) >= 0 || (x^~b) >= 0))
  6971.                 return PyInt_FromLong(x);
  6972.             return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
  6973.     }
  6974.     #endif
  6975.     #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3
  6976.     if (likely(PyLong_CheckExact(op1))) {
  6977.         const long b = intval;
  6978.         long a, x;
  6979.         const PY_LONG_LONG llb = intval;
  6980.         PY_LONG_LONG lla, llx;
  6981.         const digit* digits = ((PyLongObject*)op1)->ob_digit;
  6982.         const Py_ssize_t size = Py_SIZE(op1);
  6983.         if (likely(__Pyx_sst_abs(size) <= 1)) {
  6984.             a = likely(size) ? digits[0] : 0;
  6985.             if (size == -1) a = -a;
  6986.         } else {
  6987.             switch (size) {
  6988.                 case -2:
  6989.                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  6990.                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  6991.                         break;
  6992.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  6993.                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  6994.                         goto long_long;
  6995.                     }
  6996.                 case 2:
  6997.                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  6998.                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  6999.                         break;
  7000.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  7001.                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  7002.                         goto long_long;
  7003.                     }
  7004.                 case -3:
  7005.                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  7006.                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  7007.                         break;
  7008.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  7009.                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  7010.                         goto long_long;
  7011.                     }
  7012.                 case 3:
  7013.                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  7014.                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  7015.                         break;
  7016.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  7017.                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  7018.                         goto long_long;
  7019.                     }
  7020.                 case -4:
  7021.                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  7022.                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  7023.                         break;
  7024.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  7025.                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  7026.                         goto long_long;
  7027.                     }
  7028.                 case 4:
  7029.                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  7030.                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  7031.                         break;
  7032.                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  7033.                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  7034.                         goto long_long;
  7035.                     }
  7036.                 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
  7037.             }
  7038.         }
  7039.                 x = a - b;
  7040.             return PyLong_FromLong(x);
  7041.         long_long:
  7042.                 llx = lla - llb;
  7043.             return PyLong_FromLongLong(llx);
  7044.     }
  7045.     #endif
  7046.     if (PyFloat_CheckExact(op1)) {
  7047.         const long b = intval;
  7048.         double a = PyFloat_AS_DOUBLE(op1);
  7049.             double result;
  7050.             PyFPE_START_PROTECT("subtract", return NULL)
  7051.             result = ((double)a) - (double)b;
  7052.             PyFPE_END_PROTECT(result)
  7053.             return PyFloat_FromDouble(result);
  7054.     }
  7055.     return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
  7056. }
  7057. #endif
  7058.  
  7059. static double __Pyx__PyObject_AsDouble(PyObject* obj) {
  7060.     PyObject* float_value;
  7061. #if CYTHON_COMPILING_IN_PYPY
  7062.     float_value = PyNumber_Float(obj);  if (0) goto bad;
  7063. #else
  7064.     PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
  7065.     if (likely(nb) && likely(nb->nb_float)) {
  7066.         float_value = nb->nb_float(obj);
  7067.         if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
  7068.             PyErr_Format(PyExc_TypeError,
  7069.                 "__float__ returned non-float (type %.200s)",
  7070.                 Py_TYPE(float_value)->tp_name);
  7071.             Py_DECREF(float_value);
  7072.             goto bad;
  7073.         }
  7074.     } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
  7075. #if PY_MAJOR_VERSION >= 3
  7076.         float_value = PyFloat_FromString(obj);
  7077. #else
  7078.         float_value = PyFloat_FromString(obj, 0);
  7079. #endif
  7080.     } else {
  7081.         PyObject* args = PyTuple_New(1);
  7082.         if (unlikely(!args)) goto bad;
  7083.         PyTuple_SET_ITEM(args, 0, obj);
  7084.         float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
  7085.         PyTuple_SET_ITEM(args, 0, 0);
  7086.         Py_DECREF(args);
  7087.     }
  7088. #endif
  7089.     if (likely(float_value)) {
  7090.         double value = PyFloat_AS_DOUBLE(float_value);
  7091.         Py_DECREF(float_value);
  7092.         return value;
  7093.     }
  7094. bad:
  7095.     return (double)-1;
  7096. }
  7097.  
  7098. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  7099.     PyErr_Format(PyExc_ValueError,
  7100.                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  7101. }
  7102.  
  7103. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  7104.     PyErr_Format(PyExc_ValueError,
  7105.                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  7106.                  index, (index == 1) ? "" : "s");
  7107. }
  7108.  
  7109. static CYTHON_INLINE int __Pyx_IterFinish(void) {
  7110. #if CYTHON_COMPILING_IN_CPYTHON
  7111.     PyThreadState *tstate = PyThreadState_GET();
  7112.     PyObject* exc_type = tstate->curexc_type;
  7113.     if (unlikely(exc_type)) {
  7114.         if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
  7115.             PyObject *exc_value, *exc_tb;
  7116.             exc_value = tstate->curexc_value;
  7117.             exc_tb = tstate->curexc_traceback;
  7118.             tstate->curexc_type = 0;
  7119.             tstate->curexc_value = 0;
  7120.             tstate->curexc_traceback = 0;
  7121.             Py_DECREF(exc_type);
  7122.             Py_XDECREF(exc_value);
  7123.             Py_XDECREF(exc_tb);
  7124.             return 0;
  7125.         } else {
  7126.             return -1;
  7127.         }
  7128.     }
  7129.     return 0;
  7130. #else
  7131.     if (unlikely(PyErr_Occurred())) {
  7132.         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
  7133.             PyErr_Clear();
  7134.             return 0;
  7135.         } else {
  7136.             return -1;
  7137.         }
  7138.     }
  7139.     return 0;
  7140. #endif
  7141. }
  7142.  
  7143. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
  7144.     if (unlikely(retval)) {
  7145.         Py_DECREF(retval);
  7146.         __Pyx_RaiseTooManyValuesError(expected);
  7147.         return -1;
  7148.     } else {
  7149.         return __Pyx_IterFinish();
  7150.     }
  7151.     return 0;
  7152. }
  7153.  
  7154. #if CYTHON_COMPILING_IN_CPYTHON
  7155. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  7156.     PyObject *self, *result;
  7157.     PyCFunction cfunc;
  7158.     cfunc = PyCFunction_GET_FUNCTION(func);
  7159.     self = PyCFunction_GET_SELF(func);
  7160.     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  7161.         return NULL;
  7162.     result = cfunc(self, arg);
  7163.     Py_LeaveRecursiveCall();
  7164.     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  7165.         PyErr_SetString(
  7166.             PyExc_SystemError,
  7167.             "NULL result without error in PyObject_Call");
  7168.     }
  7169.     return result;
  7170. }
  7171. #endif
  7172.  
  7173. #if CYTHON_COMPILING_IN_CPYTHON
  7174. static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  7175.     PyObject *result;
  7176.     PyObject *args = PyTuple_New(1);
  7177.     if (unlikely(!args)) return NULL;
  7178.     Py_INCREF(arg);
  7179.     PyTuple_SET_ITEM(args, 0, arg);
  7180.     result = __Pyx_PyObject_Call(func, args, NULL);
  7181.     Py_DECREF(args);
  7182.     return result;
  7183. }
  7184. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  7185. #ifdef __Pyx_CyFunction_USED
  7186.     if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
  7187. #else
  7188.     if (likely(PyCFunction_Check(func))) {
  7189. #endif
  7190.         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
  7191.             return __Pyx_PyObject_CallMethO(func, arg);
  7192.         }
  7193.     }
  7194.     return __Pyx__PyObject_CallOneArg(func, arg);
  7195. }
  7196. #else
  7197. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  7198.     PyObject *result;
  7199.     PyObject *args = PyTuple_Pack(1, arg);
  7200.     if (unlikely(!args)) return NULL;
  7201.     result = __Pyx_PyObject_Call(func, args, NULL);
  7202.     Py_DECREF(args);
  7203.     return result;
  7204. }
  7205. #endif
  7206.  
  7207. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
  7208.     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  7209. }
  7210.  
  7211. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  7212.     PyObject *empty_list = 0;
  7213.     PyObject *module = 0;
  7214.     PyObject *global_dict = 0;
  7215.     PyObject *empty_dict = 0;
  7216.     PyObject *list;
  7217.     #if PY_VERSION_HEX < 0x03030000
  7218.     PyObject *py_import;
  7219.     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  7220.     if (!py_import)
  7221.         goto bad;
  7222.     #endif
  7223.     if (from_list)
  7224.         list = from_list;
  7225.     else {
  7226.         empty_list = PyList_New(0);
  7227.         if (!empty_list)
  7228.             goto bad;
  7229.         list = empty_list;
  7230.     }
  7231.     global_dict = PyModule_GetDict(__pyx_m);
  7232.     if (!global_dict)
  7233.         goto bad;
  7234.     empty_dict = PyDict_New();
  7235.     if (!empty_dict)
  7236.         goto bad;
  7237.     {
  7238.         #if PY_MAJOR_VERSION >= 3
  7239.         if (level == -1) {
  7240.             if (strchr(__Pyx_MODULE_NAME, '.')) {
  7241.                 #if PY_VERSION_HEX < 0x03030000
  7242.                 PyObject *py_level = PyInt_FromLong(1);
  7243.                 if (!py_level)
  7244.                     goto bad;
  7245.                 module = PyObject_CallFunctionObjArgs(py_import,
  7246.                     name, global_dict, empty_dict, list, py_level, NULL);
  7247.                 Py_DECREF(py_level);
  7248.                 #else
  7249.                 module = PyImport_ImportModuleLevelObject(
  7250.                     name, global_dict, empty_dict, list, 1);
  7251.                 #endif
  7252.                 if (!module) {
  7253.                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
  7254.                         goto bad;
  7255.                     PyErr_Clear();
  7256.                 }
  7257.             }
  7258.             level = 0;
  7259.         }
  7260.         #endif
  7261.         if (!module) {
  7262.             #if PY_VERSION_HEX < 0x03030000
  7263.             PyObject *py_level = PyInt_FromLong(level);
  7264.             if (!py_level)
  7265.                 goto bad;
  7266.             module = PyObject_CallFunctionObjArgs(py_import,
  7267.                 name, global_dict, empty_dict, list, py_level, NULL);
  7268.             Py_DECREF(py_level);
  7269.             #else
  7270.             module = PyImport_ImportModuleLevelObject(
  7271.                 name, global_dict, empty_dict, list, level);
  7272.             #endif
  7273.         }
  7274.     }
  7275. bad:
  7276.     #if PY_VERSION_HEX < 0x03030000
  7277.     Py_XDECREF(py_import);
  7278.     #endif
  7279.     Py_XDECREF(empty_list);
  7280.     Py_XDECREF(empty_dict);
  7281.     return module;
  7282. }
  7283.  
  7284. static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
  7285.     Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
  7286.     for (i=0; i < nbases; i++) {
  7287.         PyTypeObject *tmptype;
  7288.         PyObject *tmp = PyTuple_GET_ITEM(bases, i);
  7289.         tmptype = Py_TYPE(tmp);
  7290. #if PY_MAJOR_VERSION < 3
  7291.         if (tmptype == &PyClass_Type)
  7292.             continue;
  7293. #endif
  7294.         if (!metaclass) {
  7295.             metaclass = tmptype;
  7296.             continue;
  7297.         }
  7298.         if (PyType_IsSubtype(metaclass, tmptype))
  7299.             continue;
  7300.         if (PyType_IsSubtype(tmptype, metaclass)) {
  7301.             metaclass = tmptype;
  7302.             continue;
  7303.         }
  7304.         PyErr_SetString(PyExc_TypeError,
  7305.                         "metaclass conflict: "
  7306.                         "the metaclass of a derived class "
  7307.                         "must be a (non-strict) subclass "
  7308.                         "of the metaclasses of all its bases");
  7309.         return NULL;
  7310.     }
  7311.     if (!metaclass) {
  7312. #if PY_MAJOR_VERSION < 3
  7313.         metaclass = &PyClass_Type;
  7314. #else
  7315.         metaclass = &PyType_Type;
  7316. #endif
  7317.     }
  7318.     Py_INCREF((PyObject*) metaclass);
  7319.     return (PyObject*) metaclass;
  7320. }
  7321.  
  7322. static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
  7323.     PyObject* fake_module;
  7324.     PyTypeObject* cached_type = NULL;
  7325.     fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
  7326.     if (!fake_module) return NULL;
  7327.     Py_INCREF(fake_module);
  7328.     cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
  7329.     if (cached_type) {
  7330.         if (!PyType_Check((PyObject*)cached_type)) {
  7331.             PyErr_Format(PyExc_TypeError,
  7332.                 "Shared Cython type %.200s is not a type object",
  7333.                 type->tp_name);
  7334.             goto bad;
  7335.         }
  7336.         if (cached_type->tp_basicsize != type->tp_basicsize) {
  7337.             PyErr_Format(PyExc_TypeError,
  7338.                 "Shared Cython type %.200s has the wrong size, try recompiling",
  7339.                 type->tp_name);
  7340.             goto bad;
  7341.         }
  7342.     } else {
  7343.         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
  7344.         PyErr_Clear();
  7345.         if (PyType_Ready(type) < 0) goto bad;
  7346.         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
  7347.             goto bad;
  7348.         Py_INCREF(type);
  7349.         cached_type = type;
  7350.     }
  7351. done:
  7352.     Py_DECREF(fake_module);
  7353.     return cached_type;
  7354. bad:
  7355.     Py_XDECREF(cached_type);
  7356.     cached_type = NULL;
  7357.     goto done;
  7358. }
  7359.  
  7360. static PyObject *
  7361. __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
  7362. {
  7363.     if (unlikely(op->func_doc == NULL)) {
  7364.         if (op->func.m_ml->ml_doc) {
  7365. #if PY_MAJOR_VERSION >= 3
  7366.             op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
  7367. #else
  7368.             op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
  7369. #endif
  7370.             if (unlikely(op->func_doc == NULL))
  7371.                 return NULL;
  7372.         } else {
  7373.             Py_INCREF(Py_None);
  7374.             return Py_None;
  7375.         }
  7376.     }
  7377.     Py_INCREF(op->func_doc);
  7378.     return op->func_doc;
  7379. }
  7380. static int
  7381. __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
  7382. {
  7383.     PyObject *tmp = op->func_doc;
  7384.     if (value == NULL) {
  7385.         value = Py_None;
  7386.     }
  7387.     Py_INCREF(value);
  7388.     op->func_doc = value;
  7389.     Py_XDECREF(tmp);
  7390.     return 0;
  7391. }
  7392. static PyObject *
  7393. __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
  7394. {
  7395.     if (unlikely(op->func_name == NULL)) {
  7396. #if PY_MAJOR_VERSION >= 3
  7397.         op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
  7398. #else
  7399.         op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
  7400. #endif
  7401.         if (unlikely(op->func_name == NULL))
  7402.             return NULL;
  7403.     }
  7404.     Py_INCREF(op->func_name);
  7405.     return op->func_name;
  7406. }
  7407. static int
  7408. __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
  7409. {
  7410.     PyObject *tmp;
  7411. #if PY_MAJOR_VERSION >= 3
  7412.     if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  7413. #else
  7414.     if (unlikely(value == NULL || !PyString_Check(value))) {
  7415. #endif
  7416.         PyErr_SetString(PyExc_TypeError,
  7417.                         "__name__ must be set to a string object");
  7418.         return -1;
  7419.     }
  7420.     tmp = op->func_name;
  7421.     Py_INCREF(value);
  7422.     op->func_name = value;
  7423.     Py_XDECREF(tmp);
  7424.     return 0;
  7425. }
  7426. static PyObject *
  7427. __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
  7428. {
  7429.     Py_INCREF(op->func_qualname);
  7430.     return op->func_qualname;
  7431. }
  7432. static int
  7433. __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
  7434. {
  7435.     PyObject *tmp;
  7436. #if PY_MAJOR_VERSION >= 3
  7437.     if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  7438. #else
  7439.     if (unlikely(value == NULL || !PyString_Check(value))) {
  7440. #endif
  7441.         PyErr_SetString(PyExc_TypeError,
  7442.                         "__qualname__ must be set to a string object");
  7443.         return -1;
  7444.     }
  7445.     tmp = op->func_qualname;
  7446.     Py_INCREF(value);
  7447.     op->func_qualname = value;
  7448.     Py_XDECREF(tmp);
  7449.     return 0;
  7450. }
  7451. static PyObject *
  7452. __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
  7453. {
  7454.     PyObject *self;
  7455.     self = m->func_closure;
  7456.     if (self == NULL)
  7457.         self = Py_None;
  7458.     Py_INCREF(self);
  7459.     return self;
  7460. }
  7461. static PyObject *
  7462. __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
  7463. {
  7464.     if (unlikely(op->func_dict == NULL)) {
  7465.         op->func_dict = PyDict_New();
  7466.         if (unlikely(op->func_dict == NULL))
  7467.             return NULL;
  7468.     }
  7469.     Py_INCREF(op->func_dict);
  7470.     return op->func_dict;
  7471. }
  7472. static int
  7473. __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
  7474. {
  7475.     PyObject *tmp;
  7476.     if (unlikely(value == NULL)) {
  7477.         PyErr_SetString(PyExc_TypeError,
  7478.                "function's dictionary may not be deleted");
  7479.         return -1;
  7480.     }
  7481.     if (unlikely(!PyDict_Check(value))) {
  7482.         PyErr_SetString(PyExc_TypeError,
  7483.                "setting function's dictionary to a non-dict");
  7484.         return -1;
  7485.     }
  7486.     tmp = op->func_dict;
  7487.     Py_INCREF(value);
  7488.     op->func_dict = value;
  7489.     Py_XDECREF(tmp);
  7490.     return 0;
  7491. }
  7492. static PyObject *
  7493. __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
  7494. {
  7495.     Py_INCREF(op->func_globals);
  7496.     return op->func_globals;
  7497. }
  7498. static PyObject *
  7499. __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
  7500. {
  7501.     Py_INCREF(Py_None);
  7502.     return Py_None;
  7503. }
  7504. static PyObject *
  7505. __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
  7506. {
  7507.     PyObject* result = (op->func_code) ? op->func_code : Py_None;
  7508.     Py_INCREF(result);
  7509.     return result;
  7510. }
  7511. static int
  7512. __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
  7513.     int result = 0;
  7514.     PyObject *res = op->defaults_getter((PyObject *) op);
  7515.     if (unlikely(!res))
  7516.         return -1;
  7517.     #if CYTHON_COMPILING_IN_CPYTHON
  7518.     op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
  7519.     Py_INCREF(op->defaults_tuple);
  7520.     op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
  7521.     Py_INCREF(op->defaults_kwdict);
  7522.     #else
  7523.     op->defaults_tuple = PySequence_ITEM(res, 0);
  7524.     if (unlikely(!op->defaults_tuple)) result = -1;
  7525.     else {
  7526.         op->defaults_kwdict = PySequence_ITEM(res, 1);
  7527.         if (unlikely(!op->defaults_kwdict)) result = -1;
  7528.     }
  7529.     #endif
  7530.     Py_DECREF(res);
  7531.     return result;
  7532. }
  7533. static int
  7534. __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
  7535.     PyObject* tmp;
  7536.     if (!value) {
  7537.         value = Py_None;
  7538.     } else if (value != Py_None && !PyTuple_Check(value)) {
  7539.         PyErr_SetString(PyExc_TypeError,
  7540.                         "__defaults__ must be set to a tuple object");
  7541.         return -1;
  7542.     }
  7543.     Py_INCREF(value);
  7544.     tmp = op->defaults_tuple;
  7545.     op->defaults_tuple = value;
  7546.     Py_XDECREF(tmp);
  7547.     return 0;
  7548. }
  7549. static PyObject *
  7550. __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
  7551.     PyObject* result = op->defaults_tuple;
  7552.     if (unlikely(!result)) {
  7553.         if (op->defaults_getter) {
  7554.             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
  7555.             result = op->defaults_tuple;
  7556.         } else {
  7557.             result = Py_None;
  7558.         }
  7559.     }
  7560.     Py_INCREF(result);
  7561.     return result;
  7562. }
  7563. static int
  7564. __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
  7565.     PyObject* tmp;
  7566.     if (!value) {
  7567.         value = Py_None;
  7568.     } else if (value != Py_None && !PyDict_Check(value)) {
  7569.         PyErr_SetString(PyExc_TypeError,
  7570.                         "__kwdefaults__ must be set to a dict object");
  7571.         return -1;
  7572.     }
  7573.     Py_INCREF(value);
  7574.     tmp = op->defaults_kwdict;
  7575.     op->defaults_kwdict = value;
  7576.     Py_XDECREF(tmp);
  7577.     return 0;
  7578. }
  7579. static PyObject *
  7580. __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
  7581.     PyObject* result = op->defaults_kwdict;
  7582.     if (unlikely(!result)) {
  7583.         if (op->defaults_getter) {
  7584.             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
  7585.             result = op->defaults_kwdict;
  7586.         } else {
  7587.             result = Py_None;
  7588.         }
  7589.     }
  7590.     Py_INCREF(result);
  7591.     return result;
  7592. }
  7593. static int
  7594. __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
  7595.     PyObject* tmp;
  7596.     if (!value || value == Py_None) {
  7597.         value = NULL;
  7598.     } else if (!PyDict_Check(value)) {
  7599.         PyErr_SetString(PyExc_TypeError,
  7600.                         "__annotations__ must be set to a dict object");
  7601.         return -1;
  7602.     }
  7603.     Py_XINCREF(value);
  7604.     tmp = op->func_annotations;
  7605.     op->func_annotations = value;
  7606.     Py_XDECREF(tmp);
  7607.     return 0;
  7608. }
  7609. static PyObject *
  7610. __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
  7611.     PyObject* result = op->func_annotations;
  7612.     if (unlikely(!result)) {
  7613.         result = PyDict_New();
  7614.         if (unlikely(!result)) return NULL;
  7615.         op->func_annotations = result;
  7616.     }
  7617.     Py_INCREF(result);
  7618.     return result;
  7619. }
  7620. static PyGetSetDef __pyx_CyFunction_getsets[] = {
  7621.     {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  7622.     {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  7623.     {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  7624.     {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  7625.     {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
  7626.     {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
  7627.     {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
  7628.     {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
  7629.     {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  7630.     {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  7631.     {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  7632.     {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  7633.     {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  7634.     {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  7635.     {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  7636.     {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  7637.     {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
  7638.     {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
  7639.     {0, 0, 0, 0, 0}
  7640. };
  7641. static PyMemberDef __pyx_CyFunction_members[] = {
  7642.     {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
  7643.     {0, 0, 0,  0, 0}
  7644. };
  7645. static PyObject *
  7646. __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
  7647. {
  7648. #if PY_MAJOR_VERSION >= 3
  7649.     return PyUnicode_FromString(m->func.m_ml->ml_name);
  7650. #else
  7651.     return PyString_FromString(m->func.m_ml->ml_name);
  7652. #endif
  7653. }
  7654. static PyMethodDef __pyx_CyFunction_methods[] = {
  7655.     {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
  7656.     {0, 0, 0, 0}
  7657. };
  7658. #if PY_VERSION_HEX < 0x030500A0
  7659. #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
  7660. #else
  7661. #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
  7662. #endif
  7663. static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
  7664.                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  7665.     __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
  7666.     if (op == NULL)
  7667.         return NULL;
  7668.     op->flags = flags;
  7669.     __Pyx_CyFunction_weakreflist(op) = NULL;
  7670.     op->func.m_ml = ml;
  7671.     op->func.m_self = (PyObject *) op;
  7672.     Py_XINCREF(closure);
  7673.     op->func_closure = closure;
  7674.     Py_XINCREF(module);
  7675.     op->func.m_module = module;
  7676.     op->func_dict = NULL;
  7677.     op->func_name = NULL;
  7678.     Py_INCREF(qualname);
  7679.     op->func_qualname = qualname;
  7680.     op->func_doc = NULL;
  7681.     op->func_classobj = NULL;
  7682.     op->func_globals = globals;
  7683.     Py_INCREF(op->func_globals);
  7684.     Py_XINCREF(code);
  7685.     op->func_code = code;
  7686.     op->defaults_pyobjects = 0;
  7687.     op->defaults = NULL;
  7688.     op->defaults_tuple = NULL;
  7689.     op->defaults_kwdict = NULL;
  7690.     op->defaults_getter = NULL;
  7691.     op->func_annotations = NULL;
  7692.     PyObject_GC_Track(op);
  7693.     return (PyObject *) op;
  7694. }
  7695. static int
  7696. __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
  7697. {
  7698.     Py_CLEAR(m->func_closure);
  7699.     Py_CLEAR(m->func.m_module);
  7700.     Py_CLEAR(m->func_dict);
  7701.     Py_CLEAR(m->func_name);
  7702.     Py_CLEAR(m->func_qualname);
  7703.     Py_CLEAR(m->func_doc);
  7704.     Py_CLEAR(m->func_globals);
  7705.     Py_CLEAR(m->func_code);
  7706.     Py_CLEAR(m->func_classobj);
  7707.     Py_CLEAR(m->defaults_tuple);
  7708.     Py_CLEAR(m->defaults_kwdict);
  7709.     Py_CLEAR(m->func_annotations);
  7710.     if (m->defaults) {
  7711.         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
  7712.         int i;
  7713.         for (i = 0; i < m->defaults_pyobjects; i++)
  7714.             Py_XDECREF(pydefaults[i]);
  7715.         PyMem_Free(m->defaults);
  7716.         m->defaults = NULL;
  7717.     }
  7718.     return 0;
  7719. }
  7720. static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
  7721. {
  7722.     PyObject_GC_UnTrack(m);
  7723.     if (__Pyx_CyFunction_weakreflist(m) != NULL)
  7724.         PyObject_ClearWeakRefs((PyObject *) m);
  7725.     __Pyx_CyFunction_clear(m);
  7726.     PyObject_GC_Del(m);
  7727. }
  7728. static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
  7729. {
  7730.     Py_VISIT(m->func_closure);
  7731.     Py_VISIT(m->func.m_module);
  7732.     Py_VISIT(m->func_dict);
  7733.     Py_VISIT(m->func_name);
  7734.     Py_VISIT(m->func_qualname);
  7735.     Py_VISIT(m->func_doc);
  7736.     Py_VISIT(m->func_globals);
  7737.     Py_VISIT(m->func_code);
  7738.     Py_VISIT(m->func_classobj);
  7739.     Py_VISIT(m->defaults_tuple);
  7740.     Py_VISIT(m->defaults_kwdict);
  7741.     if (m->defaults) {
  7742.         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
  7743.         int i;
  7744.         for (i = 0; i < m->defaults_pyobjects; i++)
  7745.             Py_VISIT(pydefaults[i]);
  7746.     }
  7747.     return 0;
  7748. }
  7749. static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
  7750. {
  7751.     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  7752.     if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
  7753.         Py_INCREF(func);
  7754.         return func;
  7755.     }
  7756.     if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
  7757.         if (type == NULL)
  7758.             type = (PyObject *)(Py_TYPE(obj));
  7759.         return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
  7760.     }
  7761.     if (obj == Py_None)
  7762.         obj = NULL;
  7763.     return __Pyx_PyMethod_New(func, obj, type);
  7764. }
  7765. static PyObject*
  7766. __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
  7767. {
  7768. #if PY_MAJOR_VERSION >= 3
  7769.     return PyUnicode_FromFormat("<cyfunction %U at %p>",
  7770.                                 op->func_qualname, (void *)op);
  7771. #else
  7772.     return PyString_FromFormat("<cyfunction %s at %p>",
  7773.                                PyString_AsString(op->func_qualname), (void *)op);
  7774. #endif
  7775. }
  7776. #if CYTHON_COMPILING_IN_PYPY
  7777. static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  7778.     PyCFunctionObject* f = (PyCFunctionObject*)func;
  7779.     PyCFunction meth = f->m_ml->ml_meth;
  7780.     PyObject *self = f->m_self;
  7781.     Py_ssize_t size;
  7782.     switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
  7783.     case METH_VARARGS:
  7784.         if (likely(kw == NULL || PyDict_Size(kw) == 0))
  7785.             return (*meth)(self, arg);
  7786.         break;
  7787.     case METH_VARARGS | METH_KEYWORDS:
  7788.         return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
  7789.     case METH_NOARGS:
  7790.         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  7791.             size = PyTuple_GET_SIZE(arg);
  7792.             if (likely(size == 0))
  7793.                 return (*meth)(self, NULL);
  7794.             PyErr_Format(PyExc_TypeError,
  7795.                 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
  7796.                 f->m_ml->ml_name, size);
  7797.             return NULL;
  7798.         }
  7799.         break;
  7800.     case METH_O:
  7801.         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  7802.             size = PyTuple_GET_SIZE(arg);
  7803.             if (likely(size == 1)) {
  7804.                 PyObject *result, *arg0 = PySequence_ITEM(arg, 0);
  7805.                 if (unlikely(!arg0)) return NULL;
  7806.                 result = (*meth)(self, arg0);
  7807.                 Py_DECREF(arg0);
  7808.                 return result;
  7809.             }
  7810.             PyErr_Format(PyExc_TypeError,
  7811.                 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
  7812.                 f->m_ml->ml_name, size);
  7813.             return NULL;
  7814.         }
  7815.         break;
  7816.     default:
  7817.         PyErr_SetString(PyExc_SystemError, "Bad call flags in "
  7818.                         "__Pyx_CyFunction_Call. METH_OLDARGS is no "
  7819.                         "longer supported!");
  7820.         return NULL;
  7821.     }
  7822.     PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
  7823.                  f->m_ml->ml_name);
  7824.     return NULL;
  7825. }
  7826. #else
  7827. static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  7828.     return PyCFunction_Call(func, arg, kw);
  7829. }
  7830. #endif
  7831. static PyTypeObject __pyx_CyFunctionType_type = {
  7832.     PyVarObject_HEAD_INIT(0, 0)
  7833.     "cython_function_or_method",
  7834.     sizeof(__pyx_CyFunctionObject),
  7835.     0,
  7836.     (destructor) __Pyx_CyFunction_dealloc,
  7837.     0,
  7838.     0,
  7839.     0,
  7840. #if PY_MAJOR_VERSION < 3
  7841.     0,
  7842. #else
  7843.     0,
  7844. #endif
  7845.     (reprfunc) __Pyx_CyFunction_repr,
  7846.     0,
  7847.     0,
  7848.     0,
  7849.     0,
  7850.     __Pyx_CyFunction_Call,
  7851.     0,
  7852.     0,
  7853.     0,
  7854.     0,
  7855.     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
  7856.     0,
  7857.     (traverseproc) __Pyx_CyFunction_traverse,
  7858.     (inquiry) __Pyx_CyFunction_clear,
  7859.     0,
  7860. #if PY_VERSION_HEX < 0x030500A0
  7861.     offsetof(__pyx_CyFunctionObject, func_weakreflist),
  7862. #else
  7863.     offsetof(PyCFunctionObject, m_weakreflist),
  7864. #endif
  7865.     0,
  7866.     0,
  7867.     __pyx_CyFunction_methods,
  7868.     __pyx_CyFunction_members,
  7869.     __pyx_CyFunction_getsets,
  7870.     0,
  7871.     0,
  7872.     __Pyx_CyFunction_descr_get,
  7873.     0,
  7874.     offsetof(__pyx_CyFunctionObject, func_dict),
  7875.     0,
  7876.     0,
  7877.     0,
  7878.     0,
  7879.     0,
  7880.     0,
  7881.     0,
  7882.     0,
  7883.     0,
  7884.     0,
  7885.     0,
  7886.     0,
  7887. #if PY_VERSION_HEX >= 0x030400a1
  7888.     0,
  7889. #endif
  7890. };
  7891. static int __pyx_CyFunction_init(void) {
  7892. #if !CYTHON_COMPILING_IN_PYPY
  7893.     __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
  7894. #endif
  7895.     __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
  7896.     if (__pyx_CyFunctionType == NULL) {
  7897.         return -1;
  7898.     }
  7899.     return 0;
  7900. }
  7901. static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
  7902.     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  7903.     m->defaults = PyMem_Malloc(size);
  7904.     if (!m->defaults)
  7905.         return PyErr_NoMemory();
  7906.     memset(m->defaults, 0, size);
  7907.     m->defaults_pyobjects = pyobjects;
  7908.     return m->defaults;
  7909. }
  7910. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
  7911.     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  7912.     m->defaults_tuple = tuple;
  7913.     Py_INCREF(tuple);
  7914. }
  7915. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
  7916.     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  7917.     m->defaults_kwdict = dict;
  7918.     Py_INCREF(dict);
  7919. }
  7920. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
  7921.     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  7922.     m->func_annotations = dict;
  7923.     Py_INCREF(dict);
  7924. }
  7925.  
  7926. static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
  7927.                                            PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
  7928.     PyObject *ns;
  7929.     if (metaclass) {
  7930.         PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
  7931.         if (prep) {
  7932.             PyObject *pargs = PyTuple_Pack(2, name, bases);
  7933.             if (unlikely(!pargs)) {
  7934.                 Py_DECREF(prep);
  7935.                 return NULL;
  7936.             }
  7937.             ns = PyObject_Call(prep, pargs, mkw);
  7938.             Py_DECREF(prep);
  7939.             Py_DECREF(pargs);
  7940.         } else {
  7941.             if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
  7942.                 return NULL;
  7943.             PyErr_Clear();
  7944.             ns = PyDict_New();
  7945.         }
  7946.     } else {
  7947.         ns = PyDict_New();
  7948.     }
  7949.     if (unlikely(!ns))
  7950.         return NULL;
  7951.     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
  7952.     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
  7953.     if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
  7954.     return ns;
  7955. bad:
  7956.     Py_DECREF(ns);
  7957.     return NULL;
  7958. }
  7959. static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
  7960.                                       PyObject *dict, PyObject *mkw,
  7961.                                       int calculate_metaclass, int allow_py2_metaclass) {
  7962.     PyObject *result, *margs;
  7963.     PyObject *owned_metaclass = NULL;
  7964.     if (allow_py2_metaclass) {
  7965.         owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
  7966.         if (owned_metaclass) {
  7967.             metaclass = owned_metaclass;
  7968.         } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
  7969.             PyErr_Clear();
  7970.         } else {
  7971.             return NULL;
  7972.         }
  7973.     }
  7974.     if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
  7975.         metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
  7976.         Py_XDECREF(owned_metaclass);
  7977.         if (unlikely(!metaclass))
  7978.             return NULL;
  7979.         owned_metaclass = metaclass;
  7980.     }
  7981.     margs = PyTuple_Pack(3, name, bases, dict);
  7982.     if (unlikely(!margs)) {
  7983.         result = NULL;
  7984.     } else {
  7985.         result = PyObject_Call(metaclass, margs, mkw);
  7986.         Py_DECREF(margs);
  7987.     }
  7988.     Py_XDECREF(owned_metaclass);
  7989.     return result;
  7990. }
  7991.  
  7992. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  7993.     int start = 0, mid = 0, end = count - 1;
  7994.     if (end >= 0 && code_line > entries[end].code_line) {
  7995.         return count;
  7996.     }
  7997.     while (start < end) {
  7998.         mid = start + (end - start) / 2;
  7999.         if (code_line < entries[mid].code_line) {
  8000.             end = mid;
  8001.         } else if (code_line > entries[mid].code_line) {
  8002.              start = mid + 1;
  8003.         } else {
  8004.             return mid;
  8005.         }
  8006.     }
  8007.     if (code_line <= entries[mid].code_line) {
  8008.         return mid;
  8009.     } else {
  8010.         return mid + 1;
  8011.     }
  8012. }
  8013. static PyCodeObject *__pyx_find_code_object(int code_line) {
  8014.     PyCodeObject* code_object;
  8015.     int pos;
  8016.     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  8017.         return NULL;
  8018.     }
  8019.     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  8020.     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  8021.         return NULL;
  8022.     }
  8023.     code_object = __pyx_code_cache.entries[pos].code_object;
  8024.     Py_INCREF(code_object);
  8025.     return code_object;
  8026. }
  8027. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  8028.     int pos, i;
  8029.     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  8030.     if (unlikely(!code_line)) {
  8031.         return;
  8032.     }
  8033.     if (unlikely(!entries)) {
  8034.         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  8035.         if (likely(entries)) {
  8036.             __pyx_code_cache.entries = entries;
  8037.             __pyx_code_cache.max_count = 64;
  8038.             __pyx_code_cache.count = 1;
  8039.             entries[0].code_line = code_line;
  8040.             entries[0].code_object = code_object;
  8041.             Py_INCREF(code_object);
  8042.         }
  8043.         return;
  8044.     }
  8045.     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  8046.     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  8047.         PyCodeObject* tmp = entries[pos].code_object;
  8048.         entries[pos].code_object = code_object;
  8049.         Py_DECREF(tmp);
  8050.         return;
  8051.     }
  8052.     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  8053.         int new_max = __pyx_code_cache.max_count + 64;
  8054.         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  8055.             __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
  8056.         if (unlikely(!entries)) {
  8057.             return;
  8058.         }
  8059.         __pyx_code_cache.entries = entries;
  8060.         __pyx_code_cache.max_count = new_max;
  8061.     }
  8062.     for (i=__pyx_code_cache.count; i>pos; i--) {
  8063.         entries[i] = entries[i-1];
  8064.     }
  8065.     entries[pos].code_line = code_line;
  8066.     entries[pos].code_object = code_object;
  8067.     __pyx_code_cache.count++;
  8068.     Py_INCREF(code_object);
  8069. }
  8070.  
  8071. #include "compile.h"
  8072. #include "frameobject.h"
  8073. #include "traceback.h"
  8074. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  8075.             const char *funcname, int c_line,
  8076.             int py_line, const char *filename) {
  8077.     PyCodeObject *py_code = 0;
  8078.     PyObject *py_srcfile = 0;
  8079.     PyObject *py_funcname = 0;
  8080.     #if PY_MAJOR_VERSION < 3
  8081.     py_srcfile = PyString_FromString(filename);
  8082.     #else
  8083.     py_srcfile = PyUnicode_FromString(filename);
  8084.     #endif
  8085.     if (!py_srcfile) goto bad;
  8086.     if (c_line) {
  8087.         #if PY_MAJOR_VERSION < 3
  8088.         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  8089.         #else
  8090.         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  8091.         #endif
  8092.     }
  8093.     else {
  8094.         #if PY_MAJOR_VERSION < 3
  8095.         py_funcname = PyString_FromString(funcname);
  8096.         #else
  8097.         py_funcname = PyUnicode_FromString(funcname);
  8098.         #endif
  8099.     }
  8100.     if (!py_funcname) goto bad;
  8101.     py_code = __Pyx_PyCode_New(
  8102.         0,
  8103.         0,
  8104.         0,
  8105.         0,
  8106.         0,
  8107.         __pyx_empty_bytes, /*PyObject *code,*/
  8108.         __pyx_empty_tuple, /*PyObject *consts,*/
  8109.         __pyx_empty_tuple, /*PyObject *names,*/
  8110.         __pyx_empty_tuple, /*PyObject *varnames,*/
  8111.         __pyx_empty_tuple, /*PyObject *freevars,*/
  8112.         __pyx_empty_tuple, /*PyObject *cellvars,*/
  8113.         py_srcfile,   /*PyObject *filename,*/
  8114.         py_funcname,  /*PyObject *name,*/
  8115.         py_line,
  8116.         __pyx_empty_bytes  /*PyObject *lnotab*/
  8117.     );
  8118.     Py_DECREF(py_srcfile);
  8119.     Py_DECREF(py_funcname);
  8120.     return py_code;
  8121. bad:
  8122.     Py_XDECREF(py_srcfile);
  8123.     Py_XDECREF(py_funcname);
  8124.     return NULL;
  8125. }
  8126. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  8127.                                int py_line, const char *filename) {
  8128.     PyCodeObject *py_code = 0;
  8129.     PyFrameObject *py_frame = 0;
  8130.     py_code = __pyx_find_code_object(c_line ? c_line : py_line);
  8131.     if (!py_code) {
  8132.         py_code = __Pyx_CreateCodeObjectForTraceback(
  8133.             funcname, c_line, py_line, filename);
  8134.         if (!py_code) goto bad;
  8135.         __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
  8136.     }
  8137.     py_frame = PyFrame_New(
  8138.         PyThreadState_GET(), /*PyThreadState *tstate,*/
  8139.         py_code,             /*PyCodeObject *code,*/
  8140.         __pyx_d,      /*PyObject *globals,*/
  8141.         0                    /*PyObject *locals*/
  8142.     );
  8143.     if (!py_frame) goto bad;
  8144.     py_frame->f_lineno = py_line;
  8145.     PyTraceBack_Here(py_frame);
  8146. bad:
  8147.     Py_XDECREF(py_code);
  8148.     Py_XDECREF(py_frame);
  8149. }
  8150.  
  8151. #if PY_MAJOR_VERSION < 3
  8152. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  8153.     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
  8154.         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
  8155.     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
  8156.     return -1;
  8157. }
  8158. static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  8159.     PyObject *obj = view->obj;
  8160.     if (!obj) return;
  8161.     if (PyObject_CheckBuffer(obj)) {
  8162.         PyBuffer_Release(view);
  8163.         return;
  8164.     }
  8165.         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
  8166.     Py_DECREF(obj);
  8167.     view->obj = NULL;
  8168. }
  8169. #endif
  8170.  
  8171.  
  8172.             #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  8173.     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  8174. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  8175.     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  8176. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  8177.     {\
  8178.         func_type value = func_value;\
  8179.         if (sizeof(target_type) < sizeof(func_type)) {\
  8180.             if (unlikely(value != (func_type) (target_type) value)) {\
  8181.                 func_type zero = 0;\
  8182.                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  8183.                     return (target_type) -1;\
  8184.                 if (is_unsigned && unlikely(value < zero))\
  8185.                     goto raise_neg_overflow;\
  8186.                 else\
  8187.                     goto raise_overflow;\
  8188.             }\
  8189.         }\
  8190.         return (target_type) value;\
  8191.     }
  8192.  
  8193. static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) {
  8194.     const short neg_one = (short) -1, const_zero = (short) 0;
  8195.     const int is_unsigned = neg_one > const_zero;
  8196. #if PY_MAJOR_VERSION < 3
  8197.     if (likely(PyInt_Check(x))) {
  8198.         if (sizeof(short) < sizeof(long)) {
  8199.             __PYX_VERIFY_RETURN_INT(short, long, PyInt_AS_LONG(x))
  8200.         } else {
  8201.             long val = PyInt_AS_LONG(x);
  8202.             if (is_unsigned && unlikely(val < 0)) {
  8203.                 goto raise_neg_overflow;
  8204.             }
  8205.             return (short) val;
  8206.         }
  8207.     } else
  8208. #endif
  8209.     if (likely(PyLong_Check(x))) {
  8210.         if (is_unsigned) {
  8211. #if CYTHON_USE_PYLONG_INTERNALS
  8212.             const digit* digits = ((PyLongObject*)x)->ob_digit;
  8213.             switch (Py_SIZE(x)) {
  8214.                 case  0: return (short) 0;
  8215.                 case  1: __PYX_VERIFY_RETURN_INT(short, digit, digits[0])
  8216.                 case 2:
  8217.                     if (8 * sizeof(short) > 1 * PyLong_SHIFT) {
  8218.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  8219.                             __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8220.                         } else if (8 * sizeof(short) >= 2 * PyLong_SHIFT) {
  8221.                             return (short) (((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
  8222.                         }
  8223.                     }
  8224.                     break;
  8225.                 case 3:
  8226.                     if (8 * sizeof(short) > 2 * PyLong_SHIFT) {
  8227.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  8228.                             __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8229.                         } else if (8 * sizeof(short) >= 3 * PyLong_SHIFT) {
  8230.                             return (short) (((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
  8231.                         }
  8232.                     }
  8233.                     break;
  8234.                 case 4:
  8235.                     if (8 * sizeof(short) > 3 * PyLong_SHIFT) {
  8236.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  8237.                             __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8238.                         } else if (8 * sizeof(short) >= 4 * PyLong_SHIFT) {
  8239.                             return (short) (((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
  8240.                         }
  8241.                     }
  8242.                     break;
  8243.             }
  8244. #endif
  8245. #if CYTHON_COMPILING_IN_CPYTHON
  8246.             if (unlikely(Py_SIZE(x) < 0)) {
  8247.                 goto raise_neg_overflow;
  8248.             }
  8249. #else
  8250.             {
  8251.                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  8252.                 if (unlikely(result < 0))
  8253.                     return (short) -1;
  8254.                 if (unlikely(result == 1))
  8255.                     goto raise_neg_overflow;
  8256.             }
  8257. #endif
  8258.             if (sizeof(short) <= sizeof(unsigned long)) {
  8259.                 __PYX_VERIFY_RETURN_INT_EXC(short, unsigned long, PyLong_AsUnsignedLong(x))
  8260.             } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) {
  8261.                 __PYX_VERIFY_RETURN_INT_EXC(short, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  8262.             }
  8263.         } else {
  8264. #if CYTHON_USE_PYLONG_INTERNALS
  8265.             const digit* digits = ((PyLongObject*)x)->ob_digit;
  8266.             switch (Py_SIZE(x)) {
  8267.                 case  0: return (short) 0;
  8268.                 case -1: __PYX_VERIFY_RETURN_INT(short, sdigit, -(sdigit) digits[0])
  8269.                 case  1: __PYX_VERIFY_RETURN_INT(short,  digit, +digits[0])
  8270.                 case -2:
  8271.                     if (8 * sizeof(short) - 1 > 1 * PyLong_SHIFT) {
  8272.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  8273.                             __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8274.                         } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
  8275.                             return (short) (((short)-1)*(((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
  8276.                         }
  8277.                     }
  8278.                     break;
  8279.                 case 2:
  8280.                     if (8 * sizeof(short) > 1 * PyLong_SHIFT) {
  8281.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  8282.                             __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8283.                         } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
  8284.                             return (short) ((((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
  8285.                         }
  8286.                     }
  8287.                     break;
  8288.                 case -3:
  8289.                     if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
  8290.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  8291.                             __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8292.                         } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
  8293.                             return (short) (((short)-1)*(((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
  8294.                         }
  8295.                     }
  8296.                     break;
  8297.                 case 3:
  8298.                     if (8 * sizeof(short) > 2 * PyLong_SHIFT) {
  8299.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  8300.                             __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8301.                         } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
  8302.                             return (short) ((((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
  8303.                         }
  8304.                     }
  8305.                     break;
  8306.                 case -4:
  8307.                     if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
  8308.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  8309.                             __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8310.                         } else if (8 * sizeof(short) - 1 > 4 * PyLong_SHIFT) {
  8311.                             return (short) (((short)-1)*(((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
  8312.                         }
  8313.                     }
  8314.                     break;
  8315.                 case 4:
  8316.                     if (8 * sizeof(short) > 3 * PyLong_SHIFT) {
  8317.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  8318.                             __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8319.                         } else if (8 * sizeof(short) - 1 > 4 * PyLong_SHIFT) {
  8320.                             return (short) ((((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
  8321.                         }
  8322.                     }
  8323.                     break;
  8324.             }
  8325. #endif
  8326.             if (sizeof(short) <= sizeof(long)) {
  8327.                 __PYX_VERIFY_RETURN_INT_EXC(short, long, PyLong_AsLong(x))
  8328.             } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) {
  8329.                 __PYX_VERIFY_RETURN_INT_EXC(short, PY_LONG_LONG, PyLong_AsLongLong(x))
  8330.             }
  8331.         }
  8332.         {
  8333. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  8334.             PyErr_SetString(PyExc_RuntimeError,
  8335.                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  8336. #else
  8337.             short val;
  8338.             PyObject *v = __Pyx_PyNumber_Int(x);
  8339.  #if PY_MAJOR_VERSION < 3
  8340.             if (likely(v) && !PyLong_Check(v)) {
  8341.                 PyObject *tmp = v;
  8342.                 v = PyNumber_Long(tmp);
  8343.                 Py_DECREF(tmp);
  8344.             }
  8345.  #endif
  8346.             if (likely(v)) {
  8347.                 int one = 1; int is_little = (int)*(unsigned char *)&one;
  8348.                 unsigned char *bytes = (unsigned char *)&val;
  8349.                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
  8350.                                               bytes, sizeof(val),
  8351.                                               is_little, !is_unsigned);
  8352.                 Py_DECREF(v);
  8353.                 if (likely(!ret))
  8354.                     return val;
  8355.             }
  8356. #endif
  8357.             return (short) -1;
  8358.         }
  8359.     } else {
  8360.         short val;
  8361.         PyObject *tmp = __Pyx_PyNumber_Int(x);
  8362.         if (!tmp) return (short) -1;
  8363.         val = __Pyx_PyInt_As_short(tmp);
  8364.         Py_DECREF(tmp);
  8365.         return val;
  8366.     }
  8367. raise_overflow:
  8368.     PyErr_SetString(PyExc_OverflowError,
  8369.         "value too large to convert to short");
  8370.     return (short) -1;
  8371. raise_neg_overflow:
  8372.     PyErr_SetString(PyExc_OverflowError,
  8373.         "can't convert negative value to short");
  8374.     return (short) -1;
  8375. }
  8376.  
  8377. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  8378.     const int neg_one = (int) -1, const_zero = (int) 0;
  8379.     const int is_unsigned = neg_one > const_zero;
  8380. #if PY_MAJOR_VERSION < 3
  8381.     if (likely(PyInt_Check(x))) {
  8382.         if (sizeof(int) < sizeof(long)) {
  8383.             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
  8384.         } else {
  8385.             long val = PyInt_AS_LONG(x);
  8386.             if (is_unsigned && unlikely(val < 0)) {
  8387.                 goto raise_neg_overflow;
  8388.             }
  8389.             return (int) val;
  8390.         }
  8391.     } else
  8392. #endif
  8393.     if (likely(PyLong_Check(x))) {
  8394.         if (is_unsigned) {
  8395. #if CYTHON_USE_PYLONG_INTERNALS
  8396.             const digit* digits = ((PyLongObject*)x)->ob_digit;
  8397.             switch (Py_SIZE(x)) {
  8398.                 case  0: return (int) 0;
  8399.                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
  8400.                 case 2:
  8401.                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  8402.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  8403.                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8404.                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
  8405.                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  8406.                         }
  8407.                     }
  8408.                     break;
  8409.                 case 3:
  8410.                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  8411.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  8412.                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8413.                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
  8414.                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  8415.                         }
  8416.                     }
  8417.                     break;
  8418.                 case 4:
  8419.                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  8420.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  8421.                             __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])))
  8422.                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
  8423.                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  8424.                         }
  8425.                     }
  8426.                     break;
  8427.             }
  8428. #endif
  8429. #if CYTHON_COMPILING_IN_CPYTHON
  8430.             if (unlikely(Py_SIZE(x) < 0)) {
  8431.                 goto raise_neg_overflow;
  8432.             }
  8433. #else
  8434.             {
  8435.                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  8436.                 if (unlikely(result < 0))
  8437.                     return (int) -1;
  8438.                 if (unlikely(result == 1))
  8439.                     goto raise_neg_overflow;
  8440.             }
  8441. #endif
  8442.             if (sizeof(int) <= sizeof(unsigned long)) {
  8443.                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  8444.             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  8445.                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  8446.             }
  8447.         } else {
  8448. #if CYTHON_USE_PYLONG_INTERNALS
  8449.             const digit* digits = ((PyLongObject*)x)->ob_digit;
  8450.             switch (Py_SIZE(x)) {
  8451.                 case  0: return (int) 0;
  8452.                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) digits[0])
  8453.                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
  8454.                 case -2:
  8455.                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
  8456.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  8457.                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8458.                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  8459.                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  8460.                         }
  8461.                     }
  8462.                     break;
  8463.                 case 2:
  8464.                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  8465.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  8466.                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8467.                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  8468.                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  8469.                         }
  8470.                     }
  8471.                     break;
  8472.                 case -3:
  8473.                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  8474.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  8475.                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8476.                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  8477.                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  8478.                         }
  8479.                     }
  8480.                     break;
  8481.                 case 3:
  8482.                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  8483.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  8484.                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  8485.                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  8486.                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  8487.                         }
  8488.                     }
  8489.                     break;
  8490.                 case -4:
  8491.                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  8492.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  8493.                             __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])))
  8494.                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  8495.                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  8496.                         }
  8497.                     }
  8498.                     break;
  8499.                 case 4:
  8500.                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  8501.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  8502.                             __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])))
  8503.                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  8504.                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  8505.                         }
  8506.                     }
  8507.                     break;
  8508.             }
  8509. #endif
  8510.             if (sizeof(int) <= sizeof(long)) {
  8511.                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  8512.             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  8513.                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  8514.             }
  8515.         }
  8516.         {
  8517. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  8518.             PyErr_SetString(PyExc_RuntimeError,
  8519.                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  8520. #else
  8521.             int val;
  8522.             PyObject *v = __Pyx_PyNumber_Int(x);
  8523.  #if PY_MAJOR_VERSION < 3
  8524.             if (likely(v) && !PyLong_Check(v)) {
  8525.                 PyObject *tmp = v;
  8526.                 v = PyNumber_Long(tmp);
  8527.                 Py_DECREF(tmp);
  8528.             }
  8529.  #endif
  8530.             if (likely(v)) {
  8531.                 int one = 1; int is_little = (int)*(unsigned char *)&one;
  8532.                 unsigned char *bytes = (unsigned char *)&val;
  8533.                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
  8534.                                               bytes, sizeof(val),
  8535.                                               is_little, !is_unsigned);
  8536.                 Py_DECREF(v);
  8537.                 if (likely(!ret))
  8538.                     return val;
  8539.             }
  8540. #endif
  8541.             return (int) -1;
  8542.         }
  8543.     } else {
  8544.         int val;
  8545.         PyObject *tmp = __Pyx_PyNumber_Int(x);
  8546.         if (!tmp) return (int) -1;
  8547.         val = __Pyx_PyInt_As_int(tmp);
  8548.         Py_DECREF(tmp);
  8549.         return val;
  8550.     }
  8551. raise_overflow:
  8552.     PyErr_SetString(PyExc_OverflowError,
  8553.         "value too large to convert to int");
  8554.     return (int) -1;
  8555. raise_neg_overflow:
  8556.     PyErr_SetString(PyExc_OverflowError,
  8557.         "can't convert negative value to int");
  8558.     return (int) -1;
  8559. }
  8560.  
  8561. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_short(unsigned short value) {
  8562.     const unsigned short neg_one = (unsigned short) -1, const_zero = (unsigned short) 0;
  8563.     const int is_unsigned = neg_one > const_zero;
  8564.     if (is_unsigned) {
  8565.         if (sizeof(unsigned short) < sizeof(long)) {
  8566.             return PyInt_FromLong((long) value);
  8567.         } else if (sizeof(unsigned short) <= sizeof(unsigned long)) {
  8568.             return PyLong_FromUnsignedLong((unsigned long) value);
  8569.         } else if (sizeof(unsigned short) <= sizeof(unsigned PY_LONG_LONG)) {
  8570.             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  8571.         }
  8572.     } else {
  8573.         if (sizeof(unsigned short) <= sizeof(long)) {
  8574.             return PyInt_FromLong((long) value);
  8575.         } else if (sizeof(unsigned short) <= sizeof(PY_LONG_LONG)) {
  8576.             return PyLong_FromLongLong((PY_LONG_LONG) value);
  8577.         }
  8578.     }
  8579.     {
  8580.         int one = 1; int little = (int)*(unsigned char *)&one;
  8581.         unsigned char *bytes = (unsigned char *)&value;
  8582.         return _PyLong_FromByteArray(bytes, sizeof(unsigned short),
  8583.                                      little, !is_unsigned);
  8584.     }
  8585. }
  8586.  
  8587. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
  8588.     const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
  8589.     const int is_unsigned = neg_one > const_zero;
  8590.     if (is_unsigned) {
  8591.         if (sizeof(Py_intptr_t) < sizeof(long)) {
  8592.             return PyInt_FromLong((long) value);
  8593.         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
  8594.             return PyLong_FromUnsignedLong((unsigned long) value);
  8595.         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
  8596.             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  8597.         }
  8598.     } else {
  8599.         if (sizeof(Py_intptr_t) <= sizeof(long)) {
  8600.             return PyInt_FromLong((long) value);
  8601.         } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
  8602.             return PyLong_FromLongLong((PY_LONG_LONG) value);
  8603.         }
  8604.     }
  8605.     {
  8606.         int one = 1; int little = (int)*(unsigned char *)&one;
  8607.         unsigned char *bytes = (unsigned char *)&value;
  8608.         return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
  8609.                                      little, !is_unsigned);
  8610.     }
  8611. }
  8612.  
  8613. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value) {
  8614.     const short neg_one = (short) -1, const_zero = (short) 0;
  8615.     const int is_unsigned = neg_one > const_zero;
  8616.     if (is_unsigned) {
  8617.         if (sizeof(short) < sizeof(long)) {
  8618.             return PyInt_FromLong((long) value);
  8619.         } else if (sizeof(short) <= sizeof(unsigned long)) {
  8620.             return PyLong_FromUnsignedLong((unsigned long) value);
  8621.         } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) {
  8622.             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  8623.         }
  8624.     } else {
  8625.         if (sizeof(short) <= sizeof(long)) {
  8626.             return PyInt_FromLong((long) value);
  8627.         } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) {
  8628.             return PyLong_FromLongLong((PY_LONG_LONG) value);
  8629.         }
  8630.     }
  8631.     {
  8632.         int one = 1; int little = (int)*(unsigned char *)&one;
  8633.         unsigned char *bytes = (unsigned char *)&value;
  8634.         return _PyLong_FromByteArray(bytes, sizeof(short),
  8635.                                      little, !is_unsigned);
  8636.     }
  8637. }
  8638.  
  8639. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
  8640. static PyObject *__Pyx_GetStdout(void) {
  8641.     PyObject *f = PySys_GetObject((char *)"stdout");
  8642.     if (!f) {
  8643.         PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
  8644.     }
  8645.     return f;
  8646. }
  8647. static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
  8648.     int i;
  8649.     if (!f) {
  8650.         if (!(f = __Pyx_GetStdout()))
  8651.             return -1;
  8652.     }
  8653.     Py_INCREF(f);
  8654.     for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
  8655.         PyObject* v;
  8656.         if (PyFile_SoftSpace(f, 1)) {
  8657.             if (PyFile_WriteString(" ", f) < 0)
  8658.                 goto error;
  8659.         }
  8660.         v = PyTuple_GET_ITEM(arg_tuple, i);
  8661.         if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
  8662.             goto error;
  8663.         if (PyString_Check(v)) {
  8664.             char *s = PyString_AsString(v);
  8665.             Py_ssize_t len = PyString_Size(v);
  8666.             if (len > 0) {
  8667.                 switch (s[len-1]) {
  8668.                     case ' ': break;
  8669.                     case '\f': case '\r': case '\n': case '\t': case '\v':
  8670.                         PyFile_SoftSpace(f, 0);
  8671.                         break;
  8672.                     default:  break;
  8673.                 }
  8674.             }
  8675.         }
  8676.     }
  8677.     if (newline) {
  8678.         if (PyFile_WriteString("\n", f) < 0)
  8679.             goto error;
  8680.         PyFile_SoftSpace(f, 0);
  8681.     }
  8682.     Py_DECREF(f);
  8683.     return 0;
  8684. error:
  8685.     Py_DECREF(f);
  8686.     return -1;
  8687. }
  8688. #else
  8689. static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
  8690.     PyObject* kwargs = 0;
  8691.     PyObject* result = 0;
  8692.     PyObject* end_string;
  8693.     if (unlikely(!__pyx_print)) {
  8694.         __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
  8695.         if (!__pyx_print)
  8696.             return -1;
  8697.     }
  8698.     if (stream) {
  8699.         kwargs = PyDict_New();
  8700.         if (unlikely(!kwargs))
  8701.             return -1;
  8702.         if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
  8703.             goto bad;
  8704.         if (!newline) {
  8705.             end_string = PyUnicode_FromStringAndSize(" ", 1);
  8706.             if (unlikely(!end_string))
  8707.                 goto bad;
  8708.             if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
  8709.                 Py_DECREF(end_string);
  8710.                 goto bad;
  8711.             }
  8712.             Py_DECREF(end_string);
  8713.         }
  8714.     } else if (!newline) {
  8715.         if (unlikely(!__pyx_print_kwargs)) {
  8716.             __pyx_print_kwargs = PyDict_New();
  8717.             if (unlikely(!__pyx_print_kwargs))
  8718.                 return -1;
  8719.             end_string = PyUnicode_FromStringAndSize(" ", 1);
  8720.             if (unlikely(!end_string))
  8721.                 return -1;
  8722.             if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
  8723.                 Py_DECREF(end_string);
  8724.                 return -1;
  8725.             }
  8726.             Py_DECREF(end_string);
  8727.         }
  8728.         kwargs = __pyx_print_kwargs;
  8729.     }
  8730.     result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
  8731.     if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
  8732.         Py_DECREF(kwargs);
  8733.     if (!result)
  8734.         return -1;
  8735.     Py_DECREF(result);
  8736.     return 0;
  8737. bad:
  8738.     if (kwargs != __pyx_print_kwargs)
  8739.         Py_XDECREF(kwargs);
  8740.     return -1;
  8741. }
  8742. #endif
  8743.  
  8744. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
  8745. static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
  8746.     if (!f) {
  8747.         if (!(f = __Pyx_GetStdout()))
  8748.             return -1;
  8749.     }
  8750.     Py_INCREF(f);
  8751.     if (PyFile_SoftSpace(f, 0)) {
  8752.         if (PyFile_WriteString(" ", f) < 0)
  8753.             goto error;
  8754.     }
  8755.     if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
  8756.         goto error;
  8757.     if (PyFile_WriteString("\n", f) < 0)
  8758.         goto error;
  8759.     Py_DECREF(f);
  8760.     return 0;
  8761. error:
  8762.     Py_DECREF(f);
  8763.     return -1;
  8764.     /* the line below is just to avoid C compiler
  8765.      * warnings about unused functions */
  8766.     return __Pyx_Print(f, NULL, 0);
  8767. }
  8768. #else
  8769. static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
  8770.     int res;
  8771.     PyObject* arg_tuple = PyTuple_Pack(1, o);
  8772.     if (unlikely(!arg_tuple))
  8773.         return -1;
  8774.     res = __Pyx_Print(stream, arg_tuple, 1);
  8775.     Py_DECREF(arg_tuple);
  8776.     return res;
  8777. }
  8778. #endif
  8779.  
  8780. #if CYTHON_CCOMPLEX
  8781.   #ifdef __cplusplus
  8782.     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  8783.       return ::std::complex< float >(x, y);
  8784.     }
  8785.   #else
  8786.     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  8787.       return x + y*(__pyx_t_float_complex)_Complex_I;
  8788.     }
  8789.   #endif
  8790. #else
  8791.     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  8792.       __pyx_t_float_complex z;
  8793.       z.real = x;
  8794.       z.imag = y;
  8795.       return z;
  8796.     }
  8797. #endif
  8798.  
  8799. #if CYTHON_CCOMPLEX
  8800. #else
  8801.     static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  8802.        return (a.real == b.real) && (a.imag == b.imag);
  8803.     }
  8804.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  8805.         __pyx_t_float_complex z;
  8806.         z.real = a.real + b.real;
  8807.         z.imag = a.imag + b.imag;
  8808.         return z;
  8809.     }
  8810.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  8811.         __pyx_t_float_complex z;
  8812.         z.real = a.real - b.real;
  8813.         z.imag = a.imag - b.imag;
  8814.         return z;
  8815.     }
  8816.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  8817.         __pyx_t_float_complex z;
  8818.         z.real = a.real * b.real - a.imag * b.imag;
  8819.         z.imag = a.real * b.imag + a.imag * b.real;
  8820.         return z;
  8821.     }
  8822.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  8823.         __pyx_t_float_complex z;
  8824.         float denom = b.real * b.real + b.imag * b.imag;
  8825.         z.real = (a.real * b.real + a.imag * b.imag) / denom;
  8826.         z.imag = (a.imag * b.real - a.real * b.imag) / denom;
  8827.         return z;
  8828.     }
  8829.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
  8830.         __pyx_t_float_complex z;
  8831.         z.real = -a.real;
  8832.         z.imag = -a.imag;
  8833.         return z;
  8834.     }
  8835.     static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
  8836.        return (a.real == 0) && (a.imag == 0);
  8837.     }
  8838.     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
  8839.         __pyx_t_float_complex z;
  8840.         z.real =  a.real;
  8841.         z.imag = -a.imag;
  8842.         return z;
  8843.     }
  8844.     #if 1
  8845.         static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
  8846.           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  8847.             return sqrtf(z.real*z.real + z.imag*z.imag);
  8848.           #else
  8849.             return hypotf(z.real, z.imag);
  8850.           #endif
  8851.         }
  8852.         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  8853.             __pyx_t_float_complex z;
  8854.             float r, lnr, theta, z_r, z_theta;
  8855.             if (b.imag == 0 && b.real == (int)b.real) {
  8856.                 if (b.real < 0) {
  8857.                     float denom = a.real * a.real + a.imag * a.imag;
  8858.                     a.real = a.real / denom;
  8859.                     a.imag = -a.imag / denom;
  8860.                     b.real = -b.real;
  8861.                 }
  8862.                 switch ((int)b.real) {
  8863.                     case 0:
  8864.                         z.real = 1;
  8865.                         z.imag = 0;
  8866.                         return z;
  8867.                     case 1:
  8868.                         return a;
  8869.                     case 2:
  8870.                         z = __Pyx_c_prodf(a, a);
  8871.                         return __Pyx_c_prodf(a, a);
  8872.                     case 3:
  8873.                         z = __Pyx_c_prodf(a, a);
  8874.                         return __Pyx_c_prodf(z, a);
  8875.                     case 4:
  8876.                         z = __Pyx_c_prodf(a, a);
  8877.                         return __Pyx_c_prodf(z, z);
  8878.                 }
  8879.             }
  8880.             if (a.imag == 0) {
  8881.                 if (a.real == 0) {
  8882.                     return a;
  8883.                 }
  8884.                 r = a.real;
  8885.                 theta = 0;
  8886.             } else {
  8887.                 r = __Pyx_c_absf(a);
  8888.                 theta = atan2f(a.imag, a.real);
  8889.             }
  8890.             lnr = logf(r);
  8891.             z_r = expf(lnr * b.real - theta * b.imag);
  8892.             z_theta = theta * b.real + lnr * b.imag;
  8893.             z.real = z_r * cosf(z_theta);
  8894.             z.imag = z_r * sinf(z_theta);
  8895.             return z;
  8896.         }
  8897.     #endif
  8898. #endif
  8899.  
  8900. #if CYTHON_CCOMPLEX
  8901.   #ifdef __cplusplus
  8902.     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  8903.       return ::std::complex< double >(x, y);
  8904.     }
  8905.   #else
  8906.     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  8907.       return x + y*(__pyx_t_double_complex)_Complex_I;
  8908.     }
  8909.   #endif
  8910. #else
  8911.     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  8912.       __pyx_t_double_complex z;
  8913.       z.real = x;
  8914.       z.imag = y;
  8915.       return z;
  8916.     }
  8917. #endif
  8918.  
  8919. #if CYTHON_CCOMPLEX
  8920. #else
  8921.     static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  8922.        return (a.real == b.real) && (a.imag == b.imag);
  8923.     }
  8924.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  8925.         __pyx_t_double_complex z;
  8926.         z.real = a.real + b.real;
  8927.         z.imag = a.imag + b.imag;
  8928.         return z;
  8929.     }
  8930.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  8931.         __pyx_t_double_complex z;
  8932.         z.real = a.real - b.real;
  8933.         z.imag = a.imag - b.imag;
  8934.         return z;
  8935.     }
  8936.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  8937.         __pyx_t_double_complex z;
  8938.         z.real = a.real * b.real - a.imag * b.imag;
  8939.         z.imag = a.real * b.imag + a.imag * b.real;
  8940.         return z;
  8941.     }
  8942.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  8943.         __pyx_t_double_complex z;
  8944.         double denom = b.real * b.real + b.imag * b.imag;
  8945.         z.real = (a.real * b.real + a.imag * b.imag) / denom;
  8946.         z.imag = (a.imag * b.real - a.real * b.imag) / denom;
  8947.         return z;
  8948.     }
  8949.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
  8950.         __pyx_t_double_complex z;
  8951.         z.real = -a.real;
  8952.         z.imag = -a.imag;
  8953.         return z;
  8954.     }
  8955.     static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
  8956.        return (a.real == 0) && (a.imag == 0);
  8957.     }
  8958.     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
  8959.         __pyx_t_double_complex z;
  8960.         z.real =  a.real;
  8961.         z.imag = -a.imag;
  8962.         return z;
  8963.     }
  8964.     #if 1
  8965.         static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
  8966.           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  8967.             return sqrt(z.real*z.real + z.imag*z.imag);
  8968.           #else
  8969.             return hypot(z.real, z.imag);
  8970.           #endif
  8971.         }
  8972.         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  8973.             __pyx_t_double_complex z;
  8974.             double r, lnr, theta, z_r, z_theta;
  8975.             if (b.imag == 0 && b.real == (int)b.real) {
  8976.                 if (b.real < 0) {
  8977.                     double denom = a.real * a.real + a.imag * a.imag;
  8978.                     a.real = a.real / denom;
  8979.                     a.imag = -a.imag / denom;
  8980.                     b.real = -b.real;
  8981.                 }
  8982.                 switch ((int)b.real) {
  8983.                     case 0:
  8984.                         z.real = 1;
  8985.                         z.imag = 0;
  8986.                         return z;
  8987.                     case 1:
  8988.                         return a;
  8989.                     case 2:
  8990.                         z = __Pyx_c_prod(a, a);
  8991.                         return __Pyx_c_prod(a, a);
  8992.                     case 3:
  8993.                         z = __Pyx_c_prod(a, a);
  8994.                         return __Pyx_c_prod(z, a);
  8995.                     case 4:
  8996.                         z = __Pyx_c_prod(a, a);
  8997.                         return __Pyx_c_prod(z, z);
  8998.                 }
  8999.             }
  9000.             if (a.imag == 0) {
  9001.                 if (a.real == 0) {
  9002.                     return a;
  9003.                 }
  9004.                 r = a.real;
  9005.                 theta = 0;
  9006.             } else {
  9007.                 r = __Pyx_c_abs(a);
  9008.                 theta = atan2(a.imag, a.real);
  9009.             }
  9010.             lnr = log(r);
  9011.             z_r = exp(lnr * b.real - theta * b.imag);
  9012.             z_theta = theta * b.real + lnr * b.imag;
  9013.             z.real = z_r * cos(z_theta);
  9014.             z.imag = z_r * sin(z_theta);
  9015.             return z;
  9016.         }
  9017.     #endif
  9018. #endif
  9019.  
  9020. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  9021.     const int neg_one = (int) -1, const_zero = (int) 0;
  9022.     const int is_unsigned = neg_one > const_zero;
  9023.     if (is_unsigned) {
  9024.         if (sizeof(int) < sizeof(long)) {
  9025.             return PyInt_FromLong((long) value);
  9026.         } else if (sizeof(int) <= sizeof(unsigned long)) {
  9027.             return PyLong_FromUnsignedLong((unsigned long) value);
  9028.         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  9029.             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  9030.         }
  9031.     } else {
  9032.         if (sizeof(int) <= sizeof(long)) {
  9033.             return PyInt_FromLong((long) value);
  9034.         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  9035.             return PyLong_FromLongLong((PY_LONG_LONG) value);
  9036.         }
  9037.     }
  9038.     {
  9039.         int one = 1; int little = (int)*(unsigned char *)&one;
  9040.         unsigned char *bytes = (unsigned char *)&value;
  9041.         return _PyLong_FromByteArray(bytes, sizeof(int),
  9042.                                      little, !is_unsigned);
  9043.     }
  9044. }
  9045.  
  9046. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
  9047.     const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0;
  9048.     const int is_unsigned = neg_one > const_zero;
  9049.     if (is_unsigned) {
  9050.         if (sizeof(enum NPY_TYPES) < sizeof(long)) {
  9051.             return PyInt_FromLong((long) value);
  9052.         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
  9053.             return PyLong_FromUnsignedLong((unsigned long) value);
  9054.         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
  9055.             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  9056.         }
  9057.     } else {
  9058.         if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
  9059.             return PyInt_FromLong((long) value);
  9060.         } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
  9061.             return PyLong_FromLongLong((PY_LONG_LONG) value);
  9062.         }
  9063.     }
  9064.     {
  9065.         int one = 1; int little = (int)*(unsigned char *)&one;
  9066.         unsigned char *bytes = (unsigned char *)&value;
  9067.         return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
  9068.                                      little, !is_unsigned);
  9069.     }
  9070. }
  9071.  
  9072. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  9073.     const long neg_one = (long) -1, const_zero = (long) 0;
  9074.     const int is_unsigned = neg_one > const_zero;
  9075.     if (is_unsigned) {
  9076.         if (sizeof(long) < sizeof(long)) {
  9077.             return PyInt_FromLong((long) value);
  9078.         } else if (sizeof(long) <= sizeof(unsigned long)) {
  9079.             return PyLong_FromUnsignedLong((unsigned long) value);
  9080.         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  9081.             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  9082.         }
  9083.     } else {
  9084.         if (sizeof(long) <= sizeof(long)) {
  9085.             return PyInt_FromLong((long) value);
  9086.         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  9087.             return PyLong_FromLongLong((PY_LONG_LONG) value);
  9088.         }
  9089.     }
  9090.     {
  9091.         int one = 1; int little = (int)*(unsigned char *)&one;
  9092.         unsigned char *bytes = (unsigned char *)&value;
  9093.         return _PyLong_FromByteArray(bytes, sizeof(long),
  9094.                                      little, !is_unsigned);
  9095.     }
  9096. }
  9097.  
  9098. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  9099.     const long neg_one = (long) -1, const_zero = (long) 0;
  9100.     const int is_unsigned = neg_one > const_zero;
  9101. #if PY_MAJOR_VERSION < 3
  9102.     if (likely(PyInt_Check(x))) {
  9103.         if (sizeof(long) < sizeof(long)) {
  9104.             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
  9105.         } else {
  9106.             long val = PyInt_AS_LONG(x);
  9107.             if (is_unsigned && unlikely(val < 0)) {
  9108.                 goto raise_neg_overflow;
  9109.             }
  9110.             return (long) val;
  9111.         }
  9112.     } else
  9113. #endif
  9114.     if (likely(PyLong_Check(x))) {
  9115.         if (is_unsigned) {
  9116. #if CYTHON_USE_PYLONG_INTERNALS
  9117.             const digit* digits = ((PyLongObject*)x)->ob_digit;
  9118.             switch (Py_SIZE(x)) {
  9119.                 case  0: return (long) 0;
  9120.                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
  9121.                 case 2:
  9122.                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  9123.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  9124.                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9125.                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
  9126.                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  9127.                         }
  9128.                     }
  9129.                     break;
  9130.                 case 3:
  9131.                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  9132.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  9133.                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9134.                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
  9135.                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  9136.                         }
  9137.                     }
  9138.                     break;
  9139.                 case 4:
  9140.                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  9141.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  9142.                             __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])))
  9143.                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
  9144.                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  9145.                         }
  9146.                     }
  9147.                     break;
  9148.             }
  9149. #endif
  9150. #if CYTHON_COMPILING_IN_CPYTHON
  9151.             if (unlikely(Py_SIZE(x) < 0)) {
  9152.                 goto raise_neg_overflow;
  9153.             }
  9154. #else
  9155.             {
  9156.                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  9157.                 if (unlikely(result < 0))
  9158.                     return (long) -1;
  9159.                 if (unlikely(result == 1))
  9160.                     goto raise_neg_overflow;
  9161.             }
  9162. #endif
  9163.             if (sizeof(long) <= sizeof(unsigned long)) {
  9164.                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  9165.             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  9166.                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  9167.             }
  9168.         } else {
  9169. #if CYTHON_USE_PYLONG_INTERNALS
  9170.             const digit* digits = ((PyLongObject*)x)->ob_digit;
  9171.             switch (Py_SIZE(x)) {
  9172.                 case  0: return (long) 0;
  9173.                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) digits[0])
  9174.                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
  9175.                 case -2:
  9176.                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
  9177.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  9178.                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9179.                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  9180.                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  9181.                         }
  9182.                     }
  9183.                     break;
  9184.                 case 2:
  9185.                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  9186.                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  9187.                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9188.                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  9189.                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  9190.                         }
  9191.                     }
  9192.                     break;
  9193.                 case -3:
  9194.                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  9195.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  9196.                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9197.                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  9198.                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  9199.                         }
  9200.                     }
  9201.                     break;
  9202.                 case 3:
  9203.                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  9204.                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  9205.                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9206.                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  9207.                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  9208.                         }
  9209.                     }
  9210.                     break;
  9211.                 case -4:
  9212.                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  9213.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  9214.                             __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])))
  9215.                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  9216.                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  9217.                         }
  9218.                     }
  9219.                     break;
  9220.                 case 4:
  9221.                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  9222.                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  9223.                             __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])))
  9224.                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  9225.                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  9226.                         }
  9227.                     }
  9228.                     break;
  9229.             }
  9230. #endif
  9231.             if (sizeof(long) <= sizeof(long)) {
  9232.                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  9233.             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  9234.                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  9235.             }
  9236.         }
  9237.         {
  9238. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  9239.             PyErr_SetString(PyExc_RuntimeError,
  9240.                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  9241. #else
  9242.             long val;
  9243.             PyObject *v = __Pyx_PyNumber_Int(x);
  9244.  #if PY_MAJOR_VERSION < 3
  9245.             if (likely(v) && !PyLong_Check(v)) {
  9246.                 PyObject *tmp = v;
  9247.                 v = PyNumber_Long(tmp);
  9248.                 Py_DECREF(tmp);
  9249.             }
  9250.  #endif
  9251.             if (likely(v)) {
  9252.                 int one = 1; int is_little = (int)*(unsigned char *)&one;
  9253.                 unsigned char *bytes = (unsigned char *)&val;
  9254.                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
  9255.                                               bytes, sizeof(val),
  9256.                                               is_little, !is_unsigned);
  9257.                 Py_DECREF(v);
  9258.                 if (likely(!ret))
  9259.                     return val;
  9260.             }
  9261. #endif
  9262.             return (long) -1;
  9263.         }
  9264.     } else {
  9265.         long val;
  9266.         PyObject *tmp = __Pyx_PyNumber_Int(x);
  9267.         if (!tmp) return (long) -1;
  9268.         val = __Pyx_PyInt_As_long(tmp);
  9269.         Py_DECREF(tmp);
  9270.         return val;
  9271.     }
  9272. raise_overflow:
  9273.     PyErr_SetString(PyExc_OverflowError,
  9274.         "value too large to convert to long");
  9275.     return (long) -1;
  9276. raise_neg_overflow:
  9277.     PyErr_SetString(PyExc_OverflowError,
  9278.         "can't convert negative value to long");
  9279.     return (long) -1;
  9280. }
  9281.  
  9282. static int __Pyx_check_binary_version(void) {
  9283.     char ctversion[4], rtversion[4];
  9284.     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  9285.     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
  9286.     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
  9287.         char message[200];
  9288.         PyOS_snprintf(message, sizeof(message),
  9289.                       "compiletime version %s of module '%.100s' "
  9290.                       "does not match runtime version %s",
  9291.                       ctversion, __Pyx_MODULE_NAME, rtversion);
  9292.         return PyErr_WarnEx(NULL, message, 1);
  9293.     }
  9294.     return 0;
  9295. }
  9296.  
  9297. #ifndef __PYX_HAVE_RT_ImportModule
  9298. #define __PYX_HAVE_RT_ImportModule
  9299. static PyObject *__Pyx_ImportModule(const char *name) {
  9300.     PyObject *py_name = 0;
  9301.     PyObject *py_module = 0;
  9302.     py_name = __Pyx_PyIdentifier_FromString(name);
  9303.     if (!py_name)
  9304.         goto bad;
  9305.     py_module = PyImport_Import(py_name);
  9306.     Py_DECREF(py_name);
  9307.     return py_module;
  9308. bad:
  9309.     Py_XDECREF(py_name);
  9310.     return 0;
  9311. }
  9312. #endif
  9313.  
  9314. #ifndef __PYX_HAVE_RT_ImportType
  9315. #define __PYX_HAVE_RT_ImportType
  9316. static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
  9317.     size_t size, int strict)
  9318. {
  9319.     PyObject *py_module = 0;
  9320.     PyObject *result = 0;
  9321.     PyObject *py_name = 0;
  9322.     char warning[200];
  9323.     Py_ssize_t basicsize;
  9324. #ifdef Py_LIMITED_API
  9325.     PyObject *py_basicsize;
  9326. #endif
  9327.     py_module = __Pyx_ImportModule(module_name);
  9328.     if (!py_module)
  9329.         goto bad;
  9330.     py_name = __Pyx_PyIdentifier_FromString(class_name);
  9331.     if (!py_name)
  9332.         goto bad;
  9333.     result = PyObject_GetAttr(py_module, py_name);
  9334.     Py_DECREF(py_name);
  9335.     py_name = 0;
  9336.     Py_DECREF(py_module);
  9337.     py_module = 0;
  9338.     if (!result)
  9339.         goto bad;
  9340.     if (!PyType_Check(result)) {
  9341.         PyErr_Format(PyExc_TypeError,
  9342.             "%.200s.%.200s is not a type object",
  9343.             module_name, class_name);
  9344.         goto bad;
  9345.     }
  9346. #ifndef Py_LIMITED_API
  9347.     basicsize = ((PyTypeObject *)result)->tp_basicsize;
  9348. #else
  9349.     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
  9350.     if (!py_basicsize)
  9351.         goto bad;
  9352.     basicsize = PyLong_AsSsize_t(py_basicsize);
  9353.     Py_DECREF(py_basicsize);
  9354.     py_basicsize = 0;
  9355.     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
  9356.         goto bad;
  9357. #endif
  9358.     if (!strict && (size_t)basicsize > size) {
  9359.         PyOS_snprintf(warning, sizeof(warning),
  9360.             "%s.%s size changed, may indicate binary incompatibility",
  9361.             module_name, class_name);
  9362.         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
  9363.     }
  9364.     else if ((size_t)basicsize != size) {
  9365.         PyErr_Format(PyExc_ValueError,
  9366.             "%.200s.%.200s has the wrong size, try recompiling",
  9367.             module_name, class_name);
  9368.         goto bad;
  9369.     }
  9370.     return (PyTypeObject *)result;
  9371. bad:
  9372.     Py_XDECREF(py_module);
  9373.     Py_XDECREF(result);
  9374.     return NULL;
  9375. }
  9376. #endif
  9377.  
  9378. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  9379.     while (t->p) {
  9380.         #if PY_MAJOR_VERSION < 3
  9381.         if (t->is_unicode) {
  9382.             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  9383.         } else if (t->intern) {
  9384.             *t->p = PyString_InternFromString(t->s);
  9385.         } else {
  9386.             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  9387.         }
  9388.         #else
  9389.         if (t->is_unicode | t->is_str) {
  9390.             if (t->intern) {
  9391.                 *t->p = PyUnicode_InternFromString(t->s);
  9392.             } else if (t->encoding) {
  9393.                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  9394.             } else {
  9395.                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  9396.             }
  9397.         } else {
  9398.             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  9399.         }
  9400.         #endif
  9401.         if (!*t->p)
  9402.             return -1;
  9403.         ++t;
  9404.     }
  9405.     return 0;
  9406. }
  9407.  
  9408. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  9409.     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
  9410. }
  9411. static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
  9412.     Py_ssize_t ignore;
  9413.     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  9414. }
  9415. static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  9416. #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  9417.     if (
  9418. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  9419.             __Pyx_sys_getdefaultencoding_not_ascii &&
  9420. #endif
  9421.             PyUnicode_Check(o)) {
  9422. #if PY_VERSION_HEX < 0x03030000
  9423.         char* defenc_c;
  9424.         PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  9425.         if (!defenc) return NULL;
  9426.         defenc_c = PyBytes_AS_STRING(defenc);
  9427. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  9428.         {
  9429.             char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  9430.             char* c;
  9431.             for (c = defenc_c; c < end; c++) {
  9432.                 if ((unsigned char) (*c) >= 128) {
  9433.                     PyUnicode_AsASCIIString(o);
  9434.                     return NULL;
  9435.                 }
  9436.             }
  9437.         }
  9438. #endif
  9439.         *length = PyBytes_GET_SIZE(defenc);
  9440.         return defenc_c;
  9441. #else
  9442.         if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
  9443. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  9444.         if (PyUnicode_IS_ASCII(o)) {
  9445.             *length = PyUnicode_GET_LENGTH(o);
  9446.             return PyUnicode_AsUTF8(o);
  9447.         } else {
  9448.             PyUnicode_AsASCIIString(o);
  9449.             return NULL;
  9450.         }
  9451. #else
  9452.         return PyUnicode_AsUTF8AndSize(o, length);
  9453. #endif
  9454. #endif
  9455.     } else
  9456. #endif
  9457. #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
  9458.     if (PyByteArray_Check(o)) {
  9459.         *length = PyByteArray_GET_SIZE(o);
  9460.         return PyByteArray_AS_STRING(o);
  9461.     } else
  9462. #endif
  9463.     {
  9464.         char* result;
  9465.         int r = PyBytes_AsStringAndSize(o, &result, length);
  9466.         if (unlikely(r < 0)) {
  9467.             return NULL;
  9468.         } else {
  9469.             return result;
  9470.         }
  9471.     }
  9472. }
  9473. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  9474.    int is_true = x == Py_True;
  9475.    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  9476.    else return PyObject_IsTrue(x);
  9477. }
  9478. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  9479.   PyNumberMethods *m;
  9480.   const char *name = NULL;
  9481.   PyObject *res = NULL;
  9482. #if PY_MAJOR_VERSION < 3
  9483.   if (PyInt_Check(x) || PyLong_Check(x))
  9484. #else
  9485.   if (PyLong_Check(x))
  9486. #endif
  9487.     return __Pyx_NewRef(x);
  9488.   m = Py_TYPE(x)->tp_as_number;
  9489. #if PY_MAJOR_VERSION < 3
  9490.   if (m && m->nb_int) {
  9491.     name = "int";
  9492.     res = PyNumber_Int(x);
  9493.   }
  9494.   else if (m && m->nb_long) {
  9495.     name = "long";
  9496.     res = PyNumber_Long(x);
  9497.   }
  9498. #else
  9499.   if (m && m->nb_int) {
  9500.     name = "int";
  9501.     res = PyNumber_Long(x);
  9502.   }
  9503. #endif
  9504.   if (res) {
  9505. #if PY_MAJOR_VERSION < 3
  9506.     if (!PyInt_Check(res) && !PyLong_Check(res)) {
  9507. #else
  9508.     if (!PyLong_Check(res)) {
  9509. #endif
  9510.       PyErr_Format(PyExc_TypeError,
  9511.                    "__%.4s__ returned non-%.4s (type %.200s)",
  9512.                    name, name, Py_TYPE(res)->tp_name);
  9513.       Py_DECREF(res);
  9514.       return NULL;
  9515.     }
  9516.   }
  9517.   else if (!PyErr_Occurred()) {
  9518.     PyErr_SetString(PyExc_TypeError,
  9519.                     "an integer is required");
  9520.   }
  9521.   return res;
  9522. }
  9523. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  9524.   Py_ssize_t ival;
  9525.   PyObject *x;
  9526. #if PY_MAJOR_VERSION < 3
  9527.   if (likely(PyInt_CheckExact(b))) {
  9528.     if (sizeof(Py_ssize_t) >= sizeof(long))
  9529.         return PyInt_AS_LONG(b);
  9530.     else
  9531.         return PyInt_AsSsize_t(x);
  9532.   }
  9533. #endif
  9534.   if (likely(PyLong_CheckExact(b))) {
  9535.     #if CYTHON_USE_PYLONG_INTERNALS
  9536.     const digit* digits = ((PyLongObject*)b)->ob_digit;
  9537.     const Py_ssize_t size = Py_SIZE(b);
  9538.     if (likely(__Pyx_sst_abs(size) <= 1)) {
  9539.         ival = likely(size) ? digits[0] : 0;
  9540.         if (size == -1) ival = -ival;
  9541.         return ival;
  9542.     } else {
  9543.       switch (size) {
  9544.          case 2:
  9545.            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  9546.              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  9547.            }
  9548.            break;
  9549.          case -2:
  9550.            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  9551.              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  9552.            }
  9553.            break;
  9554.          case 3:
  9555.            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  9556.              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  9557.            }
  9558.            break;
  9559.          case -3:
  9560.            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  9561.              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  9562.            }
  9563.            break;
  9564.          case 4:
  9565.            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  9566.              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]));
  9567.            }
  9568.            break;
  9569.          case -4:
  9570.            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  9571.              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]));
  9572.            }
  9573.            break;
  9574.       }
  9575.     }
  9576.     #endif
  9577.     return PyLong_AsSsize_t(b);
  9578.   }
  9579.   x = PyNumber_Index(b);
  9580.   if (!x) return -1;
  9581.   ival = PyInt_AsSsize_t(x);
  9582.   Py_DECREF(x);
  9583.   return ival;
  9584. }
  9585. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  9586.     return PyInt_FromSize_t(ival);
  9587. }
  9588.  
  9589.  
  9590. #endif /* Py_PYTHON_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement