1 /* Generated by Cython 0.29.24 */
2 
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "define_macros": [
7             [
8                 "CYTHON_TRACE_NOGIL",
9                 "0"
10             ],
11             [
12                 "NPY_NO_DEPRECATED_API",
13                 "NPY_1_7_API_VERSION"
14             ]
15         ],
16         "depends": [
17             "C:\\Anaconda\\lib\\site-packages\\numpy\\core\\include\\numpy\\arrayobject.h",
18             "C:\\Anaconda\\lib\\site-packages\\numpy\\core\\include\\numpy\\arrayscalars.h",
19             "C:\\Anaconda\\lib\\site-packages\\numpy\\core\\include\\numpy\\ndarrayobject.h",
20             "C:\\Anaconda\\lib\\site-packages\\numpy\\core\\include\\numpy\\ndarraytypes.h",
21             "C:\\Anaconda\\lib\\site-packages\\numpy\\core\\include\\numpy\\ufuncobject.h"
22         ],
23         "include_dirs": [
24             "C:\\Anaconda\\lib\\site-packages\\numpy\\core\\include",
25             "C:\\\\Anaconda\\\\lib\\\\site-packages\\\\numpy\\\\core\\\\include"
26         ],
27         "libraries": [
28             "npymath"
29         ],
30         "library_dirs": [
31             "C:\\\\Anaconda\\\\lib\\\\site-packages\\\\numpy\\\\core\\\\lib"
32         ],
33         "name": "statsmodels.nonparametric._smoothers_lowess",
34         "sources": [
35             "statsmodels/nonparametric/_smoothers_lowess.pyx"
36         ]
37     },
38     "module_name": "statsmodels.nonparametric._smoothers_lowess"
39 }
40 END: Cython Metadata */
41 
42 #ifndef PY_SSIZE_T_CLEAN
43 #define PY_SSIZE_T_CLEAN
44 #endif /* PY_SSIZE_T_CLEAN */
45 #include "Python.h"
46 #ifndef Py_PYTHON_H
47     #error Python headers needed to compile C extensions, please install development version of Python.
48 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
49     #error Cython requires Python 2.6+ or Python 3.3+.
50 #else
51 #define CYTHON_ABI "0_29_24"
52 #define CYTHON_HEX_VERSION 0x001D18F0
53 #define CYTHON_FUTURE_DIVISION 1
54 #include <stddef.h>
55 #ifndef offsetof
56   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
57 #endif
58 #if !defined(WIN32) && !defined(MS_WINDOWS)
59   #ifndef __stdcall
60     #define __stdcall
61   #endif
62   #ifndef __cdecl
63     #define __cdecl
64   #endif
65   #ifndef __fastcall
66     #define __fastcall
67   #endif
68 #endif
69 #ifndef DL_IMPORT
70   #define DL_IMPORT(t) t
71 #endif
72 #ifndef DL_EXPORT
73   #define DL_EXPORT(t) t
74 #endif
75 #define __PYX_COMMA ,
76 #ifndef HAVE_LONG_LONG
77   #if PY_VERSION_HEX >= 0x02070000
78     #define HAVE_LONG_LONG
79   #endif
80 #endif
81 #ifndef PY_LONG_LONG
82   #define PY_LONG_LONG LONG_LONG
83 #endif
84 #ifndef Py_HUGE_VAL
85   #define Py_HUGE_VAL HUGE_VAL
86 #endif
87 #ifdef PYPY_VERSION
88   #define CYTHON_COMPILING_IN_PYPY 1
89   #define CYTHON_COMPILING_IN_PYSTON 0
90   #define CYTHON_COMPILING_IN_CPYTHON 0
91   #undef CYTHON_USE_TYPE_SLOTS
92   #define CYTHON_USE_TYPE_SLOTS 0
93   #undef CYTHON_USE_PYTYPE_LOOKUP
94   #define CYTHON_USE_PYTYPE_LOOKUP 0
95   #if PY_VERSION_HEX < 0x03050000
96     #undef CYTHON_USE_ASYNC_SLOTS
97     #define CYTHON_USE_ASYNC_SLOTS 0
98   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
99     #define CYTHON_USE_ASYNC_SLOTS 1
100   #endif
101   #undef CYTHON_USE_PYLIST_INTERNALS
102   #define CYTHON_USE_PYLIST_INTERNALS 0
103   #undef CYTHON_USE_UNICODE_INTERNALS
104   #define CYTHON_USE_UNICODE_INTERNALS 0
105   #undef CYTHON_USE_UNICODE_WRITER
106   #define CYTHON_USE_UNICODE_WRITER 0
107   #undef CYTHON_USE_PYLONG_INTERNALS
108   #define CYTHON_USE_PYLONG_INTERNALS 0
109   #undef CYTHON_AVOID_BORROWED_REFS
110   #define CYTHON_AVOID_BORROWED_REFS 1
111   #undef CYTHON_ASSUME_SAFE_MACROS
112   #define CYTHON_ASSUME_SAFE_MACROS 0
113   #undef CYTHON_UNPACK_METHODS
114   #define CYTHON_UNPACK_METHODS 0
115   #undef CYTHON_FAST_THREAD_STATE
116   #define CYTHON_FAST_THREAD_STATE 0
117   #undef CYTHON_FAST_PYCALL
118   #define CYTHON_FAST_PYCALL 0
119   #undef CYTHON_PEP489_MULTI_PHASE_INIT
120   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
121   #undef CYTHON_USE_TP_FINALIZE
122   #define CYTHON_USE_TP_FINALIZE 0
123   #undef CYTHON_USE_DICT_VERSIONS
124   #define CYTHON_USE_DICT_VERSIONS 0
125   #undef CYTHON_USE_EXC_INFO_STACK
126   #define CYTHON_USE_EXC_INFO_STACK 0
127 #elif defined(PYSTON_VERSION)
128   #define CYTHON_COMPILING_IN_PYPY 0
129   #define CYTHON_COMPILING_IN_PYSTON 1
130   #define CYTHON_COMPILING_IN_CPYTHON 0
131   #ifndef CYTHON_USE_TYPE_SLOTS
132     #define CYTHON_USE_TYPE_SLOTS 1
133   #endif
134   #undef CYTHON_USE_PYTYPE_LOOKUP
135   #define CYTHON_USE_PYTYPE_LOOKUP 0
136   #undef CYTHON_USE_ASYNC_SLOTS
137   #define CYTHON_USE_ASYNC_SLOTS 0
138   #undef CYTHON_USE_PYLIST_INTERNALS
139   #define CYTHON_USE_PYLIST_INTERNALS 0
140   #ifndef CYTHON_USE_UNICODE_INTERNALS
141     #define CYTHON_USE_UNICODE_INTERNALS 1
142   #endif
143   #undef CYTHON_USE_UNICODE_WRITER
144   #define CYTHON_USE_UNICODE_WRITER 0
145   #undef CYTHON_USE_PYLONG_INTERNALS
146   #define CYTHON_USE_PYLONG_INTERNALS 0
147   #ifndef CYTHON_AVOID_BORROWED_REFS
148     #define CYTHON_AVOID_BORROWED_REFS 0
149   #endif
150   #ifndef CYTHON_ASSUME_SAFE_MACROS
151     #define CYTHON_ASSUME_SAFE_MACROS 1
152   #endif
153   #ifndef CYTHON_UNPACK_METHODS
154     #define CYTHON_UNPACK_METHODS 1
155   #endif
156   #undef CYTHON_FAST_THREAD_STATE
157   #define CYTHON_FAST_THREAD_STATE 0
158   #undef CYTHON_FAST_PYCALL
159   #define CYTHON_FAST_PYCALL 0
160   #undef CYTHON_PEP489_MULTI_PHASE_INIT
161   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
162   #undef CYTHON_USE_TP_FINALIZE
163   #define CYTHON_USE_TP_FINALIZE 0
164   #undef CYTHON_USE_DICT_VERSIONS
165   #define CYTHON_USE_DICT_VERSIONS 0
166   #undef CYTHON_USE_EXC_INFO_STACK
167   #define CYTHON_USE_EXC_INFO_STACK 0
168 #else
169   #define CYTHON_COMPILING_IN_PYPY 0
170   #define CYTHON_COMPILING_IN_PYSTON 0
171   #define CYTHON_COMPILING_IN_CPYTHON 1
172   #ifndef CYTHON_USE_TYPE_SLOTS
173     #define CYTHON_USE_TYPE_SLOTS 1
174   #endif
175   #if PY_VERSION_HEX < 0x02070000
176     #undef CYTHON_USE_PYTYPE_LOOKUP
177     #define CYTHON_USE_PYTYPE_LOOKUP 0
178   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
179     #define CYTHON_USE_PYTYPE_LOOKUP 1
180   #endif
181   #if PY_MAJOR_VERSION < 3
182     #undef CYTHON_USE_ASYNC_SLOTS
183     #define CYTHON_USE_ASYNC_SLOTS 0
184   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
185     #define CYTHON_USE_ASYNC_SLOTS 1
186   #endif
187   #if PY_VERSION_HEX < 0x02070000
188     #undef CYTHON_USE_PYLONG_INTERNALS
189     #define CYTHON_USE_PYLONG_INTERNALS 0
190   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
191     #define CYTHON_USE_PYLONG_INTERNALS 1
192   #endif
193   #ifndef CYTHON_USE_PYLIST_INTERNALS
194     #define CYTHON_USE_PYLIST_INTERNALS 1
195   #endif
196   #ifndef CYTHON_USE_UNICODE_INTERNALS
197     #define CYTHON_USE_UNICODE_INTERNALS 1
198   #endif
199   #if PY_VERSION_HEX < 0x030300F0
200     #undef CYTHON_USE_UNICODE_WRITER
201     #define CYTHON_USE_UNICODE_WRITER 0
202   #elif !defined(CYTHON_USE_UNICODE_WRITER)
203     #define CYTHON_USE_UNICODE_WRITER 1
204   #endif
205   #ifndef CYTHON_AVOID_BORROWED_REFS
206     #define CYTHON_AVOID_BORROWED_REFS 0
207   #endif
208   #ifndef CYTHON_ASSUME_SAFE_MACROS
209     #define CYTHON_ASSUME_SAFE_MACROS 1
210   #endif
211   #ifndef CYTHON_UNPACK_METHODS
212     #define CYTHON_UNPACK_METHODS 1
213   #endif
214   #ifndef CYTHON_FAST_THREAD_STATE
215     #define CYTHON_FAST_THREAD_STATE 1
216   #endif
217   #ifndef CYTHON_FAST_PYCALL
218     #define CYTHON_FAST_PYCALL 1
219   #endif
220   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
221     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
222   #endif
223   #ifndef CYTHON_USE_TP_FINALIZE
224     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
225   #endif
226   #ifndef CYTHON_USE_DICT_VERSIONS
227     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
228   #endif
229   #ifndef CYTHON_USE_EXC_INFO_STACK
230     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
231   #endif
232 #endif
233 #if !defined(CYTHON_FAST_PYCCALL)
234 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
235 #endif
236 #if CYTHON_USE_PYLONG_INTERNALS
237   #include "longintrepr.h"
238   #undef SHIFT
239   #undef BASE
240   #undef MASK
241   #ifdef SIZEOF_VOID_P
242     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
243   #endif
244 #endif
245 #ifndef __has_attribute
246   #define __has_attribute(x) 0
247 #endif
248 #ifndef __has_cpp_attribute
249   #define __has_cpp_attribute(x) 0
250 #endif
251 #ifndef CYTHON_RESTRICT
252   #if defined(__GNUC__)
253     #define CYTHON_RESTRICT __restrict__
254   #elif defined(_MSC_VER) && _MSC_VER >= 1400
255     #define CYTHON_RESTRICT __restrict
256   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
257     #define CYTHON_RESTRICT restrict
258   #else
259     #define CYTHON_RESTRICT
260   #endif
261 #endif
262 #ifndef CYTHON_UNUSED
263 # if defined(__GNUC__)
264 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
265 #     define CYTHON_UNUSED __attribute__ ((__unused__))
266 #   else
267 #     define CYTHON_UNUSED
268 #   endif
269 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
270 #   define CYTHON_UNUSED __attribute__ ((__unused__))
271 # else
272 #   define CYTHON_UNUSED
273 # endif
274 #endif
275 #ifndef CYTHON_MAYBE_UNUSED_VAR
276 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)277      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
278 #  else
279 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
280 #  endif
281 #endif
282 #ifndef CYTHON_NCP_UNUSED
283 # if CYTHON_COMPILING_IN_CPYTHON
284 #  define CYTHON_NCP_UNUSED
285 # else
286 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
287 # endif
288 #endif
289 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
290 #ifdef _MSC_VER
291     #ifndef _MSC_STDINT_H_
292         #if _MSC_VER < 1300
293            typedef unsigned char     uint8_t;
294            typedef unsigned int      uint32_t;
295         #else
296            typedef unsigned __int8   uint8_t;
297            typedef unsigned __int32  uint32_t;
298         #endif
299     #endif
300 #else
301    #include <stdint.h>
302 #endif
303 #ifndef CYTHON_FALLTHROUGH
304   #if defined(__cplusplus) && __cplusplus >= 201103L
305     #if __has_cpp_attribute(fallthrough)
306       #define CYTHON_FALLTHROUGH [[fallthrough]]
307     #elif __has_cpp_attribute(clang::fallthrough)
308       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
309     #elif __has_cpp_attribute(gnu::fallthrough)
310       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
311     #endif
312   #endif
313   #ifndef CYTHON_FALLTHROUGH
314     #if __has_attribute(fallthrough)
315       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
316     #else
317       #define CYTHON_FALLTHROUGH
318     #endif
319   #endif
320   #if defined(__clang__ ) && defined(__apple_build_version__)
321     #if __apple_build_version__ < 7000000
322       #undef  CYTHON_FALLTHROUGH
323       #define CYTHON_FALLTHROUGH
324     #endif
325   #endif
326 #endif
327 
328 #ifndef CYTHON_INLINE
329   #if defined(__clang__)
330     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
331   #elif defined(__GNUC__)
332     #define CYTHON_INLINE __inline__
333   #elif defined(_MSC_VER)
334     #define CYTHON_INLINE __inline
335   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
336     #define CYTHON_INLINE inline
337   #else
338     #define CYTHON_INLINE
339   #endif
340 #endif
341 
342 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
343   #define Py_OptimizeFlag 0
344 #endif
345 #define __PYX_BUILD_PY_SSIZE_T "n"
346 #define CYTHON_FORMAT_SSIZE_T "z"
347 #if PY_MAJOR_VERSION < 3
348   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
349   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
350           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
351   #define __Pyx_DefaultClassType PyClass_Type
352 #else
353   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
354 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
355   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
356           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
357 #else
358   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
359           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
360 #endif
361   #define __Pyx_DefaultClassType PyType_Type
362 #endif
363 #ifndef Py_TPFLAGS_CHECKTYPES
364   #define Py_TPFLAGS_CHECKTYPES 0
365 #endif
366 #ifndef Py_TPFLAGS_HAVE_INDEX
367   #define Py_TPFLAGS_HAVE_INDEX 0
368 #endif
369 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
370   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
371 #endif
372 #ifndef Py_TPFLAGS_HAVE_FINALIZE
373   #define Py_TPFLAGS_HAVE_FINALIZE 0
374 #endif
375 #ifndef METH_STACKLESS
376   #define METH_STACKLESS 0
377 #endif
378 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
379   #ifndef METH_FASTCALL
380      #define METH_FASTCALL 0x80
381   #endif
382   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
383   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
384                                                           Py_ssize_t nargs, PyObject *kwnames);
385 #else
386   #define __Pyx_PyCFunctionFast _PyCFunctionFast
387   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
388 #endif
389 #if CYTHON_FAST_PYCCALL
390 #define __Pyx_PyFastCFunction_Check(func)\
391     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
392 #else
393 #define __Pyx_PyFastCFunction_Check(func) 0
394 #endif
395 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
396   #define PyObject_Malloc(s)   PyMem_Malloc(s)
397   #define PyObject_Free(p)     PyMem_Free(p)
398   #define PyObject_Realloc(p)  PyMem_Realloc(p)
399 #endif
400 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
401   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
402   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
403   #define PyMem_RawFree(p)             PyMem_Free(p)
404 #endif
405 #if CYTHON_COMPILING_IN_PYSTON
406   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
407   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
408 #else
409   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
410   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
411 #endif
412 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
413   #define __Pyx_PyThreadState_Current PyThreadState_GET()
414 #elif PY_VERSION_HEX >= 0x03060000
415   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
416 #elif PY_VERSION_HEX >= 0x03000000
417   #define __Pyx_PyThreadState_Current PyThreadState_GET()
418 #else
419   #define __Pyx_PyThreadState_Current _PyThreadState_Current
420 #endif
421 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
422 #include "pythread.h"
423 #define Py_tss_NEEDS_INIT 0
424 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)425 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
426   *key = PyThread_create_key();
427   return 0;
428 }
PyThread_tss_alloc(void)429 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
430   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
431   *key = Py_tss_NEEDS_INIT;
432   return key;
433 }
PyThread_tss_free(Py_tss_t * key)434 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
435   PyObject_Free(key);
436 }
PyThread_tss_is_created(Py_tss_t * key)437 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
438   return *key != Py_tss_NEEDS_INIT;
439 }
PyThread_tss_delete(Py_tss_t * key)440 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
441   PyThread_delete_key(*key);
442   *key = Py_tss_NEEDS_INIT;
443 }
PyThread_tss_set(Py_tss_t * key,void * value)444 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
445   return PyThread_set_key_value(*key, value);
446 }
PyThread_tss_get(Py_tss_t * key)447 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
448   return PyThread_get_key_value(*key);
449 }
450 #endif
451 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
452 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
453 #else
454 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
455 #endif
456 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
457   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
458   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
459 #else
460   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
461   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
462 #endif
463 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
464 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
465 #else
466 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
467 #endif
468 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
469   #define CYTHON_PEP393_ENABLED 1
470   #if defined(PyUnicode_IS_READY)
471   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
472                                               0 : _PyUnicode_Ready((PyObject *)(op)))
473   #else
474   #define __Pyx_PyUnicode_READY(op)       (0)
475   #endif
476   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
477   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
478   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
479   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
480   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
481   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
482   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
483   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
484   #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
485   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
486   #else
487   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
488   #endif
489   #else
490   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
491   #endif
492 #else
493   #define CYTHON_PEP393_ENABLED 0
494   #define PyUnicode_1BYTE_KIND  1
495   #define PyUnicode_2BYTE_KIND  2
496   #define PyUnicode_4BYTE_KIND  4
497   #define __Pyx_PyUnicode_READY(op)       (0)
498   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
499   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
500   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
501   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
502   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
503   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
504   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
505   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
506 #endif
507 #if CYTHON_COMPILING_IN_PYPY
508   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
509   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
510 #else
511   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
512   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
513       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
514 #endif
515 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
516   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
517 #endif
518 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
519   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
520 #endif
521 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
522   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
523 #endif
524 #define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
525 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
526 #if PY_MAJOR_VERSION >= 3
527   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
528 #else
529   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
530 #endif
531 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
532   #define PyObject_ASCII(o)            PyObject_Repr(o)
533 #endif
534 #if PY_MAJOR_VERSION >= 3
535   #define PyBaseString_Type            PyUnicode_Type
536   #define PyStringObject               PyUnicodeObject
537   #define PyString_Type                PyUnicode_Type
538   #define PyString_Check               PyUnicode_Check
539   #define PyString_CheckExact          PyUnicode_CheckExact
540 #ifndef PyObject_Unicode
541   #define PyObject_Unicode             PyObject_Str
542 #endif
543 #endif
544 #if PY_MAJOR_VERSION >= 3
545   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
546   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
547 #else
548   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
549   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
550 #endif
551 #ifndef PySet_CheckExact
552   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
553 #endif
554 #if PY_VERSION_HEX >= 0x030900A4
555   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
556   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
557 #else
558   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
559   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
560 #endif
561 #if CYTHON_ASSUME_SAFE_MACROS
562   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
563 #else
564   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
565 #endif
566 #if PY_MAJOR_VERSION >= 3
567   #define PyIntObject                  PyLongObject
568   #define PyInt_Type                   PyLong_Type
569   #define PyInt_Check(op)              PyLong_Check(op)
570   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
571   #define PyInt_FromString             PyLong_FromString
572   #define PyInt_FromUnicode            PyLong_FromUnicode
573   #define PyInt_FromLong               PyLong_FromLong
574   #define PyInt_FromSize_t             PyLong_FromSize_t
575   #define PyInt_FromSsize_t            PyLong_FromSsize_t
576   #define PyInt_AsLong                 PyLong_AsLong
577   #define PyInt_AS_LONG                PyLong_AS_LONG
578   #define PyInt_AsSsize_t              PyLong_AsSsize_t
579   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
580   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
581   #define PyNumber_Int                 PyNumber_Long
582 #endif
583 #if PY_MAJOR_VERSION >= 3
584   #define PyBoolObject                 PyLongObject
585 #endif
586 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
587   #ifndef PyUnicode_InternFromString
588     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
589   #endif
590 #endif
591 #if PY_VERSION_HEX < 0x030200A4
592   typedef long Py_hash_t;
593   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
594   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
595 #else
596   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
597   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
598 #endif
599 #if PY_MAJOR_VERSION >= 3
600   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
601 #else
602   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
603 #endif
604 #if CYTHON_USE_ASYNC_SLOTS
605   #if PY_VERSION_HEX >= 0x030500B1
606     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
607     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
608   #else
609     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
610   #endif
611 #else
612   #define __Pyx_PyType_AsAsync(obj) NULL
613 #endif
614 #ifndef __Pyx_PyAsyncMethodsStruct
615     typedef struct {
616         unaryfunc am_await;
617         unaryfunc am_aiter;
618         unaryfunc am_anext;
619     } __Pyx_PyAsyncMethodsStruct;
620 #endif
621 
622 #if defined(WIN32) || defined(MS_WINDOWS)
623   #define _USE_MATH_DEFINES
624 #endif
625 #include <math.h>
626 #ifdef NAN
627 #define __PYX_NAN() ((float) NAN)
628 #else
__PYX_NAN()629 static CYTHON_INLINE float __PYX_NAN() {
630   float value;
631   memset(&value, 0xFF, sizeof(value));
632   return value;
633 }
634 #endif
635 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
636 #define __Pyx_truncl trunc
637 #else
638 #define __Pyx_truncl truncl
639 #endif
640 
641 #define __PYX_MARK_ERR_POS(f_index, lineno) \
642     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
643 #define __PYX_ERR(f_index, lineno, Ln_error) \
644     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
645 
646 #ifndef __PYX_EXTERN_C
647   #ifdef __cplusplus
648     #define __PYX_EXTERN_C extern "C"
649   #else
650     #define __PYX_EXTERN_C extern
651   #endif
652 #endif
653 
654 #define __PYX_HAVE__statsmodels__nonparametric___smoothers_lowess
655 #define __PYX_HAVE_API__statsmodels__nonparametric___smoothers_lowess
656 /* Early includes */
657 #include <string.h>
658 #include <stdio.h>
659 #include "numpy/arrayobject.h"
660 #include "numpy/ndarrayobject.h"
661 #include "numpy/ndarraytypes.h"
662 #include "numpy/arrayscalars.h"
663 #include "numpy/ufuncobject.h"
664 
665     /* NumPy API declarations from "numpy/__init__.pxd" */
666 
667 #include <math.h>
668 #include "pythread.h"
669 #include <stdlib.h>
670 #include "pystate.h"
671 #ifdef _OPENMP
672 #include <omp.h>
673 #endif /* _OPENMP */
674 
675 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
676 #define CYTHON_WITHOUT_ASSERTIONS
677 #endif
678 
679 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
680                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
681 
682 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
683 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
684 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
685 #define __PYX_DEFAULT_STRING_ENCODING ""
686 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
687 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
688 #define __Pyx_uchar_cast(c) ((unsigned char)c)
689 #define __Pyx_long_cast(x) ((long)x)
690 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
691     (sizeof(type) < sizeof(Py_ssize_t))  ||\
692     (sizeof(type) > sizeof(Py_ssize_t) &&\
693           likely(v < (type)PY_SSIZE_T_MAX ||\
694                  v == (type)PY_SSIZE_T_MAX)  &&\
695           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
696                                 v == (type)PY_SSIZE_T_MIN)))  ||\
697     (sizeof(type) == sizeof(Py_ssize_t) &&\
698           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
699                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)700 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
701     return (size_t) i < (size_t) limit;
702 }
703 #if defined (__cplusplus) && __cplusplus >= 201103L
704     #include <cstdlib>
705     #define __Pyx_sst_abs(value) std::abs(value)
706 #elif SIZEOF_INT >= SIZEOF_SIZE_T
707     #define __Pyx_sst_abs(value) abs(value)
708 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
709     #define __Pyx_sst_abs(value) labs(value)
710 #elif defined (_MSC_VER)
711     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
712 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
713     #define __Pyx_sst_abs(value) llabs(value)
714 #elif defined (__GNUC__)
715     #define __Pyx_sst_abs(value) __builtin_llabs(value)
716 #else
717     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
718 #endif
719 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
720 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
721 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
722 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
723 #define __Pyx_PyBytes_FromString        PyBytes_FromString
724 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
725 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
726 #if PY_MAJOR_VERSION < 3
727     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
728     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
729 #else
730     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
731     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
732 #endif
733 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
734 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
735 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
736 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
737 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
738 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
739 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
740 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
741 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
742 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
743 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
744 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
745 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
746 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
747 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
748 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)749 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
750     const Py_UNICODE *u_end = u;
751     while (*u_end++) ;
752     return (size_t)(u_end - u - 1);
753 }
754 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
755 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
756 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
757 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
758 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
759 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
760 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
761 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
762 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
763 #define __Pyx_PySequence_Tuple(obj)\
764     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
765 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
766 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
767 #if CYTHON_ASSUME_SAFE_MACROS
768 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
769 #else
770 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
771 #endif
772 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
773 #if PY_MAJOR_VERSION >= 3
774 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
775 #else
776 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
777 #endif
778 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
779 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
780 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)781 static int __Pyx_init_sys_getdefaultencoding_params(void) {
782     PyObject* sys;
783     PyObject* default_encoding = NULL;
784     PyObject* ascii_chars_u = NULL;
785     PyObject* ascii_chars_b = NULL;
786     const char* default_encoding_c;
787     sys = PyImport_ImportModule("sys");
788     if (!sys) goto bad;
789     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
790     Py_DECREF(sys);
791     if (!default_encoding) goto bad;
792     default_encoding_c = PyBytes_AsString(default_encoding);
793     if (!default_encoding_c) goto bad;
794     if (strcmp(default_encoding_c, "ascii") == 0) {
795         __Pyx_sys_getdefaultencoding_not_ascii = 0;
796     } else {
797         char ascii_chars[128];
798         int c;
799         for (c = 0; c < 128; c++) {
800             ascii_chars[c] = c;
801         }
802         __Pyx_sys_getdefaultencoding_not_ascii = 1;
803         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
804         if (!ascii_chars_u) goto bad;
805         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
806         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
807             PyErr_Format(
808                 PyExc_ValueError,
809                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
810                 default_encoding_c);
811             goto bad;
812         }
813         Py_DECREF(ascii_chars_u);
814         Py_DECREF(ascii_chars_b);
815     }
816     Py_DECREF(default_encoding);
817     return 0;
818 bad:
819     Py_XDECREF(default_encoding);
820     Py_XDECREF(ascii_chars_u);
821     Py_XDECREF(ascii_chars_b);
822     return -1;
823 }
824 #endif
825 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
826 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
827 #else
828 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
829 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
830 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)831 static int __Pyx_init_sys_getdefaultencoding_params(void) {
832     PyObject* sys;
833     PyObject* default_encoding = NULL;
834     char* default_encoding_c;
835     sys = PyImport_ImportModule("sys");
836     if (!sys) goto bad;
837     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
838     Py_DECREF(sys);
839     if (!default_encoding) goto bad;
840     default_encoding_c = PyBytes_AsString(default_encoding);
841     if (!default_encoding_c) goto bad;
842     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
843     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
844     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
845     Py_DECREF(default_encoding);
846     return 0;
847 bad:
848     Py_XDECREF(default_encoding);
849     return -1;
850 }
851 #endif
852 #endif
853 
854 
855 /* Test for GCC > 2.95 */
856 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
857   #define likely(x)   __builtin_expect(!!(x), 1)
858   #define unlikely(x) __builtin_expect(!!(x), 0)
859 #else /* !__GNUC__ or GCC < 2.95 */
860   #define likely(x)   (x)
861   #define unlikely(x) (x)
862 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)863 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
864 
865 static PyObject *__pyx_m = NULL;
866 static PyObject *__pyx_d;
867 static PyObject *__pyx_b;
868 static PyObject *__pyx_cython_runtime = NULL;
869 static PyObject *__pyx_empty_tuple;
870 static PyObject *__pyx_empty_bytes;
871 static PyObject *__pyx_empty_unicode;
872 static int __pyx_lineno;
873 static int __pyx_clineno = 0;
874 static const char * __pyx_cfilenm= __FILE__;
875 static const char *__pyx_filename;
876 
877 /* Header.proto */
878 #if !defined(CYTHON_CCOMPLEX)
879   #if defined(__cplusplus)
880     #define CYTHON_CCOMPLEX 1
881   #elif defined(_Complex_I)
882     #define CYTHON_CCOMPLEX 1
883   #else
884     #define CYTHON_CCOMPLEX 0
885   #endif
886 #endif
887 #if CYTHON_CCOMPLEX
888   #ifdef __cplusplus
889     #include <complex>
890   #else
891     #include <complex.h>
892   #endif
893 #endif
894 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
895   #undef _Complex_I
896   #define _Complex_I 1.0fj
897 #endif
898 
899 
900 static const char *__pyx_f[] = {
901   "statsmodels\\nonparametric\\_smoothers_lowess.pyx",
902   "__init__.pxd",
903   "stringsource",
904   "type.pxd",
905 };
906 /* BufferFormatStructs.proto */
907 #define IS_UNSIGNED(type) (((type) -1) > 0)
908 struct __Pyx_StructField_;
909 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
910 typedef struct {
911   const char* name;
912   struct __Pyx_StructField_* fields;
913   size_t size;
914   size_t arraysize[8];
915   int ndim;
916   char typegroup;
917   char is_unsigned;
918   int flags;
919 } __Pyx_TypeInfo;
920 typedef struct __Pyx_StructField_ {
921   __Pyx_TypeInfo* type;
922   const char* name;
923   size_t offset;
924 } __Pyx_StructField;
925 typedef struct {
926   __Pyx_StructField* field;
927   size_t parent_offset;
928 } __Pyx_BufFmt_StackElem;
929 typedef struct {
930   __Pyx_StructField root;
931   __Pyx_BufFmt_StackElem* head;
932   size_t fmt_offset;
933   size_t new_count, enc_count;
934   size_t struct_alignment;
935   int is_complex;
936   char enc_type;
937   char new_packmode;
938   char enc_packmode;
939   char is_valid_array;
940 } __Pyx_BufFmt_Context;
941 
942 /* MemviewSliceStruct.proto */
943 struct __pyx_memoryview_obj;
944 typedef struct {
945   struct __pyx_memoryview_obj *memview;
946   char *data;
947   Py_ssize_t shape[8];
948   Py_ssize_t strides[8];
949   Py_ssize_t suboffsets[8];
950 } __Pyx_memviewslice;
951 #define __Pyx_MemoryView_Len(m)  (m.shape[0])
952 
953 /* Atomics.proto */
954 #include <pythread.h>
955 #ifndef CYTHON_ATOMICS
956     #define CYTHON_ATOMICS 1
957 #endif
958 #define __pyx_atomic_int_type int
959 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
960                     (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
961                     !defined(__i386__)
962     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
963     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
964     #ifdef __PYX_DEBUG_ATOMICS
965         #warning "Using GNU atomics"
966     #endif
967 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
968     #include <Windows.h>
969     #undef __pyx_atomic_int_type
970     #define __pyx_atomic_int_type LONG
971     #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
972     #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
973     #ifdef __PYX_DEBUG_ATOMICS
974         #pragma message ("Using MSVC atomics")
975     #endif
976 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
977     #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
978     #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
979     #ifdef __PYX_DEBUG_ATOMICS
980         #warning "Using Intel atomics"
981     #endif
982 #else
983     #undef CYTHON_ATOMICS
984     #define CYTHON_ATOMICS 0
985     #ifdef __PYX_DEBUG_ATOMICS
986         #warning "Not using atomics"
987     #endif
988 #endif
989 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
990 #if CYTHON_ATOMICS
991     #define __pyx_add_acquisition_count(memview)\
992              __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
993     #define __pyx_sub_acquisition_count(memview)\
994             __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
995 #else
996     #define __pyx_add_acquisition_count(memview)\
997             __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
998     #define __pyx_sub_acquisition_count(memview)\
999             __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1000 #endif
1001 
1002 /* ForceInitThreads.proto */
1003 #ifndef __PYX_FORCE_INIT_THREADS
1004   #define __PYX_FORCE_INIT_THREADS 0
1005 #endif
1006 
1007 /* NoFastGil.proto */
1008 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
1009 #define __Pyx_PyGILState_Release PyGILState_Release
1010 #define __Pyx_FastGIL_Remember()
1011 #define __Pyx_FastGIL_Forget()
1012 #define __Pyx_FastGilFuncInit()
1013 
1014 
1015 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":690
1016  * # in Cython to enable them only on the right systems.
1017  *
1018  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
1019  * ctypedef npy_int16      int16_t
1020  * ctypedef npy_int32      int32_t
1021  */
1022 typedef npy_int8 __pyx_t_5numpy_int8_t;
1023 
1024 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":691
1025  *
1026  * ctypedef npy_int8       int8_t
1027  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
1028  * ctypedef npy_int32      int32_t
1029  * ctypedef npy_int64      int64_t
1030  */
1031 typedef npy_int16 __pyx_t_5numpy_int16_t;
1032 
1033 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":692
1034  * ctypedef npy_int8       int8_t
1035  * ctypedef npy_int16      int16_t
1036  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
1037  * ctypedef npy_int64      int64_t
1038  * #ctypedef npy_int96      int96_t
1039  */
1040 typedef npy_int32 __pyx_t_5numpy_int32_t;
1041 
1042 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":693
1043  * ctypedef npy_int16      int16_t
1044  * ctypedef npy_int32      int32_t
1045  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
1046  * #ctypedef npy_int96      int96_t
1047  * #ctypedef npy_int128     int128_t
1048  */
1049 typedef npy_int64 __pyx_t_5numpy_int64_t;
1050 
1051 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":697
1052  * #ctypedef npy_int128     int128_t
1053  *
1054  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
1055  * ctypedef npy_uint16     uint16_t
1056  * ctypedef npy_uint32     uint32_t
1057  */
1058 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1059 
1060 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":698
1061  *
1062  * ctypedef npy_uint8      uint8_t
1063  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
1064  * ctypedef npy_uint32     uint32_t
1065  * ctypedef npy_uint64     uint64_t
1066  */
1067 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1068 
1069 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":699
1070  * ctypedef npy_uint8      uint8_t
1071  * ctypedef npy_uint16     uint16_t
1072  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
1073  * ctypedef npy_uint64     uint64_t
1074  * #ctypedef npy_uint96     uint96_t
1075  */
1076 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1077 
1078 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":700
1079  * ctypedef npy_uint16     uint16_t
1080  * ctypedef npy_uint32     uint32_t
1081  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
1082  * #ctypedef npy_uint96     uint96_t
1083  * #ctypedef npy_uint128    uint128_t
1084  */
1085 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1086 
1087 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":704
1088  * #ctypedef npy_uint128    uint128_t
1089  *
1090  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
1091  * ctypedef npy_float64    float64_t
1092  * #ctypedef npy_float80    float80_t
1093  */
1094 typedef npy_float32 __pyx_t_5numpy_float32_t;
1095 
1096 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":705
1097  *
1098  * ctypedef npy_float32    float32_t
1099  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
1100  * #ctypedef npy_float80    float80_t
1101  * #ctypedef npy_float128   float128_t
1102  */
1103 typedef npy_float64 __pyx_t_5numpy_float64_t;
1104 
1105 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":714
1106  * # The int types are mapped a bit surprising --
1107  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1108  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
1109  * ctypedef npy_longlong   long_t
1110  * ctypedef npy_longlong   longlong_t
1111  */
1112 typedef npy_long __pyx_t_5numpy_int_t;
1113 
1114 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":715
1115  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1116  * ctypedef npy_long       int_t
1117  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
1118  * ctypedef npy_longlong   longlong_t
1119  *
1120  */
1121 typedef npy_longlong __pyx_t_5numpy_long_t;
1122 
1123 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":716
1124  * ctypedef npy_long       int_t
1125  * ctypedef npy_longlong   long_t
1126  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
1127  *
1128  * ctypedef npy_ulong      uint_t
1129  */
1130 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1131 
1132 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":718
1133  * ctypedef npy_longlong   longlong_t
1134  *
1135  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
1136  * ctypedef npy_ulonglong  ulong_t
1137  * ctypedef npy_ulonglong  ulonglong_t
1138  */
1139 typedef npy_ulong __pyx_t_5numpy_uint_t;
1140 
1141 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":719
1142  *
1143  * ctypedef npy_ulong      uint_t
1144  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
1145  * ctypedef npy_ulonglong  ulonglong_t
1146  *
1147  */
1148 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1149 
1150 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":720
1151  * ctypedef npy_ulong      uint_t
1152  * ctypedef npy_ulonglong  ulong_t
1153  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
1154  *
1155  * ctypedef npy_intp       intp_t
1156  */
1157 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1158 
1159 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":722
1160  * ctypedef npy_ulonglong  ulonglong_t
1161  *
1162  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
1163  * ctypedef npy_uintp      uintp_t
1164  *
1165  */
1166 typedef npy_intp __pyx_t_5numpy_intp_t;
1167 
1168 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":723
1169  *
1170  * ctypedef npy_intp       intp_t
1171  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
1172  *
1173  * ctypedef npy_double     float_t
1174  */
1175 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1176 
1177 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":725
1178  * ctypedef npy_uintp      uintp_t
1179  *
1180  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
1181  * ctypedef npy_double     double_t
1182  * ctypedef npy_longdouble longdouble_t
1183  */
1184 typedef npy_double __pyx_t_5numpy_float_t;
1185 
1186 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":726
1187  *
1188  * ctypedef npy_double     float_t
1189  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
1190  * ctypedef npy_longdouble longdouble_t
1191  *
1192  */
1193 typedef npy_double __pyx_t_5numpy_double_t;
1194 
1195 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":727
1196  * ctypedef npy_double     float_t
1197  * ctypedef npy_double     double_t
1198  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
1199  *
1200  * ctypedef npy_cfloat      cfloat_t
1201  */
1202 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1203 
1204 /* "statsmodels/nonparametric/_smoothers_lowess.pyx":20
1205  *
1206  * DTYPE = np.double
1207  * ctypedef np.double_t DTYPE_t             # <<<<<<<<<<<<<<
1208  *
1209  * np.import_array()
1210  */
1211 typedef __pyx_t_5numpy_double_t __pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t;
1212 /* Declarations.proto */
1213 #if CYTHON_CCOMPLEX
1214   #ifdef __cplusplus
1215     typedef ::std::complex< float > __pyx_t_float_complex;
1216   #else
1217     typedef float _Complex __pyx_t_float_complex;
1218   #endif
1219 #else
1220     typedef struct { float real, imag; } __pyx_t_float_complex;
1221 #endif
1222 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1223 
1224 /* Declarations.proto */
1225 #if CYTHON_CCOMPLEX
1226   #ifdef __cplusplus
1227     typedef ::std::complex< double > __pyx_t_double_complex;
1228   #else
1229     typedef double _Complex __pyx_t_double_complex;
1230   #endif
1231 #else
1232     typedef struct { double real, imag; } __pyx_t_double_complex;
1233 #endif
1234 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1235 
1236 
1237 /*--- Type declarations ---*/
1238 struct __pyx_array_obj;
1239 struct __pyx_MemviewEnum_obj;
1240 struct __pyx_memoryview_obj;
1241 struct __pyx_memoryviewslice_obj;
1242 
1243 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":729
1244  * ctypedef npy_longdouble longdouble_t
1245  *
1246  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
1247  * ctypedef npy_cdouble     cdouble_t
1248  * ctypedef npy_clongdouble clongdouble_t
1249  */
1250 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1251 
1252 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":730
1253  *
1254  * ctypedef npy_cfloat      cfloat_t
1255  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
1256  * ctypedef npy_clongdouble clongdouble_t
1257  *
1258  */
1259 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1260 
1261 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":731
1262  * ctypedef npy_cfloat      cfloat_t
1263  * ctypedef npy_cdouble     cdouble_t
1264  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
1265  *
1266  * ctypedef npy_cdouble     complex_t
1267  */
1268 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1269 
1270 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":733
1271  * ctypedef npy_clongdouble clongdouble_t
1272  *
1273  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
1274  *
1275  * cdef inline object PyArray_MultiIterNew1(a):
1276  */
1277 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1278 struct __pyx_opt_args_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_y_fit;
1279 
1280 /* "statsmodels/nonparametric/_smoothers_lowess.pyx":360
1281  *
1282  *
1283  * cdef void calculate_y_fit(np.ndarray[DTYPE_t, ndim = 1] x,             # <<<<<<<<<<<<<<
1284  *                           np.ndarray[DTYPE_t, ndim = 1] y,
1285  *                           Py_ssize_t i,
1286  */
1287 struct __pyx_opt_args_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_y_fit {
1288   int __pyx_n;
1289   int fill_with_nans;
1290 };
1291 
1292 /* "View.MemoryView":105
1293  *
1294  * @cname("__pyx_array")
1295  * cdef class array:             # <<<<<<<<<<<<<<
1296  *
1297  *     cdef:
1298  */
1299 struct __pyx_array_obj {
1300   PyObject_HEAD
1301   struct __pyx_vtabstruct_array *__pyx_vtab;
1302   char *data;
1303   Py_ssize_t len;
1304   char *format;
1305   int ndim;
1306   Py_ssize_t *_shape;
1307   Py_ssize_t *_strides;
1308   Py_ssize_t itemsize;
1309   PyObject *mode;
1310   PyObject *_format;
1311   void (*callback_free_data)(void *);
1312   int free_data;
1313   int dtype_is_object;
1314 };
1315 
1316 
1317 /* "View.MemoryView":279
1318  *
1319  * @cname('__pyx_MemviewEnum')
1320  * cdef class Enum(object):             # <<<<<<<<<<<<<<
1321  *     cdef object name
1322  *     def __init__(self, name):
1323  */
1324 struct __pyx_MemviewEnum_obj {
1325   PyObject_HEAD
1326   PyObject *name;
1327 };
1328 
1329 
1330 /* "View.MemoryView":330
1331  *
1332  * @cname('__pyx_memoryview')
1333  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1334  *
1335  *     cdef object obj
1336  */
1337 struct __pyx_memoryview_obj {
1338   PyObject_HEAD
1339   struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1340   PyObject *obj;
1341   PyObject *_size;
1342   PyObject *_array_interface;
1343   PyThread_type_lock lock;
1344   __pyx_atomic_int acquisition_count[2];
1345   __pyx_atomic_int *acquisition_count_aligned_p;
1346   Py_buffer view;
1347   int flags;
1348   int dtype_is_object;
1349   __Pyx_TypeInfo *typeinfo;
1350 };
1351 
1352 
1353 /* "View.MemoryView":965
1354  *
1355  * @cname('__pyx_memoryviewslice')
1356  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1357  *     "Internal class for passing memoryview slices to Python"
1358  *
1359  */
1360 struct __pyx_memoryviewslice_obj {
1361   struct __pyx_memoryview_obj __pyx_base;
1362   __Pyx_memviewslice from_slice;
1363   PyObject *from_object;
1364   PyObject *(*to_object_func)(char *);
1365   int (*to_dtype_func)(char *, PyObject *);
1366 };
1367 
1368 
1369 
1370 /* "View.MemoryView":105
1371  *
1372  * @cname("__pyx_array")
1373  * cdef class array:             # <<<<<<<<<<<<<<
1374  *
1375  *     cdef:
1376  */
1377 
1378 struct __pyx_vtabstruct_array {
1379   PyObject *(*get_memview)(struct __pyx_array_obj *);
1380 };
1381 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1382 
1383 
1384 /* "View.MemoryView":330
1385  *
1386  * @cname('__pyx_memoryview')
1387  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1388  *
1389  *     cdef object obj
1390  */
1391 
1392 struct __pyx_vtabstruct_memoryview {
1393   char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1394   PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1395   PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1396   PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1397   PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1398   PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1399   PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1400 };
1401 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1402 
1403 
1404 /* "View.MemoryView":965
1405  *
1406  * @cname('__pyx_memoryviewslice')
1407  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1408  *     "Internal class for passing memoryview slices to Python"
1409  *
1410  */
1411 
1412 struct __pyx_vtabstruct__memoryviewslice {
1413   struct __pyx_vtabstruct_memoryview __pyx_base;
1414 };
1415 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1416 
1417 /* --- Runtime support code (head) --- */
1418 /* Refnanny.proto */
1419 #ifndef CYTHON_REFNANNY
1420   #define CYTHON_REFNANNY 0
1421 #endif
1422 #if CYTHON_REFNANNY
1423   typedef struct {
1424     void (*INCREF)(void*, PyObject*, int);
1425     void (*DECREF)(void*, PyObject*, int);
1426     void (*GOTREF)(void*, PyObject*, int);
1427     void (*GIVEREF)(void*, PyObject*, int);
1428     void* (*SetupContext)(const char*, int, const char*);
1429     void (*FinishContext)(void**);
1430   } __Pyx_RefNannyAPIStruct;
1431   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1432   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1433   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1434 #ifdef WITH_THREAD
1435   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1436           if (acquire_gil) {\
1437               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1438               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1439               PyGILState_Release(__pyx_gilstate_save);\
1440           } else {\
1441               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1442           }
1443 #else
1444   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1445           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1446 #endif
1447   #define __Pyx_RefNannyFinishContext()\
1448           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1449   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1450   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1451   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1452   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1453   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1454   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1455   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1456   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1457 #else
1458   #define __Pyx_RefNannyDeclarations
1459   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1460   #define __Pyx_RefNannyFinishContext()
1461   #define __Pyx_INCREF(r) Py_INCREF(r)
1462   #define __Pyx_DECREF(r) Py_DECREF(r)
1463   #define __Pyx_GOTREF(r)
1464   #define __Pyx_GIVEREF(r)
1465   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1466   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1467   #define __Pyx_XGOTREF(r)
1468   #define __Pyx_XGIVEREF(r)
1469 #endif
1470 #define __Pyx_XDECREF_SET(r, v) do {\
1471         PyObject *tmp = (PyObject *) r;\
1472         r = v; __Pyx_XDECREF(tmp);\
1473     } while (0)
1474 #define __Pyx_DECREF_SET(r, v) do {\
1475         PyObject *tmp = (PyObject *) r;\
1476         r = v; __Pyx_DECREF(tmp);\
1477     } while (0)
1478 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1479 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1480 
1481 /* PyObjectGetAttrStr.proto */
1482 #if CYTHON_USE_TYPE_SLOTS
1483 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1484 #else
1485 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1486 #endif
1487 
1488 /* GetBuiltinName.proto */
1489 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1490 
1491 /* RaiseArgTupleInvalid.proto */
1492 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1493     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1494 
1495 /* RaiseDoubleKeywords.proto */
1496 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1497 
1498 /* ParseKeywords.proto */
1499 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1500     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1501     const char* function_name);
1502 
1503 /* ArgTypeTest.proto */
1504 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1505     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1506         __Pyx__ArgTypeTest(obj, type, name, exact))
1507 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1508 
1509 /* IsLittleEndian.proto */
1510 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1511 
1512 /* BufferFormatCheck.proto */
1513 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1514 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1515                               __Pyx_BufFmt_StackElem* stack,
1516                               __Pyx_TypeInfo* type);
1517 
1518 /* BufferGetAndValidate.proto */
1519 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1520     ((obj == Py_None || obj == NULL) ?\
1521     (__Pyx_ZeroBuffer(buf), 0) :\
1522     __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1523 static int  __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1524     __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1525 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1526 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1527 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1528 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1529 
1530 /* BufferFallbackError.proto */
1531 static void __Pyx_RaiseBufferFallbackError(void);
1532 
1533 /* PyObjectCall.proto */
1534 #if CYTHON_COMPILING_IN_CPYTHON
1535 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1536 #else
1537 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1538 #endif
1539 
1540 /* PyThreadStateGet.proto */
1541 #if CYTHON_FAST_THREAD_STATE
1542 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1543 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1544 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1545 #else
1546 #define __Pyx_PyThreadState_declare
1547 #define __Pyx_PyThreadState_assign
1548 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1549 #endif
1550 
1551 /* PyErrFetchRestore.proto */
1552 #if CYTHON_FAST_THREAD_STATE
1553 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1554 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1555 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1556 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1557 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1558 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1559 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1560 #if CYTHON_COMPILING_IN_CPYTHON
1561 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1562 #else
1563 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1564 #endif
1565 #else
1566 #define __Pyx_PyErr_Clear() PyErr_Clear()
1567 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1568 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1569 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1570 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1571 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1572 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1573 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1574 #endif
1575 
1576 /* RaiseException.proto */
1577 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1578 
1579 /* PyDictVersioning.proto */
1580 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1581 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1582 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1583 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1584     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1585     (cache_var) = (value);
1586 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1587     static PY_UINT64_T __pyx_dict_version = 0;\
1588     static PyObject *__pyx_dict_cached_value = NULL;\
1589     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1590         (VAR) = __pyx_dict_cached_value;\
1591     } else {\
1592         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1593         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1594     }\
1595 }
1596 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1597 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1598 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1599 #else
1600 #define __PYX_GET_DICT_VERSION(dict)  (0)
1601 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1602 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1603 #endif
1604 
1605 /* GetModuleGlobalName.proto */
1606 #if CYTHON_USE_DICT_VERSIONS
1607 #define __Pyx_GetModuleGlobalName(var, name)  {\
1608     static PY_UINT64_T __pyx_dict_version = 0;\
1609     static PyObject *__pyx_dict_cached_value = NULL;\
1610     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1611         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1612         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1613 }
1614 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1615     PY_UINT64_T __pyx_dict_version;\
1616     PyObject *__pyx_dict_cached_value;\
1617     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1618 }
1619 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1620 #else
1621 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1622 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1623 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1624 #endif
1625 
1626 /* PyCFunctionFastCall.proto */
1627 #if CYTHON_FAST_PYCCALL
1628 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1629 #else
1630 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1631 #endif
1632 
1633 /* PyFunctionFastCall.proto */
1634 #if CYTHON_FAST_PYCALL
1635 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1636     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1637 #if 1 || PY_VERSION_HEX < 0x030600B1
1638 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1639 #else
1640 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1641 #endif
1642 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1643     (sizeof(char [1 - 2*!(cond)]) - 1)
1644 #ifndef Py_MEMBER_SIZE
1645 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1646 #endif
1647   static size_t __pyx_pyframe_localsplus_offset = 0;
1648   #include "frameobject.h"
1649   #define __Pxy_PyFrame_Initialize_Offsets()\
1650     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1651      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1652   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1653     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1654 #endif
1655 
1656 /* PyObjectCall2Args.proto */
1657 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1658 
1659 /* PyObjectCallMethO.proto */
1660 #if CYTHON_COMPILING_IN_CPYTHON
1661 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1662 #endif
1663 
1664 /* PyObjectCallOneArg.proto */
1665 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1666 
1667 /* ExtTypeTest.proto */
1668 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1669 
1670 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1671 /* MemviewSliceInit.proto */
1672 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1673 #define __Pyx_MEMVIEW_DIRECT   1
1674 #define __Pyx_MEMVIEW_PTR      2
1675 #define __Pyx_MEMVIEW_FULL     4
1676 #define __Pyx_MEMVIEW_CONTIG   8
1677 #define __Pyx_MEMVIEW_STRIDED  16
1678 #define __Pyx_MEMVIEW_FOLLOW   32
1679 #define __Pyx_IS_C_CONTIG 1
1680 #define __Pyx_IS_F_CONTIG 2
1681 static int __Pyx_init_memviewslice(
1682                 struct __pyx_memoryview_obj *memview,
1683                 int ndim,
1684                 __Pyx_memviewslice *memviewslice,
1685                 int memview_is_new_reference);
1686 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1687     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1688 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1689     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1690 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1691 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1692 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1693 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1694 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1695 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1696 
1697 /* RaiseTooManyValuesToUnpack.proto */
1698 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1699 
1700 /* RaiseNeedMoreValuesToUnpack.proto */
1701 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1702 
1703 /* IterFinish.proto */
1704 static CYTHON_INLINE int __Pyx_IterFinish(void);
1705 
1706 /* UnpackItemEndCheck.proto */
1707 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1708 
1709 /* None.proto */
1710 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1711 
1712 /* GetItemInt.proto */
1713 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1714     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1715     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1716     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1717                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1718 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1719     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1720     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1721     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1722 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1723                                                               int wraparound, int boundscheck);
1724 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1725     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1726     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1727     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1728 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1729                                                               int wraparound, int boundscheck);
1730 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1731 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1732                                                      int is_list, int wraparound, int boundscheck);
1733 
1734 /* ObjectGetItem.proto */
1735 #if CYTHON_USE_TYPE_SLOTS
1736 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1737 #else
1738 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1739 #endif
1740 
1741 /* WriteUnraisableException.proto */
1742 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1743                                   int lineno, const char *filename,
1744                                   int full_traceback, int nogil);
1745 
1746 /* GetTopmostException.proto */
1747 #if CYTHON_USE_EXC_INFO_STACK
1748 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1749 #endif
1750 
1751 /* SaveResetException.proto */
1752 #if CYTHON_FAST_THREAD_STATE
1753 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1754 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1755 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1756 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1757 #else
1758 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1759 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1760 #endif
1761 
1762 /* PyErrExceptionMatches.proto */
1763 #if CYTHON_FAST_THREAD_STATE
1764 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1765 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1766 #else
1767 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1768 #endif
1769 
1770 /* GetException.proto */
1771 #if CYTHON_FAST_THREAD_STATE
1772 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1773 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1774 #else
1775 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1776 #endif
1777 
1778 /* IncludeStringH.proto */
1779 #include <string.h>
1780 
1781 /* BytesEquals.proto */
1782 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1783 
1784 /* UnicodeEquals.proto */
1785 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1786 
1787 /* StrEquals.proto */
1788 #if PY_MAJOR_VERSION >= 3
1789 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1790 #else
1791 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1792 #endif
1793 
1794 /* UnaryNegOverflows.proto */
1795 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1796         (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1797 
1798 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1799 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1800 /* GetAttr.proto */
1801 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1802 
1803 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1804 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1805     int byteorder = 0;
1806     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1807 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1808 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1809     int byteorder = -1;
1810     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1811 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)1812 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1813     int byteorder = 1;
1814     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1815 }
1816 
1817 /* decode_c_string.proto */
1818 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1819          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1820          const char* encoding, const char* errors,
1821          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1822 
1823 /* GetAttr3.proto */
1824 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1825 
1826 /* RaiseNoneIterError.proto */
1827 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1828 
1829 /* SwapException.proto */
1830 #if CYTHON_FAST_THREAD_STATE
1831 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1832 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1833 #else
1834 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1835 #endif
1836 
1837 /* Import.proto */
1838 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1839 
1840 /* FastTypeChecks.proto */
1841 #if CYTHON_COMPILING_IN_CPYTHON
1842 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1843 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1844 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1845 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1846 #else
1847 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1848 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1849 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1850 #endif
1851 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1852 
1853 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1854 /* ListCompAppend.proto */
1855 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)1856 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1857     PyListObject* L = (PyListObject*) list;
1858     Py_ssize_t len = Py_SIZE(list);
1859     if (likely(L->allocated > len)) {
1860         Py_INCREF(x);
1861         PyList_SET_ITEM(list, len, x);
1862         __Pyx_SET_SIZE(list, len + 1);
1863         return 0;
1864     }
1865     return PyList_Append(list, x);
1866 }
1867 #else
1868 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1869 #endif
1870 
1871 /* PyIntBinop.proto */
1872 #if !CYTHON_COMPILING_IN_PYPY
1873 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1874 #else
1875 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1876     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1877 #endif
1878 
1879 /* ListExtend.proto */
__Pyx_PyList_Extend(PyObject * L,PyObject * v)1880 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1881 #if CYTHON_COMPILING_IN_CPYTHON
1882     PyObject* none = _PyList_Extend((PyListObject*)L, v);
1883     if (unlikely(!none))
1884         return -1;
1885     Py_DECREF(none);
1886     return 0;
1887 #else
1888     return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1889 #endif
1890 }
1891 
1892 /* ListAppend.proto */
1893 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1894 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1895     PyListObject* L = (PyListObject*) list;
1896     Py_ssize_t len = Py_SIZE(list);
1897     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1898         Py_INCREF(x);
1899         PyList_SET_ITEM(list, len, x);
1900         __Pyx_SET_SIZE(list, len + 1);
1901         return 0;
1902     }
1903     return PyList_Append(list, x);
1904 }
1905 #else
1906 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1907 #endif
1908 
1909 /* ImportFrom.proto */
1910 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1911 
1912 /* HasAttr.proto */
1913 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1914 
1915 /* PyObject_GenericGetAttrNoDict.proto */
1916 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1917 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1918 #else
1919 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1920 #endif
1921 
1922 /* PyObject_GenericGetAttr.proto */
1923 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1924 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1925 #else
1926 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1927 #endif
1928 
1929 /* SetVTable.proto */
1930 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1931 
1932 /* PyObjectGetAttrStrNoError.proto */
1933 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1934 
1935 /* SetupReduce.proto */
1936 static int __Pyx_setup_reduce(PyObject* type_obj);
1937 
1938 /* TypeImport.proto */
1939 #ifndef __PYX_HAVE_RT_ImportType_proto
1940 #define __PYX_HAVE_RT_ImportType_proto
1941 enum __Pyx_ImportType_CheckSize {
1942    __Pyx_ImportType_CheckSize_Error = 0,
1943    __Pyx_ImportType_CheckSize_Warn = 1,
1944    __Pyx_ImportType_CheckSize_Ignore = 2
1945 };
1946 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1947 #endif
1948 
1949 /* CLineInTraceback.proto */
1950 #ifdef CYTHON_CLINE_IN_TRACEBACK
1951 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1952 #else
1953 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1954 #endif
1955 
1956 /* CodeObjectCache.proto */
1957 typedef struct {
1958     PyCodeObject* code_object;
1959     int code_line;
1960 } __Pyx_CodeObjectCacheEntry;
1961 struct __Pyx_CodeObjectCache {
1962     int count;
1963     int max_count;
1964     __Pyx_CodeObjectCacheEntry* entries;
1965 };
1966 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1967 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1968 static PyCodeObject *__pyx_find_code_object(int code_line);
1969 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1970 
1971 /* AddTraceback.proto */
1972 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1973                                int py_line, const char *filename);
1974 
1975 #if PY_MAJOR_VERSION < 3
1976     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1977     static void __Pyx_ReleaseBuffer(Py_buffer *view);
1978 #else
1979     #define __Pyx_GetBuffer PyObject_GetBuffer
1980     #define __Pyx_ReleaseBuffer PyBuffer_Release
1981 #endif
1982 
1983 
1984 /* BufferStructDeclare.proto */
1985 typedef struct {
1986   Py_ssize_t shape, strides, suboffsets;
1987 } __Pyx_Buf_DimInfo;
1988 typedef struct {
1989   size_t refcount;
1990   Py_buffer pybuffer;
1991 } __Pyx_Buffer;
1992 typedef struct {
1993   __Pyx_Buffer *rcbuffer;
1994   char *data;
1995   __Pyx_Buf_DimInfo diminfo[8];
1996 } __Pyx_LocalBuf_ND;
1997 
1998 /* MemviewSliceIsContig.proto */
1999 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
2000 
2001 /* OverlappingSlices.proto */
2002 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2003                                 __Pyx_memviewslice *slice2,
2004                                 int ndim, size_t itemsize);
2005 
2006 /* Capsule.proto */
2007 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2008 
2009 /* TypeInfoCompare.proto */
2010 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2011 
2012 /* MemviewSliceValidateAndInit.proto */
2013 static int __Pyx_ValidateAndInit_memviewslice(
2014                 int *axes_specs,
2015                 int c_or_f_flag,
2016                 int buf_flags,
2017                 int ndim,
2018                 __Pyx_TypeInfo *dtype,
2019                 __Pyx_BufFmt_StackElem stack[],
2020                 __Pyx_memviewslice *memviewslice,
2021                 PyObject *original_obj);
2022 
2023 /* ObjectToMemviewSlice.proto */
2024 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_double(PyObject *, int writable_flag);
2025 
2026 /* GCCDiagnostics.proto */
2027 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2028 #define __Pyx_HAS_GCC_DIAGNOSTIC
2029 #endif
2030 
2031 /* MemviewDtypeToObject.proto */
2032 static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp);
2033 static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj);
2034 
2035 /* RealImag.proto */
2036 #if CYTHON_CCOMPLEX
2037   #ifdef __cplusplus
2038     #define __Pyx_CREAL(z) ((z).real())
2039     #define __Pyx_CIMAG(z) ((z).imag())
2040   #else
2041     #define __Pyx_CREAL(z) (__real__(z))
2042     #define __Pyx_CIMAG(z) (__imag__(z))
2043   #endif
2044 #else
2045     #define __Pyx_CREAL(z) ((z).real)
2046     #define __Pyx_CIMAG(z) ((z).imag)
2047 #endif
2048 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2049         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2050     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2051     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2052 #else
2053     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2054     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2055 #endif
2056 
2057 /* Arithmetic.proto */
2058 #if CYTHON_CCOMPLEX
2059     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
2060     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
2061     #define __Pyx_c_diff_float(a, b) ((a)-(b))
2062     #define __Pyx_c_prod_float(a, b) ((a)*(b))
2063     #define __Pyx_c_quot_float(a, b) ((a)/(b))
2064     #define __Pyx_c_neg_float(a)     (-(a))
2065   #ifdef __cplusplus
2066     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2067     #define __Pyx_c_conj_float(z)    (::std::conj(z))
2068     #if 1
2069         #define __Pyx_c_abs_float(z)     (::std::abs(z))
2070         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
2071     #endif
2072   #else
2073     #define __Pyx_c_is_zero_float(z) ((z)==0)
2074     #define __Pyx_c_conj_float(z)    (conjf(z))
2075     #if 1
2076         #define __Pyx_c_abs_float(z)     (cabsf(z))
2077         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
2078     #endif
2079  #endif
2080 #else
2081     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2082     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2083     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2084     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2085     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2086     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2087     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2088     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2089     #if 1
2090         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2091         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2092     #endif
2093 #endif
2094 
2095 /* Arithmetic.proto */
2096 #if CYTHON_CCOMPLEX
2097     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
2098     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
2099     #define __Pyx_c_diff_double(a, b) ((a)-(b))
2100     #define __Pyx_c_prod_double(a, b) ((a)*(b))
2101     #define __Pyx_c_quot_double(a, b) ((a)/(b))
2102     #define __Pyx_c_neg_double(a)     (-(a))
2103   #ifdef __cplusplus
2104     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2105     #define __Pyx_c_conj_double(z)    (::std::conj(z))
2106     #if 1
2107         #define __Pyx_c_abs_double(z)     (::std::abs(z))
2108         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
2109     #endif
2110   #else
2111     #define __Pyx_c_is_zero_double(z) ((z)==0)
2112     #define __Pyx_c_conj_double(z)    (conj(z))
2113     #if 1
2114         #define __Pyx_c_abs_double(z)     (cabs(z))
2115         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
2116     #endif
2117  #endif
2118 #else
2119     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2120     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2121     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2122     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2123     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2124     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2125     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2126     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2127     #if 1
2128         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2129         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2130     #endif
2131 #endif
2132 
2133 /* MemviewSliceCopyTemplate.proto */
2134 static __Pyx_memviewslice
2135 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2136                                  const char *mode, int ndim,
2137                                  size_t sizeof_dtype, int contig_flag,
2138                                  int dtype_is_object);
2139 
2140 /* CIntFromPy.proto */
2141 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2142 
2143 /* CIntToPy.proto */
2144 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
2145 
2146 /* CIntFromPy.proto */
2147 static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *);
2148 
2149 /* CIntFromPy.proto */
2150 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2151 
2152 /* CIntToPy.proto */
2153 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2154 
2155 /* CIntToPy.proto */
2156 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2157 
2158 /* CIntFromPy.proto */
2159 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2160 
2161 /* CheckBinaryVersion.proto */
2162 static int __Pyx_check_binary_version(void);
2163 
2164 /* InitStrings.proto */
2165 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2166 
2167 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2168 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2169 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2170 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2171 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
2172 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2173 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2174 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2175 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2176 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2177 
2178 /* Module declarations from 'cython.view' */
2179 
2180 /* Module declarations from 'cython' */
2181 
2182 /* Module declarations from 'cpython.buffer' */
2183 
2184 /* Module declarations from 'libc.string' */
2185 
2186 /* Module declarations from 'libc.stdio' */
2187 
2188 /* Module declarations from '__builtin__' */
2189 
2190 /* Module declarations from 'cpython.type' */
2191 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2192 
2193 /* Module declarations from 'cpython' */
2194 
2195 /* Module declarations from 'cpython.object' */
2196 
2197 /* Module declarations from 'cpython.ref' */
2198 
2199 /* Module declarations from 'cpython.mem' */
2200 
2201 /* Module declarations from 'numpy' */
2202 
2203 /* Module declarations from 'numpy' */
2204 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2205 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2206 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2207 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2208 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2209 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2210 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2211 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2212 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2213 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2214 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2215 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2216 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2217 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2218 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2219 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void); /*proto*/
2220 
2221 /* Module declarations from 'libc.math' */
2222 
2223 /* Module declarations from 'statsmodels.nonparametric._smoothers_lowess' */
2224 static PyTypeObject *__pyx_array_type = 0;
2225 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2226 static PyTypeObject *__pyx_memoryview_type = 0;
2227 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2228 static PyObject *generic = 0;
2229 static PyObject *strided = 0;
2230 static PyObject *indirect = 0;
2231 static PyObject *contiguous = 0;
2232 static PyObject *indirect_contiguous = 0;
2233 static int __pyx_memoryview_thread_locks_used;
2234 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2235 static PyObject *__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_update_neighborhood(__Pyx_memviewslice, double, Py_ssize_t, Py_ssize_t, Py_ssize_t, int __pyx_skip_dispatch); /*proto*/
2236 static int __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_weights(PyArrayObject *, PyArrayObject *, PyArrayObject *, __pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, Py_ssize_t, Py_ssize_t, double); /*proto*/
2237 static void __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_y_fit(PyArrayObject *, PyArrayObject *, Py_ssize_t, __pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyArrayObject *, PyArrayObject *, Py_ssize_t, Py_ssize_t, int, struct __pyx_opt_args_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_y_fit *__pyx_optional_args); /*proto*/
2238 static void __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_interpolate_skipped_fits(__Pyx_memviewslice, __Pyx_memviewslice, Py_ssize_t, Py_ssize_t); /*proto*/
2239 static PyObject *__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_update_indices(__Pyx_memviewslice, __Pyx_memviewslice, double, Py_ssize_t, Py_ssize_t, Py_ssize_t, int __pyx_skip_dispatch); /*proto*/
2240 static PyArrayObject *__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_residual_weights(__Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2241 static void __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_tricube(__Pyx_memviewslice); /*proto*/
2242 static void __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_fast_array_cube(__Pyx_memviewslice); /*proto*/
2243 static PyArrayObject *__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_bisquare(__Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2244 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2245 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2246 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2247 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2248 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2249 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2250 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2251 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
2252 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2253 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2254 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2255 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2256 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2257 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2258 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2259 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2260 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2261 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2262 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2263 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2264 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2265 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2266 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2267 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2268 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2269 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2270 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2271 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2272 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2273 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2274 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2275 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2276 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2277 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
2278 static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
2279 #define __Pyx_MODULE_NAME "statsmodels.nonparametric._smoothers_lowess"
2280 extern int __pyx_module_is_main_statsmodels__nonparametric___smoothers_lowess;
2281 int __pyx_module_is_main_statsmodels__nonparametric___smoothers_lowess = 0;
2282 
2283 /* Implementation of 'statsmodels.nonparametric._smoothers_lowess' */
2284 static PyObject *__pyx_builtin_ValueError;
2285 static PyObject *__pyx_builtin_range;
2286 static PyObject *__pyx_builtin_ImportError;
2287 static PyObject *__pyx_builtin_MemoryError;
2288 static PyObject *__pyx_builtin_enumerate;
2289 static PyObject *__pyx_builtin_TypeError;
2290 static PyObject *__pyx_builtin_Ellipsis;
2291 static PyObject *__pyx_builtin_id;
2292 static PyObject *__pyx_builtin_IndexError;
2293 static const char __pyx_k_O[] = "O";
2294 static const char __pyx_k_T[] = "T";
2295 static const char __pyx_k_c[] = "c";
2296 static const char __pyx_k_i[] = "i";
2297 static const char __pyx_k_j[] = "j";
2298 static const char __pyx_k_k[] = "k";
2299 static const char __pyx_k_n[] = "n";
2300 static const char __pyx_k_x[] = "x";
2301 static const char __pyx_k_y[] = "y";
2302 static const char __pyx_k_id[] = "id";
2303 static const char __pyx_k_it[] = "it";
2304 static const char __pyx_k_np[] = "np";
2305 static const char __pyx_k_abs[] = "abs";
2306 static const char __pyx_k_new[] = "__new__";
2307 static const char __pyx_k_obj[] = "obj";
2308 static const char __pyx_k_sum[] = "sum";
2309 static const char __pyx_k_base[] = "base";
2310 static const char __pyx_k_dict[] = "__dict__";
2311 static const char __pyx_k_exog[] = "exog";
2312 static const char __pyx_k_frac[] = "frac";
2313 static const char __pyx_k_main[] = "__main__";
2314 static const char __pyx_k_mode[] = "mode";
2315 static const char __pyx_k_name[] = "name";
2316 static const char __pyx_k_ndim[] = "ndim";
2317 static const char __pyx_k_pack[] = "pack";
2318 static const char __pyx_k_size[] = "size";
2319 static const char __pyx_k_step[] = "step";
2320 static const char __pyx_k_stop[] = "stop";
2321 static const char __pyx_k_test[] = "__test__";
2322 static const char __pyx_k_xval[] = "xval";
2323 static const char __pyx_k_ASCII[] = "ASCII";
2324 static const char __pyx_k_DTYPE[] = "DTYPE";
2325 static const char __pyx_k_array[] = "array";
2326 static const char __pyx_k_class[] = "__class__";
2327 static const char __pyx_k_delta[] = "delta";
2328 static const char __pyx_k_empty[] = "empty";
2329 static const char __pyx_k_endog[] = "endog";
2330 static const char __pyx_k_error[] = "error";
2331 static const char __pyx_k_flags[] = "flags";
2332 static const char __pyx_k_numpy[] = "numpy";
2333 static const char __pyx_k_out_n[] = "out_n";
2334 static const char __pyx_k_range[] = "range";
2335 static const char __pyx_k_shape[] = "shape";
2336 static const char __pyx_k_start[] = "start";
2337 static const char __pyx_k_xvals[] = "xvals";
2338 static const char __pyx_k_y_fit[] = "y_fit";
2339 static const char __pyx_k_double[] = "double";
2340 static const char __pyx_k_encode[] = "encode";
2341 static const char __pyx_k_format[] = "format";
2342 static const char __pyx_k_import[] = "__import__";
2343 static const char __pyx_k_lowess[] = "lowess";
2344 static const char __pyx_k_median[] = "median";
2345 static const char __pyx_k_name_2[] = "__name__";
2346 static const char __pyx_k_pickle[] = "pickle";
2347 static const char __pyx_k_radius[] = "radius";
2348 static const char __pyx_k_reduce[] = "__reduce__";
2349 static const char __pyx_k_reg_ok[] = "reg_ok";
2350 static const char __pyx_k_struct[] = "struct";
2351 static const char __pyx_k_unpack[] = "unpack";
2352 static const char __pyx_k_update[] = "update";
2353 static const char __pyx_k_fortran[] = "fortran";
2354 static const char __pyx_k_memview[] = "memview";
2355 static const char __pyx_k_robiter[] = "robiter";
2356 static const char __pyx_k_weights[] = "weights";
2357 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2358 static const char __pyx_k_getstate[] = "__getstate__";
2359 static const char __pyx_k_itemsize[] = "itemsize";
2360 static const char __pyx_k_left_end[] = "left_end";
2361 static const char __pyx_k_pyx_type[] = "__pyx_type";
2362 static const char __pyx_k_setstate[] = "__setstate__";
2363 static const char __pyx_k_TypeError[] = "TypeError";
2364 static const char __pyx_k_enumerate[] = "enumerate";
2365 static const char __pyx_k_pyx_state[] = "__pyx_state";
2366 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2367 static const char __pyx_k_right_end[] = "right_end";
2368 static const char __pyx_k_IndexError[] = "IndexError";
2369 static const char __pyx_k_ValueError[] = "ValueError";
2370 static const char __pyx_k_last_fit_i[] = "last_fit_i";
2371 static const char __pyx_k_pyx_result[] = "__pyx_result";
2372 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2373 static const char __pyx_k_ImportError[] = "ImportError";
2374 static const char __pyx_k_MemoryError[] = "MemoryError";
2375 static const char __pyx_k_PickleError[] = "PickleError";
2376 static const char __pyx_k_given_xvals[] = "given_xvals";
2377 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2378 static const char __pyx_k_stringsource[] = "stringsource";
2379 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2380 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2381 static const char __pyx_k_resid_weights[] = "resid_weights";
2382 static const char __pyx_k_lowess_line_24[] = "lowess (line 24)";
2383 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2384 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2385 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2386 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2387 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2388 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2389 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2390 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2391 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2392 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2393 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2394 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2395 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2396 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2397 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2398 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2399 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2400 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2401 static const char __pyx_k_Univariate_lowess_function_like[] = "\nUnivariate lowess function, like in R.\n\nReferences\n----------\nHastie, Tibshirani, Friedman. (2009) The Elements of Statistical Learning: Data\nMining, Inference, and Prediction, Second Edition: Chapter 6.\n\nCleveland, W.S. (1979) \"Robust Locally Weighted Regression and Smoothing\nScatterplots\". Journal of the American Statistical Association 74 (368): 829-836.\n";
2402 static const char __pyx_k_lowess_endog_exog_xvals_resid_w[] = "\n    lowess(endog, exog, xvals, resid_weights, frac=2/3, it=3, delta=0, given_xvals=False)\n\n    LOWESS (Locally Weighted Scatterplot Smoothing)\n\n    A lowess function that outs smoothed estimates of endog\n    at the given exog values from points (exog, endog)\n\n    Parameters\n    ----------\n    endog : 1-D numpy array\n        The y-values of the observed points\n    exog : 1-D numpy array\n        The x-values of the observed points. exog has to be increasing.\n    xvals : ndarray, 1d\n        The x-values of the points at which to perform the regression\n    resid_weights : 1-D numpy array\n        The initial weightings of the observed points based off residuals\n    frac : float\n        Between 0 and 1. The fraction of the data used\n        when estimating each y-value.\n    it : int\n        The number of residual-based reweightings\n        to perform.\n    delta : float\n        Distance within which to use linear-interpolation\n        instead of weighted regression.\n    given_xvals : bool\n        Whether xvals was provided as a an argument or whether\n        we are just using xvals = exog\n\n    Returns\n    -------\n    out : numpy array\n        A numpy array with two columns. The first column\n        is the sorted x values and the second column the\n        associated estimated y-values.\n    resid_weights: ndarray\n        A numpy array containing the final residual weightings\n        of the data points\n\n    Notes\n    -----\n    This lowess function implements the algorithm given in the\n    reference below using local linear estimates.\n\n    Suppose the input data has N points. The algorithm works by\n    estimating the `smooth` y_i by taking the frac*N closest points\n    to (x_i,y_i) based on their x values and estimating y_i\n    using a weighted linear regression. The weight for (x_j,y_j)\n    is tricube function applied to |x_i-x_j|.\n\n    If it > 1, then further weighted local linear regressions\n    are performed, where the ""weights are the same as above\n    times the _lowess_bisquare function of the residuals. Each iteration\n    takes approximately the same amount of time as the original fit,\n    so these iterations are expensive. They are most useful when\n    the noise has extremely heavy tails, such as Cauchy noise.\n    Noise with less heavy-tails, such as t-distributions with df>2,\n    are less problematic. The weights downgrade the influence of\n    points with large residuals. In the extreme case, points whose\n    residuals are larger than 6 times the median absolute residual\n    are given weight 0.\n\n    delta can be used to save computations. For each x_i, regressions\n    are skipped for points closer than delta. The next regression is\n    fit for the farthest point within delta of x_i and all points in\n    between are estimated by linearly interpolating between the two\n    regression fits.\n\n    Judicious choice of delta can cut computation time considerably\n    for large data (N > 5000). A good choice is delta = 0.01 *\n    range(exog).\n\n    Some experimentation is likely required to find a good\n    choice of frac and iter for a particular dataset.\n\n    References\n    ----------\n    Cleveland, W.S. (1979) \"Robust Locally Weighted Regression\n    and Smoothing Scatterplots\". Journal of the American Statistical\n    Association 74 (368): 829-836.\n\n    Examples\n    --------\n    The below allows a comparison between how different the fits from\n    lowess for different values of frac can be.\n\n    >>> import numpy as np\n    >>> import statsmodels.api as sm\n    >>> lowess = sm.nonparametric.lowess\n    >>> x = np.random.uniform(low = -2*np.pi, high = 2*np.pi, size=500)\n    >>> y = np.sin(x) + np.random.normal(size=len(x))\n    >>> z = lowess(y, x)\n    >>> w = lowess(y, x, frac=1./3)\n\n    This gives a similar comparison for when it is 0 vs not.\n\n    >>> import numpy as np\n    >>> import scipy.stats as stats\n    >>> import statsmodels.api as sm""\n    >>> lowess = sm.nonparametric.lowess\n    >>> x = np.random.uniform(low = -2*np.pi, high = 2*np.pi, size=500)\n    >>> y = np.sin(x) + stats.cauchy.rvs(size=len(x))\n    >>> z = lowess(y, x, frac= 1./3, it=0)\n    >>> w = lowess(y, x, frac=1./3)\n\n    ";
2403 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2404 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2405 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2406 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2407 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2408 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2409 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2410 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2411 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2412 static const char __pyx_k_Lowess_frac_must_be_in_the_range[] = "Lowess `frac` must be in the range [0,1]!";
2413 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2414 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2415 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2416 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2417 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2418 static const char __pyx_k_statsmodels_nonparametric__smoot[] = "statsmodels\\nonparametric\\_smoothers_lowess.pyx";
2419 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2420 static const char __pyx_k_statsmodels_nonparametric__smoot_2[] = "statsmodels.nonparametric._smoothers_lowess";
2421 static PyObject *__pyx_n_s_ASCII;
2422 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2423 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2424 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2425 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2426 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2427 static PyObject *__pyx_n_s_DTYPE;
2428 static PyObject *__pyx_n_s_Ellipsis;
2429 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2430 static PyObject *__pyx_n_s_ImportError;
2431 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2432 static PyObject *__pyx_n_s_IndexError;
2433 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2434 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2435 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2436 static PyObject *__pyx_kp_u_Lowess_frac_must_be_in_the_range;
2437 static PyObject *__pyx_n_s_MemoryError;
2438 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2439 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2440 static PyObject *__pyx_n_b_O;
2441 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2442 static PyObject *__pyx_n_s_PickleError;
2443 static PyObject *__pyx_n_s_T;
2444 static PyObject *__pyx_n_s_TypeError;
2445 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2446 static PyObject *__pyx_n_s_ValueError;
2447 static PyObject *__pyx_n_s_View_MemoryView;
2448 static PyObject *__pyx_n_s_abs;
2449 static PyObject *__pyx_n_s_allocate_buffer;
2450 static PyObject *__pyx_n_s_array;
2451 static PyObject *__pyx_n_s_base;
2452 static PyObject *__pyx_n_s_c;
2453 static PyObject *__pyx_n_u_c;
2454 static PyObject *__pyx_n_s_class;
2455 static PyObject *__pyx_n_s_cline_in_traceback;
2456 static PyObject *__pyx_kp_s_contiguous_and_direct;
2457 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2458 static PyObject *__pyx_n_s_delta;
2459 static PyObject *__pyx_n_s_dict;
2460 static PyObject *__pyx_n_s_double;
2461 static PyObject *__pyx_n_s_dtype_is_object;
2462 static PyObject *__pyx_n_s_empty;
2463 static PyObject *__pyx_n_s_encode;
2464 static PyObject *__pyx_n_s_endog;
2465 static PyObject *__pyx_n_s_enumerate;
2466 static PyObject *__pyx_n_s_error;
2467 static PyObject *__pyx_n_s_exog;
2468 static PyObject *__pyx_n_s_flags;
2469 static PyObject *__pyx_n_s_format;
2470 static PyObject *__pyx_n_s_fortran;
2471 static PyObject *__pyx_n_u_fortran;
2472 static PyObject *__pyx_n_s_frac;
2473 static PyObject *__pyx_n_s_getstate;
2474 static PyObject *__pyx_n_s_given_xvals;
2475 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2476 static PyObject *__pyx_n_s_i;
2477 static PyObject *__pyx_n_s_id;
2478 static PyObject *__pyx_n_s_import;
2479 static PyObject *__pyx_n_s_it;
2480 static PyObject *__pyx_n_s_itemsize;
2481 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2482 static PyObject *__pyx_n_s_j;
2483 static PyObject *__pyx_n_s_k;
2484 static PyObject *__pyx_n_s_last_fit_i;
2485 static PyObject *__pyx_n_s_left_end;
2486 static PyObject *__pyx_n_s_lowess;
2487 static PyObject *__pyx_kp_u_lowess_endog_exog_xvals_resid_w;
2488 static PyObject *__pyx_kp_u_lowess_line_24;
2489 static PyObject *__pyx_n_s_main;
2490 static PyObject *__pyx_n_s_median;
2491 static PyObject *__pyx_n_s_memview;
2492 static PyObject *__pyx_n_s_mode;
2493 static PyObject *__pyx_n_s_n;
2494 static PyObject *__pyx_n_s_name;
2495 static PyObject *__pyx_n_s_name_2;
2496 static PyObject *__pyx_n_s_ndim;
2497 static PyObject *__pyx_n_s_new;
2498 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2499 static PyObject *__pyx_n_s_np;
2500 static PyObject *__pyx_n_s_numpy;
2501 static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
2502 static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
2503 static PyObject *__pyx_n_s_obj;
2504 static PyObject *__pyx_n_s_out_n;
2505 static PyObject *__pyx_n_s_pack;
2506 static PyObject *__pyx_n_s_pickle;
2507 static PyObject *__pyx_n_s_pyx_PickleError;
2508 static PyObject *__pyx_n_s_pyx_checksum;
2509 static PyObject *__pyx_n_s_pyx_getbuffer;
2510 static PyObject *__pyx_n_s_pyx_result;
2511 static PyObject *__pyx_n_s_pyx_state;
2512 static PyObject *__pyx_n_s_pyx_type;
2513 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2514 static PyObject *__pyx_n_s_pyx_vtable;
2515 static PyObject *__pyx_n_s_radius;
2516 static PyObject *__pyx_n_s_range;
2517 static PyObject *__pyx_n_s_reduce;
2518 static PyObject *__pyx_n_s_reduce_cython;
2519 static PyObject *__pyx_n_s_reduce_ex;
2520 static PyObject *__pyx_n_s_reg_ok;
2521 static PyObject *__pyx_n_s_resid_weights;
2522 static PyObject *__pyx_n_s_right_end;
2523 static PyObject *__pyx_n_s_robiter;
2524 static PyObject *__pyx_n_s_setstate;
2525 static PyObject *__pyx_n_s_setstate_cython;
2526 static PyObject *__pyx_n_s_shape;
2527 static PyObject *__pyx_n_s_size;
2528 static PyObject *__pyx_n_s_start;
2529 static PyObject *__pyx_kp_s_statsmodels_nonparametric__smoot;
2530 static PyObject *__pyx_n_s_statsmodels_nonparametric__smoot_2;
2531 static PyObject *__pyx_n_s_step;
2532 static PyObject *__pyx_n_s_stop;
2533 static PyObject *__pyx_kp_s_strided_and_direct;
2534 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2535 static PyObject *__pyx_kp_s_strided_and_indirect;
2536 static PyObject *__pyx_kp_s_stringsource;
2537 static PyObject *__pyx_n_s_struct;
2538 static PyObject *__pyx_n_s_sum;
2539 static PyObject *__pyx_n_s_test;
2540 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2541 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2542 static PyObject *__pyx_n_s_unpack;
2543 static PyObject *__pyx_n_s_update;
2544 static PyObject *__pyx_n_s_weights;
2545 static PyObject *__pyx_n_s_x;
2546 static PyObject *__pyx_n_s_xval;
2547 static PyObject *__pyx_n_s_xvals;
2548 static PyObject *__pyx_n_s_y;
2549 static PyObject *__pyx_n_s_y_fit;
2550 static PyObject *__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_lowess(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_endog, PyArrayObject *__pyx_v_exog, PyArrayObject *__pyx_v_xvals, PyArrayObject *__pyx_v_resid_weights, double __pyx_v_frac, Py_ssize_t __pyx_v_it, double __pyx_v_delta, int __pyx_v_given_xvals); /* proto */
2551 static PyObject *__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_2update_neighborhood(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_xval, Py_ssize_t __pyx_v_n, Py_ssize_t __pyx_v_left_end, Py_ssize_t __pyx_v_right_end); /* proto */
2552 static PyObject *__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_4update_indices(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xvals, __Pyx_memviewslice __pyx_v_y_fit, double __pyx_v_delta, Py_ssize_t __pyx_v_i, Py_ssize_t __pyx_v_out_n, Py_ssize_t __pyx_v_last_fit_i); /* proto */
2553 static PyObject *__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_6calculate_residual_weights(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_y_fit); /* proto */
2554 static PyObject *__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_8bisquare(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_x); /* proto */
2555 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
2556 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2557 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2558 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2559 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2560 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
2561 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2562 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
2563 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
2564 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2565 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2566 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2567 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2568 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2569 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
2570 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2571 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
2572 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
2573 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2574 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2575 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2576 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2577 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2578 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2579 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2580 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2581 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2582 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2583 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2584 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2585 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2586 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2587 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2588 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2589 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2590 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2591 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2592 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2593 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2594 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2595 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2596 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
2597 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2598 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2599 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2600 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2601 static PyObject *__pyx_int_0;
2602 static PyObject *__pyx_int_1;
2603 static PyObject *__pyx_int_184977713;
2604 static PyObject *__pyx_int_neg_1;
2605 static double __pyx_k_;
2606 static PyObject *__pyx_tuple__2;
2607 static PyObject *__pyx_tuple__3;
2608 static PyObject *__pyx_tuple__4;
2609 static PyObject *__pyx_tuple__5;
2610 static PyObject *__pyx_tuple__6;
2611 static PyObject *__pyx_tuple__7;
2612 static PyObject *__pyx_tuple__8;
2613 static PyObject *__pyx_tuple__9;
2614 static PyObject *__pyx_slice__19;
2615 static PyObject *__pyx_tuple__10;
2616 static PyObject *__pyx_tuple__11;
2617 static PyObject *__pyx_tuple__12;
2618 static PyObject *__pyx_tuple__13;
2619 static PyObject *__pyx_tuple__14;
2620 static PyObject *__pyx_tuple__15;
2621 static PyObject *__pyx_tuple__16;
2622 static PyObject *__pyx_tuple__17;
2623 static PyObject *__pyx_tuple__18;
2624 static PyObject *__pyx_tuple__20;
2625 static PyObject *__pyx_tuple__21;
2626 static PyObject *__pyx_tuple__22;
2627 static PyObject *__pyx_tuple__23;
2628 static PyObject *__pyx_tuple__25;
2629 static PyObject *__pyx_tuple__26;
2630 static PyObject *__pyx_tuple__27;
2631 static PyObject *__pyx_tuple__28;
2632 static PyObject *__pyx_tuple__29;
2633 static PyObject *__pyx_tuple__30;
2634 static PyObject *__pyx_codeobj__24;
2635 static PyObject *__pyx_codeobj__31;
2636 /* Late includes */
2637 
2638 /* "statsmodels/nonparametric/_smoothers_lowess.pyx":24
2639  * np.import_array()
2640  *
2641  * def lowess(np.ndarray[DTYPE_t, ndim = 1] endog,             # <<<<<<<<<<<<<<
2642  *            np.ndarray[DTYPE_t, ndim = 1] exog,
2643  *            np.ndarray[DTYPE_t, ndim = 1] xvals,
2644  */
2645 
2646 /* Python wrapper */
2647 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_1lowess(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2648 static char __pyx_doc_11statsmodels_13nonparametric_17_smoothers_lowess_lowess[] = "\n    lowess(endog, exog, xvals, resid_weights, frac=2/3, it=3, delta=0, given_xvals=False)\n\n    LOWESS (Locally Weighted Scatterplot Smoothing)\n\n    A lowess function that outs smoothed estimates of endog\n    at the given exog values from points (exog, endog)\n\n    Parameters\n    ----------\n    endog : 1-D numpy array\n        The y-values of the observed points\n    exog : 1-D numpy array\n        The x-values of the observed points. exog has to be increasing.\n    xvals : ndarray, 1d\n        The x-values of the points at which to perform the regression\n    resid_weights : 1-D numpy array\n        The initial weightings of the observed points based off residuals\n    frac : float\n        Between 0 and 1. The fraction of the data used\n        when estimating each y-value.\n    it : int\n        The number of residual-based reweightings\n        to perform.\n    delta : float\n        Distance within which to use linear-interpolation\n        instead of weighted regression.\n    given_xvals : bool\n        Whether xvals was provided as a an argument or whether\n        we are just using xvals = exog\n\n    Returns\n    -------\n    out : numpy array\n        A numpy array with two columns. The first column\n        is the sorted x values and the second column the\n        associated estimated y-values.\n    resid_weights: ndarray\n        A numpy array containing the final residual weightings\n        of the data points\n\n    Notes\n    -----\n    This lowess function implements the algorithm given in the\n    reference below using local linear estimates.\n\n    Suppose the input data has N points. The algorithm works by\n    estimating the `smooth` y_i by taking the frac*N closest points\n    to (x_i,y_i) based on their x values and estimating y_i\n    using a weighted linear regression. The weight for (x_j,y_j)\n    is tricube function applied to |x_i-x_j|.\n\n    If it > 1, then further weighted local linear regressions\n    are performed, where the ""weights are the same as above\n    times the _lowess_bisquare function of the residuals. Each iteration\n    takes approximately the same amount of time as the original fit,\n    so these iterations are expensive. They are most useful when\n    the noise has extremely heavy tails, such as Cauchy noise.\n    Noise with less heavy-tails, such as t-distributions with df>2,\n    are less problematic. The weights downgrade the influence of\n    points with large residuals. In the extreme case, points whose\n    residuals are larger than 6 times the median absolute residual\n    are given weight 0.\n\n    delta can be used to save computations. For each x_i, regressions\n    are skipped for points closer than delta. The next regression is\n    fit for the farthest point within delta of x_i and all points in\n    between are estimated by linearly interpolating between the two\n    regression fits.\n\n    Judicious choice of delta can cut computation time considerably\n    for large data (N > 5000). A good choice is delta = 0.01 *\n    range(exog).\n\n    Some experimentation is likely required to find a good\n    choice of frac and iter for a particular dataset.\n\n    References\n    ----------\n    Cleveland, W.S. (1979) \"Robust Locally Weighted Regression\n    and Smoothing Scatterplots\". Journal of the American Statistical\n    Association 74 (368): 829-836.\n\n    Examples\n    --------\n    The below allows a comparison between how different the fits from\n    lowess for different values of frac can be.\n\n    >>> import numpy as np\n    >>> import statsmodels.api as sm\n    >>> lowess = sm.nonparametric.lowess\n    >>> x = np.random.uniform(low = -2*np.pi, high = 2*np.pi, size=500)\n    >>> y = np.sin(x) + np.random.normal(size=len(x))\n    >>> z = lowess(y, x)\n    >>> w = lowess(y, x, frac=1./3)\n\n    This gives a similar comparison for when it is 0 vs not.\n\n    >>> import numpy as np\n    >>> import scipy.stats as stats\n    >>> import statsmodels.api as sm""\n    >>> lowess = sm.nonparametric.lowess\n    >>> x = np.random.uniform(low = -2*np.pi, high = 2*np.pi, size=500)\n    >>> y = np.sin(x) + stats.cauchy.rvs(size=len(x))\n    >>> z = lowess(y, x, frac= 1./3, it=0)\n    >>> w = lowess(y, x, frac=1./3)\n\n    ";
2649 static PyMethodDef __pyx_mdef_11statsmodels_13nonparametric_17_smoothers_lowess_1lowess = {"lowess", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_1lowess, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_13nonparametric_17_smoothers_lowess_lowess};
__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_1lowess(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2650 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_1lowess(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2651   PyArrayObject *__pyx_v_endog = 0;
2652   PyArrayObject *__pyx_v_exog = 0;
2653   PyArrayObject *__pyx_v_xvals = 0;
2654   PyArrayObject *__pyx_v_resid_weights = 0;
2655   double __pyx_v_frac;
2656   Py_ssize_t __pyx_v_it;
2657   double __pyx_v_delta;
2658   int __pyx_v_given_xvals;
2659   int __pyx_lineno = 0;
2660   const char *__pyx_filename = NULL;
2661   int __pyx_clineno = 0;
2662   PyObject *__pyx_r = 0;
2663   __Pyx_RefNannyDeclarations
2664   __Pyx_RefNannySetupContext("lowess (wrapper)", 0);
2665   {
2666     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_exog,&__pyx_n_s_xvals,&__pyx_n_s_resid_weights,&__pyx_n_s_frac,&__pyx_n_s_it,&__pyx_n_s_delta,&__pyx_n_s_given_xvals,0};
2667     PyObject* values[8] = {0,0,0,0,0,0,0,0};
2668     if (unlikely(__pyx_kwds)) {
2669       Py_ssize_t kw_args;
2670       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2671       switch (pos_args) {
2672         case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
2673         CYTHON_FALLTHROUGH;
2674         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2675         CYTHON_FALLTHROUGH;
2676         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2677         CYTHON_FALLTHROUGH;
2678         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2679         CYTHON_FALLTHROUGH;
2680         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2681         CYTHON_FALLTHROUGH;
2682         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2683         CYTHON_FALLTHROUGH;
2684         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2685         CYTHON_FALLTHROUGH;
2686         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2687         CYTHON_FALLTHROUGH;
2688         case  0: break;
2689         default: goto __pyx_L5_argtuple_error;
2690       }
2691       kw_args = PyDict_Size(__pyx_kwds);
2692       switch (pos_args) {
2693         case  0:
2694         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
2695         else goto __pyx_L5_argtuple_error;
2696         CYTHON_FALLTHROUGH;
2697         case  1:
2698         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exog)) != 0)) kw_args--;
2699         else {
2700           __Pyx_RaiseArgtupleInvalid("lowess", 0, 4, 8, 1); __PYX_ERR(0, 24, __pyx_L3_error)
2701         }
2702         CYTHON_FALLTHROUGH;
2703         case  2:
2704         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xvals)) != 0)) kw_args--;
2705         else {
2706           __Pyx_RaiseArgtupleInvalid("lowess", 0, 4, 8, 2); __PYX_ERR(0, 24, __pyx_L3_error)
2707         }
2708         CYTHON_FALLTHROUGH;
2709         case  3:
2710         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_resid_weights)) != 0)) kw_args--;
2711         else {
2712           __Pyx_RaiseArgtupleInvalid("lowess", 0, 4, 8, 3); __PYX_ERR(0, 24, __pyx_L3_error)
2713         }
2714         CYTHON_FALLTHROUGH;
2715         case  4:
2716         if (kw_args > 0) {
2717           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frac);
2718           if (value) { values[4] = value; kw_args--; }
2719         }
2720         CYTHON_FALLTHROUGH;
2721         case  5:
2722         if (kw_args > 0) {
2723           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_it);
2724           if (value) { values[5] = value; kw_args--; }
2725         }
2726         CYTHON_FALLTHROUGH;
2727         case  6:
2728         if (kw_args > 0) {
2729           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta);
2730           if (value) { values[6] = value; kw_args--; }
2731         }
2732         CYTHON_FALLTHROUGH;
2733         case  7:
2734         if (kw_args > 0) {
2735           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_given_xvals);
2736           if (value) { values[7] = value; kw_args--; }
2737         }
2738       }
2739       if (unlikely(kw_args > 0)) {
2740         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lowess") < 0)) __PYX_ERR(0, 24, __pyx_L3_error)
2741       }
2742     } else {
2743       switch (PyTuple_GET_SIZE(__pyx_args)) {
2744         case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
2745         CYTHON_FALLTHROUGH;
2746         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2747         CYTHON_FALLTHROUGH;
2748         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2749         CYTHON_FALLTHROUGH;
2750         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2751         CYTHON_FALLTHROUGH;
2752         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2753         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2754         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2755         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2756         break;
2757         default: goto __pyx_L5_argtuple_error;
2758       }
2759     }
2760     __pyx_v_endog = ((PyArrayObject *)values[0]);
2761     __pyx_v_exog = ((PyArrayObject *)values[1]);
2762     __pyx_v_xvals = ((PyArrayObject *)values[2]);
2763     __pyx_v_resid_weights = ((PyArrayObject *)values[3]);
2764     if (values[4]) {
2765       __pyx_v_frac = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_frac == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 28, __pyx_L3_error)
2766     } else {
2767       __pyx_v_frac = __pyx_k_;
2768     }
2769     if (values[5]) {
2770       __pyx_v_it = __Pyx_PyIndex_AsSsize_t(values[5]); if (unlikely((__pyx_v_it == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error)
2771     } else {
2772       __pyx_v_it = ((Py_ssize_t)3);
2773     }
2774     if (values[6]) {
2775       __pyx_v_delta = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_delta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 30, __pyx_L3_error)
2776     } else {
2777       __pyx_v_delta = ((double)0.0);
2778     }
2779     if (values[7]) {
2780       __pyx_v_given_xvals = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_given_xvals == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 31, __pyx_L3_error)
2781     } else {
2782       __pyx_v_given_xvals = ((int)0);
2783     }
2784   }
2785   goto __pyx_L4_argument_unpacking_done;
2786   __pyx_L5_argtuple_error:;
2787   __Pyx_RaiseArgtupleInvalid("lowess", 0, 4, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 24, __pyx_L3_error)
2788   __pyx_L3_error:;
2789   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.lowess", __pyx_clineno, __pyx_lineno, __pyx_filename);
2790   __Pyx_RefNannyFinishContext();
2791   return NULL;
2792   __pyx_L4_argument_unpacking_done:;
2793   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_endog), __pyx_ptype_5numpy_ndarray, 1, "endog", 0))) __PYX_ERR(0, 24, __pyx_L1_error)
2794   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exog), __pyx_ptype_5numpy_ndarray, 1, "exog", 0))) __PYX_ERR(0, 25, __pyx_L1_error)
2795   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xvals), __pyx_ptype_5numpy_ndarray, 1, "xvals", 0))) __PYX_ERR(0, 26, __pyx_L1_error)
2796   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_resid_weights), __pyx_ptype_5numpy_ndarray, 1, "resid_weights", 0))) __PYX_ERR(0, 27, __pyx_L1_error)
2797   __pyx_r = __pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_lowess(__pyx_self, __pyx_v_endog, __pyx_v_exog, __pyx_v_xvals, __pyx_v_resid_weights, __pyx_v_frac, __pyx_v_it, __pyx_v_delta, __pyx_v_given_xvals);
2798 
2799   /* function exit code */
2800   goto __pyx_L0;
2801   __pyx_L1_error:;
2802   __pyx_r = NULL;
2803   __pyx_L0:;
2804   __Pyx_RefNannyFinishContext();
2805   return __pyx_r;
2806 }
2807 
__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_lowess(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_endog,PyArrayObject * __pyx_v_exog,PyArrayObject * __pyx_v_xvals,PyArrayObject * __pyx_v_resid_weights,double __pyx_v_frac,Py_ssize_t __pyx_v_it,double __pyx_v_delta,int __pyx_v_given_xvals)2808 static PyObject *__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_lowess(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_endog, PyArrayObject *__pyx_v_exog, PyArrayObject *__pyx_v_xvals, PyArrayObject *__pyx_v_resid_weights, double __pyx_v_frac, Py_ssize_t __pyx_v_it, double __pyx_v_delta, int __pyx_v_given_xvals) {
2809   Py_ssize_t __pyx_v_j;
2810   int __pyx_v_k;
2811   CYTHON_UNUSED Py_ssize_t __pyx_v_robiter;
2812   Py_ssize_t __pyx_v_i;
2813   Py_ssize_t __pyx_v_left_end;
2814   Py_ssize_t __pyx_v_right_end;
2815   npy_intp __pyx_v_n;
2816   npy_intp __pyx_v_out_n;
2817   npy_intp __pyx_v_last_fit_i;
2818   PyArrayObject *__pyx_v_x = 0;
2819   PyArrayObject *__pyx_v_y = 0;
2820   PyArrayObject *__pyx_v_y_fit = 0;
2821   PyArrayObject *__pyx_v_weights = 0;
2822   __pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t __pyx_v_xval;
2823   __pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t __pyx_v_radius;
2824   int __pyx_v_reg_ok;
2825   __Pyx_LocalBuf_ND __pyx_pybuffernd_endog;
2826   __Pyx_Buffer __pyx_pybuffer_endog;
2827   __Pyx_LocalBuf_ND __pyx_pybuffernd_exog;
2828   __Pyx_Buffer __pyx_pybuffer_exog;
2829   __Pyx_LocalBuf_ND __pyx_pybuffernd_resid_weights;
2830   __Pyx_Buffer __pyx_pybuffer_resid_weights;
2831   __Pyx_LocalBuf_ND __pyx_pybuffernd_weights;
2832   __Pyx_Buffer __pyx_pybuffer_weights;
2833   __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
2834   __Pyx_Buffer __pyx_pybuffer_x;
2835   __Pyx_LocalBuf_ND __pyx_pybuffernd_xvals;
2836   __Pyx_Buffer __pyx_pybuffer_xvals;
2837   __Pyx_LocalBuf_ND __pyx_pybuffernd_y;
2838   __Pyx_Buffer __pyx_pybuffer_y;
2839   __Pyx_LocalBuf_ND __pyx_pybuffernd_y_fit;
2840   __Pyx_Buffer __pyx_pybuffer_y_fit;
2841   PyObject *__pyx_r = NULL;
2842   __Pyx_RefNannyDeclarations
2843   int __pyx_t_1;
2844   PyObject *__pyx_t_2 = NULL;
2845   PyObject *__pyx_t_3 = NULL;
2846   PyObject *__pyx_t_4 = NULL;
2847   int __pyx_t_5;
2848   int __pyx_t_6;
2849   PyObject *__pyx_t_7 = NULL;
2850   PyObject *__pyx_t_8 = NULL;
2851   PyObject *__pyx_t_9 = NULL;
2852   PyObject *__pyx_t_10 = NULL;
2853   PyArrayObject *__pyx_t_11 = NULL;
2854   PyArrayObject *__pyx_t_12 = NULL;
2855   Py_ssize_t __pyx_t_13;
2856   Py_ssize_t __pyx_t_14;
2857   Py_ssize_t __pyx_t_15;
2858   npy_intp __pyx_t_16;
2859   npy_intp __pyx_t_17;
2860   Py_ssize_t __pyx_t_18;
2861   Py_ssize_t __pyx_t_19;
2862   __Pyx_memviewslice __pyx_t_20 = { 0, 0, { 0 }, { 0 }, { 0 } };
2863   PyObject *__pyx_t_21 = NULL;
2864   PyObject *(*__pyx_t_22)(PyObject *);
2865   Py_ssize_t __pyx_t_23;
2866   __pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t __pyx_t_24;
2867   struct __pyx_opt_args_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_y_fit __pyx_t_25;
2868   __Pyx_memviewslice __pyx_t_26 = { 0, 0, { 0 }, { 0 }, { 0 } };
2869   int __pyx_lineno = 0;
2870   const char *__pyx_filename = NULL;
2871   int __pyx_clineno = 0;
2872   __Pyx_RefNannySetupContext("lowess", 0);
2873   __Pyx_INCREF((PyObject *)__pyx_v_resid_weights);
2874   __pyx_pybuffer_x.pybuffer.buf = NULL;
2875   __pyx_pybuffer_x.refcount = 0;
2876   __pyx_pybuffernd_x.data = NULL;
2877   __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
2878   __pyx_pybuffer_y.pybuffer.buf = NULL;
2879   __pyx_pybuffer_y.refcount = 0;
2880   __pyx_pybuffernd_y.data = NULL;
2881   __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y;
2882   __pyx_pybuffer_y_fit.pybuffer.buf = NULL;
2883   __pyx_pybuffer_y_fit.refcount = 0;
2884   __pyx_pybuffernd_y_fit.data = NULL;
2885   __pyx_pybuffernd_y_fit.rcbuffer = &__pyx_pybuffer_y_fit;
2886   __pyx_pybuffer_weights.pybuffer.buf = NULL;
2887   __pyx_pybuffer_weights.refcount = 0;
2888   __pyx_pybuffernd_weights.data = NULL;
2889   __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights;
2890   __pyx_pybuffer_endog.pybuffer.buf = NULL;
2891   __pyx_pybuffer_endog.refcount = 0;
2892   __pyx_pybuffernd_endog.data = NULL;
2893   __pyx_pybuffernd_endog.rcbuffer = &__pyx_pybuffer_endog;
2894   __pyx_pybuffer_exog.pybuffer.buf = NULL;
2895   __pyx_pybuffer_exog.refcount = 0;
2896   __pyx_pybuffernd_exog.data = NULL;
2897   __pyx_pybuffernd_exog.rcbuffer = &__pyx_pybuffer_exog;
2898   __pyx_pybuffer_xvals.pybuffer.buf = NULL;
2899   __pyx_pybuffer_xvals.refcount = 0;
2900   __pyx_pybuffernd_xvals.data = NULL;
2901   __pyx_pybuffernd_xvals.rcbuffer = &__pyx_pybuffer_xvals;
2902   __pyx_pybuffer_resid_weights.pybuffer.buf = NULL;
2903   __pyx_pybuffer_resid_weights.refcount = 0;
2904   __pyx_pybuffernd_resid_weights.data = NULL;
2905   __pyx_pybuffernd_resid_weights.rcbuffer = &__pyx_pybuffer_resid_weights;
2906   {
2907     __Pyx_BufFmt_StackElem __pyx_stack[1];
2908     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_endog.rcbuffer->pybuffer, (PyObject*)__pyx_v_endog, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 24, __pyx_L1_error)
2909   }
2910   __pyx_pybuffernd_endog.diminfo[0].strides = __pyx_pybuffernd_endog.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_endog.diminfo[0].shape = __pyx_pybuffernd_endog.rcbuffer->pybuffer.shape[0];
2911   {
2912     __Pyx_BufFmt_StackElem __pyx_stack[1];
2913     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exog.rcbuffer->pybuffer, (PyObject*)__pyx_v_exog, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 24, __pyx_L1_error)
2914   }
2915   __pyx_pybuffernd_exog.diminfo[0].strides = __pyx_pybuffernd_exog.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exog.diminfo[0].shape = __pyx_pybuffernd_exog.rcbuffer->pybuffer.shape[0];
2916   {
2917     __Pyx_BufFmt_StackElem __pyx_stack[1];
2918     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xvals.rcbuffer->pybuffer, (PyObject*)__pyx_v_xvals, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 24, __pyx_L1_error)
2919   }
2920   __pyx_pybuffernd_xvals.diminfo[0].strides = __pyx_pybuffernd_xvals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xvals.diminfo[0].shape = __pyx_pybuffernd_xvals.rcbuffer->pybuffer.shape[0];
2921   {
2922     __Pyx_BufFmt_StackElem __pyx_stack[1];
2923     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resid_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_resid_weights, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 24, __pyx_L1_error)
2924   }
2925   __pyx_pybuffernd_resid_weights.diminfo[0].strides = __pyx_pybuffernd_resid_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_resid_weights.diminfo[0].shape = __pyx_pybuffernd_resid_weights.rcbuffer->pybuffer.shape[0];
2926 
2927   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":150
2928  *         DTYPE_t xval, radius
2929  *
2930  *     y = endog   # now just alias             # <<<<<<<<<<<<<<
2931  *     x = exog
2932  *
2933  */
2934   {
2935     __Pyx_BufFmt_StackElem __pyx_stack[1];
2936     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
2937     __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_v_endog), &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
2938     if (unlikely(__pyx_t_1 < 0)) {
2939       PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
2940       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
2941         Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
2942         __Pyx_RaiseBufferFallbackError();
2943       } else {
2944         PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
2945       }
2946       __pyx_t_2 = __pyx_t_3 = __pyx_t_4 = 0;
2947     }
2948     __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0];
2949     if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 150, __pyx_L1_error)
2950   }
2951   __Pyx_INCREF(((PyObject *)__pyx_v_endog));
2952   __pyx_v_y = ((PyArrayObject *)__pyx_v_endog);
2953 
2954   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":151
2955  *
2956  *     y = endog   # now just alias
2957  *     x = exog             # <<<<<<<<<<<<<<
2958  *
2959  *
2960  */
2961   {
2962     __Pyx_BufFmt_StackElem __pyx_stack[1];
2963     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
2964     __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_v_exog), &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
2965     if (unlikely(__pyx_t_1 < 0)) {
2966       PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
2967       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
2968         Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2);
2969         __Pyx_RaiseBufferFallbackError();
2970       } else {
2971         PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
2972       }
2973       __pyx_t_4 = __pyx_t_3 = __pyx_t_2 = 0;
2974     }
2975     __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0];
2976     if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 151, __pyx_L1_error)
2977   }
2978   __Pyx_INCREF(((PyObject *)__pyx_v_exog));
2979   __pyx_v_x = ((PyArrayObject *)__pyx_v_exog);
2980 
2981   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":154
2982  *
2983  *
2984  *     if not 0 <= frac <= 1:             # <<<<<<<<<<<<<<
2985  *            raise ValueError("Lowess `frac` must be in the range [0,1]!")
2986  *
2987  */
2988   __pyx_t_5 = (0.0 <= __pyx_v_frac);
2989   if (__pyx_t_5) {
2990     __pyx_t_5 = (__pyx_v_frac <= 1.0);
2991   }
2992   __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0);
2993   if (unlikely(__pyx_t_6)) {
2994 
2995     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":155
2996  *
2997  *     if not 0 <= frac <= 1:
2998  *            raise ValueError("Lowess `frac` must be in the range [0,1]!")             # <<<<<<<<<<<<<<
2999  *
3000  *     n = np.PyArray_DIMS(x)[0]
3001  */
3002     __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error)
3003     __Pyx_GOTREF(__pyx_t_7);
3004     __Pyx_Raise(__pyx_t_7, 0, 0, 0);
3005     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3006     __PYX_ERR(0, 155, __pyx_L1_error)
3007 
3008     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":154
3009  *
3010  *
3011  *     if not 0 <= frac <= 1:             # <<<<<<<<<<<<<<
3012  *            raise ValueError("Lowess `frac` must be in the range [0,1]!")
3013  *
3014  */
3015   }
3016 
3017   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":157
3018  *            raise ValueError("Lowess `frac` must be in the range [0,1]!")
3019  *
3020  *     n = np.PyArray_DIMS(x)[0]             # <<<<<<<<<<<<<<
3021  *     out_n = np.PyArray_DIMS(xvals)[0]
3022  *
3023  */
3024   __pyx_v_n = (PyArray_DIMS(((PyArrayObject *)__pyx_v_x))[0]);
3025 
3026   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":158
3027  *
3028  *     n = np.PyArray_DIMS(x)[0]
3029  *     out_n = np.PyArray_DIMS(xvals)[0]             # <<<<<<<<<<<<<<
3030  *
3031  *     # The number of neighbors in each regression.
3032  */
3033   __pyx_v_out_n = (PyArray_DIMS(((PyArrayObject *)__pyx_v_xvals))[0]);
3034 
3035   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":162
3036  *     # The number of neighbors in each regression.
3037  *     # round up if close to integer
3038  *     k =  int(frac * n + 1e-10)             # <<<<<<<<<<<<<<
3039  *
3040  *     # frac should be set, so that 2 <= k <= n.
3041  */
3042   __pyx_v_k = ((int)((__pyx_v_frac * __pyx_v_n) + 1e-10));
3043 
3044   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":166
3045  *     # frac should be set, so that 2 <= k <= n.
3046  *     # Conform them instead of throwing error.
3047  *     if k < 2:             # <<<<<<<<<<<<<<
3048  *         k = 2
3049  *     if k > n:
3050  */
3051   __pyx_t_6 = ((__pyx_v_k < 2) != 0);
3052   if (__pyx_t_6) {
3053 
3054     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":167
3055  *     # Conform them instead of throwing error.
3056  *     if k < 2:
3057  *         k = 2             # <<<<<<<<<<<<<<
3058  *     if k > n:
3059  *         k = n
3060  */
3061     __pyx_v_k = 2;
3062 
3063     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":166
3064  *     # frac should be set, so that 2 <= k <= n.
3065  *     # Conform them instead of throwing error.
3066  *     if k < 2:             # <<<<<<<<<<<<<<
3067  *         k = 2
3068  *     if k > n:
3069  */
3070   }
3071 
3072   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":168
3073  *     if k < 2:
3074  *         k = 2
3075  *     if k > n:             # <<<<<<<<<<<<<<
3076  *         k = n
3077  *
3078  */
3079   __pyx_t_6 = ((__pyx_v_k > __pyx_v_n) != 0);
3080   if (__pyx_t_6) {
3081 
3082     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":169
3083  *         k = 2
3084  *     if k > n:
3085  *         k = n             # <<<<<<<<<<<<<<
3086  *
3087  *     y_fit = np.empty(out_n)
3088  */
3089     __pyx_v_k = __pyx_v_n;
3090 
3091     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":168
3092  *     if k < 2:
3093  *         k = 2
3094  *     if k > n:             # <<<<<<<<<<<<<<
3095  *         k = n
3096  *
3097  */
3098   }
3099 
3100   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":171
3101  *         k = n
3102  *
3103  *     y_fit = np.empty(out_n)             # <<<<<<<<<<<<<<
3104  *     weights = np.empty(n)
3105  *
3106  */
3107   __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 171, __pyx_L1_error)
3108   __Pyx_GOTREF(__pyx_t_8);
3109   __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_empty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 171, __pyx_L1_error)
3110   __Pyx_GOTREF(__pyx_t_9);
3111   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3112   __pyx_t_8 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_out_n); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 171, __pyx_L1_error)
3113   __Pyx_GOTREF(__pyx_t_8);
3114   __pyx_t_10 = NULL;
3115   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
3116     __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
3117     if (likely(__pyx_t_10)) {
3118       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
3119       __Pyx_INCREF(__pyx_t_10);
3120       __Pyx_INCREF(function);
3121       __Pyx_DECREF_SET(__pyx_t_9, function);
3122     }
3123   }
3124   __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
3125   __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3126   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3127   if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 171, __pyx_L1_error)
3128   __Pyx_GOTREF(__pyx_t_7);
3129   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3130   if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 171, __pyx_L1_error)
3131   __pyx_t_11 = ((PyArrayObject *)__pyx_t_7);
3132   {
3133     __Pyx_BufFmt_StackElem __pyx_stack[1];
3134     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_fit.rcbuffer->pybuffer);
3135     __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y_fit.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
3136     if (unlikely(__pyx_t_1 < 0)) {
3137       PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
3138       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y_fit.rcbuffer->pybuffer, (PyObject*)__pyx_v_y_fit, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
3139         Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
3140         __Pyx_RaiseBufferFallbackError();
3141       } else {
3142         PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
3143       }
3144       __pyx_t_2 = __pyx_t_3 = __pyx_t_4 = 0;
3145     }
3146     __pyx_pybuffernd_y_fit.diminfo[0].strides = __pyx_pybuffernd_y_fit.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y_fit.diminfo[0].shape = __pyx_pybuffernd_y_fit.rcbuffer->pybuffer.shape[0];
3147     if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 171, __pyx_L1_error)
3148   }
3149   __pyx_t_11 = 0;
3150   __pyx_v_y_fit = ((PyArrayObject *)__pyx_t_7);
3151   __pyx_t_7 = 0;
3152 
3153   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":172
3154  *
3155  *     y_fit = np.empty(out_n)
3156  *     weights = np.empty(n)             # <<<<<<<<<<<<<<
3157  *
3158  *     it += 1 # Add one to it for initial run.
3159  */
3160   __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 172, __pyx_L1_error)
3161   __Pyx_GOTREF(__pyx_t_9);
3162   __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 172, __pyx_L1_error)
3163   __Pyx_GOTREF(__pyx_t_8);
3164   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3165   __pyx_t_9 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 172, __pyx_L1_error)
3166   __Pyx_GOTREF(__pyx_t_9);
3167   __pyx_t_10 = NULL;
3168   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
3169     __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
3170     if (likely(__pyx_t_10)) {
3171       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
3172       __Pyx_INCREF(__pyx_t_10);
3173       __Pyx_INCREF(function);
3174       __Pyx_DECREF_SET(__pyx_t_8, function);
3175     }
3176   }
3177   __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
3178   __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3179   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3180   if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 172, __pyx_L1_error)
3181   __Pyx_GOTREF(__pyx_t_7);
3182   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3183   if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 172, __pyx_L1_error)
3184   __pyx_t_12 = ((PyArrayObject *)__pyx_t_7);
3185   {
3186     __Pyx_BufFmt_StackElem __pyx_stack[1];
3187     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer);
3188     __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
3189     if (unlikely(__pyx_t_1 < 0)) {
3190       PyErr_Fetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
3191       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
3192         Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2);
3193         __Pyx_RaiseBufferFallbackError();
3194       } else {
3195         PyErr_Restore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
3196       }
3197       __pyx_t_4 = __pyx_t_3 = __pyx_t_2 = 0;
3198     }
3199     __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0];
3200     if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 172, __pyx_L1_error)
3201   }
3202   __pyx_t_12 = 0;
3203   __pyx_v_weights = ((PyArrayObject *)__pyx_t_7);
3204   __pyx_t_7 = 0;
3205 
3206   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":174
3207  *     weights = np.empty(n)
3208  *
3209  *     it += 1 # Add one to it for initial run.             # <<<<<<<<<<<<<<
3210  *     for robiter in range(it):
3211  *         i = 0
3212  */
3213   __pyx_v_it = (__pyx_v_it + 1);
3214 
3215   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":175
3216  *
3217  *     it += 1 # Add one to it for initial run.
3218  *     for robiter in range(it):             # <<<<<<<<<<<<<<
3219  *         i = 0
3220  *         last_fit_i = -1
3221  */
3222   __pyx_t_13 = __pyx_v_it;
3223   __pyx_t_14 = __pyx_t_13;
3224   for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
3225     __pyx_v_robiter = __pyx_t_15;
3226 
3227     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":176
3228  *     it += 1 # Add one to it for initial run.
3229  *     for robiter in range(it):
3230  *         i = 0             # <<<<<<<<<<<<<<
3231  *         last_fit_i = -1
3232  *         left_end = 0
3233  */
3234     __pyx_v_i = 0;
3235 
3236     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":177
3237  *     for robiter in range(it):
3238  *         i = 0
3239  *         last_fit_i = -1             # <<<<<<<<<<<<<<
3240  *         left_end = 0
3241  *         right_end = k
3242  */
3243     __pyx_v_last_fit_i = -1;
3244 
3245     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":178
3246  *         i = 0
3247  *         last_fit_i = -1
3248  *         left_end = 0             # <<<<<<<<<<<<<<
3249  *         right_end = k
3250  *         # Reinitialize y_fit each iteration
3251  */
3252     __pyx_v_left_end = 0;
3253 
3254     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":179
3255  *         last_fit_i = -1
3256  *         left_end = 0
3257  *         right_end = k             # <<<<<<<<<<<<<<
3258  *         # Reinitialize y_fit each iteration
3259  *         for j in range(out_n):
3260  */
3261     __pyx_v_right_end = __pyx_v_k;
3262 
3263     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":181
3264  *         right_end = k
3265  *         # Reinitialize y_fit each iteration
3266  *         for j in range(out_n):             # <<<<<<<<<<<<<<
3267  *             y_fit[j] = 0.0
3268  *
3269  */
3270     __pyx_t_16 = __pyx_v_out_n;
3271     __pyx_t_17 = __pyx_t_16;
3272     for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
3273       __pyx_v_j = __pyx_t_18;
3274 
3275       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":182
3276  *         # Reinitialize y_fit each iteration
3277  *         for j in range(out_n):
3278  *             y_fit[j] = 0.0             # <<<<<<<<<<<<<<
3279  *
3280  *         # 'do' Fit y[i]'s 'until' the end of the regression
3281  */
3282       __pyx_t_19 = __pyx_v_j;
3283       *__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_y_fit.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_y_fit.diminfo[0].strides) = 0.0;
3284     }
3285 
3286     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":185
3287  *
3288  *         # 'do' Fit y[i]'s 'until' the end of the regression
3289  *         while True:             # <<<<<<<<<<<<<<
3290  *             # The x value at which we will fit this time
3291  *             xval  = xvals[i]
3292  */
3293     while (1) {
3294 
3295       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":187
3296  *         while True:
3297  *             # The x value at which we will fit this time
3298  *             xval  = xvals[i]             # <<<<<<<<<<<<<<
3299  *
3300  *             # Re-initialize the weights for each point xval.
3301  */
3302       __pyx_t_19 = __pyx_v_i;
3303       __pyx_v_xval = (*__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_xvals.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_xvals.diminfo[0].strides));
3304 
3305       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":190
3306  *
3307  *             # Re-initialize the weights for each point xval.
3308  *             for j in range(n):             # <<<<<<<<<<<<<<
3309  *                 weights[j] = 0.0
3310  *
3311  */
3312       __pyx_t_16 = __pyx_v_n;
3313       __pyx_t_17 = __pyx_t_16;
3314       for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
3315         __pyx_v_j = __pyx_t_18;
3316 
3317         /* "statsmodels/nonparametric/_smoothers_lowess.pyx":191
3318  *             # Re-initialize the weights for each point xval.
3319  *             for j in range(n):
3320  *                 weights[j] = 0.0             # <<<<<<<<<<<<<<
3321  *
3322  *             # Describe the neighborhood around the current xval.
3323  */
3324         __pyx_t_19 = __pyx_v_j;
3325         *__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_weights.diminfo[0].strides) = 0.0;
3326       }
3327 
3328       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":194
3329  *
3330  *             # Describe the neighborhood around the current xval.
3331  *             left_end, right_end, radius = update_neighborhood(x, xval, n,             # <<<<<<<<<<<<<<
3332  *                                                               left_end,
3333  *                                                               right_end)
3334  */
3335       __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(((PyObject *)__pyx_v_x), PyBUF_WRITABLE); if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 194, __pyx_L1_error)
3336 
3337       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":196
3338  *             left_end, right_end, radius = update_neighborhood(x, xval, n,
3339  *                                                               left_end,
3340  *                                                               right_end)             # <<<<<<<<<<<<<<
3341  *
3342  *             # Calculate the weights for the regression in this neighborhood.
3343  */
3344       __pyx_t_7 = __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_update_neighborhood(__pyx_t_20, __pyx_v_xval, __pyx_v_n, __pyx_v_left_end, __pyx_v_right_end, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error)
3345       __Pyx_GOTREF(__pyx_t_7);
3346       __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
3347       __pyx_t_20.memview = NULL;
3348       __pyx_t_20.data = NULL;
3349       if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
3350         PyObject* sequence = __pyx_t_7;
3351         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3352         if (unlikely(size != 3)) {
3353           if (size > 3) __Pyx_RaiseTooManyValuesError(3);
3354           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3355           __PYX_ERR(0, 194, __pyx_L1_error)
3356         }
3357         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3358         if (likely(PyTuple_CheckExact(sequence))) {
3359           __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
3360           __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
3361           __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2);
3362         } else {
3363           __pyx_t_8 = PyList_GET_ITEM(sequence, 0);
3364           __pyx_t_9 = PyList_GET_ITEM(sequence, 1);
3365           __pyx_t_10 = PyList_GET_ITEM(sequence, 2);
3366         }
3367         __Pyx_INCREF(__pyx_t_8);
3368         __Pyx_INCREF(__pyx_t_9);
3369         __Pyx_INCREF(__pyx_t_10);
3370         #else
3371         __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 194, __pyx_L1_error)
3372         __Pyx_GOTREF(__pyx_t_8);
3373         __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 194, __pyx_L1_error)
3374         __Pyx_GOTREF(__pyx_t_9);
3375         __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 194, __pyx_L1_error)
3376         __Pyx_GOTREF(__pyx_t_10);
3377         #endif
3378         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3379       } else {
3380         Py_ssize_t index = -1;
3381         __pyx_t_21 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 194, __pyx_L1_error)
3382         __Pyx_GOTREF(__pyx_t_21);
3383         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3384         __pyx_t_22 = Py_TYPE(__pyx_t_21)->tp_iternext;
3385         index = 0; __pyx_t_8 = __pyx_t_22(__pyx_t_21); if (unlikely(!__pyx_t_8)) goto __pyx_L14_unpacking_failed;
3386         __Pyx_GOTREF(__pyx_t_8);
3387         index = 1; __pyx_t_9 = __pyx_t_22(__pyx_t_21); if (unlikely(!__pyx_t_9)) goto __pyx_L14_unpacking_failed;
3388         __Pyx_GOTREF(__pyx_t_9);
3389         index = 2; __pyx_t_10 = __pyx_t_22(__pyx_t_21); if (unlikely(!__pyx_t_10)) goto __pyx_L14_unpacking_failed;
3390         __Pyx_GOTREF(__pyx_t_10);
3391         if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_21), 3) < 0) __PYX_ERR(0, 194, __pyx_L1_error)
3392         __pyx_t_22 = NULL;
3393         __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3394         goto __pyx_L15_unpacking_done;
3395         __pyx_L14_unpacking_failed:;
3396         __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3397         __pyx_t_22 = NULL;
3398         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3399         __PYX_ERR(0, 194, __pyx_L1_error)
3400         __pyx_L15_unpacking_done:;
3401       }
3402 
3403       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":194
3404  *
3405  *             # Describe the neighborhood around the current xval.
3406  *             left_end, right_end, radius = update_neighborhood(x, xval, n,             # <<<<<<<<<<<<<<
3407  *                                                               left_end,
3408  *                                                               right_end)
3409  */
3410       __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error)
3411       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3412       __pyx_t_23 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_23 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error)
3413       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3414       __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_10); if (unlikely((__pyx_t_24 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error)
3415       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3416       __pyx_v_left_end = __pyx_t_18;
3417       __pyx_v_right_end = __pyx_t_23;
3418       __pyx_v_radius = __pyx_t_24;
3419 
3420       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":201
3421  *             # Determine if at least some weights are positive, so a regression
3422  *             # is ok.
3423  *             reg_ok = calculate_weights(x, weights, resid_weights, xval, left_end,             # <<<<<<<<<<<<<<
3424  *                                        right_end, radius)
3425  *
3426  */
3427       __pyx_v_reg_ok = __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_weights(((PyArrayObject *)__pyx_v_x), ((PyArrayObject *)__pyx_v_weights), ((PyArrayObject *)__pyx_v_resid_weights), __pyx_v_xval, __pyx_v_left_end, __pyx_v_right_end, __pyx_v_radius);
3428 
3429       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":205
3430  *
3431  *             # If ok, run the regression
3432  *             calculate_y_fit(x, y, i, xval, y_fit, weights, left_end, right_end,             # <<<<<<<<<<<<<<
3433  *                             reg_ok, fill_with_nans=given_xvals)
3434  *
3435  */
3436       __pyx_t_25.__pyx_n = 1;
3437       __pyx_t_25.fill_with_nans = __pyx_v_given_xvals;
3438       __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_y_fit(((PyArrayObject *)__pyx_v_x), ((PyArrayObject *)__pyx_v_y), __pyx_v_i, __pyx_v_xval, ((PyArrayObject *)__pyx_v_y_fit), ((PyArrayObject *)__pyx_v_weights), __pyx_v_left_end, __pyx_v_right_end, __pyx_v_reg_ok, &__pyx_t_25);
3439 
3440       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":210
3441  *             # If we skipped some points (because of how delta was set), go back
3442  *             # and fit them by linear interpolation.
3443  *             if last_fit_i < (i - 1):             # <<<<<<<<<<<<<<
3444  *                 interpolate_skipped_fits(xvals, y_fit, i, last_fit_i)
3445  *
3446  */
3447       __pyx_t_6 = ((__pyx_v_last_fit_i < (__pyx_v_i - 1)) != 0);
3448       if (__pyx_t_6) {
3449 
3450         /* "statsmodels/nonparametric/_smoothers_lowess.pyx":211
3451  *             # and fit them by linear interpolation.
3452  *             if last_fit_i < (i - 1):
3453  *                 interpolate_skipped_fits(xvals, y_fit, i, last_fit_i)             # <<<<<<<<<<<<<<
3454  *
3455  *             # Update the last fit counter to indicate we've now fit this point.
3456  */
3457         __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(((PyObject *)__pyx_v_xvals), PyBUF_WRITABLE); if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 211, __pyx_L1_error)
3458         __pyx_t_26 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(((PyObject *)__pyx_v_y_fit), PyBUF_WRITABLE); if (unlikely(!__pyx_t_26.memview)) __PYX_ERR(0, 211, __pyx_L1_error)
3459         __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_interpolate_skipped_fits(__pyx_t_20, __pyx_t_26, __pyx_v_i, __pyx_v_last_fit_i);
3460         __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
3461         __pyx_t_20.memview = NULL;
3462         __pyx_t_20.data = NULL;
3463         __PYX_XDEC_MEMVIEW(&__pyx_t_26, 1);
3464         __pyx_t_26.memview = NULL;
3465         __pyx_t_26.data = NULL;
3466 
3467         /* "statsmodels/nonparametric/_smoothers_lowess.pyx":210
3468  *             # If we skipped some points (because of how delta was set), go back
3469  *             # and fit them by linear interpolation.
3470  *             if last_fit_i < (i - 1):             # <<<<<<<<<<<<<<
3471  *                 interpolate_skipped_fits(xvals, y_fit, i, last_fit_i)
3472  *
3473  */
3474       }
3475 
3476       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":215
3477  *             # Update the last fit counter to indicate we've now fit this point.
3478  *             # Find the next i for which we'll run a regression.
3479  *             i, last_fit_i = update_indices(xvals, y_fit, delta, i, out_n, last_fit_i)             # <<<<<<<<<<<<<<
3480  *
3481  *             if last_fit_i >= out_n-1:
3482  */
3483       __pyx_t_26 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(((PyObject *)__pyx_v_xvals), PyBUF_WRITABLE); if (unlikely(!__pyx_t_26.memview)) __PYX_ERR(0, 215, __pyx_L1_error)
3484       __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(((PyObject *)__pyx_v_y_fit), PyBUF_WRITABLE); if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 215, __pyx_L1_error)
3485       __pyx_t_7 = __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_update_indices(__pyx_t_26, __pyx_t_20, __pyx_v_delta, __pyx_v_i, __pyx_v_out_n, __pyx_v_last_fit_i, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 215, __pyx_L1_error)
3486       __Pyx_GOTREF(__pyx_t_7);
3487       __PYX_XDEC_MEMVIEW(&__pyx_t_26, 1);
3488       __pyx_t_26.memview = NULL;
3489       __pyx_t_26.data = NULL;
3490       __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
3491       __pyx_t_20.memview = NULL;
3492       __pyx_t_20.data = NULL;
3493       if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
3494         PyObject* sequence = __pyx_t_7;
3495         Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3496         if (unlikely(size != 2)) {
3497           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
3498           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3499           __PYX_ERR(0, 215, __pyx_L1_error)
3500         }
3501         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3502         if (likely(PyTuple_CheckExact(sequence))) {
3503           __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
3504           __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
3505         } else {
3506           __pyx_t_10 = PyList_GET_ITEM(sequence, 0);
3507           __pyx_t_9 = PyList_GET_ITEM(sequence, 1);
3508         }
3509         __Pyx_INCREF(__pyx_t_10);
3510         __Pyx_INCREF(__pyx_t_9);
3511         #else
3512         __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 215, __pyx_L1_error)
3513         __Pyx_GOTREF(__pyx_t_10);
3514         __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 215, __pyx_L1_error)
3515         __Pyx_GOTREF(__pyx_t_9);
3516         #endif
3517         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3518       } else {
3519         Py_ssize_t index = -1;
3520         __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 215, __pyx_L1_error)
3521         __Pyx_GOTREF(__pyx_t_8);
3522         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3523         __pyx_t_22 = Py_TYPE(__pyx_t_8)->tp_iternext;
3524         index = 0; __pyx_t_10 = __pyx_t_22(__pyx_t_8); if (unlikely(!__pyx_t_10)) goto __pyx_L17_unpacking_failed;
3525         __Pyx_GOTREF(__pyx_t_10);
3526         index = 1; __pyx_t_9 = __pyx_t_22(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L17_unpacking_failed;
3527         __Pyx_GOTREF(__pyx_t_9);
3528         if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_8), 2) < 0) __PYX_ERR(0, 215, __pyx_L1_error)
3529         __pyx_t_22 = NULL;
3530         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3531         goto __pyx_L18_unpacking_done;
3532         __pyx_L17_unpacking_failed:;
3533         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3534         __pyx_t_22 = NULL;
3535         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3536         __PYX_ERR(0, 215, __pyx_L1_error)
3537         __pyx_L18_unpacking_done:;
3538       }
3539       __pyx_t_23 = __Pyx_PyIndex_AsSsize_t(__pyx_t_10); if (unlikely((__pyx_t_23 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L1_error)
3540       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3541       __pyx_t_16 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_9); if (unlikely((__pyx_t_16 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L1_error)
3542       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3543       __pyx_v_i = __pyx_t_23;
3544       __pyx_v_last_fit_i = __pyx_t_16;
3545 
3546       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":217
3547  *             i, last_fit_i = update_indices(xvals, y_fit, delta, i, out_n, last_fit_i)
3548  *
3549  *             if last_fit_i >= out_n-1:             # <<<<<<<<<<<<<<
3550  *                 break
3551  *
3552  */
3553       __pyx_t_6 = ((__pyx_v_last_fit_i >= (__pyx_v_out_n - 1)) != 0);
3554       if (__pyx_t_6) {
3555 
3556         /* "statsmodels/nonparametric/_smoothers_lowess.pyx":218
3557  *
3558  *             if last_fit_i >= out_n-1:
3559  *                 break             # <<<<<<<<<<<<<<
3560  *
3561  *         # Calculate residual weights
3562  */
3563         goto __pyx_L11_break;
3564 
3565         /* "statsmodels/nonparametric/_smoothers_lowess.pyx":217
3566  *             i, last_fit_i = update_indices(xvals, y_fit, delta, i, out_n, last_fit_i)
3567  *
3568  *             if last_fit_i >= out_n-1:             # <<<<<<<<<<<<<<
3569  *                 break
3570  *
3571  */
3572       }
3573     }
3574     __pyx_L11_break:;
3575 
3576     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":221
3577  *
3578  *         # Calculate residual weights
3579  *         if not given_xvals:             # <<<<<<<<<<<<<<
3580  *             resid_weights = calculate_residual_weights(y, y_fit)
3581  *
3582  */
3583     __pyx_t_6 = ((!(__pyx_v_given_xvals != 0)) != 0);
3584     if (__pyx_t_6) {
3585 
3586       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":222
3587  *         # Calculate residual weights
3588  *         if not given_xvals:
3589  *             resid_weights = calculate_residual_weights(y, y_fit)             # <<<<<<<<<<<<<<
3590  *
3591  *     return np.array([xvals, y_fit]).T, resid_weights
3592  */
3593       __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(((PyObject *)__pyx_v_y), PyBUF_WRITABLE); if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 222, __pyx_L1_error)
3594       __pyx_t_26 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(((PyObject *)__pyx_v_y_fit), PyBUF_WRITABLE); if (unlikely(!__pyx_t_26.memview)) __PYX_ERR(0, 222, __pyx_L1_error)
3595       __pyx_t_7 = ((PyObject *)__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_residual_weights(__pyx_t_20, __pyx_t_26, 0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 222, __pyx_L1_error)
3596       __Pyx_GOTREF(__pyx_t_7);
3597       __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
3598       __pyx_t_20.memview = NULL;
3599       __pyx_t_20.data = NULL;
3600       __PYX_XDEC_MEMVIEW(&__pyx_t_26, 1);
3601       __pyx_t_26.memview = NULL;
3602       __pyx_t_26.data = NULL;
3603       {
3604         __Pyx_BufFmt_StackElem __pyx_stack[1];
3605         __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resid_weights.rcbuffer->pybuffer);
3606         __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resid_weights.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_7), &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
3607         if (unlikely(__pyx_t_1 < 0)) {
3608           PyErr_Fetch(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
3609           if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resid_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_resid_weights, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
3610             Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4);
3611             __Pyx_RaiseBufferFallbackError();
3612           } else {
3613             PyErr_Restore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
3614           }
3615           __pyx_t_2 = __pyx_t_3 = __pyx_t_4 = 0;
3616         }
3617         __pyx_pybuffernd_resid_weights.diminfo[0].strides = __pyx_pybuffernd_resid_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_resid_weights.diminfo[0].shape = __pyx_pybuffernd_resid_weights.rcbuffer->pybuffer.shape[0];
3618         if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 222, __pyx_L1_error)
3619       }
3620       __Pyx_DECREF_SET(__pyx_v_resid_weights, ((PyArrayObject *)__pyx_t_7));
3621       __pyx_t_7 = 0;
3622 
3623       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":221
3624  *
3625  *         # Calculate residual weights
3626  *         if not given_xvals:             # <<<<<<<<<<<<<<
3627  *             resid_weights = calculate_residual_weights(y, y_fit)
3628  *
3629  */
3630     }
3631   }
3632 
3633   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":224
3634  *             resid_weights = calculate_residual_weights(y, y_fit)
3635  *
3636  *     return np.array([xvals, y_fit]).T, resid_weights             # <<<<<<<<<<<<<<
3637  *
3638  *
3639  */
3640   __Pyx_XDECREF(__pyx_r);
3641   __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 224, __pyx_L1_error)
3642   __Pyx_GOTREF(__pyx_t_9);
3643   __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_array); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 224, __pyx_L1_error)
3644   __Pyx_GOTREF(__pyx_t_10);
3645   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3646   __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 224, __pyx_L1_error)
3647   __Pyx_GOTREF(__pyx_t_9);
3648   __Pyx_INCREF(((PyObject *)__pyx_v_xvals));
3649   __Pyx_GIVEREF(((PyObject *)__pyx_v_xvals));
3650   PyList_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_xvals));
3651   __Pyx_INCREF(((PyObject *)__pyx_v_y_fit));
3652   __Pyx_GIVEREF(((PyObject *)__pyx_v_y_fit));
3653   PyList_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_y_fit));
3654   __pyx_t_8 = NULL;
3655   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
3656     __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
3657     if (likely(__pyx_t_8)) {
3658       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
3659       __Pyx_INCREF(__pyx_t_8);
3660       __Pyx_INCREF(function);
3661       __Pyx_DECREF_SET(__pyx_t_10, function);
3662     }
3663   }
3664   __pyx_t_7 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9);
3665   __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3666   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3667   if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error)
3668   __Pyx_GOTREF(__pyx_t_7);
3669   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3670   __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_T); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 224, __pyx_L1_error)
3671   __Pyx_GOTREF(__pyx_t_10);
3672   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3673   __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error)
3674   __Pyx_GOTREF(__pyx_t_7);
3675   __Pyx_GIVEREF(__pyx_t_10);
3676   PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10);
3677   __Pyx_INCREF(((PyObject *)__pyx_v_resid_weights));
3678   __Pyx_GIVEREF(((PyObject *)__pyx_v_resid_weights));
3679   PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_resid_weights));
3680   __pyx_t_10 = 0;
3681   __pyx_r = __pyx_t_7;
3682   __pyx_t_7 = 0;
3683   goto __pyx_L0;
3684 
3685   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":24
3686  * np.import_array()
3687  *
3688  * def lowess(np.ndarray[DTYPE_t, ndim = 1] endog,             # <<<<<<<<<<<<<<
3689  *            np.ndarray[DTYPE_t, ndim = 1] exog,
3690  *            np.ndarray[DTYPE_t, ndim = 1] xvals,
3691  */
3692 
3693   /* function exit code */
3694   __pyx_L1_error:;
3695   __Pyx_XDECREF(__pyx_t_7);
3696   __Pyx_XDECREF(__pyx_t_8);
3697   __Pyx_XDECREF(__pyx_t_9);
3698   __Pyx_XDECREF(__pyx_t_10);
3699   __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
3700   __Pyx_XDECREF(__pyx_t_21);
3701   __PYX_XDEC_MEMVIEW(&__pyx_t_26, 1);
3702   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3703     __Pyx_PyThreadState_declare
3704     __Pyx_PyThreadState_assign
3705     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3706     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_endog.rcbuffer->pybuffer);
3707     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exog.rcbuffer->pybuffer);
3708     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resid_weights.rcbuffer->pybuffer);
3709     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer);
3710     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
3711     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xvals.rcbuffer->pybuffer);
3712     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
3713     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_fit.rcbuffer->pybuffer);
3714   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3715   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.lowess", __pyx_clineno, __pyx_lineno, __pyx_filename);
3716   __pyx_r = NULL;
3717   goto __pyx_L2;
3718   __pyx_L0:;
3719   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_endog.rcbuffer->pybuffer);
3720   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exog.rcbuffer->pybuffer);
3721   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resid_weights.rcbuffer->pybuffer);
3722   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer);
3723   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
3724   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xvals.rcbuffer->pybuffer);
3725   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
3726   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_fit.rcbuffer->pybuffer);
3727   __pyx_L2:;
3728   __Pyx_XDECREF((PyObject *)__pyx_v_x);
3729   __Pyx_XDECREF((PyObject *)__pyx_v_y);
3730   __Pyx_XDECREF((PyObject *)__pyx_v_y_fit);
3731   __Pyx_XDECREF((PyObject *)__pyx_v_weights);
3732   __Pyx_XDECREF((PyObject *)__pyx_v_resid_weights);
3733   __Pyx_XGIVEREF(__pyx_r);
3734   __Pyx_RefNannyFinishContext();
3735   return __pyx_r;
3736 }
3737 
3738 /* "statsmodels/nonparametric/_smoothers_lowess.pyx":227
3739  *
3740  *
3741  * cpdef update_neighborhood(double[::1] x,             # <<<<<<<<<<<<<<
3742  *                           double xval,
3743  *                           Py_ssize_t n,
3744  */
3745 
3746 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_3update_neighborhood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_update_neighborhood(__Pyx_memviewslice __pyx_v_x,double __pyx_v_xval,Py_ssize_t __pyx_v_n,Py_ssize_t __pyx_v_left_end,Py_ssize_t __pyx_v_right_end,CYTHON_UNUSED int __pyx_skip_dispatch)3747 static PyObject *__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_update_neighborhood(__Pyx_memviewslice __pyx_v_x, double __pyx_v_xval, Py_ssize_t __pyx_v_n, Py_ssize_t __pyx_v_left_end, Py_ssize_t __pyx_v_right_end, CYTHON_UNUSED int __pyx_skip_dispatch) {
3748   double __pyx_v_radius;
3749   PyObject *__pyx_r = NULL;
3750   __Pyx_RefNannyDeclarations
3751   int __pyx_t_1;
3752   Py_ssize_t __pyx_t_2;
3753   Py_ssize_t __pyx_t_3;
3754   PyObject *__pyx_t_4 = NULL;
3755   PyObject *__pyx_t_5 = NULL;
3756   PyObject *__pyx_t_6 = NULL;
3757   PyObject *__pyx_t_7 = NULL;
3758   int __pyx_lineno = 0;
3759   const char *__pyx_filename = NULL;
3760   int __pyx_clineno = 0;
3761   __Pyx_RefNannySetupContext("update_neighborhood", 0);
3762 
3763   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":276
3764  *     # Once the right end hits the end of the data, hold the
3765  *     # neighborhood the same for the remaining xvals.
3766  *     while True:             # <<<<<<<<<<<<<<
3767  *         if right_end < n:
3768  *             if xval > ((x[left_end] + x[right_end]) / 2.0):
3769  */
3770   while (1) {
3771 
3772     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":277
3773  *     # neighborhood the same for the remaining xvals.
3774  *     while True:
3775  *         if right_end < n:             # <<<<<<<<<<<<<<
3776  *             if xval > ((x[left_end] + x[right_end]) / 2.0):
3777  *                 left_end += 1
3778  */
3779     __pyx_t_1 = ((__pyx_v_right_end < __pyx_v_n) != 0);
3780     if (__pyx_t_1) {
3781 
3782       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":278
3783  *     while True:
3784  *         if right_end < n:
3785  *             if xval > ((x[left_end] + x[right_end]) / 2.0):             # <<<<<<<<<<<<<<
3786  *                 left_end += 1
3787  *                 right_end += 1
3788  */
3789       __pyx_t_2 = __pyx_v_left_end;
3790       __pyx_t_3 = __pyx_v_right_end;
3791       __pyx_t_1 = ((__pyx_v_xval > (((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_2)) ))) + (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_3)) )))) / 2.0)) != 0);
3792       if (__pyx_t_1) {
3793 
3794         /* "statsmodels/nonparametric/_smoothers_lowess.pyx":279
3795  *         if right_end < n:
3796  *             if xval > ((x[left_end] + x[right_end]) / 2.0):
3797  *                 left_end += 1             # <<<<<<<<<<<<<<
3798  *                 right_end += 1
3799  *             else:
3800  */
3801         __pyx_v_left_end = (__pyx_v_left_end + 1);
3802 
3803         /* "statsmodels/nonparametric/_smoothers_lowess.pyx":280
3804  *             if xval > ((x[left_end] + x[right_end]) / 2.0):
3805  *                 left_end += 1
3806  *                 right_end += 1             # <<<<<<<<<<<<<<
3807  *             else:
3808  *                 break
3809  */
3810         __pyx_v_right_end = (__pyx_v_right_end + 1);
3811 
3812         /* "statsmodels/nonparametric/_smoothers_lowess.pyx":278
3813  *     while True:
3814  *         if right_end < n:
3815  *             if xval > ((x[left_end] + x[right_end]) / 2.0):             # <<<<<<<<<<<<<<
3816  *                 left_end += 1
3817  *                 right_end += 1
3818  */
3819         goto __pyx_L6;
3820       }
3821 
3822       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":282
3823  *                 right_end += 1
3824  *             else:
3825  *                 break             # <<<<<<<<<<<<<<
3826  *         else:
3827  *             break
3828  */
3829       /*else*/ {
3830         goto __pyx_L4_break;
3831       }
3832       __pyx_L6:;
3833 
3834       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":277
3835  *     # neighborhood the same for the remaining xvals.
3836  *     while True:
3837  *         if right_end < n:             # <<<<<<<<<<<<<<
3838  *             if xval > ((x[left_end] + x[right_end]) / 2.0):
3839  *                 left_end += 1
3840  */
3841       goto __pyx_L5;
3842     }
3843 
3844     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":284
3845  *                 break
3846  *         else:
3847  *             break             # <<<<<<<<<<<<<<
3848  *
3849  *     radius = fmax(xval - x[left_end], x[right_end-1] - xval)
3850  */
3851     /*else*/ {
3852       goto __pyx_L4_break;
3853     }
3854     __pyx_L5:;
3855   }
3856   __pyx_L4_break:;
3857 
3858   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":286
3859  *             break
3860  *
3861  *     radius = fmax(xval - x[left_end], x[right_end-1] - xval)             # <<<<<<<<<<<<<<
3862  *
3863  *     return left_end, right_end, radius
3864  */
3865   __pyx_t_3 = __pyx_v_left_end;
3866   __pyx_t_2 = (__pyx_v_right_end - 1);
3867   __pyx_v_radius = fmax((__pyx_v_xval - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_3)) )))), ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_2)) ))) - __pyx_v_xval));
3868 
3869   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":288
3870  *     radius = fmax(xval - x[left_end], x[right_end-1] - xval)
3871  *
3872  *     return left_end, right_end, radius             # <<<<<<<<<<<<<<
3873  *
3874  * cdef bint calculate_weights(np.ndarray[DTYPE_t, ndim = 1] x,
3875  */
3876   __Pyx_XDECREF(__pyx_r);
3877   __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_left_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error)
3878   __Pyx_GOTREF(__pyx_t_4);
3879   __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_right_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error)
3880   __Pyx_GOTREF(__pyx_t_5);
3881   __pyx_t_6 = PyFloat_FromDouble(__pyx_v_radius); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 288, __pyx_L1_error)
3882   __Pyx_GOTREF(__pyx_t_6);
3883   __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error)
3884   __Pyx_GOTREF(__pyx_t_7);
3885   __Pyx_GIVEREF(__pyx_t_4);
3886   PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
3887   __Pyx_GIVEREF(__pyx_t_5);
3888   PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
3889   __Pyx_GIVEREF(__pyx_t_6);
3890   PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
3891   __pyx_t_4 = 0;
3892   __pyx_t_5 = 0;
3893   __pyx_t_6 = 0;
3894   __pyx_r = __pyx_t_7;
3895   __pyx_t_7 = 0;
3896   goto __pyx_L0;
3897 
3898   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":227
3899  *
3900  *
3901  * cpdef update_neighborhood(double[::1] x,             # <<<<<<<<<<<<<<
3902  *                           double xval,
3903  *                           Py_ssize_t n,
3904  */
3905 
3906   /* function exit code */
3907   __pyx_L1_error:;
3908   __Pyx_XDECREF(__pyx_t_4);
3909   __Pyx_XDECREF(__pyx_t_5);
3910   __Pyx_XDECREF(__pyx_t_6);
3911   __Pyx_XDECREF(__pyx_t_7);
3912   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.update_neighborhood", __pyx_clineno, __pyx_lineno, __pyx_filename);
3913   __pyx_r = 0;
3914   __pyx_L0:;
3915   __Pyx_XGIVEREF(__pyx_r);
3916   __Pyx_RefNannyFinishContext();
3917   return __pyx_r;
3918 }
3919 
3920 /* Python wrapper */
3921 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_3update_neighborhood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3922 static char __pyx_doc_11statsmodels_13nonparametric_17_smoothers_lowess_2update_neighborhood[] = "\n    Find the indices bounding the k-nearest-neighbors of the current point.\n\n    Parameters\n    ----------\n    x : 1-D numpy array\n        The input x-values\n    xval : float\n        The x-value of the point currently being fit.\n    n : indexing integer\n        The length of the input vectors, x and y.\n    left_end : indexing integer\n        The index of the left-most point in the neighborhood\n        of the previously-fit x-value.\n    right_end: indexing integer\n        The index of the right-most point in the neighborhood\n        of the previous x-value. Non-inclusive, s.t. the neighborhood is\n        x[left_end] <= x < x[right_end].\n\n    Returns\n    -------\n    left_end : indexing integer\n        The index of the left-most point in the neighborhood\n        of xval (the current point).\n    right_end: indexing integer\n        The index of the right-most point in the neighborhood\n               of xval. Non-inclusive, s.t. the neighborhood is\n               x[left_end] <= x < x[right_end].\n    radius : float\n        The radius of the current neighborhood. The larger of\n        distances between xval and its left-most or right-most\n        neighbor.\n    ";
__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_3update_neighborhood(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3923 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_3update_neighborhood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3924   __Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } };
3925   double __pyx_v_xval;
3926   Py_ssize_t __pyx_v_n;
3927   Py_ssize_t __pyx_v_left_end;
3928   Py_ssize_t __pyx_v_right_end;
3929   int __pyx_lineno = 0;
3930   const char *__pyx_filename = NULL;
3931   int __pyx_clineno = 0;
3932   PyObject *__pyx_r = 0;
3933   __Pyx_RefNannyDeclarations
3934   __Pyx_RefNannySetupContext("update_neighborhood (wrapper)", 0);
3935   {
3936     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_xval,&__pyx_n_s_n,&__pyx_n_s_left_end,&__pyx_n_s_right_end,0};
3937     PyObject* values[5] = {0,0,0,0,0};
3938     if (unlikely(__pyx_kwds)) {
3939       Py_ssize_t kw_args;
3940       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3941       switch (pos_args) {
3942         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3943         CYTHON_FALLTHROUGH;
3944         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3945         CYTHON_FALLTHROUGH;
3946         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3947         CYTHON_FALLTHROUGH;
3948         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3949         CYTHON_FALLTHROUGH;
3950         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3951         CYTHON_FALLTHROUGH;
3952         case  0: break;
3953         default: goto __pyx_L5_argtuple_error;
3954       }
3955       kw_args = PyDict_Size(__pyx_kwds);
3956       switch (pos_args) {
3957         case  0:
3958         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
3959         else goto __pyx_L5_argtuple_error;
3960         CYTHON_FALLTHROUGH;
3961         case  1:
3962         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xval)) != 0)) kw_args--;
3963         else {
3964           __Pyx_RaiseArgtupleInvalid("update_neighborhood", 1, 5, 5, 1); __PYX_ERR(0, 227, __pyx_L3_error)
3965         }
3966         CYTHON_FALLTHROUGH;
3967         case  2:
3968         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
3969         else {
3970           __Pyx_RaiseArgtupleInvalid("update_neighborhood", 1, 5, 5, 2); __PYX_ERR(0, 227, __pyx_L3_error)
3971         }
3972         CYTHON_FALLTHROUGH;
3973         case  3:
3974         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left_end)) != 0)) kw_args--;
3975         else {
3976           __Pyx_RaiseArgtupleInvalid("update_neighborhood", 1, 5, 5, 3); __PYX_ERR(0, 227, __pyx_L3_error)
3977         }
3978         CYTHON_FALLTHROUGH;
3979         case  4:
3980         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_right_end)) != 0)) kw_args--;
3981         else {
3982           __Pyx_RaiseArgtupleInvalid("update_neighborhood", 1, 5, 5, 4); __PYX_ERR(0, 227, __pyx_L3_error)
3983         }
3984       }
3985       if (unlikely(kw_args > 0)) {
3986         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_neighborhood") < 0)) __PYX_ERR(0, 227, __pyx_L3_error)
3987       }
3988     } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
3989       goto __pyx_L5_argtuple_error;
3990     } else {
3991       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3992       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3993       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3994       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3995       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3996     }
3997     __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 227, __pyx_L3_error)
3998     __pyx_v_xval = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_xval == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L3_error)
3999     __pyx_v_n = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_n == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L3_error)
4000     __pyx_v_left_end = __Pyx_PyIndex_AsSsize_t(values[3]); if (unlikely((__pyx_v_left_end == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L3_error)
4001     __pyx_v_right_end = __Pyx_PyIndex_AsSsize_t(values[4]); if (unlikely((__pyx_v_right_end == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L3_error)
4002   }
4003   goto __pyx_L4_argument_unpacking_done;
4004   __pyx_L5_argtuple_error:;
4005   __Pyx_RaiseArgtupleInvalid("update_neighborhood", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 227, __pyx_L3_error)
4006   __pyx_L3_error:;
4007   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.update_neighborhood", __pyx_clineno, __pyx_lineno, __pyx_filename);
4008   __Pyx_RefNannyFinishContext();
4009   return NULL;
4010   __pyx_L4_argument_unpacking_done:;
4011   __pyx_r = __pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_2update_neighborhood(__pyx_self, __pyx_v_x, __pyx_v_xval, __pyx_v_n, __pyx_v_left_end, __pyx_v_right_end);
4012 
4013   /* function exit code */
4014   __Pyx_RefNannyFinishContext();
4015   return __pyx_r;
4016 }
4017 
__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_2update_neighborhood(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_x,double __pyx_v_xval,Py_ssize_t __pyx_v_n,Py_ssize_t __pyx_v_left_end,Py_ssize_t __pyx_v_right_end)4018 static PyObject *__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_2update_neighborhood(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_x, double __pyx_v_xval, Py_ssize_t __pyx_v_n, Py_ssize_t __pyx_v_left_end, Py_ssize_t __pyx_v_right_end) {
4019   PyObject *__pyx_r = NULL;
4020   __Pyx_RefNannyDeclarations
4021   PyObject *__pyx_t_1 = NULL;
4022   int __pyx_lineno = 0;
4023   const char *__pyx_filename = NULL;
4024   int __pyx_clineno = 0;
4025   __Pyx_RefNannySetupContext("update_neighborhood", 0);
4026   __Pyx_XDECREF(__pyx_r);
4027   if (unlikely(!__pyx_v_x.memview)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 227, __pyx_L1_error) }
4028   __pyx_t_1 = __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_update_neighborhood(__pyx_v_x, __pyx_v_xval, __pyx_v_n, __pyx_v_left_end, __pyx_v_right_end, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error)
4029   __Pyx_GOTREF(__pyx_t_1);
4030   __pyx_r = __pyx_t_1;
4031   __pyx_t_1 = 0;
4032   goto __pyx_L0;
4033 
4034   /* function exit code */
4035   __pyx_L1_error:;
4036   __Pyx_XDECREF(__pyx_t_1);
4037   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.update_neighborhood", __pyx_clineno, __pyx_lineno, __pyx_filename);
4038   __pyx_r = NULL;
4039   __pyx_L0:;
4040   __PYX_XDEC_MEMVIEW(&__pyx_v_x, 1);
4041   __Pyx_XGIVEREF(__pyx_r);
4042   __Pyx_RefNannyFinishContext();
4043   return __pyx_r;
4044 }
4045 
4046 /* "statsmodels/nonparametric/_smoothers_lowess.pyx":290
4047  *     return left_end, right_end, radius
4048  *
4049  * cdef bint calculate_weights(np.ndarray[DTYPE_t, ndim = 1] x,             # <<<<<<<<<<<<<<
4050  *                             np.ndarray[DTYPE_t, ndim = 1] weights,
4051  *                             np.ndarray[DTYPE_t, ndim = 1] resid_weights,
4052  */
4053 
__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_weights(PyArrayObject * __pyx_v_x,PyArrayObject * __pyx_v_weights,PyArrayObject * __pyx_v_resid_weights,__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t __pyx_v_xval,Py_ssize_t __pyx_v_left_end,Py_ssize_t __pyx_v_right_end,double __pyx_v_radius)4054 static int __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_weights(PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_weights, PyArrayObject *__pyx_v_resid_weights, __pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t __pyx_v_xval, Py_ssize_t __pyx_v_left_end, Py_ssize_t __pyx_v_right_end, double __pyx_v_radius) {
4055   PyArrayObject *__pyx_v_x_j = 0;
4056   PyArrayObject *__pyx_v_dist_i_j = 0;
4057   int __pyx_v_reg_ok;
4058   double __pyx_v_sum_weights;
4059   int __pyx_v_num_nonzero_weights;
4060   Py_ssize_t __pyx_v_j;
4061   __Pyx_LocalBuf_ND __pyx_pybuffernd_dist_i_j;
4062   __Pyx_Buffer __pyx_pybuffer_dist_i_j;
4063   __Pyx_LocalBuf_ND __pyx_pybuffernd_resid_weights;
4064   __Pyx_Buffer __pyx_pybuffer_resid_weights;
4065   __Pyx_LocalBuf_ND __pyx_pybuffernd_weights;
4066   __Pyx_Buffer __pyx_pybuffer_weights;
4067   __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
4068   __Pyx_Buffer __pyx_pybuffer_x;
4069   __Pyx_LocalBuf_ND __pyx_pybuffernd_x_j;
4070   __Pyx_Buffer __pyx_pybuffer_x_j;
4071   int __pyx_r;
4072   __Pyx_RefNannyDeclarations
4073   PyObject *__pyx_t_1 = NULL;
4074   PyObject *__pyx_t_2 = NULL;
4075   PyObject *__pyx_t_3 = NULL;
4076   PyArrayObject *__pyx_t_4 = NULL;
4077   PyObject *__pyx_t_5 = NULL;
4078   PyArrayObject *__pyx_t_6 = NULL;
4079   __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
4080   PyObject *__pyx_t_8 = NULL;
4081   double __pyx_t_9;
4082   Py_ssize_t __pyx_t_10;
4083   Py_ssize_t __pyx_t_11;
4084   Py_ssize_t __pyx_t_12;
4085   Py_ssize_t __pyx_t_13;
4086   int __pyx_t_14;
4087   int __pyx_lineno = 0;
4088   const char *__pyx_filename = NULL;
4089   int __pyx_clineno = 0;
4090   __Pyx_RefNannySetupContext("calculate_weights", 0);
4091   __pyx_pybuffer_x_j.pybuffer.buf = NULL;
4092   __pyx_pybuffer_x_j.refcount = 0;
4093   __pyx_pybuffernd_x_j.data = NULL;
4094   __pyx_pybuffernd_x_j.rcbuffer = &__pyx_pybuffer_x_j;
4095   __pyx_pybuffer_dist_i_j.pybuffer.buf = NULL;
4096   __pyx_pybuffer_dist_i_j.refcount = 0;
4097   __pyx_pybuffernd_dist_i_j.data = NULL;
4098   __pyx_pybuffernd_dist_i_j.rcbuffer = &__pyx_pybuffer_dist_i_j;
4099   __pyx_pybuffer_x.pybuffer.buf = NULL;
4100   __pyx_pybuffer_x.refcount = 0;
4101   __pyx_pybuffernd_x.data = NULL;
4102   __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
4103   __pyx_pybuffer_weights.pybuffer.buf = NULL;
4104   __pyx_pybuffer_weights.refcount = 0;
4105   __pyx_pybuffernd_weights.data = NULL;
4106   __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights;
4107   __pyx_pybuffer_resid_weights.pybuffer.buf = NULL;
4108   __pyx_pybuffer_resid_weights.refcount = 0;
4109   __pyx_pybuffernd_resid_weights.data = NULL;
4110   __pyx_pybuffernd_resid_weights.rcbuffer = &__pyx_pybuffer_resid_weights;
4111   {
4112     __Pyx_BufFmt_StackElem __pyx_stack[1];
4113     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 290, __pyx_L1_error)
4114   }
4115   __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0];
4116   {
4117     __Pyx_BufFmt_StackElem __pyx_stack[1];
4118     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 290, __pyx_L1_error)
4119   }
4120   __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0];
4121   {
4122     __Pyx_BufFmt_StackElem __pyx_stack[1];
4123     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resid_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_resid_weights, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 290, __pyx_L1_error)
4124   }
4125   __pyx_pybuffernd_resid_weights.diminfo[0].strides = __pyx_pybuffernd_resid_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_resid_weights.diminfo[0].shape = __pyx_pybuffernd_resid_weights.rcbuffer->pybuffer.shape[0];
4126 
4127   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":332
4128  *
4129  *     cdef:
4130  *         np.ndarray[DTYPE_t, ndim = 1] x_j = x[left_end:right_end]             # <<<<<<<<<<<<<<
4131  *         np.ndarray[DTYPE_t, ndim = 1] dist_i_j = np.abs(x_j - xval) / radius
4132  *         bint reg_ok = 1  # True
4133  */
4134   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_left_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
4135   __Pyx_GOTREF(__pyx_t_1);
4136   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_right_end); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error)
4137   __Pyx_GOTREF(__pyx_t_2);
4138   __pyx_t_3 = PySlice_New(__pyx_t_1, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
4139   __Pyx_GOTREF(__pyx_t_3);
4140   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4141   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4142   __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error)
4143   __Pyx_GOTREF(__pyx_t_2);
4144   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4145   if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 332, __pyx_L1_error)
4146   __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
4147   {
4148     __Pyx_BufFmt_StackElem __pyx_stack[1];
4149     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_j.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
4150       __pyx_v_x_j = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_x_j.rcbuffer->pybuffer.buf = NULL;
4151       __PYX_ERR(0, 332, __pyx_L1_error)
4152     } else {__pyx_pybuffernd_x_j.diminfo[0].strides = __pyx_pybuffernd_x_j.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x_j.diminfo[0].shape = __pyx_pybuffernd_x_j.rcbuffer->pybuffer.shape[0];
4153     }
4154   }
4155   __pyx_t_4 = 0;
4156   __pyx_v_x_j = ((PyArrayObject *)__pyx_t_2);
4157   __pyx_t_2 = 0;
4158 
4159   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":333
4160  *     cdef:
4161  *         np.ndarray[DTYPE_t, ndim = 1] x_j = x[left_end:right_end]
4162  *         np.ndarray[DTYPE_t, ndim = 1] dist_i_j = np.abs(x_j - xval) / radius             # <<<<<<<<<<<<<<
4163  *         bint reg_ok = 1  # True
4164  *         double sum_weights
4165  */
4166   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
4167   __Pyx_GOTREF(__pyx_t_3);
4168   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_abs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
4169   __Pyx_GOTREF(__pyx_t_1);
4170   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4171   __pyx_t_3 = PyFloat_FromDouble(__pyx_v_xval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
4172   __Pyx_GOTREF(__pyx_t_3);
4173   __pyx_t_5 = PyNumber_Subtract(((PyObject *)__pyx_v_x_j), __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
4174   __Pyx_GOTREF(__pyx_t_5);
4175   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4176   __pyx_t_3 = NULL;
4177   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
4178     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
4179     if (likely(__pyx_t_3)) {
4180       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4181       __Pyx_INCREF(__pyx_t_3);
4182       __Pyx_INCREF(function);
4183       __Pyx_DECREF_SET(__pyx_t_1, function);
4184     }
4185   }
4186   __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
4187   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4188   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4189   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error)
4190   __Pyx_GOTREF(__pyx_t_2);
4191   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4192   __pyx_t_1 = PyFloat_FromDouble(__pyx_v_radius); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
4193   __Pyx_GOTREF(__pyx_t_1);
4194   __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
4195   __Pyx_GOTREF(__pyx_t_5);
4196   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4197   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4198   if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 333, __pyx_L1_error)
4199   __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
4200   {
4201     __Pyx_BufFmt_StackElem __pyx_stack[1];
4202     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_i_j.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
4203       __pyx_v_dist_i_j = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dist_i_j.rcbuffer->pybuffer.buf = NULL;
4204       __PYX_ERR(0, 333, __pyx_L1_error)
4205     } else {__pyx_pybuffernd_dist_i_j.diminfo[0].strides = __pyx_pybuffernd_dist_i_j.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_i_j.diminfo[0].shape = __pyx_pybuffernd_dist_i_j.rcbuffer->pybuffer.shape[0];
4206     }
4207   }
4208   __pyx_t_6 = 0;
4209   __pyx_v_dist_i_j = ((PyArrayObject *)__pyx_t_5);
4210   __pyx_t_5 = 0;
4211 
4212   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":334
4213  *         np.ndarray[DTYPE_t, ndim = 1] x_j = x[left_end:right_end]
4214  *         np.ndarray[DTYPE_t, ndim = 1] dist_i_j = np.abs(x_j - xval) / radius
4215  *         bint reg_ok = 1  # True             # <<<<<<<<<<<<<<
4216  *         double sum_weights
4217  *         int num_nonzero_weights = 0
4218  */
4219   __pyx_v_reg_ok = 1;
4220 
4221   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":336
4222  *         bint reg_ok = 1  # True
4223  *         double sum_weights
4224  *         int num_nonzero_weights = 0             # <<<<<<<<<<<<<<
4225  *
4226  *     # Assign the distance measure to the weights, then apply the tricube
4227  */
4228   __pyx_v_num_nonzero_weights = 0;
4229 
4230   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":340
4231  *     # Assign the distance measure to the weights, then apply the tricube
4232  *     # function to change in-place.
4233  *     weights[left_end:right_end] = dist_i_j             # <<<<<<<<<<<<<<
4234  *
4235  *     tricube(weights[left_end:right_end])
4236  */
4237   __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_left_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 340, __pyx_L1_error)
4238   __Pyx_GOTREF(__pyx_t_5);
4239   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_right_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error)
4240   __Pyx_GOTREF(__pyx_t_1);
4241   __pyx_t_2 = PySlice_New(__pyx_t_5, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error)
4242   __Pyx_GOTREF(__pyx_t_2);
4243   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4244   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4245   if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_weights), __pyx_t_2, ((PyObject *)__pyx_v_dist_i_j)) < 0)) __PYX_ERR(0, 340, __pyx_L1_error)
4246   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4247 
4248   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":342
4249  *     weights[left_end:right_end] = dist_i_j
4250  *
4251  *     tricube(weights[left_end:right_end])             # <<<<<<<<<<<<<<
4252  *     weights[left_end:right_end] = (weights[left_end:right_end] *
4253  *                                       resid_weights[left_end:right_end])
4254  */
4255   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_left_end); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error)
4256   __Pyx_GOTREF(__pyx_t_2);
4257   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_right_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
4258   __Pyx_GOTREF(__pyx_t_1);
4259   __pyx_t_5 = PySlice_New(__pyx_t_2, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 342, __pyx_L1_error)
4260   __Pyx_GOTREF(__pyx_t_5);
4261   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4262   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4263   __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_weights), __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
4264   __Pyx_GOTREF(__pyx_t_1);
4265   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4266   __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 342, __pyx_L1_error)
4267   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4268   __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_tricube(__pyx_t_7);
4269   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
4270   __pyx_t_7.memview = NULL;
4271   __pyx_t_7.data = NULL;
4272 
4273   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":343
4274  *
4275  *     tricube(weights[left_end:right_end])
4276  *     weights[left_end:right_end] = (weights[left_end:right_end] *             # <<<<<<<<<<<<<<
4277  *                                       resid_weights[left_end:right_end])
4278  *
4279  */
4280   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_left_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
4281   __Pyx_GOTREF(__pyx_t_1);
4282   __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_right_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 343, __pyx_L1_error)
4283   __Pyx_GOTREF(__pyx_t_5);
4284   __pyx_t_2 = PySlice_New(__pyx_t_1, __pyx_t_5, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error)
4285   __Pyx_GOTREF(__pyx_t_2);
4286   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4287   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4288   __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_weights), __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 343, __pyx_L1_error)
4289   __Pyx_GOTREF(__pyx_t_5);
4290   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4291 
4292   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":344
4293  *     tricube(weights[left_end:right_end])
4294  *     weights[left_end:right_end] = (weights[left_end:right_end] *
4295  *                                       resid_weights[left_end:right_end])             # <<<<<<<<<<<<<<
4296  *
4297  *     sum_weights = np.sum(weights[left_end:right_end])
4298  */
4299   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_left_end); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 344, __pyx_L1_error)
4300   __Pyx_GOTREF(__pyx_t_2);
4301   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_right_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L1_error)
4302   __Pyx_GOTREF(__pyx_t_1);
4303   __pyx_t_3 = PySlice_New(__pyx_t_2, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 344, __pyx_L1_error)
4304   __Pyx_GOTREF(__pyx_t_3);
4305   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4306   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4307   __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_resid_weights), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L1_error)
4308   __Pyx_GOTREF(__pyx_t_1);
4309   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4310 
4311   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":343
4312  *
4313  *     tricube(weights[left_end:right_end])
4314  *     weights[left_end:right_end] = (weights[left_end:right_end] *             # <<<<<<<<<<<<<<
4315  *                                       resid_weights[left_end:right_end])
4316  *
4317  */
4318   __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error)
4319   __Pyx_GOTREF(__pyx_t_3);
4320   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4321   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4322   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_left_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
4323   __Pyx_GOTREF(__pyx_t_1);
4324   __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_right_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 343, __pyx_L1_error)
4325   __Pyx_GOTREF(__pyx_t_5);
4326   __pyx_t_2 = PySlice_New(__pyx_t_1, __pyx_t_5, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error)
4327   __Pyx_GOTREF(__pyx_t_2);
4328   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4329   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4330   if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_weights), __pyx_t_2, __pyx_t_3) < 0)) __PYX_ERR(0, 343, __pyx_L1_error)
4331   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4332   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4333 
4334   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":346
4335  *                                       resid_weights[left_end:right_end])
4336  *
4337  *     sum_weights = np.sum(weights[left_end:right_end])             # <<<<<<<<<<<<<<
4338  *     for j in range(left_end, right_end):
4339  *         num_nonzero_weights += weights[j] > 1e-12
4340  */
4341   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error)
4342   __Pyx_GOTREF(__pyx_t_2);
4343   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L1_error)
4344   __Pyx_GOTREF(__pyx_t_5);
4345   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4346   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_left_end); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error)
4347   __Pyx_GOTREF(__pyx_t_2);
4348   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_right_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
4349   __Pyx_GOTREF(__pyx_t_1);
4350   __pyx_t_8 = PySlice_New(__pyx_t_2, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 346, __pyx_L1_error)
4351   __Pyx_GOTREF(__pyx_t_8);
4352   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4353   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4354   __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_weights), __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
4355   __Pyx_GOTREF(__pyx_t_1);
4356   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4357   __pyx_t_8 = NULL;
4358   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
4359     __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
4360     if (likely(__pyx_t_8)) {
4361       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
4362       __Pyx_INCREF(__pyx_t_8);
4363       __Pyx_INCREF(function);
4364       __Pyx_DECREF_SET(__pyx_t_5, function);
4365     }
4366   }
4367   __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
4368   __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
4369   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4370   if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error)
4371   __Pyx_GOTREF(__pyx_t_3);
4372   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4373   __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 346, __pyx_L1_error)
4374   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4375   __pyx_v_sum_weights = __pyx_t_9;
4376 
4377   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":347
4378  *
4379  *     sum_weights = np.sum(weights[left_end:right_end])
4380  *     for j in range(left_end, right_end):             # <<<<<<<<<<<<<<
4381  *         num_nonzero_weights += weights[j] > 1e-12
4382  *
4383  */
4384   __pyx_t_10 = __pyx_v_right_end;
4385   __pyx_t_11 = __pyx_t_10;
4386   for (__pyx_t_12 = __pyx_v_left_end; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
4387     __pyx_v_j = __pyx_t_12;
4388 
4389     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":348
4390  *     sum_weights = np.sum(weights[left_end:right_end])
4391  *     for j in range(left_end, right_end):
4392  *         num_nonzero_weights += weights[j] > 1e-12             # <<<<<<<<<<<<<<
4393  *
4394  *     if num_nonzero_weights < 2:
4395  */
4396     __pyx_t_13 = __pyx_v_j;
4397     __pyx_v_num_nonzero_weights = (__pyx_v_num_nonzero_weights + ((*__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_weights.diminfo[0].strides)) > 1e-12));
4398   }
4399 
4400   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":350
4401  *         num_nonzero_weights += weights[j] > 1e-12
4402  *
4403  *     if num_nonzero_weights < 2:             # <<<<<<<<<<<<<<
4404  *         # Need at least 2 non-zero weights to get an okay regression fit
4405  *         # see 1960
4406  */
4407   __pyx_t_14 = ((__pyx_v_num_nonzero_weights < 2) != 0);
4408   if (__pyx_t_14) {
4409 
4410     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":353
4411  *         # Need at least 2 non-zero weights to get an okay regression fit
4412  *         # see 1960
4413  *         return 0  # False             # <<<<<<<<<<<<<<
4414  *     for j in range(left_end, right_end):
4415  *         weights[j] /= sum_weights
4416  */
4417     __pyx_r = 0;
4418     goto __pyx_L0;
4419 
4420     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":350
4421  *         num_nonzero_weights += weights[j] > 1e-12
4422  *
4423  *     if num_nonzero_weights < 2:             # <<<<<<<<<<<<<<
4424  *         # Need at least 2 non-zero weights to get an okay regression fit
4425  *         # see 1960
4426  */
4427   }
4428 
4429   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":354
4430  *         # see 1960
4431  *         return 0  # False
4432  *     for j in range(left_end, right_end):             # <<<<<<<<<<<<<<
4433  *         weights[j] /= sum_weights
4434  *
4435  */
4436   __pyx_t_10 = __pyx_v_right_end;
4437   __pyx_t_11 = __pyx_t_10;
4438   for (__pyx_t_12 = __pyx_v_left_end; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
4439     __pyx_v_j = __pyx_t_12;
4440 
4441     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":355
4442  *         return 0  # False
4443  *     for j in range(left_end, right_end):
4444  *         weights[j] /= sum_weights             # <<<<<<<<<<<<<<
4445  *
4446  *     return reg_ok
4447  */
4448     __pyx_t_13 = __pyx_v_j;
4449     *__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_weights.diminfo[0].strides) /= __pyx_v_sum_weights;
4450   }
4451 
4452   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":357
4453  *         weights[j] /= sum_weights
4454  *
4455  *     return reg_ok             # <<<<<<<<<<<<<<
4456  *
4457  *
4458  */
4459   __pyx_r = __pyx_v_reg_ok;
4460   goto __pyx_L0;
4461 
4462   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":290
4463  *     return left_end, right_end, radius
4464  *
4465  * cdef bint calculate_weights(np.ndarray[DTYPE_t, ndim = 1] x,             # <<<<<<<<<<<<<<
4466  *                             np.ndarray[DTYPE_t, ndim = 1] weights,
4467  *                             np.ndarray[DTYPE_t, ndim = 1] resid_weights,
4468  */
4469 
4470   /* function exit code */
4471   __pyx_L1_error:;
4472   __Pyx_XDECREF(__pyx_t_1);
4473   __Pyx_XDECREF(__pyx_t_2);
4474   __Pyx_XDECREF(__pyx_t_3);
4475   __Pyx_XDECREF(__pyx_t_5);
4476   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
4477   __Pyx_XDECREF(__pyx_t_8);
4478   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4479     __Pyx_PyThreadState_declare
4480     __Pyx_PyThreadState_assign
4481     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4482     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dist_i_j.rcbuffer->pybuffer);
4483     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resid_weights.rcbuffer->pybuffer);
4484     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer);
4485     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
4486     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_j.rcbuffer->pybuffer);
4487   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4488   __Pyx_WriteUnraisable("statsmodels.nonparametric._smoothers_lowess.calculate_weights", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4489   __pyx_r = 0;
4490   goto __pyx_L2;
4491   __pyx_L0:;
4492   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dist_i_j.rcbuffer->pybuffer);
4493   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resid_weights.rcbuffer->pybuffer);
4494   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer);
4495   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
4496   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_j.rcbuffer->pybuffer);
4497   __pyx_L2:;
4498   __Pyx_XDECREF((PyObject *)__pyx_v_x_j);
4499   __Pyx_XDECREF((PyObject *)__pyx_v_dist_i_j);
4500   __Pyx_RefNannyFinishContext();
4501   return __pyx_r;
4502 }
4503 
4504 /* "statsmodels/nonparametric/_smoothers_lowess.pyx":360
4505  *
4506  *
4507  * cdef void calculate_y_fit(np.ndarray[DTYPE_t, ndim = 1] x,             # <<<<<<<<<<<<<<
4508  *                           np.ndarray[DTYPE_t, ndim = 1] y,
4509  *                           Py_ssize_t i,
4510  */
4511 
__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_y_fit(PyArrayObject * __pyx_v_x,PyArrayObject * __pyx_v_y,Py_ssize_t __pyx_v_i,__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t __pyx_v_xval,PyArrayObject * __pyx_v_y_fit,PyArrayObject * __pyx_v_weights,Py_ssize_t __pyx_v_left_end,Py_ssize_t __pyx_v_right_end,int __pyx_v_reg_ok,struct __pyx_opt_args_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_y_fit * __pyx_optional_args)4512 static void __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_y_fit(PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_y, Py_ssize_t __pyx_v_i, __pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t __pyx_v_xval, PyArrayObject *__pyx_v_y_fit, PyArrayObject *__pyx_v_weights, Py_ssize_t __pyx_v_left_end, Py_ssize_t __pyx_v_right_end, int __pyx_v_reg_ok, struct __pyx_opt_args_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_y_fit *__pyx_optional_args) {
4513   int __pyx_v_fill_with_nans = ((int)0);
4514   double __pyx_v_sum_weighted_x;
4515   double __pyx_v_weighted_sqdev_x;
4516   double __pyx_v_p_i_j;
4517   Py_ssize_t __pyx_v_j;
4518   __Pyx_LocalBuf_ND __pyx_pybuffernd_weights;
4519   __Pyx_Buffer __pyx_pybuffer_weights;
4520   __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
4521   __Pyx_Buffer __pyx_pybuffer_x;
4522   __Pyx_LocalBuf_ND __pyx_pybuffernd_y;
4523   __Pyx_Buffer __pyx_pybuffer_y;
4524   __Pyx_LocalBuf_ND __pyx_pybuffernd_y_fit;
4525   __Pyx_Buffer __pyx_pybuffer_y_fit;
4526   __Pyx_RefNannyDeclarations
4527   int __pyx_t_1;
4528   Py_ssize_t __pyx_t_2;
4529   Py_ssize_t __pyx_t_3;
4530   Py_ssize_t __pyx_t_4;
4531   Py_ssize_t __pyx_t_5;
4532   Py_ssize_t __pyx_t_6;
4533   int __pyx_lineno = 0;
4534   const char *__pyx_filename = NULL;
4535   int __pyx_clineno = 0;
4536   __Pyx_RefNannySetupContext("calculate_y_fit", 0);
4537   if (__pyx_optional_args) {
4538     if (__pyx_optional_args->__pyx_n > 0) {
4539       __pyx_v_fill_with_nans = __pyx_optional_args->fill_with_nans;
4540     }
4541   }
4542   __pyx_pybuffer_x.pybuffer.buf = NULL;
4543   __pyx_pybuffer_x.refcount = 0;
4544   __pyx_pybuffernd_x.data = NULL;
4545   __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
4546   __pyx_pybuffer_y.pybuffer.buf = NULL;
4547   __pyx_pybuffer_y.refcount = 0;
4548   __pyx_pybuffernd_y.data = NULL;
4549   __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y;
4550   __pyx_pybuffer_y_fit.pybuffer.buf = NULL;
4551   __pyx_pybuffer_y_fit.refcount = 0;
4552   __pyx_pybuffernd_y_fit.data = NULL;
4553   __pyx_pybuffernd_y_fit.rcbuffer = &__pyx_pybuffer_y_fit;
4554   __pyx_pybuffer_weights.pybuffer.buf = NULL;
4555   __pyx_pybuffer_weights.refcount = 0;
4556   __pyx_pybuffernd_weights.data = NULL;
4557   __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights;
4558   {
4559     __Pyx_BufFmt_StackElem __pyx_stack[1];
4560     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 360, __pyx_L1_error)
4561   }
4562   __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0];
4563   {
4564     __Pyx_BufFmt_StackElem __pyx_stack[1];
4565     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 360, __pyx_L1_error)
4566   }
4567   __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0];
4568   {
4569     __Pyx_BufFmt_StackElem __pyx_stack[1];
4570     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y_fit.rcbuffer->pybuffer, (PyObject*)__pyx_v_y_fit, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 360, __pyx_L1_error)
4571   }
4572   __pyx_pybuffernd_y_fit.diminfo[0].strides = __pyx_pybuffernd_y_fit.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y_fit.diminfo[0].shape = __pyx_pybuffernd_y_fit.rcbuffer->pybuffer.shape[0];
4573   {
4574     __Pyx_BufFmt_StackElem __pyx_stack[1];
4575     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 360, __pyx_L1_error)
4576   }
4577   __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0];
4578 
4579   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":416
4580  *
4581  *     cdef:
4582  *        double sum_weighted_x = 0, weighted_sqdev_x = 0, p_i_j             # <<<<<<<<<<<<<<
4583  *
4584  *     if not reg_ok:
4585  */
4586   __pyx_v_sum_weighted_x = 0.0;
4587   __pyx_v_weighted_sqdev_x = 0.0;
4588 
4589   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":418
4590  *        double sum_weighted_x = 0, weighted_sqdev_x = 0, p_i_j
4591  *
4592  *     if not reg_ok:             # <<<<<<<<<<<<<<
4593  *         if fill_with_nans:
4594  *             # Fill a bad regression (weights all zeros) with nans
4595  */
4596   __pyx_t_1 = ((!(__pyx_v_reg_ok != 0)) != 0);
4597   if (__pyx_t_1) {
4598 
4599     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":419
4600  *
4601  *     if not reg_ok:
4602  *         if fill_with_nans:             # <<<<<<<<<<<<<<
4603  *             # Fill a bad regression (weights all zeros) with nans
4604  *             y_fit[i] = NAN
4605  */
4606     __pyx_t_1 = (__pyx_v_fill_with_nans != 0);
4607     if (__pyx_t_1) {
4608 
4609       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":421
4610  *         if fill_with_nans:
4611  *             # Fill a bad regression (weights all zeros) with nans
4612  *             y_fit[i] = NAN             # <<<<<<<<<<<<<<
4613  *         else:
4614  *             # Fill a bad regression with the original value
4615  */
4616       __pyx_t_2 = __pyx_v_i;
4617       *__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_y_fit.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_y_fit.diminfo[0].strides) = NAN;
4618 
4619       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":419
4620  *
4621  *     if not reg_ok:
4622  *         if fill_with_nans:             # <<<<<<<<<<<<<<
4623  *             # Fill a bad regression (weights all zeros) with nans
4624  *             y_fit[i] = NAN
4625  */
4626       goto __pyx_L4;
4627     }
4628 
4629     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":425
4630  *             # Fill a bad regression with the original value
4631  *             # only possible when not using xvals distinct from x
4632  *             y_fit[i] = y[i]             # <<<<<<<<<<<<<<
4633  *     else:
4634  *         for j in range(left_end, right_end):
4635  */
4636     /*else*/ {
4637       __pyx_t_2 = __pyx_v_i;
4638       __pyx_t_3 = __pyx_v_i;
4639       *__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_y_fit.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_y_fit.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_y.diminfo[0].strides));
4640     }
4641     __pyx_L4:;
4642 
4643     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":418
4644  *        double sum_weighted_x = 0, weighted_sqdev_x = 0, p_i_j
4645  *
4646  *     if not reg_ok:             # <<<<<<<<<<<<<<
4647  *         if fill_with_nans:
4648  *             # Fill a bad regression (weights all zeros) with nans
4649  */
4650     goto __pyx_L3;
4651   }
4652 
4653   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":427
4654  *             y_fit[i] = y[i]
4655  *     else:
4656  *         for j in range(left_end, right_end):             # <<<<<<<<<<<<<<
4657  *             sum_weighted_x += weights[j] * x[j]
4658  *         for j in range(left_end, right_end):
4659  */
4660   /*else*/ {
4661     __pyx_t_4 = __pyx_v_right_end;
4662     __pyx_t_5 = __pyx_t_4;
4663     for (__pyx_t_6 = __pyx_v_left_end; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4664       __pyx_v_j = __pyx_t_6;
4665 
4666       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":428
4667  *     else:
4668  *         for j in range(left_end, right_end):
4669  *             sum_weighted_x += weights[j] * x[j]             # <<<<<<<<<<<<<<
4670  *         for j in range(left_end, right_end):
4671  *             weighted_sqdev_x += weights[j] * (x[j] - sum_weighted_x) ** 2
4672  */
4673       __pyx_t_2 = __pyx_v_j;
4674       __pyx_t_3 = __pyx_v_j;
4675       __pyx_v_sum_weighted_x = (__pyx_v_sum_weighted_x + ((*__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_weights.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_x.diminfo[0].strides))));
4676     }
4677 
4678     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":429
4679  *         for j in range(left_end, right_end):
4680  *             sum_weighted_x += weights[j] * x[j]
4681  *         for j in range(left_end, right_end):             # <<<<<<<<<<<<<<
4682  *             weighted_sqdev_x += weights[j] * (x[j] - sum_weighted_x) ** 2
4683  *         # force this to always be a positive value
4684  */
4685     __pyx_t_4 = __pyx_v_right_end;
4686     __pyx_t_5 = __pyx_t_4;
4687     for (__pyx_t_6 = __pyx_v_left_end; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4688       __pyx_v_j = __pyx_t_6;
4689 
4690       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":430
4691  *             sum_weighted_x += weights[j] * x[j]
4692  *         for j in range(left_end, right_end):
4693  *             weighted_sqdev_x += weights[j] * (x[j] - sum_weighted_x) ** 2             # <<<<<<<<<<<<<<
4694  *         # force this to always be a positive value
4695  *         weighted_sqdev_x = fmax(weighted_sqdev_x, 1e-12)
4696  */
4697       __pyx_t_3 = __pyx_v_j;
4698       __pyx_t_2 = __pyx_v_j;
4699       __pyx_v_weighted_sqdev_x = (__pyx_v_weighted_sqdev_x + ((*__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_weights.diminfo[0].strides)) * pow(((*__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_x.diminfo[0].strides)) - __pyx_v_sum_weighted_x), 2.0)));
4700     }
4701 
4702     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":432
4703  *             weighted_sqdev_x += weights[j] * (x[j] - sum_weighted_x) ** 2
4704  *         # force this to always be a positive value
4705  *         weighted_sqdev_x = fmax(weighted_sqdev_x, 1e-12)             # <<<<<<<<<<<<<<
4706  *         for j in range(left_end, right_end):
4707  *             p_i_j = weights[j] * (1.0 + (xval - sum_weighted_x) *
4708  */
4709     __pyx_v_weighted_sqdev_x = fmax(__pyx_v_weighted_sqdev_x, 1e-12);
4710 
4711     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":433
4712  *         # force this to always be a positive value
4713  *         weighted_sqdev_x = fmax(weighted_sqdev_x, 1e-12)
4714  *         for j in range(left_end, right_end):             # <<<<<<<<<<<<<<
4715  *             p_i_j = weights[j] * (1.0 + (xval - sum_weighted_x) *
4716  *                              (x[j] - sum_weighted_x) / weighted_sqdev_x)
4717  */
4718     __pyx_t_4 = __pyx_v_right_end;
4719     __pyx_t_5 = __pyx_t_4;
4720     for (__pyx_t_6 = __pyx_v_left_end; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4721       __pyx_v_j = __pyx_t_6;
4722 
4723       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":434
4724  *         weighted_sqdev_x = fmax(weighted_sqdev_x, 1e-12)
4725  *         for j in range(left_end, right_end):
4726  *             p_i_j = weights[j] * (1.0 + (xval - sum_weighted_x) *             # <<<<<<<<<<<<<<
4727  *                              (x[j] - sum_weighted_x) / weighted_sqdev_x)
4728  *             y_fit[i] += p_i_j * y[j]
4729  */
4730       __pyx_t_2 = __pyx_v_j;
4731 
4732       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":435
4733  *         for j in range(left_end, right_end):
4734  *             p_i_j = weights[j] * (1.0 + (xval - sum_weighted_x) *
4735  *                              (x[j] - sum_weighted_x) / weighted_sqdev_x)             # <<<<<<<<<<<<<<
4736  *             y_fit[i] += p_i_j * y[j]
4737  *
4738  */
4739       __pyx_t_3 = __pyx_v_j;
4740 
4741       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":434
4742  *         weighted_sqdev_x = fmax(weighted_sqdev_x, 1e-12)
4743  *         for j in range(left_end, right_end):
4744  *             p_i_j = weights[j] * (1.0 + (xval - sum_weighted_x) *             # <<<<<<<<<<<<<<
4745  *                              (x[j] - sum_weighted_x) / weighted_sqdev_x)
4746  *             y_fit[i] += p_i_j * y[j]
4747  */
4748       __pyx_v_p_i_j = ((*__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_weights.diminfo[0].strides)) * (1.0 + (((__pyx_v_xval - __pyx_v_sum_weighted_x) * ((*__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_x.diminfo[0].strides)) - __pyx_v_sum_weighted_x)) / ((__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t)__pyx_v_weighted_sqdev_x))));
4749 
4750       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":436
4751  *             p_i_j = weights[j] * (1.0 + (xval - sum_weighted_x) *
4752  *                              (x[j] - sum_weighted_x) / weighted_sqdev_x)
4753  *             y_fit[i] += p_i_j * y[j]             # <<<<<<<<<<<<<<
4754  *
4755  * cdef void interpolate_skipped_fits(double[::1] xvals,
4756  */
4757       __pyx_t_3 = __pyx_v_j;
4758       __pyx_t_2 = __pyx_v_i;
4759       *__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_y_fit.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_y_fit.diminfo[0].strides) += (__pyx_v_p_i_j * (*__Pyx_BufPtrStrided1d(__pyx_t_11statsmodels_13nonparametric_17_smoothers_lowess_DTYPE_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_y.diminfo[0].strides)));
4760     }
4761   }
4762   __pyx_L3:;
4763 
4764   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":360
4765  *
4766  *
4767  * cdef void calculate_y_fit(np.ndarray[DTYPE_t, ndim = 1] x,             # <<<<<<<<<<<<<<
4768  *                           np.ndarray[DTYPE_t, ndim = 1] y,
4769  *                           Py_ssize_t i,
4770  */
4771 
4772   /* function exit code */
4773   goto __pyx_L0;
4774   __pyx_L1_error:;
4775   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4776     __Pyx_PyThreadState_declare
4777     __Pyx_PyThreadState_assign
4778     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4779     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer);
4780     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
4781     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
4782     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_fit.rcbuffer->pybuffer);
4783   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4784   __Pyx_WriteUnraisable("statsmodels.nonparametric._smoothers_lowess.calculate_y_fit", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4785   goto __pyx_L2;
4786   __pyx_L0:;
4787   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer);
4788   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
4789   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
4790   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_fit.rcbuffer->pybuffer);
4791   __pyx_L2:;
4792   __Pyx_RefNannyFinishContext();
4793 }
4794 
4795 /* "statsmodels/nonparametric/_smoothers_lowess.pyx":438
4796  *             y_fit[i] += p_i_j * y[j]
4797  *
4798  * cdef void interpolate_skipped_fits(double[::1] xvals,             # <<<<<<<<<<<<<<
4799  *                                    double[::1] y_fit,
4800  *                                    Py_ssize_t i,
4801  */
4802 
__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_interpolate_skipped_fits(__Pyx_memviewslice __pyx_v_xvals,__Pyx_memviewslice __pyx_v_y_fit,Py_ssize_t __pyx_v_i,Py_ssize_t __pyx_v_last_fit_i)4803 static void __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_interpolate_skipped_fits(__Pyx_memviewslice __pyx_v_xvals, __Pyx_memviewslice __pyx_v_y_fit, Py_ssize_t __pyx_v_i, Py_ssize_t __pyx_v_last_fit_i) {
4804   Py_ssize_t __pyx_v_j;
4805   Py_ssize_t __pyx_v_offset;
4806   Py_ssize_t __pyx_v_n;
4807   double __pyx_v_denom;
4808   double __pyx_v_a;
4809   __Pyx_RefNannyDeclarations
4810   Py_ssize_t __pyx_t_1;
4811   Py_ssize_t __pyx_t_2;
4812   Py_ssize_t __pyx_t_3;
4813   Py_ssize_t __pyx_t_4;
4814   Py_ssize_t __pyx_t_5;
4815   Py_ssize_t __pyx_t_6;
4816   __Pyx_RefNannySetupContext("interpolate_skipped_fits", 0);
4817 
4818   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":468
4819  *         double[::1] a_view
4820  *         Py_ssize_t j
4821  *         Py_ssize_t offset = last_fit_i + 1             # <<<<<<<<<<<<<<
4822  *         Py_ssize_t n = i - offset
4823  *         double denom, a
4824  */
4825   __pyx_v_offset = (__pyx_v_last_fit_i + 1);
4826 
4827   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":469
4828  *         Py_ssize_t j
4829  *         Py_ssize_t offset = last_fit_i + 1
4830  *         Py_ssize_t n = i - offset             # <<<<<<<<<<<<<<
4831  *         double denom, a
4832  *
4833  */
4834   __pyx_v_n = (__pyx_v_i - __pyx_v_offset);
4835 
4836   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":472
4837  *         double denom, a
4838  *
4839  *     denom = xvals[i] - xvals[last_fit_i]             # <<<<<<<<<<<<<<
4840  *     for j in range(n):
4841  *         a = (xvals[offset + j] - xvals[last_fit_i]) / denom
4842  */
4843   __pyx_t_1 = __pyx_v_i;
4844   __pyx_t_2 = __pyx_v_last_fit_i;
4845   __pyx_v_denom = ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_xvals.data) + __pyx_t_1)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_xvals.data) + __pyx_t_2)) ))));
4846 
4847   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":473
4848  *
4849  *     denom = xvals[i] - xvals[last_fit_i]
4850  *     for j in range(n):             # <<<<<<<<<<<<<<
4851  *         a = (xvals[offset + j] - xvals[last_fit_i]) / denom
4852  *         y_fit[offset+j] = a * y_fit[i] + (1.0 - a) * y_fit[last_fit_i]
4853  */
4854   __pyx_t_3 = __pyx_v_n;
4855   __pyx_t_4 = __pyx_t_3;
4856   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
4857     __pyx_v_j = __pyx_t_5;
4858 
4859     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":474
4860  *     denom = xvals[i] - xvals[last_fit_i]
4861  *     for j in range(n):
4862  *         a = (xvals[offset + j] - xvals[last_fit_i]) / denom             # <<<<<<<<<<<<<<
4863  *         y_fit[offset+j] = a * y_fit[i] + (1.0 - a) * y_fit[last_fit_i]
4864  *
4865  */
4866     __pyx_t_2 = (__pyx_v_offset + __pyx_v_j);
4867     __pyx_t_1 = __pyx_v_last_fit_i;
4868     __pyx_v_a = (((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_xvals.data) + __pyx_t_2)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_xvals.data) + __pyx_t_1)) )))) / __pyx_v_denom);
4869 
4870     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":475
4871  *     for j in range(n):
4872  *         a = (xvals[offset + j] - xvals[last_fit_i]) / denom
4873  *         y_fit[offset+j] = a * y_fit[i] + (1.0 - a) * y_fit[last_fit_i]             # <<<<<<<<<<<<<<
4874  *
4875  *
4876  */
4877     __pyx_t_1 = __pyx_v_i;
4878     __pyx_t_2 = __pyx_v_last_fit_i;
4879     __pyx_t_6 = (__pyx_v_offset + __pyx_v_j);
4880     *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_y_fit.data) + __pyx_t_6)) )) = ((__pyx_v_a * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_y_fit.data) + __pyx_t_1)) )))) + ((1.0 - __pyx_v_a) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_y_fit.data) + __pyx_t_2)) )))));
4881   }
4882 
4883   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":438
4884  *             y_fit[i] += p_i_j * y[j]
4885  *
4886  * cdef void interpolate_skipped_fits(double[::1] xvals,             # <<<<<<<<<<<<<<
4887  *                                    double[::1] y_fit,
4888  *                                    Py_ssize_t i,
4889  */
4890 
4891   /* function exit code */
4892   __Pyx_RefNannyFinishContext();
4893 }
4894 
4895 /* "statsmodels/nonparametric/_smoothers_lowess.pyx":478
4896  *
4897  *
4898  * cpdef update_indices(double[::1] xvals,             # <<<<<<<<<<<<<<
4899  *                      double[::1] y_fit,
4900  *                      double delta,
4901  */
4902 
4903 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_5update_indices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_update_indices(__Pyx_memviewslice __pyx_v_xvals,__Pyx_memviewslice __pyx_v_y_fit,double __pyx_v_delta,Py_ssize_t __pyx_v_i,Py_ssize_t __pyx_v_out_n,Py_ssize_t __pyx_v_last_fit_i,CYTHON_UNUSED int __pyx_skip_dispatch)4904 static PyObject *__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_update_indices(__Pyx_memviewslice __pyx_v_xvals, __Pyx_memviewslice __pyx_v_y_fit, double __pyx_v_delta, Py_ssize_t __pyx_v_i, Py_ssize_t __pyx_v_out_n, Py_ssize_t __pyx_v_last_fit_i, CYTHON_UNUSED int __pyx_skip_dispatch) {
4905   Py_ssize_t __pyx_v_k;
4906   double __pyx_v_cutpoint;
4907   PyObject *__pyx_r = NULL;
4908   __Pyx_RefNannyDeclarations
4909   Py_ssize_t __pyx_t_1;
4910   Py_ssize_t __pyx_t_2;
4911   Py_ssize_t __pyx_t_3;
4912   Py_ssize_t __pyx_t_4;
4913   int __pyx_t_5;
4914   Py_ssize_t __pyx_t_6;
4915   PyObject *__pyx_t_7 = NULL;
4916   PyObject *__pyx_t_8 = NULL;
4917   PyObject *__pyx_t_9 = NULL;
4918   int __pyx_lineno = 0;
4919   const char *__pyx_filename = NULL;
4920   int __pyx_clineno = 0;
4921   __Pyx_RefNannySetupContext("update_indices", 0);
4922 
4923   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":520
4924  *         double cutpoint
4925  *
4926  *     last_fit_i = i             # <<<<<<<<<<<<<<
4927  *     k = last_fit_i
4928  *     # For most points within delta of the current point, we skip the
4929  */
4930   __pyx_v_last_fit_i = __pyx_v_i;
4931 
4932   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":521
4933  *
4934  *     last_fit_i = i
4935  *     k = last_fit_i             # <<<<<<<<<<<<<<
4936  *     # For most points within delta of the current point, we skip the
4937  *     # weighted linear regression (which save much computation of
4938  */
4939   __pyx_v_k = __pyx_v_last_fit_i;
4940 
4941   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":530
4942  *     # This loop increments until we fall just outside of delta distance,
4943  *     # copying the results for any repeated x's along the way.
4944  *     cutpoint = xvals[last_fit_i] + delta             # <<<<<<<<<<<<<<
4945  *     for k in range(last_fit_i + 1, out_n):
4946  *         if xvals[k] > cutpoint:
4947  */
4948   __pyx_t_1 = __pyx_v_last_fit_i;
4949   __pyx_v_cutpoint = ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_xvals.data) + __pyx_t_1)) ))) + __pyx_v_delta);
4950 
4951   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":531
4952  *     # copying the results for any repeated x's along the way.
4953  *     cutpoint = xvals[last_fit_i] + delta
4954  *     for k in range(last_fit_i + 1, out_n):             # <<<<<<<<<<<<<<
4955  *         if xvals[k] > cutpoint:
4956  *             break
4957  */
4958   __pyx_t_2 = __pyx_v_out_n;
4959   __pyx_t_3 = __pyx_t_2;
4960   for (__pyx_t_4 = (__pyx_v_last_fit_i + 1); __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
4961     __pyx_v_k = __pyx_t_4;
4962 
4963     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":532
4964  *     cutpoint = xvals[last_fit_i] + delta
4965  *     for k in range(last_fit_i + 1, out_n):
4966  *         if xvals[k] > cutpoint:             # <<<<<<<<<<<<<<
4967  *             break
4968  *         if xvals[k] == xvals[last_fit_i]:
4969  */
4970     __pyx_t_1 = __pyx_v_k;
4971     __pyx_t_5 = (((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_xvals.data) + __pyx_t_1)) ))) > __pyx_v_cutpoint) != 0);
4972     if (__pyx_t_5) {
4973 
4974       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":533
4975  *     for k in range(last_fit_i + 1, out_n):
4976  *         if xvals[k] > cutpoint:
4977  *             break             # <<<<<<<<<<<<<<
4978  *         if xvals[k] == xvals[last_fit_i]:
4979  *             # if tied with previous x-value, just use the already
4980  */
4981       goto __pyx_L4_break;
4982 
4983       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":532
4984  *     cutpoint = xvals[last_fit_i] + delta
4985  *     for k in range(last_fit_i + 1, out_n):
4986  *         if xvals[k] > cutpoint:             # <<<<<<<<<<<<<<
4987  *             break
4988  *         if xvals[k] == xvals[last_fit_i]:
4989  */
4990     }
4991 
4992     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":534
4993  *         if xvals[k] > cutpoint:
4994  *             break
4995  *         if xvals[k] == xvals[last_fit_i]:             # <<<<<<<<<<<<<<
4996  *             # if tied with previous x-value, just use the already
4997  *             # fitted y, and update the last-fit counter.
4998  */
4999     __pyx_t_1 = __pyx_v_k;
5000     __pyx_t_6 = __pyx_v_last_fit_i;
5001     __pyx_t_5 = (((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_xvals.data) + __pyx_t_1)) ))) == (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_xvals.data) + __pyx_t_6)) )))) != 0);
5002     if (__pyx_t_5) {
5003 
5004       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":537
5005  *             # if tied with previous x-value, just use the already
5006  *             # fitted y, and update the last-fit counter.
5007  *             y_fit[k] = y_fit[last_fit_i]             # <<<<<<<<<<<<<<
5008  *             last_fit_i = k
5009  *
5010  */
5011       __pyx_t_6 = __pyx_v_last_fit_i;
5012       __pyx_t_1 = __pyx_v_k;
5013       *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_y_fit.data) + __pyx_t_1)) )) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_y_fit.data) + __pyx_t_6)) )));
5014 
5015       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":538
5016  *             # fitted y, and update the last-fit counter.
5017  *             y_fit[k] = y_fit[last_fit_i]
5018  *             last_fit_i = k             # <<<<<<<<<<<<<<
5019  *
5020  *     # i, which indicates the next point to fit the regression at, is
5021  */
5022       __pyx_v_last_fit_i = __pyx_v_k;
5023 
5024       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":534
5025  *         if xvals[k] > cutpoint:
5026  *             break
5027  *         if xvals[k] == xvals[last_fit_i]:             # <<<<<<<<<<<<<<
5028  *             # if tied with previous x-value, just use the already
5029  *             # fitted y, and update the last-fit counter.
5030  */
5031     }
5032   }
5033   __pyx_L4_break:;
5034 
5035   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":544
5036  *     # of delta) or is just incremented + 1 if k = i+1. This insures we
5037  *     # always step forward.
5038  *     i = max(k-1, last_fit_i + 1)             # <<<<<<<<<<<<<<
5039  *
5040  *     return i, last_fit_i
5041  */
5042   __pyx_t_2 = (__pyx_v_last_fit_i + 1);
5043   __pyx_t_3 = (__pyx_v_k - 1);
5044   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
5045     __pyx_t_4 = __pyx_t_2;
5046   } else {
5047     __pyx_t_4 = __pyx_t_3;
5048   }
5049   __pyx_v_i = __pyx_t_4;
5050 
5051   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":546
5052  *     i = max(k-1, last_fit_i + 1)
5053  *
5054  *     return i, last_fit_i             # <<<<<<<<<<<<<<
5055  *
5056  *
5057  */
5058   __Pyx_XDECREF(__pyx_r);
5059   __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 546, __pyx_L1_error)
5060   __Pyx_GOTREF(__pyx_t_7);
5061   __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_last_fit_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 546, __pyx_L1_error)
5062   __Pyx_GOTREF(__pyx_t_8);
5063   __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 546, __pyx_L1_error)
5064   __Pyx_GOTREF(__pyx_t_9);
5065   __Pyx_GIVEREF(__pyx_t_7);
5066   PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
5067   __Pyx_GIVEREF(__pyx_t_8);
5068   PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
5069   __pyx_t_7 = 0;
5070   __pyx_t_8 = 0;
5071   __pyx_r = __pyx_t_9;
5072   __pyx_t_9 = 0;
5073   goto __pyx_L0;
5074 
5075   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":478
5076  *
5077  *
5078  * cpdef update_indices(double[::1] xvals,             # <<<<<<<<<<<<<<
5079  *                      double[::1] y_fit,
5080  *                      double delta,
5081  */
5082 
5083   /* function exit code */
5084   __pyx_L1_error:;
5085   __Pyx_XDECREF(__pyx_t_7);
5086   __Pyx_XDECREF(__pyx_t_8);
5087   __Pyx_XDECREF(__pyx_t_9);
5088   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.update_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
5089   __pyx_r = 0;
5090   __pyx_L0:;
5091   __Pyx_XGIVEREF(__pyx_r);
5092   __Pyx_RefNannyFinishContext();
5093   return __pyx_r;
5094 }
5095 
5096 /* Python wrapper */
5097 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_5update_indices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5098 static char __pyx_doc_11statsmodels_13nonparametric_17_smoothers_lowess_4update_indices[] = "\n    Update the counters of the local regression.\n\n    Parameters\n    ----------\n    xvals : 1-D numpy array\n        The vector of x-values where regression is performed.\n    y_fit : 1-D numpy array\n        The vector of fitted y-values\n    delta : float\n        Indicates the range of x values within which linear\n        interpolation should be used to estimate y_fit instead\n        of weighted regression.\n    i : indexing integer\n        The index of the current point being fit.\n    out_n : indexing integer\n        The length of the input vector xvals.\n    last_fit_i : indexing integer\n        The last point at which y_fit was calculated.\n\n    Returns\n    -------\n    i : indexing integer\n        The next point at which to run a weighted regression.\n    last_fit_i : indexing integer\n        The updated last point at which y_fit was calculated\n\n    Notes\n    -----\n    The relationship between the outputs is s.t. xvals[i+1] >\n    xvals[last_fit_i] + delta.\n    ";
__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_5update_indices(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5099 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_5update_indices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5100   __Pyx_memviewslice __pyx_v_xvals = { 0, 0, { 0 }, { 0 }, { 0 } };
5101   __Pyx_memviewslice __pyx_v_y_fit = { 0, 0, { 0 }, { 0 }, { 0 } };
5102   double __pyx_v_delta;
5103   Py_ssize_t __pyx_v_i;
5104   Py_ssize_t __pyx_v_out_n;
5105   Py_ssize_t __pyx_v_last_fit_i;
5106   int __pyx_lineno = 0;
5107   const char *__pyx_filename = NULL;
5108   int __pyx_clineno = 0;
5109   PyObject *__pyx_r = 0;
5110   __Pyx_RefNannyDeclarations
5111   __Pyx_RefNannySetupContext("update_indices (wrapper)", 0);
5112   {
5113     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xvals,&__pyx_n_s_y_fit,&__pyx_n_s_delta,&__pyx_n_s_i,&__pyx_n_s_out_n,&__pyx_n_s_last_fit_i,0};
5114     PyObject* values[6] = {0,0,0,0,0,0};
5115     if (unlikely(__pyx_kwds)) {
5116       Py_ssize_t kw_args;
5117       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5118       switch (pos_args) {
5119         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5120         CYTHON_FALLTHROUGH;
5121         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5122         CYTHON_FALLTHROUGH;
5123         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5124         CYTHON_FALLTHROUGH;
5125         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5126         CYTHON_FALLTHROUGH;
5127         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5128         CYTHON_FALLTHROUGH;
5129         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5130         CYTHON_FALLTHROUGH;
5131         case  0: break;
5132         default: goto __pyx_L5_argtuple_error;
5133       }
5134       kw_args = PyDict_Size(__pyx_kwds);
5135       switch (pos_args) {
5136         case  0:
5137         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xvals)) != 0)) kw_args--;
5138         else goto __pyx_L5_argtuple_error;
5139         CYTHON_FALLTHROUGH;
5140         case  1:
5141         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y_fit)) != 0)) kw_args--;
5142         else {
5143           __Pyx_RaiseArgtupleInvalid("update_indices", 1, 6, 6, 1); __PYX_ERR(0, 478, __pyx_L3_error)
5144         }
5145         CYTHON_FALLTHROUGH;
5146         case  2:
5147         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta)) != 0)) kw_args--;
5148         else {
5149           __Pyx_RaiseArgtupleInvalid("update_indices", 1, 6, 6, 2); __PYX_ERR(0, 478, __pyx_L3_error)
5150         }
5151         CYTHON_FALLTHROUGH;
5152         case  3:
5153         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
5154         else {
5155           __Pyx_RaiseArgtupleInvalid("update_indices", 1, 6, 6, 3); __PYX_ERR(0, 478, __pyx_L3_error)
5156         }
5157         CYTHON_FALLTHROUGH;
5158         case  4:
5159         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out_n)) != 0)) kw_args--;
5160         else {
5161           __Pyx_RaiseArgtupleInvalid("update_indices", 1, 6, 6, 4); __PYX_ERR(0, 478, __pyx_L3_error)
5162         }
5163         CYTHON_FALLTHROUGH;
5164         case  5:
5165         if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_last_fit_i)) != 0)) kw_args--;
5166         else {
5167           __Pyx_RaiseArgtupleInvalid("update_indices", 1, 6, 6, 5); __PYX_ERR(0, 478, __pyx_L3_error)
5168         }
5169       }
5170       if (unlikely(kw_args > 0)) {
5171         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_indices") < 0)) __PYX_ERR(0, 478, __pyx_L3_error)
5172       }
5173     } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
5174       goto __pyx_L5_argtuple_error;
5175     } else {
5176       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5177       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5178       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5179       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5180       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5181       values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5182     }
5183     __pyx_v_xvals = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_xvals.memview)) __PYX_ERR(0, 478, __pyx_L3_error)
5184     __pyx_v_y_fit = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y_fit.memview)) __PYX_ERR(0, 479, __pyx_L3_error)
5185     __pyx_v_delta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_delta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 480, __pyx_L3_error)
5186     __pyx_v_i = __Pyx_PyIndex_AsSsize_t(values[3]); if (unlikely((__pyx_v_i == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 481, __pyx_L3_error)
5187     __pyx_v_out_n = __Pyx_PyIndex_AsSsize_t(values[4]); if (unlikely((__pyx_v_out_n == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 482, __pyx_L3_error)
5188     __pyx_v_last_fit_i = __Pyx_PyIndex_AsSsize_t(values[5]); if (unlikely((__pyx_v_last_fit_i == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L3_error)
5189   }
5190   goto __pyx_L4_argument_unpacking_done;
5191   __pyx_L5_argtuple_error:;
5192   __Pyx_RaiseArgtupleInvalid("update_indices", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 478, __pyx_L3_error)
5193   __pyx_L3_error:;
5194   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.update_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
5195   __Pyx_RefNannyFinishContext();
5196   return NULL;
5197   __pyx_L4_argument_unpacking_done:;
5198   __pyx_r = __pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_4update_indices(__pyx_self, __pyx_v_xvals, __pyx_v_y_fit, __pyx_v_delta, __pyx_v_i, __pyx_v_out_n, __pyx_v_last_fit_i);
5199 
5200   /* function exit code */
5201   __Pyx_RefNannyFinishContext();
5202   return __pyx_r;
5203 }
5204 
__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_4update_indices(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_xvals,__Pyx_memviewslice __pyx_v_y_fit,double __pyx_v_delta,Py_ssize_t __pyx_v_i,Py_ssize_t __pyx_v_out_n,Py_ssize_t __pyx_v_last_fit_i)5205 static PyObject *__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_4update_indices(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xvals, __Pyx_memviewslice __pyx_v_y_fit, double __pyx_v_delta, Py_ssize_t __pyx_v_i, Py_ssize_t __pyx_v_out_n, Py_ssize_t __pyx_v_last_fit_i) {
5206   PyObject *__pyx_r = NULL;
5207   __Pyx_RefNannyDeclarations
5208   PyObject *__pyx_t_1 = NULL;
5209   int __pyx_lineno = 0;
5210   const char *__pyx_filename = NULL;
5211   int __pyx_clineno = 0;
5212   __Pyx_RefNannySetupContext("update_indices", 0);
5213   __Pyx_XDECREF(__pyx_r);
5214   if (unlikely(!__pyx_v_xvals.memview)) { __Pyx_RaiseUnboundLocalError("xvals"); __PYX_ERR(0, 478, __pyx_L1_error) }
5215   if (unlikely(!__pyx_v_y_fit.memview)) { __Pyx_RaiseUnboundLocalError("y_fit"); __PYX_ERR(0, 478, __pyx_L1_error) }
5216   __pyx_t_1 = __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_update_indices(__pyx_v_xvals, __pyx_v_y_fit, __pyx_v_delta, __pyx_v_i, __pyx_v_out_n, __pyx_v_last_fit_i, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error)
5217   __Pyx_GOTREF(__pyx_t_1);
5218   __pyx_r = __pyx_t_1;
5219   __pyx_t_1 = 0;
5220   goto __pyx_L0;
5221 
5222   /* function exit code */
5223   __pyx_L1_error:;
5224   __Pyx_XDECREF(__pyx_t_1);
5225   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.update_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
5226   __pyx_r = NULL;
5227   __pyx_L0:;
5228   __PYX_XDEC_MEMVIEW(&__pyx_v_xvals, 1);
5229   __PYX_XDEC_MEMVIEW(&__pyx_v_y_fit, 1);
5230   __Pyx_XGIVEREF(__pyx_r);
5231   __Pyx_RefNannyFinishContext();
5232   return __pyx_r;
5233 }
5234 
5235 /* "statsmodels/nonparametric/_smoothers_lowess.pyx":549
5236  *
5237  *
5238  * cpdef np.ndarray calculate_residual_weights(double[::1] y, double[::1] y_fit):             # <<<<<<<<<<<<<<
5239  *     """
5240  *     Calculate residual weights for the next `robustifying` iteration.
5241  */
5242 
5243 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_7calculate_residual_weights(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_residual_weights(__Pyx_memviewslice __pyx_v_y,__Pyx_memviewslice __pyx_v_y_fit,CYTHON_UNUSED int __pyx_skip_dispatch)5244 static PyArrayObject *__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_residual_weights(__Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_y_fit, CYTHON_UNUSED int __pyx_skip_dispatch) {
5245   Py_ssize_t __pyx_v_j;
5246   npy_intp __pyx_v_n;
5247   PyArrayObject *__pyx_v_std_resid = 0;
5248   double __pyx_v_median;
5249   double __pyx_v_scale;
5250   double *__pyx_v_std_resid_data;
5251   PyArrayObject *__pyx_r = NULL;
5252   __Pyx_RefNannyDeclarations
5253   PyObject *__pyx_t_1 = NULL;
5254   PyObject *__pyx_t_2 = NULL;
5255   npy_intp __pyx_t_3;
5256   PyObject *__pyx_t_4 = NULL;
5257   PyObject *__pyx_t_5 = NULL;
5258   npy_intp __pyx_t_6;
5259   Py_ssize_t __pyx_t_7;
5260   Py_ssize_t __pyx_t_8;
5261   Py_ssize_t __pyx_t_9;
5262   double __pyx_t_10;
5263   int __pyx_t_11;
5264   Py_ssize_t __pyx_t_12;
5265   __Pyx_memviewslice __pyx_t_13 = { 0, 0, { 0 }, { 0 }, { 0 } };
5266   int __pyx_lineno = 0;
5267   const char *__pyx_filename = NULL;
5268   int __pyx_clineno = 0;
5269   __Pyx_RefNannySetupContext("calculate_residual_weights", 0);
5270 
5271   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":569
5272  *     cdef:
5273  *         Py_ssize_t j
5274  *         np.npy_intp n = y.size             # <<<<<<<<<<<<<<
5275  *         np.ndarray std_resid = np.empty(n)
5276  *         double median, scale
5277  */
5278   __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_y, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error)
5279   __Pyx_GOTREF(__pyx_t_1);
5280   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 569, __pyx_L1_error)
5281   __Pyx_GOTREF(__pyx_t_2);
5282   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5283   __pyx_t_3 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 569, __pyx_L1_error)
5284   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5285   __pyx_v_n = __pyx_t_3;
5286 
5287   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":570
5288  *         Py_ssize_t j
5289  *         np.npy_intp n = y.size
5290  *         np.ndarray std_resid = np.empty(n)             # <<<<<<<<<<<<<<
5291  *         double median, scale
5292  *         double* std_resid_data = <double *>np.PyArray_DATA(std_resid)
5293  */
5294   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error)
5295   __Pyx_GOTREF(__pyx_t_1);
5296   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 570, __pyx_L1_error)
5297   __Pyx_GOTREF(__pyx_t_4);
5298   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5299   __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error)
5300   __Pyx_GOTREF(__pyx_t_1);
5301   __pyx_t_5 = NULL;
5302   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
5303     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
5304     if (likely(__pyx_t_5)) {
5305       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5306       __Pyx_INCREF(__pyx_t_5);
5307       __Pyx_INCREF(function);
5308       __Pyx_DECREF_SET(__pyx_t_4, function);
5309     }
5310   }
5311   __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1);
5312   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5313   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5314   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L1_error)
5315   __Pyx_GOTREF(__pyx_t_2);
5316   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5317   if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 570, __pyx_L1_error)
5318   __pyx_v_std_resid = ((PyArrayObject *)__pyx_t_2);
5319   __pyx_t_2 = 0;
5320 
5321   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":572
5322  *         np.ndarray std_resid = np.empty(n)
5323  *         double median, scale
5324  *         double* std_resid_data = <double *>np.PyArray_DATA(std_resid)             # <<<<<<<<<<<<<<
5325  *
5326  *     for j in range(n):
5327  */
5328   __pyx_v_std_resid_data = ((double *)PyArray_DATA(__pyx_v_std_resid));
5329 
5330   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":574
5331  *         double* std_resid_data = <double *>np.PyArray_DATA(std_resid)
5332  *
5333  *     for j in range(n):             # <<<<<<<<<<<<<<
5334  *         std_resid_data[j] = fabs(y[j] - y_fit[j])
5335  *
5336  */
5337   __pyx_t_3 = __pyx_v_n;
5338   __pyx_t_6 = __pyx_t_3;
5339   for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
5340     __pyx_v_j = __pyx_t_7;
5341 
5342     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":575
5343  *
5344  *     for j in range(n):
5345  *         std_resid_data[j] = fabs(y[j] - y_fit[j])             # <<<<<<<<<<<<<<
5346  *
5347  *     median = <double>np.median(std_resid)
5348  */
5349     __pyx_t_8 = __pyx_v_j;
5350     __pyx_t_9 = __pyx_v_j;
5351     (__pyx_v_std_resid_data[__pyx_v_j]) = fabs(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_y.data) + __pyx_t_8)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_y_fit.data) + __pyx_t_9)) )))));
5352   }
5353 
5354   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":577
5355  *         std_resid_data[j] = fabs(y[j] - y_fit[j])
5356  *
5357  *     median = <double>np.median(std_resid)             # <<<<<<<<<<<<<<
5358  *     if median == 0:
5359  *         for j in range(n):
5360  */
5361   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 577, __pyx_L1_error)
5362   __Pyx_GOTREF(__pyx_t_4);
5363   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_median); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
5364   __Pyx_GOTREF(__pyx_t_1);
5365   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5366   __pyx_t_4 = NULL;
5367   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
5368     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
5369     if (likely(__pyx_t_4)) {
5370       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
5371       __Pyx_INCREF(__pyx_t_4);
5372       __Pyx_INCREF(function);
5373       __Pyx_DECREF_SET(__pyx_t_1, function);
5374     }
5375   }
5376   __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, ((PyObject *)__pyx_v_std_resid)) : __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)__pyx_v_std_resid));
5377   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5378   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error)
5379   __Pyx_GOTREF(__pyx_t_2);
5380   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5381   __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 577, __pyx_L1_error)
5382   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5383   __pyx_v_median = ((double)__pyx_t_10);
5384 
5385   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":578
5386  *
5387  *     median = <double>np.median(std_resid)
5388  *     if median == 0:             # <<<<<<<<<<<<<<
5389  *         for j in range(n):
5390  *             std_resid_data[j] = <double>(std_resid_data[j] > 0)
5391  */
5392   __pyx_t_11 = ((__pyx_v_median == 0.0) != 0);
5393   if (__pyx_t_11) {
5394 
5395     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":579
5396  *     median = <double>np.median(std_resid)
5397  *     if median == 0:
5398  *         for j in range(n):             # <<<<<<<<<<<<<<
5399  *             std_resid_data[j] = <double>(std_resid_data[j] > 0)
5400  *     else:
5401  */
5402     __pyx_t_3 = __pyx_v_n;
5403     __pyx_t_6 = __pyx_t_3;
5404     for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
5405       __pyx_v_j = __pyx_t_7;
5406 
5407       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":580
5408  *     if median == 0:
5409  *         for j in range(n):
5410  *             std_resid_data[j] = <double>(std_resid_data[j] > 0)             # <<<<<<<<<<<<<<
5411  *     else:
5412  *         scale = 6.0 * median
5413  */
5414       (__pyx_v_std_resid_data[__pyx_v_j]) = ((double)((__pyx_v_std_resid_data[__pyx_v_j]) > 0.0));
5415     }
5416 
5417     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":578
5418  *
5419  *     median = <double>np.median(std_resid)
5420  *     if median == 0:             # <<<<<<<<<<<<<<
5421  *         for j in range(n):
5422  *             std_resid_data[j] = <double>(std_resid_data[j] > 0)
5423  */
5424     goto __pyx_L5;
5425   }
5426 
5427   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":582
5428  *             std_resid_data[j] = <double>(std_resid_data[j] > 0)
5429  *     else:
5430  *         scale = 6.0 * median             # <<<<<<<<<<<<<<
5431  *         for j in range(n):
5432  *             std_resid_data[j] /= scale
5433  */
5434   /*else*/ {
5435     __pyx_v_scale = (6.0 * __pyx_v_median);
5436 
5437     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":583
5438  *     else:
5439  *         scale = 6.0 * median
5440  *         for j in range(n):             # <<<<<<<<<<<<<<
5441  *             std_resid_data[j] /= scale
5442  *
5443  */
5444     __pyx_t_3 = __pyx_v_n;
5445     __pyx_t_6 = __pyx_t_3;
5446     for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
5447       __pyx_v_j = __pyx_t_7;
5448 
5449       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":584
5450  *         scale = 6.0 * median
5451  *         for j in range(n):
5452  *             std_resid_data[j] /= scale             # <<<<<<<<<<<<<<
5453  *
5454  *     # Some trimming of outlier residuals.
5455  */
5456       __pyx_t_12 = __pyx_v_j;
5457       (__pyx_v_std_resid_data[__pyx_t_12]) = ((__pyx_v_std_resid_data[__pyx_t_12]) / __pyx_v_scale);
5458     }
5459   }
5460   __pyx_L5:;
5461 
5462   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":587
5463  *
5464  *     # Some trimming of outlier residuals.
5465  *     for j in range(n):             # <<<<<<<<<<<<<<
5466  *         if std_resid_data[j] > 1:
5467  *             std_resid_data[j] = 1.0
5468  */
5469   __pyx_t_3 = __pyx_v_n;
5470   __pyx_t_6 = __pyx_t_3;
5471   for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
5472     __pyx_v_j = __pyx_t_7;
5473 
5474     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":588
5475  *     # Some trimming of outlier residuals.
5476  *     for j in range(n):
5477  *         if std_resid_data[j] > 1:             # <<<<<<<<<<<<<<
5478  *             std_resid_data[j] = 1.0
5479  *     # std_resid[std_resid >= 0.999] = 1.0
5480  */
5481     __pyx_t_11 = (((__pyx_v_std_resid_data[__pyx_v_j]) > 1.0) != 0);
5482     if (__pyx_t_11) {
5483 
5484       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":589
5485  *     for j in range(n):
5486  *         if std_resid_data[j] > 1:
5487  *             std_resid_data[j] = 1.0             # <<<<<<<<<<<<<<
5488  *     # std_resid[std_resid >= 0.999] = 1.0
5489  *     # std_resid[std_resid <= 0.001] = 0.0
5490  */
5491       (__pyx_v_std_resid_data[__pyx_v_j]) = 1.0;
5492 
5493       /* "statsmodels/nonparametric/_smoothers_lowess.pyx":588
5494  *     # Some trimming of outlier residuals.
5495  *     for j in range(n):
5496  *         if std_resid_data[j] > 1:             # <<<<<<<<<<<<<<
5497  *             std_resid_data[j] = 1.0
5498  *     # std_resid[std_resid >= 0.999] = 1.0
5499  */
5500     }
5501   }
5502 
5503   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":593
5504  *     # std_resid[std_resid <= 0.001] = 0.0
5505  *
5506  *     return bisquare(std_resid)             # <<<<<<<<<<<<<<
5507  *
5508  *
5509  */
5510   __Pyx_XDECREF(((PyObject *)__pyx_r));
5511   __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(((PyObject *)__pyx_v_std_resid), PyBUF_WRITABLE); if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 593, __pyx_L1_error)
5512   __pyx_t_2 = ((PyObject *)__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_bisquare(__pyx_t_13, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error)
5513   __Pyx_GOTREF(__pyx_t_2);
5514   __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
5515   __pyx_t_13.memview = NULL;
5516   __pyx_t_13.data = NULL;
5517   __pyx_r = ((PyArrayObject *)__pyx_t_2);
5518   __pyx_t_2 = 0;
5519   goto __pyx_L0;
5520 
5521   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":549
5522  *
5523  *
5524  * cpdef np.ndarray calculate_residual_weights(double[::1] y, double[::1] y_fit):             # <<<<<<<<<<<<<<
5525  *     """
5526  *     Calculate residual weights for the next `robustifying` iteration.
5527  */
5528 
5529   /* function exit code */
5530   __pyx_L1_error:;
5531   __Pyx_XDECREF(__pyx_t_1);
5532   __Pyx_XDECREF(__pyx_t_2);
5533   __Pyx_XDECREF(__pyx_t_4);
5534   __Pyx_XDECREF(__pyx_t_5);
5535   __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
5536   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.calculate_residual_weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
5537   __pyx_r = 0;
5538   __pyx_L0:;
5539   __Pyx_XDECREF((PyObject *)__pyx_v_std_resid);
5540   __Pyx_XGIVEREF((PyObject *)__pyx_r);
5541   __Pyx_RefNannyFinishContext();
5542   return __pyx_r;
5543 }
5544 
5545 /* Python wrapper */
5546 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_7calculate_residual_weights(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5547 static char __pyx_doc_11statsmodels_13nonparametric_17_smoothers_lowess_6calculate_residual_weights[] = "\n    Calculate residual weights for the next `robustifying` iteration.\n\n    Parameters\n    ----------\n    y: 1-D numpy array\n        The vector of actual input y-values.\n    y_fit: 1-D numpy array\n        The vector of fitted y-values from the current\n        iteration.\n\n    Returns\n    -------\n    resid_weights: 1-D numpy array\n        The vector of residual weights, to be used in the\n        next iteration of regressions.\n    ";
__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_7calculate_residual_weights(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5548 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_7calculate_residual_weights(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5549   __Pyx_memviewslice __pyx_v_y = { 0, 0, { 0 }, { 0 }, { 0 } };
5550   __Pyx_memviewslice __pyx_v_y_fit = { 0, 0, { 0 }, { 0 }, { 0 } };
5551   int __pyx_lineno = 0;
5552   const char *__pyx_filename = NULL;
5553   int __pyx_clineno = 0;
5554   PyObject *__pyx_r = 0;
5555   __Pyx_RefNannyDeclarations
5556   __Pyx_RefNannySetupContext("calculate_residual_weights (wrapper)", 0);
5557   {
5558     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,&__pyx_n_s_y_fit,0};
5559     PyObject* values[2] = {0,0};
5560     if (unlikely(__pyx_kwds)) {
5561       Py_ssize_t kw_args;
5562       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5563       switch (pos_args) {
5564         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5565         CYTHON_FALLTHROUGH;
5566         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5567         CYTHON_FALLTHROUGH;
5568         case  0: break;
5569         default: goto __pyx_L5_argtuple_error;
5570       }
5571       kw_args = PyDict_Size(__pyx_kwds);
5572       switch (pos_args) {
5573         case  0:
5574         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
5575         else goto __pyx_L5_argtuple_error;
5576         CYTHON_FALLTHROUGH;
5577         case  1:
5578         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y_fit)) != 0)) kw_args--;
5579         else {
5580           __Pyx_RaiseArgtupleInvalid("calculate_residual_weights", 1, 2, 2, 1); __PYX_ERR(0, 549, __pyx_L3_error)
5581         }
5582       }
5583       if (unlikely(kw_args > 0)) {
5584         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculate_residual_weights") < 0)) __PYX_ERR(0, 549, __pyx_L3_error)
5585       }
5586     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5587       goto __pyx_L5_argtuple_error;
5588     } else {
5589       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5590       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5591     }
5592     __pyx_v_y = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y.memview)) __PYX_ERR(0, 549, __pyx_L3_error)
5593     __pyx_v_y_fit = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y_fit.memview)) __PYX_ERR(0, 549, __pyx_L3_error)
5594   }
5595   goto __pyx_L4_argument_unpacking_done;
5596   __pyx_L5_argtuple_error:;
5597   __Pyx_RaiseArgtupleInvalid("calculate_residual_weights", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 549, __pyx_L3_error)
5598   __pyx_L3_error:;
5599   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.calculate_residual_weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
5600   __Pyx_RefNannyFinishContext();
5601   return NULL;
5602   __pyx_L4_argument_unpacking_done:;
5603   __pyx_r = __pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_6calculate_residual_weights(__pyx_self, __pyx_v_y, __pyx_v_y_fit);
5604 
5605   /* function exit code */
5606   __Pyx_RefNannyFinishContext();
5607   return __pyx_r;
5608 }
5609 
__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_6calculate_residual_weights(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_y,__Pyx_memviewslice __pyx_v_y_fit)5610 static PyObject *__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_6calculate_residual_weights(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_y, __Pyx_memviewslice __pyx_v_y_fit) {
5611   PyObject *__pyx_r = NULL;
5612   __Pyx_RefNannyDeclarations
5613   PyObject *__pyx_t_1 = NULL;
5614   int __pyx_lineno = 0;
5615   const char *__pyx_filename = NULL;
5616   int __pyx_clineno = 0;
5617   __Pyx_RefNannySetupContext("calculate_residual_weights", 0);
5618   __Pyx_XDECREF(__pyx_r);
5619   if (unlikely(!__pyx_v_y.memview)) { __Pyx_RaiseUnboundLocalError("y"); __PYX_ERR(0, 549, __pyx_L1_error) }
5620   if (unlikely(!__pyx_v_y_fit.memview)) { __Pyx_RaiseUnboundLocalError("y_fit"); __PYX_ERR(0, 549, __pyx_L1_error) }
5621   __pyx_t_1 = ((PyObject *)__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_calculate_residual_weights(__pyx_v_y, __pyx_v_y_fit, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
5622   __Pyx_GOTREF(__pyx_t_1);
5623   __pyx_r = __pyx_t_1;
5624   __pyx_t_1 = 0;
5625   goto __pyx_L0;
5626 
5627   /* function exit code */
5628   __pyx_L1_error:;
5629   __Pyx_XDECREF(__pyx_t_1);
5630   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.calculate_residual_weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
5631   __pyx_r = NULL;
5632   __pyx_L0:;
5633   __PYX_XDEC_MEMVIEW(&__pyx_v_y, 1);
5634   __PYX_XDEC_MEMVIEW(&__pyx_v_y_fit, 1);
5635   __Pyx_XGIVEREF(__pyx_r);
5636   __Pyx_RefNannyFinishContext();
5637   return __pyx_r;
5638 }
5639 
5640 /* "statsmodels/nonparametric/_smoothers_lowess.pyx":596
5641  *
5642  *
5643  * cdef void tricube(double[::1] x):             # <<<<<<<<<<<<<<
5644  *     """
5645  *     The tri-cubic function (1 - x**3)**3. Used to weight neighboring
5646  */
5647 
__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_tricube(__Pyx_memviewslice __pyx_v_x)5648 static void __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_tricube(__Pyx_memviewslice __pyx_v_x) {
5649   npy_intp __pyx_v_n;
5650   Py_ssize_t __pyx_v_j;
5651   __Pyx_RefNannyDeclarations
5652   PyObject *__pyx_t_1 = NULL;
5653   PyObject *__pyx_t_2 = NULL;
5654   npy_intp __pyx_t_3;
5655   npy_intp __pyx_t_4;
5656   Py_ssize_t __pyx_t_5;
5657   Py_ssize_t __pyx_t_6;
5658   Py_ssize_t __pyx_t_7;
5659   int __pyx_lineno = 0;
5660   const char *__pyx_filename = NULL;
5661   int __pyx_clineno = 0;
5662   __Pyx_RefNannySetupContext("tricube", 0);
5663 
5664   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":615
5665  *     # operator.
5666  *     cdef:
5667  *         np.npy_intp n = x.size             # <<<<<<<<<<<<<<
5668  *         Py_ssize_t j
5669  *         double tmp
5670  */
5671   __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error)
5672   __Pyx_GOTREF(__pyx_t_1);
5673   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error)
5674   __Pyx_GOTREF(__pyx_t_2);
5675   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5676   __pyx_t_3 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 615, __pyx_L1_error)
5677   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5678   __pyx_v_n = __pyx_t_3;
5679 
5680   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":619
5681  *         double tmp
5682  *
5683  *     fast_array_cube(x)             # <<<<<<<<<<<<<<
5684  *     for j in range(n):
5685  *         x[j] = 1.0 - x[j]
5686  */
5687   __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_fast_array_cube(__pyx_v_x);
5688 
5689   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":620
5690  *
5691  *     fast_array_cube(x)
5692  *     for j in range(n):             # <<<<<<<<<<<<<<
5693  *         x[j] = 1.0 - x[j]
5694  *     fast_array_cube(x)
5695  */
5696   __pyx_t_3 = __pyx_v_n;
5697   __pyx_t_4 = __pyx_t_3;
5698   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
5699     __pyx_v_j = __pyx_t_5;
5700 
5701     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":621
5702  *     fast_array_cube(x)
5703  *     for j in range(n):
5704  *         x[j] = 1.0 - x[j]             # <<<<<<<<<<<<<<
5705  *     fast_array_cube(x)
5706  *
5707  */
5708     __pyx_t_6 = __pyx_v_j;
5709     __pyx_t_7 = __pyx_v_j;
5710     *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_7)) )) = (1.0 - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_6)) ))));
5711   }
5712 
5713   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":622
5714  *     for j in range(n):
5715  *         x[j] = 1.0 - x[j]
5716  *     fast_array_cube(x)             # <<<<<<<<<<<<<<
5717  *
5718  *
5719  */
5720   __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_fast_array_cube(__pyx_v_x);
5721 
5722   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":596
5723  *
5724  *
5725  * cdef void tricube(double[::1] x):             # <<<<<<<<<<<<<<
5726  *     """
5727  *     The tri-cubic function (1 - x**3)**3. Used to weight neighboring
5728  */
5729 
5730   /* function exit code */
5731   goto __pyx_L0;
5732   __pyx_L1_error:;
5733   __Pyx_XDECREF(__pyx_t_1);
5734   __Pyx_XDECREF(__pyx_t_2);
5735   __Pyx_WriteUnraisable("statsmodels.nonparametric._smoothers_lowess.tricube", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
5736   __pyx_L0:;
5737   __Pyx_RefNannyFinishContext();
5738 }
5739 
5740 /* "statsmodels/nonparametric/_smoothers_lowess.pyx":625
5741  *
5742  *
5743  * cdef void fast_array_cube(double[::1] x):             # <<<<<<<<<<<<<<
5744  *     """
5745  *     A fast, elementwise, in-place cube operator. Called by the
5746  */
5747 
__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_fast_array_cube(__Pyx_memviewslice __pyx_v_x)5748 static void __pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_fast_array_cube(__Pyx_memviewslice __pyx_v_x) {
5749   npy_intp __pyx_v_n;
5750   Py_ssize_t __pyx_v_j;
5751   double __pyx_v_tmp;
5752   __Pyx_RefNannyDeclarations
5753   PyObject *__pyx_t_1 = NULL;
5754   PyObject *__pyx_t_2 = NULL;
5755   npy_intp __pyx_t_3;
5756   npy_intp __pyx_t_4;
5757   Py_ssize_t __pyx_t_5;
5758   Py_ssize_t __pyx_t_6;
5759   int __pyx_lineno = 0;
5760   const char *__pyx_filename = NULL;
5761   int __pyx_clineno = 0;
5762   __Pyx_RefNannySetupContext("fast_array_cube", 0);
5763 
5764   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":639
5765  *     """
5766  *     cdef:
5767  *         np.npy_intp n = x.size             # <<<<<<<<<<<<<<
5768  *         Py_ssize_t j
5769  *         double tmp
5770  */
5771   __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error)
5772   __Pyx_GOTREF(__pyx_t_1);
5773   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L1_error)
5774   __Pyx_GOTREF(__pyx_t_2);
5775   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5776   __pyx_t_3 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 639, __pyx_L1_error)
5777   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5778   __pyx_v_n = __pyx_t_3;
5779 
5780   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":643
5781  *         double tmp
5782  *
5783  *     for j in range(n):             # <<<<<<<<<<<<<<
5784  *         tmp = x[j]
5785  *         x[j] = tmp * tmp * tmp
5786  */
5787   __pyx_t_3 = __pyx_v_n;
5788   __pyx_t_4 = __pyx_t_3;
5789   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
5790     __pyx_v_j = __pyx_t_5;
5791 
5792     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":644
5793  *
5794  *     for j in range(n):
5795  *         tmp = x[j]             # <<<<<<<<<<<<<<
5796  *         x[j] = tmp * tmp * tmp
5797  *
5798  */
5799     __pyx_t_6 = __pyx_v_j;
5800     __pyx_v_tmp = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_6)) )));
5801 
5802     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":645
5803  *     for j in range(n):
5804  *         tmp = x[j]
5805  *         x[j] = tmp * tmp * tmp             # <<<<<<<<<<<<<<
5806  *
5807  *
5808  */
5809     __pyx_t_6 = __pyx_v_j;
5810     *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_6)) )) = ((__pyx_v_tmp * __pyx_v_tmp) * __pyx_v_tmp);
5811   }
5812 
5813   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":625
5814  *
5815  *
5816  * cdef void fast_array_cube(double[::1] x):             # <<<<<<<<<<<<<<
5817  *     """
5818  *     A fast, elementwise, in-place cube operator. Called by the
5819  */
5820 
5821   /* function exit code */
5822   goto __pyx_L0;
5823   __pyx_L1_error:;
5824   __Pyx_XDECREF(__pyx_t_1);
5825   __Pyx_XDECREF(__pyx_t_2);
5826   __Pyx_WriteUnraisable("statsmodels.nonparametric._smoothers_lowess.fast_array_cube", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
5827   __pyx_L0:;
5828   __Pyx_RefNannyFinishContext();
5829 }
5830 
5831 /* "statsmodels/nonparametric/_smoothers_lowess.pyx":648
5832  *
5833  *
5834  * cpdef np.ndarray bisquare(double[::1] x):             # <<<<<<<<<<<<<<
5835  *     """
5836  *     The bi-square function (1 - x**2)**2.
5837  */
5838 
5839 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_9bisquare(PyObject *__pyx_self, PyObject *__pyx_arg_x); /*proto*/
__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_bisquare(__Pyx_memviewslice __pyx_v_x,CYTHON_UNUSED int __pyx_skip_dispatch)5840 static PyArrayObject *__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_bisquare(__Pyx_memviewslice __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
5841   npy_intp __pyx_v_n;
5842   PyArrayObject *__pyx_v_out = 0;
5843   double *__pyx_v_out_data;
5844   Py_ssize_t __pyx_v_j;
5845   double __pyx_v_tmp;
5846   PyArrayObject *__pyx_r = NULL;
5847   __Pyx_RefNannyDeclarations
5848   PyObject *__pyx_t_1 = NULL;
5849   PyObject *__pyx_t_2 = NULL;
5850   npy_intp __pyx_t_3;
5851   PyObject *__pyx_t_4 = NULL;
5852   PyObject *__pyx_t_5 = NULL;
5853   npy_intp __pyx_t_6;
5854   Py_ssize_t __pyx_t_7;
5855   Py_ssize_t __pyx_t_8;
5856   Py_ssize_t __pyx_t_9;
5857   int __pyx_lineno = 0;
5858   const char *__pyx_filename = NULL;
5859   int __pyx_clineno = 0;
5860   __Pyx_RefNannySetupContext("bisquare", 0);
5861 
5862   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":668
5863  *
5864  *
5865  *         np.npy_intp n = x.size             # <<<<<<<<<<<<<<
5866  *         np.ndarray out = <np.ndarray>np.empty(n)
5867  *         double* out_data = <double *>np.PyArray_DATA(out)
5868  */
5869   __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error)
5870   __Pyx_GOTREF(__pyx_t_1);
5871   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 668, __pyx_L1_error)
5872   __Pyx_GOTREF(__pyx_t_2);
5873   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5874   __pyx_t_3 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 668, __pyx_L1_error)
5875   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5876   __pyx_v_n = __pyx_t_3;
5877 
5878   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":669
5879  *
5880  *         np.npy_intp n = x.size
5881  *         np.ndarray out = <np.ndarray>np.empty(n)             # <<<<<<<<<<<<<<
5882  *         double* out_data = <double *>np.PyArray_DATA(out)
5883  *         Py_ssize_t j
5884  */
5885   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 669, __pyx_L1_error)
5886   __Pyx_GOTREF(__pyx_t_1);
5887   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error)
5888   __Pyx_GOTREF(__pyx_t_4);
5889   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5890   __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 669, __pyx_L1_error)
5891   __Pyx_GOTREF(__pyx_t_1);
5892   __pyx_t_5 = NULL;
5893   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
5894     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
5895     if (likely(__pyx_t_5)) {
5896       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5897       __Pyx_INCREF(__pyx_t_5);
5898       __Pyx_INCREF(function);
5899       __Pyx_DECREF_SET(__pyx_t_4, function);
5900     }
5901   }
5902   __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1);
5903   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5904   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5905   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error)
5906   __Pyx_GOTREF(__pyx_t_2);
5907   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5908   __pyx_t_4 = __pyx_t_2;
5909   __Pyx_INCREF(__pyx_t_4);
5910   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5911   __pyx_v_out = ((PyArrayObject *)__pyx_t_4);
5912   __pyx_t_4 = 0;
5913 
5914   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":670
5915  *         np.npy_intp n = x.size
5916  *         np.ndarray out = <np.ndarray>np.empty(n)
5917  *         double* out_data = <double *>np.PyArray_DATA(out)             # <<<<<<<<<<<<<<
5918  *         Py_ssize_t j
5919  *         double tmp
5920  */
5921   __pyx_v_out_data = ((double *)PyArray_DATA(__pyx_v_out));
5922 
5923   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":674
5924  *         double tmp
5925  *
5926  *     for j in range(n):             # <<<<<<<<<<<<<<
5927  *         tmp = 1.0 - x[j] * x[j]
5928  *         out_data[j] = tmp * tmp
5929  */
5930   __pyx_t_3 = __pyx_v_n;
5931   __pyx_t_6 = __pyx_t_3;
5932   for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
5933     __pyx_v_j = __pyx_t_7;
5934 
5935     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":675
5936  *
5937  *     for j in range(n):
5938  *         tmp = 1.0 - x[j] * x[j]             # <<<<<<<<<<<<<<
5939  *         out_data[j] = tmp * tmp
5940  *
5941  */
5942     __pyx_t_8 = __pyx_v_j;
5943     __pyx_t_9 = __pyx_v_j;
5944     __pyx_v_tmp = (1.0 - ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_8)) ))) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_x.data) + __pyx_t_9)) )))));
5945 
5946     /* "statsmodels/nonparametric/_smoothers_lowess.pyx":676
5947  *     for j in range(n):
5948  *         tmp = 1.0 - x[j] * x[j]
5949  *         out_data[j] = tmp * tmp             # <<<<<<<<<<<<<<
5950  *
5951  *     return out
5952  */
5953     (__pyx_v_out_data[__pyx_v_j]) = (__pyx_v_tmp * __pyx_v_tmp);
5954   }
5955 
5956   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":678
5957  *         out_data[j] = tmp * tmp
5958  *
5959  *     return out             # <<<<<<<<<<<<<<
5960  */
5961   __Pyx_XDECREF(((PyObject *)__pyx_r));
5962   __Pyx_INCREF(((PyObject *)__pyx_v_out));
5963   __pyx_r = __pyx_v_out;
5964   goto __pyx_L0;
5965 
5966   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":648
5967  *
5968  *
5969  * cpdef np.ndarray bisquare(double[::1] x):             # <<<<<<<<<<<<<<
5970  *     """
5971  *     The bi-square function (1 - x**2)**2.
5972  */
5973 
5974   /* function exit code */
5975   __pyx_L1_error:;
5976   __Pyx_XDECREF(__pyx_t_1);
5977   __Pyx_XDECREF(__pyx_t_2);
5978   __Pyx_XDECREF(__pyx_t_4);
5979   __Pyx_XDECREF(__pyx_t_5);
5980   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.bisquare", __pyx_clineno, __pyx_lineno, __pyx_filename);
5981   __pyx_r = 0;
5982   __pyx_L0:;
5983   __Pyx_XDECREF((PyObject *)__pyx_v_out);
5984   __Pyx_XGIVEREF((PyObject *)__pyx_r);
5985   __Pyx_RefNannyFinishContext();
5986   return __pyx_r;
5987 }
5988 
5989 /* Python wrapper */
5990 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_9bisquare(PyObject *__pyx_self, PyObject *__pyx_arg_x); /*proto*/
5991 static char __pyx_doc_11statsmodels_13nonparametric_17_smoothers_lowess_8bisquare[] = "\n    The bi-square function (1 - x**2)**2.\n\n    Used to weight the residuals in the `robustifying`\n    iterations. Called by the calculate_residual_weights function.\n\n    Parameters\n    ----------\n    x: 1-D numpy array\n        A vector of absolute regression residuals, in units of\n        6 times the median absolute residual.\n\n    Returns\n    -------\n    A 1-D numpy array of residual weights.\n    ";
__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_9bisquare(PyObject * __pyx_self,PyObject * __pyx_arg_x)5992 static PyObject *__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_9bisquare(PyObject *__pyx_self, PyObject *__pyx_arg_x) {
5993   __Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } };
5994   int __pyx_lineno = 0;
5995   const char *__pyx_filename = NULL;
5996   int __pyx_clineno = 0;
5997   PyObject *__pyx_r = 0;
5998   __Pyx_RefNannyDeclarations
5999   __Pyx_RefNannySetupContext("bisquare (wrapper)", 0);
6000   assert(__pyx_arg_x); {
6001     __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_arg_x, PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 648, __pyx_L3_error)
6002   }
6003   goto __pyx_L4_argument_unpacking_done;
6004   __pyx_L3_error:;
6005   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.bisquare", __pyx_clineno, __pyx_lineno, __pyx_filename);
6006   __Pyx_RefNannyFinishContext();
6007   return NULL;
6008   __pyx_L4_argument_unpacking_done:;
6009   __pyx_r = __pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_8bisquare(__pyx_self, __pyx_v_x);
6010 
6011   /* function exit code */
6012   __Pyx_RefNannyFinishContext();
6013   return __pyx_r;
6014 }
6015 
__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_8bisquare(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_x)6016 static PyObject *__pyx_pf_11statsmodels_13nonparametric_17_smoothers_lowess_8bisquare(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_x) {
6017   PyObject *__pyx_r = NULL;
6018   __Pyx_RefNannyDeclarations
6019   PyObject *__pyx_t_1 = NULL;
6020   int __pyx_lineno = 0;
6021   const char *__pyx_filename = NULL;
6022   int __pyx_clineno = 0;
6023   __Pyx_RefNannySetupContext("bisquare", 0);
6024   __Pyx_XDECREF(__pyx_r);
6025   if (unlikely(!__pyx_v_x.memview)) { __Pyx_RaiseUnboundLocalError("x"); __PYX_ERR(0, 648, __pyx_L1_error) }
6026   __pyx_t_1 = ((PyObject *)__pyx_f_11statsmodels_13nonparametric_17_smoothers_lowess_bisquare(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error)
6027   __Pyx_GOTREF(__pyx_t_1);
6028   __pyx_r = __pyx_t_1;
6029   __pyx_t_1 = 0;
6030   goto __pyx_L0;
6031 
6032   /* function exit code */
6033   __pyx_L1_error:;
6034   __Pyx_XDECREF(__pyx_t_1);
6035   __Pyx_AddTraceback("statsmodels.nonparametric._smoothers_lowess.bisquare", __pyx_clineno, __pyx_lineno, __pyx_filename);
6036   __pyx_r = NULL;
6037   __pyx_L0:;
6038   __PYX_XDEC_MEMVIEW(&__pyx_v_x, 1);
6039   __Pyx_XGIVEREF(__pyx_r);
6040   __Pyx_RefNannyFinishContext();
6041   return __pyx_r;
6042 }
6043 
6044 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":735
6045  * ctypedef npy_cdouble     complex_t
6046  *
6047  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
6048  *     return PyArray_MultiIterNew(1, <void*>a)
6049  *
6050  */
6051 
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)6052 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
6053   PyObject *__pyx_r = NULL;
6054   __Pyx_RefNannyDeclarations
6055   PyObject *__pyx_t_1 = NULL;
6056   int __pyx_lineno = 0;
6057   const char *__pyx_filename = NULL;
6058   int __pyx_clineno = 0;
6059   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
6060 
6061   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":736
6062  *
6063  * cdef inline object PyArray_MultiIterNew1(a):
6064  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
6065  *
6066  * cdef inline object PyArray_MultiIterNew2(a, b):
6067  */
6068   __Pyx_XDECREF(__pyx_r);
6069   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
6070   __Pyx_GOTREF(__pyx_t_1);
6071   __pyx_r = __pyx_t_1;
6072   __pyx_t_1 = 0;
6073   goto __pyx_L0;
6074 
6075   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":735
6076  * ctypedef npy_cdouble     complex_t
6077  *
6078  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
6079  *     return PyArray_MultiIterNew(1, <void*>a)
6080  *
6081  */
6082 
6083   /* function exit code */
6084   __pyx_L1_error:;
6085   __Pyx_XDECREF(__pyx_t_1);
6086   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
6087   __pyx_r = 0;
6088   __pyx_L0:;
6089   __Pyx_XGIVEREF(__pyx_r);
6090   __Pyx_RefNannyFinishContext();
6091   return __pyx_r;
6092 }
6093 
6094 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":738
6095  *     return PyArray_MultiIterNew(1, <void*>a)
6096  *
6097  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
6098  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6099  *
6100  */
6101 
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)6102 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
6103   PyObject *__pyx_r = NULL;
6104   __Pyx_RefNannyDeclarations
6105   PyObject *__pyx_t_1 = NULL;
6106   int __pyx_lineno = 0;
6107   const char *__pyx_filename = NULL;
6108   int __pyx_clineno = 0;
6109   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
6110 
6111   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":739
6112  *
6113  * cdef inline object PyArray_MultiIterNew2(a, b):
6114  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
6115  *
6116  * cdef inline object PyArray_MultiIterNew3(a, b, c):
6117  */
6118   __Pyx_XDECREF(__pyx_r);
6119   __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
6120   __Pyx_GOTREF(__pyx_t_1);
6121   __pyx_r = __pyx_t_1;
6122   __pyx_t_1 = 0;
6123   goto __pyx_L0;
6124 
6125   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":738
6126  *     return PyArray_MultiIterNew(1, <void*>a)
6127  *
6128  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
6129  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6130  *
6131  */
6132 
6133   /* function exit code */
6134   __pyx_L1_error:;
6135   __Pyx_XDECREF(__pyx_t_1);
6136   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
6137   __pyx_r = 0;
6138   __pyx_L0:;
6139   __Pyx_XGIVEREF(__pyx_r);
6140   __Pyx_RefNannyFinishContext();
6141   return __pyx_r;
6142 }
6143 
6144 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":741
6145  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6146  *
6147  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
6148  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6149  *
6150  */
6151 
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)6152 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
6153   PyObject *__pyx_r = NULL;
6154   __Pyx_RefNannyDeclarations
6155   PyObject *__pyx_t_1 = NULL;
6156   int __pyx_lineno = 0;
6157   const char *__pyx_filename = NULL;
6158   int __pyx_clineno = 0;
6159   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
6160 
6161   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":742
6162  *
6163  * cdef inline object PyArray_MultiIterNew3(a, b, c):
6164  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
6165  *
6166  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6167  */
6168   __Pyx_XDECREF(__pyx_r);
6169   __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 742, __pyx_L1_error)
6170   __Pyx_GOTREF(__pyx_t_1);
6171   __pyx_r = __pyx_t_1;
6172   __pyx_t_1 = 0;
6173   goto __pyx_L0;
6174 
6175   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":741
6176  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6177  *
6178  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
6179  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6180  *
6181  */
6182 
6183   /* function exit code */
6184   __pyx_L1_error:;
6185   __Pyx_XDECREF(__pyx_t_1);
6186   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
6187   __pyx_r = 0;
6188   __pyx_L0:;
6189   __Pyx_XGIVEREF(__pyx_r);
6190   __Pyx_RefNannyFinishContext();
6191   return __pyx_r;
6192 }
6193 
6194 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":744
6195  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6196  *
6197  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
6198  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6199  *
6200  */
6201 
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)6202 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) {
6203   PyObject *__pyx_r = NULL;
6204   __Pyx_RefNannyDeclarations
6205   PyObject *__pyx_t_1 = NULL;
6206   int __pyx_lineno = 0;
6207   const char *__pyx_filename = NULL;
6208   int __pyx_clineno = 0;
6209   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
6210 
6211   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":745
6212  *
6213  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6214  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
6215  *
6216  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6217  */
6218   __Pyx_XDECREF(__pyx_r);
6219   __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 745, __pyx_L1_error)
6220   __Pyx_GOTREF(__pyx_t_1);
6221   __pyx_r = __pyx_t_1;
6222   __pyx_t_1 = 0;
6223   goto __pyx_L0;
6224 
6225   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":744
6226  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6227  *
6228  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
6229  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6230  *
6231  */
6232 
6233   /* function exit code */
6234   __pyx_L1_error:;
6235   __Pyx_XDECREF(__pyx_t_1);
6236   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
6237   __pyx_r = 0;
6238   __pyx_L0:;
6239   __Pyx_XGIVEREF(__pyx_r);
6240   __Pyx_RefNannyFinishContext();
6241   return __pyx_r;
6242 }
6243 
6244 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":747
6245  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6246  *
6247  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
6248  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6249  *
6250  */
6251 
__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)6252 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) {
6253   PyObject *__pyx_r = NULL;
6254   __Pyx_RefNannyDeclarations
6255   PyObject *__pyx_t_1 = NULL;
6256   int __pyx_lineno = 0;
6257   const char *__pyx_filename = NULL;
6258   int __pyx_clineno = 0;
6259   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
6260 
6261   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":748
6262  *
6263  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6264  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
6265  *
6266  * cdef inline tuple PyDataType_SHAPE(dtype d):
6267  */
6268   __Pyx_XDECREF(__pyx_r);
6269   __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 748, __pyx_L1_error)
6270   __Pyx_GOTREF(__pyx_t_1);
6271   __pyx_r = __pyx_t_1;
6272   __pyx_t_1 = 0;
6273   goto __pyx_L0;
6274 
6275   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":747
6276  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6277  *
6278  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
6279  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6280  *
6281  */
6282 
6283   /* function exit code */
6284   __pyx_L1_error:;
6285   __Pyx_XDECREF(__pyx_t_1);
6286   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
6287   __pyx_r = 0;
6288   __pyx_L0:;
6289   __Pyx_XGIVEREF(__pyx_r);
6290   __Pyx_RefNannyFinishContext();
6291   return __pyx_r;
6292 }
6293 
6294 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":750
6295  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6296  *
6297  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
6298  *     if PyDataType_HASSUBARRAY(d):
6299  *         return <tuple>d.subarray.shape
6300  */
6301 
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)6302 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
6303   PyObject *__pyx_r = NULL;
6304   __Pyx_RefNannyDeclarations
6305   int __pyx_t_1;
6306   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
6307 
6308   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":751
6309  *
6310  * cdef inline tuple PyDataType_SHAPE(dtype d):
6311  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
6312  *         return <tuple>d.subarray.shape
6313  *     else:
6314  */
6315   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
6316   if (__pyx_t_1) {
6317 
6318     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":752
6319  * cdef inline tuple PyDataType_SHAPE(dtype d):
6320  *     if PyDataType_HASSUBARRAY(d):
6321  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
6322  *     else:
6323  *         return ()
6324  */
6325     __Pyx_XDECREF(__pyx_r);
6326     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
6327     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
6328     goto __pyx_L0;
6329 
6330     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":751
6331  *
6332  * cdef inline tuple PyDataType_SHAPE(dtype d):
6333  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
6334  *         return <tuple>d.subarray.shape
6335  *     else:
6336  */
6337   }
6338 
6339   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":754
6340  *         return <tuple>d.subarray.shape
6341  *     else:
6342  *         return ()             # <<<<<<<<<<<<<<
6343  *
6344  *
6345  */
6346   /*else*/ {
6347     __Pyx_XDECREF(__pyx_r);
6348     __Pyx_INCREF(__pyx_empty_tuple);
6349     __pyx_r = __pyx_empty_tuple;
6350     goto __pyx_L0;
6351   }
6352 
6353   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":750
6354  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6355  *
6356  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
6357  *     if PyDataType_HASSUBARRAY(d):
6358  *         return <tuple>d.subarray.shape
6359  */
6360 
6361   /* function exit code */
6362   __pyx_L0:;
6363   __Pyx_XGIVEREF(__pyx_r);
6364   __Pyx_RefNannyFinishContext();
6365   return __pyx_r;
6366 }
6367 
6368 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":929
6369  *     int _import_umath() except -1
6370  *
6371  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
6372  *     Py_INCREF(base) # important to do this before stealing the reference below!
6373  *     PyArray_SetBaseObject(arr, base)
6374  */
6375 
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)6376 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
6377   __Pyx_RefNannyDeclarations
6378   __Pyx_RefNannySetupContext("set_array_base", 0);
6379 
6380   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":930
6381  *
6382  * cdef inline void set_array_base(ndarray arr, object base):
6383  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
6384  *     PyArray_SetBaseObject(arr, base)
6385  *
6386  */
6387   Py_INCREF(__pyx_v_base);
6388 
6389   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":931
6390  * cdef inline void set_array_base(ndarray arr, object base):
6391  *     Py_INCREF(base) # important to do this before stealing the reference below!
6392  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
6393  *
6394  * cdef inline object get_array_base(ndarray arr):
6395  */
6396   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
6397 
6398   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":929
6399  *     int _import_umath() except -1
6400  *
6401  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
6402  *     Py_INCREF(base) # important to do this before stealing the reference below!
6403  *     PyArray_SetBaseObject(arr, base)
6404  */
6405 
6406   /* function exit code */
6407   __Pyx_RefNannyFinishContext();
6408 }
6409 
6410 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":933
6411  *     PyArray_SetBaseObject(arr, base)
6412  *
6413  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
6414  *     base = PyArray_BASE(arr)
6415  *     if base is NULL:
6416  */
6417 
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)6418 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
6419   PyObject *__pyx_v_base;
6420   PyObject *__pyx_r = NULL;
6421   __Pyx_RefNannyDeclarations
6422   int __pyx_t_1;
6423   __Pyx_RefNannySetupContext("get_array_base", 0);
6424 
6425   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":934
6426  *
6427  * cdef inline object get_array_base(ndarray arr):
6428  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
6429  *     if base is NULL:
6430  *         return None
6431  */
6432   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
6433 
6434   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":935
6435  * cdef inline object get_array_base(ndarray arr):
6436  *     base = PyArray_BASE(arr)
6437  *     if base is NULL:             # <<<<<<<<<<<<<<
6438  *         return None
6439  *     return <object>base
6440  */
6441   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
6442   if (__pyx_t_1) {
6443 
6444     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":936
6445  *     base = PyArray_BASE(arr)
6446  *     if base is NULL:
6447  *         return None             # <<<<<<<<<<<<<<
6448  *     return <object>base
6449  *
6450  */
6451     __Pyx_XDECREF(__pyx_r);
6452     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6453     goto __pyx_L0;
6454 
6455     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":935
6456  * cdef inline object get_array_base(ndarray arr):
6457  *     base = PyArray_BASE(arr)
6458  *     if base is NULL:             # <<<<<<<<<<<<<<
6459  *         return None
6460  *     return <object>base
6461  */
6462   }
6463 
6464   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":937
6465  *     if base is NULL:
6466  *         return None
6467  *     return <object>base             # <<<<<<<<<<<<<<
6468  *
6469  * # Versions of the import_* functions which are more suitable for
6470  */
6471   __Pyx_XDECREF(__pyx_r);
6472   __Pyx_INCREF(((PyObject *)__pyx_v_base));
6473   __pyx_r = ((PyObject *)__pyx_v_base);
6474   goto __pyx_L0;
6475 
6476   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":933
6477  *     PyArray_SetBaseObject(arr, base)
6478  *
6479  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
6480  *     base = PyArray_BASE(arr)
6481  *     if base is NULL:
6482  */
6483 
6484   /* function exit code */
6485   __pyx_L0:;
6486   __Pyx_XGIVEREF(__pyx_r);
6487   __Pyx_RefNannyFinishContext();
6488   return __pyx_r;
6489 }
6490 
6491 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":941
6492  * # Versions of the import_* functions which are more suitable for
6493  * # Cython code.
6494  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
6495  *     try:
6496  *         __pyx_import_array()
6497  */
6498 
__pyx_f_5numpy_import_array(void)6499 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
6500   int __pyx_r;
6501   __Pyx_RefNannyDeclarations
6502   PyObject *__pyx_t_1 = NULL;
6503   PyObject *__pyx_t_2 = NULL;
6504   PyObject *__pyx_t_3 = NULL;
6505   int __pyx_t_4;
6506   PyObject *__pyx_t_5 = NULL;
6507   PyObject *__pyx_t_6 = NULL;
6508   PyObject *__pyx_t_7 = NULL;
6509   PyObject *__pyx_t_8 = NULL;
6510   int __pyx_lineno = 0;
6511   const char *__pyx_filename = NULL;
6512   int __pyx_clineno = 0;
6513   __Pyx_RefNannySetupContext("import_array", 0);
6514 
6515   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":942
6516  * # Cython code.
6517  * cdef inline int import_array() except -1:
6518  *     try:             # <<<<<<<<<<<<<<
6519  *         __pyx_import_array()
6520  *     except Exception:
6521  */
6522   {
6523     __Pyx_PyThreadState_declare
6524     __Pyx_PyThreadState_assign
6525     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6526     __Pyx_XGOTREF(__pyx_t_1);
6527     __Pyx_XGOTREF(__pyx_t_2);
6528     __Pyx_XGOTREF(__pyx_t_3);
6529     /*try:*/ {
6530 
6531       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":943
6532  * cdef inline int import_array() except -1:
6533  *     try:
6534  *         __pyx_import_array()             # <<<<<<<<<<<<<<
6535  *     except Exception:
6536  *         raise ImportError("numpy.core.multiarray failed to import")
6537  */
6538       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
6539 
6540       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":942
6541  * # Cython code.
6542  * cdef inline int import_array() except -1:
6543  *     try:             # <<<<<<<<<<<<<<
6544  *         __pyx_import_array()
6545  *     except Exception:
6546  */
6547     }
6548     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6549     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6550     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6551     goto __pyx_L8_try_end;
6552     __pyx_L3_error:;
6553 
6554     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":944
6555  *     try:
6556  *         __pyx_import_array()
6557  *     except Exception:             # <<<<<<<<<<<<<<
6558  *         raise ImportError("numpy.core.multiarray failed to import")
6559  *
6560  */
6561     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6562     if (__pyx_t_4) {
6563       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
6564       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error)
6565       __Pyx_GOTREF(__pyx_t_5);
6566       __Pyx_GOTREF(__pyx_t_6);
6567       __Pyx_GOTREF(__pyx_t_7);
6568 
6569       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":945
6570  *         __pyx_import_array()
6571  *     except Exception:
6572  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
6573  *
6574  * cdef inline int import_umath() except -1:
6575  */
6576       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 945, __pyx_L5_except_error)
6577       __Pyx_GOTREF(__pyx_t_8);
6578       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6579       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6580       __PYX_ERR(1, 945, __pyx_L5_except_error)
6581     }
6582     goto __pyx_L5_except_error;
6583     __pyx_L5_except_error:;
6584 
6585     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":942
6586  * # Cython code.
6587  * cdef inline int import_array() except -1:
6588  *     try:             # <<<<<<<<<<<<<<
6589  *         __pyx_import_array()
6590  *     except Exception:
6591  */
6592     __Pyx_XGIVEREF(__pyx_t_1);
6593     __Pyx_XGIVEREF(__pyx_t_2);
6594     __Pyx_XGIVEREF(__pyx_t_3);
6595     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6596     goto __pyx_L1_error;
6597     __pyx_L8_try_end:;
6598   }
6599 
6600   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":941
6601  * # Versions of the import_* functions which are more suitable for
6602  * # Cython code.
6603  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
6604  *     try:
6605  *         __pyx_import_array()
6606  */
6607 
6608   /* function exit code */
6609   __pyx_r = 0;
6610   goto __pyx_L0;
6611   __pyx_L1_error:;
6612   __Pyx_XDECREF(__pyx_t_5);
6613   __Pyx_XDECREF(__pyx_t_6);
6614   __Pyx_XDECREF(__pyx_t_7);
6615   __Pyx_XDECREF(__pyx_t_8);
6616   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
6617   __pyx_r = -1;
6618   __pyx_L0:;
6619   __Pyx_RefNannyFinishContext();
6620   return __pyx_r;
6621 }
6622 
6623 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":947
6624  *         raise ImportError("numpy.core.multiarray failed to import")
6625  *
6626  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
6627  *     try:
6628  *         _import_umath()
6629  */
6630 
__pyx_f_5numpy_import_umath(void)6631 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
6632   int __pyx_r;
6633   __Pyx_RefNannyDeclarations
6634   PyObject *__pyx_t_1 = NULL;
6635   PyObject *__pyx_t_2 = NULL;
6636   PyObject *__pyx_t_3 = NULL;
6637   int __pyx_t_4;
6638   PyObject *__pyx_t_5 = NULL;
6639   PyObject *__pyx_t_6 = NULL;
6640   PyObject *__pyx_t_7 = NULL;
6641   PyObject *__pyx_t_8 = NULL;
6642   int __pyx_lineno = 0;
6643   const char *__pyx_filename = NULL;
6644   int __pyx_clineno = 0;
6645   __Pyx_RefNannySetupContext("import_umath", 0);
6646 
6647   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":948
6648  *
6649  * cdef inline int import_umath() except -1:
6650  *     try:             # <<<<<<<<<<<<<<
6651  *         _import_umath()
6652  *     except Exception:
6653  */
6654   {
6655     __Pyx_PyThreadState_declare
6656     __Pyx_PyThreadState_assign
6657     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6658     __Pyx_XGOTREF(__pyx_t_1);
6659     __Pyx_XGOTREF(__pyx_t_2);
6660     __Pyx_XGOTREF(__pyx_t_3);
6661     /*try:*/ {
6662 
6663       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":949
6664  * cdef inline int import_umath() except -1:
6665  *     try:
6666  *         _import_umath()             # <<<<<<<<<<<<<<
6667  *     except Exception:
6668  *         raise ImportError("numpy.core.umath failed to import")
6669  */
6670       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
6671 
6672       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":948
6673  *
6674  * cdef inline int import_umath() except -1:
6675  *     try:             # <<<<<<<<<<<<<<
6676  *         _import_umath()
6677  *     except Exception:
6678  */
6679     }
6680     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6681     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6682     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6683     goto __pyx_L8_try_end;
6684     __pyx_L3_error:;
6685 
6686     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":950
6687  *     try:
6688  *         _import_umath()
6689  *     except Exception:             # <<<<<<<<<<<<<<
6690  *         raise ImportError("numpy.core.umath failed to import")
6691  *
6692  */
6693     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6694     if (__pyx_t_4) {
6695       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
6696       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error)
6697       __Pyx_GOTREF(__pyx_t_5);
6698       __Pyx_GOTREF(__pyx_t_6);
6699       __Pyx_GOTREF(__pyx_t_7);
6700 
6701       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":951
6702  *         _import_umath()
6703  *     except Exception:
6704  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
6705  *
6706  * cdef inline int import_ufunc() except -1:
6707  */
6708       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 951, __pyx_L5_except_error)
6709       __Pyx_GOTREF(__pyx_t_8);
6710       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6711       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6712       __PYX_ERR(1, 951, __pyx_L5_except_error)
6713     }
6714     goto __pyx_L5_except_error;
6715     __pyx_L5_except_error:;
6716 
6717     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":948
6718  *
6719  * cdef inline int import_umath() except -1:
6720  *     try:             # <<<<<<<<<<<<<<
6721  *         _import_umath()
6722  *     except Exception:
6723  */
6724     __Pyx_XGIVEREF(__pyx_t_1);
6725     __Pyx_XGIVEREF(__pyx_t_2);
6726     __Pyx_XGIVEREF(__pyx_t_3);
6727     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6728     goto __pyx_L1_error;
6729     __pyx_L8_try_end:;
6730   }
6731 
6732   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":947
6733  *         raise ImportError("numpy.core.multiarray failed to import")
6734  *
6735  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
6736  *     try:
6737  *         _import_umath()
6738  */
6739 
6740   /* function exit code */
6741   __pyx_r = 0;
6742   goto __pyx_L0;
6743   __pyx_L1_error:;
6744   __Pyx_XDECREF(__pyx_t_5);
6745   __Pyx_XDECREF(__pyx_t_6);
6746   __Pyx_XDECREF(__pyx_t_7);
6747   __Pyx_XDECREF(__pyx_t_8);
6748   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
6749   __pyx_r = -1;
6750   __pyx_L0:;
6751   __Pyx_RefNannyFinishContext();
6752   return __pyx_r;
6753 }
6754 
6755 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":953
6756  *         raise ImportError("numpy.core.umath failed to import")
6757  *
6758  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
6759  *     try:
6760  *         _import_umath()
6761  */
6762 
__pyx_f_5numpy_import_ufunc(void)6763 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
6764   int __pyx_r;
6765   __Pyx_RefNannyDeclarations
6766   PyObject *__pyx_t_1 = NULL;
6767   PyObject *__pyx_t_2 = NULL;
6768   PyObject *__pyx_t_3 = NULL;
6769   int __pyx_t_4;
6770   PyObject *__pyx_t_5 = NULL;
6771   PyObject *__pyx_t_6 = NULL;
6772   PyObject *__pyx_t_7 = NULL;
6773   PyObject *__pyx_t_8 = NULL;
6774   int __pyx_lineno = 0;
6775   const char *__pyx_filename = NULL;
6776   int __pyx_clineno = 0;
6777   __Pyx_RefNannySetupContext("import_ufunc", 0);
6778 
6779   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":954
6780  *
6781  * cdef inline int import_ufunc() except -1:
6782  *     try:             # <<<<<<<<<<<<<<
6783  *         _import_umath()
6784  *     except Exception:
6785  */
6786   {
6787     __Pyx_PyThreadState_declare
6788     __Pyx_PyThreadState_assign
6789     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6790     __Pyx_XGOTREF(__pyx_t_1);
6791     __Pyx_XGOTREF(__pyx_t_2);
6792     __Pyx_XGOTREF(__pyx_t_3);
6793     /*try:*/ {
6794 
6795       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":955
6796  * cdef inline int import_ufunc() except -1:
6797  *     try:
6798  *         _import_umath()             # <<<<<<<<<<<<<<
6799  *     except Exception:
6800  *         raise ImportError("numpy.core.umath failed to import")
6801  */
6802       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
6803 
6804       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":954
6805  *
6806  * cdef inline int import_ufunc() except -1:
6807  *     try:             # <<<<<<<<<<<<<<
6808  *         _import_umath()
6809  *     except Exception:
6810  */
6811     }
6812     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6813     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6814     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6815     goto __pyx_L8_try_end;
6816     __pyx_L3_error:;
6817 
6818     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":956
6819  *     try:
6820  *         _import_umath()
6821  *     except Exception:             # <<<<<<<<<<<<<<
6822  *         raise ImportError("numpy.core.umath failed to import")
6823  *
6824  */
6825     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6826     if (__pyx_t_4) {
6827       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
6828       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error)
6829       __Pyx_GOTREF(__pyx_t_5);
6830       __Pyx_GOTREF(__pyx_t_6);
6831       __Pyx_GOTREF(__pyx_t_7);
6832 
6833       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":957
6834  *         _import_umath()
6835  *     except Exception:
6836  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
6837  *
6838  * cdef extern from *:
6839  */
6840       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 957, __pyx_L5_except_error)
6841       __Pyx_GOTREF(__pyx_t_8);
6842       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6843       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6844       __PYX_ERR(1, 957, __pyx_L5_except_error)
6845     }
6846     goto __pyx_L5_except_error;
6847     __pyx_L5_except_error:;
6848 
6849     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":954
6850  *
6851  * cdef inline int import_ufunc() except -1:
6852  *     try:             # <<<<<<<<<<<<<<
6853  *         _import_umath()
6854  *     except Exception:
6855  */
6856     __Pyx_XGIVEREF(__pyx_t_1);
6857     __Pyx_XGIVEREF(__pyx_t_2);
6858     __Pyx_XGIVEREF(__pyx_t_3);
6859     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6860     goto __pyx_L1_error;
6861     __pyx_L8_try_end:;
6862   }
6863 
6864   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":953
6865  *         raise ImportError("numpy.core.umath failed to import")
6866  *
6867  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
6868  *     try:
6869  *         _import_umath()
6870  */
6871 
6872   /* function exit code */
6873   __pyx_r = 0;
6874   goto __pyx_L0;
6875   __pyx_L1_error:;
6876   __Pyx_XDECREF(__pyx_t_5);
6877   __Pyx_XDECREF(__pyx_t_6);
6878   __Pyx_XDECREF(__pyx_t_7);
6879   __Pyx_XDECREF(__pyx_t_8);
6880   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
6881   __pyx_r = -1;
6882   __pyx_L0:;
6883   __Pyx_RefNannyFinishContext();
6884   return __pyx_r;
6885 }
6886 
6887 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":967
6888  *
6889  *
6890  * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
6891  *     """
6892  *     Cython equivalent of `isinstance(obj, np.timedelta64)`
6893  */
6894 
__pyx_f_5numpy_is_timedelta64_object(PyObject * __pyx_v_obj)6895 static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
6896   int __pyx_r;
6897   __Pyx_RefNannyDeclarations
6898   __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
6899 
6900   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":979
6901  *     bool
6902  *     """
6903  *     return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)             # <<<<<<<<<<<<<<
6904  *
6905  *
6906  */
6907   __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
6908   goto __pyx_L0;
6909 
6910   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":967
6911  *
6912  *
6913  * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
6914  *     """
6915  *     Cython equivalent of `isinstance(obj, np.timedelta64)`
6916  */
6917 
6918   /* function exit code */
6919   __pyx_L0:;
6920   __Pyx_RefNannyFinishContext();
6921   return __pyx_r;
6922 }
6923 
6924 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":982
6925  *
6926  *
6927  * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
6928  *     """
6929  *     Cython equivalent of `isinstance(obj, np.datetime64)`
6930  */
6931 
__pyx_f_5numpy_is_datetime64_object(PyObject * __pyx_v_obj)6932 static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
6933   int __pyx_r;
6934   __Pyx_RefNannyDeclarations
6935   __Pyx_RefNannySetupContext("is_datetime64_object", 0);
6936 
6937   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":994
6938  *     bool
6939  *     """
6940  *     return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)             # <<<<<<<<<<<<<<
6941  *
6942  *
6943  */
6944   __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
6945   goto __pyx_L0;
6946 
6947   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":982
6948  *
6949  *
6950  * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
6951  *     """
6952  *     Cython equivalent of `isinstance(obj, np.datetime64)`
6953  */
6954 
6955   /* function exit code */
6956   __pyx_L0:;
6957   __Pyx_RefNannyFinishContext();
6958   return __pyx_r;
6959 }
6960 
6961 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":997
6962  *
6963  *
6964  * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
6965  *     """
6966  *     returns the int64 value underlying scalar numpy datetime64 object
6967  */
6968 
__pyx_f_5numpy_get_datetime64_value(PyObject * __pyx_v_obj)6969 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
6970   npy_datetime __pyx_r;
6971 
6972   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1004
6973  *     also needed.  That can be found using `get_datetime64_unit`.
6974  *     """
6975  *     return (<PyDatetimeScalarObject*>obj).obval             # <<<<<<<<<<<<<<
6976  *
6977  *
6978  */
6979   __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
6980   goto __pyx_L0;
6981 
6982   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":997
6983  *
6984  *
6985  * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
6986  *     """
6987  *     returns the int64 value underlying scalar numpy datetime64 object
6988  */
6989 
6990   /* function exit code */
6991   __pyx_L0:;
6992   return __pyx_r;
6993 }
6994 
6995 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1007
6996  *
6997  *
6998  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
6999  *     """
7000  *     returns the int64 value underlying scalar numpy timedelta64 object
7001  */
7002 
__pyx_f_5numpy_get_timedelta64_value(PyObject * __pyx_v_obj)7003 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
7004   npy_timedelta __pyx_r;
7005 
7006   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1011
7007  *     returns the int64 value underlying scalar numpy timedelta64 object
7008  *     """
7009  *     return (<PyTimedeltaScalarObject*>obj).obval             # <<<<<<<<<<<<<<
7010  *
7011  *
7012  */
7013   __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
7014   goto __pyx_L0;
7015 
7016   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1007
7017  *
7018  *
7019  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
7020  *     """
7021  *     returns the int64 value underlying scalar numpy timedelta64 object
7022  */
7023 
7024   /* function exit code */
7025   __pyx_L0:;
7026   return __pyx_r;
7027 }
7028 
7029 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1014
7030  *
7031  *
7032  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
7033  *     """
7034  *     returns the unit part of the dtype for a numpy datetime64 object.
7035  */
7036 
__pyx_f_5numpy_get_datetime64_unit(PyObject * __pyx_v_obj)7037 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
7038   NPY_DATETIMEUNIT __pyx_r;
7039 
7040   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1018
7041  *     returns the unit part of the dtype for a numpy datetime64 object.
7042  *     """
7043  *     return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base             # <<<<<<<<<<<<<<
7044  */
7045   __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
7046   goto __pyx_L0;
7047 
7048   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1014
7049  *
7050  *
7051  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
7052  *     """
7053  *     returns the unit part of the dtype for a numpy datetime64 object.
7054  */
7055 
7056   /* function exit code */
7057   __pyx_L0:;
7058   return __pyx_r;
7059 }
7060 
7061 /* "View.MemoryView":122
7062  *         cdef bint dtype_is_object
7063  *
7064  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
7065  *                   mode="c", bint allocate_buffer=True):
7066  *
7067  */
7068 
7069 /* Python wrapper */
7070 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_array___cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7071 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7072   PyObject *__pyx_v_shape = 0;
7073   Py_ssize_t __pyx_v_itemsize;
7074   PyObject *__pyx_v_format = 0;
7075   PyObject *__pyx_v_mode = 0;
7076   int __pyx_v_allocate_buffer;
7077   int __pyx_lineno = 0;
7078   const char *__pyx_filename = NULL;
7079   int __pyx_clineno = 0;
7080   int __pyx_r;
7081   __Pyx_RefNannyDeclarations
7082   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
7083   {
7084     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
7085     PyObject* values[5] = {0,0,0,0,0};
7086     values[3] = ((PyObject *)__pyx_n_s_c);
7087     if (unlikely(__pyx_kwds)) {
7088       Py_ssize_t kw_args;
7089       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7090       switch (pos_args) {
7091         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7092         CYTHON_FALLTHROUGH;
7093         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7094         CYTHON_FALLTHROUGH;
7095         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7096         CYTHON_FALLTHROUGH;
7097         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7098         CYTHON_FALLTHROUGH;
7099         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7100         CYTHON_FALLTHROUGH;
7101         case  0: break;
7102         default: goto __pyx_L5_argtuple_error;
7103       }
7104       kw_args = PyDict_Size(__pyx_kwds);
7105       switch (pos_args) {
7106         case  0:
7107         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
7108         else goto __pyx_L5_argtuple_error;
7109         CYTHON_FALLTHROUGH;
7110         case  1:
7111         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
7112         else {
7113           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
7114         }
7115         CYTHON_FALLTHROUGH;
7116         case  2:
7117         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
7118         else {
7119           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
7120         }
7121         CYTHON_FALLTHROUGH;
7122         case  3:
7123         if (kw_args > 0) {
7124           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
7125           if (value) { values[3] = value; kw_args--; }
7126         }
7127         CYTHON_FALLTHROUGH;
7128         case  4:
7129         if (kw_args > 0) {
7130           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
7131           if (value) { values[4] = value; kw_args--; }
7132         }
7133       }
7134       if (unlikely(kw_args > 0)) {
7135         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error)
7136       }
7137     } else {
7138       switch (PyTuple_GET_SIZE(__pyx_args)) {
7139         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7140         CYTHON_FALLTHROUGH;
7141         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7142         CYTHON_FALLTHROUGH;
7143         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7144         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7145         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7146         break;
7147         default: goto __pyx_L5_argtuple_error;
7148       }
7149     }
7150     __pyx_v_shape = ((PyObject*)values[0]);
7151     __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __pyx_L3_error)
7152     __pyx_v_format = values[2];
7153     __pyx_v_mode = values[3];
7154     if (values[4]) {
7155       __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error)
7156     } else {
7157 
7158       /* "View.MemoryView":123
7159  *
7160  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
7161  *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
7162  *
7163  *         cdef int idx
7164  */
7165       __pyx_v_allocate_buffer = ((int)1);
7166     }
7167   }
7168   goto __pyx_L4_argument_unpacking_done;
7169   __pyx_L5_argtuple_error:;
7170   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error)
7171   __pyx_L3_error:;
7172   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7173   __Pyx_RefNannyFinishContext();
7174   return -1;
7175   __pyx_L4_argument_unpacking_done:;
7176   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error)
7177   if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
7178     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error)
7179   }
7180   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
7181 
7182   /* "View.MemoryView":122
7183  *         cdef bint dtype_is_object
7184  *
7185  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
7186  *                   mode="c", bint allocate_buffer=True):
7187  *
7188  */
7189 
7190   /* function exit code */
7191   goto __pyx_L0;
7192   __pyx_L1_error:;
7193   __pyx_r = -1;
7194   __pyx_L0:;
7195   __Pyx_RefNannyFinishContext();
7196   return __pyx_r;
7197 }
7198 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_shape,Py_ssize_t __pyx_v_itemsize,PyObject * __pyx_v_format,PyObject * __pyx_v_mode,int __pyx_v_allocate_buffer)7199 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
7200   int __pyx_v_idx;
7201   Py_ssize_t __pyx_v_i;
7202   Py_ssize_t __pyx_v_dim;
7203   PyObject **__pyx_v_p;
7204   char __pyx_v_order;
7205   int __pyx_r;
7206   __Pyx_RefNannyDeclarations
7207   Py_ssize_t __pyx_t_1;
7208   int __pyx_t_2;
7209   PyObject *__pyx_t_3 = NULL;
7210   int __pyx_t_4;
7211   PyObject *__pyx_t_5 = NULL;
7212   PyObject *__pyx_t_6 = NULL;
7213   char *__pyx_t_7;
7214   int __pyx_t_8;
7215   Py_ssize_t __pyx_t_9;
7216   PyObject *__pyx_t_10 = NULL;
7217   Py_ssize_t __pyx_t_11;
7218   int __pyx_lineno = 0;
7219   const char *__pyx_filename = NULL;
7220   int __pyx_clineno = 0;
7221   __Pyx_RefNannySetupContext("__cinit__", 0);
7222   __Pyx_INCREF(__pyx_v_format);
7223 
7224   /* "View.MemoryView":129
7225  *         cdef PyObject **p
7226  *
7227  *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
7228  *         self.itemsize = itemsize
7229  *
7230  */
7231   if (unlikely(__pyx_v_shape == Py_None)) {
7232     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
7233     __PYX_ERR(2, 129, __pyx_L1_error)
7234   }
7235   __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 129, __pyx_L1_error)
7236   __pyx_v_self->ndim = ((int)__pyx_t_1);
7237 
7238   /* "View.MemoryView":130
7239  *
7240  *         self.ndim = <int> len(shape)
7241  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
7242  *
7243  *         if not self.ndim:
7244  */
7245   __pyx_v_self->itemsize = __pyx_v_itemsize;
7246 
7247   /* "View.MemoryView":132
7248  *         self.itemsize = itemsize
7249  *
7250  *         if not self.ndim:             # <<<<<<<<<<<<<<
7251  *             raise ValueError("Empty shape tuple for cython.array")
7252  *
7253  */
7254   __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
7255   if (unlikely(__pyx_t_2)) {
7256 
7257     /* "View.MemoryView":133
7258  *
7259  *         if not self.ndim:
7260  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
7261  *
7262  *         if itemsize <= 0:
7263  */
7264     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error)
7265     __Pyx_GOTREF(__pyx_t_3);
7266     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7267     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7268     __PYX_ERR(2, 133, __pyx_L1_error)
7269 
7270     /* "View.MemoryView":132
7271  *         self.itemsize = itemsize
7272  *
7273  *         if not self.ndim:             # <<<<<<<<<<<<<<
7274  *             raise ValueError("Empty shape tuple for cython.array")
7275  *
7276  */
7277   }
7278 
7279   /* "View.MemoryView":135
7280  *             raise ValueError("Empty shape tuple for cython.array")
7281  *
7282  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
7283  *             raise ValueError("itemsize <= 0 for cython.array")
7284  *
7285  */
7286   __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
7287   if (unlikely(__pyx_t_2)) {
7288 
7289     /* "View.MemoryView":136
7290  *
7291  *         if itemsize <= 0:
7292  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
7293  *
7294  *         if not isinstance(format, bytes):
7295  */
7296     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error)
7297     __Pyx_GOTREF(__pyx_t_3);
7298     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7299     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7300     __PYX_ERR(2, 136, __pyx_L1_error)
7301 
7302     /* "View.MemoryView":135
7303  *             raise ValueError("Empty shape tuple for cython.array")
7304  *
7305  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
7306  *             raise ValueError("itemsize <= 0 for cython.array")
7307  *
7308  */
7309   }
7310 
7311   /* "View.MemoryView":138
7312  *             raise ValueError("itemsize <= 0 for cython.array")
7313  *
7314  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
7315  *             format = format.encode('ASCII')
7316  *         self._format = format  # keep a reference to the byte string
7317  */
7318   __pyx_t_2 = PyBytes_Check(__pyx_v_format);
7319   __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
7320   if (__pyx_t_4) {
7321 
7322     /* "View.MemoryView":139
7323  *
7324  *         if not isinstance(format, bytes):
7325  *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
7326  *         self._format = format  # keep a reference to the byte string
7327  *         self.format = self._format
7328  */
7329     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 139, __pyx_L1_error)
7330     __Pyx_GOTREF(__pyx_t_5);
7331     __pyx_t_6 = NULL;
7332     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7333       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7334       if (likely(__pyx_t_6)) {
7335         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7336         __Pyx_INCREF(__pyx_t_6);
7337         __Pyx_INCREF(function);
7338         __Pyx_DECREF_SET(__pyx_t_5, function);
7339       }
7340     }
7341     __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
7342     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7343     if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error)
7344     __Pyx_GOTREF(__pyx_t_3);
7345     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7346     __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
7347     __pyx_t_3 = 0;
7348 
7349     /* "View.MemoryView":138
7350  *             raise ValueError("itemsize <= 0 for cython.array")
7351  *
7352  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
7353  *             format = format.encode('ASCII')
7354  *         self._format = format  # keep a reference to the byte string
7355  */
7356   }
7357 
7358   /* "View.MemoryView":140
7359  *         if not isinstance(format, bytes):
7360  *             format = format.encode('ASCII')
7361  *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
7362  *         self.format = self._format
7363  *
7364  */
7365   if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 140, __pyx_L1_error)
7366   __pyx_t_3 = __pyx_v_format;
7367   __Pyx_INCREF(__pyx_t_3);
7368   __Pyx_GIVEREF(__pyx_t_3);
7369   __Pyx_GOTREF(__pyx_v_self->_format);
7370   __Pyx_DECREF(__pyx_v_self->_format);
7371   __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
7372   __pyx_t_3 = 0;
7373 
7374   /* "View.MemoryView":141
7375  *             format = format.encode('ASCII')
7376  *         self._format = format  # keep a reference to the byte string
7377  *         self.format = self._format             # <<<<<<<<<<<<<<
7378  *
7379  *
7380  */
7381   if (unlikely(__pyx_v_self->_format == Py_None)) {
7382     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
7383     __PYX_ERR(2, 141, __pyx_L1_error)
7384   }
7385   __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error)
7386   __pyx_v_self->format = __pyx_t_7;
7387 
7388   /* "View.MemoryView":144
7389  *
7390  *
7391  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
7392  *         self._strides = self._shape + self.ndim
7393  *
7394  */
7395   __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
7396 
7397   /* "View.MemoryView":145
7398  *
7399  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
7400  *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
7401  *
7402  *         if not self._shape:
7403  */
7404   __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
7405 
7406   /* "View.MemoryView":147
7407  *         self._strides = self._shape + self.ndim
7408  *
7409  *         if not self._shape:             # <<<<<<<<<<<<<<
7410  *             raise MemoryError("unable to allocate shape and strides.")
7411  *
7412  */
7413   __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
7414   if (unlikely(__pyx_t_4)) {
7415 
7416     /* "View.MemoryView":148
7417  *
7418  *         if not self._shape:
7419  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
7420  *
7421  *
7422  */
7423     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
7424     __Pyx_GOTREF(__pyx_t_3);
7425     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7426     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7427     __PYX_ERR(2, 148, __pyx_L1_error)
7428 
7429     /* "View.MemoryView":147
7430  *         self._strides = self._shape + self.ndim
7431  *
7432  *         if not self._shape:             # <<<<<<<<<<<<<<
7433  *             raise MemoryError("unable to allocate shape and strides.")
7434  *
7435  */
7436   }
7437 
7438   /* "View.MemoryView":151
7439  *
7440  *
7441  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
7442  *             if dim <= 0:
7443  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7444  */
7445   __pyx_t_8 = 0;
7446   __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
7447   for (;;) {
7448     if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
7449     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7450     __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 151, __pyx_L1_error)
7451     #else
7452     __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 151, __pyx_L1_error)
7453     __Pyx_GOTREF(__pyx_t_5);
7454     #endif
7455     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 151, __pyx_L1_error)
7456     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7457     __pyx_v_dim = __pyx_t_9;
7458     __pyx_v_idx = __pyx_t_8;
7459     __pyx_t_8 = (__pyx_t_8 + 1);
7460 
7461     /* "View.MemoryView":152
7462  *
7463  *         for idx, dim in enumerate(shape):
7464  *             if dim <= 0:             # <<<<<<<<<<<<<<
7465  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7466  *             self._shape[idx] = dim
7467  */
7468     __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
7469     if (unlikely(__pyx_t_4)) {
7470 
7471       /* "View.MemoryView":153
7472  *         for idx, dim in enumerate(shape):
7473  *             if dim <= 0:
7474  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
7475  *             self._shape[idx] = dim
7476  *
7477  */
7478       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error)
7479       __Pyx_GOTREF(__pyx_t_5);
7480       __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
7481       __Pyx_GOTREF(__pyx_t_6);
7482       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
7483       __Pyx_GOTREF(__pyx_t_10);
7484       __Pyx_GIVEREF(__pyx_t_5);
7485       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
7486       __Pyx_GIVEREF(__pyx_t_6);
7487       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
7488       __pyx_t_5 = 0;
7489       __pyx_t_6 = 0;
7490       __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
7491       __Pyx_GOTREF(__pyx_t_6);
7492       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7493       __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
7494       __Pyx_GOTREF(__pyx_t_10);
7495       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7496       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7497       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7498       __PYX_ERR(2, 153, __pyx_L1_error)
7499 
7500       /* "View.MemoryView":152
7501  *
7502  *         for idx, dim in enumerate(shape):
7503  *             if dim <= 0:             # <<<<<<<<<<<<<<
7504  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7505  *             self._shape[idx] = dim
7506  */
7507     }
7508 
7509     /* "View.MemoryView":154
7510  *             if dim <= 0:
7511  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7512  *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
7513  *
7514  *         cdef char order
7515  */
7516     (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
7517 
7518     /* "View.MemoryView":151
7519  *
7520  *
7521  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
7522  *             if dim <= 0:
7523  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7524  */
7525   }
7526   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7527 
7528   /* "View.MemoryView":157
7529  *
7530  *         cdef char order
7531  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
7532  *             order = b'F'
7533  *             self.mode = u'fortran'
7534  */
7535   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 157, __pyx_L1_error)
7536   if (__pyx_t_4) {
7537 
7538     /* "View.MemoryView":158
7539  *         cdef char order
7540  *         if mode == 'fortran':
7541  *             order = b'F'             # <<<<<<<<<<<<<<
7542  *             self.mode = u'fortran'
7543  *         elif mode == 'c':
7544  */
7545     __pyx_v_order = 'F';
7546 
7547     /* "View.MemoryView":159
7548  *         if mode == 'fortran':
7549  *             order = b'F'
7550  *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
7551  *         elif mode == 'c':
7552  *             order = b'C'
7553  */
7554     __Pyx_INCREF(__pyx_n_u_fortran);
7555     __Pyx_GIVEREF(__pyx_n_u_fortran);
7556     __Pyx_GOTREF(__pyx_v_self->mode);
7557     __Pyx_DECREF(__pyx_v_self->mode);
7558     __pyx_v_self->mode = __pyx_n_u_fortran;
7559 
7560     /* "View.MemoryView":157
7561  *
7562  *         cdef char order
7563  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
7564  *             order = b'F'
7565  *             self.mode = u'fortran'
7566  */
7567     goto __pyx_L10;
7568   }
7569 
7570   /* "View.MemoryView":160
7571  *             order = b'F'
7572  *             self.mode = u'fortran'
7573  *         elif mode == 'c':             # <<<<<<<<<<<<<<
7574  *             order = b'C'
7575  *             self.mode = u'c'
7576  */
7577   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 160, __pyx_L1_error)
7578   if (likely(__pyx_t_4)) {
7579 
7580     /* "View.MemoryView":161
7581  *             self.mode = u'fortran'
7582  *         elif mode == 'c':
7583  *             order = b'C'             # <<<<<<<<<<<<<<
7584  *             self.mode = u'c'
7585  *         else:
7586  */
7587     __pyx_v_order = 'C';
7588 
7589     /* "View.MemoryView":162
7590  *         elif mode == 'c':
7591  *             order = b'C'
7592  *             self.mode = u'c'             # <<<<<<<<<<<<<<
7593  *         else:
7594  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
7595  */
7596     __Pyx_INCREF(__pyx_n_u_c);
7597     __Pyx_GIVEREF(__pyx_n_u_c);
7598     __Pyx_GOTREF(__pyx_v_self->mode);
7599     __Pyx_DECREF(__pyx_v_self->mode);
7600     __pyx_v_self->mode = __pyx_n_u_c;
7601 
7602     /* "View.MemoryView":160
7603  *             order = b'F'
7604  *             self.mode = u'fortran'
7605  *         elif mode == 'c':             # <<<<<<<<<<<<<<
7606  *             order = b'C'
7607  *             self.mode = u'c'
7608  */
7609     goto __pyx_L10;
7610   }
7611 
7612   /* "View.MemoryView":164
7613  *             self.mode = u'c'
7614  *         else:
7615  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
7616  *
7617  *         self.len = fill_contig_strides_array(self._shape, self._strides,
7618  */
7619   /*else*/ {
7620     __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 164, __pyx_L1_error)
7621     __Pyx_GOTREF(__pyx_t_3);
7622     __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error)
7623     __Pyx_GOTREF(__pyx_t_10);
7624     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7625     __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7626     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7627     __PYX_ERR(2, 164, __pyx_L1_error)
7628   }
7629   __pyx_L10:;
7630 
7631   /* "View.MemoryView":166
7632  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
7633  *
7634  *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
7635  *                                              itemsize, self.ndim, order)
7636  *
7637  */
7638   __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
7639 
7640   /* "View.MemoryView":169
7641  *                                              itemsize, self.ndim, order)
7642  *
7643  *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
7644  *         self.dtype_is_object = format == b'O'
7645  *         if allocate_buffer:
7646  */
7647   __pyx_v_self->free_data = __pyx_v_allocate_buffer;
7648 
7649   /* "View.MemoryView":170
7650  *
7651  *         self.free_data = allocate_buffer
7652  *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
7653  *         if allocate_buffer:
7654  *
7655  */
7656   __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 170, __pyx_L1_error)
7657   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 170, __pyx_L1_error)
7658   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7659   __pyx_v_self->dtype_is_object = __pyx_t_4;
7660 
7661   /* "View.MemoryView":171
7662  *         self.free_data = allocate_buffer
7663  *         self.dtype_is_object = format == b'O'
7664  *         if allocate_buffer:             # <<<<<<<<<<<<<<
7665  *
7666  *
7667  */
7668   __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
7669   if (__pyx_t_4) {
7670 
7671     /* "View.MemoryView":174
7672  *
7673  *
7674  *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
7675  *             if not self.data:
7676  *                 raise MemoryError("unable to allocate array data.")
7677  */
7678     __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
7679 
7680     /* "View.MemoryView":175
7681  *
7682  *             self.data = <char *>malloc(self.len)
7683  *             if not self.data:             # <<<<<<<<<<<<<<
7684  *                 raise MemoryError("unable to allocate array data.")
7685  *
7686  */
7687     __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
7688     if (unlikely(__pyx_t_4)) {
7689 
7690       /* "View.MemoryView":176
7691  *             self.data = <char *>malloc(self.len)
7692  *             if not self.data:
7693  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
7694  *
7695  *             if self.dtype_is_object:
7696  */
7697       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error)
7698       __Pyx_GOTREF(__pyx_t_10);
7699       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7700       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7701       __PYX_ERR(2, 176, __pyx_L1_error)
7702 
7703       /* "View.MemoryView":175
7704  *
7705  *             self.data = <char *>malloc(self.len)
7706  *             if not self.data:             # <<<<<<<<<<<<<<
7707  *                 raise MemoryError("unable to allocate array data.")
7708  *
7709  */
7710     }
7711 
7712     /* "View.MemoryView":178
7713  *                 raise MemoryError("unable to allocate array data.")
7714  *
7715  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
7716  *                 p = <PyObject **> self.data
7717  *                 for i in range(self.len / itemsize):
7718  */
7719     __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
7720     if (__pyx_t_4) {
7721 
7722       /* "View.MemoryView":179
7723  *
7724  *             if self.dtype_is_object:
7725  *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
7726  *                 for i in range(self.len / itemsize):
7727  *                     p[i] = Py_None
7728  */
7729       __pyx_v_p = ((PyObject **)__pyx_v_self->data);
7730 
7731       /* "View.MemoryView":180
7732  *             if self.dtype_is_object:
7733  *                 p = <PyObject **> self.data
7734  *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
7735  *                     p[i] = Py_None
7736  *                     Py_INCREF(Py_None)
7737  */
7738       if (unlikely(__pyx_v_itemsize == 0)) {
7739         PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
7740         __PYX_ERR(2, 180, __pyx_L1_error)
7741       }
7742       else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
7743         PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
7744         __PYX_ERR(2, 180, __pyx_L1_error)
7745       }
7746       __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize);
7747       __pyx_t_9 = __pyx_t_1;
7748       for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
7749         __pyx_v_i = __pyx_t_11;
7750 
7751         /* "View.MemoryView":181
7752  *                 p = <PyObject **> self.data
7753  *                 for i in range(self.len / itemsize):
7754  *                     p[i] = Py_None             # <<<<<<<<<<<<<<
7755  *                     Py_INCREF(Py_None)
7756  *
7757  */
7758         (__pyx_v_p[__pyx_v_i]) = Py_None;
7759 
7760         /* "View.MemoryView":182
7761  *                 for i in range(self.len / itemsize):
7762  *                     p[i] = Py_None
7763  *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
7764  *
7765  *     @cname('getbuffer')
7766  */
7767         Py_INCREF(Py_None);
7768       }
7769 
7770       /* "View.MemoryView":178
7771  *                 raise MemoryError("unable to allocate array data.")
7772  *
7773  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
7774  *                 p = <PyObject **> self.data
7775  *                 for i in range(self.len / itemsize):
7776  */
7777     }
7778 
7779     /* "View.MemoryView":171
7780  *         self.free_data = allocate_buffer
7781  *         self.dtype_is_object = format == b'O'
7782  *         if allocate_buffer:             # <<<<<<<<<<<<<<
7783  *
7784  *
7785  */
7786   }
7787 
7788   /* "View.MemoryView":122
7789  *         cdef bint dtype_is_object
7790  *
7791  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
7792  *                   mode="c", bint allocate_buffer=True):
7793  *
7794  */
7795 
7796   /* function exit code */
7797   __pyx_r = 0;
7798   goto __pyx_L0;
7799   __pyx_L1_error:;
7800   __Pyx_XDECREF(__pyx_t_3);
7801   __Pyx_XDECREF(__pyx_t_5);
7802   __Pyx_XDECREF(__pyx_t_6);
7803   __Pyx_XDECREF(__pyx_t_10);
7804   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7805   __pyx_r = -1;
7806   __pyx_L0:;
7807   __Pyx_XDECREF(__pyx_v_format);
7808   __Pyx_RefNannyFinishContext();
7809   return __pyx_r;
7810 }
7811 
7812 /* "View.MemoryView":185
7813  *
7814  *     @cname('getbuffer')
7815  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
7816  *         cdef int bufmode = -1
7817  *         if self.mode == u"c":
7818  */
7819 
7820 /* Python wrapper */
7821 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_array_getbuffer(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)7822 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
7823   int __pyx_r;
7824   __Pyx_RefNannyDeclarations
7825   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
7826   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
7827 
7828   /* function exit code */
7829   __Pyx_RefNannyFinishContext();
7830   return __pyx_r;
7831 }
7832 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)7833 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
7834   int __pyx_v_bufmode;
7835   int __pyx_r;
7836   __Pyx_RefNannyDeclarations
7837   int __pyx_t_1;
7838   int __pyx_t_2;
7839   PyObject *__pyx_t_3 = NULL;
7840   char *__pyx_t_4;
7841   Py_ssize_t __pyx_t_5;
7842   int __pyx_t_6;
7843   Py_ssize_t *__pyx_t_7;
7844   int __pyx_lineno = 0;
7845   const char *__pyx_filename = NULL;
7846   int __pyx_clineno = 0;
7847   if (__pyx_v_info == NULL) {
7848     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
7849     return -1;
7850   }
7851   __Pyx_RefNannySetupContext("__getbuffer__", 0);
7852   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
7853   __Pyx_GIVEREF(__pyx_v_info->obj);
7854 
7855   /* "View.MemoryView":186
7856  *     @cname('getbuffer')
7857  *     def __getbuffer__(self, Py_buffer *info, int flags):
7858  *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
7859  *         if self.mode == u"c":
7860  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7861  */
7862   __pyx_v_bufmode = -1;
7863 
7864   /* "View.MemoryView":187
7865  *     def __getbuffer__(self, Py_buffer *info, int flags):
7866  *         cdef int bufmode = -1
7867  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
7868  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7869  *         elif self.mode == u"fortran":
7870  */
7871   __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 187, __pyx_L1_error)
7872   __pyx_t_2 = (__pyx_t_1 != 0);
7873   if (__pyx_t_2) {
7874 
7875     /* "View.MemoryView":188
7876  *         cdef int bufmode = -1
7877  *         if self.mode == u"c":
7878  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
7879  *         elif self.mode == u"fortran":
7880  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7881  */
7882     __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
7883 
7884     /* "View.MemoryView":187
7885  *     def __getbuffer__(self, Py_buffer *info, int flags):
7886  *         cdef int bufmode = -1
7887  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
7888  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7889  *         elif self.mode == u"fortran":
7890  */
7891     goto __pyx_L3;
7892   }
7893 
7894   /* "View.MemoryView":189
7895  *         if self.mode == u"c":
7896  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7897  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
7898  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7899  *         if not (flags & bufmode):
7900  */
7901   __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 189, __pyx_L1_error)
7902   __pyx_t_1 = (__pyx_t_2 != 0);
7903   if (__pyx_t_1) {
7904 
7905     /* "View.MemoryView":190
7906  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7907  *         elif self.mode == u"fortran":
7908  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
7909  *         if not (flags & bufmode):
7910  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7911  */
7912     __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
7913 
7914     /* "View.MemoryView":189
7915  *         if self.mode == u"c":
7916  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7917  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
7918  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7919  *         if not (flags & bufmode):
7920  */
7921   }
7922   __pyx_L3:;
7923 
7924   /* "View.MemoryView":191
7925  *         elif self.mode == u"fortran":
7926  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7927  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
7928  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7929  *         info.buf = self.data
7930  */
7931   __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
7932   if (unlikely(__pyx_t_1)) {
7933 
7934     /* "View.MemoryView":192
7935  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7936  *         if not (flags & bufmode):
7937  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
7938  *         info.buf = self.data
7939  *         info.len = self.len
7940  */
7941     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error)
7942     __Pyx_GOTREF(__pyx_t_3);
7943     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7944     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7945     __PYX_ERR(2, 192, __pyx_L1_error)
7946 
7947     /* "View.MemoryView":191
7948  *         elif self.mode == u"fortran":
7949  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7950  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
7951  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7952  *         info.buf = self.data
7953  */
7954   }
7955 
7956   /* "View.MemoryView":193
7957  *         if not (flags & bufmode):
7958  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7959  *         info.buf = self.data             # <<<<<<<<<<<<<<
7960  *         info.len = self.len
7961  *         info.ndim = self.ndim
7962  */
7963   __pyx_t_4 = __pyx_v_self->data;
7964   __pyx_v_info->buf = __pyx_t_4;
7965 
7966   /* "View.MemoryView":194
7967  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7968  *         info.buf = self.data
7969  *         info.len = self.len             # <<<<<<<<<<<<<<
7970  *         info.ndim = self.ndim
7971  *         info.shape = self._shape
7972  */
7973   __pyx_t_5 = __pyx_v_self->len;
7974   __pyx_v_info->len = __pyx_t_5;
7975 
7976   /* "View.MemoryView":195
7977  *         info.buf = self.data
7978  *         info.len = self.len
7979  *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
7980  *         info.shape = self._shape
7981  *         info.strides = self._strides
7982  */
7983   __pyx_t_6 = __pyx_v_self->ndim;
7984   __pyx_v_info->ndim = __pyx_t_6;
7985 
7986   /* "View.MemoryView":196
7987  *         info.len = self.len
7988  *         info.ndim = self.ndim
7989  *         info.shape = self._shape             # <<<<<<<<<<<<<<
7990  *         info.strides = self._strides
7991  *         info.suboffsets = NULL
7992  */
7993   __pyx_t_7 = __pyx_v_self->_shape;
7994   __pyx_v_info->shape = __pyx_t_7;
7995 
7996   /* "View.MemoryView":197
7997  *         info.ndim = self.ndim
7998  *         info.shape = self._shape
7999  *         info.strides = self._strides             # <<<<<<<<<<<<<<
8000  *         info.suboffsets = NULL
8001  *         info.itemsize = self.itemsize
8002  */
8003   __pyx_t_7 = __pyx_v_self->_strides;
8004   __pyx_v_info->strides = __pyx_t_7;
8005 
8006   /* "View.MemoryView":198
8007  *         info.shape = self._shape
8008  *         info.strides = self._strides
8009  *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
8010  *         info.itemsize = self.itemsize
8011  *         info.readonly = 0
8012  */
8013   __pyx_v_info->suboffsets = NULL;
8014 
8015   /* "View.MemoryView":199
8016  *         info.strides = self._strides
8017  *         info.suboffsets = NULL
8018  *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
8019  *         info.readonly = 0
8020  *
8021  */
8022   __pyx_t_5 = __pyx_v_self->itemsize;
8023   __pyx_v_info->itemsize = __pyx_t_5;
8024 
8025   /* "View.MemoryView":200
8026  *         info.suboffsets = NULL
8027  *         info.itemsize = self.itemsize
8028  *         info.readonly = 0             # <<<<<<<<<<<<<<
8029  *
8030  *         if flags & PyBUF_FORMAT:
8031  */
8032   __pyx_v_info->readonly = 0;
8033 
8034   /* "View.MemoryView":202
8035  *         info.readonly = 0
8036  *
8037  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
8038  *             info.format = self.format
8039  *         else:
8040  */
8041   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
8042   if (__pyx_t_1) {
8043 
8044     /* "View.MemoryView":203
8045  *
8046  *         if flags & PyBUF_FORMAT:
8047  *             info.format = self.format             # <<<<<<<<<<<<<<
8048  *         else:
8049  *             info.format = NULL
8050  */
8051     __pyx_t_4 = __pyx_v_self->format;
8052     __pyx_v_info->format = __pyx_t_4;
8053 
8054     /* "View.MemoryView":202
8055  *         info.readonly = 0
8056  *
8057  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
8058  *             info.format = self.format
8059  *         else:
8060  */
8061     goto __pyx_L5;
8062   }
8063 
8064   /* "View.MemoryView":205
8065  *             info.format = self.format
8066  *         else:
8067  *             info.format = NULL             # <<<<<<<<<<<<<<
8068  *
8069  *         info.obj = self
8070  */
8071   /*else*/ {
8072     __pyx_v_info->format = NULL;
8073   }
8074   __pyx_L5:;
8075 
8076   /* "View.MemoryView":207
8077  *             info.format = NULL
8078  *
8079  *         info.obj = self             # <<<<<<<<<<<<<<
8080  *
8081  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
8082  */
8083   __Pyx_INCREF(((PyObject *)__pyx_v_self));
8084   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8085   __Pyx_GOTREF(__pyx_v_info->obj);
8086   __Pyx_DECREF(__pyx_v_info->obj);
8087   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
8088 
8089   /* "View.MemoryView":185
8090  *
8091  *     @cname('getbuffer')
8092  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
8093  *         cdef int bufmode = -1
8094  *         if self.mode == u"c":
8095  */
8096 
8097   /* function exit code */
8098   __pyx_r = 0;
8099   goto __pyx_L0;
8100   __pyx_L1_error:;
8101   __Pyx_XDECREF(__pyx_t_3);
8102   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8103   __pyx_r = -1;
8104   if (__pyx_v_info->obj != NULL) {
8105     __Pyx_GOTREF(__pyx_v_info->obj);
8106     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
8107   }
8108   goto __pyx_L2;
8109   __pyx_L0:;
8110   if (__pyx_v_info->obj == Py_None) {
8111     __Pyx_GOTREF(__pyx_v_info->obj);
8112     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
8113   }
8114   __pyx_L2:;
8115   __Pyx_RefNannyFinishContext();
8116   return __pyx_r;
8117 }
8118 
8119 /* "View.MemoryView":211
8120  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
8121  *
8122  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
8123  *         if self.callback_free_data != NULL:
8124  *             self.callback_free_data(self.data)
8125  */
8126 
8127 /* Python wrapper */
8128 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___dealloc__(PyObject * __pyx_v_self)8129 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
8130   __Pyx_RefNannyDeclarations
8131   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
8132   __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
8133 
8134   /* function exit code */
8135   __Pyx_RefNannyFinishContext();
8136 }
8137 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj * __pyx_v_self)8138 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
8139   __Pyx_RefNannyDeclarations
8140   int __pyx_t_1;
8141   __Pyx_RefNannySetupContext("__dealloc__", 0);
8142 
8143   /* "View.MemoryView":212
8144  *
8145  *     def __dealloc__(array self):
8146  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
8147  *             self.callback_free_data(self.data)
8148  *         elif self.free_data:
8149  */
8150   __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
8151   if (__pyx_t_1) {
8152 
8153     /* "View.MemoryView":213
8154  *     def __dealloc__(array self):
8155  *         if self.callback_free_data != NULL:
8156  *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
8157  *         elif self.free_data:
8158  *             if self.dtype_is_object:
8159  */
8160     __pyx_v_self->callback_free_data(__pyx_v_self->data);
8161 
8162     /* "View.MemoryView":212
8163  *
8164  *     def __dealloc__(array self):
8165  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
8166  *             self.callback_free_data(self.data)
8167  *         elif self.free_data:
8168  */
8169     goto __pyx_L3;
8170   }
8171 
8172   /* "View.MemoryView":214
8173  *         if self.callback_free_data != NULL:
8174  *             self.callback_free_data(self.data)
8175  *         elif self.free_data:             # <<<<<<<<<<<<<<
8176  *             if self.dtype_is_object:
8177  *                 refcount_objects_in_slice(self.data, self._shape,
8178  */
8179   __pyx_t_1 = (__pyx_v_self->free_data != 0);
8180   if (__pyx_t_1) {
8181 
8182     /* "View.MemoryView":215
8183  *             self.callback_free_data(self.data)
8184  *         elif self.free_data:
8185  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
8186  *                 refcount_objects_in_slice(self.data, self._shape,
8187  *                                           self._strides, self.ndim, False)
8188  */
8189     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
8190     if (__pyx_t_1) {
8191 
8192       /* "View.MemoryView":216
8193  *         elif self.free_data:
8194  *             if self.dtype_is_object:
8195  *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
8196  *                                           self._strides, self.ndim, False)
8197  *             free(self.data)
8198  */
8199       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
8200 
8201       /* "View.MemoryView":215
8202  *             self.callback_free_data(self.data)
8203  *         elif self.free_data:
8204  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
8205  *                 refcount_objects_in_slice(self.data, self._shape,
8206  *                                           self._strides, self.ndim, False)
8207  */
8208     }
8209 
8210     /* "View.MemoryView":218
8211  *                 refcount_objects_in_slice(self.data, self._shape,
8212  *                                           self._strides, self.ndim, False)
8213  *             free(self.data)             # <<<<<<<<<<<<<<
8214  *         PyObject_Free(self._shape)
8215  *
8216  */
8217     free(__pyx_v_self->data);
8218 
8219     /* "View.MemoryView":214
8220  *         if self.callback_free_data != NULL:
8221  *             self.callback_free_data(self.data)
8222  *         elif self.free_data:             # <<<<<<<<<<<<<<
8223  *             if self.dtype_is_object:
8224  *                 refcount_objects_in_slice(self.data, self._shape,
8225  */
8226   }
8227   __pyx_L3:;
8228 
8229   /* "View.MemoryView":219
8230  *                                           self._strides, self.ndim, False)
8231  *             free(self.data)
8232  *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
8233  *
8234  *     @property
8235  */
8236   PyObject_Free(__pyx_v_self->_shape);
8237 
8238   /* "View.MemoryView":211
8239  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
8240  *
8241  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
8242  *         if self.callback_free_data != NULL:
8243  *             self.callback_free_data(self.data)
8244  */
8245 
8246   /* function exit code */
8247   __Pyx_RefNannyFinishContext();
8248 }
8249 
8250 /* "View.MemoryView":222
8251  *
8252  *     @property
8253  *     def memview(self):             # <<<<<<<<<<<<<<
8254  *         return self.get_memview()
8255  *
8256  */
8257 
8258 /* Python wrapper */
8259 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject * __pyx_v_self)8260 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
8261   PyObject *__pyx_r = 0;
8262   __Pyx_RefNannyDeclarations
8263   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8264   __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
8265 
8266   /* function exit code */
8267   __Pyx_RefNannyFinishContext();
8268   return __pyx_r;
8269 }
8270 
__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj * __pyx_v_self)8271 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
8272   PyObject *__pyx_r = NULL;
8273   __Pyx_RefNannyDeclarations
8274   PyObject *__pyx_t_1 = NULL;
8275   int __pyx_lineno = 0;
8276   const char *__pyx_filename = NULL;
8277   int __pyx_clineno = 0;
8278   __Pyx_RefNannySetupContext("__get__", 0);
8279 
8280   /* "View.MemoryView":223
8281  *     @property
8282  *     def memview(self):
8283  *         return self.get_memview()             # <<<<<<<<<<<<<<
8284  *
8285  *     @cname('get_memview')
8286  */
8287   __Pyx_XDECREF(__pyx_r);
8288   __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 223, __pyx_L1_error)
8289   __Pyx_GOTREF(__pyx_t_1);
8290   __pyx_r = __pyx_t_1;
8291   __pyx_t_1 = 0;
8292   goto __pyx_L0;
8293 
8294   /* "View.MemoryView":222
8295  *
8296  *     @property
8297  *     def memview(self):             # <<<<<<<<<<<<<<
8298  *         return self.get_memview()
8299  *
8300  */
8301 
8302   /* function exit code */
8303   __pyx_L1_error:;
8304   __Pyx_XDECREF(__pyx_t_1);
8305   __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8306   __pyx_r = NULL;
8307   __pyx_L0:;
8308   __Pyx_XGIVEREF(__pyx_r);
8309   __Pyx_RefNannyFinishContext();
8310   return __pyx_r;
8311 }
8312 
8313 /* "View.MemoryView":226
8314  *
8315  *     @cname('get_memview')
8316  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
8317  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
8318  *         return  memoryview(self, flags, self.dtype_is_object)
8319  */
8320 
__pyx_array_get_memview(struct __pyx_array_obj * __pyx_v_self)8321 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
8322   int __pyx_v_flags;
8323   PyObject *__pyx_r = NULL;
8324   __Pyx_RefNannyDeclarations
8325   PyObject *__pyx_t_1 = NULL;
8326   PyObject *__pyx_t_2 = NULL;
8327   PyObject *__pyx_t_3 = NULL;
8328   int __pyx_lineno = 0;
8329   const char *__pyx_filename = NULL;
8330   int __pyx_clineno = 0;
8331   __Pyx_RefNannySetupContext("get_memview", 0);
8332 
8333   /* "View.MemoryView":227
8334  *     @cname('get_memview')
8335  *     cdef get_memview(self):
8336  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
8337  *         return  memoryview(self, flags, self.dtype_is_object)
8338  *
8339  */
8340   __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
8341 
8342   /* "View.MemoryView":228
8343  *     cdef get_memview(self):
8344  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
8345  *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
8346  *
8347  *     def __len__(self):
8348  */
8349   __Pyx_XDECREF(__pyx_r);
8350   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error)
8351   __Pyx_GOTREF(__pyx_t_1);
8352   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
8353   __Pyx_GOTREF(__pyx_t_2);
8354   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error)
8355   __Pyx_GOTREF(__pyx_t_3);
8356   __Pyx_INCREF(((PyObject *)__pyx_v_self));
8357   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8358   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
8359   __Pyx_GIVEREF(__pyx_t_1);
8360   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
8361   __Pyx_GIVEREF(__pyx_t_2);
8362   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
8363   __pyx_t_1 = 0;
8364   __pyx_t_2 = 0;
8365   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
8366   __Pyx_GOTREF(__pyx_t_2);
8367   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8368   __pyx_r = __pyx_t_2;
8369   __pyx_t_2 = 0;
8370   goto __pyx_L0;
8371 
8372   /* "View.MemoryView":226
8373  *
8374  *     @cname('get_memview')
8375  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
8376  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
8377  *         return  memoryview(self, flags, self.dtype_is_object)
8378  */
8379 
8380   /* function exit code */
8381   __pyx_L1_error:;
8382   __Pyx_XDECREF(__pyx_t_1);
8383   __Pyx_XDECREF(__pyx_t_2);
8384   __Pyx_XDECREF(__pyx_t_3);
8385   __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
8386   __pyx_r = 0;
8387   __pyx_L0:;
8388   __Pyx_XGIVEREF(__pyx_r);
8389   __Pyx_RefNannyFinishContext();
8390   return __pyx_r;
8391 }
8392 
8393 /* "View.MemoryView":230
8394  *         return  memoryview(self, flags, self.dtype_is_object)
8395  *
8396  *     def __len__(self):             # <<<<<<<<<<<<<<
8397  *         return self._shape[0]
8398  *
8399  */
8400 
8401 /* Python wrapper */
8402 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___len__(PyObject * __pyx_v_self)8403 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
8404   Py_ssize_t __pyx_r;
8405   __Pyx_RefNannyDeclarations
8406   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
8407   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
8408 
8409   /* function exit code */
8410   __Pyx_RefNannyFinishContext();
8411   return __pyx_r;
8412 }
8413 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj * __pyx_v_self)8414 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
8415   Py_ssize_t __pyx_r;
8416   __Pyx_RefNannyDeclarations
8417   __Pyx_RefNannySetupContext("__len__", 0);
8418 
8419   /* "View.MemoryView":231
8420  *
8421  *     def __len__(self):
8422  *         return self._shape[0]             # <<<<<<<<<<<<<<
8423  *
8424  *     def __getattr__(self, attr):
8425  */
8426   __pyx_r = (__pyx_v_self->_shape[0]);
8427   goto __pyx_L0;
8428 
8429   /* "View.MemoryView":230
8430  *         return  memoryview(self, flags, self.dtype_is_object)
8431  *
8432  *     def __len__(self):             # <<<<<<<<<<<<<<
8433  *         return self._shape[0]
8434  *
8435  */
8436 
8437   /* function exit code */
8438   __pyx_L0:;
8439   __Pyx_RefNannyFinishContext();
8440   return __pyx_r;
8441 }
8442 
8443 /* "View.MemoryView":233
8444  *         return self._shape[0]
8445  *
8446  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
8447  *         return getattr(self.memview, attr)
8448  *
8449  */
8450 
8451 /* Python wrapper */
8452 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
__pyx_array___getattr__(PyObject * __pyx_v_self,PyObject * __pyx_v_attr)8453 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
8454   PyObject *__pyx_r = 0;
8455   __Pyx_RefNannyDeclarations
8456   __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
8457   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
8458 
8459   /* function exit code */
8460   __Pyx_RefNannyFinishContext();
8461   return __pyx_r;
8462 }
8463 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_attr)8464 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
8465   PyObject *__pyx_r = NULL;
8466   __Pyx_RefNannyDeclarations
8467   PyObject *__pyx_t_1 = NULL;
8468   PyObject *__pyx_t_2 = NULL;
8469   int __pyx_lineno = 0;
8470   const char *__pyx_filename = NULL;
8471   int __pyx_clineno = 0;
8472   __Pyx_RefNannySetupContext("__getattr__", 0);
8473 
8474   /* "View.MemoryView":234
8475  *
8476  *     def __getattr__(self, attr):
8477  *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
8478  *
8479  *     def __getitem__(self, item):
8480  */
8481   __Pyx_XDECREF(__pyx_r);
8482   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 234, __pyx_L1_error)
8483   __Pyx_GOTREF(__pyx_t_1);
8484   __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error)
8485   __Pyx_GOTREF(__pyx_t_2);
8486   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8487   __pyx_r = __pyx_t_2;
8488   __pyx_t_2 = 0;
8489   goto __pyx_L0;
8490 
8491   /* "View.MemoryView":233
8492  *         return self._shape[0]
8493  *
8494  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
8495  *         return getattr(self.memview, attr)
8496  *
8497  */
8498 
8499   /* function exit code */
8500   __pyx_L1_error:;
8501   __Pyx_XDECREF(__pyx_t_1);
8502   __Pyx_XDECREF(__pyx_t_2);
8503   __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8504   __pyx_r = NULL;
8505   __pyx_L0:;
8506   __Pyx_XGIVEREF(__pyx_r);
8507   __Pyx_RefNannyFinishContext();
8508   return __pyx_r;
8509 }
8510 
8511 /* "View.MemoryView":236
8512  *         return getattr(self.memview, attr)
8513  *
8514  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
8515  *         return self.memview[item]
8516  *
8517  */
8518 
8519 /* Python wrapper */
8520 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
__pyx_array___getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_item)8521 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
8522   PyObject *__pyx_r = 0;
8523   __Pyx_RefNannyDeclarations
8524   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
8525   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
8526 
8527   /* function exit code */
8528   __Pyx_RefNannyFinishContext();
8529   return __pyx_r;
8530 }
8531 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item)8532 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
8533   PyObject *__pyx_r = NULL;
8534   __Pyx_RefNannyDeclarations
8535   PyObject *__pyx_t_1 = NULL;
8536   PyObject *__pyx_t_2 = NULL;
8537   int __pyx_lineno = 0;
8538   const char *__pyx_filename = NULL;
8539   int __pyx_clineno = 0;
8540   __Pyx_RefNannySetupContext("__getitem__", 0);
8541 
8542   /* "View.MemoryView":237
8543  *
8544  *     def __getitem__(self, item):
8545  *         return self.memview[item]             # <<<<<<<<<<<<<<
8546  *
8547  *     def __setitem__(self, item, value):
8548  */
8549   __Pyx_XDECREF(__pyx_r);
8550   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error)
8551   __Pyx_GOTREF(__pyx_t_1);
8552   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error)
8553   __Pyx_GOTREF(__pyx_t_2);
8554   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8555   __pyx_r = __pyx_t_2;
8556   __pyx_t_2 = 0;
8557   goto __pyx_L0;
8558 
8559   /* "View.MemoryView":236
8560  *         return getattr(self.memview, attr)
8561  *
8562  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
8563  *         return self.memview[item]
8564  *
8565  */
8566 
8567   /* function exit code */
8568   __pyx_L1_error:;
8569   __Pyx_XDECREF(__pyx_t_1);
8570   __Pyx_XDECREF(__pyx_t_2);
8571   __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8572   __pyx_r = NULL;
8573   __pyx_L0:;
8574   __Pyx_XGIVEREF(__pyx_r);
8575   __Pyx_RefNannyFinishContext();
8576   return __pyx_r;
8577 }
8578 
8579 /* "View.MemoryView":239
8580  *         return self.memview[item]
8581  *
8582  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
8583  *         self.memview[item] = value
8584  *
8585  */
8586 
8587 /* Python wrapper */
8588 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
__pyx_array___setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_item,PyObject * __pyx_v_value)8589 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
8590   int __pyx_r;
8591   __Pyx_RefNannyDeclarations
8592   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
8593   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
8594 
8595   /* function exit code */
8596   __Pyx_RefNannyFinishContext();
8597   return __pyx_r;
8598 }
8599 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item,PyObject * __pyx_v_value)8600 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
8601   int __pyx_r;
8602   __Pyx_RefNannyDeclarations
8603   PyObject *__pyx_t_1 = NULL;
8604   int __pyx_lineno = 0;
8605   const char *__pyx_filename = NULL;
8606   int __pyx_clineno = 0;
8607   __Pyx_RefNannySetupContext("__setitem__", 0);
8608 
8609   /* "View.MemoryView":240
8610  *
8611  *     def __setitem__(self, item, value):
8612  *         self.memview[item] = value             # <<<<<<<<<<<<<<
8613  *
8614  *
8615  */
8616   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 240, __pyx_L1_error)
8617   __Pyx_GOTREF(__pyx_t_1);
8618   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error)
8619   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8620 
8621   /* "View.MemoryView":239
8622  *         return self.memview[item]
8623  *
8624  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
8625  *         self.memview[item] = value
8626  *
8627  */
8628 
8629   /* function exit code */
8630   __pyx_r = 0;
8631   goto __pyx_L0;
8632   __pyx_L1_error:;
8633   __Pyx_XDECREF(__pyx_t_1);
8634   __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8635   __pyx_r = -1;
8636   __pyx_L0:;
8637   __Pyx_RefNannyFinishContext();
8638   return __pyx_r;
8639 }
8640 
8641 /* "(tree fragment)":1
8642  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8643  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8644  * def __setstate_cython__(self, __pyx_state):
8645  */
8646 
8647 /* Python wrapper */
8648 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_array_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8649 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8650   PyObject *__pyx_r = 0;
8651   __Pyx_RefNannyDeclarations
8652   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8653   __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
8654 
8655   /* function exit code */
8656   __Pyx_RefNannyFinishContext();
8657   return __pyx_r;
8658 }
8659 
__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self)8660 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
8661   PyObject *__pyx_r = NULL;
8662   __Pyx_RefNannyDeclarations
8663   PyObject *__pyx_t_1 = NULL;
8664   int __pyx_lineno = 0;
8665   const char *__pyx_filename = NULL;
8666   int __pyx_clineno = 0;
8667   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8668 
8669   /* "(tree fragment)":2
8670  * def __reduce_cython__(self):
8671  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
8672  * def __setstate_cython__(self, __pyx_state):
8673  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8674  */
8675   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
8676   __Pyx_GOTREF(__pyx_t_1);
8677   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8678   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8679   __PYX_ERR(2, 2, __pyx_L1_error)
8680 
8681   /* "(tree fragment)":1
8682  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8683  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8684  * def __setstate_cython__(self, __pyx_state):
8685  */
8686 
8687   /* function exit code */
8688   __pyx_L1_error:;
8689   __Pyx_XDECREF(__pyx_t_1);
8690   __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8691   __pyx_r = NULL;
8692   __Pyx_XGIVEREF(__pyx_r);
8693   __Pyx_RefNannyFinishContext();
8694   return __pyx_r;
8695 }
8696 
8697 /* "(tree fragment)":3
8698  * def __reduce_cython__(self):
8699  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8700  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8701  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8702  */
8703 
8704 /* Python wrapper */
8705 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_array_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)8706 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8707   PyObject *__pyx_r = 0;
8708   __Pyx_RefNannyDeclarations
8709   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8710   __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8711 
8712   /* function exit code */
8713   __Pyx_RefNannyFinishContext();
8714   return __pyx_r;
8715 }
8716 
__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)8717 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
8718   PyObject *__pyx_r = NULL;
8719   __Pyx_RefNannyDeclarations
8720   PyObject *__pyx_t_1 = NULL;
8721   int __pyx_lineno = 0;
8722   const char *__pyx_filename = NULL;
8723   int __pyx_clineno = 0;
8724   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8725 
8726   /* "(tree fragment)":4
8727  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8728  * def __setstate_cython__(self, __pyx_state):
8729  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
8730  */
8731   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
8732   __Pyx_GOTREF(__pyx_t_1);
8733   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8734   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8735   __PYX_ERR(2, 4, __pyx_L1_error)
8736 
8737   /* "(tree fragment)":3
8738  * def __reduce_cython__(self):
8739  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8740  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8741  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8742  */
8743 
8744   /* function exit code */
8745   __pyx_L1_error:;
8746   __Pyx_XDECREF(__pyx_t_1);
8747   __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8748   __pyx_r = NULL;
8749   __Pyx_XGIVEREF(__pyx_r);
8750   __Pyx_RefNannyFinishContext();
8751   return __pyx_r;
8752 }
8753 
8754 /* "View.MemoryView":244
8755  *
8756  * @cname("__pyx_array_new")
8757  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
8758  *                           char *mode, char *buf):
8759  *     cdef array result
8760  */
8761 
__pyx_array_new(PyObject * __pyx_v_shape,Py_ssize_t __pyx_v_itemsize,char * __pyx_v_format,char * __pyx_v_mode,char * __pyx_v_buf)8762 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
8763   struct __pyx_array_obj *__pyx_v_result = 0;
8764   struct __pyx_array_obj *__pyx_r = NULL;
8765   __Pyx_RefNannyDeclarations
8766   int __pyx_t_1;
8767   PyObject *__pyx_t_2 = NULL;
8768   PyObject *__pyx_t_3 = NULL;
8769   PyObject *__pyx_t_4 = NULL;
8770   PyObject *__pyx_t_5 = NULL;
8771   int __pyx_lineno = 0;
8772   const char *__pyx_filename = NULL;
8773   int __pyx_clineno = 0;
8774   __Pyx_RefNannySetupContext("array_cwrapper", 0);
8775 
8776   /* "View.MemoryView":248
8777  *     cdef array result
8778  *
8779  *     if buf == NULL:             # <<<<<<<<<<<<<<
8780  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8781  *     else:
8782  */
8783   __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
8784   if (__pyx_t_1) {
8785 
8786     /* "View.MemoryView":249
8787  *
8788  *     if buf == NULL:
8789  *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
8790  *     else:
8791  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
8792  */
8793     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
8794     __Pyx_GOTREF(__pyx_t_2);
8795     __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error)
8796     __Pyx_GOTREF(__pyx_t_3);
8797     __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
8798     __Pyx_GOTREF(__pyx_t_4);
8799     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
8800     __Pyx_GOTREF(__pyx_t_5);
8801     __Pyx_INCREF(__pyx_v_shape);
8802     __Pyx_GIVEREF(__pyx_v_shape);
8803     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
8804     __Pyx_GIVEREF(__pyx_t_2);
8805     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
8806     __Pyx_GIVEREF(__pyx_t_3);
8807     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
8808     __Pyx_GIVEREF(__pyx_t_4);
8809     PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
8810     __pyx_t_2 = 0;
8811     __pyx_t_3 = 0;
8812     __pyx_t_4 = 0;
8813     __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
8814     __Pyx_GOTREF(__pyx_t_4);
8815     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8816     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
8817     __pyx_t_4 = 0;
8818 
8819     /* "View.MemoryView":248
8820  *     cdef array result
8821  *
8822  *     if buf == NULL:             # <<<<<<<<<<<<<<
8823  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8824  *     else:
8825  */
8826     goto __pyx_L3;
8827   }
8828 
8829   /* "View.MemoryView":251
8830  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8831  *     else:
8832  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
8833  *                        allocate_buffer=False)
8834  *         result.data = buf
8835  */
8836   /*else*/ {
8837     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error)
8838     __Pyx_GOTREF(__pyx_t_4);
8839     __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
8840     __Pyx_GOTREF(__pyx_t_5);
8841     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 251, __pyx_L1_error)
8842     __Pyx_GOTREF(__pyx_t_3);
8843     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error)
8844     __Pyx_GOTREF(__pyx_t_2);
8845     __Pyx_INCREF(__pyx_v_shape);
8846     __Pyx_GIVEREF(__pyx_v_shape);
8847     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
8848     __Pyx_GIVEREF(__pyx_t_4);
8849     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
8850     __Pyx_GIVEREF(__pyx_t_5);
8851     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
8852     __Pyx_GIVEREF(__pyx_t_3);
8853     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
8854     __pyx_t_4 = 0;
8855     __pyx_t_5 = 0;
8856     __pyx_t_3 = 0;
8857 
8858     /* "View.MemoryView":252
8859  *     else:
8860  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
8861  *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
8862  *         result.data = buf
8863  *
8864  */
8865     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
8866     __Pyx_GOTREF(__pyx_t_3);
8867     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error)
8868 
8869     /* "View.MemoryView":251
8870  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8871  *     else:
8872  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
8873  *                        allocate_buffer=False)
8874  *         result.data = buf
8875  */
8876     __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
8877     __Pyx_GOTREF(__pyx_t_5);
8878     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8879     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8880     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
8881     __pyx_t_5 = 0;
8882 
8883     /* "View.MemoryView":253
8884  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
8885  *                        allocate_buffer=False)
8886  *         result.data = buf             # <<<<<<<<<<<<<<
8887  *
8888  *     return result
8889  */
8890     __pyx_v_result->data = __pyx_v_buf;
8891   }
8892   __pyx_L3:;
8893 
8894   /* "View.MemoryView":255
8895  *         result.data = buf
8896  *
8897  *     return result             # <<<<<<<<<<<<<<
8898  *
8899  *
8900  */
8901   __Pyx_XDECREF(((PyObject *)__pyx_r));
8902   __Pyx_INCREF(((PyObject *)__pyx_v_result));
8903   __pyx_r = __pyx_v_result;
8904   goto __pyx_L0;
8905 
8906   /* "View.MemoryView":244
8907  *
8908  * @cname("__pyx_array_new")
8909  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
8910  *                           char *mode, char *buf):
8911  *     cdef array result
8912  */
8913 
8914   /* function exit code */
8915   __pyx_L1_error:;
8916   __Pyx_XDECREF(__pyx_t_2);
8917   __Pyx_XDECREF(__pyx_t_3);
8918   __Pyx_XDECREF(__pyx_t_4);
8919   __Pyx_XDECREF(__pyx_t_5);
8920   __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
8921   __pyx_r = 0;
8922   __pyx_L0:;
8923   __Pyx_XDECREF((PyObject *)__pyx_v_result);
8924   __Pyx_XGIVEREF((PyObject *)__pyx_r);
8925   __Pyx_RefNannyFinishContext();
8926   return __pyx_r;
8927 }
8928 
8929 /* "View.MemoryView":281
8930  * cdef class Enum(object):
8931  *     cdef object name
8932  *     def __init__(self, name):             # <<<<<<<<<<<<<<
8933  *         self.name = name
8934  *     def __repr__(self):
8935  */
8936 
8937 /* Python wrapper */
8938 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_MemviewEnum___init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8939 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8940   PyObject *__pyx_v_name = 0;
8941   int __pyx_lineno = 0;
8942   const char *__pyx_filename = NULL;
8943   int __pyx_clineno = 0;
8944   int __pyx_r;
8945   __Pyx_RefNannyDeclarations
8946   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
8947   {
8948     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
8949     PyObject* values[1] = {0};
8950     if (unlikely(__pyx_kwds)) {
8951       Py_ssize_t kw_args;
8952       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8953       switch (pos_args) {
8954         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8955         CYTHON_FALLTHROUGH;
8956         case  0: break;
8957         default: goto __pyx_L5_argtuple_error;
8958       }
8959       kw_args = PyDict_Size(__pyx_kwds);
8960       switch (pos_args) {
8961         case  0:
8962         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
8963         else goto __pyx_L5_argtuple_error;
8964       }
8965       if (unlikely(kw_args > 0)) {
8966         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error)
8967       }
8968     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
8969       goto __pyx_L5_argtuple_error;
8970     } else {
8971       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8972     }
8973     __pyx_v_name = values[0];
8974   }
8975   goto __pyx_L4_argument_unpacking_done;
8976   __pyx_L5_argtuple_error:;
8977   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error)
8978   __pyx_L3_error:;
8979   __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8980   __Pyx_RefNannyFinishContext();
8981   return -1;
8982   __pyx_L4_argument_unpacking_done:;
8983   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
8984 
8985   /* function exit code */
8986   __Pyx_RefNannyFinishContext();
8987   return __pyx_r;
8988 }
8989 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v_name)8990 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
8991   int __pyx_r;
8992   __Pyx_RefNannyDeclarations
8993   __Pyx_RefNannySetupContext("__init__", 0);
8994 
8995   /* "View.MemoryView":282
8996  *     cdef object name
8997  *     def __init__(self, name):
8998  *         self.name = name             # <<<<<<<<<<<<<<
8999  *     def __repr__(self):
9000  *         return self.name
9001  */
9002   __Pyx_INCREF(__pyx_v_name);
9003   __Pyx_GIVEREF(__pyx_v_name);
9004   __Pyx_GOTREF(__pyx_v_self->name);
9005   __Pyx_DECREF(__pyx_v_self->name);
9006   __pyx_v_self->name = __pyx_v_name;
9007 
9008   /* "View.MemoryView":281
9009  * cdef class Enum(object):
9010  *     cdef object name
9011  *     def __init__(self, name):             # <<<<<<<<<<<<<<
9012  *         self.name = name
9013  *     def __repr__(self):
9014  */
9015 
9016   /* function exit code */
9017   __pyx_r = 0;
9018   __Pyx_RefNannyFinishContext();
9019   return __pyx_r;
9020 }
9021 
9022 /* "View.MemoryView":283
9023  *     def __init__(self, name):
9024  *         self.name = name
9025  *     def __repr__(self):             # <<<<<<<<<<<<<<
9026  *         return self.name
9027  *
9028  */
9029 
9030 /* Python wrapper */
9031 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_MemviewEnum___repr__(PyObject * __pyx_v_self)9032 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
9033   PyObject *__pyx_r = 0;
9034   __Pyx_RefNannyDeclarations
9035   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
9036   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
9037 
9038   /* function exit code */
9039   __Pyx_RefNannyFinishContext();
9040   return __pyx_r;
9041 }
9042 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj * __pyx_v_self)9043 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
9044   PyObject *__pyx_r = NULL;
9045   __Pyx_RefNannyDeclarations
9046   __Pyx_RefNannySetupContext("__repr__", 0);
9047 
9048   /* "View.MemoryView":284
9049  *         self.name = name
9050  *     def __repr__(self):
9051  *         return self.name             # <<<<<<<<<<<<<<
9052  *
9053  * cdef generic = Enum("<strided and direct or indirect>")
9054  */
9055   __Pyx_XDECREF(__pyx_r);
9056   __Pyx_INCREF(__pyx_v_self->name);
9057   __pyx_r = __pyx_v_self->name;
9058   goto __pyx_L0;
9059 
9060   /* "View.MemoryView":283
9061  *     def __init__(self, name):
9062  *         self.name = name
9063  *     def __repr__(self):             # <<<<<<<<<<<<<<
9064  *         return self.name
9065  *
9066  */
9067 
9068   /* function exit code */
9069   __pyx_L0:;
9070   __Pyx_XGIVEREF(__pyx_r);
9071   __Pyx_RefNannyFinishContext();
9072   return __pyx_r;
9073 }
9074 
9075 /* "(tree fragment)":1
9076  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
9077  *     cdef tuple state
9078  *     cdef object _dict
9079  */
9080 
9081 /* Python wrapper */
9082 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)9083 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9084   PyObject *__pyx_r = 0;
9085   __Pyx_RefNannyDeclarations
9086   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
9087   __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
9088 
9089   /* function exit code */
9090   __Pyx_RefNannyFinishContext();
9091   return __pyx_r;
9092 }
9093 
__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self)9094 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
9095   PyObject *__pyx_v_state = 0;
9096   PyObject *__pyx_v__dict = 0;
9097   int __pyx_v_use_setstate;
9098   PyObject *__pyx_r = NULL;
9099   __Pyx_RefNannyDeclarations
9100   PyObject *__pyx_t_1 = NULL;
9101   int __pyx_t_2;
9102   int __pyx_t_3;
9103   PyObject *__pyx_t_4 = NULL;
9104   PyObject *__pyx_t_5 = NULL;
9105   int __pyx_lineno = 0;
9106   const char *__pyx_filename = NULL;
9107   int __pyx_clineno = 0;
9108   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
9109 
9110   /* "(tree fragment)":5
9111  *     cdef object _dict
9112  *     cdef bint use_setstate
9113  *     state = (self.name,)             # <<<<<<<<<<<<<<
9114  *     _dict = getattr(self, '__dict__', None)
9115  *     if _dict is not None:
9116  */
9117   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
9118   __Pyx_GOTREF(__pyx_t_1);
9119   __Pyx_INCREF(__pyx_v_self->name);
9120   __Pyx_GIVEREF(__pyx_v_self->name);
9121   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
9122   __pyx_v_state = ((PyObject*)__pyx_t_1);
9123   __pyx_t_1 = 0;
9124 
9125   /* "(tree fragment)":6
9126  *     cdef bint use_setstate
9127  *     state = (self.name,)
9128  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
9129  *     if _dict is not None:
9130  *         state += (_dict,)
9131  */
9132   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
9133   __Pyx_GOTREF(__pyx_t_1);
9134   __pyx_v__dict = __pyx_t_1;
9135   __pyx_t_1 = 0;
9136 
9137   /* "(tree fragment)":7
9138  *     state = (self.name,)
9139  *     _dict = getattr(self, '__dict__', None)
9140  *     if _dict is not None:             # <<<<<<<<<<<<<<
9141  *         state += (_dict,)
9142  *         use_setstate = True
9143  */
9144   __pyx_t_2 = (__pyx_v__dict != Py_None);
9145   __pyx_t_3 = (__pyx_t_2 != 0);
9146   if (__pyx_t_3) {
9147 
9148     /* "(tree fragment)":8
9149  *     _dict = getattr(self, '__dict__', None)
9150  *     if _dict is not None:
9151  *         state += (_dict,)             # <<<<<<<<<<<<<<
9152  *         use_setstate = True
9153  *     else:
9154  */
9155     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
9156     __Pyx_GOTREF(__pyx_t_1);
9157     __Pyx_INCREF(__pyx_v__dict);
9158     __Pyx_GIVEREF(__pyx_v__dict);
9159     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
9160     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
9161     __Pyx_GOTREF(__pyx_t_4);
9162     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9163     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
9164     __pyx_t_4 = 0;
9165 
9166     /* "(tree fragment)":9
9167  *     if _dict is not None:
9168  *         state += (_dict,)
9169  *         use_setstate = True             # <<<<<<<<<<<<<<
9170  *     else:
9171  *         use_setstate = self.name is not None
9172  */
9173     __pyx_v_use_setstate = 1;
9174 
9175     /* "(tree fragment)":7
9176  *     state = (self.name,)
9177  *     _dict = getattr(self, '__dict__', None)
9178  *     if _dict is not None:             # <<<<<<<<<<<<<<
9179  *         state += (_dict,)
9180  *         use_setstate = True
9181  */
9182     goto __pyx_L3;
9183   }
9184 
9185   /* "(tree fragment)":11
9186  *         use_setstate = True
9187  *     else:
9188  *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
9189  *     if use_setstate:
9190  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
9191  */
9192   /*else*/ {
9193     __pyx_t_3 = (__pyx_v_self->name != Py_None);
9194     __pyx_v_use_setstate = __pyx_t_3;
9195   }
9196   __pyx_L3:;
9197 
9198   /* "(tree fragment)":12
9199  *     else:
9200  *         use_setstate = self.name is not None
9201  *     if use_setstate:             # <<<<<<<<<<<<<<
9202  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
9203  *     else:
9204  */
9205   __pyx_t_3 = (__pyx_v_use_setstate != 0);
9206   if (__pyx_t_3) {
9207 
9208     /* "(tree fragment)":13
9209  *         use_setstate = self.name is not None
9210  *     if use_setstate:
9211  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
9212  *     else:
9213  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9214  */
9215     __Pyx_XDECREF(__pyx_r);
9216     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
9217     __Pyx_GOTREF(__pyx_t_4);
9218     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
9219     __Pyx_GOTREF(__pyx_t_1);
9220     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9221     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9222     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9223     __Pyx_INCREF(__pyx_int_184977713);
9224     __Pyx_GIVEREF(__pyx_int_184977713);
9225     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
9226     __Pyx_INCREF(Py_None);
9227     __Pyx_GIVEREF(Py_None);
9228     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
9229     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
9230     __Pyx_GOTREF(__pyx_t_5);
9231     __Pyx_GIVEREF(__pyx_t_4);
9232     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
9233     __Pyx_GIVEREF(__pyx_t_1);
9234     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
9235     __Pyx_INCREF(__pyx_v_state);
9236     __Pyx_GIVEREF(__pyx_v_state);
9237     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
9238     __pyx_t_4 = 0;
9239     __pyx_t_1 = 0;
9240     __pyx_r = __pyx_t_5;
9241     __pyx_t_5 = 0;
9242     goto __pyx_L0;
9243 
9244     /* "(tree fragment)":12
9245  *     else:
9246  *         use_setstate = self.name is not None
9247  *     if use_setstate:             # <<<<<<<<<<<<<<
9248  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
9249  *     else:
9250  */
9251   }
9252 
9253   /* "(tree fragment)":15
9254  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
9255  *     else:
9256  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
9257  * def __setstate_cython__(self, __pyx_state):
9258  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
9259  */
9260   /*else*/ {
9261     __Pyx_XDECREF(__pyx_r);
9262     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
9263     __Pyx_GOTREF(__pyx_t_5);
9264     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
9265     __Pyx_GOTREF(__pyx_t_1);
9266     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9267     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9268     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9269     __Pyx_INCREF(__pyx_int_184977713);
9270     __Pyx_GIVEREF(__pyx_int_184977713);
9271     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
9272     __Pyx_INCREF(__pyx_v_state);
9273     __Pyx_GIVEREF(__pyx_v_state);
9274     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
9275     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
9276     __Pyx_GOTREF(__pyx_t_4);
9277     __Pyx_GIVEREF(__pyx_t_5);
9278     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
9279     __Pyx_GIVEREF(__pyx_t_1);
9280     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
9281     __pyx_t_5 = 0;
9282     __pyx_t_1 = 0;
9283     __pyx_r = __pyx_t_4;
9284     __pyx_t_4 = 0;
9285     goto __pyx_L0;
9286   }
9287 
9288   /* "(tree fragment)":1
9289  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
9290  *     cdef tuple state
9291  *     cdef object _dict
9292  */
9293 
9294   /* function exit code */
9295   __pyx_L1_error:;
9296   __Pyx_XDECREF(__pyx_t_1);
9297   __Pyx_XDECREF(__pyx_t_4);
9298   __Pyx_XDECREF(__pyx_t_5);
9299   __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9300   __pyx_r = NULL;
9301   __pyx_L0:;
9302   __Pyx_XDECREF(__pyx_v_state);
9303   __Pyx_XDECREF(__pyx_v__dict);
9304   __Pyx_XGIVEREF(__pyx_r);
9305   __Pyx_RefNannyFinishContext();
9306   return __pyx_r;
9307 }
9308 
9309 /* "(tree fragment)":16
9310  *     else:
9311  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9312  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
9313  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
9314  */
9315 
9316 /* Python wrapper */
9317 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)9318 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9319   PyObject *__pyx_r = 0;
9320   __Pyx_RefNannyDeclarations
9321   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
9322   __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
9323 
9324   /* function exit code */
9325   __Pyx_RefNannyFinishContext();
9326   return __pyx_r;
9327 }
9328 
__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v___pyx_state)9329 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9330   PyObject *__pyx_r = NULL;
9331   __Pyx_RefNannyDeclarations
9332   PyObject *__pyx_t_1 = NULL;
9333   int __pyx_lineno = 0;
9334   const char *__pyx_filename = NULL;
9335   int __pyx_clineno = 0;
9336   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
9337 
9338   /* "(tree fragment)":17
9339  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9340  * def __setstate_cython__(self, __pyx_state):
9341  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
9342  */
9343   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error)
9344   __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
9345   __Pyx_GOTREF(__pyx_t_1);
9346   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9347 
9348   /* "(tree fragment)":16
9349  *     else:
9350  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9351  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
9352  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
9353  */
9354 
9355   /* function exit code */
9356   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9357   goto __pyx_L0;
9358   __pyx_L1_error:;
9359   __Pyx_XDECREF(__pyx_t_1);
9360   __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9361   __pyx_r = NULL;
9362   __pyx_L0:;
9363   __Pyx_XGIVEREF(__pyx_r);
9364   __Pyx_RefNannyFinishContext();
9365   return __pyx_r;
9366 }
9367 
9368 /* "View.MemoryView":298
9369  *
9370  * @cname('__pyx_align_pointer')
9371  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
9372  *     "Align pointer memory on a given boundary"
9373  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
9374  */
9375 
__pyx_align_pointer(void * __pyx_v_memory,size_t __pyx_v_alignment)9376 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
9377   Py_intptr_t __pyx_v_aligned_p;
9378   size_t __pyx_v_offset;
9379   void *__pyx_r;
9380   int __pyx_t_1;
9381 
9382   /* "View.MemoryView":300
9383  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
9384  *     "Align pointer memory on a given boundary"
9385  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
9386  *     cdef size_t offset
9387  *
9388  */
9389   __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
9390 
9391   /* "View.MemoryView":304
9392  *
9393  *     with cython.cdivision(True):
9394  *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
9395  *
9396  *     if offset > 0:
9397  */
9398   __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
9399 
9400   /* "View.MemoryView":306
9401  *         offset = aligned_p % alignment
9402  *
9403  *     if offset > 0:             # <<<<<<<<<<<<<<
9404  *         aligned_p += alignment - offset
9405  *
9406  */
9407   __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
9408   if (__pyx_t_1) {
9409 
9410     /* "View.MemoryView":307
9411  *
9412  *     if offset > 0:
9413  *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
9414  *
9415  *     return <void *> aligned_p
9416  */
9417     __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
9418 
9419     /* "View.MemoryView":306
9420  *         offset = aligned_p % alignment
9421  *
9422  *     if offset > 0:             # <<<<<<<<<<<<<<
9423  *         aligned_p += alignment - offset
9424  *
9425  */
9426   }
9427 
9428   /* "View.MemoryView":309
9429  *         aligned_p += alignment - offset
9430  *
9431  *     return <void *> aligned_p             # <<<<<<<<<<<<<<
9432  *
9433  *
9434  */
9435   __pyx_r = ((void *)__pyx_v_aligned_p);
9436   goto __pyx_L0;
9437 
9438   /* "View.MemoryView":298
9439  *
9440  * @cname('__pyx_align_pointer')
9441  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
9442  *     "Align pointer memory on a given boundary"
9443  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
9444  */
9445 
9446   /* function exit code */
9447   __pyx_L0:;
9448   return __pyx_r;
9449 }
9450 
9451 /* "View.MemoryView":345
9452  *     cdef __Pyx_TypeInfo *typeinfo
9453  *
9454  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
9455  *         self.obj = obj
9456  *         self.flags = flags
9457  */
9458 
9459 /* Python wrapper */
9460 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_memoryview___cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)9461 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9462   PyObject *__pyx_v_obj = 0;
9463   int __pyx_v_flags;
9464   int __pyx_v_dtype_is_object;
9465   int __pyx_lineno = 0;
9466   const char *__pyx_filename = NULL;
9467   int __pyx_clineno = 0;
9468   int __pyx_r;
9469   __Pyx_RefNannyDeclarations
9470   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
9471   {
9472     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
9473     PyObject* values[3] = {0,0,0};
9474     if (unlikely(__pyx_kwds)) {
9475       Py_ssize_t kw_args;
9476       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9477       switch (pos_args) {
9478         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9479         CYTHON_FALLTHROUGH;
9480         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9481         CYTHON_FALLTHROUGH;
9482         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9483         CYTHON_FALLTHROUGH;
9484         case  0: break;
9485         default: goto __pyx_L5_argtuple_error;
9486       }
9487       kw_args = PyDict_Size(__pyx_kwds);
9488       switch (pos_args) {
9489         case  0:
9490         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
9491         else goto __pyx_L5_argtuple_error;
9492         CYTHON_FALLTHROUGH;
9493         case  1:
9494         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
9495         else {
9496           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
9497         }
9498         CYTHON_FALLTHROUGH;
9499         case  2:
9500         if (kw_args > 0) {
9501           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
9502           if (value) { values[2] = value; kw_args--; }
9503         }
9504       }
9505       if (unlikely(kw_args > 0)) {
9506         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error)
9507       }
9508     } else {
9509       switch (PyTuple_GET_SIZE(__pyx_args)) {
9510         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9511         CYTHON_FALLTHROUGH;
9512         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9513         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9514         break;
9515         default: goto __pyx_L5_argtuple_error;
9516       }
9517     }
9518     __pyx_v_obj = values[0];
9519     __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
9520     if (values[2]) {
9521       __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
9522     } else {
9523       __pyx_v_dtype_is_object = ((int)0);
9524     }
9525   }
9526   goto __pyx_L4_argument_unpacking_done;
9527   __pyx_L5_argtuple_error:;
9528   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error)
9529   __pyx_L3_error:;
9530   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9531   __Pyx_RefNannyFinishContext();
9532   return -1;
9533   __pyx_L4_argument_unpacking_done:;
9534   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
9535 
9536   /* function exit code */
9537   __Pyx_RefNannyFinishContext();
9538   return __pyx_r;
9539 }
9540 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj,int __pyx_v_flags,int __pyx_v_dtype_is_object)9541 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
9542   int __pyx_r;
9543   __Pyx_RefNannyDeclarations
9544   int __pyx_t_1;
9545   int __pyx_t_2;
9546   int __pyx_t_3;
9547   int __pyx_t_4;
9548   int __pyx_lineno = 0;
9549   const char *__pyx_filename = NULL;
9550   int __pyx_clineno = 0;
9551   __Pyx_RefNannySetupContext("__cinit__", 0);
9552 
9553   /* "View.MemoryView":346
9554  *
9555  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
9556  *         self.obj = obj             # <<<<<<<<<<<<<<
9557  *         self.flags = flags
9558  *         if type(self) is memoryview or obj is not None:
9559  */
9560   __Pyx_INCREF(__pyx_v_obj);
9561   __Pyx_GIVEREF(__pyx_v_obj);
9562   __Pyx_GOTREF(__pyx_v_self->obj);
9563   __Pyx_DECREF(__pyx_v_self->obj);
9564   __pyx_v_self->obj = __pyx_v_obj;
9565 
9566   /* "View.MemoryView":347
9567  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
9568  *         self.obj = obj
9569  *         self.flags = flags             # <<<<<<<<<<<<<<
9570  *         if type(self) is memoryview or obj is not None:
9571  *             __Pyx_GetBuffer(obj, &self.view, flags)
9572  */
9573   __pyx_v_self->flags = __pyx_v_flags;
9574 
9575   /* "View.MemoryView":348
9576  *         self.obj = obj
9577  *         self.flags = flags
9578  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
9579  *             __Pyx_GetBuffer(obj, &self.view, flags)
9580  *             if <PyObject *> self.view.obj == NULL:
9581  */
9582   __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
9583   __pyx_t_3 = (__pyx_t_2 != 0);
9584   if (!__pyx_t_3) {
9585   } else {
9586     __pyx_t_1 = __pyx_t_3;
9587     goto __pyx_L4_bool_binop_done;
9588   }
9589   __pyx_t_3 = (__pyx_v_obj != Py_None);
9590   __pyx_t_2 = (__pyx_t_3 != 0);
9591   __pyx_t_1 = __pyx_t_2;
9592   __pyx_L4_bool_binop_done:;
9593   if (__pyx_t_1) {
9594 
9595     /* "View.MemoryView":349
9596  *         self.flags = flags
9597  *         if type(self) is memoryview or obj is not None:
9598  *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
9599  *             if <PyObject *> self.view.obj == NULL:
9600  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9601  */
9602     __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 349, __pyx_L1_error)
9603 
9604     /* "View.MemoryView":350
9605  *         if type(self) is memoryview or obj is not None:
9606  *             __Pyx_GetBuffer(obj, &self.view, flags)
9607  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
9608  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9609  *                 Py_INCREF(Py_None)
9610  */
9611     __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
9612     if (__pyx_t_1) {
9613 
9614       /* "View.MemoryView":351
9615  *             __Pyx_GetBuffer(obj, &self.view, flags)
9616  *             if <PyObject *> self.view.obj == NULL:
9617  *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
9618  *                 Py_INCREF(Py_None)
9619  *
9620  */
9621       ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
9622 
9623       /* "View.MemoryView":352
9624  *             if <PyObject *> self.view.obj == NULL:
9625  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9626  *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
9627  *
9628  *         global __pyx_memoryview_thread_locks_used
9629  */
9630       Py_INCREF(Py_None);
9631 
9632       /* "View.MemoryView":350
9633  *         if type(self) is memoryview or obj is not None:
9634  *             __Pyx_GetBuffer(obj, &self.view, flags)
9635  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
9636  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9637  *                 Py_INCREF(Py_None)
9638  */
9639     }
9640 
9641     /* "View.MemoryView":348
9642  *         self.obj = obj
9643  *         self.flags = flags
9644  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
9645  *             __Pyx_GetBuffer(obj, &self.view, flags)
9646  *             if <PyObject *> self.view.obj == NULL:
9647  */
9648   }
9649 
9650   /* "View.MemoryView":355
9651  *
9652  *         global __pyx_memoryview_thread_locks_used
9653  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
9654  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9655  *             __pyx_memoryview_thread_locks_used += 1
9656  */
9657   __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
9658   if (__pyx_t_1) {
9659 
9660     /* "View.MemoryView":356
9661  *         global __pyx_memoryview_thread_locks_used
9662  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
9663  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
9664  *             __pyx_memoryview_thread_locks_used += 1
9665  *         if self.lock is NULL:
9666  */
9667     __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
9668 
9669     /* "View.MemoryView":357
9670  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
9671  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9672  *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
9673  *         if self.lock is NULL:
9674  *             self.lock = PyThread_allocate_lock()
9675  */
9676     __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
9677 
9678     /* "View.MemoryView":355
9679  *
9680  *         global __pyx_memoryview_thread_locks_used
9681  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
9682  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9683  *             __pyx_memoryview_thread_locks_used += 1
9684  */
9685   }
9686 
9687   /* "View.MemoryView":358
9688  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9689  *             __pyx_memoryview_thread_locks_used += 1
9690  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
9691  *             self.lock = PyThread_allocate_lock()
9692  *             if self.lock is NULL:
9693  */
9694   __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
9695   if (__pyx_t_1) {
9696 
9697     /* "View.MemoryView":359
9698  *             __pyx_memoryview_thread_locks_used += 1
9699  *         if self.lock is NULL:
9700  *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
9701  *             if self.lock is NULL:
9702  *                 raise MemoryError
9703  */
9704     __pyx_v_self->lock = PyThread_allocate_lock();
9705 
9706     /* "View.MemoryView":360
9707  *         if self.lock is NULL:
9708  *             self.lock = PyThread_allocate_lock()
9709  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
9710  *                 raise MemoryError
9711  *
9712  */
9713     __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
9714     if (unlikely(__pyx_t_1)) {
9715 
9716       /* "View.MemoryView":361
9717  *             self.lock = PyThread_allocate_lock()
9718  *             if self.lock is NULL:
9719  *                 raise MemoryError             # <<<<<<<<<<<<<<
9720  *
9721  *         if flags & PyBUF_FORMAT:
9722  */
9723       PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
9724 
9725       /* "View.MemoryView":360
9726  *         if self.lock is NULL:
9727  *             self.lock = PyThread_allocate_lock()
9728  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
9729  *                 raise MemoryError
9730  *
9731  */
9732     }
9733 
9734     /* "View.MemoryView":358
9735  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9736  *             __pyx_memoryview_thread_locks_used += 1
9737  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
9738  *             self.lock = PyThread_allocate_lock()
9739  *             if self.lock is NULL:
9740  */
9741   }
9742 
9743   /* "View.MemoryView":363
9744  *                 raise MemoryError
9745  *
9746  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
9747  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
9748  *         else:
9749  */
9750   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
9751   if (__pyx_t_1) {
9752 
9753     /* "View.MemoryView":364
9754  *
9755  *         if flags & PyBUF_FORMAT:
9756  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
9757  *         else:
9758  *             self.dtype_is_object = dtype_is_object
9759  */
9760     __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
9761     if (__pyx_t_2) {
9762     } else {
9763       __pyx_t_1 = __pyx_t_2;
9764       goto __pyx_L11_bool_binop_done;
9765     }
9766     __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
9767     __pyx_t_1 = __pyx_t_2;
9768     __pyx_L11_bool_binop_done:;
9769     __pyx_v_self->dtype_is_object = __pyx_t_1;
9770 
9771     /* "View.MemoryView":363
9772  *                 raise MemoryError
9773  *
9774  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
9775  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
9776  *         else:
9777  */
9778     goto __pyx_L10;
9779   }
9780 
9781   /* "View.MemoryView":366
9782  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
9783  *         else:
9784  *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
9785  *
9786  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
9787  */
9788   /*else*/ {
9789     __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
9790   }
9791   __pyx_L10:;
9792 
9793   /* "View.MemoryView":368
9794  *             self.dtype_is_object = dtype_is_object
9795  *
9796  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
9797  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
9798  *         self.typeinfo = NULL
9799  */
9800   __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
9801 
9802   /* "View.MemoryView":370
9803  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
9804  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
9805  *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
9806  *
9807  *     def __dealloc__(memoryview self):
9808  */
9809   __pyx_v_self->typeinfo = NULL;
9810 
9811   /* "View.MemoryView":345
9812  *     cdef __Pyx_TypeInfo *typeinfo
9813  *
9814  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
9815  *         self.obj = obj
9816  *         self.flags = flags
9817  */
9818 
9819   /* function exit code */
9820   __pyx_r = 0;
9821   goto __pyx_L0;
9822   __pyx_L1_error:;
9823   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9824   __pyx_r = -1;
9825   __pyx_L0:;
9826   __Pyx_RefNannyFinishContext();
9827   return __pyx_r;
9828 }
9829 
9830 /* "View.MemoryView":372
9831  *         self.typeinfo = NULL
9832  *
9833  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
9834  *         if self.obj is not None:
9835  *             __Pyx_ReleaseBuffer(&self.view)
9836  */
9837 
9838 /* Python wrapper */
9839 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___dealloc__(PyObject * __pyx_v_self)9840 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
9841   __Pyx_RefNannyDeclarations
9842   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
9843   __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
9844 
9845   /* function exit code */
9846   __Pyx_RefNannyFinishContext();
9847 }
9848 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj * __pyx_v_self)9849 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
9850   int __pyx_v_i;
9851   __Pyx_RefNannyDeclarations
9852   int __pyx_t_1;
9853   int __pyx_t_2;
9854   int __pyx_t_3;
9855   int __pyx_t_4;
9856   int __pyx_t_5;
9857   PyThread_type_lock __pyx_t_6;
9858   PyThread_type_lock __pyx_t_7;
9859   __Pyx_RefNannySetupContext("__dealloc__", 0);
9860 
9861   /* "View.MemoryView":373
9862  *
9863  *     def __dealloc__(memoryview self):
9864  *         if self.obj is not None:             # <<<<<<<<<<<<<<
9865  *             __Pyx_ReleaseBuffer(&self.view)
9866  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
9867  */
9868   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
9869   __pyx_t_2 = (__pyx_t_1 != 0);
9870   if (__pyx_t_2) {
9871 
9872     /* "View.MemoryView":374
9873  *     def __dealloc__(memoryview self):
9874  *         if self.obj is not None:
9875  *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
9876  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
9877  *
9878  */
9879     __Pyx_ReleaseBuffer((&__pyx_v_self->view));
9880 
9881     /* "View.MemoryView":373
9882  *
9883  *     def __dealloc__(memoryview self):
9884  *         if self.obj is not None:             # <<<<<<<<<<<<<<
9885  *             __Pyx_ReleaseBuffer(&self.view)
9886  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
9887  */
9888     goto __pyx_L3;
9889   }
9890 
9891   /* "View.MemoryView":375
9892  *         if self.obj is not None:
9893  *             __Pyx_ReleaseBuffer(&self.view)
9894  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
9895  *
9896  *             (<__pyx_buffer *> &self.view).obj = NULL
9897  */
9898   __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
9899   if (__pyx_t_2) {
9900 
9901     /* "View.MemoryView":377
9902  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
9903  *
9904  *             (<__pyx_buffer *> &self.view).obj = NULL             # <<<<<<<<<<<<<<
9905  *             Py_DECREF(Py_None)
9906  *
9907  */
9908     ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
9909 
9910     /* "View.MemoryView":378
9911  *
9912  *             (<__pyx_buffer *> &self.view).obj = NULL
9913  *             Py_DECREF(Py_None)             # <<<<<<<<<<<<<<
9914  *
9915  *         cdef int i
9916  */
9917     Py_DECREF(Py_None);
9918 
9919     /* "View.MemoryView":375
9920  *         if self.obj is not None:
9921  *             __Pyx_ReleaseBuffer(&self.view)
9922  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
9923  *
9924  *             (<__pyx_buffer *> &self.view).obj = NULL
9925  */
9926   }
9927   __pyx_L3:;
9928 
9929   /* "View.MemoryView":382
9930  *         cdef int i
9931  *         global __pyx_memoryview_thread_locks_used
9932  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
9933  *             for i in range(__pyx_memoryview_thread_locks_used):
9934  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9935  */
9936   __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
9937   if (__pyx_t_2) {
9938 
9939     /* "View.MemoryView":383
9940  *         global __pyx_memoryview_thread_locks_used
9941  *         if self.lock != NULL:
9942  *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
9943  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9944  *                     __pyx_memoryview_thread_locks_used -= 1
9945  */
9946     __pyx_t_3 = __pyx_memoryview_thread_locks_used;
9947     __pyx_t_4 = __pyx_t_3;
9948     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
9949       __pyx_v_i = __pyx_t_5;
9950 
9951       /* "View.MemoryView":384
9952  *         if self.lock != NULL:
9953  *             for i in range(__pyx_memoryview_thread_locks_used):
9954  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
9955  *                     __pyx_memoryview_thread_locks_used -= 1
9956  *                     if i != __pyx_memoryview_thread_locks_used:
9957  */
9958       __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
9959       if (__pyx_t_2) {
9960 
9961         /* "View.MemoryView":385
9962  *             for i in range(__pyx_memoryview_thread_locks_used):
9963  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9964  *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
9965  *                     if i != __pyx_memoryview_thread_locks_used:
9966  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9967  */
9968         __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
9969 
9970         /* "View.MemoryView":386
9971  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9972  *                     __pyx_memoryview_thread_locks_used -= 1
9973  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
9974  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9975  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
9976  */
9977         __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
9978         if (__pyx_t_2) {
9979 
9980           /* "View.MemoryView":388
9981  *                     if i != __pyx_memoryview_thread_locks_used:
9982  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9983  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
9984  *                     break
9985  *             else:
9986  */
9987           __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
9988           __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
9989 
9990           /* "View.MemoryView":387
9991  *                     __pyx_memoryview_thread_locks_used -= 1
9992  *                     if i != __pyx_memoryview_thread_locks_used:
9993  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
9994  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
9995  *                     break
9996  */
9997           (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
9998           (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
9999 
10000           /* "View.MemoryView":386
10001  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
10002  *                     __pyx_memoryview_thread_locks_used -= 1
10003  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
10004  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
10005  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
10006  */
10007         }
10008 
10009         /* "View.MemoryView":389
10010  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
10011  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
10012  *                     break             # <<<<<<<<<<<<<<
10013  *             else:
10014  *                 PyThread_free_lock(self.lock)
10015  */
10016         goto __pyx_L6_break;
10017 
10018         /* "View.MemoryView":384
10019  *         if self.lock != NULL:
10020  *             for i in range(__pyx_memoryview_thread_locks_used):
10021  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
10022  *                     __pyx_memoryview_thread_locks_used -= 1
10023  *                     if i != __pyx_memoryview_thread_locks_used:
10024  */
10025       }
10026     }
10027     /*else*/ {
10028 
10029       /* "View.MemoryView":391
10030  *                     break
10031  *             else:
10032  *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
10033  *
10034  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
10035  */
10036       PyThread_free_lock(__pyx_v_self->lock);
10037     }
10038     __pyx_L6_break:;
10039 
10040     /* "View.MemoryView":382
10041  *         cdef int i
10042  *         global __pyx_memoryview_thread_locks_used
10043  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
10044  *             for i in range(__pyx_memoryview_thread_locks_used):
10045  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
10046  */
10047   }
10048 
10049   /* "View.MemoryView":372
10050  *         self.typeinfo = NULL
10051  *
10052  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
10053  *         if self.obj is not None:
10054  *             __Pyx_ReleaseBuffer(&self.view)
10055  */
10056 
10057   /* function exit code */
10058   __Pyx_RefNannyFinishContext();
10059 }
10060 
10061 /* "View.MemoryView":393
10062  *                 PyThread_free_lock(self.lock)
10063  *
10064  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
10065  *         cdef Py_ssize_t dim
10066  *         cdef char *itemp = <char *> self.view.buf
10067  */
10068 
__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)10069 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
10070   Py_ssize_t __pyx_v_dim;
10071   char *__pyx_v_itemp;
10072   PyObject *__pyx_v_idx = NULL;
10073   char *__pyx_r;
10074   __Pyx_RefNannyDeclarations
10075   Py_ssize_t __pyx_t_1;
10076   PyObject *__pyx_t_2 = NULL;
10077   Py_ssize_t __pyx_t_3;
10078   PyObject *(*__pyx_t_4)(PyObject *);
10079   PyObject *__pyx_t_5 = NULL;
10080   Py_ssize_t __pyx_t_6;
10081   char *__pyx_t_7;
10082   int __pyx_lineno = 0;
10083   const char *__pyx_filename = NULL;
10084   int __pyx_clineno = 0;
10085   __Pyx_RefNannySetupContext("get_item_pointer", 0);
10086 
10087   /* "View.MemoryView":395
10088  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
10089  *         cdef Py_ssize_t dim
10090  *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
10091  *
10092  *         for dim, idx in enumerate(index):
10093  */
10094   __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
10095 
10096   /* "View.MemoryView":397
10097  *         cdef char *itemp = <char *> self.view.buf
10098  *
10099  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
10100  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
10101  *
10102  */
10103   __pyx_t_1 = 0;
10104   if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
10105     __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
10106     __pyx_t_4 = NULL;
10107   } else {
10108     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error)
10109     __Pyx_GOTREF(__pyx_t_2);
10110     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error)
10111   }
10112   for (;;) {
10113     if (likely(!__pyx_t_4)) {
10114       if (likely(PyList_CheckExact(__pyx_t_2))) {
10115         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
10116         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10117         __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
10118         #else
10119         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
10120         __Pyx_GOTREF(__pyx_t_5);
10121         #endif
10122       } else {
10123         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
10124         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10125         __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
10126         #else
10127         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
10128         __Pyx_GOTREF(__pyx_t_5);
10129         #endif
10130       }
10131     } else {
10132       __pyx_t_5 = __pyx_t_4(__pyx_t_2);
10133       if (unlikely(!__pyx_t_5)) {
10134         PyObject* exc_type = PyErr_Occurred();
10135         if (exc_type) {
10136           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
10137           else __PYX_ERR(2, 397, __pyx_L1_error)
10138         }
10139         break;
10140       }
10141       __Pyx_GOTREF(__pyx_t_5);
10142     }
10143     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
10144     __pyx_t_5 = 0;
10145     __pyx_v_dim = __pyx_t_1;
10146     __pyx_t_1 = (__pyx_t_1 + 1);
10147 
10148     /* "View.MemoryView":398
10149  *
10150  *         for dim, idx in enumerate(index):
10151  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
10152  *
10153  *         return itemp
10154  */
10155     __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 398, __pyx_L1_error)
10156     __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 398, __pyx_L1_error)
10157     __pyx_v_itemp = __pyx_t_7;
10158 
10159     /* "View.MemoryView":397
10160  *         cdef char *itemp = <char *> self.view.buf
10161  *
10162  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
10163  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
10164  *
10165  */
10166   }
10167   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10168 
10169   /* "View.MemoryView":400
10170  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
10171  *
10172  *         return itemp             # <<<<<<<<<<<<<<
10173  *
10174  *
10175  */
10176   __pyx_r = __pyx_v_itemp;
10177   goto __pyx_L0;
10178 
10179   /* "View.MemoryView":393
10180  *                 PyThread_free_lock(self.lock)
10181  *
10182  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
10183  *         cdef Py_ssize_t dim
10184  *         cdef char *itemp = <char *> self.view.buf
10185  */
10186 
10187   /* function exit code */
10188   __pyx_L1_error:;
10189   __Pyx_XDECREF(__pyx_t_2);
10190   __Pyx_XDECREF(__pyx_t_5);
10191   __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
10192   __pyx_r = NULL;
10193   __pyx_L0:;
10194   __Pyx_XDECREF(__pyx_v_idx);
10195   __Pyx_RefNannyFinishContext();
10196   return __pyx_r;
10197 }
10198 
10199 /* "View.MemoryView":403
10200  *
10201  *
10202  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
10203  *         if index is Ellipsis:
10204  *             return self
10205  */
10206 
10207 /* Python wrapper */
10208 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
__pyx_memoryview___getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index)10209 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
10210   PyObject *__pyx_r = 0;
10211   __Pyx_RefNannyDeclarations
10212   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
10213   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
10214 
10215   /* function exit code */
10216   __Pyx_RefNannyFinishContext();
10217   return __pyx_r;
10218 }
10219 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)10220 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
10221   PyObject *__pyx_v_have_slices = NULL;
10222   PyObject *__pyx_v_indices = NULL;
10223   char *__pyx_v_itemp;
10224   PyObject *__pyx_r = NULL;
10225   __Pyx_RefNannyDeclarations
10226   int __pyx_t_1;
10227   int __pyx_t_2;
10228   PyObject *__pyx_t_3 = NULL;
10229   PyObject *__pyx_t_4 = NULL;
10230   PyObject *__pyx_t_5 = NULL;
10231   char *__pyx_t_6;
10232   int __pyx_lineno = 0;
10233   const char *__pyx_filename = NULL;
10234   int __pyx_clineno = 0;
10235   __Pyx_RefNannySetupContext("__getitem__", 0);
10236 
10237   /* "View.MemoryView":404
10238  *
10239  *     def __getitem__(memoryview self, object index):
10240  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
10241  *             return self
10242  *
10243  */
10244   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
10245   __pyx_t_2 = (__pyx_t_1 != 0);
10246   if (__pyx_t_2) {
10247 
10248     /* "View.MemoryView":405
10249  *     def __getitem__(memoryview self, object index):
10250  *         if index is Ellipsis:
10251  *             return self             # <<<<<<<<<<<<<<
10252  *
10253  *         have_slices, indices = _unellipsify(index, self.view.ndim)
10254  */
10255     __Pyx_XDECREF(__pyx_r);
10256     __Pyx_INCREF(((PyObject *)__pyx_v_self));
10257     __pyx_r = ((PyObject *)__pyx_v_self);
10258     goto __pyx_L0;
10259 
10260     /* "View.MemoryView":404
10261  *
10262  *     def __getitem__(memoryview self, object index):
10263  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
10264  *             return self
10265  *
10266  */
10267   }
10268 
10269   /* "View.MemoryView":407
10270  *             return self
10271  *
10272  *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
10273  *
10274  *         cdef char *itemp
10275  */
10276   __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error)
10277   __Pyx_GOTREF(__pyx_t_3);
10278   if (likely(__pyx_t_3 != Py_None)) {
10279     PyObject* sequence = __pyx_t_3;
10280     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10281     if (unlikely(size != 2)) {
10282       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10283       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10284       __PYX_ERR(2, 407, __pyx_L1_error)
10285     }
10286     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10287     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
10288     __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
10289     __Pyx_INCREF(__pyx_t_4);
10290     __Pyx_INCREF(__pyx_t_5);
10291     #else
10292     __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error)
10293     __Pyx_GOTREF(__pyx_t_4);
10294     __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error)
10295     __Pyx_GOTREF(__pyx_t_5);
10296     #endif
10297     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10298   } else {
10299     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error)
10300   }
10301   __pyx_v_have_slices = __pyx_t_4;
10302   __pyx_t_4 = 0;
10303   __pyx_v_indices = __pyx_t_5;
10304   __pyx_t_5 = 0;
10305 
10306   /* "View.MemoryView":410
10307  *
10308  *         cdef char *itemp
10309  *         if have_slices:             # <<<<<<<<<<<<<<
10310  *             return memview_slice(self, indices)
10311  *         else:
10312  */
10313   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error)
10314   if (__pyx_t_2) {
10315 
10316     /* "View.MemoryView":411
10317  *         cdef char *itemp
10318  *         if have_slices:
10319  *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
10320  *         else:
10321  *             itemp = self.get_item_pointer(indices)
10322  */
10323     __Pyx_XDECREF(__pyx_r);
10324     __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 411, __pyx_L1_error)
10325     __Pyx_GOTREF(__pyx_t_3);
10326     __pyx_r = __pyx_t_3;
10327     __pyx_t_3 = 0;
10328     goto __pyx_L0;
10329 
10330     /* "View.MemoryView":410
10331  *
10332  *         cdef char *itemp
10333  *         if have_slices:             # <<<<<<<<<<<<<<
10334  *             return memview_slice(self, indices)
10335  *         else:
10336  */
10337   }
10338 
10339   /* "View.MemoryView":413
10340  *             return memview_slice(self, indices)
10341  *         else:
10342  *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
10343  *             return self.convert_item_to_object(itemp)
10344  *
10345  */
10346   /*else*/ {
10347     __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 413, __pyx_L1_error)
10348     __pyx_v_itemp = __pyx_t_6;
10349 
10350     /* "View.MemoryView":414
10351  *         else:
10352  *             itemp = self.get_item_pointer(indices)
10353  *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
10354  *
10355  *     def __setitem__(memoryview self, object index, object value):
10356  */
10357     __Pyx_XDECREF(__pyx_r);
10358     __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 414, __pyx_L1_error)
10359     __Pyx_GOTREF(__pyx_t_3);
10360     __pyx_r = __pyx_t_3;
10361     __pyx_t_3 = 0;
10362     goto __pyx_L0;
10363   }
10364 
10365   /* "View.MemoryView":403
10366  *
10367  *
10368  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
10369  *         if index is Ellipsis:
10370  *             return self
10371  */
10372 
10373   /* function exit code */
10374   __pyx_L1_error:;
10375   __Pyx_XDECREF(__pyx_t_3);
10376   __Pyx_XDECREF(__pyx_t_4);
10377   __Pyx_XDECREF(__pyx_t_5);
10378   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10379   __pyx_r = NULL;
10380   __pyx_L0:;
10381   __Pyx_XDECREF(__pyx_v_have_slices);
10382   __Pyx_XDECREF(__pyx_v_indices);
10383   __Pyx_XGIVEREF(__pyx_r);
10384   __Pyx_RefNannyFinishContext();
10385   return __pyx_r;
10386 }
10387 
10388 /* "View.MemoryView":416
10389  *             return self.convert_item_to_object(itemp)
10390  *
10391  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
10392  *         if self.view.readonly:
10393  *             raise TypeError("Cannot assign to read-only memoryview")
10394  */
10395 
10396 /* Python wrapper */
10397 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
__pyx_memoryview___setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)10398 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10399   int __pyx_r;
10400   __Pyx_RefNannyDeclarations
10401   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
10402   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
10403 
10404   /* function exit code */
10405   __Pyx_RefNannyFinishContext();
10406   return __pyx_r;
10407 }
10408 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)10409 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10410   PyObject *__pyx_v_have_slices = NULL;
10411   PyObject *__pyx_v_obj = NULL;
10412   int __pyx_r;
10413   __Pyx_RefNannyDeclarations
10414   int __pyx_t_1;
10415   PyObject *__pyx_t_2 = NULL;
10416   PyObject *__pyx_t_3 = NULL;
10417   PyObject *__pyx_t_4 = NULL;
10418   int __pyx_lineno = 0;
10419   const char *__pyx_filename = NULL;
10420   int __pyx_clineno = 0;
10421   __Pyx_RefNannySetupContext("__setitem__", 0);
10422   __Pyx_INCREF(__pyx_v_index);
10423 
10424   /* "View.MemoryView":417
10425  *
10426  *     def __setitem__(memoryview self, object index, object value):
10427  *         if self.view.readonly:             # <<<<<<<<<<<<<<
10428  *             raise TypeError("Cannot assign to read-only memoryview")
10429  *
10430  */
10431   __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
10432   if (unlikely(__pyx_t_1)) {
10433 
10434     /* "View.MemoryView":418
10435  *     def __setitem__(memoryview self, object index, object value):
10436  *         if self.view.readonly:
10437  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
10438  *
10439  *         have_slices, index = _unellipsify(index, self.view.ndim)
10440  */
10441     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error)
10442     __Pyx_GOTREF(__pyx_t_2);
10443     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10444     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10445     __PYX_ERR(2, 418, __pyx_L1_error)
10446 
10447     /* "View.MemoryView":417
10448  *
10449  *     def __setitem__(memoryview self, object index, object value):
10450  *         if self.view.readonly:             # <<<<<<<<<<<<<<
10451  *             raise TypeError("Cannot assign to read-only memoryview")
10452  *
10453  */
10454   }
10455 
10456   /* "View.MemoryView":420
10457  *             raise TypeError("Cannot assign to read-only memoryview")
10458  *
10459  *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
10460  *
10461  *         if have_slices:
10462  */
10463   __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
10464   __Pyx_GOTREF(__pyx_t_2);
10465   if (likely(__pyx_t_2 != Py_None)) {
10466     PyObject* sequence = __pyx_t_2;
10467     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10468     if (unlikely(size != 2)) {
10469       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10470       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10471       __PYX_ERR(2, 420, __pyx_L1_error)
10472     }
10473     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10474     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
10475     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
10476     __Pyx_INCREF(__pyx_t_3);
10477     __Pyx_INCREF(__pyx_t_4);
10478     #else
10479     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error)
10480     __Pyx_GOTREF(__pyx_t_3);
10481     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error)
10482     __Pyx_GOTREF(__pyx_t_4);
10483     #endif
10484     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10485   } else {
10486     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error)
10487   }
10488   __pyx_v_have_slices = __pyx_t_3;
10489   __pyx_t_3 = 0;
10490   __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
10491   __pyx_t_4 = 0;
10492 
10493   /* "View.MemoryView":422
10494  *         have_slices, index = _unellipsify(index, self.view.ndim)
10495  *
10496  *         if have_slices:             # <<<<<<<<<<<<<<
10497  *             obj = self.is_slice(value)
10498  *             if obj:
10499  */
10500   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error)
10501   if (__pyx_t_1) {
10502 
10503     /* "View.MemoryView":423
10504  *
10505  *         if have_slices:
10506  *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
10507  *             if obj:
10508  *                 self.setitem_slice_assignment(self[index], obj)
10509  */
10510     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 423, __pyx_L1_error)
10511     __Pyx_GOTREF(__pyx_t_2);
10512     __pyx_v_obj = __pyx_t_2;
10513     __pyx_t_2 = 0;
10514 
10515     /* "View.MemoryView":424
10516  *         if have_slices:
10517  *             obj = self.is_slice(value)
10518  *             if obj:             # <<<<<<<<<<<<<<
10519  *                 self.setitem_slice_assignment(self[index], obj)
10520  *             else:
10521  */
10522     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
10523     if (__pyx_t_1) {
10524 
10525       /* "View.MemoryView":425
10526  *             obj = self.is_slice(value)
10527  *             if obj:
10528  *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
10529  *             else:
10530  *                 self.setitem_slice_assign_scalar(self[index], value)
10531  */
10532       __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error)
10533       __Pyx_GOTREF(__pyx_t_2);
10534       __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 425, __pyx_L1_error)
10535       __Pyx_GOTREF(__pyx_t_4);
10536       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10537       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10538 
10539       /* "View.MemoryView":424
10540  *         if have_slices:
10541  *             obj = self.is_slice(value)
10542  *             if obj:             # <<<<<<<<<<<<<<
10543  *                 self.setitem_slice_assignment(self[index], obj)
10544  *             else:
10545  */
10546       goto __pyx_L5;
10547     }
10548 
10549     /* "View.MemoryView":427
10550  *                 self.setitem_slice_assignment(self[index], obj)
10551  *             else:
10552  *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
10553  *         else:
10554  *             self.setitem_indexed(index, value)
10555  */
10556     /*else*/ {
10557       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error)
10558       __Pyx_GOTREF(__pyx_t_4);
10559       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error)
10560       __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error)
10561       __Pyx_GOTREF(__pyx_t_2);
10562       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10563       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10564     }
10565     __pyx_L5:;
10566 
10567     /* "View.MemoryView":422
10568  *         have_slices, index = _unellipsify(index, self.view.ndim)
10569  *
10570  *         if have_slices:             # <<<<<<<<<<<<<<
10571  *             obj = self.is_slice(value)
10572  *             if obj:
10573  */
10574     goto __pyx_L4;
10575   }
10576 
10577   /* "View.MemoryView":429
10578  *                 self.setitem_slice_assign_scalar(self[index], value)
10579  *         else:
10580  *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
10581  *
10582  *     cdef is_slice(self, obj):
10583  */
10584   /*else*/ {
10585     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error)
10586     __Pyx_GOTREF(__pyx_t_2);
10587     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10588   }
10589   __pyx_L4:;
10590 
10591   /* "View.MemoryView":416
10592  *             return self.convert_item_to_object(itemp)
10593  *
10594  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
10595  *         if self.view.readonly:
10596  *             raise TypeError("Cannot assign to read-only memoryview")
10597  */
10598 
10599   /* function exit code */
10600   __pyx_r = 0;
10601   goto __pyx_L0;
10602   __pyx_L1_error:;
10603   __Pyx_XDECREF(__pyx_t_2);
10604   __Pyx_XDECREF(__pyx_t_3);
10605   __Pyx_XDECREF(__pyx_t_4);
10606   __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10607   __pyx_r = -1;
10608   __pyx_L0:;
10609   __Pyx_XDECREF(__pyx_v_have_slices);
10610   __Pyx_XDECREF(__pyx_v_obj);
10611   __Pyx_XDECREF(__pyx_v_index);
10612   __Pyx_RefNannyFinishContext();
10613   return __pyx_r;
10614 }
10615 
10616 /* "View.MemoryView":431
10617  *             self.setitem_indexed(index, value)
10618  *
10619  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
10620  *         if not isinstance(obj, memoryview):
10621  *             try:
10622  */
10623 
__pyx_memoryview_is_slice(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj)10624 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
10625   PyObject *__pyx_r = NULL;
10626   __Pyx_RefNannyDeclarations
10627   int __pyx_t_1;
10628   int __pyx_t_2;
10629   PyObject *__pyx_t_3 = NULL;
10630   PyObject *__pyx_t_4 = NULL;
10631   PyObject *__pyx_t_5 = NULL;
10632   PyObject *__pyx_t_6 = NULL;
10633   PyObject *__pyx_t_7 = NULL;
10634   PyObject *__pyx_t_8 = NULL;
10635   int __pyx_t_9;
10636   int __pyx_lineno = 0;
10637   const char *__pyx_filename = NULL;
10638   int __pyx_clineno = 0;
10639   __Pyx_RefNannySetupContext("is_slice", 0);
10640   __Pyx_INCREF(__pyx_v_obj);
10641 
10642   /* "View.MemoryView":432
10643  *
10644  *     cdef is_slice(self, obj):
10645  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
10646  *             try:
10647  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10648  */
10649   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
10650   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
10651   if (__pyx_t_2) {
10652 
10653     /* "View.MemoryView":433
10654  *     cdef is_slice(self, obj):
10655  *         if not isinstance(obj, memoryview):
10656  *             try:             # <<<<<<<<<<<<<<
10657  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10658  *                                  self.dtype_is_object)
10659  */
10660     {
10661       __Pyx_PyThreadState_declare
10662       __Pyx_PyThreadState_assign
10663       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
10664       __Pyx_XGOTREF(__pyx_t_3);
10665       __Pyx_XGOTREF(__pyx_t_4);
10666       __Pyx_XGOTREF(__pyx_t_5);
10667       /*try:*/ {
10668 
10669         /* "View.MemoryView":434
10670  *         if not isinstance(obj, memoryview):
10671  *             try:
10672  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
10673  *                                  self.dtype_is_object)
10674  *             except TypeError:
10675  */
10676         __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 434, __pyx_L4_error)
10677         __Pyx_GOTREF(__pyx_t_6);
10678 
10679         /* "View.MemoryView":435
10680  *             try:
10681  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10682  *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
10683  *             except TypeError:
10684  *                 return None
10685  */
10686         __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error)
10687         __Pyx_GOTREF(__pyx_t_7);
10688 
10689         /* "View.MemoryView":434
10690  *         if not isinstance(obj, memoryview):
10691  *             try:
10692  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
10693  *                                  self.dtype_is_object)
10694  *             except TypeError:
10695  */
10696         __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error)
10697         __Pyx_GOTREF(__pyx_t_8);
10698         __Pyx_INCREF(__pyx_v_obj);
10699         __Pyx_GIVEREF(__pyx_v_obj);
10700         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
10701         __Pyx_GIVEREF(__pyx_t_6);
10702         PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
10703         __Pyx_GIVEREF(__pyx_t_7);
10704         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
10705         __pyx_t_6 = 0;
10706         __pyx_t_7 = 0;
10707         __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 434, __pyx_L4_error)
10708         __Pyx_GOTREF(__pyx_t_7);
10709         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10710         __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
10711         __pyx_t_7 = 0;
10712 
10713         /* "View.MemoryView":433
10714  *     cdef is_slice(self, obj):
10715  *         if not isinstance(obj, memoryview):
10716  *             try:             # <<<<<<<<<<<<<<
10717  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10718  *                                  self.dtype_is_object)
10719  */
10720       }
10721       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10722       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10723       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10724       goto __pyx_L9_try_end;
10725       __pyx_L4_error:;
10726       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10727       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10728       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
10729 
10730       /* "View.MemoryView":436
10731  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10732  *                                  self.dtype_is_object)
10733  *             except TypeError:             # <<<<<<<<<<<<<<
10734  *                 return None
10735  *
10736  */
10737       __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
10738       if (__pyx_t_9) {
10739         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10740         if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error)
10741         __Pyx_GOTREF(__pyx_t_7);
10742         __Pyx_GOTREF(__pyx_t_8);
10743         __Pyx_GOTREF(__pyx_t_6);
10744 
10745         /* "View.MemoryView":437
10746  *                                  self.dtype_is_object)
10747  *             except TypeError:
10748  *                 return None             # <<<<<<<<<<<<<<
10749  *
10750  *         return obj
10751  */
10752         __Pyx_XDECREF(__pyx_r);
10753         __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10754         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10755         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10756         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10757         goto __pyx_L7_except_return;
10758       }
10759       goto __pyx_L6_except_error;
10760       __pyx_L6_except_error:;
10761 
10762       /* "View.MemoryView":433
10763  *     cdef is_slice(self, obj):
10764  *         if not isinstance(obj, memoryview):
10765  *             try:             # <<<<<<<<<<<<<<
10766  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10767  *                                  self.dtype_is_object)
10768  */
10769       __Pyx_XGIVEREF(__pyx_t_3);
10770       __Pyx_XGIVEREF(__pyx_t_4);
10771       __Pyx_XGIVEREF(__pyx_t_5);
10772       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10773       goto __pyx_L1_error;
10774       __pyx_L7_except_return:;
10775       __Pyx_XGIVEREF(__pyx_t_3);
10776       __Pyx_XGIVEREF(__pyx_t_4);
10777       __Pyx_XGIVEREF(__pyx_t_5);
10778       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10779       goto __pyx_L0;
10780       __pyx_L9_try_end:;
10781     }
10782 
10783     /* "View.MemoryView":432
10784  *
10785  *     cdef is_slice(self, obj):
10786  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
10787  *             try:
10788  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10789  */
10790   }
10791 
10792   /* "View.MemoryView":439
10793  *                 return None
10794  *
10795  *         return obj             # <<<<<<<<<<<<<<
10796  *
10797  *     cdef setitem_slice_assignment(self, dst, src):
10798  */
10799   __Pyx_XDECREF(__pyx_r);
10800   __Pyx_INCREF(__pyx_v_obj);
10801   __pyx_r = __pyx_v_obj;
10802   goto __pyx_L0;
10803 
10804   /* "View.MemoryView":431
10805  *             self.setitem_indexed(index, value)
10806  *
10807  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
10808  *         if not isinstance(obj, memoryview):
10809  *             try:
10810  */
10811 
10812   /* function exit code */
10813   __pyx_L1_error:;
10814   __Pyx_XDECREF(__pyx_t_6);
10815   __Pyx_XDECREF(__pyx_t_7);
10816   __Pyx_XDECREF(__pyx_t_8);
10817   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10818   __pyx_r = 0;
10819   __pyx_L0:;
10820   __Pyx_XDECREF(__pyx_v_obj);
10821   __Pyx_XGIVEREF(__pyx_r);
10822   __Pyx_RefNannyFinishContext();
10823   return __pyx_r;
10824 }
10825 
10826 /* "View.MemoryView":441
10827  *         return obj
10828  *
10829  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
10830  *         cdef __Pyx_memviewslice dst_slice
10831  *         cdef __Pyx_memviewslice src_slice
10832  */
10833 
__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_dst,PyObject * __pyx_v_src)10834 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
10835   __Pyx_memviewslice __pyx_v_dst_slice;
10836   __Pyx_memviewslice __pyx_v_src_slice;
10837   PyObject *__pyx_r = NULL;
10838   __Pyx_RefNannyDeclarations
10839   __Pyx_memviewslice *__pyx_t_1;
10840   __Pyx_memviewslice *__pyx_t_2;
10841   PyObject *__pyx_t_3 = NULL;
10842   int __pyx_t_4;
10843   int __pyx_t_5;
10844   int __pyx_t_6;
10845   int __pyx_lineno = 0;
10846   const char *__pyx_filename = NULL;
10847   int __pyx_clineno = 0;
10848   __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
10849 
10850   /* "View.MemoryView":445
10851  *         cdef __Pyx_memviewslice src_slice
10852  *
10853  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
10854  *                                  get_slice_from_memview(dst, &dst_slice)[0],
10855  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10856  */
10857   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error)
10858   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 445, __pyx_L1_error)
10859 
10860   /* "View.MemoryView":446
10861  *
10862  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
10863  *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
10864  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10865  *
10866  */
10867   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error)
10868   __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 446, __pyx_L1_error)
10869 
10870   /* "View.MemoryView":447
10871  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
10872  *                                  get_slice_from_memview(dst, &dst_slice)[0],
10873  *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
10874  *
10875  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
10876  */
10877   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
10878   __Pyx_GOTREF(__pyx_t_3);
10879   __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
10880   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10881   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
10882   __Pyx_GOTREF(__pyx_t_3);
10883   __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
10884   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10885 
10886   /* "View.MemoryView":445
10887  *         cdef __Pyx_memviewslice src_slice
10888  *
10889  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
10890  *                                  get_slice_from_memview(dst, &dst_slice)[0],
10891  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10892  */
10893   __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 445, __pyx_L1_error)
10894 
10895   /* "View.MemoryView":441
10896  *         return obj
10897  *
10898  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
10899  *         cdef __Pyx_memviewslice dst_slice
10900  *         cdef __Pyx_memviewslice src_slice
10901  */
10902 
10903   /* function exit code */
10904   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10905   goto __pyx_L0;
10906   __pyx_L1_error:;
10907   __Pyx_XDECREF(__pyx_t_3);
10908   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
10909   __pyx_r = 0;
10910   __pyx_L0:;
10911   __Pyx_XGIVEREF(__pyx_r);
10912   __Pyx_RefNannyFinishContext();
10913   return __pyx_r;
10914 }
10915 
10916 /* "View.MemoryView":449
10917  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10918  *
10919  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
10920  *         cdef int array[128]
10921  *         cdef void *tmp = NULL
10922  */
10923 
__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj * __pyx_v_self,struct __pyx_memoryview_obj * __pyx_v_dst,PyObject * __pyx_v_value)10924 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
10925   int __pyx_v_array[0x80];
10926   void *__pyx_v_tmp;
10927   void *__pyx_v_item;
10928   __Pyx_memviewslice *__pyx_v_dst_slice;
10929   __Pyx_memviewslice __pyx_v_tmp_slice;
10930   PyObject *__pyx_r = NULL;
10931   __Pyx_RefNannyDeclarations
10932   __Pyx_memviewslice *__pyx_t_1;
10933   int __pyx_t_2;
10934   PyObject *__pyx_t_3 = NULL;
10935   int __pyx_t_4;
10936   int __pyx_t_5;
10937   char const *__pyx_t_6;
10938   PyObject *__pyx_t_7 = NULL;
10939   PyObject *__pyx_t_8 = NULL;
10940   PyObject *__pyx_t_9 = NULL;
10941   PyObject *__pyx_t_10 = NULL;
10942   PyObject *__pyx_t_11 = NULL;
10943   PyObject *__pyx_t_12 = NULL;
10944   int __pyx_lineno = 0;
10945   const char *__pyx_filename = NULL;
10946   int __pyx_clineno = 0;
10947   __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
10948 
10949   /* "View.MemoryView":451
10950  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
10951  *         cdef int array[128]
10952  *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
10953  *         cdef void *item
10954  *
10955  */
10956   __pyx_v_tmp = NULL;
10957 
10958   /* "View.MemoryView":456
10959  *         cdef __Pyx_memviewslice *dst_slice
10960  *         cdef __Pyx_memviewslice tmp_slice
10961  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
10962  *
10963  *         if <size_t>self.view.itemsize > sizeof(array):
10964  */
10965   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 456, __pyx_L1_error)
10966   __pyx_v_dst_slice = __pyx_t_1;
10967 
10968   /* "View.MemoryView":458
10969  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
10970  *
10971  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
10972  *             tmp = PyMem_Malloc(self.view.itemsize)
10973  *             if tmp == NULL:
10974  */
10975   __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
10976   if (__pyx_t_2) {
10977 
10978     /* "View.MemoryView":459
10979  *
10980  *         if <size_t>self.view.itemsize > sizeof(array):
10981  *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
10982  *             if tmp == NULL:
10983  *                 raise MemoryError
10984  */
10985     __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
10986 
10987     /* "View.MemoryView":460
10988  *         if <size_t>self.view.itemsize > sizeof(array):
10989  *             tmp = PyMem_Malloc(self.view.itemsize)
10990  *             if tmp == NULL:             # <<<<<<<<<<<<<<
10991  *                 raise MemoryError
10992  *             item = tmp
10993  */
10994     __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
10995     if (unlikely(__pyx_t_2)) {
10996 
10997       /* "View.MemoryView":461
10998  *             tmp = PyMem_Malloc(self.view.itemsize)
10999  *             if tmp == NULL:
11000  *                 raise MemoryError             # <<<<<<<<<<<<<<
11001  *             item = tmp
11002  *         else:
11003  */
11004       PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error)
11005 
11006       /* "View.MemoryView":460
11007  *         if <size_t>self.view.itemsize > sizeof(array):
11008  *             tmp = PyMem_Malloc(self.view.itemsize)
11009  *             if tmp == NULL:             # <<<<<<<<<<<<<<
11010  *                 raise MemoryError
11011  *             item = tmp
11012  */
11013     }
11014 
11015     /* "View.MemoryView":462
11016  *             if tmp == NULL:
11017  *                 raise MemoryError
11018  *             item = tmp             # <<<<<<<<<<<<<<
11019  *         else:
11020  *             item = <void *> array
11021  */
11022     __pyx_v_item = __pyx_v_tmp;
11023 
11024     /* "View.MemoryView":458
11025  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
11026  *
11027  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
11028  *             tmp = PyMem_Malloc(self.view.itemsize)
11029  *             if tmp == NULL:
11030  */
11031     goto __pyx_L3;
11032   }
11033 
11034   /* "View.MemoryView":464
11035  *             item = tmp
11036  *         else:
11037  *             item = <void *> array             # <<<<<<<<<<<<<<
11038  *
11039  *         try:
11040  */
11041   /*else*/ {
11042     __pyx_v_item = ((void *)__pyx_v_array);
11043   }
11044   __pyx_L3:;
11045 
11046   /* "View.MemoryView":466
11047  *             item = <void *> array
11048  *
11049  *         try:             # <<<<<<<<<<<<<<
11050  *             if self.dtype_is_object:
11051  *                 (<PyObject **> item)[0] = <PyObject *> value
11052  */
11053   /*try:*/ {
11054 
11055     /* "View.MemoryView":467
11056  *
11057  *         try:
11058  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
11059  *                 (<PyObject **> item)[0] = <PyObject *> value
11060  *             else:
11061  */
11062     __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
11063     if (__pyx_t_2) {
11064 
11065       /* "View.MemoryView":468
11066  *         try:
11067  *             if self.dtype_is_object:
11068  *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
11069  *             else:
11070  *                 self.assign_item_from_object(<char *> item, value)
11071  */
11072       (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
11073 
11074       /* "View.MemoryView":467
11075  *
11076  *         try:
11077  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
11078  *                 (<PyObject **> item)[0] = <PyObject *> value
11079  *             else:
11080  */
11081       goto __pyx_L8;
11082     }
11083 
11084     /* "View.MemoryView":470
11085  *                 (<PyObject **> item)[0] = <PyObject *> value
11086  *             else:
11087  *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
11088  *
11089  *
11090  */
11091     /*else*/ {
11092       __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 470, __pyx_L6_error)
11093       __Pyx_GOTREF(__pyx_t_3);
11094       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11095     }
11096     __pyx_L8:;
11097 
11098     /* "View.MemoryView":474
11099  *
11100  *
11101  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
11102  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
11103  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
11104  */
11105     __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
11106     if (__pyx_t_2) {
11107 
11108       /* "View.MemoryView":475
11109  *
11110  *             if self.view.suboffsets != NULL:
11111  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
11112  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
11113  *                                 item, self.dtype_is_object)
11114  */
11115       __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 475, __pyx_L6_error)
11116       __Pyx_GOTREF(__pyx_t_3);
11117       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11118 
11119       /* "View.MemoryView":474
11120  *
11121  *
11122  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
11123  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
11124  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
11125  */
11126     }
11127 
11128     /* "View.MemoryView":476
11129  *             if self.view.suboffsets != NULL:
11130  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
11131  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
11132  *                                 item, self.dtype_is_object)
11133  *         finally:
11134  */
11135     __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
11136   }
11137 
11138   /* "View.MemoryView":479
11139  *                                 item, self.dtype_is_object)
11140  *         finally:
11141  *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
11142  *
11143  *     cdef setitem_indexed(self, index, value):
11144  */
11145   /*finally:*/ {
11146     /*normal exit:*/{
11147       PyMem_Free(__pyx_v_tmp);
11148       goto __pyx_L7;
11149     }
11150     __pyx_L6_error:;
11151     /*exception exit:*/{
11152       __Pyx_PyThreadState_declare
11153       __Pyx_PyThreadState_assign
11154       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
11155       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11156       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
11157       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
11158       __Pyx_XGOTREF(__pyx_t_7);
11159       __Pyx_XGOTREF(__pyx_t_8);
11160       __Pyx_XGOTREF(__pyx_t_9);
11161       __Pyx_XGOTREF(__pyx_t_10);
11162       __Pyx_XGOTREF(__pyx_t_11);
11163       __Pyx_XGOTREF(__pyx_t_12);
11164       __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
11165       {
11166         PyMem_Free(__pyx_v_tmp);
11167       }
11168       if (PY_MAJOR_VERSION >= 3) {
11169         __Pyx_XGIVEREF(__pyx_t_10);
11170         __Pyx_XGIVEREF(__pyx_t_11);
11171         __Pyx_XGIVEREF(__pyx_t_12);
11172         __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
11173       }
11174       __Pyx_XGIVEREF(__pyx_t_7);
11175       __Pyx_XGIVEREF(__pyx_t_8);
11176       __Pyx_XGIVEREF(__pyx_t_9);
11177       __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
11178       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
11179       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
11180       goto __pyx_L1_error;
11181     }
11182     __pyx_L7:;
11183   }
11184 
11185   /* "View.MemoryView":449
11186  *                                  src.ndim, dst.ndim, self.dtype_is_object)
11187  *
11188  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
11189  *         cdef int array[128]
11190  *         cdef void *tmp = NULL
11191  */
11192 
11193   /* function exit code */
11194   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11195   goto __pyx_L0;
11196   __pyx_L1_error:;
11197   __Pyx_XDECREF(__pyx_t_3);
11198   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
11199   __pyx_r = 0;
11200   __pyx_L0:;
11201   __Pyx_XGIVEREF(__pyx_r);
11202   __Pyx_RefNannyFinishContext();
11203   return __pyx_r;
11204 }
11205 
11206 /* "View.MemoryView":481
11207  *             PyMem_Free(tmp)
11208  *
11209  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
11210  *         cdef char *itemp = self.get_item_pointer(index)
11211  *         self.assign_item_from_object(itemp, value)
11212  */
11213 
__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)11214 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
11215   char *__pyx_v_itemp;
11216   PyObject *__pyx_r = NULL;
11217   __Pyx_RefNannyDeclarations
11218   char *__pyx_t_1;
11219   PyObject *__pyx_t_2 = NULL;
11220   int __pyx_lineno = 0;
11221   const char *__pyx_filename = NULL;
11222   int __pyx_clineno = 0;
11223   __Pyx_RefNannySetupContext("setitem_indexed", 0);
11224 
11225   /* "View.MemoryView":482
11226  *
11227  *     cdef setitem_indexed(self, index, value):
11228  *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
11229  *         self.assign_item_from_object(itemp, value)
11230  *
11231  */
11232   __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 482, __pyx_L1_error)
11233   __pyx_v_itemp = __pyx_t_1;
11234 
11235   /* "View.MemoryView":483
11236  *     cdef setitem_indexed(self, index, value):
11237  *         cdef char *itemp = self.get_item_pointer(index)
11238  *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
11239  *
11240  *     cdef convert_item_to_object(self, char *itemp):
11241  */
11242   __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 483, __pyx_L1_error)
11243   __Pyx_GOTREF(__pyx_t_2);
11244   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11245 
11246   /* "View.MemoryView":481
11247  *             PyMem_Free(tmp)
11248  *
11249  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
11250  *         cdef char *itemp = self.get_item_pointer(index)
11251  *         self.assign_item_from_object(itemp, value)
11252  */
11253 
11254   /* function exit code */
11255   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11256   goto __pyx_L0;
11257   __pyx_L1_error:;
11258   __Pyx_XDECREF(__pyx_t_2);
11259   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
11260   __pyx_r = 0;
11261   __pyx_L0:;
11262   __Pyx_XGIVEREF(__pyx_r);
11263   __Pyx_RefNannyFinishContext();
11264   return __pyx_r;
11265 }
11266 
11267 /* "View.MemoryView":485
11268  *         self.assign_item_from_object(itemp, value)
11269  *
11270  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
11271  *         """Only used if instantiated manually by the user, or if Cython doesn't
11272  *         know how to convert the type"""
11273  */
11274 
__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp)11275 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
11276   PyObject *__pyx_v_struct = NULL;
11277   PyObject *__pyx_v_bytesitem = 0;
11278   PyObject *__pyx_v_result = NULL;
11279   PyObject *__pyx_r = NULL;
11280   __Pyx_RefNannyDeclarations
11281   PyObject *__pyx_t_1 = NULL;
11282   PyObject *__pyx_t_2 = NULL;
11283   PyObject *__pyx_t_3 = NULL;
11284   PyObject *__pyx_t_4 = NULL;
11285   PyObject *__pyx_t_5 = NULL;
11286   PyObject *__pyx_t_6 = NULL;
11287   PyObject *__pyx_t_7 = NULL;
11288   int __pyx_t_8;
11289   PyObject *__pyx_t_9 = NULL;
11290   size_t __pyx_t_10;
11291   int __pyx_t_11;
11292   int __pyx_lineno = 0;
11293   const char *__pyx_filename = NULL;
11294   int __pyx_clineno = 0;
11295   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
11296 
11297   /* "View.MemoryView":488
11298  *         """Only used if instantiated manually by the user, or if Cython doesn't
11299  *         know how to convert the type"""
11300  *         import struct             # <<<<<<<<<<<<<<
11301  *         cdef bytes bytesitem
11302  *
11303  */
11304   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error)
11305   __Pyx_GOTREF(__pyx_t_1);
11306   __pyx_v_struct = __pyx_t_1;
11307   __pyx_t_1 = 0;
11308 
11309   /* "View.MemoryView":491
11310  *         cdef bytes bytesitem
11311  *
11312  *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
11313  *         try:
11314  *             result = struct.unpack(self.view.format, bytesitem)
11315  */
11316   __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 491, __pyx_L1_error)
11317   __Pyx_GOTREF(__pyx_t_1);
11318   __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
11319   __pyx_t_1 = 0;
11320 
11321   /* "View.MemoryView":492
11322  *
11323  *         bytesitem = itemp[:self.view.itemsize]
11324  *         try:             # <<<<<<<<<<<<<<
11325  *             result = struct.unpack(self.view.format, bytesitem)
11326  *         except struct.error:
11327  */
11328   {
11329     __Pyx_PyThreadState_declare
11330     __Pyx_PyThreadState_assign
11331     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
11332     __Pyx_XGOTREF(__pyx_t_2);
11333     __Pyx_XGOTREF(__pyx_t_3);
11334     __Pyx_XGOTREF(__pyx_t_4);
11335     /*try:*/ {
11336 
11337       /* "View.MemoryView":493
11338  *         bytesitem = itemp[:self.view.itemsize]
11339  *         try:
11340  *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
11341  *         except struct.error:
11342  *             raise ValueError("Unable to convert item to object")
11343  */
11344       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 493, __pyx_L3_error)
11345       __Pyx_GOTREF(__pyx_t_5);
11346       __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error)
11347       __Pyx_GOTREF(__pyx_t_6);
11348       __pyx_t_7 = NULL;
11349       __pyx_t_8 = 0;
11350       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11351         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
11352         if (likely(__pyx_t_7)) {
11353           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11354           __Pyx_INCREF(__pyx_t_7);
11355           __Pyx_INCREF(function);
11356           __Pyx_DECREF_SET(__pyx_t_5, function);
11357           __pyx_t_8 = 1;
11358         }
11359       }
11360       #if CYTHON_FAST_PYCALL
11361       if (PyFunction_Check(__pyx_t_5)) {
11362         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
11363         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
11364         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11365         __Pyx_GOTREF(__pyx_t_1);
11366         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11367       } else
11368       #endif
11369       #if CYTHON_FAST_PYCCALL
11370       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
11371         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
11372         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
11373         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11374         __Pyx_GOTREF(__pyx_t_1);
11375         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11376       } else
11377       #endif
11378       {
11379         __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error)
11380         __Pyx_GOTREF(__pyx_t_9);
11381         if (__pyx_t_7) {
11382           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
11383         }
11384         __Pyx_GIVEREF(__pyx_t_6);
11385         PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
11386         __Pyx_INCREF(__pyx_v_bytesitem);
11387         __Pyx_GIVEREF(__pyx_v_bytesitem);
11388         PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
11389         __pyx_t_6 = 0;
11390         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
11391         __Pyx_GOTREF(__pyx_t_1);
11392         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
11393       }
11394       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11395       __pyx_v_result = __pyx_t_1;
11396       __pyx_t_1 = 0;
11397 
11398       /* "View.MemoryView":492
11399  *
11400  *         bytesitem = itemp[:self.view.itemsize]
11401  *         try:             # <<<<<<<<<<<<<<
11402  *             result = struct.unpack(self.view.format, bytesitem)
11403  *         except struct.error:
11404  */
11405     }
11406 
11407     /* "View.MemoryView":497
11408  *             raise ValueError("Unable to convert item to object")
11409  *         else:
11410  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
11411  *                 return result[0]
11412  *             return result
11413  */
11414     /*else:*/ {
11415       __pyx_t_10 = strlen(__pyx_v_self->view.format);
11416       __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
11417       if (__pyx_t_11) {
11418 
11419         /* "View.MemoryView":498
11420  *         else:
11421  *             if len(self.view.format) == 1:
11422  *                 return result[0]             # <<<<<<<<<<<<<<
11423  *             return result
11424  *
11425  */
11426         __Pyx_XDECREF(__pyx_r);
11427         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 498, __pyx_L5_except_error)
11428         __Pyx_GOTREF(__pyx_t_1);
11429         __pyx_r = __pyx_t_1;
11430         __pyx_t_1 = 0;
11431         goto __pyx_L6_except_return;
11432 
11433         /* "View.MemoryView":497
11434  *             raise ValueError("Unable to convert item to object")
11435  *         else:
11436  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
11437  *                 return result[0]
11438  *             return result
11439  */
11440       }
11441 
11442       /* "View.MemoryView":499
11443  *             if len(self.view.format) == 1:
11444  *                 return result[0]
11445  *             return result             # <<<<<<<<<<<<<<
11446  *
11447  *     cdef assign_item_from_object(self, char *itemp, object value):
11448  */
11449       __Pyx_XDECREF(__pyx_r);
11450       __Pyx_INCREF(__pyx_v_result);
11451       __pyx_r = __pyx_v_result;
11452       goto __pyx_L6_except_return;
11453     }
11454     __pyx_L3_error:;
11455     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
11456     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11457     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
11458     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11459     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
11460 
11461     /* "View.MemoryView":494
11462  *         try:
11463  *             result = struct.unpack(self.view.format, bytesitem)
11464  *         except struct.error:             # <<<<<<<<<<<<<<
11465  *             raise ValueError("Unable to convert item to object")
11466  *         else:
11467  */
11468     __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
11469     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 494, __pyx_L5_except_error)
11470     __Pyx_GOTREF(__pyx_t_6);
11471     __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
11472     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11473     __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
11474     __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
11475     if (__pyx_t_8) {
11476       __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11477       if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error)
11478       __Pyx_GOTREF(__pyx_t_9);
11479       __Pyx_GOTREF(__pyx_t_5);
11480       __Pyx_GOTREF(__pyx_t_1);
11481 
11482       /* "View.MemoryView":495
11483  *             result = struct.unpack(self.view.format, bytesitem)
11484  *         except struct.error:
11485  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
11486  *         else:
11487  *             if len(self.view.format) == 1:
11488  */
11489       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L5_except_error)
11490       __Pyx_GOTREF(__pyx_t_6);
11491       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
11492       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11493       __PYX_ERR(2, 495, __pyx_L5_except_error)
11494     }
11495     goto __pyx_L5_except_error;
11496     __pyx_L5_except_error:;
11497 
11498     /* "View.MemoryView":492
11499  *
11500  *         bytesitem = itemp[:self.view.itemsize]
11501  *         try:             # <<<<<<<<<<<<<<
11502  *             result = struct.unpack(self.view.format, bytesitem)
11503  *         except struct.error:
11504  */
11505     __Pyx_XGIVEREF(__pyx_t_2);
11506     __Pyx_XGIVEREF(__pyx_t_3);
11507     __Pyx_XGIVEREF(__pyx_t_4);
11508     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
11509     goto __pyx_L1_error;
11510     __pyx_L6_except_return:;
11511     __Pyx_XGIVEREF(__pyx_t_2);
11512     __Pyx_XGIVEREF(__pyx_t_3);
11513     __Pyx_XGIVEREF(__pyx_t_4);
11514     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
11515     goto __pyx_L0;
11516   }
11517 
11518   /* "View.MemoryView":485
11519  *         self.assign_item_from_object(itemp, value)
11520  *
11521  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
11522  *         """Only used if instantiated manually by the user, or if Cython doesn't
11523  *         know how to convert the type"""
11524  */
11525 
11526   /* function exit code */
11527   __pyx_L1_error:;
11528   __Pyx_XDECREF(__pyx_t_1);
11529   __Pyx_XDECREF(__pyx_t_5);
11530   __Pyx_XDECREF(__pyx_t_6);
11531   __Pyx_XDECREF(__pyx_t_7);
11532   __Pyx_XDECREF(__pyx_t_9);
11533   __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11534   __pyx_r = 0;
11535   __pyx_L0:;
11536   __Pyx_XDECREF(__pyx_v_struct);
11537   __Pyx_XDECREF(__pyx_v_bytesitem);
11538   __Pyx_XDECREF(__pyx_v_result);
11539   __Pyx_XGIVEREF(__pyx_r);
11540   __Pyx_RefNannyFinishContext();
11541   return __pyx_r;
11542 }
11543 
11544 /* "View.MemoryView":501
11545  *             return result
11546  *
11547  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
11548  *         """Only used if instantiated manually by the user, or if Cython doesn't
11549  *         know how to convert the type"""
11550  */
11551 
__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)11552 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
11553   PyObject *__pyx_v_struct = NULL;
11554   char __pyx_v_c;
11555   PyObject *__pyx_v_bytesvalue = 0;
11556   Py_ssize_t __pyx_v_i;
11557   PyObject *__pyx_r = NULL;
11558   __Pyx_RefNannyDeclarations
11559   PyObject *__pyx_t_1 = NULL;
11560   int __pyx_t_2;
11561   int __pyx_t_3;
11562   PyObject *__pyx_t_4 = NULL;
11563   PyObject *__pyx_t_5 = NULL;
11564   PyObject *__pyx_t_6 = NULL;
11565   int __pyx_t_7;
11566   PyObject *__pyx_t_8 = NULL;
11567   Py_ssize_t __pyx_t_9;
11568   PyObject *__pyx_t_10 = NULL;
11569   char *__pyx_t_11;
11570   char *__pyx_t_12;
11571   char *__pyx_t_13;
11572   char *__pyx_t_14;
11573   int __pyx_lineno = 0;
11574   const char *__pyx_filename = NULL;
11575   int __pyx_clineno = 0;
11576   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
11577 
11578   /* "View.MemoryView":504
11579  *         """Only used if instantiated manually by the user, or if Cython doesn't
11580  *         know how to convert the type"""
11581  *         import struct             # <<<<<<<<<<<<<<
11582  *         cdef char c
11583  *         cdef bytes bytesvalue
11584  */
11585   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error)
11586   __Pyx_GOTREF(__pyx_t_1);
11587   __pyx_v_struct = __pyx_t_1;
11588   __pyx_t_1 = 0;
11589 
11590   /* "View.MemoryView":509
11591  *         cdef Py_ssize_t i
11592  *
11593  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
11594  *             bytesvalue = struct.pack(self.view.format, *value)
11595  *         else:
11596  */
11597   __pyx_t_2 = PyTuple_Check(__pyx_v_value);
11598   __pyx_t_3 = (__pyx_t_2 != 0);
11599   if (__pyx_t_3) {
11600 
11601     /* "View.MemoryView":510
11602  *
11603  *         if isinstance(value, tuple):
11604  *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
11605  *         else:
11606  *             bytesvalue = struct.pack(self.view.format, value)
11607  */
11608     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 510, __pyx_L1_error)
11609     __Pyx_GOTREF(__pyx_t_1);
11610     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
11611     __Pyx_GOTREF(__pyx_t_4);
11612     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error)
11613     __Pyx_GOTREF(__pyx_t_5);
11614     __Pyx_GIVEREF(__pyx_t_4);
11615     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
11616     __pyx_t_4 = 0;
11617     __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
11618     __Pyx_GOTREF(__pyx_t_4);
11619     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __pyx_L1_error)
11620     __Pyx_GOTREF(__pyx_t_6);
11621     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11622     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11623     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
11624     __Pyx_GOTREF(__pyx_t_4);
11625     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11626     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11627     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 510, __pyx_L1_error)
11628     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11629     __pyx_t_4 = 0;
11630 
11631     /* "View.MemoryView":509
11632  *         cdef Py_ssize_t i
11633  *
11634  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
11635  *             bytesvalue = struct.pack(self.view.format, *value)
11636  *         else:
11637  */
11638     goto __pyx_L3;
11639   }
11640 
11641   /* "View.MemoryView":512
11642  *             bytesvalue = struct.pack(self.view.format, *value)
11643  *         else:
11644  *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
11645  *
11646  *         for i, c in enumerate(bytesvalue):
11647  */
11648   /*else*/ {
11649     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error)
11650     __Pyx_GOTREF(__pyx_t_6);
11651     __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
11652     __Pyx_GOTREF(__pyx_t_1);
11653     __pyx_t_5 = NULL;
11654     __pyx_t_7 = 0;
11655     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
11656       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
11657       if (likely(__pyx_t_5)) {
11658         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
11659         __Pyx_INCREF(__pyx_t_5);
11660         __Pyx_INCREF(function);
11661         __Pyx_DECREF_SET(__pyx_t_6, function);
11662         __pyx_t_7 = 1;
11663       }
11664     }
11665     #if CYTHON_FAST_PYCALL
11666     if (PyFunction_Check(__pyx_t_6)) {
11667       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11668       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
11669       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11670       __Pyx_GOTREF(__pyx_t_4);
11671       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11672     } else
11673     #endif
11674     #if CYTHON_FAST_PYCCALL
11675     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
11676       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11677       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
11678       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11679       __Pyx_GOTREF(__pyx_t_4);
11680       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11681     } else
11682     #endif
11683     {
11684       __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error)
11685       __Pyx_GOTREF(__pyx_t_8);
11686       if (__pyx_t_5) {
11687         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
11688       }
11689       __Pyx_GIVEREF(__pyx_t_1);
11690       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
11691       __Pyx_INCREF(__pyx_v_value);
11692       __Pyx_GIVEREF(__pyx_v_value);
11693       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
11694       __pyx_t_1 = 0;
11695       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
11696       __Pyx_GOTREF(__pyx_t_4);
11697       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11698     }
11699     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11700     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error)
11701     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11702     __pyx_t_4 = 0;
11703   }
11704   __pyx_L3:;
11705 
11706   /* "View.MemoryView":514
11707  *             bytesvalue = struct.pack(self.view.format, value)
11708  *
11709  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
11710  *             itemp[i] = c
11711  *
11712  */
11713   __pyx_t_9 = 0;
11714   if (unlikely(__pyx_v_bytesvalue == Py_None)) {
11715     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
11716     __PYX_ERR(2, 514, __pyx_L1_error)
11717   }
11718   __Pyx_INCREF(__pyx_v_bytesvalue);
11719   __pyx_t_10 = __pyx_v_bytesvalue;
11720   __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
11721   __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
11722   for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
11723     __pyx_t_11 = __pyx_t_14;
11724     __pyx_v_c = (__pyx_t_11[0]);
11725 
11726     /* "View.MemoryView":515
11727  *
11728  *         for i, c in enumerate(bytesvalue):
11729  *             itemp[i] = c             # <<<<<<<<<<<<<<
11730  *
11731  *     @cname('getbuffer')
11732  */
11733     __pyx_v_i = __pyx_t_9;
11734 
11735     /* "View.MemoryView":514
11736  *             bytesvalue = struct.pack(self.view.format, value)
11737  *
11738  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
11739  *             itemp[i] = c
11740  *
11741  */
11742     __pyx_t_9 = (__pyx_t_9 + 1);
11743 
11744     /* "View.MemoryView":515
11745  *
11746  *         for i, c in enumerate(bytesvalue):
11747  *             itemp[i] = c             # <<<<<<<<<<<<<<
11748  *
11749  *     @cname('getbuffer')
11750  */
11751     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
11752   }
11753   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
11754 
11755   /* "View.MemoryView":501
11756  *             return result
11757  *
11758  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
11759  *         """Only used if instantiated manually by the user, or if Cython doesn't
11760  *         know how to convert the type"""
11761  */
11762 
11763   /* function exit code */
11764   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11765   goto __pyx_L0;
11766   __pyx_L1_error:;
11767   __Pyx_XDECREF(__pyx_t_1);
11768   __Pyx_XDECREF(__pyx_t_4);
11769   __Pyx_XDECREF(__pyx_t_5);
11770   __Pyx_XDECREF(__pyx_t_6);
11771   __Pyx_XDECREF(__pyx_t_8);
11772   __Pyx_XDECREF(__pyx_t_10);
11773   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11774   __pyx_r = 0;
11775   __pyx_L0:;
11776   __Pyx_XDECREF(__pyx_v_struct);
11777   __Pyx_XDECREF(__pyx_v_bytesvalue);
11778   __Pyx_XGIVEREF(__pyx_r);
11779   __Pyx_RefNannyFinishContext();
11780   return __pyx_r;
11781 }
11782 
11783 /* "View.MemoryView":518
11784  *
11785  *     @cname('getbuffer')
11786  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
11787  *         if flags & PyBUF_WRITABLE and self.view.readonly:
11788  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11789  */
11790 
11791 /* Python wrapper */
11792 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_memoryview_getbuffer(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)11793 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
11794   int __pyx_r;
11795   __Pyx_RefNannyDeclarations
11796   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
11797   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
11798 
11799   /* function exit code */
11800   __Pyx_RefNannyFinishContext();
11801   return __pyx_r;
11802 }
11803 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)11804 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
11805   int __pyx_r;
11806   __Pyx_RefNannyDeclarations
11807   int __pyx_t_1;
11808   int __pyx_t_2;
11809   PyObject *__pyx_t_3 = NULL;
11810   Py_ssize_t *__pyx_t_4;
11811   char *__pyx_t_5;
11812   void *__pyx_t_6;
11813   int __pyx_t_7;
11814   Py_ssize_t __pyx_t_8;
11815   int __pyx_lineno = 0;
11816   const char *__pyx_filename = NULL;
11817   int __pyx_clineno = 0;
11818   if (__pyx_v_info == NULL) {
11819     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
11820     return -1;
11821   }
11822   __Pyx_RefNannySetupContext("__getbuffer__", 0);
11823   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
11824   __Pyx_GIVEREF(__pyx_v_info->obj);
11825 
11826   /* "View.MemoryView":519
11827  *     @cname('getbuffer')
11828  *     def __getbuffer__(self, Py_buffer *info, int flags):
11829  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
11830  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11831  *
11832  */
11833   __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
11834   if (__pyx_t_2) {
11835   } else {
11836     __pyx_t_1 = __pyx_t_2;
11837     goto __pyx_L4_bool_binop_done;
11838   }
11839   __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
11840   __pyx_t_1 = __pyx_t_2;
11841   __pyx_L4_bool_binop_done:;
11842   if (unlikely(__pyx_t_1)) {
11843 
11844     /* "View.MemoryView":520
11845  *     def __getbuffer__(self, Py_buffer *info, int flags):
11846  *         if flags & PyBUF_WRITABLE and self.view.readonly:
11847  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
11848  *
11849  *         if flags & PyBUF_ND:
11850  */
11851     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 520, __pyx_L1_error)
11852     __Pyx_GOTREF(__pyx_t_3);
11853     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
11854     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11855     __PYX_ERR(2, 520, __pyx_L1_error)
11856 
11857     /* "View.MemoryView":519
11858  *     @cname('getbuffer')
11859  *     def __getbuffer__(self, Py_buffer *info, int flags):
11860  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
11861  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11862  *
11863  */
11864   }
11865 
11866   /* "View.MemoryView":522
11867  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11868  *
11869  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
11870  *             info.shape = self.view.shape
11871  *         else:
11872  */
11873   __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
11874   if (__pyx_t_1) {
11875 
11876     /* "View.MemoryView":523
11877  *
11878  *         if flags & PyBUF_ND:
11879  *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
11880  *         else:
11881  *             info.shape = NULL
11882  */
11883     __pyx_t_4 = __pyx_v_self->view.shape;
11884     __pyx_v_info->shape = __pyx_t_4;
11885 
11886     /* "View.MemoryView":522
11887  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11888  *
11889  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
11890  *             info.shape = self.view.shape
11891  *         else:
11892  */
11893     goto __pyx_L6;
11894   }
11895 
11896   /* "View.MemoryView":525
11897  *             info.shape = self.view.shape
11898  *         else:
11899  *             info.shape = NULL             # <<<<<<<<<<<<<<
11900  *
11901  *         if flags & PyBUF_STRIDES:
11902  */
11903   /*else*/ {
11904     __pyx_v_info->shape = NULL;
11905   }
11906   __pyx_L6:;
11907 
11908   /* "View.MemoryView":527
11909  *             info.shape = NULL
11910  *
11911  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
11912  *             info.strides = self.view.strides
11913  *         else:
11914  */
11915   __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
11916   if (__pyx_t_1) {
11917 
11918     /* "View.MemoryView":528
11919  *
11920  *         if flags & PyBUF_STRIDES:
11921  *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
11922  *         else:
11923  *             info.strides = NULL
11924  */
11925     __pyx_t_4 = __pyx_v_self->view.strides;
11926     __pyx_v_info->strides = __pyx_t_4;
11927 
11928     /* "View.MemoryView":527
11929  *             info.shape = NULL
11930  *
11931  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
11932  *             info.strides = self.view.strides
11933  *         else:
11934  */
11935     goto __pyx_L7;
11936   }
11937 
11938   /* "View.MemoryView":530
11939  *             info.strides = self.view.strides
11940  *         else:
11941  *             info.strides = NULL             # <<<<<<<<<<<<<<
11942  *
11943  *         if flags & PyBUF_INDIRECT:
11944  */
11945   /*else*/ {
11946     __pyx_v_info->strides = NULL;
11947   }
11948   __pyx_L7:;
11949 
11950   /* "View.MemoryView":532
11951  *             info.strides = NULL
11952  *
11953  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
11954  *             info.suboffsets = self.view.suboffsets
11955  *         else:
11956  */
11957   __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
11958   if (__pyx_t_1) {
11959 
11960     /* "View.MemoryView":533
11961  *
11962  *         if flags & PyBUF_INDIRECT:
11963  *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
11964  *         else:
11965  *             info.suboffsets = NULL
11966  */
11967     __pyx_t_4 = __pyx_v_self->view.suboffsets;
11968     __pyx_v_info->suboffsets = __pyx_t_4;
11969 
11970     /* "View.MemoryView":532
11971  *             info.strides = NULL
11972  *
11973  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
11974  *             info.suboffsets = self.view.suboffsets
11975  *         else:
11976  */
11977     goto __pyx_L8;
11978   }
11979 
11980   /* "View.MemoryView":535
11981  *             info.suboffsets = self.view.suboffsets
11982  *         else:
11983  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
11984  *
11985  *         if flags & PyBUF_FORMAT:
11986  */
11987   /*else*/ {
11988     __pyx_v_info->suboffsets = NULL;
11989   }
11990   __pyx_L8:;
11991 
11992   /* "View.MemoryView":537
11993  *             info.suboffsets = NULL
11994  *
11995  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
11996  *             info.format = self.view.format
11997  *         else:
11998  */
11999   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
12000   if (__pyx_t_1) {
12001 
12002     /* "View.MemoryView":538
12003  *
12004  *         if flags & PyBUF_FORMAT:
12005  *             info.format = self.view.format             # <<<<<<<<<<<<<<
12006  *         else:
12007  *             info.format = NULL
12008  */
12009     __pyx_t_5 = __pyx_v_self->view.format;
12010     __pyx_v_info->format = __pyx_t_5;
12011 
12012     /* "View.MemoryView":537
12013  *             info.suboffsets = NULL
12014  *
12015  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
12016  *             info.format = self.view.format
12017  *         else:
12018  */
12019     goto __pyx_L9;
12020   }
12021 
12022   /* "View.MemoryView":540
12023  *             info.format = self.view.format
12024  *         else:
12025  *             info.format = NULL             # <<<<<<<<<<<<<<
12026  *
12027  *         info.buf = self.view.buf
12028  */
12029   /*else*/ {
12030     __pyx_v_info->format = NULL;
12031   }
12032   __pyx_L9:;
12033 
12034   /* "View.MemoryView":542
12035  *             info.format = NULL
12036  *
12037  *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
12038  *         info.ndim = self.view.ndim
12039  *         info.itemsize = self.view.itemsize
12040  */
12041   __pyx_t_6 = __pyx_v_self->view.buf;
12042   __pyx_v_info->buf = __pyx_t_6;
12043 
12044   /* "View.MemoryView":543
12045  *
12046  *         info.buf = self.view.buf
12047  *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
12048  *         info.itemsize = self.view.itemsize
12049  *         info.len = self.view.len
12050  */
12051   __pyx_t_7 = __pyx_v_self->view.ndim;
12052   __pyx_v_info->ndim = __pyx_t_7;
12053 
12054   /* "View.MemoryView":544
12055  *         info.buf = self.view.buf
12056  *         info.ndim = self.view.ndim
12057  *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
12058  *         info.len = self.view.len
12059  *         info.readonly = self.view.readonly
12060  */
12061   __pyx_t_8 = __pyx_v_self->view.itemsize;
12062   __pyx_v_info->itemsize = __pyx_t_8;
12063 
12064   /* "View.MemoryView":545
12065  *         info.ndim = self.view.ndim
12066  *         info.itemsize = self.view.itemsize
12067  *         info.len = self.view.len             # <<<<<<<<<<<<<<
12068  *         info.readonly = self.view.readonly
12069  *         info.obj = self
12070  */
12071   __pyx_t_8 = __pyx_v_self->view.len;
12072   __pyx_v_info->len = __pyx_t_8;
12073 
12074   /* "View.MemoryView":546
12075  *         info.itemsize = self.view.itemsize
12076  *         info.len = self.view.len
12077  *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
12078  *         info.obj = self
12079  *
12080  */
12081   __pyx_t_1 = __pyx_v_self->view.readonly;
12082   __pyx_v_info->readonly = __pyx_t_1;
12083 
12084   /* "View.MemoryView":547
12085  *         info.len = self.view.len
12086  *         info.readonly = self.view.readonly
12087  *         info.obj = self             # <<<<<<<<<<<<<<
12088  *
12089  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
12090  */
12091   __Pyx_INCREF(((PyObject *)__pyx_v_self));
12092   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
12093   __Pyx_GOTREF(__pyx_v_info->obj);
12094   __Pyx_DECREF(__pyx_v_info->obj);
12095   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
12096 
12097   /* "View.MemoryView":518
12098  *
12099  *     @cname('getbuffer')
12100  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
12101  *         if flags & PyBUF_WRITABLE and self.view.readonly:
12102  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
12103  */
12104 
12105   /* function exit code */
12106   __pyx_r = 0;
12107   goto __pyx_L0;
12108   __pyx_L1_error:;
12109   __Pyx_XDECREF(__pyx_t_3);
12110   __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12111   __pyx_r = -1;
12112   if (__pyx_v_info->obj != NULL) {
12113     __Pyx_GOTREF(__pyx_v_info->obj);
12114     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
12115   }
12116   goto __pyx_L2;
12117   __pyx_L0:;
12118   if (__pyx_v_info->obj == Py_None) {
12119     __Pyx_GOTREF(__pyx_v_info->obj);
12120     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
12121   }
12122   __pyx_L2:;
12123   __Pyx_RefNannyFinishContext();
12124   return __pyx_r;
12125 }
12126 
12127 /* "View.MemoryView":553
12128  *
12129  *     @property
12130  *     def T(self):             # <<<<<<<<<<<<<<
12131  *         cdef _memoryviewslice result = memoryview_copy(self)
12132  *         transpose_memslice(&result.from_slice)
12133  */
12134 
12135 /* Python wrapper */
12136 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject * __pyx_v_self)12137 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
12138   PyObject *__pyx_r = 0;
12139   __Pyx_RefNannyDeclarations
12140   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12141   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12142 
12143   /* function exit code */
12144   __Pyx_RefNannyFinishContext();
12145   return __pyx_r;
12146 }
12147 
__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj * __pyx_v_self)12148 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12149   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
12150   PyObject *__pyx_r = NULL;
12151   __Pyx_RefNannyDeclarations
12152   PyObject *__pyx_t_1 = NULL;
12153   int __pyx_t_2;
12154   int __pyx_lineno = 0;
12155   const char *__pyx_filename = NULL;
12156   int __pyx_clineno = 0;
12157   __Pyx_RefNannySetupContext("__get__", 0);
12158 
12159   /* "View.MemoryView":554
12160  *     @property
12161  *     def T(self):
12162  *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
12163  *         transpose_memslice(&result.from_slice)
12164  *         return result
12165  */
12166   __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __pyx_L1_error)
12167   __Pyx_GOTREF(__pyx_t_1);
12168   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error)
12169   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
12170   __pyx_t_1 = 0;
12171 
12172   /* "View.MemoryView":555
12173  *     def T(self):
12174  *         cdef _memoryviewslice result = memoryview_copy(self)
12175  *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
12176  *         return result
12177  *
12178  */
12179   __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 555, __pyx_L1_error)
12180 
12181   /* "View.MemoryView":556
12182  *         cdef _memoryviewslice result = memoryview_copy(self)
12183  *         transpose_memslice(&result.from_slice)
12184  *         return result             # <<<<<<<<<<<<<<
12185  *
12186  *     @property
12187  */
12188   __Pyx_XDECREF(__pyx_r);
12189   __Pyx_INCREF(((PyObject *)__pyx_v_result));
12190   __pyx_r = ((PyObject *)__pyx_v_result);
12191   goto __pyx_L0;
12192 
12193   /* "View.MemoryView":553
12194  *
12195  *     @property
12196  *     def T(self):             # <<<<<<<<<<<<<<
12197  *         cdef _memoryviewslice result = memoryview_copy(self)
12198  *         transpose_memslice(&result.from_slice)
12199  */
12200 
12201   /* function exit code */
12202   __pyx_L1_error:;
12203   __Pyx_XDECREF(__pyx_t_1);
12204   __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12205   __pyx_r = NULL;
12206   __pyx_L0:;
12207   __Pyx_XDECREF((PyObject *)__pyx_v_result);
12208   __Pyx_XGIVEREF(__pyx_r);
12209   __Pyx_RefNannyFinishContext();
12210   return __pyx_r;
12211 }
12212 
12213 /* "View.MemoryView":559
12214  *
12215  *     @property
12216  *     def base(self):             # <<<<<<<<<<<<<<
12217  *         return self.obj
12218  *
12219  */
12220 
12221 /* Python wrapper */
12222 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject * __pyx_v_self)12223 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
12224   PyObject *__pyx_r = 0;
12225   __Pyx_RefNannyDeclarations
12226   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12227   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12228 
12229   /* function exit code */
12230   __Pyx_RefNannyFinishContext();
12231   return __pyx_r;
12232 }
12233 
__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj * __pyx_v_self)12234 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12235   PyObject *__pyx_r = NULL;
12236   __Pyx_RefNannyDeclarations
12237   __Pyx_RefNannySetupContext("__get__", 0);
12238 
12239   /* "View.MemoryView":560
12240  *     @property
12241  *     def base(self):
12242  *         return self.obj             # <<<<<<<<<<<<<<
12243  *
12244  *     @property
12245  */
12246   __Pyx_XDECREF(__pyx_r);
12247   __Pyx_INCREF(__pyx_v_self->obj);
12248   __pyx_r = __pyx_v_self->obj;
12249   goto __pyx_L0;
12250 
12251   /* "View.MemoryView":559
12252  *
12253  *     @property
12254  *     def base(self):             # <<<<<<<<<<<<<<
12255  *         return self.obj
12256  *
12257  */
12258 
12259   /* function exit code */
12260   __pyx_L0:;
12261   __Pyx_XGIVEREF(__pyx_r);
12262   __Pyx_RefNannyFinishContext();
12263   return __pyx_r;
12264 }
12265 
12266 /* "View.MemoryView":563
12267  *
12268  *     @property
12269  *     def shape(self):             # <<<<<<<<<<<<<<
12270  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
12271  *
12272  */
12273 
12274 /* Python wrapper */
12275 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject * __pyx_v_self)12276 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
12277   PyObject *__pyx_r = 0;
12278   __Pyx_RefNannyDeclarations
12279   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12280   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12281 
12282   /* function exit code */
12283   __Pyx_RefNannyFinishContext();
12284   return __pyx_r;
12285 }
12286 
__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj * __pyx_v_self)12287 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12288   Py_ssize_t __pyx_v_length;
12289   PyObject *__pyx_r = NULL;
12290   __Pyx_RefNannyDeclarations
12291   PyObject *__pyx_t_1 = NULL;
12292   Py_ssize_t *__pyx_t_2;
12293   Py_ssize_t *__pyx_t_3;
12294   Py_ssize_t *__pyx_t_4;
12295   PyObject *__pyx_t_5 = NULL;
12296   int __pyx_lineno = 0;
12297   const char *__pyx_filename = NULL;
12298   int __pyx_clineno = 0;
12299   __Pyx_RefNannySetupContext("__get__", 0);
12300 
12301   /* "View.MemoryView":564
12302  *     @property
12303  *     def shape(self):
12304  *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
12305  *
12306  *     @property
12307  */
12308   __Pyx_XDECREF(__pyx_r);
12309   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error)
12310   __Pyx_GOTREF(__pyx_t_1);
12311   __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
12312   for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
12313     __pyx_t_2 = __pyx_t_4;
12314     __pyx_v_length = (__pyx_t_2[0]);
12315     __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
12316     __Pyx_GOTREF(__pyx_t_5);
12317     if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error)
12318     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12319   }
12320   __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
12321   __Pyx_GOTREF(__pyx_t_5);
12322   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12323   __pyx_r = __pyx_t_5;
12324   __pyx_t_5 = 0;
12325   goto __pyx_L0;
12326 
12327   /* "View.MemoryView":563
12328  *
12329  *     @property
12330  *     def shape(self):             # <<<<<<<<<<<<<<
12331  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
12332  *
12333  */
12334 
12335   /* function exit code */
12336   __pyx_L1_error:;
12337   __Pyx_XDECREF(__pyx_t_1);
12338   __Pyx_XDECREF(__pyx_t_5);
12339   __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12340   __pyx_r = NULL;
12341   __pyx_L0:;
12342   __Pyx_XGIVEREF(__pyx_r);
12343   __Pyx_RefNannyFinishContext();
12344   return __pyx_r;
12345 }
12346 
12347 /* "View.MemoryView":567
12348  *
12349  *     @property
12350  *     def strides(self):             # <<<<<<<<<<<<<<
12351  *         if self.view.strides == NULL:
12352  *
12353  */
12354 
12355 /* Python wrapper */
12356 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject * __pyx_v_self)12357 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
12358   PyObject *__pyx_r = 0;
12359   __Pyx_RefNannyDeclarations
12360   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12361   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12362 
12363   /* function exit code */
12364   __Pyx_RefNannyFinishContext();
12365   return __pyx_r;
12366 }
12367 
__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj * __pyx_v_self)12368 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12369   Py_ssize_t __pyx_v_stride;
12370   PyObject *__pyx_r = NULL;
12371   __Pyx_RefNannyDeclarations
12372   int __pyx_t_1;
12373   PyObject *__pyx_t_2 = NULL;
12374   Py_ssize_t *__pyx_t_3;
12375   Py_ssize_t *__pyx_t_4;
12376   Py_ssize_t *__pyx_t_5;
12377   PyObject *__pyx_t_6 = NULL;
12378   int __pyx_lineno = 0;
12379   const char *__pyx_filename = NULL;
12380   int __pyx_clineno = 0;
12381   __Pyx_RefNannySetupContext("__get__", 0);
12382 
12383   /* "View.MemoryView":568
12384  *     @property
12385  *     def strides(self):
12386  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
12387  *
12388  *             raise ValueError("Buffer view does not expose strides")
12389  */
12390   __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
12391   if (unlikely(__pyx_t_1)) {
12392 
12393     /* "View.MemoryView":570
12394  *         if self.view.strides == NULL:
12395  *
12396  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
12397  *
12398  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
12399  */
12400     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 570, __pyx_L1_error)
12401     __Pyx_GOTREF(__pyx_t_2);
12402     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12403     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12404     __PYX_ERR(2, 570, __pyx_L1_error)
12405 
12406     /* "View.MemoryView":568
12407  *     @property
12408  *     def strides(self):
12409  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
12410  *
12411  *             raise ValueError("Buffer view does not expose strides")
12412  */
12413   }
12414 
12415   /* "View.MemoryView":572
12416  *             raise ValueError("Buffer view does not expose strides")
12417  *
12418  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
12419  *
12420  *     @property
12421  */
12422   __Pyx_XDECREF(__pyx_r);
12423   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
12424   __Pyx_GOTREF(__pyx_t_2);
12425   __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
12426   for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
12427     __pyx_t_3 = __pyx_t_5;
12428     __pyx_v_stride = (__pyx_t_3[0]);
12429     __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
12430     __Pyx_GOTREF(__pyx_t_6);
12431     if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error)
12432     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12433   }
12434   __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
12435   __Pyx_GOTREF(__pyx_t_6);
12436   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12437   __pyx_r = __pyx_t_6;
12438   __pyx_t_6 = 0;
12439   goto __pyx_L0;
12440 
12441   /* "View.MemoryView":567
12442  *
12443  *     @property
12444  *     def strides(self):             # <<<<<<<<<<<<<<
12445  *         if self.view.strides == NULL:
12446  *
12447  */
12448 
12449   /* function exit code */
12450   __pyx_L1_error:;
12451   __Pyx_XDECREF(__pyx_t_2);
12452   __Pyx_XDECREF(__pyx_t_6);
12453   __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12454   __pyx_r = NULL;
12455   __pyx_L0:;
12456   __Pyx_XGIVEREF(__pyx_r);
12457   __Pyx_RefNannyFinishContext();
12458   return __pyx_r;
12459 }
12460 
12461 /* "View.MemoryView":575
12462  *
12463  *     @property
12464  *     def suboffsets(self):             # <<<<<<<<<<<<<<
12465  *         if self.view.suboffsets == NULL:
12466  *             return (-1,) * self.view.ndim
12467  */
12468 
12469 /* Python wrapper */
12470 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject * __pyx_v_self)12471 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
12472   PyObject *__pyx_r = 0;
12473   __Pyx_RefNannyDeclarations
12474   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12475   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12476 
12477   /* function exit code */
12478   __Pyx_RefNannyFinishContext();
12479   return __pyx_r;
12480 }
12481 
__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj * __pyx_v_self)12482 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12483   Py_ssize_t __pyx_v_suboffset;
12484   PyObject *__pyx_r = NULL;
12485   __Pyx_RefNannyDeclarations
12486   int __pyx_t_1;
12487   PyObject *__pyx_t_2 = NULL;
12488   PyObject *__pyx_t_3 = NULL;
12489   Py_ssize_t *__pyx_t_4;
12490   Py_ssize_t *__pyx_t_5;
12491   Py_ssize_t *__pyx_t_6;
12492   int __pyx_lineno = 0;
12493   const char *__pyx_filename = NULL;
12494   int __pyx_clineno = 0;
12495   __Pyx_RefNannySetupContext("__get__", 0);
12496 
12497   /* "View.MemoryView":576
12498  *     @property
12499  *     def suboffsets(self):
12500  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
12501  *             return (-1,) * self.view.ndim
12502  *
12503  */
12504   __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
12505   if (__pyx_t_1) {
12506 
12507     /* "View.MemoryView":577
12508  *     def suboffsets(self):
12509  *         if self.view.suboffsets == NULL:
12510  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
12511  *
12512  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
12513  */
12514     __Pyx_XDECREF(__pyx_r);
12515     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error)
12516     __Pyx_GOTREF(__pyx_t_2);
12517     __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__16, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __pyx_L1_error)
12518     __Pyx_GOTREF(__pyx_t_3);
12519     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12520     __pyx_r = __pyx_t_3;
12521     __pyx_t_3 = 0;
12522     goto __pyx_L0;
12523 
12524     /* "View.MemoryView":576
12525  *     @property
12526  *     def suboffsets(self):
12527  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
12528  *             return (-1,) * self.view.ndim
12529  *
12530  */
12531   }
12532 
12533   /* "View.MemoryView":579
12534  *             return (-1,) * self.view.ndim
12535  *
12536  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
12537  *
12538  *     @property
12539  */
12540   __Pyx_XDECREF(__pyx_r);
12541   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
12542   __Pyx_GOTREF(__pyx_t_3);
12543   __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
12544   for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
12545     __pyx_t_4 = __pyx_t_6;
12546     __pyx_v_suboffset = (__pyx_t_4[0]);
12547     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
12548     __Pyx_GOTREF(__pyx_t_2);
12549     if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error)
12550     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12551   }
12552   __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
12553   __Pyx_GOTREF(__pyx_t_2);
12554   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12555   __pyx_r = __pyx_t_2;
12556   __pyx_t_2 = 0;
12557   goto __pyx_L0;
12558 
12559   /* "View.MemoryView":575
12560  *
12561  *     @property
12562  *     def suboffsets(self):             # <<<<<<<<<<<<<<
12563  *         if self.view.suboffsets == NULL:
12564  *             return (-1,) * self.view.ndim
12565  */
12566 
12567   /* function exit code */
12568   __pyx_L1_error:;
12569   __Pyx_XDECREF(__pyx_t_2);
12570   __Pyx_XDECREF(__pyx_t_3);
12571   __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12572   __pyx_r = NULL;
12573   __pyx_L0:;
12574   __Pyx_XGIVEREF(__pyx_r);
12575   __Pyx_RefNannyFinishContext();
12576   return __pyx_r;
12577 }
12578 
12579 /* "View.MemoryView":582
12580  *
12581  *     @property
12582  *     def ndim(self):             # <<<<<<<<<<<<<<
12583  *         return self.view.ndim
12584  *
12585  */
12586 
12587 /* Python wrapper */
12588 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject * __pyx_v_self)12589 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
12590   PyObject *__pyx_r = 0;
12591   __Pyx_RefNannyDeclarations
12592   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12593   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12594 
12595   /* function exit code */
12596   __Pyx_RefNannyFinishContext();
12597   return __pyx_r;
12598 }
12599 
__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj * __pyx_v_self)12600 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12601   PyObject *__pyx_r = NULL;
12602   __Pyx_RefNannyDeclarations
12603   PyObject *__pyx_t_1 = NULL;
12604   int __pyx_lineno = 0;
12605   const char *__pyx_filename = NULL;
12606   int __pyx_clineno = 0;
12607   __Pyx_RefNannySetupContext("__get__", 0);
12608 
12609   /* "View.MemoryView":583
12610  *     @property
12611  *     def ndim(self):
12612  *         return self.view.ndim             # <<<<<<<<<<<<<<
12613  *
12614  *     @property
12615  */
12616   __Pyx_XDECREF(__pyx_r);
12617   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error)
12618   __Pyx_GOTREF(__pyx_t_1);
12619   __pyx_r = __pyx_t_1;
12620   __pyx_t_1 = 0;
12621   goto __pyx_L0;
12622 
12623   /* "View.MemoryView":582
12624  *
12625  *     @property
12626  *     def ndim(self):             # <<<<<<<<<<<<<<
12627  *         return self.view.ndim
12628  *
12629  */
12630 
12631   /* function exit code */
12632   __pyx_L1_error:;
12633   __Pyx_XDECREF(__pyx_t_1);
12634   __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12635   __pyx_r = NULL;
12636   __pyx_L0:;
12637   __Pyx_XGIVEREF(__pyx_r);
12638   __Pyx_RefNannyFinishContext();
12639   return __pyx_r;
12640 }
12641 
12642 /* "View.MemoryView":586
12643  *
12644  *     @property
12645  *     def itemsize(self):             # <<<<<<<<<<<<<<
12646  *         return self.view.itemsize
12647  *
12648  */
12649 
12650 /* Python wrapper */
12651 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject * __pyx_v_self)12652 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
12653   PyObject *__pyx_r = 0;
12654   __Pyx_RefNannyDeclarations
12655   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12656   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12657 
12658   /* function exit code */
12659   __Pyx_RefNannyFinishContext();
12660   return __pyx_r;
12661 }
12662 
__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj * __pyx_v_self)12663 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12664   PyObject *__pyx_r = NULL;
12665   __Pyx_RefNannyDeclarations
12666   PyObject *__pyx_t_1 = NULL;
12667   int __pyx_lineno = 0;
12668   const char *__pyx_filename = NULL;
12669   int __pyx_clineno = 0;
12670   __Pyx_RefNannySetupContext("__get__", 0);
12671 
12672   /* "View.MemoryView":587
12673  *     @property
12674  *     def itemsize(self):
12675  *         return self.view.itemsize             # <<<<<<<<<<<<<<
12676  *
12677  *     @property
12678  */
12679   __Pyx_XDECREF(__pyx_r);
12680   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error)
12681   __Pyx_GOTREF(__pyx_t_1);
12682   __pyx_r = __pyx_t_1;
12683   __pyx_t_1 = 0;
12684   goto __pyx_L0;
12685 
12686   /* "View.MemoryView":586
12687  *
12688  *     @property
12689  *     def itemsize(self):             # <<<<<<<<<<<<<<
12690  *         return self.view.itemsize
12691  *
12692  */
12693 
12694   /* function exit code */
12695   __pyx_L1_error:;
12696   __Pyx_XDECREF(__pyx_t_1);
12697   __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12698   __pyx_r = NULL;
12699   __pyx_L0:;
12700   __Pyx_XGIVEREF(__pyx_r);
12701   __Pyx_RefNannyFinishContext();
12702   return __pyx_r;
12703 }
12704 
12705 /* "View.MemoryView":590
12706  *
12707  *     @property
12708  *     def nbytes(self):             # <<<<<<<<<<<<<<
12709  *         return self.size * self.view.itemsize
12710  *
12711  */
12712 
12713 /* Python wrapper */
12714 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject * __pyx_v_self)12715 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
12716   PyObject *__pyx_r = 0;
12717   __Pyx_RefNannyDeclarations
12718   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12719   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12720 
12721   /* function exit code */
12722   __Pyx_RefNannyFinishContext();
12723   return __pyx_r;
12724 }
12725 
__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj * __pyx_v_self)12726 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12727   PyObject *__pyx_r = NULL;
12728   __Pyx_RefNannyDeclarations
12729   PyObject *__pyx_t_1 = NULL;
12730   PyObject *__pyx_t_2 = NULL;
12731   PyObject *__pyx_t_3 = NULL;
12732   int __pyx_lineno = 0;
12733   const char *__pyx_filename = NULL;
12734   int __pyx_clineno = 0;
12735   __Pyx_RefNannySetupContext("__get__", 0);
12736 
12737   /* "View.MemoryView":591
12738  *     @property
12739  *     def nbytes(self):
12740  *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
12741  *
12742  *     @property
12743  */
12744   __Pyx_XDECREF(__pyx_r);
12745   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 591, __pyx_L1_error)
12746   __Pyx_GOTREF(__pyx_t_1);
12747   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __pyx_L1_error)
12748   __Pyx_GOTREF(__pyx_t_2);
12749   __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __pyx_L1_error)
12750   __Pyx_GOTREF(__pyx_t_3);
12751   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12752   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12753   __pyx_r = __pyx_t_3;
12754   __pyx_t_3 = 0;
12755   goto __pyx_L0;
12756 
12757   /* "View.MemoryView":590
12758  *
12759  *     @property
12760  *     def nbytes(self):             # <<<<<<<<<<<<<<
12761  *         return self.size * self.view.itemsize
12762  *
12763  */
12764 
12765   /* function exit code */
12766   __pyx_L1_error:;
12767   __Pyx_XDECREF(__pyx_t_1);
12768   __Pyx_XDECREF(__pyx_t_2);
12769   __Pyx_XDECREF(__pyx_t_3);
12770   __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12771   __pyx_r = NULL;
12772   __pyx_L0:;
12773   __Pyx_XGIVEREF(__pyx_r);
12774   __Pyx_RefNannyFinishContext();
12775   return __pyx_r;
12776 }
12777 
12778 /* "View.MemoryView":594
12779  *
12780  *     @property
12781  *     def size(self):             # <<<<<<<<<<<<<<
12782  *         if self._size is None:
12783  *             result = 1
12784  */
12785 
12786 /* Python wrapper */
12787 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject * __pyx_v_self)12788 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
12789   PyObject *__pyx_r = 0;
12790   __Pyx_RefNannyDeclarations
12791   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12792   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12793 
12794   /* function exit code */
12795   __Pyx_RefNannyFinishContext();
12796   return __pyx_r;
12797 }
12798 
__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj * __pyx_v_self)12799 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12800   PyObject *__pyx_v_result = NULL;
12801   PyObject *__pyx_v_length = NULL;
12802   PyObject *__pyx_r = NULL;
12803   __Pyx_RefNannyDeclarations
12804   int __pyx_t_1;
12805   int __pyx_t_2;
12806   Py_ssize_t *__pyx_t_3;
12807   Py_ssize_t *__pyx_t_4;
12808   Py_ssize_t *__pyx_t_5;
12809   PyObject *__pyx_t_6 = NULL;
12810   int __pyx_lineno = 0;
12811   const char *__pyx_filename = NULL;
12812   int __pyx_clineno = 0;
12813   __Pyx_RefNannySetupContext("__get__", 0);
12814 
12815   /* "View.MemoryView":595
12816  *     @property
12817  *     def size(self):
12818  *         if self._size is None:             # <<<<<<<<<<<<<<
12819  *             result = 1
12820  *
12821  */
12822   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
12823   __pyx_t_2 = (__pyx_t_1 != 0);
12824   if (__pyx_t_2) {
12825 
12826     /* "View.MemoryView":596
12827  *     def size(self):
12828  *         if self._size is None:
12829  *             result = 1             # <<<<<<<<<<<<<<
12830  *
12831  *             for length in self.view.shape[:self.view.ndim]:
12832  */
12833     __Pyx_INCREF(__pyx_int_1);
12834     __pyx_v_result = __pyx_int_1;
12835 
12836     /* "View.MemoryView":598
12837  *             result = 1
12838  *
12839  *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
12840  *                 result *= length
12841  *
12842  */
12843     __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
12844     for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
12845       __pyx_t_3 = __pyx_t_5;
12846       __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error)
12847       __Pyx_GOTREF(__pyx_t_6);
12848       __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
12849       __pyx_t_6 = 0;
12850 
12851       /* "View.MemoryView":599
12852  *
12853  *             for length in self.view.shape[:self.view.ndim]:
12854  *                 result *= length             # <<<<<<<<<<<<<<
12855  *
12856  *             self._size = result
12857  */
12858       __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error)
12859       __Pyx_GOTREF(__pyx_t_6);
12860       __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
12861       __pyx_t_6 = 0;
12862     }
12863 
12864     /* "View.MemoryView":601
12865  *                 result *= length
12866  *
12867  *             self._size = result             # <<<<<<<<<<<<<<
12868  *
12869  *         return self._size
12870  */
12871     __Pyx_INCREF(__pyx_v_result);
12872     __Pyx_GIVEREF(__pyx_v_result);
12873     __Pyx_GOTREF(__pyx_v_self->_size);
12874     __Pyx_DECREF(__pyx_v_self->_size);
12875     __pyx_v_self->_size = __pyx_v_result;
12876 
12877     /* "View.MemoryView":595
12878  *     @property
12879  *     def size(self):
12880  *         if self._size is None:             # <<<<<<<<<<<<<<
12881  *             result = 1
12882  *
12883  */
12884   }
12885 
12886   /* "View.MemoryView":603
12887  *             self._size = result
12888  *
12889  *         return self._size             # <<<<<<<<<<<<<<
12890  *
12891  *     def __len__(self):
12892  */
12893   __Pyx_XDECREF(__pyx_r);
12894   __Pyx_INCREF(__pyx_v_self->_size);
12895   __pyx_r = __pyx_v_self->_size;
12896   goto __pyx_L0;
12897 
12898   /* "View.MemoryView":594
12899  *
12900  *     @property
12901  *     def size(self):             # <<<<<<<<<<<<<<
12902  *         if self._size is None:
12903  *             result = 1
12904  */
12905 
12906   /* function exit code */
12907   __pyx_L1_error:;
12908   __Pyx_XDECREF(__pyx_t_6);
12909   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12910   __pyx_r = NULL;
12911   __pyx_L0:;
12912   __Pyx_XDECREF(__pyx_v_result);
12913   __Pyx_XDECREF(__pyx_v_length);
12914   __Pyx_XGIVEREF(__pyx_r);
12915   __Pyx_RefNannyFinishContext();
12916   return __pyx_r;
12917 }
12918 
12919 /* "View.MemoryView":605
12920  *         return self._size
12921  *
12922  *     def __len__(self):             # <<<<<<<<<<<<<<
12923  *         if self.view.ndim >= 1:
12924  *             return self.view.shape[0]
12925  */
12926 
12927 /* Python wrapper */
12928 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___len__(PyObject * __pyx_v_self)12929 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
12930   Py_ssize_t __pyx_r;
12931   __Pyx_RefNannyDeclarations
12932   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
12933   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12934 
12935   /* function exit code */
12936   __Pyx_RefNannyFinishContext();
12937   return __pyx_r;
12938 }
12939 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj * __pyx_v_self)12940 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
12941   Py_ssize_t __pyx_r;
12942   __Pyx_RefNannyDeclarations
12943   int __pyx_t_1;
12944   __Pyx_RefNannySetupContext("__len__", 0);
12945 
12946   /* "View.MemoryView":606
12947  *
12948  *     def __len__(self):
12949  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
12950  *             return self.view.shape[0]
12951  *
12952  */
12953   __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
12954   if (__pyx_t_1) {
12955 
12956     /* "View.MemoryView":607
12957  *     def __len__(self):
12958  *         if self.view.ndim >= 1:
12959  *             return self.view.shape[0]             # <<<<<<<<<<<<<<
12960  *
12961  *         return 0
12962  */
12963     __pyx_r = (__pyx_v_self->view.shape[0]);
12964     goto __pyx_L0;
12965 
12966     /* "View.MemoryView":606
12967  *
12968  *     def __len__(self):
12969  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
12970  *             return self.view.shape[0]
12971  *
12972  */
12973   }
12974 
12975   /* "View.MemoryView":609
12976  *             return self.view.shape[0]
12977  *
12978  *         return 0             # <<<<<<<<<<<<<<
12979  *
12980  *     def __repr__(self):
12981  */
12982   __pyx_r = 0;
12983   goto __pyx_L0;
12984 
12985   /* "View.MemoryView":605
12986  *         return self._size
12987  *
12988  *     def __len__(self):             # <<<<<<<<<<<<<<
12989  *         if self.view.ndim >= 1:
12990  *             return self.view.shape[0]
12991  */
12992 
12993   /* function exit code */
12994   __pyx_L0:;
12995   __Pyx_RefNannyFinishContext();
12996   return __pyx_r;
12997 }
12998 
12999 /* "View.MemoryView":611
13000  *         return 0
13001  *
13002  *     def __repr__(self):             # <<<<<<<<<<<<<<
13003  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
13004  *                                                id(self))
13005  */
13006 
13007 /* Python wrapper */
13008 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___repr__(PyObject * __pyx_v_self)13009 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
13010   PyObject *__pyx_r = 0;
13011   __Pyx_RefNannyDeclarations
13012   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
13013   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13014 
13015   /* function exit code */
13016   __Pyx_RefNannyFinishContext();
13017   return __pyx_r;
13018 }
13019 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj * __pyx_v_self)13020 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
13021   PyObject *__pyx_r = NULL;
13022   __Pyx_RefNannyDeclarations
13023   PyObject *__pyx_t_1 = NULL;
13024   PyObject *__pyx_t_2 = NULL;
13025   PyObject *__pyx_t_3 = NULL;
13026   int __pyx_lineno = 0;
13027   const char *__pyx_filename = NULL;
13028   int __pyx_clineno = 0;
13029   __Pyx_RefNannySetupContext("__repr__", 0);
13030 
13031   /* "View.MemoryView":612
13032  *
13033  *     def __repr__(self):
13034  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
13035  *                                                id(self))
13036  *
13037  */
13038   __Pyx_XDECREF(__pyx_r);
13039   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
13040   __Pyx_GOTREF(__pyx_t_1);
13041   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
13042   __Pyx_GOTREF(__pyx_t_2);
13043   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13044   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
13045   __Pyx_GOTREF(__pyx_t_1);
13046   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13047 
13048   /* "View.MemoryView":613
13049  *     def __repr__(self):
13050  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
13051  *                                                id(self))             # <<<<<<<<<<<<<<
13052  *
13053  *     def __str__(self):
13054  */
13055   __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 613, __pyx_L1_error)
13056   __Pyx_GOTREF(__pyx_t_2);
13057 
13058   /* "View.MemoryView":612
13059  *
13060  *     def __repr__(self):
13061  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
13062  *                                                id(self))
13063  *
13064  */
13065   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error)
13066   __Pyx_GOTREF(__pyx_t_3);
13067   __Pyx_GIVEREF(__pyx_t_1);
13068   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
13069   __Pyx_GIVEREF(__pyx_t_2);
13070   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
13071   __pyx_t_1 = 0;
13072   __pyx_t_2 = 0;
13073   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
13074   __Pyx_GOTREF(__pyx_t_2);
13075   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13076   __pyx_r = __pyx_t_2;
13077   __pyx_t_2 = 0;
13078   goto __pyx_L0;
13079 
13080   /* "View.MemoryView":611
13081  *         return 0
13082  *
13083  *     def __repr__(self):             # <<<<<<<<<<<<<<
13084  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
13085  *                                                id(self))
13086  */
13087 
13088   /* function exit code */
13089   __pyx_L1_error:;
13090   __Pyx_XDECREF(__pyx_t_1);
13091   __Pyx_XDECREF(__pyx_t_2);
13092   __Pyx_XDECREF(__pyx_t_3);
13093   __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13094   __pyx_r = NULL;
13095   __pyx_L0:;
13096   __Pyx_XGIVEREF(__pyx_r);
13097   __Pyx_RefNannyFinishContext();
13098   return __pyx_r;
13099 }
13100 
13101 /* "View.MemoryView":615
13102  *                                                id(self))
13103  *
13104  *     def __str__(self):             # <<<<<<<<<<<<<<
13105  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
13106  *
13107  */
13108 
13109 /* Python wrapper */
13110 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___str__(PyObject * __pyx_v_self)13111 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
13112   PyObject *__pyx_r = 0;
13113   __Pyx_RefNannyDeclarations
13114   __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
13115   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13116 
13117   /* function exit code */
13118   __Pyx_RefNannyFinishContext();
13119   return __pyx_r;
13120 }
13121 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj * __pyx_v_self)13122 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
13123   PyObject *__pyx_r = NULL;
13124   __Pyx_RefNannyDeclarations
13125   PyObject *__pyx_t_1 = NULL;
13126   PyObject *__pyx_t_2 = NULL;
13127   int __pyx_lineno = 0;
13128   const char *__pyx_filename = NULL;
13129   int __pyx_clineno = 0;
13130   __Pyx_RefNannySetupContext("__str__", 0);
13131 
13132   /* "View.MemoryView":616
13133  *
13134  *     def __str__(self):
13135  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
13136  *
13137  *
13138  */
13139   __Pyx_XDECREF(__pyx_r);
13140   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
13141   __Pyx_GOTREF(__pyx_t_1);
13142   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
13143   __Pyx_GOTREF(__pyx_t_2);
13144   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13145   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
13146   __Pyx_GOTREF(__pyx_t_1);
13147   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13148   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
13149   __Pyx_GOTREF(__pyx_t_2);
13150   __Pyx_GIVEREF(__pyx_t_1);
13151   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
13152   __pyx_t_1 = 0;
13153   __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
13154   __Pyx_GOTREF(__pyx_t_1);
13155   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13156   __pyx_r = __pyx_t_1;
13157   __pyx_t_1 = 0;
13158   goto __pyx_L0;
13159 
13160   /* "View.MemoryView":615
13161  *                                                id(self))
13162  *
13163  *     def __str__(self):             # <<<<<<<<<<<<<<
13164  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
13165  *
13166  */
13167 
13168   /* function exit code */
13169   __pyx_L1_error:;
13170   __Pyx_XDECREF(__pyx_t_1);
13171   __Pyx_XDECREF(__pyx_t_2);
13172   __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13173   __pyx_r = NULL;
13174   __pyx_L0:;
13175   __Pyx_XGIVEREF(__pyx_r);
13176   __Pyx_RefNannyFinishContext();
13177   return __pyx_r;
13178 }
13179 
13180 /* "View.MemoryView":619
13181  *
13182  *
13183  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
13184  *         cdef __Pyx_memviewslice *mslice
13185  *         cdef __Pyx_memviewslice tmp
13186  */
13187 
13188 /* Python wrapper */
13189 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_is_c_contig(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13190 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13191   PyObject *__pyx_r = 0;
13192   __Pyx_RefNannyDeclarations
13193   __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
13194   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
13195 
13196   /* function exit code */
13197   __Pyx_RefNannyFinishContext();
13198   return __pyx_r;
13199 }
13200 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj * __pyx_v_self)13201 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
13202   __Pyx_memviewslice *__pyx_v_mslice;
13203   __Pyx_memviewslice __pyx_v_tmp;
13204   PyObject *__pyx_r = NULL;
13205   __Pyx_RefNannyDeclarations
13206   __Pyx_memviewslice *__pyx_t_1;
13207   PyObject *__pyx_t_2 = NULL;
13208   int __pyx_lineno = 0;
13209   const char *__pyx_filename = NULL;
13210   int __pyx_clineno = 0;
13211   __Pyx_RefNannySetupContext("is_c_contig", 0);
13212 
13213   /* "View.MemoryView":622
13214  *         cdef __Pyx_memviewslice *mslice
13215  *         cdef __Pyx_memviewslice tmp
13216  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
13217  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
13218  *
13219  */
13220   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 622, __pyx_L1_error)
13221   __pyx_v_mslice = __pyx_t_1;
13222 
13223   /* "View.MemoryView":623
13224  *         cdef __Pyx_memviewslice tmp
13225  *         mslice = get_slice_from_memview(self, &tmp)
13226  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
13227  *
13228  *     def is_f_contig(self):
13229  */
13230   __Pyx_XDECREF(__pyx_r);
13231   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 623, __pyx_L1_error)
13232   __Pyx_GOTREF(__pyx_t_2);
13233   __pyx_r = __pyx_t_2;
13234   __pyx_t_2 = 0;
13235   goto __pyx_L0;
13236 
13237   /* "View.MemoryView":619
13238  *
13239  *
13240  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
13241  *         cdef __Pyx_memviewslice *mslice
13242  *         cdef __Pyx_memviewslice tmp
13243  */
13244 
13245   /* function exit code */
13246   __pyx_L1_error:;
13247   __Pyx_XDECREF(__pyx_t_2);
13248   __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
13249   __pyx_r = NULL;
13250   __pyx_L0:;
13251   __Pyx_XGIVEREF(__pyx_r);
13252   __Pyx_RefNannyFinishContext();
13253   return __pyx_r;
13254 }
13255 
13256 /* "View.MemoryView":625
13257  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
13258  *
13259  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
13260  *         cdef __Pyx_memviewslice *mslice
13261  *         cdef __Pyx_memviewslice tmp
13262  */
13263 
13264 /* Python wrapper */
13265 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_is_f_contig(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13266 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13267   PyObject *__pyx_r = 0;
13268   __Pyx_RefNannyDeclarations
13269   __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
13270   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
13271 
13272   /* function exit code */
13273   __Pyx_RefNannyFinishContext();
13274   return __pyx_r;
13275 }
13276 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj * __pyx_v_self)13277 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
13278   __Pyx_memviewslice *__pyx_v_mslice;
13279   __Pyx_memviewslice __pyx_v_tmp;
13280   PyObject *__pyx_r = NULL;
13281   __Pyx_RefNannyDeclarations
13282   __Pyx_memviewslice *__pyx_t_1;
13283   PyObject *__pyx_t_2 = NULL;
13284   int __pyx_lineno = 0;
13285   const char *__pyx_filename = NULL;
13286   int __pyx_clineno = 0;
13287   __Pyx_RefNannySetupContext("is_f_contig", 0);
13288 
13289   /* "View.MemoryView":628
13290  *         cdef __Pyx_memviewslice *mslice
13291  *         cdef __Pyx_memviewslice tmp
13292  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
13293  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
13294  *
13295  */
13296   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 628, __pyx_L1_error)
13297   __pyx_v_mslice = __pyx_t_1;
13298 
13299   /* "View.MemoryView":629
13300  *         cdef __Pyx_memviewslice tmp
13301  *         mslice = get_slice_from_memview(self, &tmp)
13302  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
13303  *
13304  *     def copy(self):
13305  */
13306   __Pyx_XDECREF(__pyx_r);
13307   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 629, __pyx_L1_error)
13308   __Pyx_GOTREF(__pyx_t_2);
13309   __pyx_r = __pyx_t_2;
13310   __pyx_t_2 = 0;
13311   goto __pyx_L0;
13312 
13313   /* "View.MemoryView":625
13314  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
13315  *
13316  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
13317  *         cdef __Pyx_memviewslice *mslice
13318  *         cdef __Pyx_memviewslice tmp
13319  */
13320 
13321   /* function exit code */
13322   __pyx_L1_error:;
13323   __Pyx_XDECREF(__pyx_t_2);
13324   __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
13325   __pyx_r = NULL;
13326   __pyx_L0:;
13327   __Pyx_XGIVEREF(__pyx_r);
13328   __Pyx_RefNannyFinishContext();
13329   return __pyx_r;
13330 }
13331 
13332 /* "View.MemoryView":631
13333  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
13334  *
13335  *     def copy(self):             # <<<<<<<<<<<<<<
13336  *         cdef __Pyx_memviewslice mslice
13337  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
13338  */
13339 
13340 /* Python wrapper */
13341 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_copy(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13342 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13343   PyObject *__pyx_r = 0;
13344   __Pyx_RefNannyDeclarations
13345   __Pyx_RefNannySetupContext("copy (wrapper)", 0);
13346   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
13347 
13348   /* function exit code */
13349   __Pyx_RefNannyFinishContext();
13350   return __pyx_r;
13351 }
13352 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj * __pyx_v_self)13353 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
13354   __Pyx_memviewslice __pyx_v_mslice;
13355   int __pyx_v_flags;
13356   PyObject *__pyx_r = NULL;
13357   __Pyx_RefNannyDeclarations
13358   __Pyx_memviewslice __pyx_t_1;
13359   PyObject *__pyx_t_2 = NULL;
13360   int __pyx_lineno = 0;
13361   const char *__pyx_filename = NULL;
13362   int __pyx_clineno = 0;
13363   __Pyx_RefNannySetupContext("copy", 0);
13364 
13365   /* "View.MemoryView":633
13366  *     def copy(self):
13367  *         cdef __Pyx_memviewslice mslice
13368  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
13369  *
13370  *         slice_copy(self, &mslice)
13371  */
13372   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
13373 
13374   /* "View.MemoryView":635
13375  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
13376  *
13377  *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
13378  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
13379  *                                    self.view.itemsize,
13380  */
13381   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
13382 
13383   /* "View.MemoryView":636
13384  *
13385  *         slice_copy(self, &mslice)
13386  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
13387  *                                    self.view.itemsize,
13388  *                                    flags|PyBUF_C_CONTIGUOUS,
13389  */
13390   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 636, __pyx_L1_error)
13391   __pyx_v_mslice = __pyx_t_1;
13392 
13393   /* "View.MemoryView":641
13394  *                                    self.dtype_is_object)
13395  *
13396  *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
13397  *
13398  *     def copy_fortran(self):
13399  */
13400   __Pyx_XDECREF(__pyx_r);
13401   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 641, __pyx_L1_error)
13402   __Pyx_GOTREF(__pyx_t_2);
13403   __pyx_r = __pyx_t_2;
13404   __pyx_t_2 = 0;
13405   goto __pyx_L0;
13406 
13407   /* "View.MemoryView":631
13408  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
13409  *
13410  *     def copy(self):             # <<<<<<<<<<<<<<
13411  *         cdef __Pyx_memviewslice mslice
13412  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
13413  */
13414 
13415   /* function exit code */
13416   __pyx_L1_error:;
13417   __Pyx_XDECREF(__pyx_t_2);
13418   __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
13419   __pyx_r = NULL;
13420   __pyx_L0:;
13421   __Pyx_XGIVEREF(__pyx_r);
13422   __Pyx_RefNannyFinishContext();
13423   return __pyx_r;
13424 }
13425 
13426 /* "View.MemoryView":643
13427  *         return memoryview_copy_from_slice(self, &mslice)
13428  *
13429  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
13430  *         cdef __Pyx_memviewslice src, dst
13431  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
13432  */
13433 
13434 /* Python wrapper */
13435 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_copy_fortran(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13436 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13437   PyObject *__pyx_r = 0;
13438   __Pyx_RefNannyDeclarations
13439   __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
13440   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
13441 
13442   /* function exit code */
13443   __Pyx_RefNannyFinishContext();
13444   return __pyx_r;
13445 }
13446 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj * __pyx_v_self)13447 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
13448   __Pyx_memviewslice __pyx_v_src;
13449   __Pyx_memviewslice __pyx_v_dst;
13450   int __pyx_v_flags;
13451   PyObject *__pyx_r = NULL;
13452   __Pyx_RefNannyDeclarations
13453   __Pyx_memviewslice __pyx_t_1;
13454   PyObject *__pyx_t_2 = NULL;
13455   int __pyx_lineno = 0;
13456   const char *__pyx_filename = NULL;
13457   int __pyx_clineno = 0;
13458   __Pyx_RefNannySetupContext("copy_fortran", 0);
13459 
13460   /* "View.MemoryView":645
13461  *     def copy_fortran(self):
13462  *         cdef __Pyx_memviewslice src, dst
13463  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
13464  *
13465  *         slice_copy(self, &src)
13466  */
13467   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
13468 
13469   /* "View.MemoryView":647
13470  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
13471  *
13472  *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
13473  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
13474  *                                 self.view.itemsize,
13475  */
13476   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
13477 
13478   /* "View.MemoryView":648
13479  *
13480  *         slice_copy(self, &src)
13481  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
13482  *                                 self.view.itemsize,
13483  *                                 flags|PyBUF_F_CONTIGUOUS,
13484  */
13485   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 648, __pyx_L1_error)
13486   __pyx_v_dst = __pyx_t_1;
13487 
13488   /* "View.MemoryView":653
13489  *                                 self.dtype_is_object)
13490  *
13491  *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
13492  *
13493  *
13494  */
13495   __Pyx_XDECREF(__pyx_r);
13496   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error)
13497   __Pyx_GOTREF(__pyx_t_2);
13498   __pyx_r = __pyx_t_2;
13499   __pyx_t_2 = 0;
13500   goto __pyx_L0;
13501 
13502   /* "View.MemoryView":643
13503  *         return memoryview_copy_from_slice(self, &mslice)
13504  *
13505  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
13506  *         cdef __Pyx_memviewslice src, dst
13507  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
13508  */
13509 
13510   /* function exit code */
13511   __pyx_L1_error:;
13512   __Pyx_XDECREF(__pyx_t_2);
13513   __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
13514   __pyx_r = NULL;
13515   __pyx_L0:;
13516   __Pyx_XGIVEREF(__pyx_r);
13517   __Pyx_RefNannyFinishContext();
13518   return __pyx_r;
13519 }
13520 
13521 /* "(tree fragment)":1
13522  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
13523  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13524  * def __setstate_cython__(self, __pyx_state):
13525  */
13526 
13527 /* Python wrapper */
13528 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13529 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13530   PyObject *__pyx_r = 0;
13531   __Pyx_RefNannyDeclarations
13532   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
13533   __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13534 
13535   /* function exit code */
13536   __Pyx_RefNannyFinishContext();
13537   return __pyx_r;
13538 }
13539 
__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self)13540 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
13541   PyObject *__pyx_r = NULL;
13542   __Pyx_RefNannyDeclarations
13543   PyObject *__pyx_t_1 = NULL;
13544   int __pyx_lineno = 0;
13545   const char *__pyx_filename = NULL;
13546   int __pyx_clineno = 0;
13547   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
13548 
13549   /* "(tree fragment)":2
13550  * def __reduce_cython__(self):
13551  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
13552  * def __setstate_cython__(self, __pyx_state):
13553  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13554  */
13555   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
13556   __Pyx_GOTREF(__pyx_t_1);
13557   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13558   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13559   __PYX_ERR(2, 2, __pyx_L1_error)
13560 
13561   /* "(tree fragment)":1
13562  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
13563  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13564  * def __setstate_cython__(self, __pyx_state):
13565  */
13566 
13567   /* function exit code */
13568   __pyx_L1_error:;
13569   __Pyx_XDECREF(__pyx_t_1);
13570   __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13571   __pyx_r = NULL;
13572   __Pyx_XGIVEREF(__pyx_r);
13573   __Pyx_RefNannyFinishContext();
13574   return __pyx_r;
13575 }
13576 
13577 /* "(tree fragment)":3
13578  * def __reduce_cython__(self):
13579  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13580  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
13581  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13582  */
13583 
13584 /* Python wrapper */
13585 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)13586 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
13587   PyObject *__pyx_r = 0;
13588   __Pyx_RefNannyDeclarations
13589   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
13590   __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
13591 
13592   /* function exit code */
13593   __Pyx_RefNannyFinishContext();
13594   return __pyx_r;
13595 }
13596 
__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)13597 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
13598   PyObject *__pyx_r = NULL;
13599   __Pyx_RefNannyDeclarations
13600   PyObject *__pyx_t_1 = NULL;
13601   int __pyx_lineno = 0;
13602   const char *__pyx_filename = NULL;
13603   int __pyx_clineno = 0;
13604   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
13605 
13606   /* "(tree fragment)":4
13607  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13608  * def __setstate_cython__(self, __pyx_state):
13609  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
13610  */
13611   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
13612   __Pyx_GOTREF(__pyx_t_1);
13613   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13614   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13615   __PYX_ERR(2, 4, __pyx_L1_error)
13616 
13617   /* "(tree fragment)":3
13618  * def __reduce_cython__(self):
13619  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13620  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
13621  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13622  */
13623 
13624   /* function exit code */
13625   __pyx_L1_error:;
13626   __Pyx_XDECREF(__pyx_t_1);
13627   __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13628   __pyx_r = NULL;
13629   __Pyx_XGIVEREF(__pyx_r);
13630   __Pyx_RefNannyFinishContext();
13631   return __pyx_r;
13632 }
13633 
13634 /* "View.MemoryView":657
13635  *
13636  * @cname('__pyx_memoryview_new')
13637  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
13638  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13639  *     result.typeinfo = typeinfo
13640  */
13641 
__pyx_memoryview_new(PyObject * __pyx_v_o,int __pyx_v_flags,int __pyx_v_dtype_is_object,__Pyx_TypeInfo * __pyx_v_typeinfo)13642 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
13643   struct __pyx_memoryview_obj *__pyx_v_result = 0;
13644   PyObject *__pyx_r = NULL;
13645   __Pyx_RefNannyDeclarations
13646   PyObject *__pyx_t_1 = NULL;
13647   PyObject *__pyx_t_2 = NULL;
13648   PyObject *__pyx_t_3 = NULL;
13649   int __pyx_lineno = 0;
13650   const char *__pyx_filename = NULL;
13651   int __pyx_clineno = 0;
13652   __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
13653 
13654   /* "View.MemoryView":658
13655  * @cname('__pyx_memoryview_new')
13656  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
13657  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
13658  *     result.typeinfo = typeinfo
13659  *     return result
13660  */
13661   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error)
13662   __Pyx_GOTREF(__pyx_t_1);
13663   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
13664   __Pyx_GOTREF(__pyx_t_2);
13665   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error)
13666   __Pyx_GOTREF(__pyx_t_3);
13667   __Pyx_INCREF(__pyx_v_o);
13668   __Pyx_GIVEREF(__pyx_v_o);
13669   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
13670   __Pyx_GIVEREF(__pyx_t_1);
13671   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
13672   __Pyx_GIVEREF(__pyx_t_2);
13673   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
13674   __pyx_t_1 = 0;
13675   __pyx_t_2 = 0;
13676   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
13677   __Pyx_GOTREF(__pyx_t_2);
13678   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13679   __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
13680   __pyx_t_2 = 0;
13681 
13682   /* "View.MemoryView":659
13683  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
13684  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13685  *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
13686  *     return result
13687  *
13688  */
13689   __pyx_v_result->typeinfo = __pyx_v_typeinfo;
13690 
13691   /* "View.MemoryView":660
13692  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13693  *     result.typeinfo = typeinfo
13694  *     return result             # <<<<<<<<<<<<<<
13695  *
13696  * @cname('__pyx_memoryview_check')
13697  */
13698   __Pyx_XDECREF(__pyx_r);
13699   __Pyx_INCREF(((PyObject *)__pyx_v_result));
13700   __pyx_r = ((PyObject *)__pyx_v_result);
13701   goto __pyx_L0;
13702 
13703   /* "View.MemoryView":657
13704  *
13705  * @cname('__pyx_memoryview_new')
13706  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
13707  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13708  *     result.typeinfo = typeinfo
13709  */
13710 
13711   /* function exit code */
13712   __pyx_L1_error:;
13713   __Pyx_XDECREF(__pyx_t_1);
13714   __Pyx_XDECREF(__pyx_t_2);
13715   __Pyx_XDECREF(__pyx_t_3);
13716   __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
13717   __pyx_r = 0;
13718   __pyx_L0:;
13719   __Pyx_XDECREF((PyObject *)__pyx_v_result);
13720   __Pyx_XGIVEREF(__pyx_r);
13721   __Pyx_RefNannyFinishContext();
13722   return __pyx_r;
13723 }
13724 
13725 /* "View.MemoryView":663
13726  *
13727  * @cname('__pyx_memoryview_check')
13728  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
13729  *     return isinstance(o, memoryview)
13730  *
13731  */
13732 
__pyx_memoryview_check(PyObject * __pyx_v_o)13733 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
13734   int __pyx_r;
13735   __Pyx_RefNannyDeclarations
13736   int __pyx_t_1;
13737   __Pyx_RefNannySetupContext("memoryview_check", 0);
13738 
13739   /* "View.MemoryView":664
13740  * @cname('__pyx_memoryview_check')
13741  * cdef inline bint memoryview_check(object o):
13742  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
13743  *
13744  * cdef tuple _unellipsify(object index, int ndim):
13745  */
13746   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
13747   __pyx_r = __pyx_t_1;
13748   goto __pyx_L0;
13749 
13750   /* "View.MemoryView":663
13751  *
13752  * @cname('__pyx_memoryview_check')
13753  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
13754  *     return isinstance(o, memoryview)
13755  *
13756  */
13757 
13758   /* function exit code */
13759   __pyx_L0:;
13760   __Pyx_RefNannyFinishContext();
13761   return __pyx_r;
13762 }
13763 
13764 /* "View.MemoryView":666
13765  *     return isinstance(o, memoryview)
13766  *
13767  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
13768  *     """
13769  *     Replace all ellipses with full slices and fill incomplete indices with
13770  */
13771 
_unellipsify(PyObject * __pyx_v_index,int __pyx_v_ndim)13772 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
13773   PyObject *__pyx_v_tup = NULL;
13774   PyObject *__pyx_v_result = NULL;
13775   int __pyx_v_have_slices;
13776   int __pyx_v_seen_ellipsis;
13777   CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
13778   PyObject *__pyx_v_item = NULL;
13779   Py_ssize_t __pyx_v_nslices;
13780   PyObject *__pyx_r = NULL;
13781   __Pyx_RefNannyDeclarations
13782   int __pyx_t_1;
13783   int __pyx_t_2;
13784   PyObject *__pyx_t_3 = NULL;
13785   PyObject *__pyx_t_4 = NULL;
13786   Py_ssize_t __pyx_t_5;
13787   PyObject *(*__pyx_t_6)(PyObject *);
13788   PyObject *__pyx_t_7 = NULL;
13789   Py_ssize_t __pyx_t_8;
13790   int __pyx_t_9;
13791   int __pyx_t_10;
13792   PyObject *__pyx_t_11 = NULL;
13793   int __pyx_lineno = 0;
13794   const char *__pyx_filename = NULL;
13795   int __pyx_clineno = 0;
13796   __Pyx_RefNannySetupContext("_unellipsify", 0);
13797 
13798   /* "View.MemoryView":671
13799  *     full slices.
13800  *     """
13801  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
13802  *         tup = (index,)
13803  *     else:
13804  */
13805   __pyx_t_1 = PyTuple_Check(__pyx_v_index);
13806   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
13807   if (__pyx_t_2) {
13808 
13809     /* "View.MemoryView":672
13810  *     """
13811  *     if not isinstance(index, tuple):
13812  *         tup = (index,)             # <<<<<<<<<<<<<<
13813  *     else:
13814  *         tup = index
13815  */
13816     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error)
13817     __Pyx_GOTREF(__pyx_t_3);
13818     __Pyx_INCREF(__pyx_v_index);
13819     __Pyx_GIVEREF(__pyx_v_index);
13820     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
13821     __pyx_v_tup = __pyx_t_3;
13822     __pyx_t_3 = 0;
13823 
13824     /* "View.MemoryView":671
13825  *     full slices.
13826  *     """
13827  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
13828  *         tup = (index,)
13829  *     else:
13830  */
13831     goto __pyx_L3;
13832   }
13833 
13834   /* "View.MemoryView":674
13835  *         tup = (index,)
13836  *     else:
13837  *         tup = index             # <<<<<<<<<<<<<<
13838  *
13839  *     result = []
13840  */
13841   /*else*/ {
13842     __Pyx_INCREF(__pyx_v_index);
13843     __pyx_v_tup = __pyx_v_index;
13844   }
13845   __pyx_L3:;
13846 
13847   /* "View.MemoryView":676
13848  *         tup = index
13849  *
13850  *     result = []             # <<<<<<<<<<<<<<
13851  *     have_slices = False
13852  *     seen_ellipsis = False
13853  */
13854   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error)
13855   __Pyx_GOTREF(__pyx_t_3);
13856   __pyx_v_result = ((PyObject*)__pyx_t_3);
13857   __pyx_t_3 = 0;
13858 
13859   /* "View.MemoryView":677
13860  *
13861  *     result = []
13862  *     have_slices = False             # <<<<<<<<<<<<<<
13863  *     seen_ellipsis = False
13864  *     for idx, item in enumerate(tup):
13865  */
13866   __pyx_v_have_slices = 0;
13867 
13868   /* "View.MemoryView":678
13869  *     result = []
13870  *     have_slices = False
13871  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
13872  *     for idx, item in enumerate(tup):
13873  *         if item is Ellipsis:
13874  */
13875   __pyx_v_seen_ellipsis = 0;
13876 
13877   /* "View.MemoryView":679
13878  *     have_slices = False
13879  *     seen_ellipsis = False
13880  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
13881  *         if item is Ellipsis:
13882  *             if not seen_ellipsis:
13883  */
13884   __Pyx_INCREF(__pyx_int_0);
13885   __pyx_t_3 = __pyx_int_0;
13886   if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
13887     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
13888     __pyx_t_6 = NULL;
13889   } else {
13890     __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error)
13891     __Pyx_GOTREF(__pyx_t_4);
13892     __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error)
13893   }
13894   for (;;) {
13895     if (likely(!__pyx_t_6)) {
13896       if (likely(PyList_CheckExact(__pyx_t_4))) {
13897         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
13898         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13899         __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
13900         #else
13901         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
13902         __Pyx_GOTREF(__pyx_t_7);
13903         #endif
13904       } else {
13905         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
13906         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13907         __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
13908         #else
13909         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
13910         __Pyx_GOTREF(__pyx_t_7);
13911         #endif
13912       }
13913     } else {
13914       __pyx_t_7 = __pyx_t_6(__pyx_t_4);
13915       if (unlikely(!__pyx_t_7)) {
13916         PyObject* exc_type = PyErr_Occurred();
13917         if (exc_type) {
13918           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
13919           else __PYX_ERR(2, 679, __pyx_L1_error)
13920         }
13921         break;
13922       }
13923       __Pyx_GOTREF(__pyx_t_7);
13924     }
13925     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
13926     __pyx_t_7 = 0;
13927     __Pyx_INCREF(__pyx_t_3);
13928     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
13929     __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
13930     __Pyx_GOTREF(__pyx_t_7);
13931     __Pyx_DECREF(__pyx_t_3);
13932     __pyx_t_3 = __pyx_t_7;
13933     __pyx_t_7 = 0;
13934 
13935     /* "View.MemoryView":680
13936  *     seen_ellipsis = False
13937  *     for idx, item in enumerate(tup):
13938  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
13939  *             if not seen_ellipsis:
13940  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13941  */
13942     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
13943     __pyx_t_1 = (__pyx_t_2 != 0);
13944     if (__pyx_t_1) {
13945 
13946       /* "View.MemoryView":681
13947  *     for idx, item in enumerate(tup):
13948  *         if item is Ellipsis:
13949  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
13950  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13951  *                 seen_ellipsis = True
13952  */
13953       __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
13954       if (__pyx_t_1) {
13955 
13956         /* "View.MemoryView":682
13957  *         if item is Ellipsis:
13958  *             if not seen_ellipsis:
13959  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
13960  *                 seen_ellipsis = True
13961  *             else:
13962  */
13963         __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
13964         __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 682, __pyx_L1_error)
13965         __Pyx_GOTREF(__pyx_t_7);
13966         { Py_ssize_t __pyx_temp;
13967           for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
13968             __Pyx_INCREF(__pyx_slice__19);
13969             __Pyx_GIVEREF(__pyx_slice__19);
13970             PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__19);
13971           }
13972         }
13973         __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
13974         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13975 
13976         /* "View.MemoryView":683
13977  *             if not seen_ellipsis:
13978  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13979  *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
13980  *             else:
13981  *                 result.append(slice(None))
13982  */
13983         __pyx_v_seen_ellipsis = 1;
13984 
13985         /* "View.MemoryView":681
13986  *     for idx, item in enumerate(tup):
13987  *         if item is Ellipsis:
13988  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
13989  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13990  *                 seen_ellipsis = True
13991  */
13992         goto __pyx_L7;
13993       }
13994 
13995       /* "View.MemoryView":685
13996  *                 seen_ellipsis = True
13997  *             else:
13998  *                 result.append(slice(None))             # <<<<<<<<<<<<<<
13999  *             have_slices = True
14000  *         else:
14001  */
14002       /*else*/ {
14003         __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__19); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 685, __pyx_L1_error)
14004       }
14005       __pyx_L7:;
14006 
14007       /* "View.MemoryView":686
14008  *             else:
14009  *                 result.append(slice(None))
14010  *             have_slices = True             # <<<<<<<<<<<<<<
14011  *         else:
14012  *             if not isinstance(item, slice) and not PyIndex_Check(item):
14013  */
14014       __pyx_v_have_slices = 1;
14015 
14016       /* "View.MemoryView":680
14017  *     seen_ellipsis = False
14018  *     for idx, item in enumerate(tup):
14019  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
14020  *             if not seen_ellipsis:
14021  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
14022  */
14023       goto __pyx_L6;
14024     }
14025 
14026     /* "View.MemoryView":688
14027  *             have_slices = True
14028  *         else:
14029  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
14030  *                 raise TypeError("Cannot index with type '%s'" % type(item))
14031  *
14032  */
14033     /*else*/ {
14034       __pyx_t_2 = PySlice_Check(__pyx_v_item);
14035       __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
14036       if (__pyx_t_10) {
14037       } else {
14038         __pyx_t_1 = __pyx_t_10;
14039         goto __pyx_L9_bool_binop_done;
14040       }
14041       __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
14042       __pyx_t_1 = __pyx_t_10;
14043       __pyx_L9_bool_binop_done:;
14044       if (unlikely(__pyx_t_1)) {
14045 
14046         /* "View.MemoryView":689
14047  *         else:
14048  *             if not isinstance(item, slice) and not PyIndex_Check(item):
14049  *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
14050  *
14051  *             have_slices = have_slices or isinstance(item, slice)
14052  */
14053         __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 689, __pyx_L1_error)
14054         __Pyx_GOTREF(__pyx_t_7);
14055         __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error)
14056         __Pyx_GOTREF(__pyx_t_11);
14057         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14058         __Pyx_Raise(__pyx_t_11, 0, 0, 0);
14059         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14060         __PYX_ERR(2, 689, __pyx_L1_error)
14061 
14062         /* "View.MemoryView":688
14063  *             have_slices = True
14064  *         else:
14065  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
14066  *                 raise TypeError("Cannot index with type '%s'" % type(item))
14067  *
14068  */
14069       }
14070 
14071       /* "View.MemoryView":691
14072  *                 raise TypeError("Cannot index with type '%s'" % type(item))
14073  *
14074  *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
14075  *             result.append(item)
14076  *
14077  */
14078       __pyx_t_10 = (__pyx_v_have_slices != 0);
14079       if (!__pyx_t_10) {
14080       } else {
14081         __pyx_t_1 = __pyx_t_10;
14082         goto __pyx_L11_bool_binop_done;
14083       }
14084       __pyx_t_10 = PySlice_Check(__pyx_v_item);
14085       __pyx_t_2 = (__pyx_t_10 != 0);
14086       __pyx_t_1 = __pyx_t_2;
14087       __pyx_L11_bool_binop_done:;
14088       __pyx_v_have_slices = __pyx_t_1;
14089 
14090       /* "View.MemoryView":692
14091  *
14092  *             have_slices = have_slices or isinstance(item, slice)
14093  *             result.append(item)             # <<<<<<<<<<<<<<
14094  *
14095  *     nslices = ndim - len(result)
14096  */
14097       __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error)
14098     }
14099     __pyx_L6:;
14100 
14101     /* "View.MemoryView":679
14102  *     have_slices = False
14103  *     seen_ellipsis = False
14104  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
14105  *         if item is Ellipsis:
14106  *             if not seen_ellipsis:
14107  */
14108   }
14109   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14110   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14111 
14112   /* "View.MemoryView":694
14113  *             result.append(item)
14114  *
14115  *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
14116  *     if nslices:
14117  *         result.extend([slice(None)] * nslices)
14118  */
14119   __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 694, __pyx_L1_error)
14120   __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
14121 
14122   /* "View.MemoryView":695
14123  *
14124  *     nslices = ndim - len(result)
14125  *     if nslices:             # <<<<<<<<<<<<<<
14126  *         result.extend([slice(None)] * nslices)
14127  *
14128  */
14129   __pyx_t_1 = (__pyx_v_nslices != 0);
14130   if (__pyx_t_1) {
14131 
14132     /* "View.MemoryView":696
14133  *     nslices = ndim - len(result)
14134  *     if nslices:
14135  *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
14136  *
14137  *     return have_slices or nslices, tuple(result)
14138  */
14139     __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 696, __pyx_L1_error)
14140     __Pyx_GOTREF(__pyx_t_3);
14141     { Py_ssize_t __pyx_temp;
14142       for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
14143         __Pyx_INCREF(__pyx_slice__19);
14144         __Pyx_GIVEREF(__pyx_slice__19);
14145         PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__19);
14146       }
14147     }
14148     __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 696, __pyx_L1_error)
14149     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14150 
14151     /* "View.MemoryView":695
14152  *
14153  *     nslices = ndim - len(result)
14154  *     if nslices:             # <<<<<<<<<<<<<<
14155  *         result.extend([slice(None)] * nslices)
14156  *
14157  */
14158   }
14159 
14160   /* "View.MemoryView":698
14161  *         result.extend([slice(None)] * nslices)
14162  *
14163  *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
14164  *
14165  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
14166  */
14167   __Pyx_XDECREF(__pyx_r);
14168   if (!__pyx_v_have_slices) {
14169   } else {
14170     __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
14171     __Pyx_GOTREF(__pyx_t_4);
14172     __pyx_t_3 = __pyx_t_4;
14173     __pyx_t_4 = 0;
14174     goto __pyx_L14_bool_binop_done;
14175   }
14176   __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
14177   __Pyx_GOTREF(__pyx_t_4);
14178   __pyx_t_3 = __pyx_t_4;
14179   __pyx_t_4 = 0;
14180   __pyx_L14_bool_binop_done:;
14181   __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
14182   __Pyx_GOTREF(__pyx_t_4);
14183   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error)
14184   __Pyx_GOTREF(__pyx_t_11);
14185   __Pyx_GIVEREF(__pyx_t_3);
14186   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
14187   __Pyx_GIVEREF(__pyx_t_4);
14188   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
14189   __pyx_t_3 = 0;
14190   __pyx_t_4 = 0;
14191   __pyx_r = ((PyObject*)__pyx_t_11);
14192   __pyx_t_11 = 0;
14193   goto __pyx_L0;
14194 
14195   /* "View.MemoryView":666
14196  *     return isinstance(o, memoryview)
14197  *
14198  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
14199  *     """
14200  *     Replace all ellipses with full slices and fill incomplete indices with
14201  */
14202 
14203   /* function exit code */
14204   __pyx_L1_error:;
14205   __Pyx_XDECREF(__pyx_t_3);
14206   __Pyx_XDECREF(__pyx_t_4);
14207   __Pyx_XDECREF(__pyx_t_7);
14208   __Pyx_XDECREF(__pyx_t_11);
14209   __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
14210   __pyx_r = 0;
14211   __pyx_L0:;
14212   __Pyx_XDECREF(__pyx_v_tup);
14213   __Pyx_XDECREF(__pyx_v_result);
14214   __Pyx_XDECREF(__pyx_v_idx);
14215   __Pyx_XDECREF(__pyx_v_item);
14216   __Pyx_XGIVEREF(__pyx_r);
14217   __Pyx_RefNannyFinishContext();
14218   return __pyx_r;
14219 }
14220 
14221 /* "View.MemoryView":700
14222  *     return have_slices or nslices, tuple(result)
14223  *
14224  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
14225  *     for suboffset in suboffsets[:ndim]:
14226  *         if suboffset >= 0:
14227  */
14228 
assert_direct_dimensions(Py_ssize_t * __pyx_v_suboffsets,int __pyx_v_ndim)14229 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
14230   Py_ssize_t __pyx_v_suboffset;
14231   PyObject *__pyx_r = NULL;
14232   __Pyx_RefNannyDeclarations
14233   Py_ssize_t *__pyx_t_1;
14234   Py_ssize_t *__pyx_t_2;
14235   Py_ssize_t *__pyx_t_3;
14236   int __pyx_t_4;
14237   PyObject *__pyx_t_5 = NULL;
14238   int __pyx_lineno = 0;
14239   const char *__pyx_filename = NULL;
14240   int __pyx_clineno = 0;
14241   __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
14242 
14243   /* "View.MemoryView":701
14244  *
14245  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
14246  *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
14247  *         if suboffset >= 0:
14248  *             raise ValueError("Indirect dimensions not supported")
14249  */
14250   __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
14251   for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
14252     __pyx_t_1 = __pyx_t_3;
14253     __pyx_v_suboffset = (__pyx_t_1[0]);
14254 
14255     /* "View.MemoryView":702
14256  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
14257  *     for suboffset in suboffsets[:ndim]:
14258  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
14259  *             raise ValueError("Indirect dimensions not supported")
14260  *
14261  */
14262     __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
14263     if (unlikely(__pyx_t_4)) {
14264 
14265       /* "View.MemoryView":703
14266  *     for suboffset in suboffsets[:ndim]:
14267  *         if suboffset >= 0:
14268  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
14269  *
14270  *
14271  */
14272       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 703, __pyx_L1_error)
14273       __Pyx_GOTREF(__pyx_t_5);
14274       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
14275       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14276       __PYX_ERR(2, 703, __pyx_L1_error)
14277 
14278       /* "View.MemoryView":702
14279  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
14280  *     for suboffset in suboffsets[:ndim]:
14281  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
14282  *             raise ValueError("Indirect dimensions not supported")
14283  *
14284  */
14285     }
14286   }
14287 
14288   /* "View.MemoryView":700
14289  *     return have_slices or nslices, tuple(result)
14290  *
14291  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
14292  *     for suboffset in suboffsets[:ndim]:
14293  *         if suboffset >= 0:
14294  */
14295 
14296   /* function exit code */
14297   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14298   goto __pyx_L0;
14299   __pyx_L1_error:;
14300   __Pyx_XDECREF(__pyx_t_5);
14301   __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
14302   __pyx_r = 0;
14303   __pyx_L0:;
14304   __Pyx_XGIVEREF(__pyx_r);
14305   __Pyx_RefNannyFinishContext();
14306   return __pyx_r;
14307 }
14308 
14309 /* "View.MemoryView":710
14310  *
14311  * @cname('__pyx_memview_slice')
14312  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
14313  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
14314  *     cdef bint negative_step
14315  */
14316 
__pyx_memview_slice(struct __pyx_memoryview_obj * __pyx_v_memview,PyObject * __pyx_v_indices)14317 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
14318   int __pyx_v_new_ndim;
14319   int __pyx_v_suboffset_dim;
14320   int __pyx_v_dim;
14321   __Pyx_memviewslice __pyx_v_src;
14322   __Pyx_memviewslice __pyx_v_dst;
14323   __Pyx_memviewslice *__pyx_v_p_src;
14324   struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
14325   __Pyx_memviewslice *__pyx_v_p_dst;
14326   int *__pyx_v_p_suboffset_dim;
14327   Py_ssize_t __pyx_v_start;
14328   Py_ssize_t __pyx_v_stop;
14329   Py_ssize_t __pyx_v_step;
14330   int __pyx_v_have_start;
14331   int __pyx_v_have_stop;
14332   int __pyx_v_have_step;
14333   PyObject *__pyx_v_index = NULL;
14334   struct __pyx_memoryview_obj *__pyx_r = NULL;
14335   __Pyx_RefNannyDeclarations
14336   int __pyx_t_1;
14337   int __pyx_t_2;
14338   PyObject *__pyx_t_3 = NULL;
14339   struct __pyx_memoryview_obj *__pyx_t_4;
14340   char *__pyx_t_5;
14341   int __pyx_t_6;
14342   Py_ssize_t __pyx_t_7;
14343   PyObject *(*__pyx_t_8)(PyObject *);
14344   PyObject *__pyx_t_9 = NULL;
14345   Py_ssize_t __pyx_t_10;
14346   int __pyx_t_11;
14347   Py_ssize_t __pyx_t_12;
14348   int __pyx_lineno = 0;
14349   const char *__pyx_filename = NULL;
14350   int __pyx_clineno = 0;
14351   __Pyx_RefNannySetupContext("memview_slice", 0);
14352 
14353   /* "View.MemoryView":711
14354  * @cname('__pyx_memview_slice')
14355  * cdef memoryview memview_slice(memoryview memview, object indices):
14356  *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
14357  *     cdef bint negative_step
14358  *     cdef __Pyx_memviewslice src, dst
14359  */
14360   __pyx_v_new_ndim = 0;
14361   __pyx_v_suboffset_dim = -1;
14362 
14363   /* "View.MemoryView":718
14364  *
14365  *
14366  *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
14367  *
14368  *     cdef _memoryviewslice memviewsliceobj
14369  */
14370   (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
14371 
14372   /* "View.MemoryView":722
14373  *     cdef _memoryviewslice memviewsliceobj
14374  *
14375  *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
14376  *
14377  *     if isinstance(memview, _memoryviewslice):
14378  */
14379   #ifndef CYTHON_WITHOUT_ASSERTIONS
14380   if (unlikely(!Py_OptimizeFlag)) {
14381     if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
14382       PyErr_SetNone(PyExc_AssertionError);
14383       __PYX_ERR(2, 722, __pyx_L1_error)
14384     }
14385   }
14386   #endif
14387 
14388   /* "View.MemoryView":724
14389  *     assert memview.view.ndim > 0
14390  *
14391  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14392  *         memviewsliceobj = memview
14393  *         p_src = &memviewsliceobj.from_slice
14394  */
14395   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14396   __pyx_t_2 = (__pyx_t_1 != 0);
14397   if (__pyx_t_2) {
14398 
14399     /* "View.MemoryView":725
14400  *
14401  *     if isinstance(memview, _memoryviewslice):
14402  *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
14403  *         p_src = &memviewsliceobj.from_slice
14404  *     else:
14405  */
14406     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 725, __pyx_L1_error)
14407     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
14408     __Pyx_INCREF(__pyx_t_3);
14409     __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
14410     __pyx_t_3 = 0;
14411 
14412     /* "View.MemoryView":726
14413  *     if isinstance(memview, _memoryviewslice):
14414  *         memviewsliceobj = memview
14415  *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
14416  *     else:
14417  *         slice_copy(memview, &src)
14418  */
14419     __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
14420 
14421     /* "View.MemoryView":724
14422  *     assert memview.view.ndim > 0
14423  *
14424  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14425  *         memviewsliceobj = memview
14426  *         p_src = &memviewsliceobj.from_slice
14427  */
14428     goto __pyx_L3;
14429   }
14430 
14431   /* "View.MemoryView":728
14432  *         p_src = &memviewsliceobj.from_slice
14433  *     else:
14434  *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
14435  *         p_src = &src
14436  *
14437  */
14438   /*else*/ {
14439     __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
14440 
14441     /* "View.MemoryView":729
14442  *     else:
14443  *         slice_copy(memview, &src)
14444  *         p_src = &src             # <<<<<<<<<<<<<<
14445  *
14446  *
14447  */
14448     __pyx_v_p_src = (&__pyx_v_src);
14449   }
14450   __pyx_L3:;
14451 
14452   /* "View.MemoryView":735
14453  *
14454  *
14455  *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
14456  *     dst.data = p_src.data
14457  *
14458  */
14459   __pyx_t_4 = __pyx_v_p_src->memview;
14460   __pyx_v_dst.memview = __pyx_t_4;
14461 
14462   /* "View.MemoryView":736
14463  *
14464  *     dst.memview = p_src.memview
14465  *     dst.data = p_src.data             # <<<<<<<<<<<<<<
14466  *
14467  *
14468  */
14469   __pyx_t_5 = __pyx_v_p_src->data;
14470   __pyx_v_dst.data = __pyx_t_5;
14471 
14472   /* "View.MemoryView":741
14473  *
14474  *
14475  *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
14476  *     cdef int *p_suboffset_dim = &suboffset_dim
14477  *     cdef Py_ssize_t start, stop, step
14478  */
14479   __pyx_v_p_dst = (&__pyx_v_dst);
14480 
14481   /* "View.MemoryView":742
14482  *
14483  *     cdef __Pyx_memviewslice *p_dst = &dst
14484  *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
14485  *     cdef Py_ssize_t start, stop, step
14486  *     cdef bint have_start, have_stop, have_step
14487  */
14488   __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
14489 
14490   /* "View.MemoryView":746
14491  *     cdef bint have_start, have_stop, have_step
14492  *
14493  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
14494  *         if PyIndex_Check(index):
14495  *             slice_memviewslice(
14496  */
14497   __pyx_t_6 = 0;
14498   if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
14499     __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
14500     __pyx_t_8 = NULL;
14501   } else {
14502     __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error)
14503     __Pyx_GOTREF(__pyx_t_3);
14504     __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error)
14505   }
14506   for (;;) {
14507     if (likely(!__pyx_t_8)) {
14508       if (likely(PyList_CheckExact(__pyx_t_3))) {
14509         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
14510         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14511         __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
14512         #else
14513         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
14514         __Pyx_GOTREF(__pyx_t_9);
14515         #endif
14516       } else {
14517         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
14518         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14519         __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
14520         #else
14521         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
14522         __Pyx_GOTREF(__pyx_t_9);
14523         #endif
14524       }
14525     } else {
14526       __pyx_t_9 = __pyx_t_8(__pyx_t_3);
14527       if (unlikely(!__pyx_t_9)) {
14528         PyObject* exc_type = PyErr_Occurred();
14529         if (exc_type) {
14530           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14531           else __PYX_ERR(2, 746, __pyx_L1_error)
14532         }
14533         break;
14534       }
14535       __Pyx_GOTREF(__pyx_t_9);
14536     }
14537     __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
14538     __pyx_t_9 = 0;
14539     __pyx_v_dim = __pyx_t_6;
14540     __pyx_t_6 = (__pyx_t_6 + 1);
14541 
14542     /* "View.MemoryView":747
14543  *
14544  *     for dim, index in enumerate(indices):
14545  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
14546  *             slice_memviewslice(
14547  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14548  */
14549     __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
14550     if (__pyx_t_2) {
14551 
14552       /* "View.MemoryView":751
14553  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14554  *                 dim, new_ndim, p_suboffset_dim,
14555  *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
14556  *                 0, 0, 0, # have_{start,stop,step}
14557  *                 False)
14558  */
14559       __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 751, __pyx_L1_error)
14560 
14561       /* "View.MemoryView":748
14562  *     for dim, index in enumerate(indices):
14563  *         if PyIndex_Check(index):
14564  *             slice_memviewslice(             # <<<<<<<<<<<<<<
14565  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14566  *                 dim, new_ndim, p_suboffset_dim,
14567  */
14568       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 748, __pyx_L1_error)
14569 
14570       /* "View.MemoryView":747
14571  *
14572  *     for dim, index in enumerate(indices):
14573  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
14574  *             slice_memviewslice(
14575  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14576  */
14577       goto __pyx_L6;
14578     }
14579 
14580     /* "View.MemoryView":754
14581  *                 0, 0, 0, # have_{start,stop,step}
14582  *                 False)
14583  *         elif index is None:             # <<<<<<<<<<<<<<
14584  *             p_dst.shape[new_ndim] = 1
14585  *             p_dst.strides[new_ndim] = 0
14586  */
14587     __pyx_t_2 = (__pyx_v_index == Py_None);
14588     __pyx_t_1 = (__pyx_t_2 != 0);
14589     if (__pyx_t_1) {
14590 
14591       /* "View.MemoryView":755
14592  *                 False)
14593  *         elif index is None:
14594  *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
14595  *             p_dst.strides[new_ndim] = 0
14596  *             p_dst.suboffsets[new_ndim] = -1
14597  */
14598       (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
14599 
14600       /* "View.MemoryView":756
14601  *         elif index is None:
14602  *             p_dst.shape[new_ndim] = 1
14603  *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
14604  *             p_dst.suboffsets[new_ndim] = -1
14605  *             new_ndim += 1
14606  */
14607       (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
14608 
14609       /* "View.MemoryView":757
14610  *             p_dst.shape[new_ndim] = 1
14611  *             p_dst.strides[new_ndim] = 0
14612  *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
14613  *             new_ndim += 1
14614  *         else:
14615  */
14616       (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
14617 
14618       /* "View.MemoryView":758
14619  *             p_dst.strides[new_ndim] = 0
14620  *             p_dst.suboffsets[new_ndim] = -1
14621  *             new_ndim += 1             # <<<<<<<<<<<<<<
14622  *         else:
14623  *             start = index.start or 0
14624  */
14625       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14626 
14627       /* "View.MemoryView":754
14628  *                 0, 0, 0, # have_{start,stop,step}
14629  *                 False)
14630  *         elif index is None:             # <<<<<<<<<<<<<<
14631  *             p_dst.shape[new_ndim] = 1
14632  *             p_dst.strides[new_ndim] = 0
14633  */
14634       goto __pyx_L6;
14635     }
14636 
14637     /* "View.MemoryView":760
14638  *             new_ndim += 1
14639  *         else:
14640  *             start = index.start or 0             # <<<<<<<<<<<<<<
14641  *             stop = index.stop or 0
14642  *             step = index.step or 0
14643  */
14644     /*else*/ {
14645       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error)
14646       __Pyx_GOTREF(__pyx_t_9);
14647       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error)
14648       if (!__pyx_t_1) {
14649         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14650       } else {
14651         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 760, __pyx_L1_error)
14652         __pyx_t_10 = __pyx_t_12;
14653         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14654         goto __pyx_L7_bool_binop_done;
14655       }
14656       __pyx_t_10 = 0;
14657       __pyx_L7_bool_binop_done:;
14658       __pyx_v_start = __pyx_t_10;
14659 
14660       /* "View.MemoryView":761
14661  *         else:
14662  *             start = index.start or 0
14663  *             stop = index.stop or 0             # <<<<<<<<<<<<<<
14664  *             step = index.step or 0
14665  *
14666  */
14667       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error)
14668       __Pyx_GOTREF(__pyx_t_9);
14669       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error)
14670       if (!__pyx_t_1) {
14671         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14672       } else {
14673         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 761, __pyx_L1_error)
14674         __pyx_t_10 = __pyx_t_12;
14675         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14676         goto __pyx_L9_bool_binop_done;
14677       }
14678       __pyx_t_10 = 0;
14679       __pyx_L9_bool_binop_done:;
14680       __pyx_v_stop = __pyx_t_10;
14681 
14682       /* "View.MemoryView":762
14683  *             start = index.start or 0
14684  *             stop = index.stop or 0
14685  *             step = index.step or 0             # <<<<<<<<<<<<<<
14686  *
14687  *             have_start = index.start is not None
14688  */
14689       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error)
14690       __Pyx_GOTREF(__pyx_t_9);
14691       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
14692       if (!__pyx_t_1) {
14693         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14694       } else {
14695         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error)
14696         __pyx_t_10 = __pyx_t_12;
14697         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14698         goto __pyx_L11_bool_binop_done;
14699       }
14700       __pyx_t_10 = 0;
14701       __pyx_L11_bool_binop_done:;
14702       __pyx_v_step = __pyx_t_10;
14703 
14704       /* "View.MemoryView":764
14705  *             step = index.step or 0
14706  *
14707  *             have_start = index.start is not None             # <<<<<<<<<<<<<<
14708  *             have_stop = index.stop is not None
14709  *             have_step = index.step is not None
14710  */
14711       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error)
14712       __Pyx_GOTREF(__pyx_t_9);
14713       __pyx_t_1 = (__pyx_t_9 != Py_None);
14714       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14715       __pyx_v_have_start = __pyx_t_1;
14716 
14717       /* "View.MemoryView":765
14718  *
14719  *             have_start = index.start is not None
14720  *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
14721  *             have_step = index.step is not None
14722  *
14723  */
14724       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 765, __pyx_L1_error)
14725       __Pyx_GOTREF(__pyx_t_9);
14726       __pyx_t_1 = (__pyx_t_9 != Py_None);
14727       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14728       __pyx_v_have_stop = __pyx_t_1;
14729 
14730       /* "View.MemoryView":766
14731  *             have_start = index.start is not None
14732  *             have_stop = index.stop is not None
14733  *             have_step = index.step is not None             # <<<<<<<<<<<<<<
14734  *
14735  *             slice_memviewslice(
14736  */
14737       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error)
14738       __Pyx_GOTREF(__pyx_t_9);
14739       __pyx_t_1 = (__pyx_t_9 != Py_None);
14740       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14741       __pyx_v_have_step = __pyx_t_1;
14742 
14743       /* "View.MemoryView":768
14744  *             have_step = index.step is not None
14745  *
14746  *             slice_memviewslice(             # <<<<<<<<<<<<<<
14747  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14748  *                 dim, new_ndim, p_suboffset_dim,
14749  */
14750       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 768, __pyx_L1_error)
14751 
14752       /* "View.MemoryView":774
14753  *                 have_start, have_stop, have_step,
14754  *                 True)
14755  *             new_ndim += 1             # <<<<<<<<<<<<<<
14756  *
14757  *     if isinstance(memview, _memoryviewslice):
14758  */
14759       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14760     }
14761     __pyx_L6:;
14762 
14763     /* "View.MemoryView":746
14764  *     cdef bint have_start, have_stop, have_step
14765  *
14766  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
14767  *         if PyIndex_Check(index):
14768  *             slice_memviewslice(
14769  */
14770   }
14771   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14772 
14773   /* "View.MemoryView":776
14774  *             new_ndim += 1
14775  *
14776  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14777  *         return memoryview_fromslice(dst, new_ndim,
14778  *                                     memviewsliceobj.to_object_func,
14779  */
14780   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14781   __pyx_t_2 = (__pyx_t_1 != 0);
14782   if (__pyx_t_2) {
14783 
14784     /* "View.MemoryView":777
14785  *
14786  *     if isinstance(memview, _memoryviewslice):
14787  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
14788  *                                     memviewsliceobj.to_object_func,
14789  *                                     memviewsliceobj.to_dtype_func,
14790  */
14791     __Pyx_XDECREF(((PyObject *)__pyx_r));
14792 
14793     /* "View.MemoryView":778
14794  *     if isinstance(memview, _memoryviewslice):
14795  *         return memoryview_fromslice(dst, new_ndim,
14796  *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
14797  *                                     memviewsliceobj.to_dtype_func,
14798  *                                     memview.dtype_is_object)
14799  */
14800     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) }
14801 
14802     /* "View.MemoryView":779
14803  *         return memoryview_fromslice(dst, new_ndim,
14804  *                                     memviewsliceobj.to_object_func,
14805  *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
14806  *                                     memview.dtype_is_object)
14807  *     else:
14808  */
14809     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) }
14810 
14811     /* "View.MemoryView":777
14812  *
14813  *     if isinstance(memview, _memoryviewslice):
14814  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
14815  *                                     memviewsliceobj.to_object_func,
14816  *                                     memviewsliceobj.to_dtype_func,
14817  */
14818     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 777, __pyx_L1_error)
14819     __Pyx_GOTREF(__pyx_t_3);
14820     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error)
14821     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
14822     __pyx_t_3 = 0;
14823     goto __pyx_L0;
14824 
14825     /* "View.MemoryView":776
14826  *             new_ndim += 1
14827  *
14828  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14829  *         return memoryview_fromslice(dst, new_ndim,
14830  *                                     memviewsliceobj.to_object_func,
14831  */
14832   }
14833 
14834   /* "View.MemoryView":782
14835  *                                     memview.dtype_is_object)
14836  *     else:
14837  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
14838  *                                     memview.dtype_is_object)
14839  *
14840  */
14841   /*else*/ {
14842     __Pyx_XDECREF(((PyObject *)__pyx_r));
14843 
14844     /* "View.MemoryView":783
14845  *     else:
14846  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
14847  *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
14848  *
14849  *
14850  */
14851     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 782, __pyx_L1_error)
14852     __Pyx_GOTREF(__pyx_t_3);
14853 
14854     /* "View.MemoryView":782
14855  *                                     memview.dtype_is_object)
14856  *     else:
14857  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
14858  *                                     memview.dtype_is_object)
14859  *
14860  */
14861     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error)
14862     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
14863     __pyx_t_3 = 0;
14864     goto __pyx_L0;
14865   }
14866 
14867   /* "View.MemoryView":710
14868  *
14869  * @cname('__pyx_memview_slice')
14870  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
14871  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
14872  *     cdef bint negative_step
14873  */
14874 
14875   /* function exit code */
14876   __pyx_L1_error:;
14877   __Pyx_XDECREF(__pyx_t_3);
14878   __Pyx_XDECREF(__pyx_t_9);
14879   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14880   __pyx_r = 0;
14881   __pyx_L0:;
14882   __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
14883   __Pyx_XDECREF(__pyx_v_index);
14884   __Pyx_XGIVEREF((PyObject *)__pyx_r);
14885   __Pyx_RefNannyFinishContext();
14886   return __pyx_r;
14887 }
14888 
14889 /* "View.MemoryView":807
14890  *
14891  * @cname('__pyx_memoryview_slice_memviewslice')
14892  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
14893  *         __Pyx_memviewslice *dst,
14894  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
14895  */
14896 
__pyx_memoryview_slice_memviewslice(__Pyx_memviewslice * __pyx_v_dst,Py_ssize_t __pyx_v_shape,Py_ssize_t __pyx_v_stride,Py_ssize_t __pyx_v_suboffset,int __pyx_v_dim,int __pyx_v_new_ndim,int * __pyx_v_suboffset_dim,Py_ssize_t __pyx_v_start,Py_ssize_t __pyx_v_stop,Py_ssize_t __pyx_v_step,int __pyx_v_have_start,int __pyx_v_have_stop,int __pyx_v_have_step,int __pyx_v_is_slice)14897 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
14898   Py_ssize_t __pyx_v_new_shape;
14899   int __pyx_v_negative_step;
14900   int __pyx_r;
14901   int __pyx_t_1;
14902   int __pyx_t_2;
14903   int __pyx_t_3;
14904   int __pyx_lineno = 0;
14905   const char *__pyx_filename = NULL;
14906   int __pyx_clineno = 0;
14907 
14908   /* "View.MemoryView":827
14909  *     cdef bint negative_step
14910  *
14911  *     if not is_slice:             # <<<<<<<<<<<<<<
14912  *
14913  *         if start < 0:
14914  */
14915   __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
14916   if (__pyx_t_1) {
14917 
14918     /* "View.MemoryView":829
14919  *     if not is_slice:
14920  *
14921  *         if start < 0:             # <<<<<<<<<<<<<<
14922  *             start += shape
14923  *         if not 0 <= start < shape:
14924  */
14925     __pyx_t_1 = ((__pyx_v_start < 0) != 0);
14926     if (__pyx_t_1) {
14927 
14928       /* "View.MemoryView":830
14929  *
14930  *         if start < 0:
14931  *             start += shape             # <<<<<<<<<<<<<<
14932  *         if not 0 <= start < shape:
14933  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
14934  */
14935       __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
14936 
14937       /* "View.MemoryView":829
14938  *     if not is_slice:
14939  *
14940  *         if start < 0:             # <<<<<<<<<<<<<<
14941  *             start += shape
14942  *         if not 0 <= start < shape:
14943  */
14944     }
14945 
14946     /* "View.MemoryView":831
14947  *         if start < 0:
14948  *             start += shape
14949  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
14950  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
14951  *     else:
14952  */
14953     __pyx_t_1 = (0 <= __pyx_v_start);
14954     if (__pyx_t_1) {
14955       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
14956     }
14957     __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
14958     if (__pyx_t_2) {
14959 
14960       /* "View.MemoryView":832
14961  *             start += shape
14962  *         if not 0 <= start < shape:
14963  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
14964  *     else:
14965  *
14966  */
14967       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 832, __pyx_L1_error)
14968 
14969       /* "View.MemoryView":831
14970  *         if start < 0:
14971  *             start += shape
14972  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
14973  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
14974  *     else:
14975  */
14976     }
14977 
14978     /* "View.MemoryView":827
14979  *     cdef bint negative_step
14980  *
14981  *     if not is_slice:             # <<<<<<<<<<<<<<
14982  *
14983  *         if start < 0:
14984  */
14985     goto __pyx_L3;
14986   }
14987 
14988   /* "View.MemoryView":835
14989  *     else:
14990  *
14991  *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
14992  *
14993  *         if have_step and step == 0:
14994  */
14995   /*else*/ {
14996     __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
14997     if (__pyx_t_1) {
14998     } else {
14999       __pyx_t_2 = __pyx_t_1;
15000       goto __pyx_L6_bool_binop_done;
15001     }
15002     __pyx_t_1 = ((__pyx_v_step < 0) != 0);
15003     __pyx_t_2 = __pyx_t_1;
15004     __pyx_L6_bool_binop_done:;
15005     __pyx_v_negative_step = __pyx_t_2;
15006 
15007     /* "View.MemoryView":837
15008  *         negative_step = have_step != 0 and step < 0
15009  *
15010  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
15011  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
15012  *
15013  */
15014     __pyx_t_1 = (__pyx_v_have_step != 0);
15015     if (__pyx_t_1) {
15016     } else {
15017       __pyx_t_2 = __pyx_t_1;
15018       goto __pyx_L9_bool_binop_done;
15019     }
15020     __pyx_t_1 = ((__pyx_v_step == 0) != 0);
15021     __pyx_t_2 = __pyx_t_1;
15022     __pyx_L9_bool_binop_done:;
15023     if (__pyx_t_2) {
15024 
15025       /* "View.MemoryView":838
15026  *
15027  *         if have_step and step == 0:
15028  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
15029  *
15030  *
15031  */
15032       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 838, __pyx_L1_error)
15033 
15034       /* "View.MemoryView":837
15035  *         negative_step = have_step != 0 and step < 0
15036  *
15037  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
15038  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
15039  *
15040  */
15041     }
15042 
15043     /* "View.MemoryView":841
15044  *
15045  *
15046  *         if have_start:             # <<<<<<<<<<<<<<
15047  *             if start < 0:
15048  *                 start += shape
15049  */
15050     __pyx_t_2 = (__pyx_v_have_start != 0);
15051     if (__pyx_t_2) {
15052 
15053       /* "View.MemoryView":842
15054  *
15055  *         if have_start:
15056  *             if start < 0:             # <<<<<<<<<<<<<<
15057  *                 start += shape
15058  *                 if start < 0:
15059  */
15060       __pyx_t_2 = ((__pyx_v_start < 0) != 0);
15061       if (__pyx_t_2) {
15062 
15063         /* "View.MemoryView":843
15064  *         if have_start:
15065  *             if start < 0:
15066  *                 start += shape             # <<<<<<<<<<<<<<
15067  *                 if start < 0:
15068  *                     start = 0
15069  */
15070         __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
15071 
15072         /* "View.MemoryView":844
15073  *             if start < 0:
15074  *                 start += shape
15075  *                 if start < 0:             # <<<<<<<<<<<<<<
15076  *                     start = 0
15077  *             elif start >= shape:
15078  */
15079         __pyx_t_2 = ((__pyx_v_start < 0) != 0);
15080         if (__pyx_t_2) {
15081 
15082           /* "View.MemoryView":845
15083  *                 start += shape
15084  *                 if start < 0:
15085  *                     start = 0             # <<<<<<<<<<<<<<
15086  *             elif start >= shape:
15087  *                 if negative_step:
15088  */
15089           __pyx_v_start = 0;
15090 
15091           /* "View.MemoryView":844
15092  *             if start < 0:
15093  *                 start += shape
15094  *                 if start < 0:             # <<<<<<<<<<<<<<
15095  *                     start = 0
15096  *             elif start >= shape:
15097  */
15098         }
15099 
15100         /* "View.MemoryView":842
15101  *
15102  *         if have_start:
15103  *             if start < 0:             # <<<<<<<<<<<<<<
15104  *                 start += shape
15105  *                 if start < 0:
15106  */
15107         goto __pyx_L12;
15108       }
15109 
15110       /* "View.MemoryView":846
15111  *                 if start < 0:
15112  *                     start = 0
15113  *             elif start >= shape:             # <<<<<<<<<<<<<<
15114  *                 if negative_step:
15115  *                     start = shape - 1
15116  */
15117       __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
15118       if (__pyx_t_2) {
15119 
15120         /* "View.MemoryView":847
15121  *                     start = 0
15122  *             elif start >= shape:
15123  *                 if negative_step:             # <<<<<<<<<<<<<<
15124  *                     start = shape - 1
15125  *                 else:
15126  */
15127         __pyx_t_2 = (__pyx_v_negative_step != 0);
15128         if (__pyx_t_2) {
15129 
15130           /* "View.MemoryView":848
15131  *             elif start >= shape:
15132  *                 if negative_step:
15133  *                     start = shape - 1             # <<<<<<<<<<<<<<
15134  *                 else:
15135  *                     start = shape
15136  */
15137           __pyx_v_start = (__pyx_v_shape - 1);
15138 
15139           /* "View.MemoryView":847
15140  *                     start = 0
15141  *             elif start >= shape:
15142  *                 if negative_step:             # <<<<<<<<<<<<<<
15143  *                     start = shape - 1
15144  *                 else:
15145  */
15146           goto __pyx_L14;
15147         }
15148 
15149         /* "View.MemoryView":850
15150  *                     start = shape - 1
15151  *                 else:
15152  *                     start = shape             # <<<<<<<<<<<<<<
15153  *         else:
15154  *             if negative_step:
15155  */
15156         /*else*/ {
15157           __pyx_v_start = __pyx_v_shape;
15158         }
15159         __pyx_L14:;
15160 
15161         /* "View.MemoryView":846
15162  *                 if start < 0:
15163  *                     start = 0
15164  *             elif start >= shape:             # <<<<<<<<<<<<<<
15165  *                 if negative_step:
15166  *                     start = shape - 1
15167  */
15168       }
15169       __pyx_L12:;
15170 
15171       /* "View.MemoryView":841
15172  *
15173  *
15174  *         if have_start:             # <<<<<<<<<<<<<<
15175  *             if start < 0:
15176  *                 start += shape
15177  */
15178       goto __pyx_L11;
15179     }
15180 
15181     /* "View.MemoryView":852
15182  *                     start = shape
15183  *         else:
15184  *             if negative_step:             # <<<<<<<<<<<<<<
15185  *                 start = shape - 1
15186  *             else:
15187  */
15188     /*else*/ {
15189       __pyx_t_2 = (__pyx_v_negative_step != 0);
15190       if (__pyx_t_2) {
15191 
15192         /* "View.MemoryView":853
15193  *         else:
15194  *             if negative_step:
15195  *                 start = shape - 1             # <<<<<<<<<<<<<<
15196  *             else:
15197  *                 start = 0
15198  */
15199         __pyx_v_start = (__pyx_v_shape - 1);
15200 
15201         /* "View.MemoryView":852
15202  *                     start = shape
15203  *         else:
15204  *             if negative_step:             # <<<<<<<<<<<<<<
15205  *                 start = shape - 1
15206  *             else:
15207  */
15208         goto __pyx_L15;
15209       }
15210 
15211       /* "View.MemoryView":855
15212  *                 start = shape - 1
15213  *             else:
15214  *                 start = 0             # <<<<<<<<<<<<<<
15215  *
15216  *         if have_stop:
15217  */
15218       /*else*/ {
15219         __pyx_v_start = 0;
15220       }
15221       __pyx_L15:;
15222     }
15223     __pyx_L11:;
15224 
15225     /* "View.MemoryView":857
15226  *                 start = 0
15227  *
15228  *         if have_stop:             # <<<<<<<<<<<<<<
15229  *             if stop < 0:
15230  *                 stop += shape
15231  */
15232     __pyx_t_2 = (__pyx_v_have_stop != 0);
15233     if (__pyx_t_2) {
15234 
15235       /* "View.MemoryView":858
15236  *
15237  *         if have_stop:
15238  *             if stop < 0:             # <<<<<<<<<<<<<<
15239  *                 stop += shape
15240  *                 if stop < 0:
15241  */
15242       __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
15243       if (__pyx_t_2) {
15244 
15245         /* "View.MemoryView":859
15246  *         if have_stop:
15247  *             if stop < 0:
15248  *                 stop += shape             # <<<<<<<<<<<<<<
15249  *                 if stop < 0:
15250  *                     stop = 0
15251  */
15252         __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
15253 
15254         /* "View.MemoryView":860
15255  *             if stop < 0:
15256  *                 stop += shape
15257  *                 if stop < 0:             # <<<<<<<<<<<<<<
15258  *                     stop = 0
15259  *             elif stop > shape:
15260  */
15261         __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
15262         if (__pyx_t_2) {
15263 
15264           /* "View.MemoryView":861
15265  *                 stop += shape
15266  *                 if stop < 0:
15267  *                     stop = 0             # <<<<<<<<<<<<<<
15268  *             elif stop > shape:
15269  *                 stop = shape
15270  */
15271           __pyx_v_stop = 0;
15272 
15273           /* "View.MemoryView":860
15274  *             if stop < 0:
15275  *                 stop += shape
15276  *                 if stop < 0:             # <<<<<<<<<<<<<<
15277  *                     stop = 0
15278  *             elif stop > shape:
15279  */
15280         }
15281 
15282         /* "View.MemoryView":858
15283  *
15284  *         if have_stop:
15285  *             if stop < 0:             # <<<<<<<<<<<<<<
15286  *                 stop += shape
15287  *                 if stop < 0:
15288  */
15289         goto __pyx_L17;
15290       }
15291 
15292       /* "View.MemoryView":862
15293  *                 if stop < 0:
15294  *                     stop = 0
15295  *             elif stop > shape:             # <<<<<<<<<<<<<<
15296  *                 stop = shape
15297  *         else:
15298  */
15299       __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
15300       if (__pyx_t_2) {
15301 
15302         /* "View.MemoryView":863
15303  *                     stop = 0
15304  *             elif stop > shape:
15305  *                 stop = shape             # <<<<<<<<<<<<<<
15306  *         else:
15307  *             if negative_step:
15308  */
15309         __pyx_v_stop = __pyx_v_shape;
15310 
15311         /* "View.MemoryView":862
15312  *                 if stop < 0:
15313  *                     stop = 0
15314  *             elif stop > shape:             # <<<<<<<<<<<<<<
15315  *                 stop = shape
15316  *         else:
15317  */
15318       }
15319       __pyx_L17:;
15320 
15321       /* "View.MemoryView":857
15322  *                 start = 0
15323  *
15324  *         if have_stop:             # <<<<<<<<<<<<<<
15325  *             if stop < 0:
15326  *                 stop += shape
15327  */
15328       goto __pyx_L16;
15329     }
15330 
15331     /* "View.MemoryView":865
15332  *                 stop = shape
15333  *         else:
15334  *             if negative_step:             # <<<<<<<<<<<<<<
15335  *                 stop = -1
15336  *             else:
15337  */
15338     /*else*/ {
15339       __pyx_t_2 = (__pyx_v_negative_step != 0);
15340       if (__pyx_t_2) {
15341 
15342         /* "View.MemoryView":866
15343  *         else:
15344  *             if negative_step:
15345  *                 stop = -1             # <<<<<<<<<<<<<<
15346  *             else:
15347  *                 stop = shape
15348  */
15349         __pyx_v_stop = -1L;
15350 
15351         /* "View.MemoryView":865
15352  *                 stop = shape
15353  *         else:
15354  *             if negative_step:             # <<<<<<<<<<<<<<
15355  *                 stop = -1
15356  *             else:
15357  */
15358         goto __pyx_L19;
15359       }
15360 
15361       /* "View.MemoryView":868
15362  *                 stop = -1
15363  *             else:
15364  *                 stop = shape             # <<<<<<<<<<<<<<
15365  *
15366  *         if not have_step:
15367  */
15368       /*else*/ {
15369         __pyx_v_stop = __pyx_v_shape;
15370       }
15371       __pyx_L19:;
15372     }
15373     __pyx_L16:;
15374 
15375     /* "View.MemoryView":870
15376  *                 stop = shape
15377  *
15378  *         if not have_step:             # <<<<<<<<<<<<<<
15379  *             step = 1
15380  *
15381  */
15382     __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
15383     if (__pyx_t_2) {
15384 
15385       /* "View.MemoryView":871
15386  *
15387  *         if not have_step:
15388  *             step = 1             # <<<<<<<<<<<<<<
15389  *
15390  *
15391  */
15392       __pyx_v_step = 1;
15393 
15394       /* "View.MemoryView":870
15395  *                 stop = shape
15396  *
15397  *         if not have_step:             # <<<<<<<<<<<<<<
15398  *             step = 1
15399  *
15400  */
15401     }
15402 
15403     /* "View.MemoryView":875
15404  *
15405  *         with cython.cdivision(True):
15406  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
15407  *
15408  *             if (stop - start) - step * new_shape:
15409  */
15410     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
15411 
15412     /* "View.MemoryView":877
15413  *             new_shape = (stop - start) // step
15414  *
15415  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
15416  *                 new_shape += 1
15417  *
15418  */
15419     __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
15420     if (__pyx_t_2) {
15421 
15422       /* "View.MemoryView":878
15423  *
15424  *             if (stop - start) - step * new_shape:
15425  *                 new_shape += 1             # <<<<<<<<<<<<<<
15426  *
15427  *         if new_shape < 0:
15428  */
15429       __pyx_v_new_shape = (__pyx_v_new_shape + 1);
15430 
15431       /* "View.MemoryView":877
15432  *             new_shape = (stop - start) // step
15433  *
15434  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
15435  *                 new_shape += 1
15436  *
15437  */
15438     }
15439 
15440     /* "View.MemoryView":880
15441  *                 new_shape += 1
15442  *
15443  *         if new_shape < 0:             # <<<<<<<<<<<<<<
15444  *             new_shape = 0
15445  *
15446  */
15447     __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
15448     if (__pyx_t_2) {
15449 
15450       /* "View.MemoryView":881
15451  *
15452  *         if new_shape < 0:
15453  *             new_shape = 0             # <<<<<<<<<<<<<<
15454  *
15455  *
15456  */
15457       __pyx_v_new_shape = 0;
15458 
15459       /* "View.MemoryView":880
15460  *                 new_shape += 1
15461  *
15462  *         if new_shape < 0:             # <<<<<<<<<<<<<<
15463  *             new_shape = 0
15464  *
15465  */
15466     }
15467 
15468     /* "View.MemoryView":884
15469  *
15470  *
15471  *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
15472  *         dst.shape[new_ndim] = new_shape
15473  *         dst.suboffsets[new_ndim] = suboffset
15474  */
15475     (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
15476 
15477     /* "View.MemoryView":885
15478  *
15479  *         dst.strides[new_ndim] = stride * step
15480  *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
15481  *         dst.suboffsets[new_ndim] = suboffset
15482  *
15483  */
15484     (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
15485 
15486     /* "View.MemoryView":886
15487  *         dst.strides[new_ndim] = stride * step
15488  *         dst.shape[new_ndim] = new_shape
15489  *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
15490  *
15491  *
15492  */
15493     (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
15494   }
15495   __pyx_L3:;
15496 
15497   /* "View.MemoryView":889
15498  *
15499  *
15500  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
15501  *         dst.data += start * stride
15502  *     else:
15503  */
15504   __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
15505   if (__pyx_t_2) {
15506 
15507     /* "View.MemoryView":890
15508  *
15509  *     if suboffset_dim[0] < 0:
15510  *         dst.data += start * stride             # <<<<<<<<<<<<<<
15511  *     else:
15512  *         dst.suboffsets[suboffset_dim[0]] += start * stride
15513  */
15514     __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
15515 
15516     /* "View.MemoryView":889
15517  *
15518  *
15519  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
15520  *         dst.data += start * stride
15521  *     else:
15522  */
15523     goto __pyx_L23;
15524   }
15525 
15526   /* "View.MemoryView":892
15527  *         dst.data += start * stride
15528  *     else:
15529  *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
15530  *
15531  *     if suboffset >= 0:
15532  */
15533   /*else*/ {
15534     __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
15535     (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
15536   }
15537   __pyx_L23:;
15538 
15539   /* "View.MemoryView":894
15540  *         dst.suboffsets[suboffset_dim[0]] += start * stride
15541  *
15542  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15543  *         if not is_slice:
15544  *             if new_ndim == 0:
15545  */
15546   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15547   if (__pyx_t_2) {
15548 
15549     /* "View.MemoryView":895
15550  *
15551  *     if suboffset >= 0:
15552  *         if not is_slice:             # <<<<<<<<<<<<<<
15553  *             if new_ndim == 0:
15554  *                 dst.data = (<char **> dst.data)[0] + suboffset
15555  */
15556     __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
15557     if (__pyx_t_2) {
15558 
15559       /* "View.MemoryView":896
15560  *     if suboffset >= 0:
15561  *         if not is_slice:
15562  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
15563  *                 dst.data = (<char **> dst.data)[0] + suboffset
15564  *             else:
15565  */
15566       __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
15567       if (__pyx_t_2) {
15568 
15569         /* "View.MemoryView":897
15570  *         if not is_slice:
15571  *             if new_ndim == 0:
15572  *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
15573  *             else:
15574  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
15575  */
15576         __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
15577 
15578         /* "View.MemoryView":896
15579  *     if suboffset >= 0:
15580  *         if not is_slice:
15581  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
15582  *                 dst.data = (<char **> dst.data)[0] + suboffset
15583  *             else:
15584  */
15585         goto __pyx_L26;
15586       }
15587 
15588       /* "View.MemoryView":899
15589  *                 dst.data = (<char **> dst.data)[0] + suboffset
15590  *             else:
15591  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
15592  *                                      "must be indexed and not sliced", dim)
15593  *         else:
15594  */
15595       /*else*/ {
15596 
15597         /* "View.MemoryView":900
15598  *             else:
15599  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
15600  *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
15601  *         else:
15602  *             suboffset_dim[0] = new_ndim
15603  */
15604         __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 899, __pyx_L1_error)
15605       }
15606       __pyx_L26:;
15607 
15608       /* "View.MemoryView":895
15609  *
15610  *     if suboffset >= 0:
15611  *         if not is_slice:             # <<<<<<<<<<<<<<
15612  *             if new_ndim == 0:
15613  *                 dst.data = (<char **> dst.data)[0] + suboffset
15614  */
15615       goto __pyx_L25;
15616     }
15617 
15618     /* "View.MemoryView":902
15619  *                                      "must be indexed and not sliced", dim)
15620  *         else:
15621  *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
15622  *
15623  *     return 0
15624  */
15625     /*else*/ {
15626       (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
15627     }
15628     __pyx_L25:;
15629 
15630     /* "View.MemoryView":894
15631  *         dst.suboffsets[suboffset_dim[0]] += start * stride
15632  *
15633  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15634  *         if not is_slice:
15635  *             if new_ndim == 0:
15636  */
15637   }
15638 
15639   /* "View.MemoryView":904
15640  *             suboffset_dim[0] = new_ndim
15641  *
15642  *     return 0             # <<<<<<<<<<<<<<
15643  *
15644  *
15645  */
15646   __pyx_r = 0;
15647   goto __pyx_L0;
15648 
15649   /* "View.MemoryView":807
15650  *
15651  * @cname('__pyx_memoryview_slice_memviewslice')
15652  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
15653  *         __Pyx_memviewslice *dst,
15654  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
15655  */
15656 
15657   /* function exit code */
15658   __pyx_L1_error:;
15659   {
15660     #ifdef WITH_THREAD
15661     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
15662     #endif
15663     __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15664     #ifdef WITH_THREAD
15665     __Pyx_PyGILState_Release(__pyx_gilstate_save);
15666     #endif
15667   }
15668   __pyx_r = -1;
15669   __pyx_L0:;
15670   return __pyx_r;
15671 }
15672 
15673 /* "View.MemoryView":910
15674  *
15675  * @cname('__pyx_pybuffer_index')
15676  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
15677  *                           Py_ssize_t dim) except NULL:
15678  *     cdef Py_ssize_t shape, stride, suboffset = -1
15679  */
15680 
__pyx_pybuffer_index(Py_buffer * __pyx_v_view,char * __pyx_v_bufp,Py_ssize_t __pyx_v_index,Py_ssize_t __pyx_v_dim)15681 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
15682   Py_ssize_t __pyx_v_shape;
15683   Py_ssize_t __pyx_v_stride;
15684   Py_ssize_t __pyx_v_suboffset;
15685   Py_ssize_t __pyx_v_itemsize;
15686   char *__pyx_v_resultp;
15687   char *__pyx_r;
15688   __Pyx_RefNannyDeclarations
15689   Py_ssize_t __pyx_t_1;
15690   int __pyx_t_2;
15691   PyObject *__pyx_t_3 = NULL;
15692   PyObject *__pyx_t_4 = NULL;
15693   int __pyx_lineno = 0;
15694   const char *__pyx_filename = NULL;
15695   int __pyx_clineno = 0;
15696   __Pyx_RefNannySetupContext("pybuffer_index", 0);
15697 
15698   /* "View.MemoryView":912
15699  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
15700  *                           Py_ssize_t dim) except NULL:
15701  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
15702  *     cdef Py_ssize_t itemsize = view.itemsize
15703  *     cdef char *resultp
15704  */
15705   __pyx_v_suboffset = -1L;
15706 
15707   /* "View.MemoryView":913
15708  *                           Py_ssize_t dim) except NULL:
15709  *     cdef Py_ssize_t shape, stride, suboffset = -1
15710  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
15711  *     cdef char *resultp
15712  *
15713  */
15714   __pyx_t_1 = __pyx_v_view->itemsize;
15715   __pyx_v_itemsize = __pyx_t_1;
15716 
15717   /* "View.MemoryView":916
15718  *     cdef char *resultp
15719  *
15720  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
15721  *         shape = view.len / itemsize
15722  *         stride = itemsize
15723  */
15724   __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
15725   if (__pyx_t_2) {
15726 
15727     /* "View.MemoryView":917
15728  *
15729  *     if view.ndim == 0:
15730  *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
15731  *         stride = itemsize
15732  *     else:
15733  */
15734     if (unlikely(__pyx_v_itemsize == 0)) {
15735       PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
15736       __PYX_ERR(2, 917, __pyx_L1_error)
15737     }
15738     else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
15739       PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
15740       __PYX_ERR(2, 917, __pyx_L1_error)
15741     }
15742     __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize);
15743 
15744     /* "View.MemoryView":918
15745  *     if view.ndim == 0:
15746  *         shape = view.len / itemsize
15747  *         stride = itemsize             # <<<<<<<<<<<<<<
15748  *     else:
15749  *         shape = view.shape[dim]
15750  */
15751     __pyx_v_stride = __pyx_v_itemsize;
15752 
15753     /* "View.MemoryView":916
15754  *     cdef char *resultp
15755  *
15756  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
15757  *         shape = view.len / itemsize
15758  *         stride = itemsize
15759  */
15760     goto __pyx_L3;
15761   }
15762 
15763   /* "View.MemoryView":920
15764  *         stride = itemsize
15765  *     else:
15766  *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
15767  *         stride = view.strides[dim]
15768  *         if view.suboffsets != NULL:
15769  */
15770   /*else*/ {
15771     __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
15772 
15773     /* "View.MemoryView":921
15774  *     else:
15775  *         shape = view.shape[dim]
15776  *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
15777  *         if view.suboffsets != NULL:
15778  *             suboffset = view.suboffsets[dim]
15779  */
15780     __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
15781 
15782     /* "View.MemoryView":922
15783  *         shape = view.shape[dim]
15784  *         stride = view.strides[dim]
15785  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
15786  *             suboffset = view.suboffsets[dim]
15787  *
15788  */
15789     __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
15790     if (__pyx_t_2) {
15791 
15792       /* "View.MemoryView":923
15793  *         stride = view.strides[dim]
15794  *         if view.suboffsets != NULL:
15795  *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
15796  *
15797  *     if index < 0:
15798  */
15799       __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
15800 
15801       /* "View.MemoryView":922
15802  *         shape = view.shape[dim]
15803  *         stride = view.strides[dim]
15804  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
15805  *             suboffset = view.suboffsets[dim]
15806  *
15807  */
15808     }
15809   }
15810   __pyx_L3:;
15811 
15812   /* "View.MemoryView":925
15813  *             suboffset = view.suboffsets[dim]
15814  *
15815  *     if index < 0:             # <<<<<<<<<<<<<<
15816  *         index += view.shape[dim]
15817  *         if index < 0:
15818  */
15819   __pyx_t_2 = ((__pyx_v_index < 0) != 0);
15820   if (__pyx_t_2) {
15821 
15822     /* "View.MemoryView":926
15823  *
15824  *     if index < 0:
15825  *         index += view.shape[dim]             # <<<<<<<<<<<<<<
15826  *         if index < 0:
15827  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15828  */
15829     __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
15830 
15831     /* "View.MemoryView":927
15832  *     if index < 0:
15833  *         index += view.shape[dim]
15834  *         if index < 0:             # <<<<<<<<<<<<<<
15835  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15836  *
15837  */
15838     __pyx_t_2 = ((__pyx_v_index < 0) != 0);
15839     if (unlikely(__pyx_t_2)) {
15840 
15841       /* "View.MemoryView":928
15842  *         index += view.shape[dim]
15843  *         if index < 0:
15844  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
15845  *
15846  *     if index >= shape:
15847  */
15848       __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
15849       __Pyx_GOTREF(__pyx_t_3);
15850       __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 928, __pyx_L1_error)
15851       __Pyx_GOTREF(__pyx_t_4);
15852       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15853       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
15854       __Pyx_GOTREF(__pyx_t_3);
15855       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15856       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15857       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15858       __PYX_ERR(2, 928, __pyx_L1_error)
15859 
15860       /* "View.MemoryView":927
15861  *     if index < 0:
15862  *         index += view.shape[dim]
15863  *         if index < 0:             # <<<<<<<<<<<<<<
15864  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15865  *
15866  */
15867     }
15868 
15869     /* "View.MemoryView":925
15870  *             suboffset = view.suboffsets[dim]
15871  *
15872  *     if index < 0:             # <<<<<<<<<<<<<<
15873  *         index += view.shape[dim]
15874  *         if index < 0:
15875  */
15876   }
15877 
15878   /* "View.MemoryView":930
15879  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15880  *
15881  *     if index >= shape:             # <<<<<<<<<<<<<<
15882  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15883  *
15884  */
15885   __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
15886   if (unlikely(__pyx_t_2)) {
15887 
15888     /* "View.MemoryView":931
15889  *
15890  *     if index >= shape:
15891  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
15892  *
15893  *     resultp = bufp + index * stride
15894  */
15895     __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
15896     __Pyx_GOTREF(__pyx_t_3);
15897     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 931, __pyx_L1_error)
15898     __Pyx_GOTREF(__pyx_t_4);
15899     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15900     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
15901     __Pyx_GOTREF(__pyx_t_3);
15902     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15903     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15904     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15905     __PYX_ERR(2, 931, __pyx_L1_error)
15906 
15907     /* "View.MemoryView":930
15908  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15909  *
15910  *     if index >= shape:             # <<<<<<<<<<<<<<
15911  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15912  *
15913  */
15914   }
15915 
15916   /* "View.MemoryView":933
15917  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15918  *
15919  *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
15920  *     if suboffset >= 0:
15921  *         resultp = (<char **> resultp)[0] + suboffset
15922  */
15923   __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
15924 
15925   /* "View.MemoryView":934
15926  *
15927  *     resultp = bufp + index * stride
15928  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15929  *         resultp = (<char **> resultp)[0] + suboffset
15930  *
15931  */
15932   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15933   if (__pyx_t_2) {
15934 
15935     /* "View.MemoryView":935
15936  *     resultp = bufp + index * stride
15937  *     if suboffset >= 0:
15938  *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
15939  *
15940  *     return resultp
15941  */
15942     __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
15943 
15944     /* "View.MemoryView":934
15945  *
15946  *     resultp = bufp + index * stride
15947  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15948  *         resultp = (<char **> resultp)[0] + suboffset
15949  *
15950  */
15951   }
15952 
15953   /* "View.MemoryView":937
15954  *         resultp = (<char **> resultp)[0] + suboffset
15955  *
15956  *     return resultp             # <<<<<<<<<<<<<<
15957  *
15958  *
15959  */
15960   __pyx_r = __pyx_v_resultp;
15961   goto __pyx_L0;
15962 
15963   /* "View.MemoryView":910
15964  *
15965  * @cname('__pyx_pybuffer_index')
15966  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
15967  *                           Py_ssize_t dim) except NULL:
15968  *     cdef Py_ssize_t shape, stride, suboffset = -1
15969  */
15970 
15971   /* function exit code */
15972   __pyx_L1_error:;
15973   __Pyx_XDECREF(__pyx_t_3);
15974   __Pyx_XDECREF(__pyx_t_4);
15975   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
15976   __pyx_r = NULL;
15977   __pyx_L0:;
15978   __Pyx_RefNannyFinishContext();
15979   return __pyx_r;
15980 }
15981 
15982 /* "View.MemoryView":943
15983  *
15984  * @cname('__pyx_memslice_transpose')
15985  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
15986  *     cdef int ndim = memslice.memview.view.ndim
15987  *
15988  */
15989 
__pyx_memslice_transpose(__Pyx_memviewslice * __pyx_v_memslice)15990 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
15991   int __pyx_v_ndim;
15992   Py_ssize_t *__pyx_v_shape;
15993   Py_ssize_t *__pyx_v_strides;
15994   int __pyx_v_i;
15995   int __pyx_v_j;
15996   int __pyx_r;
15997   int __pyx_t_1;
15998   Py_ssize_t *__pyx_t_2;
15999   long __pyx_t_3;
16000   long __pyx_t_4;
16001   Py_ssize_t __pyx_t_5;
16002   Py_ssize_t __pyx_t_6;
16003   int __pyx_t_7;
16004   int __pyx_t_8;
16005   int __pyx_t_9;
16006   int __pyx_lineno = 0;
16007   const char *__pyx_filename = NULL;
16008   int __pyx_clineno = 0;
16009 
16010   /* "View.MemoryView":944
16011  * @cname('__pyx_memslice_transpose')
16012  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
16013  *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
16014  *
16015  *     cdef Py_ssize_t *shape = memslice.shape
16016  */
16017   __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
16018   __pyx_v_ndim = __pyx_t_1;
16019 
16020   /* "View.MemoryView":946
16021  *     cdef int ndim = memslice.memview.view.ndim
16022  *
16023  *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
16024  *     cdef Py_ssize_t *strides = memslice.strides
16025  *
16026  */
16027   __pyx_t_2 = __pyx_v_memslice->shape;
16028   __pyx_v_shape = __pyx_t_2;
16029 
16030   /* "View.MemoryView":947
16031  *
16032  *     cdef Py_ssize_t *shape = memslice.shape
16033  *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
16034  *
16035  *
16036  */
16037   __pyx_t_2 = __pyx_v_memslice->strides;
16038   __pyx_v_strides = __pyx_t_2;
16039 
16040   /* "View.MemoryView":951
16041  *
16042  *     cdef int i, j
16043  *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
16044  *         j = ndim - 1 - i
16045  *         strides[i], strides[j] = strides[j], strides[i]
16046  */
16047   __pyx_t_3 = (__pyx_v_ndim / 2);
16048   __pyx_t_4 = __pyx_t_3;
16049   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
16050     __pyx_v_i = __pyx_t_1;
16051 
16052     /* "View.MemoryView":952
16053  *     cdef int i, j
16054  *     for i in range(ndim / 2):
16055  *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
16056  *         strides[i], strides[j] = strides[j], strides[i]
16057  *         shape[i], shape[j] = shape[j], shape[i]
16058  */
16059     __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
16060 
16061     /* "View.MemoryView":953
16062  *     for i in range(ndim / 2):
16063  *         j = ndim - 1 - i
16064  *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
16065  *         shape[i], shape[j] = shape[j], shape[i]
16066  *
16067  */
16068     __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
16069     __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
16070     (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
16071     (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
16072 
16073     /* "View.MemoryView":954
16074  *         j = ndim - 1 - i
16075  *         strides[i], strides[j] = strides[j], strides[i]
16076  *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
16077  *
16078  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
16079  */
16080     __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
16081     __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
16082     (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
16083     (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
16084 
16085     /* "View.MemoryView":956
16086  *         shape[i], shape[j] = shape[j], shape[i]
16087  *
16088  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
16089  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
16090  *
16091  */
16092     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
16093     if (!__pyx_t_8) {
16094     } else {
16095       __pyx_t_7 = __pyx_t_8;
16096       goto __pyx_L6_bool_binop_done;
16097     }
16098     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
16099     __pyx_t_7 = __pyx_t_8;
16100     __pyx_L6_bool_binop_done:;
16101     if (__pyx_t_7) {
16102 
16103       /* "View.MemoryView":957
16104  *
16105  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
16106  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
16107  *
16108  *     return 1
16109  */
16110       __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 957, __pyx_L1_error)
16111 
16112       /* "View.MemoryView":956
16113  *         shape[i], shape[j] = shape[j], shape[i]
16114  *
16115  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
16116  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
16117  *
16118  */
16119     }
16120   }
16121 
16122   /* "View.MemoryView":959
16123  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
16124  *
16125  *     return 1             # <<<<<<<<<<<<<<
16126  *
16127  *
16128  */
16129   __pyx_r = 1;
16130   goto __pyx_L0;
16131 
16132   /* "View.MemoryView":943
16133  *
16134  * @cname('__pyx_memslice_transpose')
16135  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
16136  *     cdef int ndim = memslice.memview.view.ndim
16137  *
16138  */
16139 
16140   /* function exit code */
16141   __pyx_L1_error:;
16142   {
16143     #ifdef WITH_THREAD
16144     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16145     #endif
16146     __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16147     #ifdef WITH_THREAD
16148     __Pyx_PyGILState_Release(__pyx_gilstate_save);
16149     #endif
16150   }
16151   __pyx_r = 0;
16152   __pyx_L0:;
16153   return __pyx_r;
16154 }
16155 
16156 /* "View.MemoryView":976
16157  *     cdef int (*to_dtype_func)(char *, object) except 0
16158  *
16159  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
16160  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
16161  *
16162  */
16163 
16164 /* Python wrapper */
16165 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryviewslice___dealloc__(PyObject * __pyx_v_self)16166 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
16167   __Pyx_RefNannyDeclarations
16168   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
16169   __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16170 
16171   /* function exit code */
16172   __Pyx_RefNannyFinishContext();
16173 }
16174 
__pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj * __pyx_v_self)16175 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16176   __Pyx_RefNannyDeclarations
16177   __Pyx_RefNannySetupContext("__dealloc__", 0);
16178 
16179   /* "View.MemoryView":977
16180  *
16181  *     def __dealloc__(self):
16182  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
16183  *
16184  *     cdef convert_item_to_object(self, char *itemp):
16185  */
16186   __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
16187 
16188   /* "View.MemoryView":976
16189  *     cdef int (*to_dtype_func)(char *, object) except 0
16190  *
16191  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
16192  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
16193  *
16194  */
16195 
16196   /* function exit code */
16197   __Pyx_RefNannyFinishContext();
16198 }
16199 
16200 /* "View.MemoryView":979
16201  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
16202  *
16203  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
16204  *         if self.to_object_func != NULL:
16205  *             return self.to_object_func(itemp)
16206  */
16207 
__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp)16208 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
16209   PyObject *__pyx_r = NULL;
16210   __Pyx_RefNannyDeclarations
16211   int __pyx_t_1;
16212   PyObject *__pyx_t_2 = NULL;
16213   int __pyx_lineno = 0;
16214   const char *__pyx_filename = NULL;
16215   int __pyx_clineno = 0;
16216   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
16217 
16218   /* "View.MemoryView":980
16219  *
16220  *     cdef convert_item_to_object(self, char *itemp):
16221  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
16222  *             return self.to_object_func(itemp)
16223  *         else:
16224  */
16225   __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
16226   if (__pyx_t_1) {
16227 
16228     /* "View.MemoryView":981
16229  *     cdef convert_item_to_object(self, char *itemp):
16230  *         if self.to_object_func != NULL:
16231  *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
16232  *         else:
16233  *             return memoryview.convert_item_to_object(self, itemp)
16234  */
16235     __Pyx_XDECREF(__pyx_r);
16236     __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error)
16237     __Pyx_GOTREF(__pyx_t_2);
16238     __pyx_r = __pyx_t_2;
16239     __pyx_t_2 = 0;
16240     goto __pyx_L0;
16241 
16242     /* "View.MemoryView":980
16243  *
16244  *     cdef convert_item_to_object(self, char *itemp):
16245  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
16246  *             return self.to_object_func(itemp)
16247  *         else:
16248  */
16249   }
16250 
16251   /* "View.MemoryView":983
16252  *             return self.to_object_func(itemp)
16253  *         else:
16254  *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
16255  *
16256  *     cdef assign_item_from_object(self, char *itemp, object value):
16257  */
16258   /*else*/ {
16259     __Pyx_XDECREF(__pyx_r);
16260     __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error)
16261     __Pyx_GOTREF(__pyx_t_2);
16262     __pyx_r = __pyx_t_2;
16263     __pyx_t_2 = 0;
16264     goto __pyx_L0;
16265   }
16266 
16267   /* "View.MemoryView":979
16268  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
16269  *
16270  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
16271  *         if self.to_object_func != NULL:
16272  *             return self.to_object_func(itemp)
16273  */
16274 
16275   /* function exit code */
16276   __pyx_L1_error:;
16277   __Pyx_XDECREF(__pyx_t_2);
16278   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
16279   __pyx_r = 0;
16280   __pyx_L0:;
16281   __Pyx_XGIVEREF(__pyx_r);
16282   __Pyx_RefNannyFinishContext();
16283   return __pyx_r;
16284 }
16285 
16286 /* "View.MemoryView":985
16287  *             return memoryview.convert_item_to_object(self, itemp)
16288  *
16289  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
16290  *         if self.to_dtype_func != NULL:
16291  *             self.to_dtype_func(itemp, value)
16292  */
16293 
__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)16294 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
16295   PyObject *__pyx_r = NULL;
16296   __Pyx_RefNannyDeclarations
16297   int __pyx_t_1;
16298   int __pyx_t_2;
16299   PyObject *__pyx_t_3 = NULL;
16300   int __pyx_lineno = 0;
16301   const char *__pyx_filename = NULL;
16302   int __pyx_clineno = 0;
16303   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
16304 
16305   /* "View.MemoryView":986
16306  *
16307  *     cdef assign_item_from_object(self, char *itemp, object value):
16308  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
16309  *             self.to_dtype_func(itemp, value)
16310  *         else:
16311  */
16312   __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
16313   if (__pyx_t_1) {
16314 
16315     /* "View.MemoryView":987
16316  *     cdef assign_item_from_object(self, char *itemp, object value):
16317  *         if self.to_dtype_func != NULL:
16318  *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
16319  *         else:
16320  *             memoryview.assign_item_from_object(self, itemp, value)
16321  */
16322     __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 987, __pyx_L1_error)
16323 
16324     /* "View.MemoryView":986
16325  *
16326  *     cdef assign_item_from_object(self, char *itemp, object value):
16327  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
16328  *             self.to_dtype_func(itemp, value)
16329  *         else:
16330  */
16331     goto __pyx_L3;
16332   }
16333 
16334   /* "View.MemoryView":989
16335  *             self.to_dtype_func(itemp, value)
16336  *         else:
16337  *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
16338  *
16339  *     @property
16340  */
16341   /*else*/ {
16342     __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 989, __pyx_L1_error)
16343     __Pyx_GOTREF(__pyx_t_3);
16344     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16345   }
16346   __pyx_L3:;
16347 
16348   /* "View.MemoryView":985
16349  *             return memoryview.convert_item_to_object(self, itemp)
16350  *
16351  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
16352  *         if self.to_dtype_func != NULL:
16353  *             self.to_dtype_func(itemp, value)
16354  */
16355 
16356   /* function exit code */
16357   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16358   goto __pyx_L0;
16359   __pyx_L1_error:;
16360   __Pyx_XDECREF(__pyx_t_3);
16361   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
16362   __pyx_r = 0;
16363   __pyx_L0:;
16364   __Pyx_XGIVEREF(__pyx_r);
16365   __Pyx_RefNannyFinishContext();
16366   return __pyx_r;
16367 }
16368 
16369 /* "View.MemoryView":992
16370  *
16371  *     @property
16372  *     def base(self):             # <<<<<<<<<<<<<<
16373  *         return self.from_object
16374  *
16375  */
16376 
16377 /* Python wrapper */
16378 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject * __pyx_v_self)16379 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
16380   PyObject *__pyx_r = 0;
16381   __Pyx_RefNannyDeclarations
16382   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
16383   __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16384 
16385   /* function exit code */
16386   __Pyx_RefNannyFinishContext();
16387   return __pyx_r;
16388 }
16389 
__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj * __pyx_v_self)16390 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16391   PyObject *__pyx_r = NULL;
16392   __Pyx_RefNannyDeclarations
16393   __Pyx_RefNannySetupContext("__get__", 0);
16394 
16395   /* "View.MemoryView":993
16396  *     @property
16397  *     def base(self):
16398  *         return self.from_object             # <<<<<<<<<<<<<<
16399  *
16400  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
16401  */
16402   __Pyx_XDECREF(__pyx_r);
16403   __Pyx_INCREF(__pyx_v_self->from_object);
16404   __pyx_r = __pyx_v_self->from_object;
16405   goto __pyx_L0;
16406 
16407   /* "View.MemoryView":992
16408  *
16409  *     @property
16410  *     def base(self):             # <<<<<<<<<<<<<<
16411  *         return self.from_object
16412  *
16413  */
16414 
16415   /* function exit code */
16416   __pyx_L0:;
16417   __Pyx_XGIVEREF(__pyx_r);
16418   __Pyx_RefNannyFinishContext();
16419   return __pyx_r;
16420 }
16421 
16422 /* "(tree fragment)":1
16423  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
16424  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16425  * def __setstate_cython__(self, __pyx_state):
16426  */
16427 
16428 /* Python wrapper */
16429 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)16430 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16431   PyObject *__pyx_r = 0;
16432   __Pyx_RefNannyDeclarations
16433   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
16434   __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16435 
16436   /* function exit code */
16437   __Pyx_RefNannyFinishContext();
16438   return __pyx_r;
16439 }
16440 
__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self)16441 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16442   PyObject *__pyx_r = NULL;
16443   __Pyx_RefNannyDeclarations
16444   PyObject *__pyx_t_1 = NULL;
16445   int __pyx_lineno = 0;
16446   const char *__pyx_filename = NULL;
16447   int __pyx_clineno = 0;
16448   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
16449 
16450   /* "(tree fragment)":2
16451  * def __reduce_cython__(self):
16452  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
16453  * def __setstate_cython__(self, __pyx_state):
16454  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16455  */
16456   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
16457   __Pyx_GOTREF(__pyx_t_1);
16458   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16459   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16460   __PYX_ERR(2, 2, __pyx_L1_error)
16461 
16462   /* "(tree fragment)":1
16463  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
16464  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16465  * def __setstate_cython__(self, __pyx_state):
16466  */
16467 
16468   /* function exit code */
16469   __pyx_L1_error:;
16470   __Pyx_XDECREF(__pyx_t_1);
16471   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16472   __pyx_r = NULL;
16473   __Pyx_XGIVEREF(__pyx_r);
16474   __Pyx_RefNannyFinishContext();
16475   return __pyx_r;
16476 }
16477 
16478 /* "(tree fragment)":3
16479  * def __reduce_cython__(self):
16480  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16481  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
16482  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16483  */
16484 
16485 /* Python wrapper */
16486 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)16487 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
16488   PyObject *__pyx_r = 0;
16489   __Pyx_RefNannyDeclarations
16490   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
16491   __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
16492 
16493   /* function exit code */
16494   __Pyx_RefNannyFinishContext();
16495   return __pyx_r;
16496 }
16497 
__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)16498 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
16499   PyObject *__pyx_r = NULL;
16500   __Pyx_RefNannyDeclarations
16501   PyObject *__pyx_t_1 = NULL;
16502   int __pyx_lineno = 0;
16503   const char *__pyx_filename = NULL;
16504   int __pyx_clineno = 0;
16505   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
16506 
16507   /* "(tree fragment)":4
16508  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16509  * def __setstate_cython__(self, __pyx_state):
16510  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
16511  */
16512   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
16513   __Pyx_GOTREF(__pyx_t_1);
16514   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16515   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16516   __PYX_ERR(2, 4, __pyx_L1_error)
16517 
16518   /* "(tree fragment)":3
16519  * def __reduce_cython__(self):
16520  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16521  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
16522  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16523  */
16524 
16525   /* function exit code */
16526   __pyx_L1_error:;
16527   __Pyx_XDECREF(__pyx_t_1);
16528   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16529   __pyx_r = NULL;
16530   __Pyx_XGIVEREF(__pyx_r);
16531   __Pyx_RefNannyFinishContext();
16532   return __pyx_r;
16533 }
16534 
16535 /* "View.MemoryView":999
16536  *
16537  * @cname('__pyx_memoryview_fromslice')
16538  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
16539  *                           int ndim,
16540  *                           object (*to_object_func)(char *),
16541  */
16542 
__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice,int __pyx_v_ndim,PyObject * (* __pyx_v_to_object_func)(char *),int (* __pyx_v_to_dtype_func)(char *,PyObject *),int __pyx_v_dtype_is_object)16543 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
16544   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
16545   Py_ssize_t __pyx_v_suboffset;
16546   PyObject *__pyx_v_length = NULL;
16547   PyObject *__pyx_r = NULL;
16548   __Pyx_RefNannyDeclarations
16549   int __pyx_t_1;
16550   PyObject *__pyx_t_2 = NULL;
16551   PyObject *__pyx_t_3 = NULL;
16552   __Pyx_TypeInfo *__pyx_t_4;
16553   Py_buffer __pyx_t_5;
16554   Py_ssize_t *__pyx_t_6;
16555   Py_ssize_t *__pyx_t_7;
16556   Py_ssize_t *__pyx_t_8;
16557   Py_ssize_t __pyx_t_9;
16558   int __pyx_lineno = 0;
16559   const char *__pyx_filename = NULL;
16560   int __pyx_clineno = 0;
16561   __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
16562 
16563   /* "View.MemoryView":1007
16564  *     cdef _memoryviewslice result
16565  *
16566  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
16567  *         return None
16568  *
16569  */
16570   __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
16571   if (__pyx_t_1) {
16572 
16573     /* "View.MemoryView":1008
16574  *
16575  *     if <PyObject *> memviewslice.memview == Py_None:
16576  *         return None             # <<<<<<<<<<<<<<
16577  *
16578  *
16579  */
16580     __Pyx_XDECREF(__pyx_r);
16581     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16582     goto __pyx_L0;
16583 
16584     /* "View.MemoryView":1007
16585  *     cdef _memoryviewslice result
16586  *
16587  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
16588  *         return None
16589  *
16590  */
16591   }
16592 
16593   /* "View.MemoryView":1013
16594  *
16595  *
16596  *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
16597  *
16598  *     result.from_slice = memviewslice
16599  */
16600   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
16601   __Pyx_GOTREF(__pyx_t_2);
16602   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error)
16603   __Pyx_GOTREF(__pyx_t_3);
16604   __Pyx_INCREF(Py_None);
16605   __Pyx_GIVEREF(Py_None);
16606   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
16607   __Pyx_INCREF(__pyx_int_0);
16608   __Pyx_GIVEREF(__pyx_int_0);
16609   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
16610   __Pyx_GIVEREF(__pyx_t_2);
16611   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
16612   __pyx_t_2 = 0;
16613   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
16614   __Pyx_GOTREF(__pyx_t_2);
16615   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16616   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
16617   __pyx_t_2 = 0;
16618 
16619   /* "View.MemoryView":1015
16620  *     result = _memoryviewslice(None, 0, dtype_is_object)
16621  *
16622  *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
16623  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
16624  *
16625  */
16626   __pyx_v_result->from_slice = __pyx_v_memviewslice;
16627 
16628   /* "View.MemoryView":1016
16629  *
16630  *     result.from_slice = memviewslice
16631  *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
16632  *
16633  *     result.from_object = (<memoryview> memviewslice.memview).base
16634  */
16635   __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
16636 
16637   /* "View.MemoryView":1018
16638  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
16639  *
16640  *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
16641  *     result.typeinfo = memviewslice.memview.typeinfo
16642  *
16643  */
16644   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1018, __pyx_L1_error)
16645   __Pyx_GOTREF(__pyx_t_2);
16646   __Pyx_GIVEREF(__pyx_t_2);
16647   __Pyx_GOTREF(__pyx_v_result->from_object);
16648   __Pyx_DECREF(__pyx_v_result->from_object);
16649   __pyx_v_result->from_object = __pyx_t_2;
16650   __pyx_t_2 = 0;
16651 
16652   /* "View.MemoryView":1019
16653  *
16654  *     result.from_object = (<memoryview> memviewslice.memview).base
16655  *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
16656  *
16657  *     result.view = memviewslice.memview.view
16658  */
16659   __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
16660   __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
16661 
16662   /* "View.MemoryView":1021
16663  *     result.typeinfo = memviewslice.memview.typeinfo
16664  *
16665  *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
16666  *     result.view.buf = <void *> memviewslice.data
16667  *     result.view.ndim = ndim
16668  */
16669   __pyx_t_5 = __pyx_v_memviewslice.memview->view;
16670   __pyx_v_result->__pyx_base.view = __pyx_t_5;
16671 
16672   /* "View.MemoryView":1022
16673  *
16674  *     result.view = memviewslice.memview.view
16675  *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
16676  *     result.view.ndim = ndim
16677  *     (<__pyx_buffer *> &result.view).obj = Py_None
16678  */
16679   __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
16680 
16681   /* "View.MemoryView":1023
16682  *     result.view = memviewslice.memview.view
16683  *     result.view.buf = <void *> memviewslice.data
16684  *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
16685  *     (<__pyx_buffer *> &result.view).obj = Py_None
16686  *     Py_INCREF(Py_None)
16687  */
16688   __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
16689 
16690   /* "View.MemoryView":1024
16691  *     result.view.buf = <void *> memviewslice.data
16692  *     result.view.ndim = ndim
16693  *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
16694  *     Py_INCREF(Py_None)
16695  *
16696  */
16697   ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
16698 
16699   /* "View.MemoryView":1025
16700  *     result.view.ndim = ndim
16701  *     (<__pyx_buffer *> &result.view).obj = Py_None
16702  *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
16703  *
16704  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
16705  */
16706   Py_INCREF(Py_None);
16707 
16708   /* "View.MemoryView":1027
16709  *     Py_INCREF(Py_None)
16710  *
16711  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
16712  *         result.flags = PyBUF_RECORDS
16713  *     else:
16714  */
16715   __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
16716   if (__pyx_t_1) {
16717 
16718     /* "View.MemoryView":1028
16719  *
16720  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
16721  *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
16722  *     else:
16723  *         result.flags = PyBUF_RECORDS_RO
16724  */
16725     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
16726 
16727     /* "View.MemoryView":1027
16728  *     Py_INCREF(Py_None)
16729  *
16730  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
16731  *         result.flags = PyBUF_RECORDS
16732  *     else:
16733  */
16734     goto __pyx_L4;
16735   }
16736 
16737   /* "View.MemoryView":1030
16738  *         result.flags = PyBUF_RECORDS
16739  *     else:
16740  *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
16741  *
16742  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
16743  */
16744   /*else*/ {
16745     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
16746   }
16747   __pyx_L4:;
16748 
16749   /* "View.MemoryView":1032
16750  *         result.flags = PyBUF_RECORDS_RO
16751  *
16752  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
16753  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
16754  *
16755  */
16756   __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
16757 
16758   /* "View.MemoryView":1033
16759  *
16760  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
16761  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
16762  *
16763  *
16764  */
16765   __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
16766 
16767   /* "View.MemoryView":1036
16768  *
16769  *
16770  *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
16771  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16772  *         if suboffset >= 0:
16773  */
16774   __pyx_v_result->__pyx_base.view.suboffsets = NULL;
16775 
16776   /* "View.MemoryView":1037
16777  *
16778  *     result.view.suboffsets = NULL
16779  *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
16780  *         if suboffset >= 0:
16781  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16782  */
16783   __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
16784   for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16785     __pyx_t_6 = __pyx_t_8;
16786     __pyx_v_suboffset = (__pyx_t_6[0]);
16787 
16788     /* "View.MemoryView":1038
16789  *     result.view.suboffsets = NULL
16790  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16791  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
16792  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16793  *             break
16794  */
16795     __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
16796     if (__pyx_t_1) {
16797 
16798       /* "View.MemoryView":1039
16799  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16800  *         if suboffset >= 0:
16801  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
16802  *             break
16803  *
16804  */
16805       __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
16806 
16807       /* "View.MemoryView":1040
16808  *         if suboffset >= 0:
16809  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16810  *             break             # <<<<<<<<<<<<<<
16811  *
16812  *     result.view.len = result.view.itemsize
16813  */
16814       goto __pyx_L6_break;
16815 
16816       /* "View.MemoryView":1038
16817  *     result.view.suboffsets = NULL
16818  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16819  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
16820  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16821  *             break
16822  */
16823     }
16824   }
16825   __pyx_L6_break:;
16826 
16827   /* "View.MemoryView":1042
16828  *             break
16829  *
16830  *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
16831  *     for length in result.view.shape[:ndim]:
16832  *         result.view.len *= length
16833  */
16834   __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
16835   __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
16836 
16837   /* "View.MemoryView":1043
16838  *
16839  *     result.view.len = result.view.itemsize
16840  *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
16841  *         result.view.len *= length
16842  *
16843  */
16844   __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
16845   for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16846     __pyx_t_6 = __pyx_t_8;
16847     __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error)
16848     __Pyx_GOTREF(__pyx_t_2);
16849     __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
16850     __pyx_t_2 = 0;
16851 
16852     /* "View.MemoryView":1044
16853  *     result.view.len = result.view.itemsize
16854  *     for length in result.view.shape[:ndim]:
16855  *         result.view.len *= length             # <<<<<<<<<<<<<<
16856  *
16857  *     result.to_object_func = to_object_func
16858  */
16859     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1044, __pyx_L1_error)
16860     __Pyx_GOTREF(__pyx_t_2);
16861     __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error)
16862     __Pyx_GOTREF(__pyx_t_3);
16863     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16864     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1044, __pyx_L1_error)
16865     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16866     __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
16867   }
16868 
16869   /* "View.MemoryView":1046
16870  *         result.view.len *= length
16871  *
16872  *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
16873  *     result.to_dtype_func = to_dtype_func
16874  *
16875  */
16876   __pyx_v_result->to_object_func = __pyx_v_to_object_func;
16877 
16878   /* "View.MemoryView":1047
16879  *
16880  *     result.to_object_func = to_object_func
16881  *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
16882  *
16883  *     return result
16884  */
16885   __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
16886 
16887   /* "View.MemoryView":1049
16888  *     result.to_dtype_func = to_dtype_func
16889  *
16890  *     return result             # <<<<<<<<<<<<<<
16891  *
16892  * @cname('__pyx_memoryview_get_slice_from_memoryview')
16893  */
16894   __Pyx_XDECREF(__pyx_r);
16895   __Pyx_INCREF(((PyObject *)__pyx_v_result));
16896   __pyx_r = ((PyObject *)__pyx_v_result);
16897   goto __pyx_L0;
16898 
16899   /* "View.MemoryView":999
16900  *
16901  * @cname('__pyx_memoryview_fromslice')
16902  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
16903  *                           int ndim,
16904  *                           object (*to_object_func)(char *),
16905  */
16906 
16907   /* function exit code */
16908   __pyx_L1_error:;
16909   __Pyx_XDECREF(__pyx_t_2);
16910   __Pyx_XDECREF(__pyx_t_3);
16911   __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16912   __pyx_r = 0;
16913   __pyx_L0:;
16914   __Pyx_XDECREF((PyObject *)__pyx_v_result);
16915   __Pyx_XDECREF(__pyx_v_length);
16916   __Pyx_XGIVEREF(__pyx_r);
16917   __Pyx_RefNannyFinishContext();
16918   return __pyx_r;
16919 }
16920 
16921 /* "View.MemoryView":1052
16922  *
16923  * @cname('__pyx_memoryview_get_slice_from_memoryview')
16924  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
16925  *                                                    __Pyx_memviewslice *mslice) except NULL:
16926  *     cdef _memoryviewslice obj
16927  */
16928 
__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_mslice)16929 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
16930   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
16931   __Pyx_memviewslice *__pyx_r;
16932   __Pyx_RefNannyDeclarations
16933   int __pyx_t_1;
16934   int __pyx_t_2;
16935   PyObject *__pyx_t_3 = NULL;
16936   int __pyx_lineno = 0;
16937   const char *__pyx_filename = NULL;
16938   int __pyx_clineno = 0;
16939   __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
16940 
16941   /* "View.MemoryView":1055
16942  *                                                    __Pyx_memviewslice *mslice) except NULL:
16943  *     cdef _memoryviewslice obj
16944  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16945  *         obj = memview
16946  *         return &obj.from_slice
16947  */
16948   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
16949   __pyx_t_2 = (__pyx_t_1 != 0);
16950   if (__pyx_t_2) {
16951 
16952     /* "View.MemoryView":1056
16953  *     cdef _memoryviewslice obj
16954  *     if isinstance(memview, _memoryviewslice):
16955  *         obj = memview             # <<<<<<<<<<<<<<
16956  *         return &obj.from_slice
16957  *     else:
16958  */
16959     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1056, __pyx_L1_error)
16960     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
16961     __Pyx_INCREF(__pyx_t_3);
16962     __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
16963     __pyx_t_3 = 0;
16964 
16965     /* "View.MemoryView":1057
16966  *     if isinstance(memview, _memoryviewslice):
16967  *         obj = memview
16968  *         return &obj.from_slice             # <<<<<<<<<<<<<<
16969  *     else:
16970  *         slice_copy(memview, mslice)
16971  */
16972     __pyx_r = (&__pyx_v_obj->from_slice);
16973     goto __pyx_L0;
16974 
16975     /* "View.MemoryView":1055
16976  *                                                    __Pyx_memviewslice *mslice) except NULL:
16977  *     cdef _memoryviewslice obj
16978  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16979  *         obj = memview
16980  *         return &obj.from_slice
16981  */
16982   }
16983 
16984   /* "View.MemoryView":1059
16985  *         return &obj.from_slice
16986  *     else:
16987  *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
16988  *         return mslice
16989  *
16990  */
16991   /*else*/ {
16992     __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
16993 
16994     /* "View.MemoryView":1060
16995  *     else:
16996  *         slice_copy(memview, mslice)
16997  *         return mslice             # <<<<<<<<<<<<<<
16998  *
16999  * @cname('__pyx_memoryview_slice_copy')
17000  */
17001     __pyx_r = __pyx_v_mslice;
17002     goto __pyx_L0;
17003   }
17004 
17005   /* "View.MemoryView":1052
17006  *
17007  * @cname('__pyx_memoryview_get_slice_from_memoryview')
17008  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
17009  *                                                    __Pyx_memviewslice *mslice) except NULL:
17010  *     cdef _memoryviewslice obj
17011  */
17012 
17013   /* function exit code */
17014   __pyx_L1_error:;
17015   __Pyx_XDECREF(__pyx_t_3);
17016   __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
17017   __pyx_r = NULL;
17018   __pyx_L0:;
17019   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
17020   __Pyx_RefNannyFinishContext();
17021   return __pyx_r;
17022 }
17023 
17024 /* "View.MemoryView":1063
17025  *
17026  * @cname('__pyx_memoryview_slice_copy')
17027  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
17028  *     cdef int dim
17029  *     cdef (Py_ssize_t*) shape, strides, suboffsets
17030  */
17031 
__pyx_memoryview_slice_copy(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_dst)17032 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
17033   int __pyx_v_dim;
17034   Py_ssize_t *__pyx_v_shape;
17035   Py_ssize_t *__pyx_v_strides;
17036   Py_ssize_t *__pyx_v_suboffsets;
17037   __Pyx_RefNannyDeclarations
17038   Py_ssize_t *__pyx_t_1;
17039   int __pyx_t_2;
17040   int __pyx_t_3;
17041   int __pyx_t_4;
17042   Py_ssize_t __pyx_t_5;
17043   __Pyx_RefNannySetupContext("slice_copy", 0);
17044 
17045   /* "View.MemoryView":1067
17046  *     cdef (Py_ssize_t*) shape, strides, suboffsets
17047  *
17048  *     shape = memview.view.shape             # <<<<<<<<<<<<<<
17049  *     strides = memview.view.strides
17050  *     suboffsets = memview.view.suboffsets
17051  */
17052   __pyx_t_1 = __pyx_v_memview->view.shape;
17053   __pyx_v_shape = __pyx_t_1;
17054 
17055   /* "View.MemoryView":1068
17056  *
17057  *     shape = memview.view.shape
17058  *     strides = memview.view.strides             # <<<<<<<<<<<<<<
17059  *     suboffsets = memview.view.suboffsets
17060  *
17061  */
17062   __pyx_t_1 = __pyx_v_memview->view.strides;
17063   __pyx_v_strides = __pyx_t_1;
17064 
17065   /* "View.MemoryView":1069
17066  *     shape = memview.view.shape
17067  *     strides = memview.view.strides
17068  *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
17069  *
17070  *     dst.memview = <__pyx_memoryview *> memview
17071  */
17072   __pyx_t_1 = __pyx_v_memview->view.suboffsets;
17073   __pyx_v_suboffsets = __pyx_t_1;
17074 
17075   /* "View.MemoryView":1071
17076  *     suboffsets = memview.view.suboffsets
17077  *
17078  *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
17079  *     dst.data = <char *> memview.view.buf
17080  *
17081  */
17082   __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
17083 
17084   /* "View.MemoryView":1072
17085  *
17086  *     dst.memview = <__pyx_memoryview *> memview
17087  *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
17088  *
17089  *     for dim in range(memview.view.ndim):
17090  */
17091   __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
17092 
17093   /* "View.MemoryView":1074
17094  *     dst.data = <char *> memview.view.buf
17095  *
17096  *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
17097  *         dst.shape[dim] = shape[dim]
17098  *         dst.strides[dim] = strides[dim]
17099  */
17100   __pyx_t_2 = __pyx_v_memview->view.ndim;
17101   __pyx_t_3 = __pyx_t_2;
17102   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17103     __pyx_v_dim = __pyx_t_4;
17104 
17105     /* "View.MemoryView":1075
17106  *
17107  *     for dim in range(memview.view.ndim):
17108  *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
17109  *         dst.strides[dim] = strides[dim]
17110  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
17111  */
17112     (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
17113 
17114     /* "View.MemoryView":1076
17115  *     for dim in range(memview.view.ndim):
17116  *         dst.shape[dim] = shape[dim]
17117  *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
17118  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
17119  *
17120  */
17121     (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
17122 
17123     /* "View.MemoryView":1077
17124  *         dst.shape[dim] = shape[dim]
17125  *         dst.strides[dim] = strides[dim]
17126  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
17127  *
17128  * @cname('__pyx_memoryview_copy_object')
17129  */
17130     if ((__pyx_v_suboffsets != 0)) {
17131       __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
17132     } else {
17133       __pyx_t_5 = -1L;
17134     }
17135     (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
17136   }
17137 
17138   /* "View.MemoryView":1063
17139  *
17140  * @cname('__pyx_memoryview_slice_copy')
17141  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
17142  *     cdef int dim
17143  *     cdef (Py_ssize_t*) shape, strides, suboffsets
17144  */
17145 
17146   /* function exit code */
17147   __Pyx_RefNannyFinishContext();
17148 }
17149 
17150 /* "View.MemoryView":1080
17151  *
17152  * @cname('__pyx_memoryview_copy_object')
17153  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
17154  *     "Create a new memoryview object"
17155  *     cdef __Pyx_memviewslice memviewslice
17156  */
17157 
__pyx_memoryview_copy_object(struct __pyx_memoryview_obj * __pyx_v_memview)17158 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
17159   __Pyx_memviewslice __pyx_v_memviewslice;
17160   PyObject *__pyx_r = NULL;
17161   __Pyx_RefNannyDeclarations
17162   PyObject *__pyx_t_1 = NULL;
17163   int __pyx_lineno = 0;
17164   const char *__pyx_filename = NULL;
17165   int __pyx_clineno = 0;
17166   __Pyx_RefNannySetupContext("memoryview_copy", 0);
17167 
17168   /* "View.MemoryView":1083
17169  *     "Create a new memoryview object"
17170  *     cdef __Pyx_memviewslice memviewslice
17171  *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
17172  *     return memoryview_copy_from_slice(memview, &memviewslice)
17173  *
17174  */
17175   __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
17176 
17177   /* "View.MemoryView":1084
17178  *     cdef __Pyx_memviewslice memviewslice
17179  *     slice_copy(memview, &memviewslice)
17180  *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
17181  *
17182  * @cname('__pyx_memoryview_copy_object_from_slice')
17183  */
17184   __Pyx_XDECREF(__pyx_r);
17185   __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1084, __pyx_L1_error)
17186   __Pyx_GOTREF(__pyx_t_1);
17187   __pyx_r = __pyx_t_1;
17188   __pyx_t_1 = 0;
17189   goto __pyx_L0;
17190 
17191   /* "View.MemoryView":1080
17192  *
17193  * @cname('__pyx_memoryview_copy_object')
17194  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
17195  *     "Create a new memoryview object"
17196  *     cdef __Pyx_memviewslice memviewslice
17197  */
17198 
17199   /* function exit code */
17200   __pyx_L1_error:;
17201   __Pyx_XDECREF(__pyx_t_1);
17202   __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
17203   __pyx_r = 0;
17204   __pyx_L0:;
17205   __Pyx_XGIVEREF(__pyx_r);
17206   __Pyx_RefNannyFinishContext();
17207   return __pyx_r;
17208 }
17209 
17210 /* "View.MemoryView":1087
17211  *
17212  * @cname('__pyx_memoryview_copy_object_from_slice')
17213  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
17214  *     """
17215  *     Create a new memoryview object from a given memoryview object and slice.
17216  */
17217 
__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_memviewslice)17218 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
17219   PyObject *(*__pyx_v_to_object_func)(char *);
17220   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
17221   PyObject *__pyx_r = NULL;
17222   __Pyx_RefNannyDeclarations
17223   int __pyx_t_1;
17224   int __pyx_t_2;
17225   PyObject *(*__pyx_t_3)(char *);
17226   int (*__pyx_t_4)(char *, PyObject *);
17227   PyObject *__pyx_t_5 = NULL;
17228   int __pyx_lineno = 0;
17229   const char *__pyx_filename = NULL;
17230   int __pyx_clineno = 0;
17231   __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
17232 
17233   /* "View.MemoryView":1094
17234  *     cdef int (*to_dtype_func)(char *, object) except 0
17235  *
17236  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
17237  *         to_object_func = (<_memoryviewslice> memview).to_object_func
17238  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
17239  */
17240   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
17241   __pyx_t_2 = (__pyx_t_1 != 0);
17242   if (__pyx_t_2) {
17243 
17244     /* "View.MemoryView":1095
17245  *
17246  *     if isinstance(memview, _memoryviewslice):
17247  *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
17248  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
17249  *     else:
17250  */
17251     __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
17252     __pyx_v_to_object_func = __pyx_t_3;
17253 
17254     /* "View.MemoryView":1096
17255  *     if isinstance(memview, _memoryviewslice):
17256  *         to_object_func = (<_memoryviewslice> memview).to_object_func
17257  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
17258  *     else:
17259  *         to_object_func = NULL
17260  */
17261     __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
17262     __pyx_v_to_dtype_func = __pyx_t_4;
17263 
17264     /* "View.MemoryView":1094
17265  *     cdef int (*to_dtype_func)(char *, object) except 0
17266  *
17267  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
17268  *         to_object_func = (<_memoryviewslice> memview).to_object_func
17269  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
17270  */
17271     goto __pyx_L3;
17272   }
17273 
17274   /* "View.MemoryView":1098
17275  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
17276  *     else:
17277  *         to_object_func = NULL             # <<<<<<<<<<<<<<
17278  *         to_dtype_func = NULL
17279  *
17280  */
17281   /*else*/ {
17282     __pyx_v_to_object_func = NULL;
17283 
17284     /* "View.MemoryView":1099
17285  *     else:
17286  *         to_object_func = NULL
17287  *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
17288  *
17289  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
17290  */
17291     __pyx_v_to_dtype_func = NULL;
17292   }
17293   __pyx_L3:;
17294 
17295   /* "View.MemoryView":1101
17296  *         to_dtype_func = NULL
17297  *
17298  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
17299  *                                 to_object_func, to_dtype_func,
17300  *                                 memview.dtype_is_object)
17301  */
17302   __Pyx_XDECREF(__pyx_r);
17303 
17304   /* "View.MemoryView":1103
17305  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
17306  *                                 to_object_func, to_dtype_func,
17307  *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
17308  *
17309  *
17310  */
17311   __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1101, __pyx_L1_error)
17312   __Pyx_GOTREF(__pyx_t_5);
17313   __pyx_r = __pyx_t_5;
17314   __pyx_t_5 = 0;
17315   goto __pyx_L0;
17316 
17317   /* "View.MemoryView":1087
17318  *
17319  * @cname('__pyx_memoryview_copy_object_from_slice')
17320  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
17321  *     """
17322  *     Create a new memoryview object from a given memoryview object and slice.
17323  */
17324 
17325   /* function exit code */
17326   __pyx_L1_error:;
17327   __Pyx_XDECREF(__pyx_t_5);
17328   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17329   __pyx_r = 0;
17330   __pyx_L0:;
17331   __Pyx_XGIVEREF(__pyx_r);
17332   __Pyx_RefNannyFinishContext();
17333   return __pyx_r;
17334 }
17335 
17336 /* "View.MemoryView":1109
17337  *
17338  *
17339  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
17340  *     if arg < 0:
17341  *         return -arg
17342  */
17343 
abs_py_ssize_t(Py_ssize_t __pyx_v_arg)17344 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
17345   Py_ssize_t __pyx_r;
17346   int __pyx_t_1;
17347 
17348   /* "View.MemoryView":1110
17349  *
17350  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
17351  *     if arg < 0:             # <<<<<<<<<<<<<<
17352  *         return -arg
17353  *     else:
17354  */
17355   __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
17356   if (__pyx_t_1) {
17357 
17358     /* "View.MemoryView":1111
17359  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
17360  *     if arg < 0:
17361  *         return -arg             # <<<<<<<<<<<<<<
17362  *     else:
17363  *         return arg
17364  */
17365     __pyx_r = (-__pyx_v_arg);
17366     goto __pyx_L0;
17367 
17368     /* "View.MemoryView":1110
17369  *
17370  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
17371  *     if arg < 0:             # <<<<<<<<<<<<<<
17372  *         return -arg
17373  *     else:
17374  */
17375   }
17376 
17377   /* "View.MemoryView":1113
17378  *         return -arg
17379  *     else:
17380  *         return arg             # <<<<<<<<<<<<<<
17381  *
17382  * @cname('__pyx_get_best_slice_order')
17383  */
17384   /*else*/ {
17385     __pyx_r = __pyx_v_arg;
17386     goto __pyx_L0;
17387   }
17388 
17389   /* "View.MemoryView":1109
17390  *
17391  *
17392  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
17393  *     if arg < 0:
17394  *         return -arg
17395  */
17396 
17397   /* function exit code */
17398   __pyx_L0:;
17399   return __pyx_r;
17400 }
17401 
17402 /* "View.MemoryView":1116
17403  *
17404  * @cname('__pyx_get_best_slice_order')
17405  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
17406  *     """
17407  *     Figure out the best memory access order for a given slice.
17408  */
17409 
__pyx_get_best_slice_order(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim)17410 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
17411   int __pyx_v_i;
17412   Py_ssize_t __pyx_v_c_stride;
17413   Py_ssize_t __pyx_v_f_stride;
17414   char __pyx_r;
17415   int __pyx_t_1;
17416   int __pyx_t_2;
17417   int __pyx_t_3;
17418   int __pyx_t_4;
17419 
17420   /* "View.MemoryView":1121
17421  *     """
17422  *     cdef int i
17423  *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
17424  *     cdef Py_ssize_t f_stride = 0
17425  *
17426  */
17427   __pyx_v_c_stride = 0;
17428 
17429   /* "View.MemoryView":1122
17430  *     cdef int i
17431  *     cdef Py_ssize_t c_stride = 0
17432  *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
17433  *
17434  *     for i in range(ndim - 1, -1, -1):
17435  */
17436   __pyx_v_f_stride = 0;
17437 
17438   /* "View.MemoryView":1124
17439  *     cdef Py_ssize_t f_stride = 0
17440  *
17441  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
17442  *         if mslice.shape[i] > 1:
17443  *             c_stride = mslice.strides[i]
17444  */
17445   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
17446     __pyx_v_i = __pyx_t_1;
17447 
17448     /* "View.MemoryView":1125
17449  *
17450  *     for i in range(ndim - 1, -1, -1):
17451  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17452  *             c_stride = mslice.strides[i]
17453  *             break
17454  */
17455     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17456     if (__pyx_t_2) {
17457 
17458       /* "View.MemoryView":1126
17459  *     for i in range(ndim - 1, -1, -1):
17460  *         if mslice.shape[i] > 1:
17461  *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
17462  *             break
17463  *
17464  */
17465       __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17466 
17467       /* "View.MemoryView":1127
17468  *         if mslice.shape[i] > 1:
17469  *             c_stride = mslice.strides[i]
17470  *             break             # <<<<<<<<<<<<<<
17471  *
17472  *     for i in range(ndim):
17473  */
17474       goto __pyx_L4_break;
17475 
17476       /* "View.MemoryView":1125
17477  *
17478  *     for i in range(ndim - 1, -1, -1):
17479  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17480  *             c_stride = mslice.strides[i]
17481  *             break
17482  */
17483     }
17484   }
17485   __pyx_L4_break:;
17486 
17487   /* "View.MemoryView":1129
17488  *             break
17489  *
17490  *     for i in range(ndim):             # <<<<<<<<<<<<<<
17491  *         if mslice.shape[i] > 1:
17492  *             f_stride = mslice.strides[i]
17493  */
17494   __pyx_t_1 = __pyx_v_ndim;
17495   __pyx_t_3 = __pyx_t_1;
17496   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17497     __pyx_v_i = __pyx_t_4;
17498 
17499     /* "View.MemoryView":1130
17500  *
17501  *     for i in range(ndim):
17502  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17503  *             f_stride = mslice.strides[i]
17504  *             break
17505  */
17506     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17507     if (__pyx_t_2) {
17508 
17509       /* "View.MemoryView":1131
17510  *     for i in range(ndim):
17511  *         if mslice.shape[i] > 1:
17512  *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
17513  *             break
17514  *
17515  */
17516       __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17517 
17518       /* "View.MemoryView":1132
17519  *         if mslice.shape[i] > 1:
17520  *             f_stride = mslice.strides[i]
17521  *             break             # <<<<<<<<<<<<<<
17522  *
17523  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
17524  */
17525       goto __pyx_L7_break;
17526 
17527       /* "View.MemoryView":1130
17528  *
17529  *     for i in range(ndim):
17530  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17531  *             f_stride = mslice.strides[i]
17532  *             break
17533  */
17534     }
17535   }
17536   __pyx_L7_break:;
17537 
17538   /* "View.MemoryView":1134
17539  *             break
17540  *
17541  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
17542  *         return 'C'
17543  *     else:
17544  */
17545   __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
17546   if (__pyx_t_2) {
17547 
17548     /* "View.MemoryView":1135
17549  *
17550  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
17551  *         return 'C'             # <<<<<<<<<<<<<<
17552  *     else:
17553  *         return 'F'
17554  */
17555     __pyx_r = 'C';
17556     goto __pyx_L0;
17557 
17558     /* "View.MemoryView":1134
17559  *             break
17560  *
17561  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
17562  *         return 'C'
17563  *     else:
17564  */
17565   }
17566 
17567   /* "View.MemoryView":1137
17568  *         return 'C'
17569  *     else:
17570  *         return 'F'             # <<<<<<<<<<<<<<
17571  *
17572  * @cython.cdivision(True)
17573  */
17574   /*else*/ {
17575     __pyx_r = 'F';
17576     goto __pyx_L0;
17577   }
17578 
17579   /* "View.MemoryView":1116
17580  *
17581  * @cname('__pyx_get_best_slice_order')
17582  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
17583  *     """
17584  *     Figure out the best memory access order for a given slice.
17585  */
17586 
17587   /* function exit code */
17588   __pyx_L0:;
17589   return __pyx_r;
17590 }
17591 
17592 /* "View.MemoryView":1140
17593  *
17594  * @cython.cdivision(True)
17595  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
17596  *                                    char *dst_data, Py_ssize_t *dst_strides,
17597  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
17598  */
17599 
_copy_strided_to_strided(char * __pyx_v_src_data,Py_ssize_t * __pyx_v_src_strides,char * __pyx_v_dst_data,Py_ssize_t * __pyx_v_dst_strides,Py_ssize_t * __pyx_v_src_shape,Py_ssize_t * __pyx_v_dst_shape,int __pyx_v_ndim,size_t __pyx_v_itemsize)17600 static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
17601   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17602   CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
17603   Py_ssize_t __pyx_v_dst_extent;
17604   Py_ssize_t __pyx_v_src_stride;
17605   Py_ssize_t __pyx_v_dst_stride;
17606   int __pyx_t_1;
17607   int __pyx_t_2;
17608   int __pyx_t_3;
17609   Py_ssize_t __pyx_t_4;
17610   Py_ssize_t __pyx_t_5;
17611   Py_ssize_t __pyx_t_6;
17612 
17613   /* "View.MemoryView":1147
17614  *
17615  *     cdef Py_ssize_t i
17616  *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
17617  *     cdef Py_ssize_t dst_extent = dst_shape[0]
17618  *     cdef Py_ssize_t src_stride = src_strides[0]
17619  */
17620   __pyx_v_src_extent = (__pyx_v_src_shape[0]);
17621 
17622   /* "View.MemoryView":1148
17623  *     cdef Py_ssize_t i
17624  *     cdef Py_ssize_t src_extent = src_shape[0]
17625  *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
17626  *     cdef Py_ssize_t src_stride = src_strides[0]
17627  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17628  */
17629   __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
17630 
17631   /* "View.MemoryView":1149
17632  *     cdef Py_ssize_t src_extent = src_shape[0]
17633  *     cdef Py_ssize_t dst_extent = dst_shape[0]
17634  *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
17635  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17636  *
17637  */
17638   __pyx_v_src_stride = (__pyx_v_src_strides[0]);
17639 
17640   /* "View.MemoryView":1150
17641  *     cdef Py_ssize_t dst_extent = dst_shape[0]
17642  *     cdef Py_ssize_t src_stride = src_strides[0]
17643  *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
17644  *
17645  *     if ndim == 1:
17646  */
17647   __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
17648 
17649   /* "View.MemoryView":1152
17650  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17651  *
17652  *     if ndim == 1:             # <<<<<<<<<<<<<<
17653  *        if (src_stride > 0 and dst_stride > 0 and
17654  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17655  */
17656   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
17657   if (__pyx_t_1) {
17658 
17659     /* "View.MemoryView":1153
17660  *
17661  *     if ndim == 1:
17662  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
17663  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17664  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17665  */
17666     __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
17667     if (__pyx_t_2) {
17668     } else {
17669       __pyx_t_1 = __pyx_t_2;
17670       goto __pyx_L5_bool_binop_done;
17671     }
17672     __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
17673     if (__pyx_t_2) {
17674     } else {
17675       __pyx_t_1 = __pyx_t_2;
17676       goto __pyx_L5_bool_binop_done;
17677     }
17678 
17679     /* "View.MemoryView":1154
17680  *     if ndim == 1:
17681  *        if (src_stride > 0 and dst_stride > 0 and
17682  *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
17683  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17684  *        else:
17685  */
17686     __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
17687     if (__pyx_t_2) {
17688       __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
17689     }
17690     __pyx_t_3 = (__pyx_t_2 != 0);
17691     __pyx_t_1 = __pyx_t_3;
17692     __pyx_L5_bool_binop_done:;
17693 
17694     /* "View.MemoryView":1153
17695  *
17696  *     if ndim == 1:
17697  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
17698  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17699  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17700  */
17701     if (__pyx_t_1) {
17702 
17703       /* "View.MemoryView":1155
17704  *        if (src_stride > 0 and dst_stride > 0 and
17705  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17706  *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
17707  *        else:
17708  *            for i in range(dst_extent):
17709  */
17710       (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
17711 
17712       /* "View.MemoryView":1153
17713  *
17714  *     if ndim == 1:
17715  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
17716  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17717  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17718  */
17719       goto __pyx_L4;
17720     }
17721 
17722     /* "View.MemoryView":1157
17723  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17724  *        else:
17725  *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
17726  *                memcpy(dst_data, src_data, itemsize)
17727  *                src_data += src_stride
17728  */
17729     /*else*/ {
17730       __pyx_t_4 = __pyx_v_dst_extent;
17731       __pyx_t_5 = __pyx_t_4;
17732       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17733         __pyx_v_i = __pyx_t_6;
17734 
17735         /* "View.MemoryView":1158
17736  *        else:
17737  *            for i in range(dst_extent):
17738  *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
17739  *                src_data += src_stride
17740  *                dst_data += dst_stride
17741  */
17742         (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
17743 
17744         /* "View.MemoryView":1159
17745  *            for i in range(dst_extent):
17746  *                memcpy(dst_data, src_data, itemsize)
17747  *                src_data += src_stride             # <<<<<<<<<<<<<<
17748  *                dst_data += dst_stride
17749  *     else:
17750  */
17751         __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17752 
17753         /* "View.MemoryView":1160
17754  *                memcpy(dst_data, src_data, itemsize)
17755  *                src_data += src_stride
17756  *                dst_data += dst_stride             # <<<<<<<<<<<<<<
17757  *     else:
17758  *         for i in range(dst_extent):
17759  */
17760         __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17761       }
17762     }
17763     __pyx_L4:;
17764 
17765     /* "View.MemoryView":1152
17766  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17767  *
17768  *     if ndim == 1:             # <<<<<<<<<<<<<<
17769  *        if (src_stride > 0 and dst_stride > 0 and
17770  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17771  */
17772     goto __pyx_L3;
17773   }
17774 
17775   /* "View.MemoryView":1162
17776  *                dst_data += dst_stride
17777  *     else:
17778  *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
17779  *             _copy_strided_to_strided(src_data, src_strides + 1,
17780  *                                      dst_data, dst_strides + 1,
17781  */
17782   /*else*/ {
17783     __pyx_t_4 = __pyx_v_dst_extent;
17784     __pyx_t_5 = __pyx_t_4;
17785     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17786       __pyx_v_i = __pyx_t_6;
17787 
17788       /* "View.MemoryView":1163
17789  *     else:
17790  *         for i in range(dst_extent):
17791  *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
17792  *                                      dst_data, dst_strides + 1,
17793  *                                      src_shape + 1, dst_shape + 1,
17794  */
17795       _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
17796 
17797       /* "View.MemoryView":1167
17798  *                                      src_shape + 1, dst_shape + 1,
17799  *                                      ndim - 1, itemsize)
17800  *             src_data += src_stride             # <<<<<<<<<<<<<<
17801  *             dst_data += dst_stride
17802  *
17803  */
17804       __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17805 
17806       /* "View.MemoryView":1168
17807  *                                      ndim - 1, itemsize)
17808  *             src_data += src_stride
17809  *             dst_data += dst_stride             # <<<<<<<<<<<<<<
17810  *
17811  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
17812  */
17813       __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17814     }
17815   }
17816   __pyx_L3:;
17817 
17818   /* "View.MemoryView":1140
17819  *
17820  * @cython.cdivision(True)
17821  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
17822  *                                    char *dst_data, Py_ssize_t *dst_strides,
17823  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
17824  */
17825 
17826   /* function exit code */
17827 }
17828 
17829 /* "View.MemoryView":1170
17830  *             dst_data += dst_stride
17831  *
17832  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
17833  *                                   __Pyx_memviewslice *dst,
17834  *                                   int ndim, size_t itemsize) nogil:
17835  */
17836 
copy_strided_to_strided(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize)17837 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
17838 
17839   /* "View.MemoryView":1173
17840  *                                   __Pyx_memviewslice *dst,
17841  *                                   int ndim, size_t itemsize) nogil:
17842  *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
17843  *                              src.shape, dst.shape, ndim, itemsize)
17844  *
17845  */
17846   _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
17847 
17848   /* "View.MemoryView":1170
17849  *             dst_data += dst_stride
17850  *
17851  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
17852  *                                   __Pyx_memviewslice *dst,
17853  *                                   int ndim, size_t itemsize) nogil:
17854  */
17855 
17856   /* function exit code */
17857 }
17858 
17859 /* "View.MemoryView":1177
17860  *
17861  * @cname('__pyx_memoryview_slice_get_size')
17862  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
17863  *     "Return the size of the memory occupied by the slice in number of bytes"
17864  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
17865  */
17866 
__pyx_memoryview_slice_get_size(__Pyx_memviewslice * __pyx_v_src,int __pyx_v_ndim)17867 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
17868   Py_ssize_t __pyx_v_shape;
17869   Py_ssize_t __pyx_v_size;
17870   Py_ssize_t __pyx_r;
17871   Py_ssize_t __pyx_t_1;
17872   Py_ssize_t *__pyx_t_2;
17873   Py_ssize_t *__pyx_t_3;
17874   Py_ssize_t *__pyx_t_4;
17875 
17876   /* "View.MemoryView":1179
17877  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
17878  *     "Return the size of the memory occupied by the slice in number of bytes"
17879  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
17880  *
17881  *     for shape in src.shape[:ndim]:
17882  */
17883   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
17884   __pyx_v_size = __pyx_t_1;
17885 
17886   /* "View.MemoryView":1181
17887  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
17888  *
17889  *     for shape in src.shape[:ndim]:             # <<<<<<<<<<<<<<
17890  *         size *= shape
17891  *
17892  */
17893   __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
17894   for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
17895     __pyx_t_2 = __pyx_t_4;
17896     __pyx_v_shape = (__pyx_t_2[0]);
17897 
17898     /* "View.MemoryView":1182
17899  *
17900  *     for shape in src.shape[:ndim]:
17901  *         size *= shape             # <<<<<<<<<<<<<<
17902  *
17903  *     return size
17904  */
17905     __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
17906   }
17907 
17908   /* "View.MemoryView":1184
17909  *         size *= shape
17910  *
17911  *     return size             # <<<<<<<<<<<<<<
17912  *
17913  * @cname('__pyx_fill_contig_strides_array')
17914  */
17915   __pyx_r = __pyx_v_size;
17916   goto __pyx_L0;
17917 
17918   /* "View.MemoryView":1177
17919  *
17920  * @cname('__pyx_memoryview_slice_get_size')
17921  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
17922  *     "Return the size of the memory occupied by the slice in number of bytes"
17923  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
17924  */
17925 
17926   /* function exit code */
17927   __pyx_L0:;
17928   return __pyx_r;
17929 }
17930 
17931 /* "View.MemoryView":1187
17932  *
17933  * @cname('__pyx_fill_contig_strides_array')
17934  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
17935  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
17936  *                 int ndim, char order) nogil:
17937  */
17938 
__pyx_fill_contig_strides_array(Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,Py_ssize_t __pyx_v_stride,int __pyx_v_ndim,char __pyx_v_order)17939 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
17940   int __pyx_v_idx;
17941   Py_ssize_t __pyx_r;
17942   int __pyx_t_1;
17943   int __pyx_t_2;
17944   int __pyx_t_3;
17945   int __pyx_t_4;
17946 
17947   /* "View.MemoryView":1196
17948  *     cdef int idx
17949  *
17950  *     if order == 'F':             # <<<<<<<<<<<<<<
17951  *         for idx in range(ndim):
17952  *             strides[idx] = stride
17953  */
17954   __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
17955   if (__pyx_t_1) {
17956 
17957     /* "View.MemoryView":1197
17958  *
17959  *     if order == 'F':
17960  *         for idx in range(ndim):             # <<<<<<<<<<<<<<
17961  *             strides[idx] = stride
17962  *             stride *= shape[idx]
17963  */
17964     __pyx_t_2 = __pyx_v_ndim;
17965     __pyx_t_3 = __pyx_t_2;
17966     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17967       __pyx_v_idx = __pyx_t_4;
17968 
17969       /* "View.MemoryView":1198
17970  *     if order == 'F':
17971  *         for idx in range(ndim):
17972  *             strides[idx] = stride             # <<<<<<<<<<<<<<
17973  *             stride *= shape[idx]
17974  *     else:
17975  */
17976       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
17977 
17978       /* "View.MemoryView":1199
17979  *         for idx in range(ndim):
17980  *             strides[idx] = stride
17981  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
17982  *     else:
17983  *         for idx in range(ndim - 1, -1, -1):
17984  */
17985       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
17986     }
17987 
17988     /* "View.MemoryView":1196
17989  *     cdef int idx
17990  *
17991  *     if order == 'F':             # <<<<<<<<<<<<<<
17992  *         for idx in range(ndim):
17993  *             strides[idx] = stride
17994  */
17995     goto __pyx_L3;
17996   }
17997 
17998   /* "View.MemoryView":1201
17999  *             stride *= shape[idx]
18000  *     else:
18001  *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
18002  *             strides[idx] = stride
18003  *             stride *= shape[idx]
18004  */
18005   /*else*/ {
18006     for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
18007       __pyx_v_idx = __pyx_t_2;
18008 
18009       /* "View.MemoryView":1202
18010  *     else:
18011  *         for idx in range(ndim - 1, -1, -1):
18012  *             strides[idx] = stride             # <<<<<<<<<<<<<<
18013  *             stride *= shape[idx]
18014  *
18015  */
18016       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
18017 
18018       /* "View.MemoryView":1203
18019  *         for idx in range(ndim - 1, -1, -1):
18020  *             strides[idx] = stride
18021  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
18022  *
18023  *     return stride
18024  */
18025       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
18026     }
18027   }
18028   __pyx_L3:;
18029 
18030   /* "View.MemoryView":1205
18031  *             stride *= shape[idx]
18032  *
18033  *     return stride             # <<<<<<<<<<<<<<
18034  *
18035  * @cname('__pyx_memoryview_copy_data_to_temp')
18036  */
18037   __pyx_r = __pyx_v_stride;
18038   goto __pyx_L0;
18039 
18040   /* "View.MemoryView":1187
18041  *
18042  * @cname('__pyx_fill_contig_strides_array')
18043  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
18044  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
18045  *                 int ndim, char order) nogil:
18046  */
18047 
18048   /* function exit code */
18049   __pyx_L0:;
18050   return __pyx_r;
18051 }
18052 
18053 /* "View.MemoryView":1208
18054  *
18055  * @cname('__pyx_memoryview_copy_data_to_temp')
18056  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
18057  *                              __Pyx_memviewslice *tmpslice,
18058  *                              char order,
18059  */
18060 
__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_tmpslice,char __pyx_v_order,int __pyx_v_ndim)18061 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
18062   int __pyx_v_i;
18063   void *__pyx_v_result;
18064   size_t __pyx_v_itemsize;
18065   size_t __pyx_v_size;
18066   void *__pyx_r;
18067   Py_ssize_t __pyx_t_1;
18068   int __pyx_t_2;
18069   int __pyx_t_3;
18070   struct __pyx_memoryview_obj *__pyx_t_4;
18071   int __pyx_t_5;
18072   int __pyx_t_6;
18073   int __pyx_lineno = 0;
18074   const char *__pyx_filename = NULL;
18075   int __pyx_clineno = 0;
18076 
18077   /* "View.MemoryView":1219
18078  *     cdef void *result
18079  *
18080  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
18081  *     cdef size_t size = slice_get_size(src, ndim)
18082  *
18083  */
18084   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
18085   __pyx_v_itemsize = __pyx_t_1;
18086 
18087   /* "View.MemoryView":1220
18088  *
18089  *     cdef size_t itemsize = src.memview.view.itemsize
18090  *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
18091  *
18092  *     result = malloc(size)
18093  */
18094   __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
18095 
18096   /* "View.MemoryView":1222
18097  *     cdef size_t size = slice_get_size(src, ndim)
18098  *
18099  *     result = malloc(size)             # <<<<<<<<<<<<<<
18100  *     if not result:
18101  *         _err(MemoryError, NULL)
18102  */
18103   __pyx_v_result = malloc(__pyx_v_size);
18104 
18105   /* "View.MemoryView":1223
18106  *
18107  *     result = malloc(size)
18108  *     if not result:             # <<<<<<<<<<<<<<
18109  *         _err(MemoryError, NULL)
18110  *
18111  */
18112   __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
18113   if (__pyx_t_2) {
18114 
18115     /* "View.MemoryView":1224
18116  *     result = malloc(size)
18117  *     if not result:
18118  *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
18119  *
18120  *
18121  */
18122     __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1224, __pyx_L1_error)
18123 
18124     /* "View.MemoryView":1223
18125  *
18126  *     result = malloc(size)
18127  *     if not result:             # <<<<<<<<<<<<<<
18128  *         _err(MemoryError, NULL)
18129  *
18130  */
18131   }
18132 
18133   /* "View.MemoryView":1227
18134  *
18135  *
18136  *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
18137  *     tmpslice.memview = src.memview
18138  *     for i in range(ndim):
18139  */
18140   __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
18141 
18142   /* "View.MemoryView":1228
18143  *
18144  *     tmpslice.data = <char *> result
18145  *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
18146  *     for i in range(ndim):
18147  *         tmpslice.shape[i] = src.shape[i]
18148  */
18149   __pyx_t_4 = __pyx_v_src->memview;
18150   __pyx_v_tmpslice->memview = __pyx_t_4;
18151 
18152   /* "View.MemoryView":1229
18153  *     tmpslice.data = <char *> result
18154  *     tmpslice.memview = src.memview
18155  *     for i in range(ndim):             # <<<<<<<<<<<<<<
18156  *         tmpslice.shape[i] = src.shape[i]
18157  *         tmpslice.suboffsets[i] = -1
18158  */
18159   __pyx_t_3 = __pyx_v_ndim;
18160   __pyx_t_5 = __pyx_t_3;
18161   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18162     __pyx_v_i = __pyx_t_6;
18163 
18164     /* "View.MemoryView":1230
18165  *     tmpslice.memview = src.memview
18166  *     for i in range(ndim):
18167  *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
18168  *         tmpslice.suboffsets[i] = -1
18169  *
18170  */
18171     (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
18172 
18173     /* "View.MemoryView":1231
18174  *     for i in range(ndim):
18175  *         tmpslice.shape[i] = src.shape[i]
18176  *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
18177  *
18178  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
18179  */
18180     (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
18181   }
18182 
18183   /* "View.MemoryView":1233
18184  *         tmpslice.suboffsets[i] = -1
18185  *
18186  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
18187  *                               ndim, order)
18188  *
18189  */
18190   (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
18191 
18192   /* "View.MemoryView":1237
18193  *
18194  *
18195  *     for i in range(ndim):             # <<<<<<<<<<<<<<
18196  *         if tmpslice.shape[i] == 1:
18197  *             tmpslice.strides[i] = 0
18198  */
18199   __pyx_t_3 = __pyx_v_ndim;
18200   __pyx_t_5 = __pyx_t_3;
18201   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18202     __pyx_v_i = __pyx_t_6;
18203 
18204     /* "View.MemoryView":1238
18205  *
18206  *     for i in range(ndim):
18207  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
18208  *             tmpslice.strides[i] = 0
18209  *
18210  */
18211     __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
18212     if (__pyx_t_2) {
18213 
18214       /* "View.MemoryView":1239
18215  *     for i in range(ndim):
18216  *         if tmpslice.shape[i] == 1:
18217  *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
18218  *
18219  *     if slice_is_contig(src[0], order, ndim):
18220  */
18221       (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
18222 
18223       /* "View.MemoryView":1238
18224  *
18225  *     for i in range(ndim):
18226  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
18227  *             tmpslice.strides[i] = 0
18228  *
18229  */
18230     }
18231   }
18232 
18233   /* "View.MemoryView":1241
18234  *             tmpslice.strides[i] = 0
18235  *
18236  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
18237  *         memcpy(result, src.data, size)
18238  *     else:
18239  */
18240   __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
18241   if (__pyx_t_2) {
18242 
18243     /* "View.MemoryView":1242
18244  *
18245  *     if slice_is_contig(src[0], order, ndim):
18246  *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
18247  *     else:
18248  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
18249  */
18250     (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
18251 
18252     /* "View.MemoryView":1241
18253  *             tmpslice.strides[i] = 0
18254  *
18255  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
18256  *         memcpy(result, src.data, size)
18257  *     else:
18258  */
18259     goto __pyx_L9;
18260   }
18261 
18262   /* "View.MemoryView":1244
18263  *         memcpy(result, src.data, size)
18264  *     else:
18265  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
18266  *
18267  *     return result
18268  */
18269   /*else*/ {
18270     copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
18271   }
18272   __pyx_L9:;
18273 
18274   /* "View.MemoryView":1246
18275  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
18276  *
18277  *     return result             # <<<<<<<<<<<<<<
18278  *
18279  *
18280  */
18281   __pyx_r = __pyx_v_result;
18282   goto __pyx_L0;
18283 
18284   /* "View.MemoryView":1208
18285  *
18286  * @cname('__pyx_memoryview_copy_data_to_temp')
18287  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
18288  *                              __Pyx_memviewslice *tmpslice,
18289  *                              char order,
18290  */
18291 
18292   /* function exit code */
18293   __pyx_L1_error:;
18294   {
18295     #ifdef WITH_THREAD
18296     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18297     #endif
18298     __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
18299     #ifdef WITH_THREAD
18300     __Pyx_PyGILState_Release(__pyx_gilstate_save);
18301     #endif
18302   }
18303   __pyx_r = NULL;
18304   __pyx_L0:;
18305   return __pyx_r;
18306 }
18307 
18308 /* "View.MemoryView":1251
18309  *
18310  * @cname('__pyx_memoryview_err_extents')
18311  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
18312  *                              Py_ssize_t extent2) except -1 with gil:
18313  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
18314  */
18315 
__pyx_memoryview_err_extents(int __pyx_v_i,Py_ssize_t __pyx_v_extent1,Py_ssize_t __pyx_v_extent2)18316 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
18317   int __pyx_r;
18318   __Pyx_RefNannyDeclarations
18319   PyObject *__pyx_t_1 = NULL;
18320   PyObject *__pyx_t_2 = NULL;
18321   PyObject *__pyx_t_3 = NULL;
18322   PyObject *__pyx_t_4 = NULL;
18323   int __pyx_lineno = 0;
18324   const char *__pyx_filename = NULL;
18325   int __pyx_clineno = 0;
18326   #ifdef WITH_THREAD
18327   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18328   #endif
18329   __Pyx_RefNannySetupContext("_err_extents", 0);
18330 
18331   /* "View.MemoryView":1254
18332  *                              Py_ssize_t extent2) except -1 with gil:
18333  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
18334  *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
18335  *
18336  * @cname('__pyx_memoryview_err_dim')
18337  */
18338   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error)
18339   __Pyx_GOTREF(__pyx_t_1);
18340   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __pyx_L1_error)
18341   __Pyx_GOTREF(__pyx_t_2);
18342   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error)
18343   __Pyx_GOTREF(__pyx_t_3);
18344   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error)
18345   __Pyx_GOTREF(__pyx_t_4);
18346   __Pyx_GIVEREF(__pyx_t_1);
18347   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
18348   __Pyx_GIVEREF(__pyx_t_2);
18349   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
18350   __Pyx_GIVEREF(__pyx_t_3);
18351   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
18352   __pyx_t_1 = 0;
18353   __pyx_t_2 = 0;
18354   __pyx_t_3 = 0;
18355 
18356   /* "View.MemoryView":1253
18357  * cdef int _err_extents(int i, Py_ssize_t extent1,
18358  *                              Py_ssize_t extent2) except -1 with gil:
18359  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
18360  *                                                         (i, extent1, extent2))
18361  *
18362  */
18363   __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1253, __pyx_L1_error)
18364   __Pyx_GOTREF(__pyx_t_3);
18365   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18366   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1253, __pyx_L1_error)
18367   __Pyx_GOTREF(__pyx_t_4);
18368   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18369   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
18370   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18371   __PYX_ERR(2, 1253, __pyx_L1_error)
18372 
18373   /* "View.MemoryView":1251
18374  *
18375  * @cname('__pyx_memoryview_err_extents')
18376  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
18377  *                              Py_ssize_t extent2) except -1 with gil:
18378  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
18379  */
18380 
18381   /* function exit code */
18382   __pyx_L1_error:;
18383   __Pyx_XDECREF(__pyx_t_1);
18384   __Pyx_XDECREF(__pyx_t_2);
18385   __Pyx_XDECREF(__pyx_t_3);
18386   __Pyx_XDECREF(__pyx_t_4);
18387   __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
18388   __pyx_r = -1;
18389   __Pyx_RefNannyFinishContext();
18390   #ifdef WITH_THREAD
18391   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18392   #endif
18393   return __pyx_r;
18394 }
18395 
18396 /* "View.MemoryView":1257
18397  *
18398  * @cname('__pyx_memoryview_err_dim')
18399  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
18400  *     raise error(msg.decode('ascii') % dim)
18401  *
18402  */
18403 
__pyx_memoryview_err_dim(PyObject * __pyx_v_error,char * __pyx_v_msg,int __pyx_v_dim)18404 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
18405   int __pyx_r;
18406   __Pyx_RefNannyDeclarations
18407   PyObject *__pyx_t_1 = NULL;
18408   PyObject *__pyx_t_2 = NULL;
18409   PyObject *__pyx_t_3 = NULL;
18410   PyObject *__pyx_t_4 = NULL;
18411   int __pyx_lineno = 0;
18412   const char *__pyx_filename = NULL;
18413   int __pyx_clineno = 0;
18414   #ifdef WITH_THREAD
18415   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18416   #endif
18417   __Pyx_RefNannySetupContext("_err_dim", 0);
18418   __Pyx_INCREF(__pyx_v_error);
18419 
18420   /* "View.MemoryView":1258
18421  * @cname('__pyx_memoryview_err_dim')
18422  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
18423  *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
18424  *
18425  * @cname('__pyx_memoryview_err')
18426  */
18427   __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1258, __pyx_L1_error)
18428   __Pyx_GOTREF(__pyx_t_2);
18429   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1258, __pyx_L1_error)
18430   __Pyx_GOTREF(__pyx_t_3);
18431   __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1258, __pyx_L1_error)
18432   __Pyx_GOTREF(__pyx_t_4);
18433   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18434   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18435   __Pyx_INCREF(__pyx_v_error);
18436   __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
18437   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
18438     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
18439     if (likely(__pyx_t_2)) {
18440       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
18441       __Pyx_INCREF(__pyx_t_2);
18442       __Pyx_INCREF(function);
18443       __Pyx_DECREF_SET(__pyx_t_3, function);
18444     }
18445   }
18446   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
18447   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
18448   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18449   if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1258, __pyx_L1_error)
18450   __Pyx_GOTREF(__pyx_t_1);
18451   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18452   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18453   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18454   __PYX_ERR(2, 1258, __pyx_L1_error)
18455 
18456   /* "View.MemoryView":1257
18457  *
18458  * @cname('__pyx_memoryview_err_dim')
18459  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
18460  *     raise error(msg.decode('ascii') % dim)
18461  *
18462  */
18463 
18464   /* function exit code */
18465   __pyx_L1_error:;
18466   __Pyx_XDECREF(__pyx_t_1);
18467   __Pyx_XDECREF(__pyx_t_2);
18468   __Pyx_XDECREF(__pyx_t_3);
18469   __Pyx_XDECREF(__pyx_t_4);
18470   __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
18471   __pyx_r = -1;
18472   __Pyx_XDECREF(__pyx_v_error);
18473   __Pyx_RefNannyFinishContext();
18474   #ifdef WITH_THREAD
18475   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18476   #endif
18477   return __pyx_r;
18478 }
18479 
18480 /* "View.MemoryView":1261
18481  *
18482  * @cname('__pyx_memoryview_err')
18483  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
18484  *     if msg != NULL:
18485  *         raise error(msg.decode('ascii'))
18486  */
18487 
__pyx_memoryview_err(PyObject * __pyx_v_error,char * __pyx_v_msg)18488 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
18489   int __pyx_r;
18490   __Pyx_RefNannyDeclarations
18491   int __pyx_t_1;
18492   PyObject *__pyx_t_2 = NULL;
18493   PyObject *__pyx_t_3 = NULL;
18494   PyObject *__pyx_t_4 = NULL;
18495   PyObject *__pyx_t_5 = NULL;
18496   int __pyx_lineno = 0;
18497   const char *__pyx_filename = NULL;
18498   int __pyx_clineno = 0;
18499   #ifdef WITH_THREAD
18500   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18501   #endif
18502   __Pyx_RefNannySetupContext("_err", 0);
18503   __Pyx_INCREF(__pyx_v_error);
18504 
18505   /* "View.MemoryView":1262
18506  * @cname('__pyx_memoryview_err')
18507  * cdef int _err(object error, char *msg) except -1 with gil:
18508  *     if msg != NULL:             # <<<<<<<<<<<<<<
18509  *         raise error(msg.decode('ascii'))
18510  *     else:
18511  */
18512   __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
18513   if (unlikely(__pyx_t_1)) {
18514 
18515     /* "View.MemoryView":1263
18516  * cdef int _err(object error, char *msg) except -1 with gil:
18517  *     if msg != NULL:
18518  *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
18519  *     else:
18520  *         raise error
18521  */
18522     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1263, __pyx_L1_error)
18523     __Pyx_GOTREF(__pyx_t_3);
18524     __Pyx_INCREF(__pyx_v_error);
18525     __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
18526     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
18527       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
18528       if (likely(__pyx_t_5)) {
18529         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
18530         __Pyx_INCREF(__pyx_t_5);
18531         __Pyx_INCREF(function);
18532         __Pyx_DECREF_SET(__pyx_t_4, function);
18533       }
18534     }
18535     __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
18536     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
18537     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18538     if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1263, __pyx_L1_error)
18539     __Pyx_GOTREF(__pyx_t_2);
18540     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18541     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
18542     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18543     __PYX_ERR(2, 1263, __pyx_L1_error)
18544 
18545     /* "View.MemoryView":1262
18546  * @cname('__pyx_memoryview_err')
18547  * cdef int _err(object error, char *msg) except -1 with gil:
18548  *     if msg != NULL:             # <<<<<<<<<<<<<<
18549  *         raise error(msg.decode('ascii'))
18550  *     else:
18551  */
18552   }
18553 
18554   /* "View.MemoryView":1265
18555  *         raise error(msg.decode('ascii'))
18556  *     else:
18557  *         raise error             # <<<<<<<<<<<<<<
18558  *
18559  * @cname('__pyx_memoryview_copy_contents')
18560  */
18561   /*else*/ {
18562     __Pyx_Raise(__pyx_v_error, 0, 0, 0);
18563     __PYX_ERR(2, 1265, __pyx_L1_error)
18564   }
18565 
18566   /* "View.MemoryView":1261
18567  *
18568  * @cname('__pyx_memoryview_err')
18569  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
18570  *     if msg != NULL:
18571  *         raise error(msg.decode('ascii'))
18572  */
18573 
18574   /* function exit code */
18575   __pyx_L1_error:;
18576   __Pyx_XDECREF(__pyx_t_2);
18577   __Pyx_XDECREF(__pyx_t_3);
18578   __Pyx_XDECREF(__pyx_t_4);
18579   __Pyx_XDECREF(__pyx_t_5);
18580   __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
18581   __pyx_r = -1;
18582   __Pyx_XDECREF(__pyx_v_error);
18583   __Pyx_RefNannyFinishContext();
18584   #ifdef WITH_THREAD
18585   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18586   #endif
18587   return __pyx_r;
18588 }
18589 
18590 /* "View.MemoryView":1268
18591  *
18592  * @cname('__pyx_memoryview_copy_contents')
18593  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
18594  *                                   __Pyx_memviewslice dst,
18595  *                                   int src_ndim, int dst_ndim,
18596  */
18597 
__pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src,__Pyx_memviewslice __pyx_v_dst,int __pyx_v_src_ndim,int __pyx_v_dst_ndim,int __pyx_v_dtype_is_object)18598 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
18599   void *__pyx_v_tmpdata;
18600   size_t __pyx_v_itemsize;
18601   int __pyx_v_i;
18602   char __pyx_v_order;
18603   int __pyx_v_broadcasting;
18604   int __pyx_v_direct_copy;
18605   __Pyx_memviewslice __pyx_v_tmp;
18606   int __pyx_v_ndim;
18607   int __pyx_r;
18608   Py_ssize_t __pyx_t_1;
18609   int __pyx_t_2;
18610   int __pyx_t_3;
18611   int __pyx_t_4;
18612   int __pyx_t_5;
18613   int __pyx_t_6;
18614   void *__pyx_t_7;
18615   int __pyx_t_8;
18616   int __pyx_lineno = 0;
18617   const char *__pyx_filename = NULL;
18618   int __pyx_clineno = 0;
18619 
18620   /* "View.MemoryView":1276
18621  *     Check for overlapping memory and verify the shapes.
18622  *     """
18623  *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
18624  *     cdef size_t itemsize = src.memview.view.itemsize
18625  *     cdef int i
18626  */
18627   __pyx_v_tmpdata = NULL;
18628 
18629   /* "View.MemoryView":1277
18630  *     """
18631  *     cdef void *tmpdata = NULL
18632  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
18633  *     cdef int i
18634  *     cdef char order = get_best_order(&src, src_ndim)
18635  */
18636   __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
18637   __pyx_v_itemsize = __pyx_t_1;
18638 
18639   /* "View.MemoryView":1279
18640  *     cdef size_t itemsize = src.memview.view.itemsize
18641  *     cdef int i
18642  *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
18643  *     cdef bint broadcasting = False
18644  *     cdef bint direct_copy = False
18645  */
18646   __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
18647 
18648   /* "View.MemoryView":1280
18649  *     cdef int i
18650  *     cdef char order = get_best_order(&src, src_ndim)
18651  *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
18652  *     cdef bint direct_copy = False
18653  *     cdef __Pyx_memviewslice tmp
18654  */
18655   __pyx_v_broadcasting = 0;
18656 
18657   /* "View.MemoryView":1281
18658  *     cdef char order = get_best_order(&src, src_ndim)
18659  *     cdef bint broadcasting = False
18660  *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
18661  *     cdef __Pyx_memviewslice tmp
18662  *
18663  */
18664   __pyx_v_direct_copy = 0;
18665 
18666   /* "View.MemoryView":1284
18667  *     cdef __Pyx_memviewslice tmp
18668  *
18669  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
18670  *         broadcast_leading(&src, src_ndim, dst_ndim)
18671  *     elif dst_ndim < src_ndim:
18672  */
18673   __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
18674   if (__pyx_t_2) {
18675 
18676     /* "View.MemoryView":1285
18677  *
18678  *     if src_ndim < dst_ndim:
18679  *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
18680  *     elif dst_ndim < src_ndim:
18681  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18682  */
18683     __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
18684 
18685     /* "View.MemoryView":1284
18686  *     cdef __Pyx_memviewslice tmp
18687  *
18688  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
18689  *         broadcast_leading(&src, src_ndim, dst_ndim)
18690  *     elif dst_ndim < src_ndim:
18691  */
18692     goto __pyx_L3;
18693   }
18694 
18695   /* "View.MemoryView":1286
18696  *     if src_ndim < dst_ndim:
18697  *         broadcast_leading(&src, src_ndim, dst_ndim)
18698  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
18699  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18700  *
18701  */
18702   __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
18703   if (__pyx_t_2) {
18704 
18705     /* "View.MemoryView":1287
18706  *         broadcast_leading(&src, src_ndim, dst_ndim)
18707  *     elif dst_ndim < src_ndim:
18708  *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
18709  *
18710  *     cdef int ndim = max(src_ndim, dst_ndim)
18711  */
18712     __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
18713 
18714     /* "View.MemoryView":1286
18715  *     if src_ndim < dst_ndim:
18716  *         broadcast_leading(&src, src_ndim, dst_ndim)
18717  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
18718  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18719  *
18720  */
18721   }
18722   __pyx_L3:;
18723 
18724   /* "View.MemoryView":1289
18725  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18726  *
18727  *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
18728  *
18729  *     for i in range(ndim):
18730  */
18731   __pyx_t_3 = __pyx_v_dst_ndim;
18732   __pyx_t_4 = __pyx_v_src_ndim;
18733   if (((__pyx_t_3 > __pyx_t_4) != 0)) {
18734     __pyx_t_5 = __pyx_t_3;
18735   } else {
18736     __pyx_t_5 = __pyx_t_4;
18737   }
18738   __pyx_v_ndim = __pyx_t_5;
18739 
18740   /* "View.MemoryView":1291
18741  *     cdef int ndim = max(src_ndim, dst_ndim)
18742  *
18743  *     for i in range(ndim):             # <<<<<<<<<<<<<<
18744  *         if src.shape[i] != dst.shape[i]:
18745  *             if src.shape[i] == 1:
18746  */
18747   __pyx_t_5 = __pyx_v_ndim;
18748   __pyx_t_3 = __pyx_t_5;
18749   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18750     __pyx_v_i = __pyx_t_4;
18751 
18752     /* "View.MemoryView":1292
18753  *
18754  *     for i in range(ndim):
18755  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
18756  *             if src.shape[i] == 1:
18757  *                 broadcasting = True
18758  */
18759     __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
18760     if (__pyx_t_2) {
18761 
18762       /* "View.MemoryView":1293
18763  *     for i in range(ndim):
18764  *         if src.shape[i] != dst.shape[i]:
18765  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
18766  *                 broadcasting = True
18767  *                 src.strides[i] = 0
18768  */
18769       __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
18770       if (__pyx_t_2) {
18771 
18772         /* "View.MemoryView":1294
18773  *         if src.shape[i] != dst.shape[i]:
18774  *             if src.shape[i] == 1:
18775  *                 broadcasting = True             # <<<<<<<<<<<<<<
18776  *                 src.strides[i] = 0
18777  *             else:
18778  */
18779         __pyx_v_broadcasting = 1;
18780 
18781         /* "View.MemoryView":1295
18782  *             if src.shape[i] == 1:
18783  *                 broadcasting = True
18784  *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
18785  *             else:
18786  *                 _err_extents(i, dst.shape[i], src.shape[i])
18787  */
18788         (__pyx_v_src.strides[__pyx_v_i]) = 0;
18789 
18790         /* "View.MemoryView":1293
18791  *     for i in range(ndim):
18792  *         if src.shape[i] != dst.shape[i]:
18793  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
18794  *                 broadcasting = True
18795  *                 src.strides[i] = 0
18796  */
18797         goto __pyx_L7;
18798       }
18799 
18800       /* "View.MemoryView":1297
18801  *                 src.strides[i] = 0
18802  *             else:
18803  *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
18804  *
18805  *         if src.suboffsets[i] >= 0:
18806  */
18807       /*else*/ {
18808         __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1297, __pyx_L1_error)
18809       }
18810       __pyx_L7:;
18811 
18812       /* "View.MemoryView":1292
18813  *
18814  *     for i in range(ndim):
18815  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
18816  *             if src.shape[i] == 1:
18817  *                 broadcasting = True
18818  */
18819     }
18820 
18821     /* "View.MemoryView":1299
18822  *                 _err_extents(i, dst.shape[i], src.shape[i])
18823  *
18824  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
18825  *             _err_dim(ValueError, "Dimension %d is not direct", i)
18826  *
18827  */
18828     __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
18829     if (__pyx_t_2) {
18830 
18831       /* "View.MemoryView":1300
18832  *
18833  *         if src.suboffsets[i] >= 0:
18834  *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
18835  *
18836  *     if slices_overlap(&src, &dst, ndim, itemsize):
18837  */
18838       __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1300, __pyx_L1_error)
18839 
18840       /* "View.MemoryView":1299
18841  *                 _err_extents(i, dst.shape[i], src.shape[i])
18842  *
18843  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
18844  *             _err_dim(ValueError, "Dimension %d is not direct", i)
18845  *
18846  */
18847     }
18848   }
18849 
18850   /* "View.MemoryView":1302
18851  *             _err_dim(ValueError, "Dimension %d is not direct", i)
18852  *
18853  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
18854  *
18855  *         if not slice_is_contig(src, order, ndim):
18856  */
18857   __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
18858   if (__pyx_t_2) {
18859 
18860     /* "View.MemoryView":1304
18861  *     if slices_overlap(&src, &dst, ndim, itemsize):
18862  *
18863  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
18864  *             order = get_best_order(&dst, ndim)
18865  *
18866  */
18867     __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
18868     if (__pyx_t_2) {
18869 
18870       /* "View.MemoryView":1305
18871  *
18872  *         if not slice_is_contig(src, order, ndim):
18873  *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
18874  *
18875  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
18876  */
18877       __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
18878 
18879       /* "View.MemoryView":1304
18880  *     if slices_overlap(&src, &dst, ndim, itemsize):
18881  *
18882  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
18883  *             order = get_best_order(&dst, ndim)
18884  *
18885  */
18886     }
18887 
18888     /* "View.MemoryView":1307
18889  *             order = get_best_order(&dst, ndim)
18890  *
18891  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
18892  *         src = tmp
18893  *
18894  */
18895     __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1307, __pyx_L1_error)
18896     __pyx_v_tmpdata = __pyx_t_7;
18897 
18898     /* "View.MemoryView":1308
18899  *
18900  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
18901  *         src = tmp             # <<<<<<<<<<<<<<
18902  *
18903  *     if not broadcasting:
18904  */
18905     __pyx_v_src = __pyx_v_tmp;
18906 
18907     /* "View.MemoryView":1302
18908  *             _err_dim(ValueError, "Dimension %d is not direct", i)
18909  *
18910  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
18911  *
18912  *         if not slice_is_contig(src, order, ndim):
18913  */
18914   }
18915 
18916   /* "View.MemoryView":1310
18917  *         src = tmp
18918  *
18919  *     if not broadcasting:             # <<<<<<<<<<<<<<
18920  *
18921  *
18922  */
18923   __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
18924   if (__pyx_t_2) {
18925 
18926     /* "View.MemoryView":1313
18927  *
18928  *
18929  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
18930  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18931  *         elif slice_is_contig(src, 'F', ndim):
18932  */
18933     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
18934     if (__pyx_t_2) {
18935 
18936       /* "View.MemoryView":1314
18937  *
18938  *         if slice_is_contig(src, 'C', ndim):
18939  *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
18940  *         elif slice_is_contig(src, 'F', ndim):
18941  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18942  */
18943       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
18944 
18945       /* "View.MemoryView":1313
18946  *
18947  *
18948  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
18949  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18950  *         elif slice_is_contig(src, 'F', ndim):
18951  */
18952       goto __pyx_L12;
18953     }
18954 
18955     /* "View.MemoryView":1315
18956  *         if slice_is_contig(src, 'C', ndim):
18957  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18958  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
18959  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18960  *
18961  */
18962     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
18963     if (__pyx_t_2) {
18964 
18965       /* "View.MemoryView":1316
18966  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18967  *         elif slice_is_contig(src, 'F', ndim):
18968  *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
18969  *
18970  *         if direct_copy:
18971  */
18972       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
18973 
18974       /* "View.MemoryView":1315
18975  *         if slice_is_contig(src, 'C', ndim):
18976  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18977  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
18978  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18979  *
18980  */
18981     }
18982     __pyx_L12:;
18983 
18984     /* "View.MemoryView":1318
18985  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18986  *
18987  *         if direct_copy:             # <<<<<<<<<<<<<<
18988  *
18989  *             refcount_copying(&dst, dtype_is_object, ndim, False)
18990  */
18991     __pyx_t_2 = (__pyx_v_direct_copy != 0);
18992     if (__pyx_t_2) {
18993 
18994       /* "View.MemoryView":1320
18995  *         if direct_copy:
18996  *
18997  *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
18998  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
18999  *             refcount_copying(&dst, dtype_is_object, ndim, True)
19000  */
19001       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19002 
19003       /* "View.MemoryView":1321
19004  *
19005  *             refcount_copying(&dst, dtype_is_object, ndim, False)
19006  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
19007  *             refcount_copying(&dst, dtype_is_object, ndim, True)
19008  *             free(tmpdata)
19009  */
19010       (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
19011 
19012       /* "View.MemoryView":1322
19013  *             refcount_copying(&dst, dtype_is_object, ndim, False)
19014  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
19015  *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
19016  *             free(tmpdata)
19017  *             return 0
19018  */
19019       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19020 
19021       /* "View.MemoryView":1323
19022  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
19023  *             refcount_copying(&dst, dtype_is_object, ndim, True)
19024  *             free(tmpdata)             # <<<<<<<<<<<<<<
19025  *             return 0
19026  *
19027  */
19028       free(__pyx_v_tmpdata);
19029 
19030       /* "View.MemoryView":1324
19031  *             refcount_copying(&dst, dtype_is_object, ndim, True)
19032  *             free(tmpdata)
19033  *             return 0             # <<<<<<<<<<<<<<
19034  *
19035  *     if order == 'F' == get_best_order(&dst, ndim):
19036  */
19037       __pyx_r = 0;
19038       goto __pyx_L0;
19039 
19040       /* "View.MemoryView":1318
19041  *             direct_copy = slice_is_contig(dst, 'F', ndim)
19042  *
19043  *         if direct_copy:             # <<<<<<<<<<<<<<
19044  *
19045  *             refcount_copying(&dst, dtype_is_object, ndim, False)
19046  */
19047     }
19048 
19049     /* "View.MemoryView":1310
19050  *         src = tmp
19051  *
19052  *     if not broadcasting:             # <<<<<<<<<<<<<<
19053  *
19054  *
19055  */
19056   }
19057 
19058   /* "View.MemoryView":1326
19059  *             return 0
19060  *
19061  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
19062  *
19063  *
19064  */
19065   __pyx_t_2 = (__pyx_v_order == 'F');
19066   if (__pyx_t_2) {
19067     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
19068   }
19069   __pyx_t_8 = (__pyx_t_2 != 0);
19070   if (__pyx_t_8) {
19071 
19072     /* "View.MemoryView":1329
19073  *
19074  *
19075  *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
19076  *         transpose_memslice(&dst)
19077  *
19078  */
19079     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1329, __pyx_L1_error)
19080 
19081     /* "View.MemoryView":1330
19082  *
19083  *         transpose_memslice(&src)
19084  *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
19085  *
19086  *     refcount_copying(&dst, dtype_is_object, ndim, False)
19087  */
19088     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error)
19089 
19090     /* "View.MemoryView":1326
19091  *             return 0
19092  *
19093  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
19094  *
19095  *
19096  */
19097   }
19098 
19099   /* "View.MemoryView":1332
19100  *         transpose_memslice(&dst)
19101  *
19102  *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
19103  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
19104  *     refcount_copying(&dst, dtype_is_object, ndim, True)
19105  */
19106   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19107 
19108   /* "View.MemoryView":1333
19109  *
19110  *     refcount_copying(&dst, dtype_is_object, ndim, False)
19111  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
19112  *     refcount_copying(&dst, dtype_is_object, ndim, True)
19113  *
19114  */
19115   copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
19116 
19117   /* "View.MemoryView":1334
19118  *     refcount_copying(&dst, dtype_is_object, ndim, False)
19119  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
19120  *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
19121  *
19122  *     free(tmpdata)
19123  */
19124   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19125 
19126   /* "View.MemoryView":1336
19127  *     refcount_copying(&dst, dtype_is_object, ndim, True)
19128  *
19129  *     free(tmpdata)             # <<<<<<<<<<<<<<
19130  *     return 0
19131  *
19132  */
19133   free(__pyx_v_tmpdata);
19134 
19135   /* "View.MemoryView":1337
19136  *
19137  *     free(tmpdata)
19138  *     return 0             # <<<<<<<<<<<<<<
19139  *
19140  * @cname('__pyx_memoryview_broadcast_leading')
19141  */
19142   __pyx_r = 0;
19143   goto __pyx_L0;
19144 
19145   /* "View.MemoryView":1268
19146  *
19147  * @cname('__pyx_memoryview_copy_contents')
19148  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
19149  *                                   __Pyx_memviewslice dst,
19150  *                                   int src_ndim, int dst_ndim,
19151  */
19152 
19153   /* function exit code */
19154   __pyx_L1_error:;
19155   {
19156     #ifdef WITH_THREAD
19157     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19158     #endif
19159     __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
19160     #ifdef WITH_THREAD
19161     __Pyx_PyGILState_Release(__pyx_gilstate_save);
19162     #endif
19163   }
19164   __pyx_r = -1;
19165   __pyx_L0:;
19166   return __pyx_r;
19167 }
19168 
19169 /* "View.MemoryView":1340
19170  *
19171  * @cname('__pyx_memoryview_broadcast_leading')
19172  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
19173  *                             int ndim,
19174  *                             int ndim_other) nogil:
19175  */
19176 
__pyx_memoryview_broadcast_leading(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim,int __pyx_v_ndim_other)19177 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
19178   int __pyx_v_i;
19179   int __pyx_v_offset;
19180   int __pyx_t_1;
19181   int __pyx_t_2;
19182   int __pyx_t_3;
19183 
19184   /* "View.MemoryView":1344
19185  *                             int ndim_other) nogil:
19186  *     cdef int i
19187  *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
19188  *
19189  *     for i in range(ndim - 1, -1, -1):
19190  */
19191   __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
19192 
19193   /* "View.MemoryView":1346
19194  *     cdef int offset = ndim_other - ndim
19195  *
19196  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
19197  *         mslice.shape[i + offset] = mslice.shape[i]
19198  *         mslice.strides[i + offset] = mslice.strides[i]
19199  */
19200   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
19201     __pyx_v_i = __pyx_t_1;
19202 
19203     /* "View.MemoryView":1347
19204  *
19205  *     for i in range(ndim - 1, -1, -1):
19206  *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
19207  *         mslice.strides[i + offset] = mslice.strides[i]
19208  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
19209  */
19210     (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
19211 
19212     /* "View.MemoryView":1348
19213  *     for i in range(ndim - 1, -1, -1):
19214  *         mslice.shape[i + offset] = mslice.shape[i]
19215  *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
19216  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
19217  *
19218  */
19219     (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
19220 
19221     /* "View.MemoryView":1349
19222  *         mslice.shape[i + offset] = mslice.shape[i]
19223  *         mslice.strides[i + offset] = mslice.strides[i]
19224  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
19225  *
19226  *     for i in range(offset):
19227  */
19228     (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
19229   }
19230 
19231   /* "View.MemoryView":1351
19232  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
19233  *
19234  *     for i in range(offset):             # <<<<<<<<<<<<<<
19235  *         mslice.shape[i] = 1
19236  *         mslice.strides[i] = mslice.strides[0]
19237  */
19238   __pyx_t_1 = __pyx_v_offset;
19239   __pyx_t_2 = __pyx_t_1;
19240   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19241     __pyx_v_i = __pyx_t_3;
19242 
19243     /* "View.MemoryView":1352
19244  *
19245  *     for i in range(offset):
19246  *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
19247  *         mslice.strides[i] = mslice.strides[0]
19248  *         mslice.suboffsets[i] = -1
19249  */
19250     (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
19251 
19252     /* "View.MemoryView":1353
19253  *     for i in range(offset):
19254  *         mslice.shape[i] = 1
19255  *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
19256  *         mslice.suboffsets[i] = -1
19257  *
19258  */
19259     (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
19260 
19261     /* "View.MemoryView":1354
19262  *         mslice.shape[i] = 1
19263  *         mslice.strides[i] = mslice.strides[0]
19264  *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
19265  *
19266  *
19267  */
19268     (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
19269   }
19270 
19271   /* "View.MemoryView":1340
19272  *
19273  * @cname('__pyx_memoryview_broadcast_leading')
19274  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
19275  *                             int ndim,
19276  *                             int ndim_other) nogil:
19277  */
19278 
19279   /* function exit code */
19280 }
19281 
19282 /* "View.MemoryView":1362
19283  *
19284  * @cname('__pyx_memoryview_refcount_copying')
19285  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
19286  *                            int ndim, bint inc) nogil:
19287  *
19288  */
19289 
__pyx_memoryview_refcount_copying(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_dtype_is_object,int __pyx_v_ndim,int __pyx_v_inc)19290 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
19291   int __pyx_t_1;
19292 
19293   /* "View.MemoryView":1366
19294  *
19295  *
19296  *     if dtype_is_object:             # <<<<<<<<<<<<<<
19297  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
19298  *                                            dst.strides, ndim, inc)
19299  */
19300   __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
19301   if (__pyx_t_1) {
19302 
19303     /* "View.MemoryView":1367
19304  *
19305  *     if dtype_is_object:
19306  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
19307  *                                            dst.strides, ndim, inc)
19308  *
19309  */
19310     __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
19311 
19312     /* "View.MemoryView":1366
19313  *
19314  *
19315  *     if dtype_is_object:             # <<<<<<<<<<<<<<
19316  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
19317  *                                            dst.strides, ndim, inc)
19318  */
19319   }
19320 
19321   /* "View.MemoryView":1362
19322  *
19323  * @cname('__pyx_memoryview_refcount_copying')
19324  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
19325  *                            int ndim, bint inc) nogil:
19326  *
19327  */
19328 
19329   /* function exit code */
19330 }
19331 
19332 /* "View.MemoryView":1371
19333  *
19334  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
19335  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19336  *                                              Py_ssize_t *strides, int ndim,
19337  *                                              bint inc) with gil:
19338  */
19339 
__pyx_memoryview_refcount_objects_in_slice_with_gil(char * __pyx_v_data,Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,int __pyx_v_ndim,int __pyx_v_inc)19340 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
19341   __Pyx_RefNannyDeclarations
19342   #ifdef WITH_THREAD
19343   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19344   #endif
19345   __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
19346 
19347   /* "View.MemoryView":1374
19348  *                                              Py_ssize_t *strides, int ndim,
19349  *                                              bint inc) with gil:
19350  *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
19351  *
19352  * @cname('__pyx_memoryview_refcount_objects_in_slice')
19353  */
19354   __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
19355 
19356   /* "View.MemoryView":1371
19357  *
19358  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
19359  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19360  *                                              Py_ssize_t *strides, int ndim,
19361  *                                              bint inc) with gil:
19362  */
19363 
19364   /* function exit code */
19365   __Pyx_RefNannyFinishContext();
19366   #ifdef WITH_THREAD
19367   __Pyx_PyGILState_Release(__pyx_gilstate_save);
19368   #endif
19369 }
19370 
19371 /* "View.MemoryView":1377
19372  *
19373  * @cname('__pyx_memoryview_refcount_objects_in_slice')
19374  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19375  *                                     Py_ssize_t *strides, int ndim, bint inc):
19376  *     cdef Py_ssize_t i
19377  */
19378 
__pyx_memoryview_refcount_objects_in_slice(char * __pyx_v_data,Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,int __pyx_v_ndim,int __pyx_v_inc)19379 static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
19380   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19381   __Pyx_RefNannyDeclarations
19382   Py_ssize_t __pyx_t_1;
19383   Py_ssize_t __pyx_t_2;
19384   Py_ssize_t __pyx_t_3;
19385   int __pyx_t_4;
19386   __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
19387 
19388   /* "View.MemoryView":1381
19389  *     cdef Py_ssize_t i
19390  *
19391  *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
19392  *         if ndim == 1:
19393  *             if inc:
19394  */
19395   __pyx_t_1 = (__pyx_v_shape[0]);
19396   __pyx_t_2 = __pyx_t_1;
19397   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19398     __pyx_v_i = __pyx_t_3;
19399 
19400     /* "View.MemoryView":1382
19401  *
19402  *     for i in range(shape[0]):
19403  *         if ndim == 1:             # <<<<<<<<<<<<<<
19404  *             if inc:
19405  *                 Py_INCREF((<PyObject **> data)[0])
19406  */
19407     __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
19408     if (__pyx_t_4) {
19409 
19410       /* "View.MemoryView":1383
19411  *     for i in range(shape[0]):
19412  *         if ndim == 1:
19413  *             if inc:             # <<<<<<<<<<<<<<
19414  *                 Py_INCREF((<PyObject **> data)[0])
19415  *             else:
19416  */
19417       __pyx_t_4 = (__pyx_v_inc != 0);
19418       if (__pyx_t_4) {
19419 
19420         /* "View.MemoryView":1384
19421  *         if ndim == 1:
19422  *             if inc:
19423  *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
19424  *             else:
19425  *                 Py_DECREF((<PyObject **> data)[0])
19426  */
19427         Py_INCREF((((PyObject **)__pyx_v_data)[0]));
19428 
19429         /* "View.MemoryView":1383
19430  *     for i in range(shape[0]):
19431  *         if ndim == 1:
19432  *             if inc:             # <<<<<<<<<<<<<<
19433  *                 Py_INCREF((<PyObject **> data)[0])
19434  *             else:
19435  */
19436         goto __pyx_L6;
19437       }
19438 
19439       /* "View.MemoryView":1386
19440  *                 Py_INCREF((<PyObject **> data)[0])
19441  *             else:
19442  *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
19443  *         else:
19444  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
19445  */
19446       /*else*/ {
19447         Py_DECREF((((PyObject **)__pyx_v_data)[0]));
19448       }
19449       __pyx_L6:;
19450 
19451       /* "View.MemoryView":1382
19452  *
19453  *     for i in range(shape[0]):
19454  *         if ndim == 1:             # <<<<<<<<<<<<<<
19455  *             if inc:
19456  *                 Py_INCREF((<PyObject **> data)[0])
19457  */
19458       goto __pyx_L5;
19459     }
19460 
19461     /* "View.MemoryView":1388
19462  *                 Py_DECREF((<PyObject **> data)[0])
19463  *         else:
19464  *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
19465  *                                       ndim - 1, inc)
19466  *
19467  */
19468     /*else*/ {
19469 
19470       /* "View.MemoryView":1389
19471  *         else:
19472  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
19473  *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
19474  *
19475  *         data += strides[0]
19476  */
19477       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
19478     }
19479     __pyx_L5:;
19480 
19481     /* "View.MemoryView":1391
19482  *                                       ndim - 1, inc)
19483  *
19484  *         data += strides[0]             # <<<<<<<<<<<<<<
19485  *
19486  *
19487  */
19488     __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
19489   }
19490 
19491   /* "View.MemoryView":1377
19492  *
19493  * @cname('__pyx_memoryview_refcount_objects_in_slice')
19494  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19495  *                                     Py_ssize_t *strides, int ndim, bint inc):
19496  *     cdef Py_ssize_t i
19497  */
19498 
19499   /* function exit code */
19500   __Pyx_RefNannyFinishContext();
19501 }
19502 
19503 /* "View.MemoryView":1397
19504  *
19505  * @cname('__pyx_memoryview_slice_assign_scalar')
19506  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
19507  *                               size_t itemsize, void *item,
19508  *                               bint dtype_is_object) nogil:
19509  */
19510 
__pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize,void * __pyx_v_item,int __pyx_v_dtype_is_object)19511 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {
19512 
19513   /* "View.MemoryView":1400
19514  *                               size_t itemsize, void *item,
19515  *                               bint dtype_is_object) nogil:
19516  *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
19517  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
19518  *                          itemsize, item)
19519  */
19520   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19521 
19522   /* "View.MemoryView":1401
19523  *                               bint dtype_is_object) nogil:
19524  *     refcount_copying(dst, dtype_is_object, ndim, False)
19525  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
19526  *                          itemsize, item)
19527  *     refcount_copying(dst, dtype_is_object, ndim, True)
19528  */
19529   __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
19530 
19531   /* "View.MemoryView":1403
19532  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
19533  *                          itemsize, item)
19534  *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
19535  *
19536  *
19537  */
19538   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19539 
19540   /* "View.MemoryView":1397
19541  *
19542  * @cname('__pyx_memoryview_slice_assign_scalar')
19543  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
19544  *                               size_t itemsize, void *item,
19545  *                               bint dtype_is_object) nogil:
19546  */
19547 
19548   /* function exit code */
19549 }
19550 
19551 /* "View.MemoryView":1407
19552  *
19553  * @cname('__pyx_memoryview__slice_assign_scalar')
19554  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19555  *                               Py_ssize_t *strides, int ndim,
19556  *                               size_t itemsize, void *item) nogil:
19557  */
19558 
__pyx_memoryview__slice_assign_scalar(char * __pyx_v_data,Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,int __pyx_v_ndim,size_t __pyx_v_itemsize,void * __pyx_v_item)19559 static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
19560   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19561   Py_ssize_t __pyx_v_stride;
19562   Py_ssize_t __pyx_v_extent;
19563   int __pyx_t_1;
19564   Py_ssize_t __pyx_t_2;
19565   Py_ssize_t __pyx_t_3;
19566   Py_ssize_t __pyx_t_4;
19567 
19568   /* "View.MemoryView":1411
19569  *                               size_t itemsize, void *item) nogil:
19570  *     cdef Py_ssize_t i
19571  *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
19572  *     cdef Py_ssize_t extent = shape[0]
19573  *
19574  */
19575   __pyx_v_stride = (__pyx_v_strides[0]);
19576 
19577   /* "View.MemoryView":1412
19578  *     cdef Py_ssize_t i
19579  *     cdef Py_ssize_t stride = strides[0]
19580  *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
19581  *
19582  *     if ndim == 1:
19583  */
19584   __pyx_v_extent = (__pyx_v_shape[0]);
19585 
19586   /* "View.MemoryView":1414
19587  *     cdef Py_ssize_t extent = shape[0]
19588  *
19589  *     if ndim == 1:             # <<<<<<<<<<<<<<
19590  *         for i in range(extent):
19591  *             memcpy(data, item, itemsize)
19592  */
19593   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
19594   if (__pyx_t_1) {
19595 
19596     /* "View.MemoryView":1415
19597  *
19598  *     if ndim == 1:
19599  *         for i in range(extent):             # <<<<<<<<<<<<<<
19600  *             memcpy(data, item, itemsize)
19601  *             data += stride
19602  */
19603     __pyx_t_2 = __pyx_v_extent;
19604     __pyx_t_3 = __pyx_t_2;
19605     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19606       __pyx_v_i = __pyx_t_4;
19607 
19608       /* "View.MemoryView":1416
19609  *     if ndim == 1:
19610  *         for i in range(extent):
19611  *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
19612  *             data += stride
19613  *     else:
19614  */
19615       (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
19616 
19617       /* "View.MemoryView":1417
19618  *         for i in range(extent):
19619  *             memcpy(data, item, itemsize)
19620  *             data += stride             # <<<<<<<<<<<<<<
19621  *     else:
19622  *         for i in range(extent):
19623  */
19624       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19625     }
19626 
19627     /* "View.MemoryView":1414
19628  *     cdef Py_ssize_t extent = shape[0]
19629  *
19630  *     if ndim == 1:             # <<<<<<<<<<<<<<
19631  *         for i in range(extent):
19632  *             memcpy(data, item, itemsize)
19633  */
19634     goto __pyx_L3;
19635   }
19636 
19637   /* "View.MemoryView":1419
19638  *             data += stride
19639  *     else:
19640  *         for i in range(extent):             # <<<<<<<<<<<<<<
19641  *             _slice_assign_scalar(data, shape + 1, strides + 1,
19642  *                                 ndim - 1, itemsize, item)
19643  */
19644   /*else*/ {
19645     __pyx_t_2 = __pyx_v_extent;
19646     __pyx_t_3 = __pyx_t_2;
19647     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19648       __pyx_v_i = __pyx_t_4;
19649 
19650       /* "View.MemoryView":1420
19651  *     else:
19652  *         for i in range(extent):
19653  *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
19654  *                                 ndim - 1, itemsize, item)
19655  *             data += stride
19656  */
19657       __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
19658 
19659       /* "View.MemoryView":1422
19660  *             _slice_assign_scalar(data, shape + 1, strides + 1,
19661  *                                 ndim - 1, itemsize, item)
19662  *             data += stride             # <<<<<<<<<<<<<<
19663  *
19664  *
19665  */
19666       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19667     }
19668   }
19669   __pyx_L3:;
19670 
19671   /* "View.MemoryView":1407
19672  *
19673  * @cname('__pyx_memoryview__slice_assign_scalar')
19674  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19675  *                               Py_ssize_t *strides, int ndim,
19676  *                               size_t itemsize, void *item) nogil:
19677  */
19678 
19679   /* function exit code */
19680 }
19681 
19682 /* "(tree fragment)":1
19683  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
19684  *     cdef object __pyx_PickleError
19685  *     cdef object __pyx_result
19686  */
19687 
19688 /* Python wrapper */
19689 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19690 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)19691 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19692   PyObject *__pyx_v___pyx_type = 0;
19693   long __pyx_v___pyx_checksum;
19694   PyObject *__pyx_v___pyx_state = 0;
19695   int __pyx_lineno = 0;
19696   const char *__pyx_filename = NULL;
19697   int __pyx_clineno = 0;
19698   PyObject *__pyx_r = 0;
19699   __Pyx_RefNannyDeclarations
19700   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
19701   {
19702     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
19703     PyObject* values[3] = {0,0,0};
19704     if (unlikely(__pyx_kwds)) {
19705       Py_ssize_t kw_args;
19706       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19707       switch (pos_args) {
19708         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19709         CYTHON_FALLTHROUGH;
19710         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19711         CYTHON_FALLTHROUGH;
19712         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19713         CYTHON_FALLTHROUGH;
19714         case  0: break;
19715         default: goto __pyx_L5_argtuple_error;
19716       }
19717       kw_args = PyDict_Size(__pyx_kwds);
19718       switch (pos_args) {
19719         case  0:
19720         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
19721         else goto __pyx_L5_argtuple_error;
19722         CYTHON_FALLTHROUGH;
19723         case  1:
19724         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
19725         else {
19726           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
19727         }
19728         CYTHON_FALLTHROUGH;
19729         case  2:
19730         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
19731         else {
19732           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
19733         }
19734       }
19735       if (unlikely(kw_args > 0)) {
19736         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
19737       }
19738     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
19739       goto __pyx_L5_argtuple_error;
19740     } else {
19741       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19742       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19743       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19744     }
19745     __pyx_v___pyx_type = values[0];
19746     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
19747     __pyx_v___pyx_state = values[2];
19748   }
19749   goto __pyx_L4_argument_unpacking_done;
19750   __pyx_L5_argtuple_error:;
19751   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
19752   __pyx_L3_error:;
19753   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19754   __Pyx_RefNannyFinishContext();
19755   return NULL;
19756   __pyx_L4_argument_unpacking_done:;
19757   __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
19758 
19759   /* function exit code */
19760   __Pyx_RefNannyFinishContext();
19761   return __pyx_r;
19762 }
19763 
__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)19764 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
19765   PyObject *__pyx_v___pyx_PickleError = 0;
19766   PyObject *__pyx_v___pyx_result = 0;
19767   PyObject *__pyx_r = NULL;
19768   __Pyx_RefNannyDeclarations
19769   int __pyx_t_1;
19770   PyObject *__pyx_t_2 = NULL;
19771   PyObject *__pyx_t_3 = NULL;
19772   PyObject *__pyx_t_4 = NULL;
19773   PyObject *__pyx_t_5 = NULL;
19774   int __pyx_t_6;
19775   int __pyx_lineno = 0;
19776   const char *__pyx_filename = NULL;
19777   int __pyx_clineno = 0;
19778   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
19779 
19780   /* "(tree fragment)":4
19781  *     cdef object __pyx_PickleError
19782  *     cdef object __pyx_result
19783  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
19784  *         from pickle import PickleError as __pyx_PickleError
19785  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19786  */
19787   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
19788   if (__pyx_t_1) {
19789 
19790     /* "(tree fragment)":5
19791  *     cdef object __pyx_result
19792  *     if __pyx_checksum != 0xb068931:
19793  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
19794  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19795  *     __pyx_result = Enum.__new__(__pyx_type)
19796  */
19797     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
19798     __Pyx_GOTREF(__pyx_t_2);
19799     __Pyx_INCREF(__pyx_n_s_PickleError);
19800     __Pyx_GIVEREF(__pyx_n_s_PickleError);
19801     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
19802     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
19803     __Pyx_GOTREF(__pyx_t_3);
19804     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19805     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
19806     __Pyx_GOTREF(__pyx_t_2);
19807     __Pyx_INCREF(__pyx_t_2);
19808     __pyx_v___pyx_PickleError = __pyx_t_2;
19809     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19810     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19811 
19812     /* "(tree fragment)":6
19813  *     if __pyx_checksum != 0xb068931:
19814  *         from pickle import PickleError as __pyx_PickleError
19815  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
19816  *     __pyx_result = Enum.__new__(__pyx_type)
19817  *     if __pyx_state is not None:
19818  */
19819     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
19820     __Pyx_GOTREF(__pyx_t_2);
19821     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
19822     __Pyx_GOTREF(__pyx_t_4);
19823     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19824     __Pyx_INCREF(__pyx_v___pyx_PickleError);
19825     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
19826     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
19827       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
19828       if (likely(__pyx_t_5)) {
19829         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
19830         __Pyx_INCREF(__pyx_t_5);
19831         __Pyx_INCREF(function);
19832         __Pyx_DECREF_SET(__pyx_t_2, function);
19833       }
19834     }
19835     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
19836     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19837     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19838     if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
19839     __Pyx_GOTREF(__pyx_t_3);
19840     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19841     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
19842     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19843     __PYX_ERR(2, 6, __pyx_L1_error)
19844 
19845     /* "(tree fragment)":4
19846  *     cdef object __pyx_PickleError
19847  *     cdef object __pyx_result
19848  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
19849  *         from pickle import PickleError as __pyx_PickleError
19850  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19851  */
19852   }
19853 
19854   /* "(tree fragment)":7
19855  *         from pickle import PickleError as __pyx_PickleError
19856  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19857  *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
19858  *     if __pyx_state is not None:
19859  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19860  */
19861   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error)
19862   __Pyx_GOTREF(__pyx_t_2);
19863   __pyx_t_4 = NULL;
19864   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
19865     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
19866     if (likely(__pyx_t_4)) {
19867       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
19868       __Pyx_INCREF(__pyx_t_4);
19869       __Pyx_INCREF(function);
19870       __Pyx_DECREF_SET(__pyx_t_2, function);
19871     }
19872   }
19873   __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
19874   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
19875   if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
19876   __Pyx_GOTREF(__pyx_t_3);
19877   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19878   __pyx_v___pyx_result = __pyx_t_3;
19879   __pyx_t_3 = 0;
19880 
19881   /* "(tree fragment)":8
19882  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19883  *     __pyx_result = Enum.__new__(__pyx_type)
19884  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
19885  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19886  *     return __pyx_result
19887  */
19888   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
19889   __pyx_t_6 = (__pyx_t_1 != 0);
19890   if (__pyx_t_6) {
19891 
19892     /* "(tree fragment)":9
19893  *     __pyx_result = Enum.__new__(__pyx_type)
19894  *     if __pyx_state is not None:
19895  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
19896  *     return __pyx_result
19897  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19898  */
19899     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error)
19900     __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 9, __pyx_L1_error)
19901     __Pyx_GOTREF(__pyx_t_3);
19902     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19903 
19904     /* "(tree fragment)":8
19905  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19906  *     __pyx_result = Enum.__new__(__pyx_type)
19907  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
19908  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19909  *     return __pyx_result
19910  */
19911   }
19912 
19913   /* "(tree fragment)":10
19914  *     if __pyx_state is not None:
19915  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19916  *     return __pyx_result             # <<<<<<<<<<<<<<
19917  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19918  *     __pyx_result.name = __pyx_state[0]
19919  */
19920   __Pyx_XDECREF(__pyx_r);
19921   __Pyx_INCREF(__pyx_v___pyx_result);
19922   __pyx_r = __pyx_v___pyx_result;
19923   goto __pyx_L0;
19924 
19925   /* "(tree fragment)":1
19926  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
19927  *     cdef object __pyx_PickleError
19928  *     cdef object __pyx_result
19929  */
19930 
19931   /* function exit code */
19932   __pyx_L1_error:;
19933   __Pyx_XDECREF(__pyx_t_2);
19934   __Pyx_XDECREF(__pyx_t_3);
19935   __Pyx_XDECREF(__pyx_t_4);
19936   __Pyx_XDECREF(__pyx_t_5);
19937   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19938   __pyx_r = NULL;
19939   __pyx_L0:;
19940   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
19941   __Pyx_XDECREF(__pyx_v___pyx_result);
19942   __Pyx_XGIVEREF(__pyx_r);
19943   __Pyx_RefNannyFinishContext();
19944   return __pyx_r;
19945 }
19946 
19947 /* "(tree fragment)":11
19948  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19949  *     return __pyx_result
19950  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
19951  *     __pyx_result.name = __pyx_state[0]
19952  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
19953  */
19954 
__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)19955 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
19956   PyObject *__pyx_r = NULL;
19957   __Pyx_RefNannyDeclarations
19958   PyObject *__pyx_t_1 = NULL;
19959   int __pyx_t_2;
19960   Py_ssize_t __pyx_t_3;
19961   int __pyx_t_4;
19962   int __pyx_t_5;
19963   PyObject *__pyx_t_6 = NULL;
19964   PyObject *__pyx_t_7 = NULL;
19965   PyObject *__pyx_t_8 = NULL;
19966   int __pyx_lineno = 0;
19967   const char *__pyx_filename = NULL;
19968   int __pyx_clineno = 0;
19969   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
19970 
19971   /* "(tree fragment)":12
19972  *     return __pyx_result
19973  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19974  *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
19975  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
19976  *         __pyx_result.__dict__.update(__pyx_state[1])
19977  */
19978   if (unlikely(__pyx_v___pyx_state == Py_None)) {
19979     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
19980     __PYX_ERR(2, 12, __pyx_L1_error)
19981   }
19982   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
19983   __Pyx_GOTREF(__pyx_t_1);
19984   __Pyx_GIVEREF(__pyx_t_1);
19985   __Pyx_GOTREF(__pyx_v___pyx_result->name);
19986   __Pyx_DECREF(__pyx_v___pyx_result->name);
19987   __pyx_v___pyx_result->name = __pyx_t_1;
19988   __pyx_t_1 = 0;
19989 
19990   /* "(tree fragment)":13
19991  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19992  *     __pyx_result.name = __pyx_state[0]
19993  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
19994  *         __pyx_result.__dict__.update(__pyx_state[1])
19995  */
19996   if (unlikely(__pyx_v___pyx_state == Py_None)) {
19997     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
19998     __PYX_ERR(2, 13, __pyx_L1_error)
19999   }
20000   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
20001   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
20002   if (__pyx_t_4) {
20003   } else {
20004     __pyx_t_2 = __pyx_t_4;
20005     goto __pyx_L4_bool_binop_done;
20006   }
20007   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
20008   __pyx_t_5 = (__pyx_t_4 != 0);
20009   __pyx_t_2 = __pyx_t_5;
20010   __pyx_L4_bool_binop_done:;
20011   if (__pyx_t_2) {
20012 
20013     /* "(tree fragment)":14
20014  *     __pyx_result.name = __pyx_state[0]
20015  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
20016  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
20017  */
20018     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
20019     __Pyx_GOTREF(__pyx_t_6);
20020     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error)
20021     __Pyx_GOTREF(__pyx_t_7);
20022     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20023     if (unlikely(__pyx_v___pyx_state == Py_None)) {
20024       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
20025       __PYX_ERR(2, 14, __pyx_L1_error)
20026     }
20027     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
20028     __Pyx_GOTREF(__pyx_t_6);
20029     __pyx_t_8 = NULL;
20030     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
20031       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
20032       if (likely(__pyx_t_8)) {
20033         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
20034         __Pyx_INCREF(__pyx_t_8);
20035         __Pyx_INCREF(function);
20036         __Pyx_DECREF_SET(__pyx_t_7, function);
20037       }
20038     }
20039     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
20040     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20041     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20042     if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
20043     __Pyx_GOTREF(__pyx_t_1);
20044     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20045     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20046 
20047     /* "(tree fragment)":13
20048  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
20049  *     __pyx_result.name = __pyx_state[0]
20050  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
20051  *         __pyx_result.__dict__.update(__pyx_state[1])
20052  */
20053   }
20054 
20055   /* "(tree fragment)":11
20056  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
20057  *     return __pyx_result
20058  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
20059  *     __pyx_result.name = __pyx_state[0]
20060  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
20061  */
20062 
20063   /* function exit code */
20064   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20065   goto __pyx_L0;
20066   __pyx_L1_error:;
20067   __Pyx_XDECREF(__pyx_t_1);
20068   __Pyx_XDECREF(__pyx_t_6);
20069   __Pyx_XDECREF(__pyx_t_7);
20070   __Pyx_XDECREF(__pyx_t_8);
20071   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
20072   __pyx_r = 0;
20073   __pyx_L0:;
20074   __Pyx_XGIVEREF(__pyx_r);
20075   __Pyx_RefNannyFinishContext();
20076   return __pyx_r;
20077 }
20078 static struct __pyx_vtabstruct_array __pyx_vtable_array;
20079 
__pyx_tp_new_array(PyTypeObject * t,PyObject * a,PyObject * k)20080 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
20081   struct __pyx_array_obj *p;
20082   PyObject *o;
20083   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20084     o = (*t->tp_alloc)(t, 0);
20085   } else {
20086     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20087   }
20088   if (unlikely(!o)) return 0;
20089   p = ((struct __pyx_array_obj *)o);
20090   p->__pyx_vtab = __pyx_vtabptr_array;
20091   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
20092   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
20093   if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
20094   return o;
20095   bad:
20096   Py_DECREF(o); o = 0;
20097   return NULL;
20098 }
20099 
__pyx_tp_dealloc_array(PyObject * o)20100 static void __pyx_tp_dealloc_array(PyObject *o) {
20101   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
20102   #if CYTHON_USE_TP_FINALIZE
20103   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
20104     if (PyObject_CallFinalizerFromDealloc(o)) return;
20105   }
20106   #endif
20107   {
20108     PyObject *etype, *eval, *etb;
20109     PyErr_Fetch(&etype, &eval, &etb);
20110     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20111     __pyx_array___dealloc__(o);
20112     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20113     PyErr_Restore(etype, eval, etb);
20114   }
20115   Py_CLEAR(p->mode);
20116   Py_CLEAR(p->_format);
20117   (*Py_TYPE(o)->tp_free)(o);
20118 }
__pyx_sq_item_array(PyObject * o,Py_ssize_t i)20119 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
20120   PyObject *r;
20121   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
20122   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20123   Py_DECREF(x);
20124   return r;
20125 }
20126 
__pyx_mp_ass_subscript_array(PyObject * o,PyObject * i,PyObject * v)20127 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
20128   if (v) {
20129     return __pyx_array___setitem__(o, i, v);
20130   }
20131   else {
20132     PyErr_Format(PyExc_NotImplementedError,
20133       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20134     return -1;
20135   }
20136 }
20137 
__pyx_tp_getattro_array(PyObject * o,PyObject * n)20138 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
20139   PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
20140   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
20141     PyErr_Clear();
20142     v = __pyx_array___getattr__(o, n);
20143   }
20144   return v;
20145 }
20146 
__pyx_getprop___pyx_array_memview(PyObject * o,CYTHON_UNUSED void * x)20147 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
20148   return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
20149 }
20150 
20151 static PyMethodDef __pyx_methods_array[] = {
20152   {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
20153   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
20154   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
20155   {0, 0, 0, 0}
20156 };
20157 
20158 static struct PyGetSetDef __pyx_getsets_array[] = {
20159   {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
20160   {0, 0, 0, 0, 0}
20161 };
20162 
20163 static PySequenceMethods __pyx_tp_as_sequence_array = {
20164   __pyx_array___len__, /*sq_length*/
20165   0, /*sq_concat*/
20166   0, /*sq_repeat*/
20167   __pyx_sq_item_array, /*sq_item*/
20168   0, /*sq_slice*/
20169   0, /*sq_ass_item*/
20170   0, /*sq_ass_slice*/
20171   0, /*sq_contains*/
20172   0, /*sq_inplace_concat*/
20173   0, /*sq_inplace_repeat*/
20174 };
20175 
20176 static PyMappingMethods __pyx_tp_as_mapping_array = {
20177   __pyx_array___len__, /*mp_length*/
20178   __pyx_array___getitem__, /*mp_subscript*/
20179   __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
20180 };
20181 
20182 static PyBufferProcs __pyx_tp_as_buffer_array = {
20183   #if PY_MAJOR_VERSION < 3
20184   0, /*bf_getreadbuffer*/
20185   #endif
20186   #if PY_MAJOR_VERSION < 3
20187   0, /*bf_getwritebuffer*/
20188   #endif
20189   #if PY_MAJOR_VERSION < 3
20190   0, /*bf_getsegcount*/
20191   #endif
20192   #if PY_MAJOR_VERSION < 3
20193   0, /*bf_getcharbuffer*/
20194   #endif
20195   __pyx_array_getbuffer, /*bf_getbuffer*/
20196   0, /*bf_releasebuffer*/
20197 };
20198 
20199 static PyTypeObject __pyx_type___pyx_array = {
20200   PyVarObject_HEAD_INIT(0, 0)
20201   "statsmodels.nonparametric._smoothers_lowess.array", /*tp_name*/
20202   sizeof(struct __pyx_array_obj), /*tp_basicsize*/
20203   0, /*tp_itemsize*/
20204   __pyx_tp_dealloc_array, /*tp_dealloc*/
20205   #if PY_VERSION_HEX < 0x030800b4
20206   0, /*tp_print*/
20207   #endif
20208   #if PY_VERSION_HEX >= 0x030800b4
20209   0, /*tp_vectorcall_offset*/
20210   #endif
20211   0, /*tp_getattr*/
20212   0, /*tp_setattr*/
20213   #if PY_MAJOR_VERSION < 3
20214   0, /*tp_compare*/
20215   #endif
20216   #if PY_MAJOR_VERSION >= 3
20217   0, /*tp_as_async*/
20218   #endif
20219   0, /*tp_repr*/
20220   0, /*tp_as_number*/
20221   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
20222   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
20223   0, /*tp_hash*/
20224   0, /*tp_call*/
20225   0, /*tp_str*/
20226   __pyx_tp_getattro_array, /*tp_getattro*/
20227   0, /*tp_setattro*/
20228   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
20229   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
20230   0, /*tp_doc*/
20231   0, /*tp_traverse*/
20232   0, /*tp_clear*/
20233   0, /*tp_richcompare*/
20234   0, /*tp_weaklistoffset*/
20235   0, /*tp_iter*/
20236   0, /*tp_iternext*/
20237   __pyx_methods_array, /*tp_methods*/
20238   0, /*tp_members*/
20239   __pyx_getsets_array, /*tp_getset*/
20240   0, /*tp_base*/
20241   0, /*tp_dict*/
20242   0, /*tp_descr_get*/
20243   0, /*tp_descr_set*/
20244   0, /*tp_dictoffset*/
20245   0, /*tp_init*/
20246   0, /*tp_alloc*/
20247   __pyx_tp_new_array, /*tp_new*/
20248   0, /*tp_free*/
20249   0, /*tp_is_gc*/
20250   0, /*tp_bases*/
20251   0, /*tp_mro*/
20252   0, /*tp_cache*/
20253   0, /*tp_subclasses*/
20254   0, /*tp_weaklist*/
20255   0, /*tp_del*/
20256   0, /*tp_version_tag*/
20257   #if PY_VERSION_HEX >= 0x030400a1
20258   0, /*tp_finalize*/
20259   #endif
20260   #if PY_VERSION_HEX >= 0x030800b1
20261   0, /*tp_vectorcall*/
20262   #endif
20263   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20264   0, /*tp_print*/
20265   #endif
20266 };
20267 
__pyx_tp_new_Enum(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)20268 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
20269   struct __pyx_MemviewEnum_obj *p;
20270   PyObject *o;
20271   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20272     o = (*t->tp_alloc)(t, 0);
20273   } else {
20274     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20275   }
20276   if (unlikely(!o)) return 0;
20277   p = ((struct __pyx_MemviewEnum_obj *)o);
20278   p->name = Py_None; Py_INCREF(Py_None);
20279   return o;
20280 }
20281 
__pyx_tp_dealloc_Enum(PyObject * o)20282 static void __pyx_tp_dealloc_Enum(PyObject *o) {
20283   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
20284   #if CYTHON_USE_TP_FINALIZE
20285   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20286     if (PyObject_CallFinalizerFromDealloc(o)) return;
20287   }
20288   #endif
20289   PyObject_GC_UnTrack(o);
20290   Py_CLEAR(p->name);
20291   (*Py_TYPE(o)->tp_free)(o);
20292 }
20293 
__pyx_tp_traverse_Enum(PyObject * o,visitproc v,void * a)20294 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
20295   int e;
20296   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
20297   if (p->name) {
20298     e = (*v)(p->name, a); if (e) return e;
20299   }
20300   return 0;
20301 }
20302 
__pyx_tp_clear_Enum(PyObject * o)20303 static int __pyx_tp_clear_Enum(PyObject *o) {
20304   PyObject* tmp;
20305   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
20306   tmp = ((PyObject*)p->name);
20307   p->name = Py_None; Py_INCREF(Py_None);
20308   Py_XDECREF(tmp);
20309   return 0;
20310 }
20311 
20312 static PyMethodDef __pyx_methods_Enum[] = {
20313   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
20314   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
20315   {0, 0, 0, 0}
20316 };
20317 
20318 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
20319   PyVarObject_HEAD_INIT(0, 0)
20320   "statsmodels.nonparametric._smoothers_lowess.Enum", /*tp_name*/
20321   sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
20322   0, /*tp_itemsize*/
20323   __pyx_tp_dealloc_Enum, /*tp_dealloc*/
20324   #if PY_VERSION_HEX < 0x030800b4
20325   0, /*tp_print*/
20326   #endif
20327   #if PY_VERSION_HEX >= 0x030800b4
20328   0, /*tp_vectorcall_offset*/
20329   #endif
20330   0, /*tp_getattr*/
20331   0, /*tp_setattr*/
20332   #if PY_MAJOR_VERSION < 3
20333   0, /*tp_compare*/
20334   #endif
20335   #if PY_MAJOR_VERSION >= 3
20336   0, /*tp_as_async*/
20337   #endif
20338   __pyx_MemviewEnum___repr__, /*tp_repr*/
20339   0, /*tp_as_number*/
20340   0, /*tp_as_sequence*/
20341   0, /*tp_as_mapping*/
20342   0, /*tp_hash*/
20343   0, /*tp_call*/
20344   0, /*tp_str*/
20345   0, /*tp_getattro*/
20346   0, /*tp_setattro*/
20347   0, /*tp_as_buffer*/
20348   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20349   0, /*tp_doc*/
20350   __pyx_tp_traverse_Enum, /*tp_traverse*/
20351   __pyx_tp_clear_Enum, /*tp_clear*/
20352   0, /*tp_richcompare*/
20353   0, /*tp_weaklistoffset*/
20354   0, /*tp_iter*/
20355   0, /*tp_iternext*/
20356   __pyx_methods_Enum, /*tp_methods*/
20357   0, /*tp_members*/
20358   0, /*tp_getset*/
20359   0, /*tp_base*/
20360   0, /*tp_dict*/
20361   0, /*tp_descr_get*/
20362   0, /*tp_descr_set*/
20363   0, /*tp_dictoffset*/
20364   __pyx_MemviewEnum___init__, /*tp_init*/
20365   0, /*tp_alloc*/
20366   __pyx_tp_new_Enum, /*tp_new*/
20367   0, /*tp_free*/
20368   0, /*tp_is_gc*/
20369   0, /*tp_bases*/
20370   0, /*tp_mro*/
20371   0, /*tp_cache*/
20372   0, /*tp_subclasses*/
20373   0, /*tp_weaklist*/
20374   0, /*tp_del*/
20375   0, /*tp_version_tag*/
20376   #if PY_VERSION_HEX >= 0x030400a1
20377   0, /*tp_finalize*/
20378   #endif
20379   #if PY_VERSION_HEX >= 0x030800b1
20380   0, /*tp_vectorcall*/
20381   #endif
20382   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20383   0, /*tp_print*/
20384   #endif
20385 };
20386 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
20387 
__pyx_tp_new_memoryview(PyTypeObject * t,PyObject * a,PyObject * k)20388 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
20389   struct __pyx_memoryview_obj *p;
20390   PyObject *o;
20391   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20392     o = (*t->tp_alloc)(t, 0);
20393   } else {
20394     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20395   }
20396   if (unlikely(!o)) return 0;
20397   p = ((struct __pyx_memoryview_obj *)o);
20398   p->__pyx_vtab = __pyx_vtabptr_memoryview;
20399   p->obj = Py_None; Py_INCREF(Py_None);
20400   p->_size = Py_None; Py_INCREF(Py_None);
20401   p->_array_interface = Py_None; Py_INCREF(Py_None);
20402   p->view.obj = NULL;
20403   if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
20404   return o;
20405   bad:
20406   Py_DECREF(o); o = 0;
20407   return NULL;
20408 }
20409 
__pyx_tp_dealloc_memoryview(PyObject * o)20410 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
20411   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
20412   #if CYTHON_USE_TP_FINALIZE
20413   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20414     if (PyObject_CallFinalizerFromDealloc(o)) return;
20415   }
20416   #endif
20417   PyObject_GC_UnTrack(o);
20418   {
20419     PyObject *etype, *eval, *etb;
20420     PyErr_Fetch(&etype, &eval, &etb);
20421     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20422     __pyx_memoryview___dealloc__(o);
20423     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20424     PyErr_Restore(etype, eval, etb);
20425   }
20426   Py_CLEAR(p->obj);
20427   Py_CLEAR(p->_size);
20428   Py_CLEAR(p->_array_interface);
20429   (*Py_TYPE(o)->tp_free)(o);
20430 }
20431 
__pyx_tp_traverse_memoryview(PyObject * o,visitproc v,void * a)20432 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
20433   int e;
20434   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
20435   if (p->obj) {
20436     e = (*v)(p->obj, a); if (e) return e;
20437   }
20438   if (p->_size) {
20439     e = (*v)(p->_size, a); if (e) return e;
20440   }
20441   if (p->_array_interface) {
20442     e = (*v)(p->_array_interface, a); if (e) return e;
20443   }
20444   if (p->view.obj) {
20445     e = (*v)(p->view.obj, a); if (e) return e;
20446   }
20447   return 0;
20448 }
20449 
__pyx_tp_clear_memoryview(PyObject * o)20450 static int __pyx_tp_clear_memoryview(PyObject *o) {
20451   PyObject* tmp;
20452   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
20453   tmp = ((PyObject*)p->obj);
20454   p->obj = Py_None; Py_INCREF(Py_None);
20455   Py_XDECREF(tmp);
20456   tmp = ((PyObject*)p->_size);
20457   p->_size = Py_None; Py_INCREF(Py_None);
20458   Py_XDECREF(tmp);
20459   tmp = ((PyObject*)p->_array_interface);
20460   p->_array_interface = Py_None; Py_INCREF(Py_None);
20461   Py_XDECREF(tmp);
20462   Py_CLEAR(p->view.obj);
20463   return 0;
20464 }
__pyx_sq_item_memoryview(PyObject * o,Py_ssize_t i)20465 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
20466   PyObject *r;
20467   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
20468   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20469   Py_DECREF(x);
20470   return r;
20471 }
20472 
__pyx_mp_ass_subscript_memoryview(PyObject * o,PyObject * i,PyObject * v)20473 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
20474   if (v) {
20475     return __pyx_memoryview___setitem__(o, i, v);
20476   }
20477   else {
20478     PyErr_Format(PyExc_NotImplementedError,
20479       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20480     return -1;
20481   }
20482 }
20483 
__pyx_getprop___pyx_memoryview_T(PyObject * o,CYTHON_UNUSED void * x)20484 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
20485   return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
20486 }
20487 
__pyx_getprop___pyx_memoryview_base(PyObject * o,CYTHON_UNUSED void * x)20488 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
20489   return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
20490 }
20491 
__pyx_getprop___pyx_memoryview_shape(PyObject * o,CYTHON_UNUSED void * x)20492 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
20493   return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
20494 }
20495 
__pyx_getprop___pyx_memoryview_strides(PyObject * o,CYTHON_UNUSED void * x)20496 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
20497   return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
20498 }
20499 
__pyx_getprop___pyx_memoryview_suboffsets(PyObject * o,CYTHON_UNUSED void * x)20500 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
20501   return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
20502 }
20503 
__pyx_getprop___pyx_memoryview_ndim(PyObject * o,CYTHON_UNUSED void * x)20504 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
20505   return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
20506 }
20507 
__pyx_getprop___pyx_memoryview_itemsize(PyObject * o,CYTHON_UNUSED void * x)20508 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
20509   return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
20510 }
20511 
__pyx_getprop___pyx_memoryview_nbytes(PyObject * o,CYTHON_UNUSED void * x)20512 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
20513   return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
20514 }
20515 
__pyx_getprop___pyx_memoryview_size(PyObject * o,CYTHON_UNUSED void * x)20516 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
20517   return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
20518 }
20519 
20520 static PyMethodDef __pyx_methods_memoryview[] = {
20521   {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
20522   {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
20523   {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
20524   {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
20525   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
20526   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
20527   {0, 0, 0, 0}
20528 };
20529 
20530 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
20531   {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
20532   {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
20533   {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
20534   {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
20535   {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
20536   {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
20537   {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
20538   {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
20539   {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
20540   {0, 0, 0, 0, 0}
20541 };
20542 
20543 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
20544   __pyx_memoryview___len__, /*sq_length*/
20545   0, /*sq_concat*/
20546   0, /*sq_repeat*/
20547   __pyx_sq_item_memoryview, /*sq_item*/
20548   0, /*sq_slice*/
20549   0, /*sq_ass_item*/
20550   0, /*sq_ass_slice*/
20551   0, /*sq_contains*/
20552   0, /*sq_inplace_concat*/
20553   0, /*sq_inplace_repeat*/
20554 };
20555 
20556 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
20557   __pyx_memoryview___len__, /*mp_length*/
20558   __pyx_memoryview___getitem__, /*mp_subscript*/
20559   __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
20560 };
20561 
20562 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
20563   #if PY_MAJOR_VERSION < 3
20564   0, /*bf_getreadbuffer*/
20565   #endif
20566   #if PY_MAJOR_VERSION < 3
20567   0, /*bf_getwritebuffer*/
20568   #endif
20569   #if PY_MAJOR_VERSION < 3
20570   0, /*bf_getsegcount*/
20571   #endif
20572   #if PY_MAJOR_VERSION < 3
20573   0, /*bf_getcharbuffer*/
20574   #endif
20575   __pyx_memoryview_getbuffer, /*bf_getbuffer*/
20576   0, /*bf_releasebuffer*/
20577 };
20578 
20579 static PyTypeObject __pyx_type___pyx_memoryview = {
20580   PyVarObject_HEAD_INIT(0, 0)
20581   "statsmodels.nonparametric._smoothers_lowess.memoryview", /*tp_name*/
20582   sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
20583   0, /*tp_itemsize*/
20584   __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
20585   #if PY_VERSION_HEX < 0x030800b4
20586   0, /*tp_print*/
20587   #endif
20588   #if PY_VERSION_HEX >= 0x030800b4
20589   0, /*tp_vectorcall_offset*/
20590   #endif
20591   0, /*tp_getattr*/
20592   0, /*tp_setattr*/
20593   #if PY_MAJOR_VERSION < 3
20594   0, /*tp_compare*/
20595   #endif
20596   #if PY_MAJOR_VERSION >= 3
20597   0, /*tp_as_async*/
20598   #endif
20599   __pyx_memoryview___repr__, /*tp_repr*/
20600   0, /*tp_as_number*/
20601   &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
20602   &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
20603   0, /*tp_hash*/
20604   0, /*tp_call*/
20605   __pyx_memoryview___str__, /*tp_str*/
20606   0, /*tp_getattro*/
20607   0, /*tp_setattro*/
20608   &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
20609   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20610   0, /*tp_doc*/
20611   __pyx_tp_traverse_memoryview, /*tp_traverse*/
20612   __pyx_tp_clear_memoryview, /*tp_clear*/
20613   0, /*tp_richcompare*/
20614   0, /*tp_weaklistoffset*/
20615   0, /*tp_iter*/
20616   0, /*tp_iternext*/
20617   __pyx_methods_memoryview, /*tp_methods*/
20618   0, /*tp_members*/
20619   __pyx_getsets_memoryview, /*tp_getset*/
20620   0, /*tp_base*/
20621   0, /*tp_dict*/
20622   0, /*tp_descr_get*/
20623   0, /*tp_descr_set*/
20624   0, /*tp_dictoffset*/
20625   0, /*tp_init*/
20626   0, /*tp_alloc*/
20627   __pyx_tp_new_memoryview, /*tp_new*/
20628   0, /*tp_free*/
20629   0, /*tp_is_gc*/
20630   0, /*tp_bases*/
20631   0, /*tp_mro*/
20632   0, /*tp_cache*/
20633   0, /*tp_subclasses*/
20634   0, /*tp_weaklist*/
20635   0, /*tp_del*/
20636   0, /*tp_version_tag*/
20637   #if PY_VERSION_HEX >= 0x030400a1
20638   0, /*tp_finalize*/
20639   #endif
20640   #if PY_VERSION_HEX >= 0x030800b1
20641   0, /*tp_vectorcall*/
20642   #endif
20643   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20644   0, /*tp_print*/
20645   #endif
20646 };
20647 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
20648 
__pyx_tp_new__memoryviewslice(PyTypeObject * t,PyObject * a,PyObject * k)20649 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
20650   struct __pyx_memoryviewslice_obj *p;
20651   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
20652   if (unlikely(!o)) return 0;
20653   p = ((struct __pyx_memoryviewslice_obj *)o);
20654   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
20655   p->from_object = Py_None; Py_INCREF(Py_None);
20656   p->from_slice.memview = NULL;
20657   return o;
20658 }
20659 
__pyx_tp_dealloc__memoryviewslice(PyObject * o)20660 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
20661   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
20662   #if CYTHON_USE_TP_FINALIZE
20663   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20664     if (PyObject_CallFinalizerFromDealloc(o)) return;
20665   }
20666   #endif
20667   PyObject_GC_UnTrack(o);
20668   {
20669     PyObject *etype, *eval, *etb;
20670     PyErr_Fetch(&etype, &eval, &etb);
20671     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20672     __pyx_memoryviewslice___dealloc__(o);
20673     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20674     PyErr_Restore(etype, eval, etb);
20675   }
20676   Py_CLEAR(p->from_object);
20677   PyObject_GC_Track(o);
20678   __pyx_tp_dealloc_memoryview(o);
20679 }
20680 
__pyx_tp_traverse__memoryviewslice(PyObject * o,visitproc v,void * a)20681 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
20682   int e;
20683   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
20684   e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
20685   if (p->from_object) {
20686     e = (*v)(p->from_object, a); if (e) return e;
20687   }
20688   return 0;
20689 }
20690 
__pyx_tp_clear__memoryviewslice(PyObject * o)20691 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
20692   PyObject* tmp;
20693   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
20694   __pyx_tp_clear_memoryview(o);
20695   tmp = ((PyObject*)p->from_object);
20696   p->from_object = Py_None; Py_INCREF(Py_None);
20697   Py_XDECREF(tmp);
20698   __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
20699   return 0;
20700 }
20701 
__pyx_getprop___pyx_memoryviewslice_base(PyObject * o,CYTHON_UNUSED void * x)20702 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
20703   return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
20704 }
20705 
20706 static PyMethodDef __pyx_methods__memoryviewslice[] = {
20707   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
20708   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
20709   {0, 0, 0, 0}
20710 };
20711 
20712 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
20713   {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
20714   {0, 0, 0, 0, 0}
20715 };
20716 
20717 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
20718   PyVarObject_HEAD_INIT(0, 0)
20719   "statsmodels.nonparametric._smoothers_lowess._memoryviewslice", /*tp_name*/
20720   sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
20721   0, /*tp_itemsize*/
20722   __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
20723   #if PY_VERSION_HEX < 0x030800b4
20724   0, /*tp_print*/
20725   #endif
20726   #if PY_VERSION_HEX >= 0x030800b4
20727   0, /*tp_vectorcall_offset*/
20728   #endif
20729   0, /*tp_getattr*/
20730   0, /*tp_setattr*/
20731   #if PY_MAJOR_VERSION < 3
20732   0, /*tp_compare*/
20733   #endif
20734   #if PY_MAJOR_VERSION >= 3
20735   0, /*tp_as_async*/
20736   #endif
20737   #if CYTHON_COMPILING_IN_PYPY
20738   __pyx_memoryview___repr__, /*tp_repr*/
20739   #else
20740   0, /*tp_repr*/
20741   #endif
20742   0, /*tp_as_number*/
20743   0, /*tp_as_sequence*/
20744   0, /*tp_as_mapping*/
20745   0, /*tp_hash*/
20746   0, /*tp_call*/
20747   #if CYTHON_COMPILING_IN_PYPY
20748   __pyx_memoryview___str__, /*tp_str*/
20749   #else
20750   0, /*tp_str*/
20751   #endif
20752   0, /*tp_getattro*/
20753   0, /*tp_setattro*/
20754   0, /*tp_as_buffer*/
20755   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20756   "Internal class for passing memoryview slices to Python", /*tp_doc*/
20757   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
20758   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
20759   0, /*tp_richcompare*/
20760   0, /*tp_weaklistoffset*/
20761   0, /*tp_iter*/
20762   0, /*tp_iternext*/
20763   __pyx_methods__memoryviewslice, /*tp_methods*/
20764   0, /*tp_members*/
20765   __pyx_getsets__memoryviewslice, /*tp_getset*/
20766   0, /*tp_base*/
20767   0, /*tp_dict*/
20768   0, /*tp_descr_get*/
20769   0, /*tp_descr_set*/
20770   0, /*tp_dictoffset*/
20771   0, /*tp_init*/
20772   0, /*tp_alloc*/
20773   __pyx_tp_new__memoryviewslice, /*tp_new*/
20774   0, /*tp_free*/
20775   0, /*tp_is_gc*/
20776   0, /*tp_bases*/
20777   0, /*tp_mro*/
20778   0, /*tp_cache*/
20779   0, /*tp_subclasses*/
20780   0, /*tp_weaklist*/
20781   0, /*tp_del*/
20782   0, /*tp_version_tag*/
20783   #if PY_VERSION_HEX >= 0x030400a1
20784   0, /*tp_finalize*/
20785   #endif
20786   #if PY_VERSION_HEX >= 0x030800b1
20787   0, /*tp_vectorcall*/
20788   #endif
20789   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20790   0, /*tp_print*/
20791   #endif
20792 };
20793 
20794 static PyMethodDef __pyx_methods[] = {
20795   {"update_neighborhood", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_3update_neighborhood, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_13nonparametric_17_smoothers_lowess_2update_neighborhood},
20796   {"update_indices", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_5update_indices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_13nonparametric_17_smoothers_lowess_4update_indices},
20797   {"calculate_residual_weights", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_7calculate_residual_weights, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_13nonparametric_17_smoothers_lowess_6calculate_residual_weights},
20798   {"bisquare", (PyCFunction)__pyx_pw_11statsmodels_13nonparametric_17_smoothers_lowess_9bisquare, METH_O, __pyx_doc_11statsmodels_13nonparametric_17_smoothers_lowess_8bisquare},
20799   {0, 0, 0, 0}
20800 };
20801 
20802 #if PY_MAJOR_VERSION >= 3
20803 #if CYTHON_PEP489_MULTI_PHASE_INIT
20804 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
20805 static int __pyx_pymod_exec__smoothers_lowess(PyObject* module); /*proto*/
20806 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
20807   {Py_mod_create, (void*)__pyx_pymod_create},
20808   {Py_mod_exec, (void*)__pyx_pymod_exec__smoothers_lowess},
20809   {0, NULL}
20810 };
20811 #endif
20812 
20813 static struct PyModuleDef __pyx_moduledef = {
20814     PyModuleDef_HEAD_INIT,
20815     "_smoothers_lowess",
20816     __pyx_k_Univariate_lowess_function_like, /* m_doc */
20817   #if CYTHON_PEP489_MULTI_PHASE_INIT
20818     0, /* m_size */
20819   #else
20820     -1, /* m_size */
20821   #endif
20822     __pyx_methods /* m_methods */,
20823   #if CYTHON_PEP489_MULTI_PHASE_INIT
20824     __pyx_moduledef_slots, /* m_slots */
20825   #else
20826     NULL, /* m_reload */
20827   #endif
20828     NULL, /* m_traverse */
20829     NULL, /* m_clear */
20830     NULL /* m_free */
20831 };
20832 #endif
20833 #ifndef CYTHON_SMALL_CODE
20834 #if defined(__clang__)
20835     #define CYTHON_SMALL_CODE
20836 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
20837     #define CYTHON_SMALL_CODE __attribute__((cold))
20838 #else
20839     #define CYTHON_SMALL_CODE
20840 #endif
20841 #endif
20842 
20843 static __Pyx_StringTabEntry __pyx_string_tab[] = {
20844   {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
20845   {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
20846   {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
20847   {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
20848   {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
20849   {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
20850   {&__pyx_n_s_DTYPE, __pyx_k_DTYPE, sizeof(__pyx_k_DTYPE), 0, 0, 1, 1},
20851   {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
20852   {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
20853   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
20854   {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
20855   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
20856   {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
20857   {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
20858   {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
20859   {&__pyx_kp_u_Lowess_frac_must_be_in_the_range, __pyx_k_Lowess_frac_must_be_in_the_range, sizeof(__pyx_k_Lowess_frac_must_be_in_the_range), 0, 1, 0, 0},
20860   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
20861   {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
20862   {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
20863   {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
20864   {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
20865   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
20866   {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1},
20867   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
20868   {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
20869   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
20870   {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
20871   {&__pyx_n_s_abs, __pyx_k_abs, sizeof(__pyx_k_abs), 0, 0, 1, 1},
20872   {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
20873   {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
20874   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
20875   {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
20876   {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
20877   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
20878   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
20879   {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
20880   {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
20881   {&__pyx_n_s_delta, __pyx_k_delta, sizeof(__pyx_k_delta), 0, 0, 1, 1},
20882   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
20883   {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1},
20884   {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
20885   {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
20886   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
20887   {&__pyx_n_s_endog, __pyx_k_endog, sizeof(__pyx_k_endog), 0, 0, 1, 1},
20888   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
20889   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
20890   {&__pyx_n_s_exog, __pyx_k_exog, sizeof(__pyx_k_exog), 0, 0, 1, 1},
20891   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
20892   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
20893   {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
20894   {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
20895   {&__pyx_n_s_frac, __pyx_k_frac, sizeof(__pyx_k_frac), 0, 0, 1, 1},
20896   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
20897   {&__pyx_n_s_given_xvals, __pyx_k_given_xvals, sizeof(__pyx_k_given_xvals), 0, 0, 1, 1},
20898   {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
20899   {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
20900   {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
20901   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
20902   {&__pyx_n_s_it, __pyx_k_it, sizeof(__pyx_k_it), 0, 0, 1, 1},
20903   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
20904   {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
20905   {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
20906   {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
20907   {&__pyx_n_s_last_fit_i, __pyx_k_last_fit_i, sizeof(__pyx_k_last_fit_i), 0, 0, 1, 1},
20908   {&__pyx_n_s_left_end, __pyx_k_left_end, sizeof(__pyx_k_left_end), 0, 0, 1, 1},
20909   {&__pyx_n_s_lowess, __pyx_k_lowess, sizeof(__pyx_k_lowess), 0, 0, 1, 1},
20910   {&__pyx_kp_u_lowess_endog_exog_xvals_resid_w, __pyx_k_lowess_endog_exog_xvals_resid_w, sizeof(__pyx_k_lowess_endog_exog_xvals_resid_w), 0, 1, 0, 0},
20911   {&__pyx_kp_u_lowess_line_24, __pyx_k_lowess_line_24, sizeof(__pyx_k_lowess_line_24), 0, 1, 0, 0},
20912   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
20913   {&__pyx_n_s_median, __pyx_k_median, sizeof(__pyx_k_median), 0, 0, 1, 1},
20914   {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
20915   {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
20916   {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
20917   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
20918   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
20919   {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
20920   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
20921   {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
20922   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
20923   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
20924   {&__pyx_kp_u_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 1, 0, 0},
20925   {&__pyx_kp_u_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 1, 0, 0},
20926   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
20927   {&__pyx_n_s_out_n, __pyx_k_out_n, sizeof(__pyx_k_out_n), 0, 0, 1, 1},
20928   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
20929   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
20930   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
20931   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
20932   {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
20933   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
20934   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
20935   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
20936   {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
20937   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
20938   {&__pyx_n_s_radius, __pyx_k_radius, sizeof(__pyx_k_radius), 0, 0, 1, 1},
20939   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
20940   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
20941   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
20942   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
20943   {&__pyx_n_s_reg_ok, __pyx_k_reg_ok, sizeof(__pyx_k_reg_ok), 0, 0, 1, 1},
20944   {&__pyx_n_s_resid_weights, __pyx_k_resid_weights, sizeof(__pyx_k_resid_weights), 0, 0, 1, 1},
20945   {&__pyx_n_s_right_end, __pyx_k_right_end, sizeof(__pyx_k_right_end), 0, 0, 1, 1},
20946   {&__pyx_n_s_robiter, __pyx_k_robiter, sizeof(__pyx_k_robiter), 0, 0, 1, 1},
20947   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
20948   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
20949   {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
20950   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
20951   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
20952   {&__pyx_kp_s_statsmodels_nonparametric__smoot, __pyx_k_statsmodels_nonparametric__smoot, sizeof(__pyx_k_statsmodels_nonparametric__smoot), 0, 0, 1, 0},
20953   {&__pyx_n_s_statsmodels_nonparametric__smoot_2, __pyx_k_statsmodels_nonparametric__smoot_2, sizeof(__pyx_k_statsmodels_nonparametric__smoot_2), 0, 0, 1, 1},
20954   {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
20955   {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
20956   {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
20957   {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
20958   {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
20959   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
20960   {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
20961   {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
20962   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
20963   {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
20964   {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
20965   {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
20966   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
20967   {&__pyx_n_s_weights, __pyx_k_weights, sizeof(__pyx_k_weights), 0, 0, 1, 1},
20968   {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
20969   {&__pyx_n_s_xval, __pyx_k_xval, sizeof(__pyx_k_xval), 0, 0, 1, 1},
20970   {&__pyx_n_s_xvals, __pyx_k_xvals, sizeof(__pyx_k_xvals), 0, 0, 1, 1},
20971   {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
20972   {&__pyx_n_s_y_fit, __pyx_k_y_fit, sizeof(__pyx_k_y_fit), 0, 0, 1, 1},
20973   {0, 0, 0, 0, 0, 0, 0}
20974 };
__Pyx_InitCachedBuiltins(void)20975 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
20976   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 155, __pyx_L1_error)
20977   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 175, __pyx_L1_error)
20978   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error)
20979   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error)
20980   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 151, __pyx_L1_error)
20981   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
20982   __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error)
20983   __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error)
20984   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error)
20985   return 0;
20986   __pyx_L1_error:;
20987   return -1;
20988 }
20989 
__Pyx_InitCachedConstants(void)20990 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
20991   __Pyx_RefNannyDeclarations
20992   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
20993 
20994   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":155
20995  *
20996  *     if not 0 <= frac <= 1:
20997  *            raise ValueError("Lowess `frac` must be in the range [0,1]!")             # <<<<<<<<<<<<<<
20998  *
20999  *     n = np.PyArray_DIMS(x)[0]
21000  */
21001   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Lowess_frac_must_be_in_the_range); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 155, __pyx_L1_error)
21002   __Pyx_GOTREF(__pyx_tuple__2);
21003   __Pyx_GIVEREF(__pyx_tuple__2);
21004 
21005   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":945
21006  *         __pyx_import_array()
21007  *     except Exception:
21008  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
21009  *
21010  * cdef inline int import_umath() except -1:
21011  */
21012   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 945, __pyx_L1_error)
21013   __Pyx_GOTREF(__pyx_tuple__3);
21014   __Pyx_GIVEREF(__pyx_tuple__3);
21015 
21016   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":951
21017  *         _import_umath()
21018  *     except Exception:
21019  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
21020  *
21021  * cdef inline int import_ufunc() except -1:
21022  */
21023   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 951, __pyx_L1_error)
21024   __Pyx_GOTREF(__pyx_tuple__4);
21025   __Pyx_GIVEREF(__pyx_tuple__4);
21026 
21027   /* "View.MemoryView":133
21028  *
21029  *         if not self.ndim:
21030  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
21031  *
21032  *         if itemsize <= 0:
21033  */
21034   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 133, __pyx_L1_error)
21035   __Pyx_GOTREF(__pyx_tuple__5);
21036   __Pyx_GIVEREF(__pyx_tuple__5);
21037 
21038   /* "View.MemoryView":136
21039  *
21040  *         if itemsize <= 0:
21041  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
21042  *
21043  *         if not isinstance(format, bytes):
21044  */
21045   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 136, __pyx_L1_error)
21046   __Pyx_GOTREF(__pyx_tuple__6);
21047   __Pyx_GIVEREF(__pyx_tuple__6);
21048 
21049   /* "View.MemoryView":148
21050  *
21051  *         if not self._shape:
21052  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
21053  *
21054  *
21055  */
21056   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 148, __pyx_L1_error)
21057   __Pyx_GOTREF(__pyx_tuple__7);
21058   __Pyx_GIVEREF(__pyx_tuple__7);
21059 
21060   /* "View.MemoryView":176
21061  *             self.data = <char *>malloc(self.len)
21062  *             if not self.data:
21063  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
21064  *
21065  *             if self.dtype_is_object:
21066  */
21067   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 176, __pyx_L1_error)
21068   __Pyx_GOTREF(__pyx_tuple__8);
21069   __Pyx_GIVEREF(__pyx_tuple__8);
21070 
21071   /* "View.MemoryView":192
21072  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
21073  *         if not (flags & bufmode):
21074  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
21075  *         info.buf = self.data
21076  *         info.len = self.len
21077  */
21078   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 192, __pyx_L1_error)
21079   __Pyx_GOTREF(__pyx_tuple__9);
21080   __Pyx_GIVEREF(__pyx_tuple__9);
21081 
21082   /* "(tree fragment)":2
21083  * def __reduce_cython__(self):
21084  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21085  * def __setstate_cython__(self, __pyx_state):
21086  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21087  */
21088   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 2, __pyx_L1_error)
21089   __Pyx_GOTREF(__pyx_tuple__10);
21090   __Pyx_GIVEREF(__pyx_tuple__10);
21091 
21092   /* "(tree fragment)":4
21093  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21094  * def __setstate_cython__(self, __pyx_state):
21095  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21096  */
21097   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 4, __pyx_L1_error)
21098   __Pyx_GOTREF(__pyx_tuple__11);
21099   __Pyx_GIVEREF(__pyx_tuple__11);
21100 
21101   /* "View.MemoryView":418
21102  *     def __setitem__(memoryview self, object index, object value):
21103  *         if self.view.readonly:
21104  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
21105  *
21106  *         have_slices, index = _unellipsify(index, self.view.ndim)
21107  */
21108   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 418, __pyx_L1_error)
21109   __Pyx_GOTREF(__pyx_tuple__12);
21110   __Pyx_GIVEREF(__pyx_tuple__12);
21111 
21112   /* "View.MemoryView":495
21113  *             result = struct.unpack(self.view.format, bytesitem)
21114  *         except struct.error:
21115  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
21116  *         else:
21117  *             if len(self.view.format) == 1:
21118  */
21119   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 495, __pyx_L1_error)
21120   __Pyx_GOTREF(__pyx_tuple__13);
21121   __Pyx_GIVEREF(__pyx_tuple__13);
21122 
21123   /* "View.MemoryView":520
21124  *     def __getbuffer__(self, Py_buffer *info, int flags):
21125  *         if flags & PyBUF_WRITABLE and self.view.readonly:
21126  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
21127  *
21128  *         if flags & PyBUF_ND:
21129  */
21130   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 520, __pyx_L1_error)
21131   __Pyx_GOTREF(__pyx_tuple__14);
21132   __Pyx_GIVEREF(__pyx_tuple__14);
21133 
21134   /* "View.MemoryView":570
21135  *         if self.view.strides == NULL:
21136  *
21137  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
21138  *
21139  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
21140  */
21141   __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 570, __pyx_L1_error)
21142   __Pyx_GOTREF(__pyx_tuple__15);
21143   __Pyx_GIVEREF(__pyx_tuple__15);
21144 
21145   /* "View.MemoryView":577
21146  *     def suboffsets(self):
21147  *         if self.view.suboffsets == NULL:
21148  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
21149  *
21150  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
21151  */
21152   __pyx_tuple__16 = PyTuple_New(1); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 577, __pyx_L1_error)
21153   __Pyx_GOTREF(__pyx_tuple__16);
21154   __Pyx_INCREF(__pyx_int_neg_1);
21155   __Pyx_GIVEREF(__pyx_int_neg_1);
21156   PyTuple_SET_ITEM(__pyx_tuple__16, 0, __pyx_int_neg_1);
21157   __Pyx_GIVEREF(__pyx_tuple__16);
21158 
21159   /* "(tree fragment)":2
21160  * def __reduce_cython__(self):
21161  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21162  * def __setstate_cython__(self, __pyx_state):
21163  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21164  */
21165   __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 2, __pyx_L1_error)
21166   __Pyx_GOTREF(__pyx_tuple__17);
21167   __Pyx_GIVEREF(__pyx_tuple__17);
21168 
21169   /* "(tree fragment)":4
21170  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21171  * def __setstate_cython__(self, __pyx_state):
21172  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21173  */
21174   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 4, __pyx_L1_error)
21175   __Pyx_GOTREF(__pyx_tuple__18);
21176   __Pyx_GIVEREF(__pyx_tuple__18);
21177 
21178   /* "View.MemoryView":682
21179  *         if item is Ellipsis:
21180  *             if not seen_ellipsis:
21181  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
21182  *                 seen_ellipsis = True
21183  *             else:
21184  */
21185   __pyx_slice__19 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__19)) __PYX_ERR(2, 682, __pyx_L1_error)
21186   __Pyx_GOTREF(__pyx_slice__19);
21187   __Pyx_GIVEREF(__pyx_slice__19);
21188 
21189   /* "View.MemoryView":703
21190  *     for suboffset in suboffsets[:ndim]:
21191  *         if suboffset >= 0:
21192  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
21193  *
21194  *
21195  */
21196   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 703, __pyx_L1_error)
21197   __Pyx_GOTREF(__pyx_tuple__20);
21198   __Pyx_GIVEREF(__pyx_tuple__20);
21199 
21200   /* "(tree fragment)":2
21201  * def __reduce_cython__(self):
21202  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21203  * def __setstate_cython__(self, __pyx_state):
21204  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21205  */
21206   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 2, __pyx_L1_error)
21207   __Pyx_GOTREF(__pyx_tuple__21);
21208   __Pyx_GIVEREF(__pyx_tuple__21);
21209 
21210   /* "(tree fragment)":4
21211  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21212  * def __setstate_cython__(self, __pyx_state):
21213  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21214  */
21215   __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 4, __pyx_L1_error)
21216   __Pyx_GOTREF(__pyx_tuple__22);
21217   __Pyx_GIVEREF(__pyx_tuple__22);
21218 
21219   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":24
21220  * np.import_array()
21221  *
21222  * def lowess(np.ndarray[DTYPE_t, ndim = 1] endog,             # <<<<<<<<<<<<<<
21223  *            np.ndarray[DTYPE_t, ndim = 1] exog,
21224  *            np.ndarray[DTYPE_t, ndim = 1] xvals,
21225  */
21226   __pyx_tuple__23 = PyTuple_Pack(24, __pyx_n_s_endog, __pyx_n_s_exog, __pyx_n_s_xvals, __pyx_n_s_resid_weights, __pyx_n_s_frac, __pyx_n_s_it, __pyx_n_s_delta, __pyx_n_s_given_xvals, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_robiter, __pyx_n_s_i, __pyx_n_s_left_end, __pyx_n_s_right_end, __pyx_n_s_n, __pyx_n_s_out_n, __pyx_n_s_last_fit_i, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_y_fit, __pyx_n_s_weights, __pyx_n_s_xval, __pyx_n_s_radius, __pyx_n_s_reg_ok); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 24, __pyx_L1_error)
21227   __Pyx_GOTREF(__pyx_tuple__23);
21228   __Pyx_GIVEREF(__pyx_tuple__23);
21229   __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(8, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_statsmodels_nonparametric__smoot, __pyx_n_s_lowess, 24, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 24, __pyx_L1_error)
21230 
21231   /* "View.MemoryView":286
21232  *         return self.name
21233  *
21234  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
21235  * cdef strided = Enum("<strided and direct>") # default
21236  * cdef indirect = Enum("<strided and indirect>")
21237  */
21238   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 286, __pyx_L1_error)
21239   __Pyx_GOTREF(__pyx_tuple__25);
21240   __Pyx_GIVEREF(__pyx_tuple__25);
21241 
21242   /* "View.MemoryView":287
21243  *
21244  * cdef generic = Enum("<strided and direct or indirect>")
21245  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
21246  * cdef indirect = Enum("<strided and indirect>")
21247  *
21248  */
21249   __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 287, __pyx_L1_error)
21250   __Pyx_GOTREF(__pyx_tuple__26);
21251   __Pyx_GIVEREF(__pyx_tuple__26);
21252 
21253   /* "View.MemoryView":288
21254  * cdef generic = Enum("<strided and direct or indirect>")
21255  * cdef strided = Enum("<strided and direct>") # default
21256  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
21257  *
21258  *
21259  */
21260   __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 288, __pyx_L1_error)
21261   __Pyx_GOTREF(__pyx_tuple__27);
21262   __Pyx_GIVEREF(__pyx_tuple__27);
21263 
21264   /* "View.MemoryView":291
21265  *
21266  *
21267  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
21268  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
21269  *
21270  */
21271   __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 291, __pyx_L1_error)
21272   __Pyx_GOTREF(__pyx_tuple__28);
21273   __Pyx_GIVEREF(__pyx_tuple__28);
21274 
21275   /* "View.MemoryView":292
21276  *
21277  * cdef contiguous = Enum("<contiguous and direct>")
21278  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
21279  *
21280  *
21281  */
21282   __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 292, __pyx_L1_error)
21283   __Pyx_GOTREF(__pyx_tuple__29);
21284   __Pyx_GIVEREF(__pyx_tuple__29);
21285 
21286   /* "(tree fragment)":1
21287  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
21288  *     cdef object __pyx_PickleError
21289  *     cdef object __pyx_result
21290  */
21291   __pyx_tuple__30 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 1, __pyx_L1_error)
21292   __Pyx_GOTREF(__pyx_tuple__30);
21293   __Pyx_GIVEREF(__pyx_tuple__30);
21294   __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(2, 1, __pyx_L1_error)
21295   __Pyx_RefNannyFinishContext();
21296   return 0;
21297   __pyx_L1_error:;
21298   __Pyx_RefNannyFinishContext();
21299   return -1;
21300 }
21301 
__Pyx_InitGlobals(void)21302 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
21303   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
21304   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
21305   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21306   __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
21307   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21308   return 0;
21309   __pyx_L1_error:;
21310   return -1;
21311 }
21312 
21313 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
21314 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
21315 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
21316 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
21317 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
21318 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
21319 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
21320 
__Pyx_modinit_global_init_code(void)21321 static int __Pyx_modinit_global_init_code(void) {
21322   __Pyx_RefNannyDeclarations
21323   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
21324   /*--- Global init code ---*/
21325   generic = Py_None; Py_INCREF(Py_None);
21326   strided = Py_None; Py_INCREF(Py_None);
21327   indirect = Py_None; Py_INCREF(Py_None);
21328   contiguous = Py_None; Py_INCREF(Py_None);
21329   indirect_contiguous = Py_None; Py_INCREF(Py_None);
21330   __Pyx_RefNannyFinishContext();
21331   return 0;
21332 }
21333 
__Pyx_modinit_variable_export_code(void)21334 static int __Pyx_modinit_variable_export_code(void) {
21335   __Pyx_RefNannyDeclarations
21336   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
21337   /*--- Variable export code ---*/
21338   __Pyx_RefNannyFinishContext();
21339   return 0;
21340 }
21341 
__Pyx_modinit_function_export_code(void)21342 static int __Pyx_modinit_function_export_code(void) {
21343   __Pyx_RefNannyDeclarations
21344   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
21345   /*--- Function export code ---*/
21346   __Pyx_RefNannyFinishContext();
21347   return 0;
21348 }
21349 
__Pyx_modinit_type_init_code(void)21350 static int __Pyx_modinit_type_init_code(void) {
21351   __Pyx_RefNannyDeclarations
21352   int __pyx_lineno = 0;
21353   const char *__pyx_filename = NULL;
21354   int __pyx_clineno = 0;
21355   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
21356   /*--- Type init code ---*/
21357   __pyx_vtabptr_array = &__pyx_vtable_array;
21358   __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
21359   if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
21360   #if PY_VERSION_HEX < 0x030800B1
21361   __pyx_type___pyx_array.tp_print = 0;
21362   #endif
21363   if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
21364   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
21365   __pyx_array_type = &__pyx_type___pyx_array;
21366   if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
21367   #if PY_VERSION_HEX < 0x030800B1
21368   __pyx_type___pyx_MemviewEnum.tp_print = 0;
21369   #endif
21370   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
21371     __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21372   }
21373   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
21374   __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
21375   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
21376   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
21377   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
21378   __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
21379   __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
21380   __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
21381   __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
21382   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
21383   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
21384   #if PY_VERSION_HEX < 0x030800B1
21385   __pyx_type___pyx_memoryview.tp_print = 0;
21386   #endif
21387   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
21388     __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21389   }
21390   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
21391   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
21392   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
21393   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
21394   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
21395   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
21396   __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
21397   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
21398   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
21399   #if PY_VERSION_HEX < 0x030800B1
21400   __pyx_type___pyx_memoryviewslice.tp_print = 0;
21401   #endif
21402   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
21403     __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21404   }
21405   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
21406   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
21407   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
21408   __Pyx_RefNannyFinishContext();
21409   return 0;
21410   __pyx_L1_error:;
21411   __Pyx_RefNannyFinishContext();
21412   return -1;
21413 }
21414 
__Pyx_modinit_type_import_code(void)21415 static int __Pyx_modinit_type_import_code(void) {
21416   __Pyx_RefNannyDeclarations
21417   PyObject *__pyx_t_1 = NULL;
21418   int __pyx_lineno = 0;
21419   const char *__pyx_filename = NULL;
21420   int __pyx_clineno = 0;
21421   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
21422   /*--- Type import code ---*/
21423   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
21424   __Pyx_GOTREF(__pyx_t_1);
21425   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
21426   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
21427   sizeof(PyTypeObject),
21428   #else
21429   sizeof(PyHeapTypeObject),
21430   #endif
21431   __Pyx_ImportType_CheckSize_Warn);
21432    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
21433   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21434   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
21435   __Pyx_GOTREF(__pyx_t_1);
21436   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
21437    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
21438   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
21439    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
21440   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
21441    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
21442   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
21443    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
21444   __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21445    if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
21446   __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21447    if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
21448   __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21449    if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
21450   __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21451    if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
21452   __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21453    if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
21454   __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21455    if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
21456   __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21457    if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
21458   __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21459    if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
21460   __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21461    if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
21462   __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21463    if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
21464   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
21465    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
21466   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21467   __Pyx_RefNannyFinishContext();
21468   return 0;
21469   __pyx_L1_error:;
21470   __Pyx_XDECREF(__pyx_t_1);
21471   __Pyx_RefNannyFinishContext();
21472   return -1;
21473 }
21474 
__Pyx_modinit_variable_import_code(void)21475 static int __Pyx_modinit_variable_import_code(void) {
21476   __Pyx_RefNannyDeclarations
21477   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
21478   /*--- Variable import code ---*/
21479   __Pyx_RefNannyFinishContext();
21480   return 0;
21481 }
21482 
__Pyx_modinit_function_import_code(void)21483 static int __Pyx_modinit_function_import_code(void) {
21484   __Pyx_RefNannyDeclarations
21485   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
21486   /*--- Function import code ---*/
21487   __Pyx_RefNannyFinishContext();
21488   return 0;
21489 }
21490 
21491 
21492 #ifndef CYTHON_NO_PYINIT_EXPORT
21493 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
21494 #elif PY_MAJOR_VERSION < 3
21495 #ifdef __cplusplus
21496 #define __Pyx_PyMODINIT_FUNC extern "C" void
21497 #else
21498 #define __Pyx_PyMODINIT_FUNC void
21499 #endif
21500 #else
21501 #ifdef __cplusplus
21502 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
21503 #else
21504 #define __Pyx_PyMODINIT_FUNC PyObject *
21505 #endif
21506 #endif
21507 
21508 
21509 #if PY_MAJOR_VERSION < 3
21510 __Pyx_PyMODINIT_FUNC init_smoothers_lowess(void) CYTHON_SMALL_CODE; /*proto*/
init_smoothers_lowess(void)21511 __Pyx_PyMODINIT_FUNC init_smoothers_lowess(void)
21512 #else
21513 __Pyx_PyMODINIT_FUNC PyInit__smoothers_lowess(void) CYTHON_SMALL_CODE; /*proto*/
21514 __Pyx_PyMODINIT_FUNC PyInit__smoothers_lowess(void)
21515 #if CYTHON_PEP489_MULTI_PHASE_INIT
21516 {
21517   return PyModuleDef_Init(&__pyx_moduledef);
21518 }
21519 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
21520     #if PY_VERSION_HEX >= 0x030700A1
21521     static PY_INT64_T main_interpreter_id = -1;
21522     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
21523     if (main_interpreter_id == -1) {
21524         main_interpreter_id = current_id;
21525         return (unlikely(current_id == -1)) ? -1 : 0;
21526     } else if (unlikely(main_interpreter_id != current_id))
21527     #else
21528     static PyInterpreterState *main_interpreter = NULL;
21529     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
21530     if (!main_interpreter) {
21531         main_interpreter = current_interpreter;
21532     } else if (unlikely(main_interpreter != current_interpreter))
21533     #endif
21534     {
21535         PyErr_SetString(
21536             PyExc_ImportError,
21537             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
21538         return -1;
21539     }
21540     return 0;
21541 }
21542 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
21543     PyObject *value = PyObject_GetAttrString(spec, from_name);
21544     int result = 0;
21545     if (likely(value)) {
21546         if (allow_none || value != Py_None) {
21547             result = PyDict_SetItemString(moddict, to_name, value);
21548         }
21549         Py_DECREF(value);
21550     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
21551         PyErr_Clear();
21552     } else {
21553         result = -1;
21554     }
21555     return result;
21556 }
21557 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
21558     PyObject *module = NULL, *moddict, *modname;
21559     if (__Pyx_check_single_interpreter())
21560         return NULL;
21561     if (__pyx_m)
21562         return __Pyx_NewRef(__pyx_m);
21563     modname = PyObject_GetAttrString(spec, "name");
21564     if (unlikely(!modname)) goto bad;
21565     module = PyModule_NewObject(modname);
21566     Py_DECREF(modname);
21567     if (unlikely(!module)) goto bad;
21568     moddict = PyModule_GetDict(module);
21569     if (unlikely(!moddict)) goto bad;
21570     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
21571     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
21572     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
21573     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
21574     return module;
21575 bad:
21576     Py_XDECREF(module);
21577     return NULL;
21578 }
21579 
21580 
21581 static CYTHON_SMALL_CODE int __pyx_pymod_exec__smoothers_lowess(PyObject *__pyx_pyinit_module)
21582 #endif
21583 #endif
21584 {
21585   PyObject *__pyx_t_1 = NULL;
21586   PyObject *__pyx_t_2 = NULL;
21587   int __pyx_t_3;
21588   static PyThread_type_lock __pyx_t_4[8];
21589   int __pyx_lineno = 0;
21590   const char *__pyx_filename = NULL;
21591   int __pyx_clineno = 0;
21592   __Pyx_RefNannyDeclarations
21593   #if CYTHON_PEP489_MULTI_PHASE_INIT
21594   if (__pyx_m) {
21595     if (__pyx_m == __pyx_pyinit_module) return 0;
21596     PyErr_SetString(PyExc_RuntimeError, "Module '_smoothers_lowess' has already been imported. Re-initialisation is not supported.");
21597     return -1;
21598   }
21599   #elif PY_MAJOR_VERSION >= 3
21600   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
21601   #endif
21602   #if CYTHON_REFNANNY
21603 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
21604 if (!__Pyx_RefNanny) {
21605   PyErr_Clear();
21606   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
21607   if (!__Pyx_RefNanny)
21608       Py_FatalError("failed to import 'refnanny' module");
21609 }
21610 #endif
21611   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__smoothers_lowess(void)", 0);
21612   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21613   #ifdef __Pxy_PyFrame_Initialize_Offsets
21614   __Pxy_PyFrame_Initialize_Offsets();
21615   #endif
21616   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
21617   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
21618   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
21619   #ifdef __Pyx_CyFunction_USED
21620   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21621   #endif
21622   #ifdef __Pyx_FusedFunction_USED
21623   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21624   #endif
21625   #ifdef __Pyx_Coroutine_USED
21626   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21627   #endif
21628   #ifdef __Pyx_Generator_USED
21629   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21630   #endif
21631   #ifdef __Pyx_AsyncGen_USED
21632   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21633   #endif
21634   #ifdef __Pyx_StopAsyncIteration_USED
21635   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21636   #endif
21637   /*--- Library function declarations ---*/
21638   /*--- Threads initialization code ---*/
21639   #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
21640   PyEval_InitThreads();
21641   #endif
21642   /*--- Module creation code ---*/
21643   #if CYTHON_PEP489_MULTI_PHASE_INIT
21644   __pyx_m = __pyx_pyinit_module;
21645   Py_INCREF(__pyx_m);
21646   #else
21647   #if PY_MAJOR_VERSION < 3
21648   __pyx_m = Py_InitModule4("_smoothers_lowess", __pyx_methods, __pyx_k_Univariate_lowess_function_like, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
21649   #else
21650   __pyx_m = PyModule_Create(&__pyx_moduledef);
21651   #endif
21652   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
21653   #endif
21654   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
21655   Py_INCREF(__pyx_d);
21656   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
21657   Py_INCREF(__pyx_b);
21658   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
21659   Py_INCREF(__pyx_cython_runtime);
21660   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
21661   /*--- Initialize various global constants etc. ---*/
21662   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21663   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
21664   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21665   #endif
21666   if (__pyx_module_is_main_statsmodels__nonparametric___smoothers_lowess) {
21667     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21668   }
21669   #if PY_MAJOR_VERSION >= 3
21670   {
21671     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
21672     if (!PyDict_GetItemString(modules, "statsmodels.nonparametric._smoothers_lowess")) {
21673       if (unlikely(PyDict_SetItemString(modules, "statsmodels.nonparametric._smoothers_lowess", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21674     }
21675   }
21676   #endif
21677   /*--- Builtin init code ---*/
21678   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21679   /*--- Constants init code ---*/
21680   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21681   /*--- Global type/function init code ---*/
21682   (void)__Pyx_modinit_global_init_code();
21683   (void)__Pyx_modinit_variable_export_code();
21684   (void)__Pyx_modinit_function_export_code();
21685   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21686   if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21687   (void)__Pyx_modinit_variable_import_code();
21688   (void)__Pyx_modinit_function_import_code();
21689   /*--- Execution code ---*/
21690   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
21691   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21692   #endif
21693 
21694   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":15
21695  *
21696  * cimport cython
21697  * import numpy as np             # <<<<<<<<<<<<<<
21698  * cimport numpy as np
21699  * from libc.math cimport NAN, fabs, fmax
21700  */
21701   __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
21702   __Pyx_GOTREF(__pyx_t_1);
21703   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
21704   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21705 
21706   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":19
21707  * from libc.math cimport NAN, fabs, fmax
21708  *
21709  * DTYPE = np.double             # <<<<<<<<<<<<<<
21710  * ctypedef np.double_t DTYPE_t
21711  *
21712  */
21713   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
21714   __Pyx_GOTREF(__pyx_t_1);
21715   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_double); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
21716   __Pyx_GOTREF(__pyx_t_2);
21717   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21718   if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTYPE, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
21719   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21720 
21721   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":22
21722  * ctypedef np.double_t DTYPE_t
21723  *
21724  * np.import_array()             # <<<<<<<<<<<<<<
21725  *
21726  * def lowess(np.ndarray[DTYPE_t, ndim = 1] endog,
21727  */
21728   __pyx_t_3 = __pyx_f_5numpy_import_array(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 22, __pyx_L1_error)
21729 
21730   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":28
21731  *            np.ndarray[DTYPE_t, ndim = 1] xvals,
21732  *            np.ndarray[DTYPE_t, ndim = 1] resid_weights,
21733  *            double frac = 2.0 / 3.0,             # <<<<<<<<<<<<<<
21734  *            Py_ssize_t it = 3,
21735  *            double delta = 0.0,
21736  */
21737   __pyx_k_ = (2.0 / 3.0);
21738 
21739   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":24
21740  * np.import_array()
21741  *
21742  * def lowess(np.ndarray[DTYPE_t, ndim = 1] endog,             # <<<<<<<<<<<<<<
21743  *            np.ndarray[DTYPE_t, ndim = 1] exog,
21744  *            np.ndarray[DTYPE_t, ndim = 1] xvals,
21745  */
21746   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11statsmodels_13nonparametric_17_smoothers_lowess_1lowess, NULL, __pyx_n_s_statsmodels_nonparametric__smoot_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
21747   __Pyx_GOTREF(__pyx_t_2);
21748   if (PyDict_SetItem(__pyx_d, __pyx_n_s_lowess, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
21749   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21750 
21751   /* "statsmodels/nonparametric/_smoothers_lowess.pyx":1
21752  * #cython: boundscheck=False, wraparound=False, cdivision=True, language_level=3             # <<<<<<<<<<<<<<
21753  * """
21754  * Univariate lowess function, like in R.
21755  */
21756   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
21757   __Pyx_GOTREF(__pyx_t_2);
21758   if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_lowess_line_24, __pyx_kp_u_lowess_endog_exog_xvals_resid_w) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21759   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21760   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21761 
21762   /* "View.MemoryView":209
21763  *         info.obj = self
21764  *
21765  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
21766  *
21767  *     def __dealloc__(array self):
21768  */
21769   __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 209, __pyx_L1_error)
21770   __Pyx_GOTREF(__pyx_t_2);
21771   if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 209, __pyx_L1_error)
21772   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21773   PyType_Modified(__pyx_array_type);
21774 
21775   /* "View.MemoryView":286
21776  *         return self.name
21777  *
21778  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
21779  * cdef strided = Enum("<strided and direct>") # default
21780  * cdef indirect = Enum("<strided and indirect>")
21781  */
21782   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 286, __pyx_L1_error)
21783   __Pyx_GOTREF(__pyx_t_2);
21784   __Pyx_XGOTREF(generic);
21785   __Pyx_DECREF_SET(generic, __pyx_t_2);
21786   __Pyx_GIVEREF(__pyx_t_2);
21787   __pyx_t_2 = 0;
21788 
21789   /* "View.MemoryView":287
21790  *
21791  * cdef generic = Enum("<strided and direct or indirect>")
21792  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
21793  * cdef indirect = Enum("<strided and indirect>")
21794  *
21795  */
21796   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 287, __pyx_L1_error)
21797   __Pyx_GOTREF(__pyx_t_2);
21798   __Pyx_XGOTREF(strided);
21799   __Pyx_DECREF_SET(strided, __pyx_t_2);
21800   __Pyx_GIVEREF(__pyx_t_2);
21801   __pyx_t_2 = 0;
21802 
21803   /* "View.MemoryView":288
21804  * cdef generic = Enum("<strided and direct or indirect>")
21805  * cdef strided = Enum("<strided and direct>") # default
21806  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
21807  *
21808  *
21809  */
21810   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 288, __pyx_L1_error)
21811   __Pyx_GOTREF(__pyx_t_2);
21812   __Pyx_XGOTREF(indirect);
21813   __Pyx_DECREF_SET(indirect, __pyx_t_2);
21814   __Pyx_GIVEREF(__pyx_t_2);
21815   __pyx_t_2 = 0;
21816 
21817   /* "View.MemoryView":291
21818  *
21819  *
21820  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
21821  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
21822  *
21823  */
21824   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 291, __pyx_L1_error)
21825   __Pyx_GOTREF(__pyx_t_2);
21826   __Pyx_XGOTREF(contiguous);
21827   __Pyx_DECREF_SET(contiguous, __pyx_t_2);
21828   __Pyx_GIVEREF(__pyx_t_2);
21829   __pyx_t_2 = 0;
21830 
21831   /* "View.MemoryView":292
21832  *
21833  * cdef contiguous = Enum("<contiguous and direct>")
21834  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
21835  *
21836  *
21837  */
21838   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 292, __pyx_L1_error)
21839   __Pyx_GOTREF(__pyx_t_2);
21840   __Pyx_XGOTREF(indirect_contiguous);
21841   __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2);
21842   __Pyx_GIVEREF(__pyx_t_2);
21843   __pyx_t_2 = 0;
21844 
21845   /* "View.MemoryView":316
21846  *
21847  * DEF THREAD_LOCKS_PREALLOCATED = 8
21848  * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
21849  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
21850  *     PyThread_allocate_lock(),
21851  */
21852   __pyx_memoryview_thread_locks_used = 0;
21853 
21854   /* "View.MemoryView":317
21855  * DEF THREAD_LOCKS_PREALLOCATED = 8
21856  * cdef int __pyx_memoryview_thread_locks_used = 0
21857  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
21858  *     PyThread_allocate_lock(),
21859  *     PyThread_allocate_lock(),
21860  */
21861   __pyx_t_4[0] = PyThread_allocate_lock();
21862   __pyx_t_4[1] = PyThread_allocate_lock();
21863   __pyx_t_4[2] = PyThread_allocate_lock();
21864   __pyx_t_4[3] = PyThread_allocate_lock();
21865   __pyx_t_4[4] = PyThread_allocate_lock();
21866   __pyx_t_4[5] = PyThread_allocate_lock();
21867   __pyx_t_4[6] = PyThread_allocate_lock();
21868   __pyx_t_4[7] = PyThread_allocate_lock();
21869   memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_4, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
21870 
21871   /* "View.MemoryView":549
21872  *         info.obj = self
21873  *
21874  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
21875  *
21876  *
21877  */
21878   __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 549, __pyx_L1_error)
21879   __Pyx_GOTREF(__pyx_t_2);
21880   if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 549, __pyx_L1_error)
21881   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21882   PyType_Modified(__pyx_memoryview_type);
21883 
21884   /* "View.MemoryView":995
21885  *         return self.from_object
21886  *
21887  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
21888  *
21889  *
21890  */
21891   __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 995, __pyx_L1_error)
21892   __Pyx_GOTREF(__pyx_t_2);
21893   if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 995, __pyx_L1_error)
21894   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21895   PyType_Modified(__pyx_memoryviewslice_type);
21896 
21897   /* "(tree fragment)":1
21898  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
21899  *     cdef object __pyx_PickleError
21900  *     cdef object __pyx_result
21901  */
21902   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error)
21903   __Pyx_GOTREF(__pyx_t_2);
21904   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
21905   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21906 
21907   /* "(tree fragment)":11
21908  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21909  *     return __pyx_result
21910  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
21911  *     __pyx_result.name = __pyx_state[0]
21912  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
21913  */
21914 
21915   /*--- Wrapped vars code ---*/
21916 
21917   goto __pyx_L0;
21918   __pyx_L1_error:;
21919   __Pyx_XDECREF(__pyx_t_1);
21920   __Pyx_XDECREF(__pyx_t_2);
21921   if (__pyx_m) {
21922     if (__pyx_d) {
21923       __Pyx_AddTraceback("init statsmodels.nonparametric._smoothers_lowess", __pyx_clineno, __pyx_lineno, __pyx_filename);
21924     }
21925     Py_CLEAR(__pyx_m);
21926   } else if (!PyErr_Occurred()) {
21927     PyErr_SetString(PyExc_ImportError, "init statsmodels.nonparametric._smoothers_lowess");
21928   }
21929   __pyx_L0:;
21930   __Pyx_RefNannyFinishContext();
21931   #if CYTHON_PEP489_MULTI_PHASE_INIT
21932   return (__pyx_m != NULL) ? 0 : -1;
21933   #elif PY_MAJOR_VERSION >= 3
21934   return __pyx_m;
21935   #else
21936   return;
21937   #endif
21938 }
21939 
21940 /* --- Runtime support code --- */
21941 /* Refnanny */
21942 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)21943 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
21944     PyObject *m = NULL, *p = NULL;
21945     void *r = NULL;
21946     m = PyImport_ImportModule(modname);
21947     if (!m) goto end;
21948     p = PyObject_GetAttrString(m, "RefNannyAPI");
21949     if (!p) goto end;
21950     r = PyLong_AsVoidPtr(p);
21951 end:
21952     Py_XDECREF(p);
21953     Py_XDECREF(m);
21954     return (__Pyx_RefNannyAPIStruct *)r;
21955 }
21956 #endif
21957 
21958 /* PyObjectGetAttrStr */
21959 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)21960 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
21961     PyTypeObject* tp = Py_TYPE(obj);
21962     if (likely(tp->tp_getattro))
21963         return tp->tp_getattro(obj, attr_name);
21964 #if PY_MAJOR_VERSION < 3
21965     if (likely(tp->tp_getattr))
21966         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
21967 #endif
21968     return PyObject_GetAttr(obj, attr_name);
21969 }
21970 #endif
21971 
21972 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)21973 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
21974     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
21975     if (unlikely(!result)) {
21976         PyErr_Format(PyExc_NameError,
21977 #if PY_MAJOR_VERSION >= 3
21978             "name '%U' is not defined", name);
21979 #else
21980             "name '%.200s' is not defined", PyString_AS_STRING(name));
21981 #endif
21982     }
21983     return result;
21984 }
21985 
21986 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)21987 static void __Pyx_RaiseArgtupleInvalid(
21988     const char* func_name,
21989     int exact,
21990     Py_ssize_t num_min,
21991     Py_ssize_t num_max,
21992     Py_ssize_t num_found)
21993 {
21994     Py_ssize_t num_expected;
21995     const char *more_or_less;
21996     if (num_found < num_min) {
21997         num_expected = num_min;
21998         more_or_less = "at least";
21999     } else {
22000         num_expected = num_max;
22001         more_or_less = "at most";
22002     }
22003     if (exact) {
22004         more_or_less = "exactly";
22005     }
22006     PyErr_Format(PyExc_TypeError,
22007                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
22008                  func_name, more_or_less, num_expected,
22009                  (num_expected == 1) ? "" : "s", num_found);
22010 }
22011 
22012 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)22013 static void __Pyx_RaiseDoubleKeywordsError(
22014     const char* func_name,
22015     PyObject* kw_name)
22016 {
22017     PyErr_Format(PyExc_TypeError,
22018         #if PY_MAJOR_VERSION >= 3
22019         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
22020         #else
22021         "%s() got multiple values for keyword argument '%s'", func_name,
22022         PyString_AsString(kw_name));
22023         #endif
22024 }
22025 
22026 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)22027 static int __Pyx_ParseOptionalKeywords(
22028     PyObject *kwds,
22029     PyObject **argnames[],
22030     PyObject *kwds2,
22031     PyObject *values[],
22032     Py_ssize_t num_pos_args,
22033     const char* function_name)
22034 {
22035     PyObject *key = 0, *value = 0;
22036     Py_ssize_t pos = 0;
22037     PyObject*** name;
22038     PyObject*** first_kw_arg = argnames + num_pos_args;
22039     while (PyDict_Next(kwds, &pos, &key, &value)) {
22040         name = first_kw_arg;
22041         while (*name && (**name != key)) name++;
22042         if (*name) {
22043             values[name-argnames] = value;
22044             continue;
22045         }
22046         name = first_kw_arg;
22047         #if PY_MAJOR_VERSION < 3
22048         if (likely(PyString_Check(key))) {
22049             while (*name) {
22050                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
22051                         && _PyString_Eq(**name, key)) {
22052                     values[name-argnames] = value;
22053                     break;
22054                 }
22055                 name++;
22056             }
22057             if (*name) continue;
22058             else {
22059                 PyObject*** argname = argnames;
22060                 while (argname != first_kw_arg) {
22061                     if ((**argname == key) || (
22062                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
22063                              && _PyString_Eq(**argname, key))) {
22064                         goto arg_passed_twice;
22065                     }
22066                     argname++;
22067                 }
22068             }
22069         } else
22070         #endif
22071         if (likely(PyUnicode_Check(key))) {
22072             while (*name) {
22073                 int cmp = (**name == key) ? 0 :
22074                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
22075                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
22076                 #endif
22077                     PyUnicode_Compare(**name, key);
22078                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
22079                 if (cmp == 0) {
22080                     values[name-argnames] = value;
22081                     break;
22082                 }
22083                 name++;
22084             }
22085             if (*name) continue;
22086             else {
22087                 PyObject*** argname = argnames;
22088                 while (argname != first_kw_arg) {
22089                     int cmp = (**argname == key) ? 0 :
22090                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
22091                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
22092                     #endif
22093                         PyUnicode_Compare(**argname, key);
22094                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
22095                     if (cmp == 0) goto arg_passed_twice;
22096                     argname++;
22097                 }
22098             }
22099         } else
22100             goto invalid_keyword_type;
22101         if (kwds2) {
22102             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
22103         } else {
22104             goto invalid_keyword;
22105         }
22106     }
22107     return 0;
22108 arg_passed_twice:
22109     __Pyx_RaiseDoubleKeywordsError(function_name, key);
22110     goto bad;
22111 invalid_keyword_type:
22112     PyErr_Format(PyExc_TypeError,
22113         "%.200s() keywords must be strings", function_name);
22114     goto bad;
22115 invalid_keyword:
22116     PyErr_Format(PyExc_TypeError,
22117     #if PY_MAJOR_VERSION < 3
22118         "%.200s() got an unexpected keyword argument '%.200s'",
22119         function_name, PyString_AsString(key));
22120     #else
22121         "%s() got an unexpected keyword argument '%U'",
22122         function_name, key);
22123     #endif
22124 bad:
22125     return -1;
22126 }
22127 
22128 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)22129 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
22130 {
22131     if (unlikely(!type)) {
22132         PyErr_SetString(PyExc_SystemError, "Missing type object");
22133         return 0;
22134     }
22135     else if (exact) {
22136         #if PY_MAJOR_VERSION == 2
22137         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
22138         #endif
22139     }
22140     else {
22141         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
22142     }
22143     PyErr_Format(PyExc_TypeError,
22144         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
22145         name, type->tp_name, Py_TYPE(obj)->tp_name);
22146     return 0;
22147 }
22148 
22149 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)22150 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
22151 {
22152   union {
22153     uint32_t u32;
22154     uint8_t u8[4];
22155   } S;
22156   S.u32 = 0x01020304;
22157   return S.u8[0] == 4;
22158 }
22159 
22160 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)22161 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
22162                               __Pyx_BufFmt_StackElem* stack,
22163                               __Pyx_TypeInfo* type) {
22164   stack[0].field = &ctx->root;
22165   stack[0].parent_offset = 0;
22166   ctx->root.type = type;
22167   ctx->root.name = "buffer dtype";
22168   ctx->root.offset = 0;
22169   ctx->head = stack;
22170   ctx->head->field = &ctx->root;
22171   ctx->fmt_offset = 0;
22172   ctx->head->parent_offset = 0;
22173   ctx->new_packmode = '@';
22174   ctx->enc_packmode = '@';
22175   ctx->new_count = 1;
22176   ctx->enc_count = 0;
22177   ctx->enc_type = 0;
22178   ctx->is_complex = 0;
22179   ctx->is_valid_array = 0;
22180   ctx->struct_alignment = 0;
22181   while (type->typegroup == 'S') {
22182     ++ctx->head;
22183     ctx->head->field = type->fields;
22184     ctx->head->parent_offset = 0;
22185     type = type->fields->type;
22186   }
22187 }
__Pyx_BufFmt_ParseNumber(const char ** ts)22188 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
22189     int count;
22190     const char* t = *ts;
22191     if (*t < '0' || *t > '9') {
22192       return -1;
22193     } else {
22194         count = *t++ - '0';
22195         while (*t >= '0' && *t <= '9') {
22196             count *= 10;
22197             count += *t++ - '0';
22198         }
22199     }
22200     *ts = t;
22201     return count;
22202 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)22203 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
22204     int number = __Pyx_BufFmt_ParseNumber(ts);
22205     if (number == -1)
22206         PyErr_Format(PyExc_ValueError,\
22207                      "Does not understand character buffer dtype format string ('%c')", **ts);
22208     return number;
22209 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)22210 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
22211   PyErr_Format(PyExc_ValueError,
22212                "Unexpected format string character: '%c'", ch);
22213 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)22214 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
22215   switch (ch) {
22216     case '?': return "'bool'";
22217     case 'c': return "'char'";
22218     case 'b': return "'signed char'";
22219     case 'B': return "'unsigned char'";
22220     case 'h': return "'short'";
22221     case 'H': return "'unsigned short'";
22222     case 'i': return "'int'";
22223     case 'I': return "'unsigned int'";
22224     case 'l': return "'long'";
22225     case 'L': return "'unsigned long'";
22226     case 'q': return "'long long'";
22227     case 'Q': return "'unsigned long long'";
22228     case 'f': return (is_complex ? "'complex float'" : "'float'");
22229     case 'd': return (is_complex ? "'complex double'" : "'double'");
22230     case 'g': return (is_complex ? "'complex long double'" : "'long double'");
22231     case 'T': return "a struct";
22232     case 'O': return "Python object";
22233     case 'P': return "a pointer";
22234     case 's': case 'p': return "a string";
22235     case 0: return "end";
22236     default: return "unparseable format string";
22237   }
22238 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)22239 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
22240   switch (ch) {
22241     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
22242     case 'h': case 'H': return 2;
22243     case 'i': case 'I': case 'l': case 'L': return 4;
22244     case 'q': case 'Q': return 8;
22245     case 'f': return (is_complex ? 8 : 4);
22246     case 'd': return (is_complex ? 16 : 8);
22247     case 'g': {
22248       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
22249       return 0;
22250     }
22251     case 'O': case 'P': return sizeof(void*);
22252     default:
22253       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22254       return 0;
22255     }
22256 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)22257 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
22258   switch (ch) {
22259     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
22260     case 'h': case 'H': return sizeof(short);
22261     case 'i': case 'I': return sizeof(int);
22262     case 'l': case 'L': return sizeof(long);
22263     #ifdef HAVE_LONG_LONG
22264     case 'q': case 'Q': return sizeof(PY_LONG_LONG);
22265     #endif
22266     case 'f': return sizeof(float) * (is_complex ? 2 : 1);
22267     case 'd': return sizeof(double) * (is_complex ? 2 : 1);
22268     case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
22269     case 'O': case 'P': return sizeof(void*);
22270     default: {
22271       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22272       return 0;
22273     }
22274   }
22275 }
22276 typedef struct { char c; short x; } __Pyx_st_short;
22277 typedef struct { char c; int x; } __Pyx_st_int;
22278 typedef struct { char c; long x; } __Pyx_st_long;
22279 typedef struct { char c; float x; } __Pyx_st_float;
22280 typedef struct { char c; double x; } __Pyx_st_double;
22281 typedef struct { char c; long double x; } __Pyx_st_longdouble;
22282 typedef struct { char c; void *x; } __Pyx_st_void_p;
22283 #ifdef HAVE_LONG_LONG
22284 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
22285 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)22286 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
22287   switch (ch) {
22288     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
22289     case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
22290     case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
22291     case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
22292 #ifdef HAVE_LONG_LONG
22293     case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
22294 #endif
22295     case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
22296     case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
22297     case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
22298     case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
22299     default:
22300       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22301       return 0;
22302     }
22303 }
22304 /* These are for computing the padding at the end of the struct to align
22305    on the first member of the struct. This will probably the same as above,
22306    but we don't have any guarantees.
22307  */
22308 typedef struct { short x; char c; } __Pyx_pad_short;
22309 typedef struct { int x; char c; } __Pyx_pad_int;
22310 typedef struct { long x; char c; } __Pyx_pad_long;
22311 typedef struct { float x; char c; } __Pyx_pad_float;
22312 typedef struct { double x; char c; } __Pyx_pad_double;
22313 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
22314 typedef struct { void *x; char c; } __Pyx_pad_void_p;
22315 #ifdef HAVE_LONG_LONG
22316 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
22317 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)22318 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
22319   switch (ch) {
22320     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
22321     case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
22322     case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
22323     case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
22324 #ifdef HAVE_LONG_LONG
22325     case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
22326 #endif
22327     case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
22328     case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
22329     case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
22330     case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
22331     default:
22332       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22333       return 0;
22334     }
22335 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)22336 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
22337   switch (ch) {
22338     case 'c':
22339         return 'H';
22340     case 'b': case 'h': case 'i':
22341     case 'l': case 'q': case 's': case 'p':
22342         return 'I';
22343     case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
22344         return 'U';
22345     case 'f': case 'd': case 'g':
22346         return (is_complex ? 'C' : 'R');
22347     case 'O':
22348         return 'O';
22349     case 'P':
22350         return 'P';
22351     default: {
22352       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22353       return 0;
22354     }
22355   }
22356 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)22357 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
22358   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
22359     const char* expected;
22360     const char* quote;
22361     if (ctx->head == NULL) {
22362       expected = "end";
22363       quote = "";
22364     } else {
22365       expected = ctx->head->field->type->name;
22366       quote = "'";
22367     }
22368     PyErr_Format(PyExc_ValueError,
22369                  "Buffer dtype mismatch, expected %s%s%s but got %s",
22370                  quote, expected, quote,
22371                  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
22372   } else {
22373     __Pyx_StructField* field = ctx->head->field;
22374     __Pyx_StructField* parent = (ctx->head - 1)->field;
22375     PyErr_Format(PyExc_ValueError,
22376                  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
22377                  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
22378                  parent->type->name, field->name);
22379   }
22380 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)22381 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
22382   char group;
22383   size_t size, offset, arraysize = 1;
22384   if (ctx->enc_type == 0) return 0;
22385   if (ctx->head->field->type->arraysize[0]) {
22386     int i, ndim = 0;
22387     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
22388         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
22389         ndim = 1;
22390         if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
22391             PyErr_Format(PyExc_ValueError,
22392                          "Expected a dimension of size %zu, got %zu",
22393                          ctx->head->field->type->arraysize[0], ctx->enc_count);
22394             return -1;
22395         }
22396     }
22397     if (!ctx->is_valid_array) {
22398       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
22399                    ctx->head->field->type->ndim, ndim);
22400       return -1;
22401     }
22402     for (i = 0; i < ctx->head->field->type->ndim; i++) {
22403       arraysize *= ctx->head->field->type->arraysize[i];
22404     }
22405     ctx->is_valid_array = 0;
22406     ctx->enc_count = 1;
22407   }
22408   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
22409   do {
22410     __Pyx_StructField* field = ctx->head->field;
22411     __Pyx_TypeInfo* type = field->type;
22412     if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
22413       size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
22414     } else {
22415       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
22416     }
22417     if (ctx->enc_packmode == '@') {
22418       size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
22419       size_t align_mod_offset;
22420       if (align_at == 0) return -1;
22421       align_mod_offset = ctx->fmt_offset % align_at;
22422       if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
22423       if (ctx->struct_alignment == 0)
22424           ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
22425                                                                  ctx->is_complex);
22426     }
22427     if (type->size != size || type->typegroup != group) {
22428       if (type->typegroup == 'C' && type->fields != NULL) {
22429         size_t parent_offset = ctx->head->parent_offset + field->offset;
22430         ++ctx->head;
22431         ctx->head->field = type->fields;
22432         ctx->head->parent_offset = parent_offset;
22433         continue;
22434       }
22435       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
22436       } else {
22437           __Pyx_BufFmt_RaiseExpected(ctx);
22438           return -1;
22439       }
22440     }
22441     offset = ctx->head->parent_offset + field->offset;
22442     if (ctx->fmt_offset != offset) {
22443       PyErr_Format(PyExc_ValueError,
22444                    "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
22445                    (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
22446       return -1;
22447     }
22448     ctx->fmt_offset += size;
22449     if (arraysize)
22450       ctx->fmt_offset += (arraysize - 1) * size;
22451     --ctx->enc_count;
22452     while (1) {
22453       if (field == &ctx->root) {
22454         ctx->head = NULL;
22455         if (ctx->enc_count != 0) {
22456           __Pyx_BufFmt_RaiseExpected(ctx);
22457           return -1;
22458         }
22459         break;
22460       }
22461       ctx->head->field = ++field;
22462       if (field->type == NULL) {
22463         --ctx->head;
22464         field = ctx->head->field;
22465         continue;
22466       } else if (field->type->typegroup == 'S') {
22467         size_t parent_offset = ctx->head->parent_offset + field->offset;
22468         if (field->type->fields->type == NULL) continue;
22469         field = field->type->fields;
22470         ++ctx->head;
22471         ctx->head->field = field;
22472         ctx->head->parent_offset = parent_offset;
22473         break;
22474       } else {
22475         break;
22476       }
22477     }
22478   } while (ctx->enc_count);
22479   ctx->enc_type = 0;
22480   ctx->is_complex = 0;
22481   return 0;
22482 }
22483 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)22484 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
22485 {
22486     const char *ts = *tsp;
22487     int i = 0, number, ndim;
22488     ++ts;
22489     if (ctx->new_count != 1) {
22490         PyErr_SetString(PyExc_ValueError,
22491                         "Cannot handle repeated arrays in format string");
22492         return NULL;
22493     }
22494     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
22495     ndim = ctx->head->field->type->ndim;
22496     while (*ts && *ts != ')') {
22497         switch (*ts) {
22498             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
22499             default:  break;
22500         }
22501         number = __Pyx_BufFmt_ExpectNumber(&ts);
22502         if (number == -1) return NULL;
22503         if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
22504             return PyErr_Format(PyExc_ValueError,
22505                         "Expected a dimension of size %zu, got %d",
22506                         ctx->head->field->type->arraysize[i], number);
22507         if (*ts != ',' && *ts != ')')
22508             return PyErr_Format(PyExc_ValueError,
22509                                 "Expected a comma in format string, got '%c'", *ts);
22510         if (*ts == ',') ts++;
22511         i++;
22512     }
22513     if (i != ndim)
22514         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
22515                             ctx->head->field->type->ndim, i);
22516     if (!*ts) {
22517         PyErr_SetString(PyExc_ValueError,
22518                         "Unexpected end of format string, expected ')'");
22519         return NULL;
22520     }
22521     ctx->is_valid_array = 1;
22522     ctx->new_count = 1;
22523     *tsp = ++ts;
22524     return Py_None;
22525 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)22526 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
22527   int got_Z = 0;
22528   while (1) {
22529     switch(*ts) {
22530       case 0:
22531         if (ctx->enc_type != 0 && ctx->head == NULL) {
22532           __Pyx_BufFmt_RaiseExpected(ctx);
22533           return NULL;
22534         }
22535         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
22536         if (ctx->head != NULL) {
22537           __Pyx_BufFmt_RaiseExpected(ctx);
22538           return NULL;
22539         }
22540         return ts;
22541       case ' ':
22542       case '\r':
22543       case '\n':
22544         ++ts;
22545         break;
22546       case '<':
22547         if (!__Pyx_Is_Little_Endian()) {
22548           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
22549           return NULL;
22550         }
22551         ctx->new_packmode = '=';
22552         ++ts;
22553         break;
22554       case '>':
22555       case '!':
22556         if (__Pyx_Is_Little_Endian()) {
22557           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
22558           return NULL;
22559         }
22560         ctx->new_packmode = '=';
22561         ++ts;
22562         break;
22563       case '=':
22564       case '@':
22565       case '^':
22566         ctx->new_packmode = *ts++;
22567         break;
22568       case 'T':
22569         {
22570           const char* ts_after_sub;
22571           size_t i, struct_count = ctx->new_count;
22572           size_t struct_alignment = ctx->struct_alignment;
22573           ctx->new_count = 1;
22574           ++ts;
22575           if (*ts != '{') {
22576             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
22577             return NULL;
22578           }
22579           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
22580           ctx->enc_type = 0;
22581           ctx->enc_count = 0;
22582           ctx->struct_alignment = 0;
22583           ++ts;
22584           ts_after_sub = ts;
22585           for (i = 0; i != struct_count; ++i) {
22586             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
22587             if (!ts_after_sub) return NULL;
22588           }
22589           ts = ts_after_sub;
22590           if (struct_alignment) ctx->struct_alignment = struct_alignment;
22591         }
22592         break;
22593       case '}':
22594         {
22595           size_t alignment = ctx->struct_alignment;
22596           ++ts;
22597           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
22598           ctx->enc_type = 0;
22599           if (alignment && ctx->fmt_offset % alignment) {
22600             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
22601           }
22602         }
22603         return ts;
22604       case 'x':
22605         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
22606         ctx->fmt_offset += ctx->new_count;
22607         ctx->new_count = 1;
22608         ctx->enc_count = 0;
22609         ctx->enc_type = 0;
22610         ctx->enc_packmode = ctx->new_packmode;
22611         ++ts;
22612         break;
22613       case 'Z':
22614         got_Z = 1;
22615         ++ts;
22616         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
22617           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
22618           return NULL;
22619         }
22620         CYTHON_FALLTHROUGH;
22621       case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
22622       case 'l': case 'L': case 'q': case 'Q':
22623       case 'f': case 'd': case 'g':
22624       case 'O': case 'p':
22625         if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
22626             (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
22627           ctx->enc_count += ctx->new_count;
22628           ctx->new_count = 1;
22629           got_Z = 0;
22630           ++ts;
22631           break;
22632         }
22633         CYTHON_FALLTHROUGH;
22634       case 's':
22635         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
22636         ctx->enc_count = ctx->new_count;
22637         ctx->enc_packmode = ctx->new_packmode;
22638         ctx->enc_type = *ts;
22639         ctx->is_complex = got_Z;
22640         ++ts;
22641         ctx->new_count = 1;
22642         got_Z = 0;
22643         break;
22644       case ':':
22645         ++ts;
22646         while(*ts != ':') ++ts;
22647         ++ts;
22648         break;
22649       case '(':
22650         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
22651         break;
22652       default:
22653         {
22654           int number = __Pyx_BufFmt_ExpectNumber(&ts);
22655           if (number == -1) return NULL;
22656           ctx->new_count = (size_t)number;
22657         }
22658     }
22659   }
22660 }
22661 
22662 /* BufferGetAndValidate */
__Pyx_SafeReleaseBuffer(Py_buffer * info)22663   static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
22664   if (unlikely(info->buf == NULL)) return;
22665   if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
22666   __Pyx_ReleaseBuffer(info);
22667 }
__Pyx_ZeroBuffer(Py_buffer * buf)22668 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
22669   buf->buf = NULL;
22670   buf->obj = NULL;
22671   buf->strides = __Pyx_zeros;
22672   buf->shape = __Pyx_zeros;
22673   buf->suboffsets = __Pyx_minusones;
22674 }
__Pyx__GetBufferAndValidate(Py_buffer * buf,PyObject * obj,__Pyx_TypeInfo * dtype,int flags,int nd,int cast,__Pyx_BufFmt_StackElem * stack)22675 static int __Pyx__GetBufferAndValidate(
22676         Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
22677         int nd, int cast, __Pyx_BufFmt_StackElem* stack)
22678 {
22679   buf->buf = NULL;
22680   if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
22681     __Pyx_ZeroBuffer(buf);
22682     return -1;
22683   }
22684   if (unlikely(buf->ndim != nd)) {
22685     PyErr_Format(PyExc_ValueError,
22686                  "Buffer has wrong number of dimensions (expected %d, got %d)",
22687                  nd, buf->ndim);
22688     goto fail;
22689   }
22690   if (!cast) {
22691     __Pyx_BufFmt_Context ctx;
22692     __Pyx_BufFmt_Init(&ctx, stack, dtype);
22693     if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
22694   }
22695   if (unlikely((size_t)buf->itemsize != dtype->size)) {
22696     PyErr_Format(PyExc_ValueError,
22697       "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
22698       buf->itemsize, (buf->itemsize > 1) ? "s" : "",
22699       dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
22700     goto fail;
22701   }
22702   if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
22703   return 0;
22704 fail:;
22705   __Pyx_SafeReleaseBuffer(buf);
22706   return -1;
22707 }
22708 
22709 /* BufferFallbackError */
__Pyx_RaiseBufferFallbackError(void)22710   static void __Pyx_RaiseBufferFallbackError(void) {
22711   PyErr_SetString(PyExc_ValueError,
22712      "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
22713 }
22714 
22715 /* PyObjectCall */
22716   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)22717 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
22718     PyObject *result;
22719     ternaryfunc call = Py_TYPE(func)->tp_call;
22720     if (unlikely(!call))
22721         return PyObject_Call(func, arg, kw);
22722     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
22723         return NULL;
22724     result = (*call)(func, arg, kw);
22725     Py_LeaveRecursiveCall();
22726     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
22727         PyErr_SetString(
22728             PyExc_SystemError,
22729             "NULL result without error in PyObject_Call");
22730     }
22731     return result;
22732 }
22733 #endif
22734 
22735 /* PyErrFetchRestore */
22736   #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)22737 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
22738     PyObject *tmp_type, *tmp_value, *tmp_tb;
22739     tmp_type = tstate->curexc_type;
22740     tmp_value = tstate->curexc_value;
22741     tmp_tb = tstate->curexc_traceback;
22742     tstate->curexc_type = type;
22743     tstate->curexc_value = value;
22744     tstate->curexc_traceback = tb;
22745     Py_XDECREF(tmp_type);
22746     Py_XDECREF(tmp_value);
22747     Py_XDECREF(tmp_tb);
22748 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)22749 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22750     *type = tstate->curexc_type;
22751     *value = tstate->curexc_value;
22752     *tb = tstate->curexc_traceback;
22753     tstate->curexc_type = 0;
22754     tstate->curexc_value = 0;
22755     tstate->curexc_traceback = 0;
22756 }
22757 #endif
22758 
22759 /* RaiseException */
22760   #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)22761 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
22762                         CYTHON_UNUSED PyObject *cause) {
22763     __Pyx_PyThreadState_declare
22764     Py_XINCREF(type);
22765     if (!value || value == Py_None)
22766         value = NULL;
22767     else
22768         Py_INCREF(value);
22769     if (!tb || tb == Py_None)
22770         tb = NULL;
22771     else {
22772         Py_INCREF(tb);
22773         if (!PyTraceBack_Check(tb)) {
22774             PyErr_SetString(PyExc_TypeError,
22775                 "raise: arg 3 must be a traceback or None");
22776             goto raise_error;
22777         }
22778     }
22779     if (PyType_Check(type)) {
22780 #if CYTHON_COMPILING_IN_PYPY
22781         if (!value) {
22782             Py_INCREF(Py_None);
22783             value = Py_None;
22784         }
22785 #endif
22786         PyErr_NormalizeException(&type, &value, &tb);
22787     } else {
22788         if (value) {
22789             PyErr_SetString(PyExc_TypeError,
22790                 "instance exception may not have a separate value");
22791             goto raise_error;
22792         }
22793         value = type;
22794         type = (PyObject*) Py_TYPE(type);
22795         Py_INCREF(type);
22796         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
22797             PyErr_SetString(PyExc_TypeError,
22798                 "raise: exception class must be a subclass of BaseException");
22799             goto raise_error;
22800         }
22801     }
22802     __Pyx_PyThreadState_assign
22803     __Pyx_ErrRestore(type, value, tb);
22804     return;
22805 raise_error:
22806     Py_XDECREF(value);
22807     Py_XDECREF(type);
22808     Py_XDECREF(tb);
22809     return;
22810 }
22811 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)22812 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
22813     PyObject* owned_instance = NULL;
22814     if (tb == Py_None) {
22815         tb = 0;
22816     } else if (tb && !PyTraceBack_Check(tb)) {
22817         PyErr_SetString(PyExc_TypeError,
22818             "raise: arg 3 must be a traceback or None");
22819         goto bad;
22820     }
22821     if (value == Py_None)
22822         value = 0;
22823     if (PyExceptionInstance_Check(type)) {
22824         if (value) {
22825             PyErr_SetString(PyExc_TypeError,
22826                 "instance exception may not have a separate value");
22827             goto bad;
22828         }
22829         value = type;
22830         type = (PyObject*) Py_TYPE(value);
22831     } else if (PyExceptionClass_Check(type)) {
22832         PyObject *instance_class = NULL;
22833         if (value && PyExceptionInstance_Check(value)) {
22834             instance_class = (PyObject*) Py_TYPE(value);
22835             if (instance_class != type) {
22836                 int is_subclass = PyObject_IsSubclass(instance_class, type);
22837                 if (!is_subclass) {
22838                     instance_class = NULL;
22839                 } else if (unlikely(is_subclass == -1)) {
22840                     goto bad;
22841                 } else {
22842                     type = instance_class;
22843                 }
22844             }
22845         }
22846         if (!instance_class) {
22847             PyObject *args;
22848             if (!value)
22849                 args = PyTuple_New(0);
22850             else if (PyTuple_Check(value)) {
22851                 Py_INCREF(value);
22852                 args = value;
22853             } else
22854                 args = PyTuple_Pack(1, value);
22855             if (!args)
22856                 goto bad;
22857             owned_instance = PyObject_Call(type, args, NULL);
22858             Py_DECREF(args);
22859             if (!owned_instance)
22860                 goto bad;
22861             value = owned_instance;
22862             if (!PyExceptionInstance_Check(value)) {
22863                 PyErr_Format(PyExc_TypeError,
22864                              "calling %R should have returned an instance of "
22865                              "BaseException, not %R",
22866                              type, Py_TYPE(value));
22867                 goto bad;
22868             }
22869         }
22870     } else {
22871         PyErr_SetString(PyExc_TypeError,
22872             "raise: exception class must be a subclass of BaseException");
22873         goto bad;
22874     }
22875     if (cause) {
22876         PyObject *fixed_cause;
22877         if (cause == Py_None) {
22878             fixed_cause = NULL;
22879         } else if (PyExceptionClass_Check(cause)) {
22880             fixed_cause = PyObject_CallObject(cause, NULL);
22881             if (fixed_cause == NULL)
22882                 goto bad;
22883         } else if (PyExceptionInstance_Check(cause)) {
22884             fixed_cause = cause;
22885             Py_INCREF(fixed_cause);
22886         } else {
22887             PyErr_SetString(PyExc_TypeError,
22888                             "exception causes must derive from "
22889                             "BaseException");
22890             goto bad;
22891         }
22892         PyException_SetCause(value, fixed_cause);
22893     }
22894     PyErr_SetObject(type, value);
22895     if (tb) {
22896 #if CYTHON_COMPILING_IN_PYPY
22897         PyObject *tmp_type, *tmp_value, *tmp_tb;
22898         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
22899         Py_INCREF(tb);
22900         PyErr_Restore(tmp_type, tmp_value, tb);
22901         Py_XDECREF(tmp_tb);
22902 #else
22903         PyThreadState *tstate = __Pyx_PyThreadState_Current;
22904         PyObject* tmp_tb = tstate->curexc_traceback;
22905         if (tb != tmp_tb) {
22906             Py_INCREF(tb);
22907             tstate->curexc_traceback = tb;
22908             Py_XDECREF(tmp_tb);
22909         }
22910 #endif
22911     }
22912 bad:
22913     Py_XDECREF(owned_instance);
22914     return;
22915 }
22916 #endif
22917 
22918 /* PyDictVersioning */
22919   #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)22920 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
22921     PyObject *dict = Py_TYPE(obj)->tp_dict;
22922     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
22923 }
__Pyx_get_object_dict_version(PyObject * obj)22924 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
22925     PyObject **dictptr = NULL;
22926     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
22927     if (offset) {
22928 #if CYTHON_COMPILING_IN_CPYTHON
22929         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
22930 #else
22931         dictptr = _PyObject_GetDictPtr(obj);
22932 #endif
22933     }
22934     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
22935 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)22936 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
22937     PyObject *dict = Py_TYPE(obj)->tp_dict;
22938     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
22939         return 0;
22940     return obj_dict_version == __Pyx_get_object_dict_version(obj);
22941 }
22942 #endif
22943 
22944 /* GetModuleGlobalName */
22945   #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)22946 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
22947 #else
22948 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
22949 #endif
22950 {
22951     PyObject *result;
22952 #if !CYTHON_AVOID_BORROWED_REFS
22953 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
22954     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
22955     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
22956     if (likely(result)) {
22957         return __Pyx_NewRef(result);
22958     } else if (unlikely(PyErr_Occurred())) {
22959         return NULL;
22960     }
22961 #else
22962     result = PyDict_GetItem(__pyx_d, name);
22963     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
22964     if (likely(result)) {
22965         return __Pyx_NewRef(result);
22966     }
22967 #endif
22968 #else
22969     result = PyObject_GetItem(__pyx_d, name);
22970     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
22971     if (likely(result)) {
22972         return __Pyx_NewRef(result);
22973     }
22974     PyErr_Clear();
22975 #endif
22976     return __Pyx_GetBuiltinName(name);
22977 }
22978 
22979 /* PyCFunctionFastCall */
22980   #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)22981 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
22982     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
22983     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
22984     PyObject *self = PyCFunction_GET_SELF(func);
22985     int flags = PyCFunction_GET_FLAGS(func);
22986     assert(PyCFunction_Check(func));
22987     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
22988     assert(nargs >= 0);
22989     assert(nargs == 0 || args != NULL);
22990     /* _PyCFunction_FastCallDict() must not be called with an exception set,
22991        because it may clear it (directly or indirectly) and so the
22992        caller loses its exception */
22993     assert(!PyErr_Occurred());
22994     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
22995         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
22996     } else {
22997         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
22998     }
22999 }
23000 #endif
23001 
23002 /* PyFunctionFastCall */
23003   #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)23004 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
23005                                                PyObject *globals) {
23006     PyFrameObject *f;
23007     PyThreadState *tstate = __Pyx_PyThreadState_Current;
23008     PyObject **fastlocals;
23009     Py_ssize_t i;
23010     PyObject *result;
23011     assert(globals != NULL);
23012     /* XXX Perhaps we should create a specialized
23013        PyFrame_New() that doesn't take locals, but does
23014        take builtins without sanity checking them.
23015        */
23016     assert(tstate != NULL);
23017     f = PyFrame_New(tstate, co, globals, NULL);
23018     if (f == NULL) {
23019         return NULL;
23020     }
23021     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
23022     for (i = 0; i < na; i++) {
23023         Py_INCREF(*args);
23024         fastlocals[i] = *args++;
23025     }
23026     result = PyEval_EvalFrameEx(f,0);
23027     ++tstate->recursion_depth;
23028     Py_DECREF(f);
23029     --tstate->recursion_depth;
23030     return result;
23031 }
23032 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)23033 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
23034     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
23035     PyObject *globals = PyFunction_GET_GLOBALS(func);
23036     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
23037     PyObject *closure;
23038 #if PY_MAJOR_VERSION >= 3
23039     PyObject *kwdefs;
23040 #endif
23041     PyObject *kwtuple, **k;
23042     PyObject **d;
23043     Py_ssize_t nd;
23044     Py_ssize_t nk;
23045     PyObject *result;
23046     assert(kwargs == NULL || PyDict_Check(kwargs));
23047     nk = kwargs ? PyDict_Size(kwargs) : 0;
23048     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
23049         return NULL;
23050     }
23051     if (
23052 #if PY_MAJOR_VERSION >= 3
23053             co->co_kwonlyargcount == 0 &&
23054 #endif
23055             likely(kwargs == NULL || nk == 0) &&
23056             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
23057         if (argdefs == NULL && co->co_argcount == nargs) {
23058             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
23059             goto done;
23060         }
23061         else if (nargs == 0 && argdefs != NULL
23062                  && co->co_argcount == Py_SIZE(argdefs)) {
23063             /* function called with no arguments, but all parameters have
23064                a default value: use default values as arguments .*/
23065             args = &PyTuple_GET_ITEM(argdefs, 0);
23066             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
23067             goto done;
23068         }
23069     }
23070     if (kwargs != NULL) {
23071         Py_ssize_t pos, i;
23072         kwtuple = PyTuple_New(2 * nk);
23073         if (kwtuple == NULL) {
23074             result = NULL;
23075             goto done;
23076         }
23077         k = &PyTuple_GET_ITEM(kwtuple, 0);
23078         pos = i = 0;
23079         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
23080             Py_INCREF(k[i]);
23081             Py_INCREF(k[i+1]);
23082             i += 2;
23083         }
23084         nk = i / 2;
23085     }
23086     else {
23087         kwtuple = NULL;
23088         k = NULL;
23089     }
23090     closure = PyFunction_GET_CLOSURE(func);
23091 #if PY_MAJOR_VERSION >= 3
23092     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
23093 #endif
23094     if (argdefs != NULL) {
23095         d = &PyTuple_GET_ITEM(argdefs, 0);
23096         nd = Py_SIZE(argdefs);
23097     }
23098     else {
23099         d = NULL;
23100         nd = 0;
23101     }
23102 #if PY_MAJOR_VERSION >= 3
23103     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
23104                                args, (int)nargs,
23105                                k, (int)nk,
23106                                d, (int)nd, kwdefs, closure);
23107 #else
23108     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
23109                                args, (int)nargs,
23110                                k, (int)nk,
23111                                d, (int)nd, closure);
23112 #endif
23113     Py_XDECREF(kwtuple);
23114 done:
23115     Py_LeaveRecursiveCall();
23116     return result;
23117 }
23118 #endif
23119 #endif
23120 
23121 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)23122   static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
23123     PyObject *args, *result = NULL;
23124     #if CYTHON_FAST_PYCALL
23125     if (PyFunction_Check(function)) {
23126         PyObject *args[2] = {arg1, arg2};
23127         return __Pyx_PyFunction_FastCall(function, args, 2);
23128     }
23129     #endif
23130     #if CYTHON_FAST_PYCCALL
23131     if (__Pyx_PyFastCFunction_Check(function)) {
23132         PyObject *args[2] = {arg1, arg2};
23133         return __Pyx_PyCFunction_FastCall(function, args, 2);
23134     }
23135     #endif
23136     args = PyTuple_New(2);
23137     if (unlikely(!args)) goto done;
23138     Py_INCREF(arg1);
23139     PyTuple_SET_ITEM(args, 0, arg1);
23140     Py_INCREF(arg2);
23141     PyTuple_SET_ITEM(args, 1, arg2);
23142     Py_INCREF(function);
23143     result = __Pyx_PyObject_Call(function, args, NULL);
23144     Py_DECREF(args);
23145     Py_DECREF(function);
23146 done:
23147     return result;
23148 }
23149 
23150 /* PyObjectCallMethO */
23151   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)23152 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
23153     PyObject *self, *result;
23154     PyCFunction cfunc;
23155     cfunc = PyCFunction_GET_FUNCTION(func);
23156     self = PyCFunction_GET_SELF(func);
23157     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
23158         return NULL;
23159     result = cfunc(self, arg);
23160     Py_LeaveRecursiveCall();
23161     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
23162         PyErr_SetString(
23163             PyExc_SystemError,
23164             "NULL result without error in PyObject_Call");
23165     }
23166     return result;
23167 }
23168 #endif
23169 
23170 /* PyObjectCallOneArg */
23171   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)23172 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23173     PyObject *result;
23174     PyObject *args = PyTuple_New(1);
23175     if (unlikely(!args)) return NULL;
23176     Py_INCREF(arg);
23177     PyTuple_SET_ITEM(args, 0, arg);
23178     result = __Pyx_PyObject_Call(func, args, NULL);
23179     Py_DECREF(args);
23180     return result;
23181 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)23182 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23183 #if CYTHON_FAST_PYCALL
23184     if (PyFunction_Check(func)) {
23185         return __Pyx_PyFunction_FastCall(func, &arg, 1);
23186     }
23187 #endif
23188     if (likely(PyCFunction_Check(func))) {
23189         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
23190             return __Pyx_PyObject_CallMethO(func, arg);
23191 #if CYTHON_FAST_PYCCALL
23192         } else if (__Pyx_PyFastCFunction_Check(func)) {
23193             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
23194 #endif
23195         }
23196     }
23197     return __Pyx__PyObject_CallOneArg(func, arg);
23198 }
23199 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)23200 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23201     PyObject *result;
23202     PyObject *args = PyTuple_Pack(1, arg);
23203     if (unlikely(!args)) return NULL;
23204     result = __Pyx_PyObject_Call(func, args, NULL);
23205     Py_DECREF(args);
23206     return result;
23207 }
23208 #endif
23209 
23210 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)23211   static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
23212     if (unlikely(!type)) {
23213         PyErr_SetString(PyExc_SystemError, "Missing type object");
23214         return 0;
23215     }
23216     if (likely(__Pyx_TypeCheck(obj, type)))
23217         return 1;
23218     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
23219                  Py_TYPE(obj)->tp_name, type->tp_name);
23220     return 0;
23221 }
23222 
23223 /* MemviewSliceInit */
23224   static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj * memview,int ndim,__Pyx_memviewslice * memviewslice,int memview_is_new_reference)23225 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
23226                         int ndim,
23227                         __Pyx_memviewslice *memviewslice,
23228                         int memview_is_new_reference)
23229 {
23230     __Pyx_RefNannyDeclarations
23231     int i, retval=-1;
23232     Py_buffer *buf = &memview->view;
23233     __Pyx_RefNannySetupContext("init_memviewslice", 0);
23234     if (unlikely(memviewslice->memview || memviewslice->data)) {
23235         PyErr_SetString(PyExc_ValueError,
23236             "memviewslice is already initialized!");
23237         goto fail;
23238     }
23239     if (buf->strides) {
23240         for (i = 0; i < ndim; i++) {
23241             memviewslice->strides[i] = buf->strides[i];
23242         }
23243     } else {
23244         Py_ssize_t stride = buf->itemsize;
23245         for (i = ndim - 1; i >= 0; i--) {
23246             memviewslice->strides[i] = stride;
23247             stride *= buf->shape[i];
23248         }
23249     }
23250     for (i = 0; i < ndim; i++) {
23251         memviewslice->shape[i]   = buf->shape[i];
23252         if (buf->suboffsets) {
23253             memviewslice->suboffsets[i] = buf->suboffsets[i];
23254         } else {
23255             memviewslice->suboffsets[i] = -1;
23256         }
23257     }
23258     memviewslice->memview = memview;
23259     memviewslice->data = (char *)buf->buf;
23260     if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
23261         Py_INCREF(memview);
23262     }
23263     retval = 0;
23264     goto no_fail;
23265 fail:
23266     memviewslice->memview = 0;
23267     memviewslice->data = 0;
23268     retval = -1;
23269 no_fail:
23270     __Pyx_RefNannyFinishContext();
23271     return retval;
23272 }
23273 #ifndef Py_NO_RETURN
23274 #define Py_NO_RETURN
23275 #endif
__pyx_fatalerror(const char * fmt,...)23276 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
23277     va_list vargs;
23278     char msg[200];
23279 #ifdef HAVE_STDARG_PROTOTYPES
23280     va_start(vargs, fmt);
23281 #else
23282     va_start(vargs);
23283 #endif
23284     vsnprintf(msg, 200, fmt, vargs);
23285     va_end(vargs);
23286     Py_FatalError(msg);
23287 }
23288 static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)23289 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
23290                                    PyThread_type_lock lock)
23291 {
23292     int result;
23293     PyThread_acquire_lock(lock, 1);
23294     result = (*acquisition_count)++;
23295     PyThread_release_lock(lock);
23296     return result;
23297 }
23298 static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)23299 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
23300                                    PyThread_type_lock lock)
23301 {
23302     int result;
23303     PyThread_acquire_lock(lock, 1);
23304     result = (*acquisition_count)--;
23305     PyThread_release_lock(lock);
23306     return result;
23307 }
23308 static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)23309 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
23310 {
23311     int first_time;
23312     struct __pyx_memoryview_obj *memview = memslice->memview;
23313     if (unlikely(!memview || (PyObject *) memview == Py_None))
23314         return;
23315     if (unlikely(__pyx_get_slice_count(memview) < 0))
23316         __pyx_fatalerror("Acquisition count is %d (line %d)",
23317                          __pyx_get_slice_count(memview), lineno);
23318     first_time = __pyx_add_acquisition_count(memview) == 0;
23319     if (unlikely(first_time)) {
23320         if (have_gil) {
23321             Py_INCREF((PyObject *) memview);
23322         } else {
23323             PyGILState_STATE _gilstate = PyGILState_Ensure();
23324             Py_INCREF((PyObject *) memview);
23325             PyGILState_Release(_gilstate);
23326         }
23327     }
23328 }
__Pyx_XDEC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)23329 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
23330                                              int have_gil, int lineno) {
23331     int last_time;
23332     struct __pyx_memoryview_obj *memview = memslice->memview;
23333     if (unlikely(!memview || (PyObject *) memview == Py_None)) {
23334         memslice->memview = NULL;
23335         return;
23336     }
23337     if (unlikely(__pyx_get_slice_count(memview) <= 0))
23338         __pyx_fatalerror("Acquisition count is %d (line %d)",
23339                          __pyx_get_slice_count(memview), lineno);
23340     last_time = __pyx_sub_acquisition_count(memview) == 1;
23341     memslice->data = NULL;
23342     if (unlikely(last_time)) {
23343         if (have_gil) {
23344             Py_CLEAR(memslice->memview);
23345         } else {
23346             PyGILState_STATE _gilstate = PyGILState_Ensure();
23347             Py_CLEAR(memslice->memview);
23348             PyGILState_Release(_gilstate);
23349         }
23350     } else {
23351         memslice->memview = NULL;
23352     }
23353 }
23354 
23355 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)23356   static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
23357     PyErr_Format(PyExc_ValueError,
23358                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
23359 }
23360 
23361 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)23362   static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
23363     PyErr_Format(PyExc_ValueError,
23364                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
23365                  index, (index == 1) ? "" : "s");
23366 }
23367 
23368 /* IterFinish */
__Pyx_IterFinish(void)23369   static CYTHON_INLINE int __Pyx_IterFinish(void) {
23370 #if CYTHON_FAST_THREAD_STATE
23371     PyThreadState *tstate = __Pyx_PyThreadState_Current;
23372     PyObject* exc_type = tstate->curexc_type;
23373     if (unlikely(exc_type)) {
23374         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
23375             PyObject *exc_value, *exc_tb;
23376             exc_value = tstate->curexc_value;
23377             exc_tb = tstate->curexc_traceback;
23378             tstate->curexc_type = 0;
23379             tstate->curexc_value = 0;
23380             tstate->curexc_traceback = 0;
23381             Py_DECREF(exc_type);
23382             Py_XDECREF(exc_value);
23383             Py_XDECREF(exc_tb);
23384             return 0;
23385         } else {
23386             return -1;
23387         }
23388     }
23389     return 0;
23390 #else
23391     if (unlikely(PyErr_Occurred())) {
23392         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
23393             PyErr_Clear();
23394             return 0;
23395         } else {
23396             return -1;
23397         }
23398     }
23399     return 0;
23400 #endif
23401 }
23402 
23403 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)23404   static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
23405     if (unlikely(retval)) {
23406         Py_DECREF(retval);
23407         __Pyx_RaiseTooManyValuesError(expected);
23408         return -1;
23409     } else {
23410         return __Pyx_IterFinish();
23411     }
23412     return 0;
23413 }
23414 
23415 /* None */
__Pyx_RaiseUnboundLocalError(const char * varname)23416   static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
23417     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
23418 }
23419 
23420 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)23421   static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
23422     PyObject *r;
23423     if (!j) return NULL;
23424     r = PyObject_GetItem(o, j);
23425     Py_DECREF(j);
23426     return r;
23427 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)23428 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
23429                                                               CYTHON_NCP_UNUSED int wraparound,
23430                                                               CYTHON_NCP_UNUSED int boundscheck) {
23431 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23432     Py_ssize_t wrapped_i = i;
23433     if (wraparound & unlikely(i < 0)) {
23434         wrapped_i += PyList_GET_SIZE(o);
23435     }
23436     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
23437         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
23438         Py_INCREF(r);
23439         return r;
23440     }
23441     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23442 #else
23443     return PySequence_GetItem(o, i);
23444 #endif
23445 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)23446 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
23447                                                               CYTHON_NCP_UNUSED int wraparound,
23448                                                               CYTHON_NCP_UNUSED int boundscheck) {
23449 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23450     Py_ssize_t wrapped_i = i;
23451     if (wraparound & unlikely(i < 0)) {
23452         wrapped_i += PyTuple_GET_SIZE(o);
23453     }
23454     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
23455         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
23456         Py_INCREF(r);
23457         return r;
23458     }
23459     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23460 #else
23461     return PySequence_GetItem(o, i);
23462 #endif
23463 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)23464 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
23465                                                      CYTHON_NCP_UNUSED int wraparound,
23466                                                      CYTHON_NCP_UNUSED int boundscheck) {
23467 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
23468     if (is_list || PyList_CheckExact(o)) {
23469         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
23470         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
23471             PyObject *r = PyList_GET_ITEM(o, n);
23472             Py_INCREF(r);
23473             return r;
23474         }
23475     }
23476     else if (PyTuple_CheckExact(o)) {
23477         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
23478         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
23479             PyObject *r = PyTuple_GET_ITEM(o, n);
23480             Py_INCREF(r);
23481             return r;
23482         }
23483     } else {
23484         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
23485         if (likely(m && m->sq_item)) {
23486             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
23487                 Py_ssize_t l = m->sq_length(o);
23488                 if (likely(l >= 0)) {
23489                     i += l;
23490                 } else {
23491                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23492                         return NULL;
23493                     PyErr_Clear();
23494                 }
23495             }
23496             return m->sq_item(o, i);
23497         }
23498     }
23499 #else
23500     if (is_list || PySequence_Check(o)) {
23501         return PySequence_GetItem(o, i);
23502     }
23503 #endif
23504     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23505 }
23506 
23507 /* ObjectGetItem */
23508   #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)23509 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
23510     PyObject *runerr;
23511     Py_ssize_t key_value;
23512     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
23513     if (unlikely(!(m && m->sq_item))) {
23514         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
23515         return NULL;
23516     }
23517     key_value = __Pyx_PyIndex_AsSsize_t(index);
23518     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
23519         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
23520     }
23521     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
23522         PyErr_Clear();
23523         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
23524     }
23525     return NULL;
23526 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)23527 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
23528     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
23529     if (likely(m && m->mp_subscript)) {
23530         return m->mp_subscript(obj, key);
23531     }
23532     return __Pyx_PyObject_GetIndex(obj, key);
23533 }
23534 #endif
23535 
23536 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,CYTHON_UNUSED int clineno,CYTHON_UNUSED int lineno,CYTHON_UNUSED const char * filename,int full_traceback,CYTHON_UNUSED int nogil)23537   static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
23538                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
23539                                   int full_traceback, CYTHON_UNUSED int nogil) {
23540     PyObject *old_exc, *old_val, *old_tb;
23541     PyObject *ctx;
23542     __Pyx_PyThreadState_declare
23543 #ifdef WITH_THREAD
23544     PyGILState_STATE state;
23545     if (nogil)
23546         state = PyGILState_Ensure();
23547 #ifdef _MSC_VER
23548     else state = (PyGILState_STATE)-1;
23549 #endif
23550 #endif
23551     __Pyx_PyThreadState_assign
23552     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
23553     if (full_traceback) {
23554         Py_XINCREF(old_exc);
23555         Py_XINCREF(old_val);
23556         Py_XINCREF(old_tb);
23557         __Pyx_ErrRestore(old_exc, old_val, old_tb);
23558         PyErr_PrintEx(1);
23559     }
23560     #if PY_MAJOR_VERSION < 3
23561     ctx = PyString_FromString(name);
23562     #else
23563     ctx = PyUnicode_FromString(name);
23564     #endif
23565     __Pyx_ErrRestore(old_exc, old_val, old_tb);
23566     if (!ctx) {
23567         PyErr_WriteUnraisable(Py_None);
23568     } else {
23569         PyErr_WriteUnraisable(ctx);
23570         Py_DECREF(ctx);
23571     }
23572 #ifdef WITH_THREAD
23573     if (nogil)
23574         PyGILState_Release(state);
23575 #endif
23576 }
23577 
23578 /* GetTopmostException */
23579   #if CYTHON_USE_EXC_INFO_STACK
23580 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)23581 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
23582 {
23583     _PyErr_StackItem *exc_info = tstate->exc_info;
23584     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
23585            exc_info->previous_item != NULL)
23586     {
23587         exc_info = exc_info->previous_item;
23588     }
23589     return exc_info;
23590 }
23591 #endif
23592 
23593 /* SaveResetException */
23594   #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)23595 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23596     #if CYTHON_USE_EXC_INFO_STACK
23597     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
23598     *type = exc_info->exc_type;
23599     *value = exc_info->exc_value;
23600     *tb = exc_info->exc_traceback;
23601     #else
23602     *type = tstate->exc_type;
23603     *value = tstate->exc_value;
23604     *tb = tstate->exc_traceback;
23605     #endif
23606     Py_XINCREF(*type);
23607     Py_XINCREF(*value);
23608     Py_XINCREF(*tb);
23609 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)23610 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
23611     PyObject *tmp_type, *tmp_value, *tmp_tb;
23612     #if CYTHON_USE_EXC_INFO_STACK
23613     _PyErr_StackItem *exc_info = tstate->exc_info;
23614     tmp_type = exc_info->exc_type;
23615     tmp_value = exc_info->exc_value;
23616     tmp_tb = exc_info->exc_traceback;
23617     exc_info->exc_type = type;
23618     exc_info->exc_value = value;
23619     exc_info->exc_traceback = tb;
23620     #else
23621     tmp_type = tstate->exc_type;
23622     tmp_value = tstate->exc_value;
23623     tmp_tb = tstate->exc_traceback;
23624     tstate->exc_type = type;
23625     tstate->exc_value = value;
23626     tstate->exc_traceback = tb;
23627     #endif
23628     Py_XDECREF(tmp_type);
23629     Py_XDECREF(tmp_value);
23630     Py_XDECREF(tmp_tb);
23631 }
23632 #endif
23633 
23634 /* PyErrExceptionMatches */
23635   #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)23636 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
23637     Py_ssize_t i, n;
23638     n = PyTuple_GET_SIZE(tuple);
23639 #if PY_MAJOR_VERSION >= 3
23640     for (i=0; i<n; i++) {
23641         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
23642     }
23643 #endif
23644     for (i=0; i<n; i++) {
23645         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
23646     }
23647     return 0;
23648 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)23649 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
23650     PyObject *exc_type = tstate->curexc_type;
23651     if (exc_type == err) return 1;
23652     if (unlikely(!exc_type)) return 0;
23653     if (unlikely(PyTuple_Check(err)))
23654         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
23655     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
23656 }
23657 #endif
23658 
23659 /* GetException */
23660   #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)23661 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
23662 #else
23663 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
23664 #endif
23665 {
23666     PyObject *local_type, *local_value, *local_tb;
23667 #if CYTHON_FAST_THREAD_STATE
23668     PyObject *tmp_type, *tmp_value, *tmp_tb;
23669     local_type = tstate->curexc_type;
23670     local_value = tstate->curexc_value;
23671     local_tb = tstate->curexc_traceback;
23672     tstate->curexc_type = 0;
23673     tstate->curexc_value = 0;
23674     tstate->curexc_traceback = 0;
23675 #else
23676     PyErr_Fetch(&local_type, &local_value, &local_tb);
23677 #endif
23678     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
23679 #if CYTHON_FAST_THREAD_STATE
23680     if (unlikely(tstate->curexc_type))
23681 #else
23682     if (unlikely(PyErr_Occurred()))
23683 #endif
23684         goto bad;
23685     #if PY_MAJOR_VERSION >= 3
23686     if (local_tb) {
23687         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
23688             goto bad;
23689     }
23690     #endif
23691     Py_XINCREF(local_tb);
23692     Py_XINCREF(local_type);
23693     Py_XINCREF(local_value);
23694     *type = local_type;
23695     *value = local_value;
23696     *tb = local_tb;
23697 #if CYTHON_FAST_THREAD_STATE
23698     #if CYTHON_USE_EXC_INFO_STACK
23699     {
23700         _PyErr_StackItem *exc_info = tstate->exc_info;
23701         tmp_type = exc_info->exc_type;
23702         tmp_value = exc_info->exc_value;
23703         tmp_tb = exc_info->exc_traceback;
23704         exc_info->exc_type = local_type;
23705         exc_info->exc_value = local_value;
23706         exc_info->exc_traceback = local_tb;
23707     }
23708     #else
23709     tmp_type = tstate->exc_type;
23710     tmp_value = tstate->exc_value;
23711     tmp_tb = tstate->exc_traceback;
23712     tstate->exc_type = local_type;
23713     tstate->exc_value = local_value;
23714     tstate->exc_traceback = local_tb;
23715     #endif
23716     Py_XDECREF(tmp_type);
23717     Py_XDECREF(tmp_value);
23718     Py_XDECREF(tmp_tb);
23719 #else
23720     PyErr_SetExcInfo(local_type, local_value, local_tb);
23721 #endif
23722     return 0;
23723 bad:
23724     *type = 0;
23725     *value = 0;
23726     *tb = 0;
23727     Py_XDECREF(local_type);
23728     Py_XDECREF(local_value);
23729     Py_XDECREF(local_tb);
23730     return -1;
23731 }
23732 
23733 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)23734   static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
23735 #if CYTHON_COMPILING_IN_PYPY
23736     return PyObject_RichCompareBool(s1, s2, equals);
23737 #else
23738     if (s1 == s2) {
23739         return (equals == Py_EQ);
23740     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
23741         const char *ps1, *ps2;
23742         Py_ssize_t length = PyBytes_GET_SIZE(s1);
23743         if (length != PyBytes_GET_SIZE(s2))
23744             return (equals == Py_NE);
23745         ps1 = PyBytes_AS_STRING(s1);
23746         ps2 = PyBytes_AS_STRING(s2);
23747         if (ps1[0] != ps2[0]) {
23748             return (equals == Py_NE);
23749         } else if (length == 1) {
23750             return (equals == Py_EQ);
23751         } else {
23752             int result;
23753 #if CYTHON_USE_UNICODE_INTERNALS
23754             Py_hash_t hash1, hash2;
23755             hash1 = ((PyBytesObject*)s1)->ob_shash;
23756             hash2 = ((PyBytesObject*)s2)->ob_shash;
23757             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
23758                 return (equals == Py_NE);
23759             }
23760 #endif
23761             result = memcmp(ps1, ps2, (size_t)length);
23762             return (equals == Py_EQ) ? (result == 0) : (result != 0);
23763         }
23764     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
23765         return (equals == Py_NE);
23766     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
23767         return (equals == Py_NE);
23768     } else {
23769         int result;
23770         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
23771         if (!py_result)
23772             return -1;
23773         result = __Pyx_PyObject_IsTrue(py_result);
23774         Py_DECREF(py_result);
23775         return result;
23776     }
23777 #endif
23778 }
23779 
23780 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)23781   static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
23782 #if CYTHON_COMPILING_IN_PYPY
23783     return PyObject_RichCompareBool(s1, s2, equals);
23784 #else
23785 #if PY_MAJOR_VERSION < 3
23786     PyObject* owned_ref = NULL;
23787 #endif
23788     int s1_is_unicode, s2_is_unicode;
23789     if (s1 == s2) {
23790         goto return_eq;
23791     }
23792     s1_is_unicode = PyUnicode_CheckExact(s1);
23793     s2_is_unicode = PyUnicode_CheckExact(s2);
23794 #if PY_MAJOR_VERSION < 3
23795     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
23796         owned_ref = PyUnicode_FromObject(s2);
23797         if (unlikely(!owned_ref))
23798             return -1;
23799         s2 = owned_ref;
23800         s2_is_unicode = 1;
23801     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
23802         owned_ref = PyUnicode_FromObject(s1);
23803         if (unlikely(!owned_ref))
23804             return -1;
23805         s1 = owned_ref;
23806         s1_is_unicode = 1;
23807     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
23808         return __Pyx_PyBytes_Equals(s1, s2, equals);
23809     }
23810 #endif
23811     if (s1_is_unicode & s2_is_unicode) {
23812         Py_ssize_t length;
23813         int kind;
23814         void *data1, *data2;
23815         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
23816             return -1;
23817         length = __Pyx_PyUnicode_GET_LENGTH(s1);
23818         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
23819             goto return_ne;
23820         }
23821 #if CYTHON_USE_UNICODE_INTERNALS
23822         {
23823             Py_hash_t hash1, hash2;
23824         #if CYTHON_PEP393_ENABLED
23825             hash1 = ((PyASCIIObject*)s1)->hash;
23826             hash2 = ((PyASCIIObject*)s2)->hash;
23827         #else
23828             hash1 = ((PyUnicodeObject*)s1)->hash;
23829             hash2 = ((PyUnicodeObject*)s2)->hash;
23830         #endif
23831             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
23832                 goto return_ne;
23833             }
23834         }
23835 #endif
23836         kind = __Pyx_PyUnicode_KIND(s1);
23837         if (kind != __Pyx_PyUnicode_KIND(s2)) {
23838             goto return_ne;
23839         }
23840         data1 = __Pyx_PyUnicode_DATA(s1);
23841         data2 = __Pyx_PyUnicode_DATA(s2);
23842         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
23843             goto return_ne;
23844         } else if (length == 1) {
23845             goto return_eq;
23846         } else {
23847             int result = memcmp(data1, data2, (size_t)(length * kind));
23848             #if PY_MAJOR_VERSION < 3
23849             Py_XDECREF(owned_ref);
23850             #endif
23851             return (equals == Py_EQ) ? (result == 0) : (result != 0);
23852         }
23853     } else if ((s1 == Py_None) & s2_is_unicode) {
23854         goto return_ne;
23855     } else if ((s2 == Py_None) & s1_is_unicode) {
23856         goto return_ne;
23857     } else {
23858         int result;
23859         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
23860         #if PY_MAJOR_VERSION < 3
23861         Py_XDECREF(owned_ref);
23862         #endif
23863         if (!py_result)
23864             return -1;
23865         result = __Pyx_PyObject_IsTrue(py_result);
23866         Py_DECREF(py_result);
23867         return result;
23868     }
23869 return_eq:
23870     #if PY_MAJOR_VERSION < 3
23871     Py_XDECREF(owned_ref);
23872     #endif
23873     return (equals == Py_EQ);
23874 return_ne:
23875     #if PY_MAJOR_VERSION < 3
23876     Py_XDECREF(owned_ref);
23877     #endif
23878     return (equals == Py_NE);
23879 #endif
23880 }
23881 
23882 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)23883   static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
23884 #if CYTHON_USE_TYPE_SLOTS
23885 #if PY_MAJOR_VERSION >= 3
23886     if (likely(PyUnicode_Check(n)))
23887 #else
23888     if (likely(PyString_Check(n)))
23889 #endif
23890         return __Pyx_PyObject_GetAttrStr(o, n);
23891 #endif
23892     return PyObject_GetAttr(o, n);
23893 }
23894 
23895 /* decode_c_string */
__Pyx_decode_c_string(const char * cstring,Py_ssize_t start,Py_ssize_t stop,const char * encoding,const char * errors,PyObject * (* decode_func)(const char * s,Py_ssize_t size,const char * errors))23896   static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
23897          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
23898          const char* encoding, const char* errors,
23899          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
23900     Py_ssize_t length;
23901     if (unlikely((start < 0) | (stop < 0))) {
23902         size_t slen = strlen(cstring);
23903         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
23904             PyErr_SetString(PyExc_OverflowError,
23905                             "c-string too long to convert to Python");
23906             return NULL;
23907         }
23908         length = (Py_ssize_t) slen;
23909         if (start < 0) {
23910             start += length;
23911             if (start < 0)
23912                 start = 0;
23913         }
23914         if (stop < 0)
23915             stop += length;
23916     }
23917     if (unlikely(stop <= start))
23918         return __Pyx_NewRef(__pyx_empty_unicode);
23919     length = stop - start;
23920     cstring += start;
23921     if (decode_func) {
23922         return decode_func(cstring, length, errors);
23923     } else {
23924         return PyUnicode_Decode(cstring, length, encoding, errors);
23925     }
23926 }
23927 
23928 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)23929   static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
23930     __Pyx_PyThreadState_declare
23931     __Pyx_PyThreadState_assign
23932     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
23933         return NULL;
23934     __Pyx_PyErr_Clear();
23935     Py_INCREF(d);
23936     return d;
23937 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)23938 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
23939     PyObject *r = __Pyx_GetAttr(o, n);
23940     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
23941 }
23942 
23943 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)23944   static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
23945     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
23946 }
23947 
23948 /* SwapException */
23949   #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)23950 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23951     PyObject *tmp_type, *tmp_value, *tmp_tb;
23952     #if CYTHON_USE_EXC_INFO_STACK
23953     _PyErr_StackItem *exc_info = tstate->exc_info;
23954     tmp_type = exc_info->exc_type;
23955     tmp_value = exc_info->exc_value;
23956     tmp_tb = exc_info->exc_traceback;
23957     exc_info->exc_type = *type;
23958     exc_info->exc_value = *value;
23959     exc_info->exc_traceback = *tb;
23960     #else
23961     tmp_type = tstate->exc_type;
23962     tmp_value = tstate->exc_value;
23963     tmp_tb = tstate->exc_traceback;
23964     tstate->exc_type = *type;
23965     tstate->exc_value = *value;
23966     tstate->exc_traceback = *tb;
23967     #endif
23968     *type = tmp_type;
23969     *value = tmp_value;
23970     *tb = tmp_tb;
23971 }
23972 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)23973 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
23974     PyObject *tmp_type, *tmp_value, *tmp_tb;
23975     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
23976     PyErr_SetExcInfo(*type, *value, *tb);
23977     *type = tmp_type;
23978     *value = tmp_value;
23979     *tb = tmp_tb;
23980 }
23981 #endif
23982 
23983 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)23984   static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
23985     PyObject *empty_list = 0;
23986     PyObject *module = 0;
23987     PyObject *global_dict = 0;
23988     PyObject *empty_dict = 0;
23989     PyObject *list;
23990     #if PY_MAJOR_VERSION < 3
23991     PyObject *py_import;
23992     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
23993     if (!py_import)
23994         goto bad;
23995     #endif
23996     if (from_list)
23997         list = from_list;
23998     else {
23999         empty_list = PyList_New(0);
24000         if (!empty_list)
24001             goto bad;
24002         list = empty_list;
24003     }
24004     global_dict = PyModule_GetDict(__pyx_m);
24005     if (!global_dict)
24006         goto bad;
24007     empty_dict = PyDict_New();
24008     if (!empty_dict)
24009         goto bad;
24010     {
24011         #if PY_MAJOR_VERSION >= 3
24012         if (level == -1) {
24013             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
24014                 module = PyImport_ImportModuleLevelObject(
24015                     name, global_dict, empty_dict, list, 1);
24016                 if (!module) {
24017                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
24018                         goto bad;
24019                     PyErr_Clear();
24020                 }
24021             }
24022             level = 0;
24023         }
24024         #endif
24025         if (!module) {
24026             #if PY_MAJOR_VERSION < 3
24027             PyObject *py_level = PyInt_FromLong(level);
24028             if (!py_level)
24029                 goto bad;
24030             module = PyObject_CallFunctionObjArgs(py_import,
24031                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
24032             Py_DECREF(py_level);
24033             #else
24034             module = PyImport_ImportModuleLevelObject(
24035                 name, global_dict, empty_dict, list, level);
24036             #endif
24037         }
24038     }
24039 bad:
24040     #if PY_MAJOR_VERSION < 3
24041     Py_XDECREF(py_import);
24042     #endif
24043     Py_XDECREF(empty_list);
24044     Py_XDECREF(empty_dict);
24045     return module;
24046 }
24047 
24048 /* FastTypeChecks */
24049   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)24050 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
24051     while (a) {
24052         a = a->tp_base;
24053         if (a == b)
24054             return 1;
24055     }
24056     return b == &PyBaseObject_Type;
24057 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)24058 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
24059     PyObject *mro;
24060     if (a == b) return 1;
24061     mro = a->tp_mro;
24062     if (likely(mro)) {
24063         Py_ssize_t i, n;
24064         n = PyTuple_GET_SIZE(mro);
24065         for (i = 0; i < n; i++) {
24066             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
24067                 return 1;
24068         }
24069         return 0;
24070     }
24071     return __Pyx_InBases(a, b);
24072 }
24073 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)24074 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
24075     PyObject *exception, *value, *tb;
24076     int res;
24077     __Pyx_PyThreadState_declare
24078     __Pyx_PyThreadState_assign
24079     __Pyx_ErrFetch(&exception, &value, &tb);
24080     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
24081     if (unlikely(res == -1)) {
24082         PyErr_WriteUnraisable(err);
24083         res = 0;
24084     }
24085     if (!res) {
24086         res = PyObject_IsSubclass(err, exc_type2);
24087         if (unlikely(res == -1)) {
24088             PyErr_WriteUnraisable(err);
24089             res = 0;
24090         }
24091     }
24092     __Pyx_ErrRestore(exception, value, tb);
24093     return res;
24094 }
24095 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)24096 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
24097     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
24098     if (!res) {
24099         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
24100     }
24101     return res;
24102 }
24103 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)24104 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24105     Py_ssize_t i, n;
24106     assert(PyExceptionClass_Check(exc_type));
24107     n = PyTuple_GET_SIZE(tuple);
24108 #if PY_MAJOR_VERSION >= 3
24109     for (i=0; i<n; i++) {
24110         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
24111     }
24112 #endif
24113     for (i=0; i<n; i++) {
24114         PyObject *t = PyTuple_GET_ITEM(tuple, i);
24115         #if PY_MAJOR_VERSION < 3
24116         if (likely(exc_type == t)) return 1;
24117         #endif
24118         if (likely(PyExceptionClass_Check(t))) {
24119             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
24120         } else {
24121         }
24122     }
24123     return 0;
24124 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)24125 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
24126     if (likely(err == exc_type)) return 1;
24127     if (likely(PyExceptionClass_Check(err))) {
24128         if (likely(PyExceptionClass_Check(exc_type))) {
24129             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
24130         } else if (likely(PyTuple_Check(exc_type))) {
24131             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
24132         } else {
24133         }
24134     }
24135     return PyErr_GivenExceptionMatches(err, exc_type);
24136 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)24137 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
24138     assert(PyExceptionClass_Check(exc_type1));
24139     assert(PyExceptionClass_Check(exc_type2));
24140     if (likely(err == exc_type1 || err == exc_type2)) return 1;
24141     if (likely(PyExceptionClass_Check(err))) {
24142         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
24143     }
24144     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
24145 }
24146 #endif
24147 
24148 /* PyIntBinop */
24149   #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)24150 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
24151     (void)inplace;
24152     (void)zerodivision_check;
24153     #if PY_MAJOR_VERSION < 3
24154     if (likely(PyInt_CheckExact(op1))) {
24155         const long b = intval;
24156         long x;
24157         long a = PyInt_AS_LONG(op1);
24158             x = (long)((unsigned long)a + b);
24159             if (likely((x^a) >= 0 || (x^b) >= 0))
24160                 return PyInt_FromLong(x);
24161             return PyLong_Type.tp_as_number->nb_add(op1, op2);
24162     }
24163     #endif
24164     #if CYTHON_USE_PYLONG_INTERNALS
24165     if (likely(PyLong_CheckExact(op1))) {
24166         const long b = intval;
24167         long a, x;
24168 #ifdef HAVE_LONG_LONG
24169         const PY_LONG_LONG llb = intval;
24170         PY_LONG_LONG lla, llx;
24171 #endif
24172         const digit* digits = ((PyLongObject*)op1)->ob_digit;
24173         const Py_ssize_t size = Py_SIZE(op1);
24174         if (likely(__Pyx_sst_abs(size) <= 1)) {
24175             a = likely(size) ? digits[0] : 0;
24176             if (size == -1) a = -a;
24177         } else {
24178             switch (size) {
24179                 case -2:
24180                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
24181                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24182                         break;
24183 #ifdef HAVE_LONG_LONG
24184                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24185                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
24186                         goto long_long;
24187 #endif
24188                     }
24189                     CYTHON_FALLTHROUGH;
24190                 case 2:
24191                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
24192                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24193                         break;
24194 #ifdef HAVE_LONG_LONG
24195                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24196                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
24197                         goto long_long;
24198 #endif
24199                     }
24200                     CYTHON_FALLTHROUGH;
24201                 case -3:
24202                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
24203                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24204                         break;
24205 #ifdef HAVE_LONG_LONG
24206                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24207                         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]));
24208                         goto long_long;
24209 #endif
24210                     }
24211                     CYTHON_FALLTHROUGH;
24212                 case 3:
24213                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
24214                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24215                         break;
24216 #ifdef HAVE_LONG_LONG
24217                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24218                         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]));
24219                         goto long_long;
24220 #endif
24221                     }
24222                     CYTHON_FALLTHROUGH;
24223                 case -4:
24224                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
24225                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24226                         break;
24227 #ifdef HAVE_LONG_LONG
24228                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24229                         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]));
24230                         goto long_long;
24231 #endif
24232                     }
24233                     CYTHON_FALLTHROUGH;
24234                 case 4:
24235                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
24236                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24237                         break;
24238 #ifdef HAVE_LONG_LONG
24239                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24240                         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]));
24241                         goto long_long;
24242 #endif
24243                     }
24244                     CYTHON_FALLTHROUGH;
24245                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
24246             }
24247         }
24248                 x = a + b;
24249             return PyLong_FromLong(x);
24250 #ifdef HAVE_LONG_LONG
24251         long_long:
24252                 llx = lla + llb;
24253             return PyLong_FromLongLong(llx);
24254 #endif
24255 
24256 
24257     }
24258     #endif
24259     if (PyFloat_CheckExact(op1)) {
24260         const long b = intval;
24261         double a = PyFloat_AS_DOUBLE(op1);
24262             double result;
24263             PyFPE_START_PROTECT("add", return NULL)
24264             result = ((double)a) + (double)b;
24265             PyFPE_END_PROTECT(result)
24266             return PyFloat_FromDouble(result);
24267     }
24268     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
24269 }
24270 #endif
24271 
24272 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)24273   static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
24274     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
24275     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
24276         PyErr_Format(PyExc_ImportError,
24277         #if PY_MAJOR_VERSION < 3
24278             "cannot import name %.230s", PyString_AS_STRING(name));
24279         #else
24280             "cannot import name %S", name);
24281         #endif
24282     }
24283     return value;
24284 }
24285 
24286 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)24287   static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
24288     PyObject *r;
24289     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
24290         PyErr_SetString(PyExc_TypeError,
24291                         "hasattr(): attribute name must be string");
24292         return -1;
24293     }
24294     r = __Pyx_GetAttr(o, n);
24295     if (unlikely(!r)) {
24296         PyErr_Clear();
24297         return 0;
24298     } else {
24299         Py_DECREF(r);
24300         return 1;
24301     }
24302 }
24303 
24304 /* PyObject_GenericGetAttrNoDict */
24305   #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)24306 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
24307     PyErr_Format(PyExc_AttributeError,
24308 #if PY_MAJOR_VERSION >= 3
24309                  "'%.50s' object has no attribute '%U'",
24310                  tp->tp_name, attr_name);
24311 #else
24312                  "'%.50s' object has no attribute '%.400s'",
24313                  tp->tp_name, PyString_AS_STRING(attr_name));
24314 #endif
24315     return NULL;
24316 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)24317 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
24318     PyObject *descr;
24319     PyTypeObject *tp = Py_TYPE(obj);
24320     if (unlikely(!PyString_Check(attr_name))) {
24321         return PyObject_GenericGetAttr(obj, attr_name);
24322     }
24323     assert(!tp->tp_dictoffset);
24324     descr = _PyType_Lookup(tp, attr_name);
24325     if (unlikely(!descr)) {
24326         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
24327     }
24328     Py_INCREF(descr);
24329     #if PY_MAJOR_VERSION < 3
24330     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
24331     #endif
24332     {
24333         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
24334         if (unlikely(f)) {
24335             PyObject *res = f(descr, obj, (PyObject *)tp);
24336             Py_DECREF(descr);
24337             return res;
24338         }
24339     }
24340     return descr;
24341 }
24342 #endif
24343 
24344 /* PyObject_GenericGetAttr */
24345   #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)24346 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
24347     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
24348         return PyObject_GenericGetAttr(obj, attr_name);
24349     }
24350     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
24351 }
24352 #endif
24353 
24354 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)24355   static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
24356 #if PY_VERSION_HEX >= 0x02070000
24357     PyObject *ob = PyCapsule_New(vtable, 0, 0);
24358 #else
24359     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
24360 #endif
24361     if (!ob)
24362         goto bad;
24363     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
24364         goto bad;
24365     Py_DECREF(ob);
24366     return 0;
24367 bad:
24368     Py_XDECREF(ob);
24369     return -1;
24370 }
24371 
24372 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)24373   static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
24374     __Pyx_PyThreadState_declare
24375     __Pyx_PyThreadState_assign
24376     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
24377         __Pyx_PyErr_Clear();
24378 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)24379 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
24380     PyObject *result;
24381 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
24382     PyTypeObject* tp = Py_TYPE(obj);
24383     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
24384         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
24385     }
24386 #endif
24387     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
24388     if (unlikely(!result)) {
24389         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
24390     }
24391     return result;
24392 }
24393 
24394 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)24395   static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
24396   int ret;
24397   PyObject *name_attr;
24398   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
24399   if (likely(name_attr)) {
24400       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
24401   } else {
24402       ret = -1;
24403   }
24404   if (unlikely(ret < 0)) {
24405       PyErr_Clear();
24406       ret = 0;
24407   }
24408   Py_XDECREF(name_attr);
24409   return ret;
24410 }
__Pyx_setup_reduce(PyObject * type_obj)24411 static int __Pyx_setup_reduce(PyObject* type_obj) {
24412     int ret = 0;
24413     PyObject *object_reduce = NULL;
24414     PyObject *object_reduce_ex = NULL;
24415     PyObject *reduce = NULL;
24416     PyObject *reduce_ex = NULL;
24417     PyObject *reduce_cython = NULL;
24418     PyObject *setstate = NULL;
24419     PyObject *setstate_cython = NULL;
24420 #if CYTHON_USE_PYTYPE_LOOKUP
24421     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
24422 #else
24423     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
24424 #endif
24425 #if CYTHON_USE_PYTYPE_LOOKUP
24426     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
24427 #else
24428     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
24429 #endif
24430     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
24431     if (reduce_ex == object_reduce_ex) {
24432 #if CYTHON_USE_PYTYPE_LOOKUP
24433         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
24434 #else
24435         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
24436 #endif
24437         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
24438         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
24439             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
24440             if (likely(reduce_cython)) {
24441                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
24442                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
24443             } else if (reduce == object_reduce || PyErr_Occurred()) {
24444                 goto __PYX_BAD;
24445             }
24446             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
24447             if (!setstate) PyErr_Clear();
24448             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
24449                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
24450                 if (likely(setstate_cython)) {
24451                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
24452                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
24453                 } else if (!setstate || PyErr_Occurred()) {
24454                     goto __PYX_BAD;
24455                 }
24456             }
24457             PyType_Modified((PyTypeObject*)type_obj);
24458         }
24459     }
24460     goto __PYX_GOOD;
24461 __PYX_BAD:
24462     if (!PyErr_Occurred())
24463         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
24464     ret = -1;
24465 __PYX_GOOD:
24466 #if !CYTHON_USE_PYTYPE_LOOKUP
24467     Py_XDECREF(object_reduce);
24468     Py_XDECREF(object_reduce_ex);
24469 #endif
24470     Py_XDECREF(reduce);
24471     Py_XDECREF(reduce_ex);
24472     Py_XDECREF(reduce_cython);
24473     Py_XDECREF(setstate);
24474     Py_XDECREF(setstate_cython);
24475     return ret;
24476 }
24477 
24478 /* TypeImport */
24479   #ifndef __PYX_HAVE_RT_ImportType
24480 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)24481 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
24482     size_t size, enum __Pyx_ImportType_CheckSize check_size)
24483 {
24484     PyObject *result = 0;
24485     char warning[200];
24486     Py_ssize_t basicsize;
24487 #ifdef Py_LIMITED_API
24488     PyObject *py_basicsize;
24489 #endif
24490     result = PyObject_GetAttrString(module, class_name);
24491     if (!result)
24492         goto bad;
24493     if (!PyType_Check(result)) {
24494         PyErr_Format(PyExc_TypeError,
24495             "%.200s.%.200s is not a type object",
24496             module_name, class_name);
24497         goto bad;
24498     }
24499 #ifndef Py_LIMITED_API
24500     basicsize = ((PyTypeObject *)result)->tp_basicsize;
24501 #else
24502     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
24503     if (!py_basicsize)
24504         goto bad;
24505     basicsize = PyLong_AsSsize_t(py_basicsize);
24506     Py_DECREF(py_basicsize);
24507     py_basicsize = 0;
24508     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
24509         goto bad;
24510 #endif
24511     if ((size_t)basicsize < size) {
24512         PyErr_Format(PyExc_ValueError,
24513             "%.200s.%.200s size changed, may indicate binary incompatibility. "
24514             "Expected %zd from C header, got %zd from PyObject",
24515             module_name, class_name, size, basicsize);
24516         goto bad;
24517     }
24518     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
24519         PyErr_Format(PyExc_ValueError,
24520             "%.200s.%.200s size changed, may indicate binary incompatibility. "
24521             "Expected %zd from C header, got %zd from PyObject",
24522             module_name, class_name, size, basicsize);
24523         goto bad;
24524     }
24525     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
24526         PyOS_snprintf(warning, sizeof(warning),
24527             "%s.%s size changed, may indicate binary incompatibility. "
24528             "Expected %zd from C header, got %zd from PyObject",
24529             module_name, class_name, size, basicsize);
24530         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
24531     }
24532     return (PyTypeObject *)result;
24533 bad:
24534     Py_XDECREF(result);
24535     return NULL;
24536 }
24537 #endif
24538 
24539 /* CLineInTraceback */
24540   #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)24541 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
24542     PyObject *use_cline;
24543     PyObject *ptype, *pvalue, *ptraceback;
24544 #if CYTHON_COMPILING_IN_CPYTHON
24545     PyObject **cython_runtime_dict;
24546 #endif
24547     if (unlikely(!__pyx_cython_runtime)) {
24548         return c_line;
24549     }
24550     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
24551 #if CYTHON_COMPILING_IN_CPYTHON
24552     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
24553     if (likely(cython_runtime_dict)) {
24554         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
24555             use_cline, *cython_runtime_dict,
24556             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
24557     } else
24558 #endif
24559     {
24560       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
24561       if (use_cline_obj) {
24562         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
24563         Py_DECREF(use_cline_obj);
24564       } else {
24565         PyErr_Clear();
24566         use_cline = NULL;
24567       }
24568     }
24569     if (!use_cline) {
24570         c_line = 0;
24571         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
24572     }
24573     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
24574         c_line = 0;
24575     }
24576     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
24577     return c_line;
24578 }
24579 #endif
24580 
24581 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)24582   static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
24583     int start = 0, mid = 0, end = count - 1;
24584     if (end >= 0 && code_line > entries[end].code_line) {
24585         return count;
24586     }
24587     while (start < end) {
24588         mid = start + (end - start) / 2;
24589         if (code_line < entries[mid].code_line) {
24590             end = mid;
24591         } else if (code_line > entries[mid].code_line) {
24592              start = mid + 1;
24593         } else {
24594             return mid;
24595         }
24596     }
24597     if (code_line <= entries[mid].code_line) {
24598         return mid;
24599     } else {
24600         return mid + 1;
24601     }
24602 }
__pyx_find_code_object(int code_line)24603 static PyCodeObject *__pyx_find_code_object(int code_line) {
24604     PyCodeObject* code_object;
24605     int pos;
24606     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
24607         return NULL;
24608     }
24609     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
24610     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
24611         return NULL;
24612     }
24613     code_object = __pyx_code_cache.entries[pos].code_object;
24614     Py_INCREF(code_object);
24615     return code_object;
24616 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)24617 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
24618     int pos, i;
24619     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
24620     if (unlikely(!code_line)) {
24621         return;
24622     }
24623     if (unlikely(!entries)) {
24624         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
24625         if (likely(entries)) {
24626             __pyx_code_cache.entries = entries;
24627             __pyx_code_cache.max_count = 64;
24628             __pyx_code_cache.count = 1;
24629             entries[0].code_line = code_line;
24630             entries[0].code_object = code_object;
24631             Py_INCREF(code_object);
24632         }
24633         return;
24634     }
24635     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
24636     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
24637         PyCodeObject* tmp = entries[pos].code_object;
24638         entries[pos].code_object = code_object;
24639         Py_DECREF(tmp);
24640         return;
24641     }
24642     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
24643         int new_max = __pyx_code_cache.max_count + 64;
24644         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
24645             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
24646         if (unlikely(!entries)) {
24647             return;
24648         }
24649         __pyx_code_cache.entries = entries;
24650         __pyx_code_cache.max_count = new_max;
24651     }
24652     for (i=__pyx_code_cache.count; i>pos; i--) {
24653         entries[i] = entries[i-1];
24654     }
24655     entries[pos].code_line = code_line;
24656     entries[pos].code_object = code_object;
24657     __pyx_code_cache.count++;
24658     Py_INCREF(code_object);
24659 }
24660 
24661 /* AddTraceback */
24662   #include "compile.h"
24663 #include "frameobject.h"
24664 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)24665 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
24666             const char *funcname, int c_line,
24667             int py_line, const char *filename) {
24668     PyCodeObject *py_code = 0;
24669     PyObject *py_srcfile = 0;
24670     PyObject *py_funcname = 0;
24671     #if PY_MAJOR_VERSION < 3
24672     py_srcfile = PyString_FromString(filename);
24673     #else
24674     py_srcfile = PyUnicode_FromString(filename);
24675     #endif
24676     if (!py_srcfile) goto bad;
24677     if (c_line) {
24678         #if PY_MAJOR_VERSION < 3
24679         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
24680         #else
24681         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
24682         #endif
24683     }
24684     else {
24685         #if PY_MAJOR_VERSION < 3
24686         py_funcname = PyString_FromString(funcname);
24687         #else
24688         py_funcname = PyUnicode_FromString(funcname);
24689         #endif
24690     }
24691     if (!py_funcname) goto bad;
24692     py_code = __Pyx_PyCode_New(
24693         0,
24694         0,
24695         0,
24696         0,
24697         0,
24698         __pyx_empty_bytes, /*PyObject *code,*/
24699         __pyx_empty_tuple, /*PyObject *consts,*/
24700         __pyx_empty_tuple, /*PyObject *names,*/
24701         __pyx_empty_tuple, /*PyObject *varnames,*/
24702         __pyx_empty_tuple, /*PyObject *freevars,*/
24703         __pyx_empty_tuple, /*PyObject *cellvars,*/
24704         py_srcfile,   /*PyObject *filename,*/
24705         py_funcname,  /*PyObject *name,*/
24706         py_line,
24707         __pyx_empty_bytes  /*PyObject *lnotab*/
24708     );
24709     Py_DECREF(py_srcfile);
24710     Py_DECREF(py_funcname);
24711     return py_code;
24712 bad:
24713     Py_XDECREF(py_srcfile);
24714     Py_XDECREF(py_funcname);
24715     return NULL;
24716 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)24717 static void __Pyx_AddTraceback(const char *funcname, int c_line,
24718                                int py_line, const char *filename) {
24719     PyCodeObject *py_code = 0;
24720     PyFrameObject *py_frame = 0;
24721     PyThreadState *tstate = __Pyx_PyThreadState_Current;
24722     if (c_line) {
24723         c_line = __Pyx_CLineForTraceback(tstate, c_line);
24724     }
24725     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
24726     if (!py_code) {
24727         py_code = __Pyx_CreateCodeObjectForTraceback(
24728             funcname, c_line, py_line, filename);
24729         if (!py_code) goto bad;
24730         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
24731     }
24732     py_frame = PyFrame_New(
24733         tstate,            /*PyThreadState *tstate,*/
24734         py_code,           /*PyCodeObject *code,*/
24735         __pyx_d,    /*PyObject *globals,*/
24736         0                  /*PyObject *locals*/
24737     );
24738     if (!py_frame) goto bad;
24739     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
24740     PyTraceBack_Here(py_frame);
24741 bad:
24742     Py_XDECREF(py_code);
24743     Py_XDECREF(py_frame);
24744 }
24745 
24746 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)24747 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
24748     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
24749         if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
24750         if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
24751     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
24752     return -1;
24753 }
__Pyx_ReleaseBuffer(Py_buffer * view)24754 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
24755     PyObject *obj = view->obj;
24756     if (!obj) return;
24757     if (PyObject_CheckBuffer(obj)) {
24758         PyBuffer_Release(view);
24759         return;
24760     }
24761     if ((0)) {}
24762     view->obj = NULL;
24763     Py_DECREF(obj);
24764 }
24765 #endif
24766 
24767 
24768   /* MemviewSliceIsContig */
24769   static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs,char order,int ndim)24770 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
24771 {
24772     int i, index, step, start;
24773     Py_ssize_t itemsize = mvs.memview->view.itemsize;
24774     if (order == 'F') {
24775         step = 1;
24776         start = 0;
24777     } else {
24778         step = -1;
24779         start = ndim - 1;
24780     }
24781     for (i = 0; i < ndim; i++) {
24782         index = start + step * i;
24783         if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
24784             return 0;
24785         itemsize *= mvs.shape[index];
24786     }
24787     return 1;
24788 }
24789 
24790 /* OverlappingSlices */
24791   static void
__pyx_get_array_memory_extents(__Pyx_memviewslice * slice,void ** out_start,void ** out_end,int ndim,size_t itemsize)24792 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
24793                                void **out_start, void **out_end,
24794                                int ndim, size_t itemsize)
24795 {
24796     char *start, *end;
24797     int i;
24798     start = end = slice->data;
24799     for (i = 0; i < ndim; i++) {
24800         Py_ssize_t stride = slice->strides[i];
24801         Py_ssize_t extent = slice->shape[i];
24802         if (extent == 0) {
24803             *out_start = *out_end = start;
24804             return;
24805         } else {
24806             if (stride > 0)
24807                 end += stride * (extent - 1);
24808             else
24809                 start += stride * (extent - 1);
24810         }
24811     }
24812     *out_start = start;
24813     *out_end = end + itemsize;
24814 }
24815 static int
__pyx_slices_overlap(__Pyx_memviewslice * slice1,__Pyx_memviewslice * slice2,int ndim,size_t itemsize)24816 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
24817                      __Pyx_memviewslice *slice2,
24818                      int ndim, size_t itemsize)
24819 {
24820     void *start1, *end1, *start2, *end2;
24821     __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
24822     __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
24823     return (start1 < end2) && (start2 < end1);
24824 }
24825 
24826 /* Capsule */
24827   static CYTHON_INLINE PyObject *
__pyx_capsule_create(void * p,CYTHON_UNUSED const char * sig)24828 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
24829 {
24830     PyObject *cobj;
24831 #if PY_VERSION_HEX >= 0x02070000
24832     cobj = PyCapsule_New(p, sig, NULL);
24833 #else
24834     cobj = PyCObject_FromVoidPtr(p, NULL);
24835 #endif
24836     return cobj;
24837 }
24838 
24839 /* TypeInfoCompare */
24840   static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo * a,__Pyx_TypeInfo * b)24841 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
24842 {
24843     int i;
24844     if (!a || !b)
24845         return 0;
24846     if (a == b)
24847         return 1;
24848     if (a->size != b->size || a->typegroup != b->typegroup ||
24849             a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
24850         if (a->typegroup == 'H' || b->typegroup == 'H') {
24851             return a->size == b->size;
24852         } else {
24853             return 0;
24854         }
24855     }
24856     if (a->ndim) {
24857         for (i = 0; i < a->ndim; i++)
24858             if (a->arraysize[i] != b->arraysize[i])
24859                 return 0;
24860     }
24861     if (a->typegroup == 'S') {
24862         if (a->flags != b->flags)
24863             return 0;
24864         if (a->fields || b->fields) {
24865             if (!(a->fields && b->fields))
24866                 return 0;
24867             for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
24868                 __Pyx_StructField *field_a = a->fields + i;
24869                 __Pyx_StructField *field_b = b->fields + i;
24870                 if (field_a->offset != field_b->offset ||
24871                     !__pyx_typeinfo_cmp(field_a->type, field_b->type))
24872                     return 0;
24873             }
24874             return !a->fields[i].type && !b->fields[i].type;
24875         }
24876     }
24877     return 1;
24878 }
24879 
24880 /* MemviewSliceValidateAndInit */
24881   static int
__pyx_check_strides(Py_buffer * buf,int dim,int ndim,int spec)24882 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
24883 {
24884     if (buf->shape[dim] <= 1)
24885         return 1;
24886     if (buf->strides) {
24887         if (spec & __Pyx_MEMVIEW_CONTIG) {
24888             if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
24889                 if (unlikely(buf->strides[dim] != sizeof(void *))) {
24890                     PyErr_Format(PyExc_ValueError,
24891                                  "Buffer is not indirectly contiguous "
24892                                  "in dimension %d.", dim);
24893                     goto fail;
24894                 }
24895             } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
24896                 PyErr_SetString(PyExc_ValueError,
24897                                 "Buffer and memoryview are not contiguous "
24898                                 "in the same dimension.");
24899                 goto fail;
24900             }
24901         }
24902         if (spec & __Pyx_MEMVIEW_FOLLOW) {
24903             Py_ssize_t stride = buf->strides[dim];
24904             if (stride < 0)
24905                 stride = -stride;
24906             if (unlikely(stride < buf->itemsize)) {
24907                 PyErr_SetString(PyExc_ValueError,
24908                                 "Buffer and memoryview are not contiguous "
24909                                 "in the same dimension.");
24910                 goto fail;
24911             }
24912         }
24913     } else {
24914         if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
24915             PyErr_Format(PyExc_ValueError,
24916                          "C-contiguous buffer is not contiguous in "
24917                          "dimension %d", dim);
24918             goto fail;
24919         } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
24920             PyErr_Format(PyExc_ValueError,
24921                          "C-contiguous buffer is not indirect in "
24922                          "dimension %d", dim);
24923             goto fail;
24924         } else if (unlikely(buf->suboffsets)) {
24925             PyErr_SetString(PyExc_ValueError,
24926                             "Buffer exposes suboffsets but no strides");
24927             goto fail;
24928         }
24929     }
24930     return 1;
24931 fail:
24932     return 0;
24933 }
24934 static int
__pyx_check_suboffsets(Py_buffer * buf,int dim,CYTHON_UNUSED int ndim,int spec)24935 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
24936 {
24937     if (spec & __Pyx_MEMVIEW_DIRECT) {
24938         if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
24939             PyErr_Format(PyExc_ValueError,
24940                          "Buffer not compatible with direct access "
24941                          "in dimension %d.", dim);
24942             goto fail;
24943         }
24944     }
24945     if (spec & __Pyx_MEMVIEW_PTR) {
24946         if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
24947             PyErr_Format(PyExc_ValueError,
24948                          "Buffer is not indirectly accessible "
24949                          "in dimension %d.", dim);
24950             goto fail;
24951         }
24952     }
24953     return 1;
24954 fail:
24955     return 0;
24956 }
24957 static int
__pyx_verify_contig(Py_buffer * buf,int ndim,int c_or_f_flag)24958 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
24959 {
24960     int i;
24961     if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
24962         Py_ssize_t stride = 1;
24963         for (i = 0; i < ndim; i++) {
24964             if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
24965                 PyErr_SetString(PyExc_ValueError,
24966                     "Buffer not fortran contiguous.");
24967                 goto fail;
24968             }
24969             stride = stride * buf->shape[i];
24970         }
24971     } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
24972         Py_ssize_t stride = 1;
24973         for (i = ndim - 1; i >- 1; i--) {
24974             if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
24975                 PyErr_SetString(PyExc_ValueError,
24976                     "Buffer not C contiguous.");
24977                 goto fail;
24978             }
24979             stride = stride * buf->shape[i];
24980         }
24981     }
24982     return 1;
24983 fail:
24984     return 0;
24985 }
__Pyx_ValidateAndInit_memviewslice(int * axes_specs,int c_or_f_flag,int buf_flags,int ndim,__Pyx_TypeInfo * dtype,__Pyx_BufFmt_StackElem stack[],__Pyx_memviewslice * memviewslice,PyObject * original_obj)24986 static int __Pyx_ValidateAndInit_memviewslice(
24987                 int *axes_specs,
24988                 int c_or_f_flag,
24989                 int buf_flags,
24990                 int ndim,
24991                 __Pyx_TypeInfo *dtype,
24992                 __Pyx_BufFmt_StackElem stack[],
24993                 __Pyx_memviewslice *memviewslice,
24994                 PyObject *original_obj)
24995 {
24996     struct __pyx_memoryview_obj *memview, *new_memview;
24997     __Pyx_RefNannyDeclarations
24998     Py_buffer *buf;
24999     int i, spec = 0, retval = -1;
25000     __Pyx_BufFmt_Context ctx;
25001     int from_memoryview = __pyx_memoryview_check(original_obj);
25002     __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
25003     if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
25004                                                             original_obj)->typeinfo)) {
25005         memview = (struct __pyx_memoryview_obj *) original_obj;
25006         new_memview = NULL;
25007     } else {
25008         memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
25009                                             original_obj, buf_flags, 0, dtype);
25010         new_memview = memview;
25011         if (unlikely(!memview))
25012             goto fail;
25013     }
25014     buf = &memview->view;
25015     if (unlikely(buf->ndim != ndim)) {
25016         PyErr_Format(PyExc_ValueError,
25017                 "Buffer has wrong number of dimensions (expected %d, got %d)",
25018                 ndim, buf->ndim);
25019         goto fail;
25020     }
25021     if (new_memview) {
25022         __Pyx_BufFmt_Init(&ctx, stack, dtype);
25023         if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
25024     }
25025     if (unlikely((unsigned) buf->itemsize != dtype->size)) {
25026         PyErr_Format(PyExc_ValueError,
25027                      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
25028                      "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
25029                      buf->itemsize,
25030                      (buf->itemsize > 1) ? "s" : "",
25031                      dtype->name,
25032                      dtype->size,
25033                      (dtype->size > 1) ? "s" : "");
25034         goto fail;
25035     }
25036     if (buf->len > 0) {
25037         for (i = 0; i < ndim; i++) {
25038             spec = axes_specs[i];
25039             if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
25040                 goto fail;
25041             if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
25042                 goto fail;
25043         }
25044         if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
25045             goto fail;
25046     }
25047     if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
25048                                          new_memview != NULL) == -1)) {
25049         goto fail;
25050     }
25051     retval = 0;
25052     goto no_fail;
25053 fail:
25054     Py_XDECREF(new_memview);
25055     retval = -1;
25056 no_fail:
25057     __Pyx_RefNannyFinishContext();
25058     return retval;
25059 }
25060 
25061 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dc_double(PyObject * obj,int writable_flag)25062   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_double(PyObject *obj, int writable_flag) {
25063     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
25064     __Pyx_BufFmt_StackElem stack[1];
25065     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
25066     int retcode;
25067     if (obj == Py_None) {
25068         result.memview = (struct __pyx_memoryview_obj *) Py_None;
25069         return result;
25070     }
25071     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
25072                                                  (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1,
25073                                                  &__Pyx_TypeInfo_double, stack,
25074                                                  &result, obj);
25075     if (unlikely(retcode == -1))
25076         goto __pyx_fail;
25077     return result;
25078 __pyx_fail:
25079     result.memview = NULL;
25080     result.data = NULL;
25081     return result;
25082 }
25083 
25084 /* CIntFromPyVerify */
25085   #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
25086     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
25087 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
25088     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
25089 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
25090     {\
25091         func_type value = func_value;\
25092         if (sizeof(target_type) < sizeof(func_type)) {\
25093             if (unlikely(value != (func_type) (target_type) value)) {\
25094                 func_type zero = 0;\
25095                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
25096                     return (target_type) -1;\
25097                 if (is_unsigned && unlikely(value < zero))\
25098                     goto raise_neg_overflow;\
25099                 else\
25100                     goto raise_overflow;\
25101             }\
25102         }\
25103         return (target_type) value;\
25104     }
25105 
25106 /* MemviewDtypeToObject */
__pyx_memview_get_double(const char * itemp)25107   static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp) {
25108     return (PyObject *) PyFloat_FromDouble(*(double *) itemp);
25109 }
__pyx_memview_set_double(const char * itemp,PyObject * obj)25110 static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj) {
25111     double value = __pyx_PyFloat_AsDouble(obj);
25112     if ((value == (double)-1) && PyErr_Occurred())
25113         return 0;
25114     *(double *) itemp = value;
25115     return 1;
25116 }
25117 
25118 /* Declarations */
25119   #if CYTHON_CCOMPLEX
25120   #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)25121     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25122       return ::std::complex< float >(x, y);
25123     }
25124   #else
__pyx_t_float_complex_from_parts(float x,float y)25125     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25126       return x + y*(__pyx_t_float_complex)_Complex_I;
25127     }
25128   #endif
25129 #else
__pyx_t_float_complex_from_parts(float x,float y)25130     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25131       __pyx_t_float_complex z;
25132       z.real = x;
25133       z.imag = y;
25134       return z;
25135     }
25136 #endif
25137 
25138 /* Arithmetic */
25139   #if CYTHON_CCOMPLEX
25140 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25141     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25142        return (a.real == b.real) && (a.imag == b.imag);
25143     }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25144     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25145         __pyx_t_float_complex z;
25146         z.real = a.real + b.real;
25147         z.imag = a.imag + b.imag;
25148         return z;
25149     }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25150     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25151         __pyx_t_float_complex z;
25152         z.real = a.real - b.real;
25153         z.imag = a.imag - b.imag;
25154         return z;
25155     }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25156     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25157         __pyx_t_float_complex z;
25158         z.real = a.real * b.real - a.imag * b.imag;
25159         z.imag = a.real * b.imag + a.imag * b.real;
25160         return z;
25161     }
25162     #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25163     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25164         if (b.imag == 0) {
25165             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
25166         } else if (fabsf(b.real) >= fabsf(b.imag)) {
25167             if (b.real == 0 && b.imag == 0) {
25168                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
25169             } else {
25170                 float r = b.imag / b.real;
25171                 float s = (float)(1.0) / (b.real + b.imag * r);
25172                 return __pyx_t_float_complex_from_parts(
25173                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
25174             }
25175         } else {
25176             float r = b.real / b.imag;
25177             float s = (float)(1.0) / (b.imag + b.real * r);
25178             return __pyx_t_float_complex_from_parts(
25179                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
25180         }
25181     }
25182     #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25183     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25184         if (b.imag == 0) {
25185             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
25186         } else {
25187             float denom = b.real * b.real + b.imag * b.imag;
25188             return __pyx_t_float_complex_from_parts(
25189                 (a.real * b.real + a.imag * b.imag) / denom,
25190                 (a.imag * b.real - a.real * b.imag) / denom);
25191         }
25192     }
25193     #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)25194     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
25195         __pyx_t_float_complex z;
25196         z.real = -a.real;
25197         z.imag = -a.imag;
25198         return z;
25199     }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)25200     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
25201        return (a.real == 0) && (a.imag == 0);
25202     }
__Pyx_c_conj_float(__pyx_t_float_complex a)25203     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
25204         __pyx_t_float_complex z;
25205         z.real =  a.real;
25206         z.imag = -a.imag;
25207         return z;
25208     }
25209     #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)25210         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
25211           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25212             return sqrtf(z.real*z.real + z.imag*z.imag);
25213           #else
25214             return hypotf(z.real, z.imag);
25215           #endif
25216         }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25217         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25218             __pyx_t_float_complex z;
25219             float r, lnr, theta, z_r, z_theta;
25220             if (b.imag == 0 && b.real == (int)b.real) {
25221                 if (b.real < 0) {
25222                     float denom = a.real * a.real + a.imag * a.imag;
25223                     a.real = a.real / denom;
25224                     a.imag = -a.imag / denom;
25225                     b.real = -b.real;
25226                 }
25227                 switch ((int)b.real) {
25228                     case 0:
25229                         z.real = 1;
25230                         z.imag = 0;
25231                         return z;
25232                     case 1:
25233                         return a;
25234                     case 2:
25235                         return __Pyx_c_prod_float(a, a);
25236                     case 3:
25237                         z = __Pyx_c_prod_float(a, a);
25238                         return __Pyx_c_prod_float(z, a);
25239                     case 4:
25240                         z = __Pyx_c_prod_float(a, a);
25241                         return __Pyx_c_prod_float(z, z);
25242                 }
25243             }
25244             if (a.imag == 0) {
25245                 if (a.real == 0) {
25246                     return a;
25247                 } else if (b.imag == 0) {
25248                     z.real = powf(a.real, b.real);
25249                     z.imag = 0;
25250                     return z;
25251                 } else if (a.real > 0) {
25252                     r = a.real;
25253                     theta = 0;
25254                 } else {
25255                     r = -a.real;
25256                     theta = atan2f(0.0, -1.0);
25257                 }
25258             } else {
25259                 r = __Pyx_c_abs_float(a);
25260                 theta = atan2f(a.imag, a.real);
25261             }
25262             lnr = logf(r);
25263             z_r = expf(lnr * b.real - theta * b.imag);
25264             z_theta = theta * b.real + lnr * b.imag;
25265             z.real = z_r * cosf(z_theta);
25266             z.imag = z_r * sinf(z_theta);
25267             return z;
25268         }
25269     #endif
25270 #endif
25271 
25272 /* Declarations */
25273   #if CYTHON_CCOMPLEX
25274   #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)25275     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25276       return ::std::complex< double >(x, y);
25277     }
25278   #else
__pyx_t_double_complex_from_parts(double x,double y)25279     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25280       return x + y*(__pyx_t_double_complex)_Complex_I;
25281     }
25282   #endif
25283 #else
__pyx_t_double_complex_from_parts(double x,double y)25284     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25285       __pyx_t_double_complex z;
25286       z.real = x;
25287       z.imag = y;
25288       return z;
25289     }
25290 #endif
25291 
25292 /* Arithmetic */
25293   #if CYTHON_CCOMPLEX
25294 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25295     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25296        return (a.real == b.real) && (a.imag == b.imag);
25297     }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25298     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25299         __pyx_t_double_complex z;
25300         z.real = a.real + b.real;
25301         z.imag = a.imag + b.imag;
25302         return z;
25303     }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25304     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25305         __pyx_t_double_complex z;
25306         z.real = a.real - b.real;
25307         z.imag = a.imag - b.imag;
25308         return z;
25309     }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25310     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25311         __pyx_t_double_complex z;
25312         z.real = a.real * b.real - a.imag * b.imag;
25313         z.imag = a.real * b.imag + a.imag * b.real;
25314         return z;
25315     }
25316     #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25317     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25318         if (b.imag == 0) {
25319             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
25320         } else if (fabs(b.real) >= fabs(b.imag)) {
25321             if (b.real == 0 && b.imag == 0) {
25322                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
25323             } else {
25324                 double r = b.imag / b.real;
25325                 double s = (double)(1.0) / (b.real + b.imag * r);
25326                 return __pyx_t_double_complex_from_parts(
25327                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
25328             }
25329         } else {
25330             double r = b.real / b.imag;
25331             double s = (double)(1.0) / (b.imag + b.real * r);
25332             return __pyx_t_double_complex_from_parts(
25333                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
25334         }
25335     }
25336     #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25337     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25338         if (b.imag == 0) {
25339             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
25340         } else {
25341             double denom = b.real * b.real + b.imag * b.imag;
25342             return __pyx_t_double_complex_from_parts(
25343                 (a.real * b.real + a.imag * b.imag) / denom,
25344                 (a.imag * b.real - a.real * b.imag) / denom);
25345         }
25346     }
25347     #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)25348     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
25349         __pyx_t_double_complex z;
25350         z.real = -a.real;
25351         z.imag = -a.imag;
25352         return z;
25353     }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)25354     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
25355        return (a.real == 0) && (a.imag == 0);
25356     }
__Pyx_c_conj_double(__pyx_t_double_complex a)25357     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
25358         __pyx_t_double_complex z;
25359         z.real =  a.real;
25360         z.imag = -a.imag;
25361         return z;
25362     }
25363     #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)25364         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
25365           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25366             return sqrt(z.real*z.real + z.imag*z.imag);
25367           #else
25368             return hypot(z.real, z.imag);
25369           #endif
25370         }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25371         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25372             __pyx_t_double_complex z;
25373             double r, lnr, theta, z_r, z_theta;
25374             if (b.imag == 0 && b.real == (int)b.real) {
25375                 if (b.real < 0) {
25376                     double denom = a.real * a.real + a.imag * a.imag;
25377                     a.real = a.real / denom;
25378                     a.imag = -a.imag / denom;
25379                     b.real = -b.real;
25380                 }
25381                 switch ((int)b.real) {
25382                     case 0:
25383                         z.real = 1;
25384                         z.imag = 0;
25385                         return z;
25386                     case 1:
25387                         return a;
25388                     case 2:
25389                         return __Pyx_c_prod_double(a, a);
25390                     case 3:
25391                         z = __Pyx_c_prod_double(a, a);
25392                         return __Pyx_c_prod_double(z, a);
25393                     case 4:
25394                         z = __Pyx_c_prod_double(a, a);
25395                         return __Pyx_c_prod_double(z, z);
25396                 }
25397             }
25398             if (a.imag == 0) {
25399                 if (a.real == 0) {
25400                     return a;
25401                 } else if (b.imag == 0) {
25402                     z.real = pow(a.real, b.real);
25403                     z.imag = 0;
25404                     return z;
25405                 } else if (a.real > 0) {
25406                     r = a.real;
25407                     theta = 0;
25408                 } else {
25409                     r = -a.real;
25410                     theta = atan2(0.0, -1.0);
25411                 }
25412             } else {
25413                 r = __Pyx_c_abs_double(a);
25414                 theta = atan2(a.imag, a.real);
25415             }
25416             lnr = log(r);
25417             z_r = exp(lnr * b.real - theta * b.imag);
25418             z_theta = theta * b.real + lnr * b.imag;
25419             z.real = z_r * cos(z_theta);
25420             z.imag = z_r * sin(z_theta);
25421             return z;
25422         }
25423     #endif
25424 #endif
25425 
25426 /* MemviewSliceCopyTemplate */
25427   static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice * from_mvs,const char * mode,int ndim,size_t sizeof_dtype,int contig_flag,int dtype_is_object)25428 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
25429                                  const char *mode, int ndim,
25430                                  size_t sizeof_dtype, int contig_flag,
25431                                  int dtype_is_object)
25432 {
25433     __Pyx_RefNannyDeclarations
25434     int i;
25435     __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
25436     struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
25437     Py_buffer *buf = &from_memview->view;
25438     PyObject *shape_tuple = NULL;
25439     PyObject *temp_int = NULL;
25440     struct __pyx_array_obj *array_obj = NULL;
25441     struct __pyx_memoryview_obj *memview_obj = NULL;
25442     __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
25443     for (i = 0; i < ndim; i++) {
25444         if (unlikely(from_mvs->suboffsets[i] >= 0)) {
25445             PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
25446                                            "indirect dimensions (axis %d)", i);
25447             goto fail;
25448         }
25449     }
25450     shape_tuple = PyTuple_New(ndim);
25451     if (unlikely(!shape_tuple)) {
25452         goto fail;
25453     }
25454     __Pyx_GOTREF(shape_tuple);
25455     for(i = 0; i < ndim; i++) {
25456         temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
25457         if(unlikely(!temp_int)) {
25458             goto fail;
25459         } else {
25460             PyTuple_SET_ITEM(shape_tuple, i, temp_int);
25461             temp_int = NULL;
25462         }
25463     }
25464     array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
25465     if (unlikely(!array_obj)) {
25466         goto fail;
25467     }
25468     __Pyx_GOTREF(array_obj);
25469     memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
25470                                     (PyObject *) array_obj, contig_flag,
25471                                     dtype_is_object,
25472                                     from_mvs->memview->typeinfo);
25473     if (unlikely(!memview_obj))
25474         goto fail;
25475     if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
25476         goto fail;
25477     if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
25478                                                 dtype_is_object) < 0))
25479         goto fail;
25480     goto no_fail;
25481 fail:
25482     __Pyx_XDECREF(new_mvs.memview);
25483     new_mvs.memview = NULL;
25484     new_mvs.data = NULL;
25485 no_fail:
25486     __Pyx_XDECREF(shape_tuple);
25487     __Pyx_XDECREF(temp_int);
25488     __Pyx_XDECREF(array_obj);
25489     __Pyx_RefNannyFinishContext();
25490     return new_mvs;
25491 }
25492 
25493 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)25494   static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
25495 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25496 #pragma GCC diagnostic push
25497 #pragma GCC diagnostic ignored "-Wconversion"
25498 #endif
25499     const int neg_one = (int) -1, const_zero = (int) 0;
25500 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25501 #pragma GCC diagnostic pop
25502 #endif
25503     const int is_unsigned = neg_one > const_zero;
25504 #if PY_MAJOR_VERSION < 3
25505     if (likely(PyInt_Check(x))) {
25506         if (sizeof(int) < sizeof(long)) {
25507             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
25508         } else {
25509             long val = PyInt_AS_LONG(x);
25510             if (is_unsigned && unlikely(val < 0)) {
25511                 goto raise_neg_overflow;
25512             }
25513             return (int) val;
25514         }
25515     } else
25516 #endif
25517     if (likely(PyLong_Check(x))) {
25518         if (is_unsigned) {
25519 #if CYTHON_USE_PYLONG_INTERNALS
25520             const digit* digits = ((PyLongObject*)x)->ob_digit;
25521             switch (Py_SIZE(x)) {
25522                 case  0: return (int) 0;
25523                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
25524                 case 2:
25525                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
25526                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25527                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25528                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
25529                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25530                         }
25531                     }
25532                     break;
25533                 case 3:
25534                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
25535                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25536                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25537                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
25538                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25539                         }
25540                     }
25541                     break;
25542                 case 4:
25543                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
25544                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25545                             __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])))
25546                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
25547                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25548                         }
25549                     }
25550                     break;
25551             }
25552 #endif
25553 #if CYTHON_COMPILING_IN_CPYTHON
25554             if (unlikely(Py_SIZE(x) < 0)) {
25555                 goto raise_neg_overflow;
25556             }
25557 #else
25558             {
25559                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25560                 if (unlikely(result < 0))
25561                     return (int) -1;
25562                 if (unlikely(result == 1))
25563                     goto raise_neg_overflow;
25564             }
25565 #endif
25566             if (sizeof(int) <= sizeof(unsigned long)) {
25567                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
25568 #ifdef HAVE_LONG_LONG
25569             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
25570                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25571 #endif
25572             }
25573         } else {
25574 #if CYTHON_USE_PYLONG_INTERNALS
25575             const digit* digits = ((PyLongObject*)x)->ob_digit;
25576             switch (Py_SIZE(x)) {
25577                 case  0: return (int) 0;
25578                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
25579                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
25580                 case -2:
25581                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
25582                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25583                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25584                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25585                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25586                         }
25587                     }
25588                     break;
25589                 case 2:
25590                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
25591                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25592                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25593                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25594                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25595                         }
25596                     }
25597                     break;
25598                 case -3:
25599                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25600                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25601                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25602                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25603                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25604                         }
25605                     }
25606                     break;
25607                 case 3:
25608                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
25609                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25610                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25611                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25612                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25613                         }
25614                     }
25615                     break;
25616                 case -4:
25617                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25618                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25619                             __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])))
25620                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
25621                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25622                         }
25623                     }
25624                     break;
25625                 case 4:
25626                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
25627                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25628                             __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])))
25629                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
25630                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25631                         }
25632                     }
25633                     break;
25634             }
25635 #endif
25636             if (sizeof(int) <= sizeof(long)) {
25637                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
25638 #ifdef HAVE_LONG_LONG
25639             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
25640                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
25641 #endif
25642             }
25643         }
25644         {
25645 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25646             PyErr_SetString(PyExc_RuntimeError,
25647                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25648 #else
25649             int val;
25650             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25651  #if PY_MAJOR_VERSION < 3
25652             if (likely(v) && !PyLong_Check(v)) {
25653                 PyObject *tmp = v;
25654                 v = PyNumber_Long(tmp);
25655                 Py_DECREF(tmp);
25656             }
25657  #endif
25658             if (likely(v)) {
25659                 int one = 1; int is_little = (int)*(unsigned char *)&one;
25660                 unsigned char *bytes = (unsigned char *)&val;
25661                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25662                                               bytes, sizeof(val),
25663                                               is_little, !is_unsigned);
25664                 Py_DECREF(v);
25665                 if (likely(!ret))
25666                     return val;
25667             }
25668 #endif
25669             return (int) -1;
25670         }
25671     } else {
25672         int val;
25673         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25674         if (!tmp) return (int) -1;
25675         val = __Pyx_PyInt_As_int(tmp);
25676         Py_DECREF(tmp);
25677         return val;
25678     }
25679 raise_overflow:
25680     PyErr_SetString(PyExc_OverflowError,
25681         "value too large to convert to int");
25682     return (int) -1;
25683 raise_neg_overflow:
25684     PyErr_SetString(PyExc_OverflowError,
25685         "can't convert negative value to int");
25686     return (int) -1;
25687 }
25688 
25689 /* CIntToPy */
__Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value)25690   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
25691 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25692 #pragma GCC diagnostic push
25693 #pragma GCC diagnostic ignored "-Wconversion"
25694 #endif
25695     const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
25696 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25697 #pragma GCC diagnostic pop
25698 #endif
25699     const int is_unsigned = neg_one > const_zero;
25700     if (is_unsigned) {
25701         if (sizeof(Py_intptr_t) < sizeof(long)) {
25702             return PyInt_FromLong((long) value);
25703         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
25704             return PyLong_FromUnsignedLong((unsigned long) value);
25705 #ifdef HAVE_LONG_LONG
25706         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
25707             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
25708 #endif
25709         }
25710     } else {
25711         if (sizeof(Py_intptr_t) <= sizeof(long)) {
25712             return PyInt_FromLong((long) value);
25713 #ifdef HAVE_LONG_LONG
25714         } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
25715             return PyLong_FromLongLong((PY_LONG_LONG) value);
25716 #endif
25717         }
25718     }
25719     {
25720         int one = 1; int little = (int)*(unsigned char *)&one;
25721         unsigned char *bytes = (unsigned char *)&value;
25722         return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
25723                                      little, !is_unsigned);
25724     }
25725 }
25726 
25727 /* CIntFromPy */
__Pyx_PyInt_As_Py_intptr_t(PyObject * x)25728   static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) {
25729 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25730 #pragma GCC diagnostic push
25731 #pragma GCC diagnostic ignored "-Wconversion"
25732 #endif
25733     const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
25734 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25735 #pragma GCC diagnostic pop
25736 #endif
25737     const int is_unsigned = neg_one > const_zero;
25738 #if PY_MAJOR_VERSION < 3
25739     if (likely(PyInt_Check(x))) {
25740         if (sizeof(Py_intptr_t) < sizeof(long)) {
25741             __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG(x))
25742         } else {
25743             long val = PyInt_AS_LONG(x);
25744             if (is_unsigned && unlikely(val < 0)) {
25745                 goto raise_neg_overflow;
25746             }
25747             return (Py_intptr_t) val;
25748         }
25749     } else
25750 #endif
25751     if (likely(PyLong_Check(x))) {
25752         if (is_unsigned) {
25753 #if CYTHON_USE_PYLONG_INTERNALS
25754             const digit* digits = ((PyLongObject*)x)->ob_digit;
25755             switch (Py_SIZE(x)) {
25756                 case  0: return (Py_intptr_t) 0;
25757                 case  1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, digits[0])
25758                 case 2:
25759                     if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
25760                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25761                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25762                         } else if (8 * sizeof(Py_intptr_t) >= 2 * PyLong_SHIFT) {
25763                             return (Py_intptr_t) (((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
25764                         }
25765                     }
25766                     break;
25767                 case 3:
25768                     if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
25769                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25770                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25771                         } else if (8 * sizeof(Py_intptr_t) >= 3 * PyLong_SHIFT) {
25772                             return (Py_intptr_t) (((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
25773                         }
25774                     }
25775                     break;
25776                 case 4:
25777                     if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
25778                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25779                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25780                         } else if (8 * sizeof(Py_intptr_t) >= 4 * PyLong_SHIFT) {
25781                             return (Py_intptr_t) (((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
25782                         }
25783                     }
25784                     break;
25785             }
25786 #endif
25787 #if CYTHON_COMPILING_IN_CPYTHON
25788             if (unlikely(Py_SIZE(x) < 0)) {
25789                 goto raise_neg_overflow;
25790             }
25791 #else
25792             {
25793                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25794                 if (unlikely(result < 0))
25795                     return (Py_intptr_t) -1;
25796                 if (unlikely(result == 1))
25797                     goto raise_neg_overflow;
25798             }
25799 #endif
25800             if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
25801                 __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong(x))
25802 #ifdef HAVE_LONG_LONG
25803             } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
25804                 __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25805 #endif
25806             }
25807         } else {
25808 #if CYTHON_USE_PYLONG_INTERNALS
25809             const digit* digits = ((PyLongObject*)x)->ob_digit;
25810             switch (Py_SIZE(x)) {
25811                 case  0: return (Py_intptr_t) 0;
25812                 case -1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, sdigit, (sdigit) (-(sdigit)digits[0]))
25813                 case  1: __PYX_VERIFY_RETURN_INT(Py_intptr_t,  digit, +digits[0])
25814                 case -2:
25815                     if (8 * sizeof(Py_intptr_t) - 1 > 1 * PyLong_SHIFT) {
25816                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25817                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25818                         } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
25819                             return (Py_intptr_t) (((Py_intptr_t)-1)*(((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
25820                         }
25821                     }
25822                     break;
25823                 case 2:
25824                     if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
25825                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25826                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25827                         } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
25828                             return (Py_intptr_t) ((((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
25829                         }
25830                     }
25831                     break;
25832                 case -3:
25833                     if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
25834                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25835                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25836                         } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
25837                             return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
25838                         }
25839                     }
25840                     break;
25841                 case 3:
25842                     if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
25843                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25844                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25845                         } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
25846                             return (Py_intptr_t) ((((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
25847                         }
25848                     }
25849                     break;
25850                 case -4:
25851                     if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
25852                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25853                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25854                         } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
25855                             return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
25856                         }
25857                     }
25858                     break;
25859                 case 4:
25860                     if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
25861                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25862                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25863                         } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
25864                             return (Py_intptr_t) ((((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
25865                         }
25866                     }
25867                     break;
25868             }
25869 #endif
25870             if (sizeof(Py_intptr_t) <= sizeof(long)) {
25871                 __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, long, PyLong_AsLong(x))
25872 #ifdef HAVE_LONG_LONG
25873             } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
25874                 __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, PY_LONG_LONG, PyLong_AsLongLong(x))
25875 #endif
25876             }
25877         }
25878         {
25879 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25880             PyErr_SetString(PyExc_RuntimeError,
25881                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25882 #else
25883             Py_intptr_t val;
25884             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25885  #if PY_MAJOR_VERSION < 3
25886             if (likely(v) && !PyLong_Check(v)) {
25887                 PyObject *tmp = v;
25888                 v = PyNumber_Long(tmp);
25889                 Py_DECREF(tmp);
25890             }
25891  #endif
25892             if (likely(v)) {
25893                 int one = 1; int is_little = (int)*(unsigned char *)&one;
25894                 unsigned char *bytes = (unsigned char *)&val;
25895                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25896                                               bytes, sizeof(val),
25897                                               is_little, !is_unsigned);
25898                 Py_DECREF(v);
25899                 if (likely(!ret))
25900                     return val;
25901             }
25902 #endif
25903             return (Py_intptr_t) -1;
25904         }
25905     } else {
25906         Py_intptr_t val;
25907         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25908         if (!tmp) return (Py_intptr_t) -1;
25909         val = __Pyx_PyInt_As_Py_intptr_t(tmp);
25910         Py_DECREF(tmp);
25911         return val;
25912     }
25913 raise_overflow:
25914     PyErr_SetString(PyExc_OverflowError,
25915         "value too large to convert to Py_intptr_t");
25916     return (Py_intptr_t) -1;
25917 raise_neg_overflow:
25918     PyErr_SetString(PyExc_OverflowError,
25919         "can't convert negative value to Py_intptr_t");
25920     return (Py_intptr_t) -1;
25921 }
25922 
25923 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)25924   static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
25925 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25926 #pragma GCC diagnostic push
25927 #pragma GCC diagnostic ignored "-Wconversion"
25928 #endif
25929     const long neg_one = (long) -1, const_zero = (long) 0;
25930 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25931 #pragma GCC diagnostic pop
25932 #endif
25933     const int is_unsigned = neg_one > const_zero;
25934 #if PY_MAJOR_VERSION < 3
25935     if (likely(PyInt_Check(x))) {
25936         if (sizeof(long) < sizeof(long)) {
25937             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
25938         } else {
25939             long val = PyInt_AS_LONG(x);
25940             if (is_unsigned && unlikely(val < 0)) {
25941                 goto raise_neg_overflow;
25942             }
25943             return (long) val;
25944         }
25945     } else
25946 #endif
25947     if (likely(PyLong_Check(x))) {
25948         if (is_unsigned) {
25949 #if CYTHON_USE_PYLONG_INTERNALS
25950             const digit* digits = ((PyLongObject*)x)->ob_digit;
25951             switch (Py_SIZE(x)) {
25952                 case  0: return (long) 0;
25953                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
25954                 case 2:
25955                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
25956                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25957                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25958                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
25959                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25960                         }
25961                     }
25962                     break;
25963                 case 3:
25964                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
25965                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25966                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25967                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
25968                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25969                         }
25970                     }
25971                     break;
25972                 case 4:
25973                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
25974                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25975                             __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])))
25976                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
25977                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25978                         }
25979                     }
25980                     break;
25981             }
25982 #endif
25983 #if CYTHON_COMPILING_IN_CPYTHON
25984             if (unlikely(Py_SIZE(x) < 0)) {
25985                 goto raise_neg_overflow;
25986             }
25987 #else
25988             {
25989                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25990                 if (unlikely(result < 0))
25991                     return (long) -1;
25992                 if (unlikely(result == 1))
25993                     goto raise_neg_overflow;
25994             }
25995 #endif
25996             if (sizeof(long) <= sizeof(unsigned long)) {
25997                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
25998 #ifdef HAVE_LONG_LONG
25999             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
26000                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26001 #endif
26002             }
26003         } else {
26004 #if CYTHON_USE_PYLONG_INTERNALS
26005             const digit* digits = ((PyLongObject*)x)->ob_digit;
26006             switch (Py_SIZE(x)) {
26007                 case  0: return (long) 0;
26008                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
26009                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
26010                 case -2:
26011                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
26012                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26013                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26014                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26015                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26016                         }
26017                     }
26018                     break;
26019                 case 2:
26020                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
26021                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26022                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26023                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26024                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26025                         }
26026                     }
26027                     break;
26028                 case -3:
26029                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26030                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26031                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26032                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26033                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26034                         }
26035                     }
26036                     break;
26037                 case 3:
26038                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
26039                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26040                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26041                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26042                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26043                         }
26044                     }
26045                     break;
26046                 case -4:
26047                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26048                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26049                             __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])))
26050                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
26051                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26052                         }
26053                     }
26054                     break;
26055                 case 4:
26056                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
26057                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26058                             __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])))
26059                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
26060                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26061                         }
26062                     }
26063                     break;
26064             }
26065 #endif
26066             if (sizeof(long) <= sizeof(long)) {
26067                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
26068 #ifdef HAVE_LONG_LONG
26069             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
26070                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
26071 #endif
26072             }
26073         }
26074         {
26075 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26076             PyErr_SetString(PyExc_RuntimeError,
26077                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26078 #else
26079             long val;
26080             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26081  #if PY_MAJOR_VERSION < 3
26082             if (likely(v) && !PyLong_Check(v)) {
26083                 PyObject *tmp = v;
26084                 v = PyNumber_Long(tmp);
26085                 Py_DECREF(tmp);
26086             }
26087  #endif
26088             if (likely(v)) {
26089                 int one = 1; int is_little = (int)*(unsigned char *)&one;
26090                 unsigned char *bytes = (unsigned char *)&val;
26091                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
26092                                               bytes, sizeof(val),
26093                                               is_little, !is_unsigned);
26094                 Py_DECREF(v);
26095                 if (likely(!ret))
26096                     return val;
26097             }
26098 #endif
26099             return (long) -1;
26100         }
26101     } else {
26102         long val;
26103         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26104         if (!tmp) return (long) -1;
26105         val = __Pyx_PyInt_As_long(tmp);
26106         Py_DECREF(tmp);
26107         return val;
26108     }
26109 raise_overflow:
26110     PyErr_SetString(PyExc_OverflowError,
26111         "value too large to convert to long");
26112     return (long) -1;
26113 raise_neg_overflow:
26114     PyErr_SetString(PyExc_OverflowError,
26115         "can't convert negative value to long");
26116     return (long) -1;
26117 }
26118 
26119 /* CIntToPy */
__Pyx_PyInt_From_int(int value)26120   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
26121 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26122 #pragma GCC diagnostic push
26123 #pragma GCC diagnostic ignored "-Wconversion"
26124 #endif
26125     const int neg_one = (int) -1, const_zero = (int) 0;
26126 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26127 #pragma GCC diagnostic pop
26128 #endif
26129     const int is_unsigned = neg_one > const_zero;
26130     if (is_unsigned) {
26131         if (sizeof(int) < sizeof(long)) {
26132             return PyInt_FromLong((long) value);
26133         } else if (sizeof(int) <= sizeof(unsigned long)) {
26134             return PyLong_FromUnsignedLong((unsigned long) value);
26135 #ifdef HAVE_LONG_LONG
26136         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
26137             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26138 #endif
26139         }
26140     } else {
26141         if (sizeof(int) <= sizeof(long)) {
26142             return PyInt_FromLong((long) value);
26143 #ifdef HAVE_LONG_LONG
26144         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
26145             return PyLong_FromLongLong((PY_LONG_LONG) value);
26146 #endif
26147         }
26148     }
26149     {
26150         int one = 1; int little = (int)*(unsigned char *)&one;
26151         unsigned char *bytes = (unsigned char *)&value;
26152         return _PyLong_FromByteArray(bytes, sizeof(int),
26153                                      little, !is_unsigned);
26154     }
26155 }
26156 
26157 /* CIntToPy */
__Pyx_PyInt_From_long(long value)26158   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
26159 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26160 #pragma GCC diagnostic push
26161 #pragma GCC diagnostic ignored "-Wconversion"
26162 #endif
26163     const long neg_one = (long) -1, const_zero = (long) 0;
26164 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26165 #pragma GCC diagnostic pop
26166 #endif
26167     const int is_unsigned = neg_one > const_zero;
26168     if (is_unsigned) {
26169         if (sizeof(long) < sizeof(long)) {
26170             return PyInt_FromLong((long) value);
26171         } else if (sizeof(long) <= sizeof(unsigned long)) {
26172             return PyLong_FromUnsignedLong((unsigned long) value);
26173 #ifdef HAVE_LONG_LONG
26174         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
26175             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26176 #endif
26177         }
26178     } else {
26179         if (sizeof(long) <= sizeof(long)) {
26180             return PyInt_FromLong((long) value);
26181 #ifdef HAVE_LONG_LONG
26182         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
26183             return PyLong_FromLongLong((PY_LONG_LONG) value);
26184 #endif
26185         }
26186     }
26187     {
26188         int one = 1; int little = (int)*(unsigned char *)&one;
26189         unsigned char *bytes = (unsigned char *)&value;
26190         return _PyLong_FromByteArray(bytes, sizeof(long),
26191                                      little, !is_unsigned);
26192     }
26193 }
26194 
26195 /* CIntFromPy */
__Pyx_PyInt_As_char(PyObject * x)26196   static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
26197 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26198 #pragma GCC diagnostic push
26199 #pragma GCC diagnostic ignored "-Wconversion"
26200 #endif
26201     const char neg_one = (char) -1, const_zero = (char) 0;
26202 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26203 #pragma GCC diagnostic pop
26204 #endif
26205     const int is_unsigned = neg_one > const_zero;
26206 #if PY_MAJOR_VERSION < 3
26207     if (likely(PyInt_Check(x))) {
26208         if (sizeof(char) < sizeof(long)) {
26209             __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
26210         } else {
26211             long val = PyInt_AS_LONG(x);
26212             if (is_unsigned && unlikely(val < 0)) {
26213                 goto raise_neg_overflow;
26214             }
26215             return (char) val;
26216         }
26217     } else
26218 #endif
26219     if (likely(PyLong_Check(x))) {
26220         if (is_unsigned) {
26221 #if CYTHON_USE_PYLONG_INTERNALS
26222             const digit* digits = ((PyLongObject*)x)->ob_digit;
26223             switch (Py_SIZE(x)) {
26224                 case  0: return (char) 0;
26225                 case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
26226                 case 2:
26227                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
26228                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26229                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26230                         } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
26231                             return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
26232                         }
26233                     }
26234                     break;
26235                 case 3:
26236                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
26237                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26238                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26239                         } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
26240                             return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
26241                         }
26242                     }
26243                     break;
26244                 case 4:
26245                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
26246                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26247                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26248                         } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
26249                             return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
26250                         }
26251                     }
26252                     break;
26253             }
26254 #endif
26255 #if CYTHON_COMPILING_IN_CPYTHON
26256             if (unlikely(Py_SIZE(x) < 0)) {
26257                 goto raise_neg_overflow;
26258             }
26259 #else
26260             {
26261                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26262                 if (unlikely(result < 0))
26263                     return (char) -1;
26264                 if (unlikely(result == 1))
26265                     goto raise_neg_overflow;
26266             }
26267 #endif
26268             if (sizeof(char) <= sizeof(unsigned long)) {
26269                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
26270 #ifdef HAVE_LONG_LONG
26271             } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
26272                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26273 #endif
26274             }
26275         } else {
26276 #if CYTHON_USE_PYLONG_INTERNALS
26277             const digit* digits = ((PyLongObject*)x)->ob_digit;
26278             switch (Py_SIZE(x)) {
26279                 case  0: return (char) 0;
26280                 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
26281                 case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
26282                 case -2:
26283                     if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
26284                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26285                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26286                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
26287                             return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26288                         }
26289                     }
26290                     break;
26291                 case 2:
26292                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
26293                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26294                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26295                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
26296                             return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26297                         }
26298                     }
26299                     break;
26300                 case -3:
26301                     if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
26302                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26303                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26304                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
26305                             return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26306                         }
26307                     }
26308                     break;
26309                 case 3:
26310                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
26311                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26312                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26313                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
26314                             return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26315                         }
26316                     }
26317                     break;
26318                 case -4:
26319                     if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
26320                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26321                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26322                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
26323                             return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26324                         }
26325                     }
26326                     break;
26327                 case 4:
26328                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
26329                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26330                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26331                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
26332                             return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26333                         }
26334                     }
26335                     break;
26336             }
26337 #endif
26338             if (sizeof(char) <= sizeof(long)) {
26339                 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
26340 #ifdef HAVE_LONG_LONG
26341             } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
26342                 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
26343 #endif
26344             }
26345         }
26346         {
26347 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26348             PyErr_SetString(PyExc_RuntimeError,
26349                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26350 #else
26351             char val;
26352             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26353  #if PY_MAJOR_VERSION < 3
26354             if (likely(v) && !PyLong_Check(v)) {
26355                 PyObject *tmp = v;
26356                 v = PyNumber_Long(tmp);
26357                 Py_DECREF(tmp);
26358             }
26359  #endif
26360             if (likely(v)) {
26361                 int one = 1; int is_little = (int)*(unsigned char *)&one;
26362                 unsigned char *bytes = (unsigned char *)&val;
26363                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
26364                                               bytes, sizeof(val),
26365                                               is_little, !is_unsigned);
26366                 Py_DECREF(v);
26367                 if (likely(!ret))
26368                     return val;
26369             }
26370 #endif
26371             return (char) -1;
26372         }
26373     } else {
26374         char val;
26375         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26376         if (!tmp) return (char) -1;
26377         val = __Pyx_PyInt_As_char(tmp);
26378         Py_DECREF(tmp);
26379         return val;
26380     }
26381 raise_overflow:
26382     PyErr_SetString(PyExc_OverflowError,
26383         "value too large to convert to char");
26384     return (char) -1;
26385 raise_neg_overflow:
26386     PyErr_SetString(PyExc_OverflowError,
26387         "can't convert negative value to char");
26388     return (char) -1;
26389 }
26390 
26391 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)26392   static int __Pyx_check_binary_version(void) {
26393     char ctversion[4], rtversion[4];
26394     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
26395     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
26396     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
26397         char message[200];
26398         PyOS_snprintf(message, sizeof(message),
26399                       "compiletime version %s of module '%.100s' "
26400                       "does not match runtime version %s",
26401                       ctversion, __Pyx_MODULE_NAME, rtversion);
26402         return PyErr_WarnEx(NULL, message, 1);
26403     }
26404     return 0;
26405 }
26406 
26407 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)26408   static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
26409     while (t->p) {
26410         #if PY_MAJOR_VERSION < 3
26411         if (t->is_unicode) {
26412             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
26413         } else if (t->intern) {
26414             *t->p = PyString_InternFromString(t->s);
26415         } else {
26416             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
26417         }
26418         #else
26419         if (t->is_unicode | t->is_str) {
26420             if (t->intern) {
26421                 *t->p = PyUnicode_InternFromString(t->s);
26422             } else if (t->encoding) {
26423                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
26424             } else {
26425                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
26426             }
26427         } else {
26428             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
26429         }
26430         #endif
26431         if (!*t->p)
26432             return -1;
26433         if (PyObject_Hash(*t->p) == -1)
26434             return -1;
26435         ++t;
26436     }
26437     return 0;
26438 }
26439 
__Pyx_PyUnicode_FromString(const char * c_str)26440 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
26441     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
26442 }
__Pyx_PyObject_AsString(PyObject * o)26443 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
26444     Py_ssize_t ignore;
26445     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
26446 }
26447 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
26448 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)26449 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26450     char* defenc_c;
26451     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
26452     if (!defenc) return NULL;
26453     defenc_c = PyBytes_AS_STRING(defenc);
26454 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26455     {
26456         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
26457         char* c;
26458         for (c = defenc_c; c < end; c++) {
26459             if ((unsigned char) (*c) >= 128) {
26460                 PyUnicode_AsASCIIString(o);
26461                 return NULL;
26462             }
26463         }
26464     }
26465 #endif
26466     *length = PyBytes_GET_SIZE(defenc);
26467     return defenc_c;
26468 }
26469 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)26470 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26471     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
26472 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26473     if (likely(PyUnicode_IS_ASCII(o))) {
26474         *length = PyUnicode_GET_LENGTH(o);
26475         return PyUnicode_AsUTF8(o);
26476     } else {
26477         PyUnicode_AsASCIIString(o);
26478         return NULL;
26479     }
26480 #else
26481     return PyUnicode_AsUTF8AndSize(o, length);
26482 #endif
26483 }
26484 #endif
26485 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)26486 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26487 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
26488     if (
26489 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26490             __Pyx_sys_getdefaultencoding_not_ascii &&
26491 #endif
26492             PyUnicode_Check(o)) {
26493         return __Pyx_PyUnicode_AsStringAndSize(o, length);
26494     } else
26495 #endif
26496 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
26497     if (PyByteArray_Check(o)) {
26498         *length = PyByteArray_GET_SIZE(o);
26499         return PyByteArray_AS_STRING(o);
26500     } else
26501 #endif
26502     {
26503         char* result;
26504         int r = PyBytes_AsStringAndSize(o, &result, length);
26505         if (unlikely(r < 0)) {
26506             return NULL;
26507         } else {
26508             return result;
26509         }
26510     }
26511 }
__Pyx_PyObject_IsTrue(PyObject * x)26512 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
26513    int is_true = x == Py_True;
26514    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
26515    else return PyObject_IsTrue(x);
26516 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)26517 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
26518     int retval;
26519     if (unlikely(!x)) return -1;
26520     retval = __Pyx_PyObject_IsTrue(x);
26521     Py_DECREF(x);
26522     return retval;
26523 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)26524 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
26525 #if PY_MAJOR_VERSION >= 3
26526     if (PyLong_Check(result)) {
26527         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
26528                 "__int__ returned non-int (type %.200s).  "
26529                 "The ability to return an instance of a strict subclass of int "
26530                 "is deprecated, and may be removed in a future version of Python.",
26531                 Py_TYPE(result)->tp_name)) {
26532             Py_DECREF(result);
26533             return NULL;
26534         }
26535         return result;
26536     }
26537 #endif
26538     PyErr_Format(PyExc_TypeError,
26539                  "__%.4s__ returned non-%.4s (type %.200s)",
26540                  type_name, type_name, Py_TYPE(result)->tp_name);
26541     Py_DECREF(result);
26542     return NULL;
26543 }
__Pyx_PyNumber_IntOrLong(PyObject * x)26544 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
26545 #if CYTHON_USE_TYPE_SLOTS
26546   PyNumberMethods *m;
26547 #endif
26548   const char *name = NULL;
26549   PyObject *res = NULL;
26550 #if PY_MAJOR_VERSION < 3
26551   if (likely(PyInt_Check(x) || PyLong_Check(x)))
26552 #else
26553   if (likely(PyLong_Check(x)))
26554 #endif
26555     return __Pyx_NewRef(x);
26556 #if CYTHON_USE_TYPE_SLOTS
26557   m = Py_TYPE(x)->tp_as_number;
26558   #if PY_MAJOR_VERSION < 3
26559   if (m && m->nb_int) {
26560     name = "int";
26561     res = m->nb_int(x);
26562   }
26563   else if (m && m->nb_long) {
26564     name = "long";
26565     res = m->nb_long(x);
26566   }
26567   #else
26568   if (likely(m && m->nb_int)) {
26569     name = "int";
26570     res = m->nb_int(x);
26571   }
26572   #endif
26573 #else
26574   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
26575     res = PyNumber_Int(x);
26576   }
26577 #endif
26578   if (likely(res)) {
26579 #if PY_MAJOR_VERSION < 3
26580     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
26581 #else
26582     if (unlikely(!PyLong_CheckExact(res))) {
26583 #endif
26584         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
26585     }
26586   }
26587   else if (!PyErr_Occurred()) {
26588     PyErr_SetString(PyExc_TypeError,
26589                     "an integer is required");
26590   }
26591   return res;
26592 }
26593 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
26594   Py_ssize_t ival;
26595   PyObject *x;
26596 #if PY_MAJOR_VERSION < 3
26597   if (likely(PyInt_CheckExact(b))) {
26598     if (sizeof(Py_ssize_t) >= sizeof(long))
26599         return PyInt_AS_LONG(b);
26600     else
26601         return PyInt_AsSsize_t(b);
26602   }
26603 #endif
26604   if (likely(PyLong_CheckExact(b))) {
26605     #if CYTHON_USE_PYLONG_INTERNALS
26606     const digit* digits = ((PyLongObject*)b)->ob_digit;
26607     const Py_ssize_t size = Py_SIZE(b);
26608     if (likely(__Pyx_sst_abs(size) <= 1)) {
26609         ival = likely(size) ? digits[0] : 0;
26610         if (size == -1) ival = -ival;
26611         return ival;
26612     } else {
26613       switch (size) {
26614          case 2:
26615            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26616              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26617            }
26618            break;
26619          case -2:
26620            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26621              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26622            }
26623            break;
26624          case 3:
26625            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
26626              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26627            }
26628            break;
26629          case -3:
26630            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
26631              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26632            }
26633            break;
26634          case 4:
26635            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
26636              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]));
26637            }
26638            break;
26639          case -4:
26640            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
26641              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]));
26642            }
26643            break;
26644       }
26645     }
26646     #endif
26647     return PyLong_AsSsize_t(b);
26648   }
26649   x = PyNumber_Index(b);
26650   if (!x) return -1;
26651   ival = PyInt_AsSsize_t(x);
26652   Py_DECREF(x);
26653   return ival;
26654 }
26655 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
26656   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
26657 }
26658 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
26659     return PyInt_FromSize_t(ival);
26660 }
26661 
26662 
26663 #endif /* Py_PYTHON_H */
26664