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\\npy_math.h",
22             "C:\\Anaconda\\lib\\site-packages\\numpy\\core\\include\\numpy\\ufuncobject.h"
23         ],
24         "include_dirs": [
25             "C:\\Anaconda\\lib\\site-packages\\numpy\\core\\include",
26             "C:\\\\Anaconda\\\\lib\\\\site-packages\\\\numpy\\\\core\\\\include"
27         ],
28         "libraries": [
29             "npymath"
30         ],
31         "library_dirs": [
32             "C:\\\\Anaconda\\\\lib\\\\site-packages\\\\numpy\\\\core\\\\lib"
33         ],
34         "name": "statsmodels.tsa.innovations._arma_innovations",
35         "sources": [
36             "statsmodels/tsa/innovations/_arma_innovations.pyx"
37         ]
38     },
39     "module_name": "statsmodels.tsa.innovations._arma_innovations"
40 }
41 END: Cython Metadata */
42 
43 #ifndef PY_SSIZE_T_CLEAN
44 #define PY_SSIZE_T_CLEAN
45 #endif /* PY_SSIZE_T_CLEAN */
46 #include "Python.h"
47 #ifndef Py_PYTHON_H
48     #error Python headers needed to compile C extensions, please install development version of Python.
49 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
50     #error Cython requires Python 2.6+ or Python 3.3+.
51 #else
52 #define CYTHON_ABI "0_29_24"
53 #define CYTHON_HEX_VERSION 0x001D18F0
54 #define CYTHON_FUTURE_DIVISION 1
55 #include <stddef.h>
56 #ifndef offsetof
57   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
58 #endif
59 #if !defined(WIN32) && !defined(MS_WINDOWS)
60   #ifndef __stdcall
61     #define __stdcall
62   #endif
63   #ifndef __cdecl
64     #define __cdecl
65   #endif
66   #ifndef __fastcall
67     #define __fastcall
68   #endif
69 #endif
70 #ifndef DL_IMPORT
71   #define DL_IMPORT(t) t
72 #endif
73 #ifndef DL_EXPORT
74   #define DL_EXPORT(t) t
75 #endif
76 #define __PYX_COMMA ,
77 #ifndef HAVE_LONG_LONG
78   #if PY_VERSION_HEX >= 0x02070000
79     #define HAVE_LONG_LONG
80   #endif
81 #endif
82 #ifndef PY_LONG_LONG
83   #define PY_LONG_LONG LONG_LONG
84 #endif
85 #ifndef Py_HUGE_VAL
86   #define Py_HUGE_VAL HUGE_VAL
87 #endif
88 #ifdef PYPY_VERSION
89   #define CYTHON_COMPILING_IN_PYPY 1
90   #define CYTHON_COMPILING_IN_PYSTON 0
91   #define CYTHON_COMPILING_IN_CPYTHON 0
92   #undef CYTHON_USE_TYPE_SLOTS
93   #define CYTHON_USE_TYPE_SLOTS 0
94   #undef CYTHON_USE_PYTYPE_LOOKUP
95   #define CYTHON_USE_PYTYPE_LOOKUP 0
96   #if PY_VERSION_HEX < 0x03050000
97     #undef CYTHON_USE_ASYNC_SLOTS
98     #define CYTHON_USE_ASYNC_SLOTS 0
99   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
100     #define CYTHON_USE_ASYNC_SLOTS 1
101   #endif
102   #undef CYTHON_USE_PYLIST_INTERNALS
103   #define CYTHON_USE_PYLIST_INTERNALS 0
104   #undef CYTHON_USE_UNICODE_INTERNALS
105   #define CYTHON_USE_UNICODE_INTERNALS 0
106   #undef CYTHON_USE_UNICODE_WRITER
107   #define CYTHON_USE_UNICODE_WRITER 0
108   #undef CYTHON_USE_PYLONG_INTERNALS
109   #define CYTHON_USE_PYLONG_INTERNALS 0
110   #undef CYTHON_AVOID_BORROWED_REFS
111   #define CYTHON_AVOID_BORROWED_REFS 1
112   #undef CYTHON_ASSUME_SAFE_MACROS
113   #define CYTHON_ASSUME_SAFE_MACROS 0
114   #undef CYTHON_UNPACK_METHODS
115   #define CYTHON_UNPACK_METHODS 0
116   #undef CYTHON_FAST_THREAD_STATE
117   #define CYTHON_FAST_THREAD_STATE 0
118   #undef CYTHON_FAST_PYCALL
119   #define CYTHON_FAST_PYCALL 0
120   #undef CYTHON_PEP489_MULTI_PHASE_INIT
121   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
122   #undef CYTHON_USE_TP_FINALIZE
123   #define CYTHON_USE_TP_FINALIZE 0
124   #undef CYTHON_USE_DICT_VERSIONS
125   #define CYTHON_USE_DICT_VERSIONS 0
126   #undef CYTHON_USE_EXC_INFO_STACK
127   #define CYTHON_USE_EXC_INFO_STACK 0
128 #elif defined(PYSTON_VERSION)
129   #define CYTHON_COMPILING_IN_PYPY 0
130   #define CYTHON_COMPILING_IN_PYSTON 1
131   #define CYTHON_COMPILING_IN_CPYTHON 0
132   #ifndef CYTHON_USE_TYPE_SLOTS
133     #define CYTHON_USE_TYPE_SLOTS 1
134   #endif
135   #undef CYTHON_USE_PYTYPE_LOOKUP
136   #define CYTHON_USE_PYTYPE_LOOKUP 0
137   #undef CYTHON_USE_ASYNC_SLOTS
138   #define CYTHON_USE_ASYNC_SLOTS 0
139   #undef CYTHON_USE_PYLIST_INTERNALS
140   #define CYTHON_USE_PYLIST_INTERNALS 0
141   #ifndef CYTHON_USE_UNICODE_INTERNALS
142     #define CYTHON_USE_UNICODE_INTERNALS 1
143   #endif
144   #undef CYTHON_USE_UNICODE_WRITER
145   #define CYTHON_USE_UNICODE_WRITER 0
146   #undef CYTHON_USE_PYLONG_INTERNALS
147   #define CYTHON_USE_PYLONG_INTERNALS 0
148   #ifndef CYTHON_AVOID_BORROWED_REFS
149     #define CYTHON_AVOID_BORROWED_REFS 0
150   #endif
151   #ifndef CYTHON_ASSUME_SAFE_MACROS
152     #define CYTHON_ASSUME_SAFE_MACROS 1
153   #endif
154   #ifndef CYTHON_UNPACK_METHODS
155     #define CYTHON_UNPACK_METHODS 1
156   #endif
157   #undef CYTHON_FAST_THREAD_STATE
158   #define CYTHON_FAST_THREAD_STATE 0
159   #undef CYTHON_FAST_PYCALL
160   #define CYTHON_FAST_PYCALL 0
161   #undef CYTHON_PEP489_MULTI_PHASE_INIT
162   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
163   #undef CYTHON_USE_TP_FINALIZE
164   #define CYTHON_USE_TP_FINALIZE 0
165   #undef CYTHON_USE_DICT_VERSIONS
166   #define CYTHON_USE_DICT_VERSIONS 0
167   #undef CYTHON_USE_EXC_INFO_STACK
168   #define CYTHON_USE_EXC_INFO_STACK 0
169 #else
170   #define CYTHON_COMPILING_IN_PYPY 0
171   #define CYTHON_COMPILING_IN_PYSTON 0
172   #define CYTHON_COMPILING_IN_CPYTHON 1
173   #ifndef CYTHON_USE_TYPE_SLOTS
174     #define CYTHON_USE_TYPE_SLOTS 1
175   #endif
176   #if PY_VERSION_HEX < 0x02070000
177     #undef CYTHON_USE_PYTYPE_LOOKUP
178     #define CYTHON_USE_PYTYPE_LOOKUP 0
179   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
180     #define CYTHON_USE_PYTYPE_LOOKUP 1
181   #endif
182   #if PY_MAJOR_VERSION < 3
183     #undef CYTHON_USE_ASYNC_SLOTS
184     #define CYTHON_USE_ASYNC_SLOTS 0
185   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
186     #define CYTHON_USE_ASYNC_SLOTS 1
187   #endif
188   #if PY_VERSION_HEX < 0x02070000
189     #undef CYTHON_USE_PYLONG_INTERNALS
190     #define CYTHON_USE_PYLONG_INTERNALS 0
191   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
192     #define CYTHON_USE_PYLONG_INTERNALS 1
193   #endif
194   #ifndef CYTHON_USE_PYLIST_INTERNALS
195     #define CYTHON_USE_PYLIST_INTERNALS 1
196   #endif
197   #ifndef CYTHON_USE_UNICODE_INTERNALS
198     #define CYTHON_USE_UNICODE_INTERNALS 1
199   #endif
200   #if PY_VERSION_HEX < 0x030300F0
201     #undef CYTHON_USE_UNICODE_WRITER
202     #define CYTHON_USE_UNICODE_WRITER 0
203   #elif !defined(CYTHON_USE_UNICODE_WRITER)
204     #define CYTHON_USE_UNICODE_WRITER 1
205   #endif
206   #ifndef CYTHON_AVOID_BORROWED_REFS
207     #define CYTHON_AVOID_BORROWED_REFS 0
208   #endif
209   #ifndef CYTHON_ASSUME_SAFE_MACROS
210     #define CYTHON_ASSUME_SAFE_MACROS 1
211   #endif
212   #ifndef CYTHON_UNPACK_METHODS
213     #define CYTHON_UNPACK_METHODS 1
214   #endif
215   #ifndef CYTHON_FAST_THREAD_STATE
216     #define CYTHON_FAST_THREAD_STATE 1
217   #endif
218   #ifndef CYTHON_FAST_PYCALL
219     #define CYTHON_FAST_PYCALL 1
220   #endif
221   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
222     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
223   #endif
224   #ifndef CYTHON_USE_TP_FINALIZE
225     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
226   #endif
227   #ifndef CYTHON_USE_DICT_VERSIONS
228     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
229   #endif
230   #ifndef CYTHON_USE_EXC_INFO_STACK
231     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
232   #endif
233 #endif
234 #if !defined(CYTHON_FAST_PYCCALL)
235 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
236 #endif
237 #if CYTHON_USE_PYLONG_INTERNALS
238   #include "longintrepr.h"
239   #undef SHIFT
240   #undef BASE
241   #undef MASK
242   #ifdef SIZEOF_VOID_P
243     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
244   #endif
245 #endif
246 #ifndef __has_attribute
247   #define __has_attribute(x) 0
248 #endif
249 #ifndef __has_cpp_attribute
250   #define __has_cpp_attribute(x) 0
251 #endif
252 #ifndef CYTHON_RESTRICT
253   #if defined(__GNUC__)
254     #define CYTHON_RESTRICT __restrict__
255   #elif defined(_MSC_VER) && _MSC_VER >= 1400
256     #define CYTHON_RESTRICT __restrict
257   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
258     #define CYTHON_RESTRICT restrict
259   #else
260     #define CYTHON_RESTRICT
261   #endif
262 #endif
263 #ifndef CYTHON_UNUSED
264 # if defined(__GNUC__)
265 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
266 #     define CYTHON_UNUSED __attribute__ ((__unused__))
267 #   else
268 #     define CYTHON_UNUSED
269 #   endif
270 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
271 #   define CYTHON_UNUSED __attribute__ ((__unused__))
272 # else
273 #   define CYTHON_UNUSED
274 # endif
275 #endif
276 #ifndef CYTHON_MAYBE_UNUSED_VAR
277 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)278      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
279 #  else
280 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
281 #  endif
282 #endif
283 #ifndef CYTHON_NCP_UNUSED
284 # if CYTHON_COMPILING_IN_CPYTHON
285 #  define CYTHON_NCP_UNUSED
286 # else
287 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
288 # endif
289 #endif
290 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
291 #ifdef _MSC_VER
292     #ifndef _MSC_STDINT_H_
293         #if _MSC_VER < 1300
294            typedef unsigned char     uint8_t;
295            typedef unsigned int      uint32_t;
296         #else
297            typedef unsigned __int8   uint8_t;
298            typedef unsigned __int32  uint32_t;
299         #endif
300     #endif
301 #else
302    #include <stdint.h>
303 #endif
304 #ifndef CYTHON_FALLTHROUGH
305   #if defined(__cplusplus) && __cplusplus >= 201103L
306     #if __has_cpp_attribute(fallthrough)
307       #define CYTHON_FALLTHROUGH [[fallthrough]]
308     #elif __has_cpp_attribute(clang::fallthrough)
309       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
310     #elif __has_cpp_attribute(gnu::fallthrough)
311       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
312     #endif
313   #endif
314   #ifndef CYTHON_FALLTHROUGH
315     #if __has_attribute(fallthrough)
316       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
317     #else
318       #define CYTHON_FALLTHROUGH
319     #endif
320   #endif
321   #if defined(__clang__ ) && defined(__apple_build_version__)
322     #if __apple_build_version__ < 7000000
323       #undef  CYTHON_FALLTHROUGH
324       #define CYTHON_FALLTHROUGH
325     #endif
326   #endif
327 #endif
328 
329 #ifndef CYTHON_INLINE
330   #if defined(__clang__)
331     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
332   #elif defined(__GNUC__)
333     #define CYTHON_INLINE __inline__
334   #elif defined(_MSC_VER)
335     #define CYTHON_INLINE __inline
336   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
337     #define CYTHON_INLINE inline
338   #else
339     #define CYTHON_INLINE
340   #endif
341 #endif
342 
343 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
344   #define Py_OptimizeFlag 0
345 #endif
346 #define __PYX_BUILD_PY_SSIZE_T "n"
347 #define CYTHON_FORMAT_SSIZE_T "z"
348 #if PY_MAJOR_VERSION < 3
349   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
350   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
351           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
352   #define __Pyx_DefaultClassType PyClass_Type
353 #else
354   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
355 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
356   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
357           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
358 #else
359   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
360           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
361 #endif
362   #define __Pyx_DefaultClassType PyType_Type
363 #endif
364 #ifndef Py_TPFLAGS_CHECKTYPES
365   #define Py_TPFLAGS_CHECKTYPES 0
366 #endif
367 #ifndef Py_TPFLAGS_HAVE_INDEX
368   #define Py_TPFLAGS_HAVE_INDEX 0
369 #endif
370 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
371   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
372 #endif
373 #ifndef Py_TPFLAGS_HAVE_FINALIZE
374   #define Py_TPFLAGS_HAVE_FINALIZE 0
375 #endif
376 #ifndef METH_STACKLESS
377   #define METH_STACKLESS 0
378 #endif
379 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
380   #ifndef METH_FASTCALL
381      #define METH_FASTCALL 0x80
382   #endif
383   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
384   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
385                                                           Py_ssize_t nargs, PyObject *kwnames);
386 #else
387   #define __Pyx_PyCFunctionFast _PyCFunctionFast
388   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
389 #endif
390 #if CYTHON_FAST_PYCCALL
391 #define __Pyx_PyFastCFunction_Check(func)\
392     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
393 #else
394 #define __Pyx_PyFastCFunction_Check(func) 0
395 #endif
396 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
397   #define PyObject_Malloc(s)   PyMem_Malloc(s)
398   #define PyObject_Free(p)     PyMem_Free(p)
399   #define PyObject_Realloc(p)  PyMem_Realloc(p)
400 #endif
401 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
402   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
403   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
404   #define PyMem_RawFree(p)             PyMem_Free(p)
405 #endif
406 #if CYTHON_COMPILING_IN_PYSTON
407   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
408   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
409 #else
410   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
411   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
412 #endif
413 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
414   #define __Pyx_PyThreadState_Current PyThreadState_GET()
415 #elif PY_VERSION_HEX >= 0x03060000
416   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
417 #elif PY_VERSION_HEX >= 0x03000000
418   #define __Pyx_PyThreadState_Current PyThreadState_GET()
419 #else
420   #define __Pyx_PyThreadState_Current _PyThreadState_Current
421 #endif
422 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
423 #include "pythread.h"
424 #define Py_tss_NEEDS_INIT 0
425 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)426 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
427   *key = PyThread_create_key();
428   return 0;
429 }
PyThread_tss_alloc(void)430 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
431   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
432   *key = Py_tss_NEEDS_INIT;
433   return key;
434 }
PyThread_tss_free(Py_tss_t * key)435 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
436   PyObject_Free(key);
437 }
PyThread_tss_is_created(Py_tss_t * key)438 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
439   return *key != Py_tss_NEEDS_INIT;
440 }
PyThread_tss_delete(Py_tss_t * key)441 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
442   PyThread_delete_key(*key);
443   *key = Py_tss_NEEDS_INIT;
444 }
PyThread_tss_set(Py_tss_t * key,void * value)445 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
446   return PyThread_set_key_value(*key, value);
447 }
PyThread_tss_get(Py_tss_t * key)448 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
449   return PyThread_get_key_value(*key);
450 }
451 #endif
452 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
453 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
454 #else
455 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
456 #endif
457 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
458   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
459   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
460 #else
461   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
462   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
463 #endif
464 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
465 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
466 #else
467 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
468 #endif
469 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
470   #define CYTHON_PEP393_ENABLED 1
471   #if defined(PyUnicode_IS_READY)
472   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
473                                               0 : _PyUnicode_Ready((PyObject *)(op)))
474   #else
475   #define __Pyx_PyUnicode_READY(op)       (0)
476   #endif
477   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
478   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
479   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
480   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
481   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
482   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
483   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
484   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
485   #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
486   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
487   #else
488   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
489   #endif
490   #else
491   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
492   #endif
493 #else
494   #define CYTHON_PEP393_ENABLED 0
495   #define PyUnicode_1BYTE_KIND  1
496   #define PyUnicode_2BYTE_KIND  2
497   #define PyUnicode_4BYTE_KIND  4
498   #define __Pyx_PyUnicode_READY(op)       (0)
499   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
500   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
501   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
502   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
503   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
504   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
505   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
506   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
507 #endif
508 #if CYTHON_COMPILING_IN_PYPY
509   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
510   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
511 #else
512   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
513   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
514       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
515 #endif
516 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
517   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
518 #endif
519 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
520   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
521 #endif
522 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
523   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
524 #endif
525 #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))
526 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
527 #if PY_MAJOR_VERSION >= 3
528   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
529 #else
530   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
531 #endif
532 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
533   #define PyObject_ASCII(o)            PyObject_Repr(o)
534 #endif
535 #if PY_MAJOR_VERSION >= 3
536   #define PyBaseString_Type            PyUnicode_Type
537   #define PyStringObject               PyUnicodeObject
538   #define PyString_Type                PyUnicode_Type
539   #define PyString_Check               PyUnicode_Check
540   #define PyString_CheckExact          PyUnicode_CheckExact
541 #ifndef PyObject_Unicode
542   #define PyObject_Unicode             PyObject_Str
543 #endif
544 #endif
545 #if PY_MAJOR_VERSION >= 3
546   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
547   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
548 #else
549   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
550   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
551 #endif
552 #ifndef PySet_CheckExact
553   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
554 #endif
555 #if PY_VERSION_HEX >= 0x030900A4
556   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
557   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
558 #else
559   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
560   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
561 #endif
562 #if CYTHON_ASSUME_SAFE_MACROS
563   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
564 #else
565   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
566 #endif
567 #if PY_MAJOR_VERSION >= 3
568   #define PyIntObject                  PyLongObject
569   #define PyInt_Type                   PyLong_Type
570   #define PyInt_Check(op)              PyLong_Check(op)
571   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
572   #define PyInt_FromString             PyLong_FromString
573   #define PyInt_FromUnicode            PyLong_FromUnicode
574   #define PyInt_FromLong               PyLong_FromLong
575   #define PyInt_FromSize_t             PyLong_FromSize_t
576   #define PyInt_FromSsize_t            PyLong_FromSsize_t
577   #define PyInt_AsLong                 PyLong_AsLong
578   #define PyInt_AS_LONG                PyLong_AS_LONG
579   #define PyInt_AsSsize_t              PyLong_AsSsize_t
580   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
581   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
582   #define PyNumber_Int                 PyNumber_Long
583 #endif
584 #if PY_MAJOR_VERSION >= 3
585   #define PyBoolObject                 PyLongObject
586 #endif
587 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
588   #ifndef PyUnicode_InternFromString
589     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
590   #endif
591 #endif
592 #if PY_VERSION_HEX < 0x030200A4
593   typedef long Py_hash_t;
594   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
595   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
596 #else
597   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
598   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
599 #endif
600 #if PY_MAJOR_VERSION >= 3
601   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
602 #else
603   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
604 #endif
605 #if CYTHON_USE_ASYNC_SLOTS
606   #if PY_VERSION_HEX >= 0x030500B1
607     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
608     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
609   #else
610     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
611   #endif
612 #else
613   #define __Pyx_PyType_AsAsync(obj) NULL
614 #endif
615 #ifndef __Pyx_PyAsyncMethodsStruct
616     typedef struct {
617         unaryfunc am_await;
618         unaryfunc am_aiter;
619         unaryfunc am_anext;
620     } __Pyx_PyAsyncMethodsStruct;
621 #endif
622 
623 #if defined(WIN32) || defined(MS_WINDOWS)
624   #define _USE_MATH_DEFINES
625 #endif
626 #include <math.h>
627 #ifdef NAN
628 #define __PYX_NAN() ((float) NAN)
629 #else
__PYX_NAN()630 static CYTHON_INLINE float __PYX_NAN() {
631   float value;
632   memset(&value, 0xFF, sizeof(value));
633   return value;
634 }
635 #endif
636 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
637 #define __Pyx_truncl trunc
638 #else
639 #define __Pyx_truncl truncl
640 #endif
641 
642 #define __PYX_MARK_ERR_POS(f_index, lineno) \
643     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
644 #define __PYX_ERR(f_index, lineno, Ln_error) \
645     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
646 
647 #ifndef __PYX_EXTERN_C
648   #ifdef __cplusplus
649     #define __PYX_EXTERN_C extern "C"
650   #else
651     #define __PYX_EXTERN_C extern
652   #endif
653 #endif
654 
655 #define __PYX_HAVE__statsmodels__tsa__innovations___arma_innovations
656 #define __PYX_HAVE_API__statsmodels__tsa__innovations___arma_innovations
657 /* Early includes */
658 #include <math.h>
659 #include <string.h>
660 #include <stdio.h>
661 #include "numpy/arrayobject.h"
662 #include "numpy/ndarrayobject.h"
663 #include "numpy/ndarraytypes.h"
664 #include "numpy/arrayscalars.h"
665 #include "numpy/ufuncobject.h"
666 
667     /* NumPy API declarations from "numpy/__init__.pxd" */
668 
669 #include "numpy/npy_math.h"
670 #include "pythread.h"
671 #include <stdlib.h>
672 #include "pystate.h"
673 #ifdef _OPENMP
674 #include <omp.h>
675 #endif /* _OPENMP */
676 
677 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
678 #define CYTHON_WITHOUT_ASSERTIONS
679 #endif
680 
681 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
682                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
683 
684 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
685 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
686 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
687 #define __PYX_DEFAULT_STRING_ENCODING ""
688 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
689 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
690 #define __Pyx_uchar_cast(c) ((unsigned char)c)
691 #define __Pyx_long_cast(x) ((long)x)
692 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
693     (sizeof(type) < sizeof(Py_ssize_t))  ||\
694     (sizeof(type) > sizeof(Py_ssize_t) &&\
695           likely(v < (type)PY_SSIZE_T_MAX ||\
696                  v == (type)PY_SSIZE_T_MAX)  &&\
697           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
698                                 v == (type)PY_SSIZE_T_MIN)))  ||\
699     (sizeof(type) == sizeof(Py_ssize_t) &&\
700           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
701                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)702 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
703     return (size_t) i < (size_t) limit;
704 }
705 #if defined (__cplusplus) && __cplusplus >= 201103L
706     #include <cstdlib>
707     #define __Pyx_sst_abs(value) std::abs(value)
708 #elif SIZEOF_INT >= SIZEOF_SIZE_T
709     #define __Pyx_sst_abs(value) abs(value)
710 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
711     #define __Pyx_sst_abs(value) labs(value)
712 #elif defined (_MSC_VER)
713     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
714 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
715     #define __Pyx_sst_abs(value) llabs(value)
716 #elif defined (__GNUC__)
717     #define __Pyx_sst_abs(value) __builtin_llabs(value)
718 #else
719     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
720 #endif
721 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
722 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
723 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
724 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
725 #define __Pyx_PyBytes_FromString        PyBytes_FromString
726 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
727 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
728 #if PY_MAJOR_VERSION < 3
729     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
730     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
731 #else
732     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
733     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
734 #endif
735 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
736 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
737 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
738 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
739 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
740 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
741 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
742 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
743 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
744 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
745 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
746 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
747 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
748 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
749 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
750 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)751 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
752     const Py_UNICODE *u_end = u;
753     while (*u_end++) ;
754     return (size_t)(u_end - u - 1);
755 }
756 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
757 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
758 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
759 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
760 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
761 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
762 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
763 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
764 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
765 #define __Pyx_PySequence_Tuple(obj)\
766     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
767 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
768 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
769 #if CYTHON_ASSUME_SAFE_MACROS
770 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
771 #else
772 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
773 #endif
774 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
775 #if PY_MAJOR_VERSION >= 3
776 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
777 #else
778 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
779 #endif
780 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
781 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
782 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)783 static int __Pyx_init_sys_getdefaultencoding_params(void) {
784     PyObject* sys;
785     PyObject* default_encoding = NULL;
786     PyObject* ascii_chars_u = NULL;
787     PyObject* ascii_chars_b = NULL;
788     const char* default_encoding_c;
789     sys = PyImport_ImportModule("sys");
790     if (!sys) goto bad;
791     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
792     Py_DECREF(sys);
793     if (!default_encoding) goto bad;
794     default_encoding_c = PyBytes_AsString(default_encoding);
795     if (!default_encoding_c) goto bad;
796     if (strcmp(default_encoding_c, "ascii") == 0) {
797         __Pyx_sys_getdefaultencoding_not_ascii = 0;
798     } else {
799         char ascii_chars[128];
800         int c;
801         for (c = 0; c < 128; c++) {
802             ascii_chars[c] = c;
803         }
804         __Pyx_sys_getdefaultencoding_not_ascii = 1;
805         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
806         if (!ascii_chars_u) goto bad;
807         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
808         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
809             PyErr_Format(
810                 PyExc_ValueError,
811                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
812                 default_encoding_c);
813             goto bad;
814         }
815         Py_DECREF(ascii_chars_u);
816         Py_DECREF(ascii_chars_b);
817     }
818     Py_DECREF(default_encoding);
819     return 0;
820 bad:
821     Py_XDECREF(default_encoding);
822     Py_XDECREF(ascii_chars_u);
823     Py_XDECREF(ascii_chars_b);
824     return -1;
825 }
826 #endif
827 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
828 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
829 #else
830 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
831 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
832 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)833 static int __Pyx_init_sys_getdefaultencoding_params(void) {
834     PyObject* sys;
835     PyObject* default_encoding = NULL;
836     char* default_encoding_c;
837     sys = PyImport_ImportModule("sys");
838     if (!sys) goto bad;
839     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
840     Py_DECREF(sys);
841     if (!default_encoding) goto bad;
842     default_encoding_c = PyBytes_AsString(default_encoding);
843     if (!default_encoding_c) goto bad;
844     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
845     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
846     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
847     Py_DECREF(default_encoding);
848     return 0;
849 bad:
850     Py_XDECREF(default_encoding);
851     return -1;
852 }
853 #endif
854 #endif
855 
856 
857 /* Test for GCC > 2.95 */
858 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
859   #define likely(x)   __builtin_expect(!!(x), 1)
860   #define unlikely(x) __builtin_expect(!!(x), 0)
861 #else /* !__GNUC__ or GCC < 2.95 */
862   #define likely(x)   (x)
863   #define unlikely(x) (x)
864 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)865 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
866 
867 static PyObject *__pyx_m = NULL;
868 static PyObject *__pyx_d;
869 static PyObject *__pyx_b;
870 static PyObject *__pyx_cython_runtime = NULL;
871 static PyObject *__pyx_empty_tuple;
872 static PyObject *__pyx_empty_bytes;
873 static PyObject *__pyx_empty_unicode;
874 static int __pyx_lineno;
875 static int __pyx_clineno = 0;
876 static const char * __pyx_cfilenm= __FILE__;
877 static const char *__pyx_filename;
878 
879 /* Header.proto */
880 #if !defined(CYTHON_CCOMPLEX)
881   #if defined(__cplusplus)
882     #define CYTHON_CCOMPLEX 1
883   #elif defined(_Complex_I)
884     #define CYTHON_CCOMPLEX 1
885   #else
886     #define CYTHON_CCOMPLEX 0
887   #endif
888 #endif
889 #if CYTHON_CCOMPLEX
890   #ifdef __cplusplus
891     #include <complex>
892   #else
893     #include <complex.h>
894   #endif
895 #endif
896 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
897   #undef _Complex_I
898   #define _Complex_I 1.0fj
899 #endif
900 
901 
902 static const char *__pyx_f[] = {
903   "statsmodels\\tsa\\innovations\\_arma_innovations.pyx",
904   "__init__.pxd",
905   "stringsource",
906   "type.pxd",
907 };
908 /* MemviewSliceStruct.proto */
909 struct __pyx_memoryview_obj;
910 typedef struct {
911   struct __pyx_memoryview_obj *memview;
912   char *data;
913   Py_ssize_t shape[8];
914   Py_ssize_t strides[8];
915   Py_ssize_t suboffsets[8];
916 } __Pyx_memviewslice;
917 #define __Pyx_MemoryView_Len(m)  (m.shape[0])
918 
919 /* Atomics.proto */
920 #include <pythread.h>
921 #ifndef CYTHON_ATOMICS
922     #define CYTHON_ATOMICS 1
923 #endif
924 #define __pyx_atomic_int_type int
925 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
926                     (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
927                     !defined(__i386__)
928     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
929     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
930     #ifdef __PYX_DEBUG_ATOMICS
931         #warning "Using GNU atomics"
932     #endif
933 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
934     #include <Windows.h>
935     #undef __pyx_atomic_int_type
936     #define __pyx_atomic_int_type LONG
937     #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
938     #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
939     #ifdef __PYX_DEBUG_ATOMICS
940         #pragma message ("Using MSVC atomics")
941     #endif
942 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
943     #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
944     #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
945     #ifdef __PYX_DEBUG_ATOMICS
946         #warning "Using Intel atomics"
947     #endif
948 #else
949     #undef CYTHON_ATOMICS
950     #define CYTHON_ATOMICS 0
951     #ifdef __PYX_DEBUG_ATOMICS
952         #warning "Not using atomics"
953     #endif
954 #endif
955 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
956 #if CYTHON_ATOMICS
957     #define __pyx_add_acquisition_count(memview)\
958              __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
959     #define __pyx_sub_acquisition_count(memview)\
960             __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
961 #else
962     #define __pyx_add_acquisition_count(memview)\
963             __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
964     #define __pyx_sub_acquisition_count(memview)\
965             __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
966 #endif
967 
968 /* ForceInitThreads.proto */
969 #ifndef __PYX_FORCE_INIT_THREADS
970   #define __PYX_FORCE_INIT_THREADS 0
971 #endif
972 
973 /* NoFastGil.proto */
974 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
975 #define __Pyx_PyGILState_Release PyGILState_Release
976 #define __Pyx_FastGIL_Remember()
977 #define __Pyx_FastGIL_Forget()
978 #define __Pyx_FastGilFuncInit()
979 
980 /* BufferFormatStructs.proto */
981 #define IS_UNSIGNED(type) (((type) -1) > 0)
982 struct __Pyx_StructField_;
983 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
984 typedef struct {
985   const char* name;
986   struct __Pyx_StructField_* fields;
987   size_t size;
988   size_t arraysize[8];
989   int ndim;
990   char typegroup;
991   char is_unsigned;
992   int flags;
993 } __Pyx_TypeInfo;
994 typedef struct __Pyx_StructField_ {
995   __Pyx_TypeInfo* type;
996   const char* name;
997   size_t offset;
998 } __Pyx_StructField;
999 typedef struct {
1000   __Pyx_StructField* field;
1001   size_t parent_offset;
1002 } __Pyx_BufFmt_StackElem;
1003 typedef struct {
1004   __Pyx_StructField root;
1005   __Pyx_BufFmt_StackElem* head;
1006   size_t fmt_offset;
1007   size_t new_count, enc_count;
1008   size_t struct_alignment;
1009   int is_complex;
1010   char enc_type;
1011   char new_packmode;
1012   char enc_packmode;
1013   char is_valid_array;
1014 } __Pyx_BufFmt_Context;
1015 
1016 
1017 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":690
1018  * # in Cython to enable them only on the right systems.
1019  *
1020  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
1021  * ctypedef npy_int16      int16_t
1022  * ctypedef npy_int32      int32_t
1023  */
1024 typedef npy_int8 __pyx_t_5numpy_int8_t;
1025 
1026 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":691
1027  *
1028  * ctypedef npy_int8       int8_t
1029  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
1030  * ctypedef npy_int32      int32_t
1031  * ctypedef npy_int64      int64_t
1032  */
1033 typedef npy_int16 __pyx_t_5numpy_int16_t;
1034 
1035 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":692
1036  * ctypedef npy_int8       int8_t
1037  * ctypedef npy_int16      int16_t
1038  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
1039  * ctypedef npy_int64      int64_t
1040  * #ctypedef npy_int96      int96_t
1041  */
1042 typedef npy_int32 __pyx_t_5numpy_int32_t;
1043 
1044 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":693
1045  * ctypedef npy_int16      int16_t
1046  * ctypedef npy_int32      int32_t
1047  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
1048  * #ctypedef npy_int96      int96_t
1049  * #ctypedef npy_int128     int128_t
1050  */
1051 typedef npy_int64 __pyx_t_5numpy_int64_t;
1052 
1053 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":697
1054  * #ctypedef npy_int128     int128_t
1055  *
1056  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
1057  * ctypedef npy_uint16     uint16_t
1058  * ctypedef npy_uint32     uint32_t
1059  */
1060 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1061 
1062 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":698
1063  *
1064  * ctypedef npy_uint8      uint8_t
1065  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
1066  * ctypedef npy_uint32     uint32_t
1067  * ctypedef npy_uint64     uint64_t
1068  */
1069 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1070 
1071 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":699
1072  * ctypedef npy_uint8      uint8_t
1073  * ctypedef npy_uint16     uint16_t
1074  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
1075  * ctypedef npy_uint64     uint64_t
1076  * #ctypedef npy_uint96     uint96_t
1077  */
1078 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1079 
1080 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":700
1081  * ctypedef npy_uint16     uint16_t
1082  * ctypedef npy_uint32     uint32_t
1083  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
1084  * #ctypedef npy_uint96     uint96_t
1085  * #ctypedef npy_uint128    uint128_t
1086  */
1087 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1088 
1089 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":704
1090  * #ctypedef npy_uint128    uint128_t
1091  *
1092  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
1093  * ctypedef npy_float64    float64_t
1094  * #ctypedef npy_float80    float80_t
1095  */
1096 typedef npy_float32 __pyx_t_5numpy_float32_t;
1097 
1098 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":705
1099  *
1100  * ctypedef npy_float32    float32_t
1101  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
1102  * #ctypedef npy_float80    float80_t
1103  * #ctypedef npy_float128   float128_t
1104  */
1105 typedef npy_float64 __pyx_t_5numpy_float64_t;
1106 
1107 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":714
1108  * # The int types are mapped a bit surprising --
1109  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1110  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
1111  * ctypedef npy_longlong   long_t
1112  * ctypedef npy_longlong   longlong_t
1113  */
1114 typedef npy_long __pyx_t_5numpy_int_t;
1115 
1116 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":715
1117  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1118  * ctypedef npy_long       int_t
1119  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
1120  * ctypedef npy_longlong   longlong_t
1121  *
1122  */
1123 typedef npy_longlong __pyx_t_5numpy_long_t;
1124 
1125 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":716
1126  * ctypedef npy_long       int_t
1127  * ctypedef npy_longlong   long_t
1128  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
1129  *
1130  * ctypedef npy_ulong      uint_t
1131  */
1132 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1133 
1134 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":718
1135  * ctypedef npy_longlong   longlong_t
1136  *
1137  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
1138  * ctypedef npy_ulonglong  ulong_t
1139  * ctypedef npy_ulonglong  ulonglong_t
1140  */
1141 typedef npy_ulong __pyx_t_5numpy_uint_t;
1142 
1143 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":719
1144  *
1145  * ctypedef npy_ulong      uint_t
1146  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
1147  * ctypedef npy_ulonglong  ulonglong_t
1148  *
1149  */
1150 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1151 
1152 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":720
1153  * ctypedef npy_ulong      uint_t
1154  * ctypedef npy_ulonglong  ulong_t
1155  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
1156  *
1157  * ctypedef npy_intp       intp_t
1158  */
1159 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1160 
1161 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":722
1162  * ctypedef npy_ulonglong  ulonglong_t
1163  *
1164  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
1165  * ctypedef npy_uintp      uintp_t
1166  *
1167  */
1168 typedef npy_intp __pyx_t_5numpy_intp_t;
1169 
1170 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":723
1171  *
1172  * ctypedef npy_intp       intp_t
1173  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
1174  *
1175  * ctypedef npy_double     float_t
1176  */
1177 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1178 
1179 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":725
1180  * ctypedef npy_uintp      uintp_t
1181  *
1182  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
1183  * ctypedef npy_double     double_t
1184  * ctypedef npy_longdouble longdouble_t
1185  */
1186 typedef npy_double __pyx_t_5numpy_float_t;
1187 
1188 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":726
1189  *
1190  * ctypedef npy_double     float_t
1191  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
1192  * ctypedef npy_longdouble longdouble_t
1193  *
1194  */
1195 typedef npy_double __pyx_t_5numpy_double_t;
1196 
1197 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":727
1198  * ctypedef npy_double     float_t
1199  * ctypedef npy_double     double_t
1200  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
1201  *
1202  * ctypedef npy_cfloat      cfloat_t
1203  */
1204 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1205 /* Declarations.proto */
1206 #if CYTHON_CCOMPLEX
1207   #ifdef __cplusplus
1208     typedef ::std::complex< double > __pyx_t_double_complex;
1209   #else
1210     typedef double _Complex __pyx_t_double_complex;
1211   #endif
1212 #else
1213     typedef struct { double real, imag; } __pyx_t_double_complex;
1214 #endif
1215 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1216 
1217 /* Declarations.proto */
1218 #if CYTHON_CCOMPLEX
1219   #ifdef __cplusplus
1220     typedef ::std::complex< float > __pyx_t_float_complex;
1221   #else
1222     typedef float _Complex __pyx_t_float_complex;
1223   #endif
1224 #else
1225     typedef struct { float real, imag; } __pyx_t_float_complex;
1226 #endif
1227 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1228 
1229 
1230 /*--- Type declarations ---*/
1231 struct __pyx_array_obj;
1232 struct __pyx_MemviewEnum_obj;
1233 struct __pyx_memoryview_obj;
1234 struct __pyx_memoryviewslice_obj;
1235 
1236 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":729
1237  * ctypedef npy_longdouble longdouble_t
1238  *
1239  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
1240  * ctypedef npy_cdouble     cdouble_t
1241  * ctypedef npy_clongdouble clongdouble_t
1242  */
1243 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1244 
1245 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":730
1246  *
1247  * ctypedef npy_cfloat      cfloat_t
1248  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
1249  * ctypedef npy_clongdouble clongdouble_t
1250  *
1251  */
1252 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1253 
1254 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":731
1255  * ctypedef npy_cfloat      cfloat_t
1256  * ctypedef npy_cdouble     cdouble_t
1257  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
1258  *
1259  * ctypedef npy_cdouble     complex_t
1260  */
1261 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1262 
1263 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":733
1264  * ctypedef npy_clongdouble clongdouble_t
1265  *
1266  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
1267  *
1268  * cdef inline object PyArray_MultiIterNew1(a):
1269  */
1270 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1271 
1272 /* "View.MemoryView":105
1273  *
1274  * @cname("__pyx_array")
1275  * cdef class array:             # <<<<<<<<<<<<<<
1276  *
1277  *     cdef:
1278  */
1279 struct __pyx_array_obj {
1280   PyObject_HEAD
1281   struct __pyx_vtabstruct_array *__pyx_vtab;
1282   char *data;
1283   Py_ssize_t len;
1284   char *format;
1285   int ndim;
1286   Py_ssize_t *_shape;
1287   Py_ssize_t *_strides;
1288   Py_ssize_t itemsize;
1289   PyObject *mode;
1290   PyObject *_format;
1291   void (*callback_free_data)(void *);
1292   int free_data;
1293   int dtype_is_object;
1294 };
1295 
1296 
1297 /* "View.MemoryView":279
1298  *
1299  * @cname('__pyx_MemviewEnum')
1300  * cdef class Enum(object):             # <<<<<<<<<<<<<<
1301  *     cdef object name
1302  *     def __init__(self, name):
1303  */
1304 struct __pyx_MemviewEnum_obj {
1305   PyObject_HEAD
1306   PyObject *name;
1307 };
1308 
1309 
1310 /* "View.MemoryView":330
1311  *
1312  * @cname('__pyx_memoryview')
1313  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1314  *
1315  *     cdef object obj
1316  */
1317 struct __pyx_memoryview_obj {
1318   PyObject_HEAD
1319   struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1320   PyObject *obj;
1321   PyObject *_size;
1322   PyObject *_array_interface;
1323   PyThread_type_lock lock;
1324   __pyx_atomic_int acquisition_count[2];
1325   __pyx_atomic_int *acquisition_count_aligned_p;
1326   Py_buffer view;
1327   int flags;
1328   int dtype_is_object;
1329   __Pyx_TypeInfo *typeinfo;
1330 };
1331 
1332 
1333 /* "View.MemoryView":965
1334  *
1335  * @cname('__pyx_memoryviewslice')
1336  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1337  *     "Internal class for passing memoryview slices to Python"
1338  *
1339  */
1340 struct __pyx_memoryviewslice_obj {
1341   struct __pyx_memoryview_obj __pyx_base;
1342   __Pyx_memviewslice from_slice;
1343   PyObject *from_object;
1344   PyObject *(*to_object_func)(char *);
1345   int (*to_dtype_func)(char *, PyObject *);
1346 };
1347 
1348 
1349 
1350 /* "View.MemoryView":105
1351  *
1352  * @cname("__pyx_array")
1353  * cdef class array:             # <<<<<<<<<<<<<<
1354  *
1355  *     cdef:
1356  */
1357 
1358 struct __pyx_vtabstruct_array {
1359   PyObject *(*get_memview)(struct __pyx_array_obj *);
1360 };
1361 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1362 
1363 
1364 /* "View.MemoryView":330
1365  *
1366  * @cname('__pyx_memoryview')
1367  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1368  *
1369  *     cdef object obj
1370  */
1371 
1372 struct __pyx_vtabstruct_memoryview {
1373   char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1374   PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1375   PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1376   PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1377   PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1378   PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1379   PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1380 };
1381 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1382 
1383 
1384 /* "View.MemoryView":965
1385  *
1386  * @cname('__pyx_memoryviewslice')
1387  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1388  *     "Internal class for passing memoryview slices to Python"
1389  *
1390  */
1391 
1392 struct __pyx_vtabstruct__memoryviewslice {
1393   struct __pyx_vtabstruct_memoryview __pyx_base;
1394 };
1395 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1396 
1397 /* --- Runtime support code (head) --- */
1398 /* Refnanny.proto */
1399 #ifndef CYTHON_REFNANNY
1400   #define CYTHON_REFNANNY 0
1401 #endif
1402 #if CYTHON_REFNANNY
1403   typedef struct {
1404     void (*INCREF)(void*, PyObject*, int);
1405     void (*DECREF)(void*, PyObject*, int);
1406     void (*GOTREF)(void*, PyObject*, int);
1407     void (*GIVEREF)(void*, PyObject*, int);
1408     void* (*SetupContext)(const char*, int, const char*);
1409     void (*FinishContext)(void**);
1410   } __Pyx_RefNannyAPIStruct;
1411   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1412   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1413   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1414 #ifdef WITH_THREAD
1415   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1416           if (acquire_gil) {\
1417               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1418               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1419               PyGILState_Release(__pyx_gilstate_save);\
1420           } else {\
1421               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1422           }
1423 #else
1424   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1425           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1426 #endif
1427   #define __Pyx_RefNannyFinishContext()\
1428           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1429   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1430   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1431   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1432   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1433   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1434   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1435   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1436   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1437 #else
1438   #define __Pyx_RefNannyDeclarations
1439   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1440   #define __Pyx_RefNannyFinishContext()
1441   #define __Pyx_INCREF(r) Py_INCREF(r)
1442   #define __Pyx_DECREF(r) Py_DECREF(r)
1443   #define __Pyx_GOTREF(r)
1444   #define __Pyx_GIVEREF(r)
1445   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1446   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1447   #define __Pyx_XGOTREF(r)
1448   #define __Pyx_XGIVEREF(r)
1449 #endif
1450 #define __Pyx_XDECREF_SET(r, v) do {\
1451         PyObject *tmp = (PyObject *) r;\
1452         r = v; __Pyx_XDECREF(tmp);\
1453     } while (0)
1454 #define __Pyx_DECREF_SET(r, v) do {\
1455         PyObject *tmp = (PyObject *) r;\
1456         r = v; __Pyx_DECREF(tmp);\
1457     } while (0)
1458 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1459 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1460 
1461 /* PyObjectGetAttrStr.proto */
1462 #if CYTHON_USE_TYPE_SLOTS
1463 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1464 #else
1465 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1466 #endif
1467 
1468 /* GetBuiltinName.proto */
1469 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1470 
1471 /* py_abs.proto */
1472 #if CYTHON_USE_PYLONG_INTERNALS
1473 static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
1474 #define __Pyx_PyNumber_Absolute(x)\
1475     ((likely(PyLong_CheckExact(x))) ?\
1476          (likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
1477          PyNumber_Absolute(x))
1478 #else
1479 #define __Pyx_PyNumber_Absolute(x)  PyNumber_Absolute(x)
1480 #endif
1481 
1482 /* MemviewSliceInit.proto */
1483 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1484 #define __Pyx_MEMVIEW_DIRECT   1
1485 #define __Pyx_MEMVIEW_PTR      2
1486 #define __Pyx_MEMVIEW_FULL     4
1487 #define __Pyx_MEMVIEW_CONTIG   8
1488 #define __Pyx_MEMVIEW_STRIDED  16
1489 #define __Pyx_MEMVIEW_FOLLOW   32
1490 #define __Pyx_IS_C_CONTIG 1
1491 #define __Pyx_IS_F_CONTIG 2
1492 static int __Pyx_init_memviewslice(
1493                 struct __pyx_memoryview_obj *memview,
1494                 int ndim,
1495                 __Pyx_memviewslice *memviewslice,
1496                 int memview_is_new_reference);
1497 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1498     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1499 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1500     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1501 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1502 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1503 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1504 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1505 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1506 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1507 
1508 /* RaiseArgTupleInvalid.proto */
1509 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1510     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1511 
1512 /* RaiseDoubleKeywords.proto */
1513 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1514 
1515 /* ParseKeywords.proto */
1516 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1517     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1518     const char* function_name);
1519 
1520 /* None.proto */
1521 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1522 
1523 /* PyDictVersioning.proto */
1524 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1525 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1526 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1527 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1528     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1529     (cache_var) = (value);
1530 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1531     static PY_UINT64_T __pyx_dict_version = 0;\
1532     static PyObject *__pyx_dict_cached_value = NULL;\
1533     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1534         (VAR) = __pyx_dict_cached_value;\
1535     } else {\
1536         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1537         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1538     }\
1539 }
1540 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1541 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1542 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1543 #else
1544 #define __PYX_GET_DICT_VERSION(dict)  (0)
1545 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1546 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1547 #endif
1548 
1549 /* GetModuleGlobalName.proto */
1550 #if CYTHON_USE_DICT_VERSIONS
1551 #define __Pyx_GetModuleGlobalName(var, name)  {\
1552     static PY_UINT64_T __pyx_dict_version = 0;\
1553     static PyObject *__pyx_dict_cached_value = NULL;\
1554     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1555         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1556         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1557 }
1558 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1559     PY_UINT64_T __pyx_dict_version;\
1560     PyObject *__pyx_dict_cached_value;\
1561     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1562 }
1563 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1564 #else
1565 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1566 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1567 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1568 #endif
1569 
1570 /* PyObjectCall.proto */
1571 #if CYTHON_COMPILING_IN_CPYTHON
1572 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1573 #else
1574 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1575 #endif
1576 
1577 /* RaiseTooManyValuesToUnpack.proto */
1578 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1579 
1580 /* RaiseNeedMoreValuesToUnpack.proto */
1581 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1582 
1583 /* IterFinish.proto */
1584 static CYTHON_INLINE int __Pyx_IterFinish(void);
1585 
1586 /* UnpackItemEndCheck.proto */
1587 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1588 
1589 /* GetTopmostException.proto */
1590 #if CYTHON_USE_EXC_INFO_STACK
1591 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1592 #endif
1593 
1594 /* PyThreadStateGet.proto */
1595 #if CYTHON_FAST_THREAD_STATE
1596 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1597 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1598 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1599 #else
1600 #define __Pyx_PyThreadState_declare
1601 #define __Pyx_PyThreadState_assign
1602 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1603 #endif
1604 
1605 /* SaveResetException.proto */
1606 #if CYTHON_FAST_THREAD_STATE
1607 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1608 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1609 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1610 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1611 #else
1612 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1613 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1614 #endif
1615 
1616 /* PyErrExceptionMatches.proto */
1617 #if CYTHON_FAST_THREAD_STATE
1618 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1619 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1620 #else
1621 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1622 #endif
1623 
1624 /* GetException.proto */
1625 #if CYTHON_FAST_THREAD_STATE
1626 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1627 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1628 #else
1629 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1630 #endif
1631 
1632 /* PyErrFetchRestore.proto */
1633 #if CYTHON_FAST_THREAD_STATE
1634 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1635 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1636 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1637 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1638 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1639 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1640 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1641 #if CYTHON_COMPILING_IN_CPYTHON
1642 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1643 #else
1644 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1645 #endif
1646 #else
1647 #define __Pyx_PyErr_Clear() PyErr_Clear()
1648 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1649 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1650 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1651 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1652 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1653 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1654 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1655 #endif
1656 
1657 /* RaiseException.proto */
1658 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1659 
1660 /* ArgTypeTest.proto */
1661 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1662     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1663         __Pyx__ArgTypeTest(obj, type, name, exact))
1664 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1665 
1666 /* PyCFunctionFastCall.proto */
1667 #if CYTHON_FAST_PYCCALL
1668 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1669 #else
1670 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1671 #endif
1672 
1673 /* PyFunctionFastCall.proto */
1674 #if CYTHON_FAST_PYCALL
1675 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1676     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1677 #if 1 || PY_VERSION_HEX < 0x030600B1
1678 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1679 #else
1680 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1681 #endif
1682 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1683     (sizeof(char [1 - 2*!(cond)]) - 1)
1684 #ifndef Py_MEMBER_SIZE
1685 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1686 #endif
1687   static size_t __pyx_pyframe_localsplus_offset = 0;
1688   #include "frameobject.h"
1689   #define __Pxy_PyFrame_Initialize_Offsets()\
1690     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1691      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1692   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1693     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1694 #endif
1695 
1696 /* PyObjectCall2Args.proto */
1697 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1698 
1699 /* PyObjectCallMethO.proto */
1700 #if CYTHON_COMPILING_IN_CPYTHON
1701 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1702 #endif
1703 
1704 /* PyObjectCallOneArg.proto */
1705 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1706 
1707 /* IncludeStringH.proto */
1708 #include <string.h>
1709 
1710 /* BytesEquals.proto */
1711 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1712 
1713 /* UnicodeEquals.proto */
1714 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1715 
1716 /* StrEquals.proto */
1717 #if PY_MAJOR_VERSION >= 3
1718 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1719 #else
1720 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1721 #endif
1722 
1723 /* None.proto */
1724 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1725 
1726 /* UnaryNegOverflows.proto */
1727 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1728         (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1729 
1730 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1731 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1732 /* GetAttr.proto */
1733 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1734 
1735 /* GetItemInt.proto */
1736 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1737     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1738     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1739     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1740                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1741 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1742     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1743     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1744     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1745 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1746                                                               int wraparound, int boundscheck);
1747 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1748     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1749     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1750     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1751 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1752                                                               int wraparound, int boundscheck);
1753 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1754 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1755                                                      int is_list, int wraparound, int boundscheck);
1756 
1757 /* ObjectGetItem.proto */
1758 #if CYTHON_USE_TYPE_SLOTS
1759 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1760 #else
1761 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1762 #endif
1763 
1764 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1765 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1766     int byteorder = 0;
1767     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1768 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1769 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1770     int byteorder = -1;
1771     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1772 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)1773 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1774     int byteorder = 1;
1775     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1776 }
1777 
1778 /* decode_c_string.proto */
1779 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1780          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1781          const char* encoding, const char* errors,
1782          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1783 
1784 /* GetAttr3.proto */
1785 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1786 
1787 /* RaiseNoneIterError.proto */
1788 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1789 
1790 /* ExtTypeTest.proto */
1791 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1792 
1793 /* SwapException.proto */
1794 #if CYTHON_FAST_THREAD_STATE
1795 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1796 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1797 #else
1798 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1799 #endif
1800 
1801 /* Import.proto */
1802 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1803 
1804 /* FastTypeChecks.proto */
1805 #if CYTHON_COMPILING_IN_CPYTHON
1806 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1807 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1808 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1809 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1810 #else
1811 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1812 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1813 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1814 #endif
1815 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1816 
1817 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1818 /* ListCompAppend.proto */
1819 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)1820 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1821     PyListObject* L = (PyListObject*) list;
1822     Py_ssize_t len = Py_SIZE(list);
1823     if (likely(L->allocated > len)) {
1824         Py_INCREF(x);
1825         PyList_SET_ITEM(list, len, x);
1826         __Pyx_SET_SIZE(list, len + 1);
1827         return 0;
1828     }
1829     return PyList_Append(list, x);
1830 }
1831 #else
1832 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1833 #endif
1834 
1835 /* PyIntBinop.proto */
1836 #if !CYTHON_COMPILING_IN_PYPY
1837 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1838 #else
1839 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1840     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1841 #endif
1842 
1843 /* ListExtend.proto */
__Pyx_PyList_Extend(PyObject * L,PyObject * v)1844 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1845 #if CYTHON_COMPILING_IN_CPYTHON
1846     PyObject* none = _PyList_Extend((PyListObject*)L, v);
1847     if (unlikely(!none))
1848         return -1;
1849     Py_DECREF(none);
1850     return 0;
1851 #else
1852     return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1853 #endif
1854 }
1855 
1856 /* ListAppend.proto */
1857 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1858 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1859     PyListObject* L = (PyListObject*) list;
1860     Py_ssize_t len = Py_SIZE(list);
1861     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1862         Py_INCREF(x);
1863         PyList_SET_ITEM(list, len, x);
1864         __Pyx_SET_SIZE(list, len + 1);
1865         return 0;
1866     }
1867     return PyList_Append(list, x);
1868 }
1869 #else
1870 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1871 #endif
1872 
1873 /* None.proto */
1874 static CYTHON_INLINE long __Pyx_div_long(long, long);
1875 
1876 /* ImportFrom.proto */
1877 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1878 
1879 /* HasAttr.proto */
1880 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1881 
1882 /* PyObject_GenericGetAttrNoDict.proto */
1883 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1884 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1885 #else
1886 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1887 #endif
1888 
1889 /* PyObject_GenericGetAttr.proto */
1890 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1891 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1892 #else
1893 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1894 #endif
1895 
1896 /* SetVTable.proto */
1897 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1898 
1899 /* PyObjectGetAttrStrNoError.proto */
1900 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1901 
1902 /* SetupReduce.proto */
1903 static int __Pyx_setup_reduce(PyObject* type_obj);
1904 
1905 /* TypeImport.proto */
1906 #ifndef __PYX_HAVE_RT_ImportType_proto
1907 #define __PYX_HAVE_RT_ImportType_proto
1908 enum __Pyx_ImportType_CheckSize {
1909    __Pyx_ImportType_CheckSize_Error = 0,
1910    __Pyx_ImportType_CheckSize_Warn = 1,
1911    __Pyx_ImportType_CheckSize_Ignore = 2
1912 };
1913 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1914 #endif
1915 
1916 /* CLineInTraceback.proto */
1917 #ifdef CYTHON_CLINE_IN_TRACEBACK
1918 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1919 #else
1920 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1921 #endif
1922 
1923 /* CodeObjectCache.proto */
1924 typedef struct {
1925     PyCodeObject* code_object;
1926     int code_line;
1927 } __Pyx_CodeObjectCacheEntry;
1928 struct __Pyx_CodeObjectCache {
1929     int count;
1930     int max_count;
1931     __Pyx_CodeObjectCacheEntry* entries;
1932 };
1933 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1934 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1935 static PyCodeObject *__pyx_find_code_object(int code_line);
1936 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1937 
1938 /* AddTraceback.proto */
1939 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1940                                int py_line, const char *filename);
1941 
1942 #if PY_MAJOR_VERSION < 3
1943     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1944     static void __Pyx_ReleaseBuffer(Py_buffer *view);
1945 #else
1946     #define __Pyx_GetBuffer PyObject_GetBuffer
1947     #define __Pyx_ReleaseBuffer PyBuffer_Release
1948 #endif
1949 
1950 
1951 /* BufferStructDeclare.proto */
1952 typedef struct {
1953   Py_ssize_t shape, strides, suboffsets;
1954 } __Pyx_Buf_DimInfo;
1955 typedef struct {
1956   size_t refcount;
1957   Py_buffer pybuffer;
1958 } __Pyx_Buffer;
1959 typedef struct {
1960   __Pyx_Buffer *rcbuffer;
1961   char *data;
1962   __Pyx_Buf_DimInfo diminfo[8];
1963 } __Pyx_LocalBuf_ND;
1964 
1965 /* MemviewSliceIsContig.proto */
1966 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
1967 
1968 /* OverlappingSlices.proto */
1969 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
1970                                 __Pyx_memviewslice *slice2,
1971                                 int ndim, size_t itemsize);
1972 
1973 /* Capsule.proto */
1974 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
1975 
1976 /* IsLittleEndian.proto */
1977 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1978 
1979 /* BufferFormatCheck.proto */
1980 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1981 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1982                               __Pyx_BufFmt_StackElem* stack,
1983                               __Pyx_TypeInfo* type);
1984 
1985 /* TypeInfoCompare.proto */
1986 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
1987 
1988 /* MemviewSliceValidateAndInit.proto */
1989 static int __Pyx_ValidateAndInit_memviewslice(
1990                 int *axes_specs,
1991                 int c_or_f_flag,
1992                 int buf_flags,
1993                 int ndim,
1994                 __Pyx_TypeInfo *dtype,
1995                 __Pyx_BufFmt_StackElem stack[],
1996                 __Pyx_memviewslice *memviewslice,
1997                 PyObject *original_obj);
1998 
1999 /* ObjectToMemviewSlice.proto */
2000 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(PyObject *, int writable_flag);
2001 
2002 /* GCCDiagnostics.proto */
2003 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2004 #define __Pyx_HAS_GCC_DIAGNOSTIC
2005 #endif
2006 
2007 /* ObjectToMemviewSlice.proto */
2008 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float32_t(PyObject *, int writable_flag);
2009 
2010 /* ObjectToMemviewSlice.proto */
2011 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *, int writable_flag);
2012 
2013 /* ObjectToMemviewSlice.proto */
2014 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(PyObject *, int writable_flag);
2015 
2016 /* ObjectToMemviewSlice.proto */
2017 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(PyObject *, int writable_flag);
2018 
2019 /* ObjectToMemviewSlice.proto */
2020 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_float_complex(PyObject *, int writable_flag);
2021 
2022 /* FromPy.proto */
2023 static __pyx_t_float_complex __Pyx_PyComplex_As___pyx_t_float_complex(PyObject*);
2024 
2025 /* ObjectToMemviewSlice.proto */
2026 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(PyObject *, int writable_flag);
2027 
2028 /* ObjectToMemviewSlice.proto */
2029 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(PyObject *, int writable_flag);
2030 
2031 /* FromPy.proto */
2032 static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject*);
2033 
2034 /* MemviewDtypeToObject.proto */
2035 static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_float32_t(const char *itemp);
2036 static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_float32_t(const char *itemp, PyObject *obj);
2037 
2038 /* MemviewDtypeToObject.proto */
2039 static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_float64_t(const char *itemp);
2040 static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_float64_t(const char *itemp, PyObject *obj);
2041 
2042 /* ToPy.proto */
2043 #define __pyx_PyComplex_FromComplex(z)\
2044         PyComplex_FromDoubles((double)__Pyx_CREAL(z),\
2045                               (double)__Pyx_CIMAG(z))
2046 
2047 /* MemviewDtypeToObject.proto */
2048 static CYTHON_INLINE PyObject *__pyx_memview_get___pyx_t_float_complex(const char *itemp);
2049 static CYTHON_INLINE int __pyx_memview_set___pyx_t_float_complex(const char *itemp, PyObject *obj);
2050 
2051 /* RealImag.proto */
2052 #if CYTHON_CCOMPLEX
2053   #ifdef __cplusplus
2054     #define __Pyx_CREAL(z) ((z).real())
2055     #define __Pyx_CIMAG(z) ((z).imag())
2056   #else
2057     #define __Pyx_CREAL(z) (__real__(z))
2058     #define __Pyx_CIMAG(z) (__imag__(z))
2059   #endif
2060 #else
2061     #define __Pyx_CREAL(z) ((z).real)
2062     #define __Pyx_CIMAG(z) ((z).imag)
2063 #endif
2064 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2065         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2066     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2067     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2068 #else
2069     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2070     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2071 #endif
2072 
2073 /* Arithmetic.proto */
2074 #if CYTHON_CCOMPLEX
2075     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
2076     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
2077     #define __Pyx_c_diff_double(a, b) ((a)-(b))
2078     #define __Pyx_c_prod_double(a, b) ((a)*(b))
2079     #define __Pyx_c_quot_double(a, b) ((a)/(b))
2080     #define __Pyx_c_neg_double(a)     (-(a))
2081   #ifdef __cplusplus
2082     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2083     #define __Pyx_c_conj_double(z)    (::std::conj(z))
2084     #if 1
2085         #define __Pyx_c_abs_double(z)     (::std::abs(z))
2086         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
2087     #endif
2088   #else
2089     #define __Pyx_c_is_zero_double(z) ((z)==0)
2090     #define __Pyx_c_conj_double(z)    (conj(z))
2091     #if 1
2092         #define __Pyx_c_abs_double(z)     (cabs(z))
2093         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
2094     #endif
2095  #endif
2096 #else
2097     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2098     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2099     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2100     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2101     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2102     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2103     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2104     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2105     #if 1
2106         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2107         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2108     #endif
2109 #endif
2110 
2111 /* Arithmetic.proto */
2112 #if CYTHON_CCOMPLEX
2113     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
2114     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
2115     #define __Pyx_c_diff_float(a, b) ((a)-(b))
2116     #define __Pyx_c_prod_float(a, b) ((a)*(b))
2117     #define __Pyx_c_quot_float(a, b) ((a)/(b))
2118     #define __Pyx_c_neg_float(a)     (-(a))
2119   #ifdef __cplusplus
2120     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2121     #define __Pyx_c_conj_float(z)    (::std::conj(z))
2122     #if 1
2123         #define __Pyx_c_abs_float(z)     (::std::abs(z))
2124         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
2125     #endif
2126   #else
2127     #define __Pyx_c_is_zero_float(z) ((z)==0)
2128     #define __Pyx_c_conj_float(z)    (conjf(z))
2129     #if 1
2130         #define __Pyx_c_abs_float(z)     (cabsf(z))
2131         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
2132     #endif
2133  #endif
2134 #else
2135     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2136     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2137     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2138     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2139     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2140     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2141     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2142     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2143     #if 1
2144         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2145         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2146     #endif
2147 #endif
2148 
2149 /* MemviewDtypeToObject.proto */
2150 static CYTHON_INLINE PyObject *__pyx_memview_get___pyx_t_double_complex(const char *itemp);
2151 static CYTHON_INLINE int __pyx_memview_set___pyx_t_double_complex(const char *itemp, PyObject *obj);
2152 
2153 /* MemviewSliceCopyTemplate.proto */
2154 static __Pyx_memviewslice
2155 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2156                                  const char *mode, int ndim,
2157                                  size_t sizeof_dtype, int contig_flag,
2158                                  int dtype_is_object);
2159 
2160 /* CIntFromPy.proto */
2161 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2162 
2163 /* CIntToPy.proto */
2164 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2165 
2166 /* CIntToPy.proto */
2167 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2168 
2169 /* CIntFromPy.proto */
2170 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2171 
2172 /* CIntFromPy.proto */
2173 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2174 
2175 /* CheckBinaryVersion.proto */
2176 static int __Pyx_check_binary_version(void);
2177 
2178 /* InitStrings.proto */
2179 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2180 
2181 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2182 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2183 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2184 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2185 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*/
2186 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2187 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2188 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2189 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2190 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2191 
2192 /* Module declarations from 'libc.math' */
2193 
2194 /* Module declarations from 'cpython.buffer' */
2195 
2196 /* Module declarations from 'libc.string' */
2197 
2198 /* Module declarations from 'libc.stdio' */
2199 
2200 /* Module declarations from '__builtin__' */
2201 
2202 /* Module declarations from 'cpython.type' */
2203 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2204 
2205 /* Module declarations from 'cpython' */
2206 
2207 /* Module declarations from 'cpython.object' */
2208 
2209 /* Module declarations from 'cpython.ref' */
2210 
2211 /* Module declarations from 'cpython.mem' */
2212 
2213 /* Module declarations from 'numpy' */
2214 
2215 /* Module declarations from 'numpy' */
2216 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2217 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2218 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2219 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2220 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2221 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2222 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2223 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2224 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2225 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2226 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2227 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2228 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2229 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2230 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2231 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void); /*proto*/
2232 
2233 /* Module declarations from 'statsmodels.src.math' */
2234 static CYTHON_INLINE __pyx_t_double_complex __pyx_f_11statsmodels_3src_4math_zlog(__pyx_t_double_complex); /*proto*/
2235 
2236 /* Module declarations from 'cython.view' */
2237 
2238 /* Module declarations from 'cython' */
2239 
2240 /* Module declarations from 'statsmodels.tsa.innovations._arma_innovations' */
2241 static PyTypeObject *__pyx_array_type = 0;
2242 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2243 static PyTypeObject *__pyx_memoryview_type = 0;
2244 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2245 static int __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C;
2246 static PyObject *generic = 0;
2247 static PyObject *strided = 0;
2248 static PyObject *indirect = 0;
2249 static PyObject *contiguous = 0;
2250 static PyObject *indirect_contiguous = 0;
2251 static int __pyx_memoryview_thread_locks_used;
2252 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2253 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_stoeplitz(int, int, int, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2254 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_transformed_acovf_fast(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2255 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations_algo_fast(int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2256 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations_filter(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2257 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_5numpy_float32_t, int __pyx_skip_dispatch); /*proto*/
2258 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_loglikeobs_fast(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_5numpy_float32_t, int __pyx_skip_dispatch); /*proto*/
2259 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_dtoeplitz(int, int, int, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2260 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_transformed_acovf_fast(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2261 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations_algo_fast(int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2262 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations_filter(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2263 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/
2264 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_loglikeobs_fast(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_5numpy_float64_t, int __pyx_skip_dispatch); /*proto*/
2265 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_ctoeplitz(int, int, int, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2266 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_transformed_acovf_fast(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2267 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations_algo_fast(int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2268 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations_filter(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2269 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_float_complex, int __pyx_skip_dispatch); /*proto*/
2270 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_loglikeobs_fast(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_float_complex, int __pyx_skip_dispatch); /*proto*/
2271 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_ztoeplitz(int, int, int, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2272 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_transformed_acovf_fast(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2273 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations_algo_fast(int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2274 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations_filter(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/
2275 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_double_complex, int __pyx_skip_dispatch); /*proto*/
2276 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_loglikeobs_fast(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_double_complex, int __pyx_skip_dispatch); /*proto*/
2277 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2278 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2279 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2280 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2281 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2282 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2283 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2284 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*/
2285 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2286 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2287 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2288 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2289 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2290 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2291 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2292 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2293 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2294 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2295 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2296 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2297 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2298 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2299 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2300 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2301 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2302 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2303 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2304 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2305 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2306 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2307 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2308 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2309 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2310 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), { 0 }, 0, 'R', 0, 0 };
2311 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 };
2312 static __Pyx_TypeInfo __Pyx_TypeInfo___pyx_t_float_complex = { "float complex", NULL, sizeof(__pyx_t_float_complex), { 0 }, 0, 'C', 0, 0 };
2313 static __Pyx_TypeInfo __Pyx_TypeInfo___pyx_t_double_complex = { "double complex", NULL, sizeof(__pyx_t_double_complex), { 0 }, 0, 'C', 0, 0 };
2314 #define __Pyx_MODULE_NAME "statsmodels.tsa.innovations._arma_innovations"
2315 extern int __pyx_module_is_main_statsmodels__tsa__innovations___arma_innovations;
2316 int __pyx_module_is_main_statsmodels__tsa__innovations___arma_innovations = 0;
2317 
2318 /* Implementation of 'statsmodels.tsa.innovations._arma_innovations' */
2319 static PyObject *__pyx_builtin_range;
2320 static PyObject *__pyx_builtin_ImportError;
2321 static PyObject *__pyx_builtin_ValueError;
2322 static PyObject *__pyx_builtin_MemoryError;
2323 static PyObject *__pyx_builtin_enumerate;
2324 static PyObject *__pyx_builtin_TypeError;
2325 static PyObject *__pyx_builtin_Ellipsis;
2326 static PyObject *__pyx_builtin_id;
2327 static PyObject *__pyx_builtin_IndexError;
2328 static const char __pyx_k_O[] = "O";
2329 static const char __pyx_k_c[] = "c";
2330 static const char __pyx_k_ar[] = "ar";
2331 static const char __pyx_k_id[] = "id";
2332 static const char __pyx_k_ma[] = "ma";
2333 static const char __pyx_k_np[] = "np";
2334 static const char __pyx_k_new[] = "__new__";
2335 static const char __pyx_k_obj[] = "obj";
2336 static const char __pyx_k_base[] = "base";
2337 static const char __pyx_k_dict[] = "__dict__";
2338 static const char __pyx_k_main[] = "__main__";
2339 static const char __pyx_k_mode[] = "mode";
2340 static const char __pyx_k_name[] = "name";
2341 static const char __pyx_k_ndim[] = "ndim";
2342 static const char __pyx_k_nobs[] = "nobs";
2343 static const char __pyx_k_pack[] = "pack";
2344 static const char __pyx_k_size[] = "size";
2345 static const char __pyx_k_step[] = "step";
2346 static const char __pyx_k_stop[] = "stop";
2347 static const char __pyx_k_test[] = "__test__";
2348 static const char __pyx_k_ASCII[] = "ASCII";
2349 static const char __pyx_k_acovf[] = "acovf";
2350 static const char __pyx_k_array[] = "array";
2351 static const char __pyx_k_class[] = "__class__";
2352 static const char __pyx_k_dtype[] = "dtype";
2353 static const char __pyx_k_endog[] = "endog";
2354 static const char __pyx_k_error[] = "error";
2355 static const char __pyx_k_flags[] = "flags";
2356 static const char __pyx_k_numpy[] = "numpy";
2357 static const char __pyx_k_range[] = "range";
2358 static const char __pyx_k_shape[] = "shape";
2359 static const char __pyx_k_start[] = "start";
2360 static const char __pyx_k_theta[] = "theta";
2361 static const char __pyx_k_acovf2[] = "acovf2";
2362 static const char __pyx_k_encode[] = "encode";
2363 static const char __pyx_k_format[] = "format";
2364 static const char __pyx_k_import[] = "__import__";
2365 static const char __pyx_k_name_2[] = "__name__";
2366 static const char __pyx_k_pickle[] = "pickle";
2367 static const char __pyx_k_reduce[] = "__reduce__";
2368 static const char __pyx_k_sigma2[] = "sigma2";
2369 static const char __pyx_k_struct[] = "struct";
2370 static const char __pyx_k_unpack[] = "unpack";
2371 static const char __pyx_k_update[] = "update";
2372 static const char __pyx_k_float32[] = "float32";
2373 static const char __pyx_k_fortran[] = "fortran";
2374 static const char __pyx_k_memview[] = "memview";
2375 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2376 static const char __pyx_k_getstate[] = "__getstate__";
2377 static const char __pyx_k_itemsize[] = "itemsize";
2378 static const char __pyx_k_pyx_type[] = "__pyx_type";
2379 static const char __pyx_k_setstate[] = "__setstate__";
2380 static const char __pyx_k_warnings[] = "warnings";
2381 static const char __pyx_k_TypeError[] = "TypeError";
2382 static const char __pyx_k_ar_params[] = "ar_params";
2383 static const char __pyx_k_complex64[] = "complex64";
2384 static const char __pyx_k_enumerate[] = "enumerate";
2385 static const char __pyx_k_ma_params[] = "ma_params";
2386 static const char __pyx_k_pyx_state[] = "__pyx_state";
2387 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2388 static const char __pyx_k_IndexError[] = "IndexError";
2389 static const char __pyx_k_ValueError[] = "ValueError";
2390 static const char __pyx_k_arma_acovf[] = "arma_acovf";
2391 static const char __pyx_k_pyx_result[] = "__pyx_result";
2392 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2393 static const char __pyx_k_ImportError[] = "ImportError";
2394 static const char __pyx_k_MemoryError[] = "MemoryError";
2395 static const char __pyx_k_PickleError[] = "PickleError";
2396 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2397 static const char __pyx_k_stringsource[] = "stringsource";
2398 static const char __pyx_k_arima_process[] = "arima_process";
2399 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2400 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2401 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2402 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2403 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2404 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2405 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2406 static const char __pyx_k_statsmodels_tsa[] = "statsmodels.tsa";
2407 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2408 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2409 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2410 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2411 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2412 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2413 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2414 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2415 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2416 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2417 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2418 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2419 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2420 static const char __pyx_k_Innovations_algorithm_Author_Ch[] = "\nInnovations algorithm\n\nAuthor: Chad Fulton\nLicense: Simplified-BSD\n";
2421 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2422 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2423 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2424 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2425 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2426 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2427 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2428 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2429 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2430 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2431 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2432 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2433 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2434 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2435 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2436 static PyObject *__pyx_n_s_ASCII;
2437 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2438 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2439 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2440 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2441 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2442 static PyObject *__pyx_n_s_Ellipsis;
2443 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2444 static PyObject *__pyx_n_s_ImportError;
2445 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2446 static PyObject *__pyx_n_s_IndexError;
2447 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2448 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2449 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2450 static PyObject *__pyx_n_s_MemoryError;
2451 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2452 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2453 static PyObject *__pyx_n_b_O;
2454 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2455 static PyObject *__pyx_n_s_PickleError;
2456 static PyObject *__pyx_n_s_TypeError;
2457 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2458 static PyObject *__pyx_n_s_ValueError;
2459 static PyObject *__pyx_n_s_View_MemoryView;
2460 static PyObject *__pyx_n_s_acovf;
2461 static PyObject *__pyx_n_s_acovf2;
2462 static PyObject *__pyx_n_s_allocate_buffer;
2463 static PyObject *__pyx_n_s_ar;
2464 static PyObject *__pyx_n_s_ar_params;
2465 static PyObject *__pyx_n_s_arima_process;
2466 static PyObject *__pyx_n_s_arma_acovf;
2467 static PyObject *__pyx_n_s_array;
2468 static PyObject *__pyx_n_s_base;
2469 static PyObject *__pyx_n_s_c;
2470 static PyObject *__pyx_n_u_c;
2471 static PyObject *__pyx_n_s_class;
2472 static PyObject *__pyx_n_s_cline_in_traceback;
2473 static PyObject *__pyx_n_s_complex64;
2474 static PyObject *__pyx_kp_s_contiguous_and_direct;
2475 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2476 static PyObject *__pyx_n_s_dict;
2477 static PyObject *__pyx_n_s_dtype;
2478 static PyObject *__pyx_n_s_dtype_is_object;
2479 static PyObject *__pyx_n_s_encode;
2480 static PyObject *__pyx_n_s_endog;
2481 static PyObject *__pyx_n_s_enumerate;
2482 static PyObject *__pyx_n_s_error;
2483 static PyObject *__pyx_n_s_flags;
2484 static PyObject *__pyx_n_s_float32;
2485 static PyObject *__pyx_n_s_format;
2486 static PyObject *__pyx_n_s_fortran;
2487 static PyObject *__pyx_n_u_fortran;
2488 static PyObject *__pyx_n_s_getstate;
2489 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2490 static PyObject *__pyx_n_s_id;
2491 static PyObject *__pyx_n_s_import;
2492 static PyObject *__pyx_n_s_itemsize;
2493 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2494 static PyObject *__pyx_n_s_ma;
2495 static PyObject *__pyx_n_s_ma_params;
2496 static PyObject *__pyx_n_s_main;
2497 static PyObject *__pyx_n_s_memview;
2498 static PyObject *__pyx_n_s_mode;
2499 static PyObject *__pyx_n_s_name;
2500 static PyObject *__pyx_n_s_name_2;
2501 static PyObject *__pyx_n_s_ndim;
2502 static PyObject *__pyx_n_s_new;
2503 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2504 static PyObject *__pyx_n_s_nobs;
2505 static PyObject *__pyx_n_s_np;
2506 static PyObject *__pyx_n_s_numpy;
2507 static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
2508 static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
2509 static PyObject *__pyx_n_s_obj;
2510 static PyObject *__pyx_n_s_pack;
2511 static PyObject *__pyx_n_s_pickle;
2512 static PyObject *__pyx_n_s_pyx_PickleError;
2513 static PyObject *__pyx_n_s_pyx_checksum;
2514 static PyObject *__pyx_n_s_pyx_getbuffer;
2515 static PyObject *__pyx_n_s_pyx_result;
2516 static PyObject *__pyx_n_s_pyx_state;
2517 static PyObject *__pyx_n_s_pyx_type;
2518 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2519 static PyObject *__pyx_n_s_pyx_vtable;
2520 static PyObject *__pyx_n_s_range;
2521 static PyObject *__pyx_n_s_reduce;
2522 static PyObject *__pyx_n_s_reduce_cython;
2523 static PyObject *__pyx_n_s_reduce_ex;
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_sigma2;
2528 static PyObject *__pyx_n_s_size;
2529 static PyObject *__pyx_n_s_start;
2530 static PyObject *__pyx_n_s_statsmodels_tsa;
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_test;
2539 static PyObject *__pyx_n_s_theta;
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_warnings;
2545 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_transformed_acovf_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ar, __Pyx_memviewslice __pyx_v_ma, __Pyx_memviewslice __pyx_v_arma_acovf); /* proto */
2546 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_2sarma_innovations_algo_fast(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nobs, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_acovf, __Pyx_memviewslice __pyx_v_acovf2); /* proto */
2547 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_4sarma_innovations_filter(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_theta); /* proto */
2548 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_6sarma_innovations(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_5numpy_float32_t __pyx_v_sigma2); /* proto */
2549 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_8sarma_loglikeobs_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_5numpy_float32_t __pyx_v_sigma2); /* proto */
2550 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_10darma_transformed_acovf_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ar, __Pyx_memviewslice __pyx_v_ma, __Pyx_memviewslice __pyx_v_arma_acovf); /* proto */
2551 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_12darma_innovations_algo_fast(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nobs, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_acovf, __Pyx_memviewslice __pyx_v_acovf2); /* proto */
2552 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_14darma_innovations_filter(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_theta); /* proto */
2553 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_16darma_innovations(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_5numpy_float64_t __pyx_v_sigma2); /* proto */
2554 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_18darma_loglikeobs_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_5numpy_float64_t __pyx_v_sigma2); /* proto */
2555 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_20carma_transformed_acovf_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ar, __Pyx_memviewslice __pyx_v_ma, __Pyx_memviewslice __pyx_v_arma_acovf); /* proto */
2556 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_22carma_innovations_algo_fast(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nobs, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_acovf, __Pyx_memviewslice __pyx_v_acovf2); /* proto */
2557 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_24carma_innovations_filter(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_theta); /* proto */
2558 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_26carma_innovations(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_float_complex __pyx_v_sigma2); /* proto */
2559 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_28carma_loglikeobs_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_float_complex __pyx_v_sigma2); /* proto */
2560 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_30zarma_transformed_acovf_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ar, __Pyx_memviewslice __pyx_v_ma, __Pyx_memviewslice __pyx_v_arma_acovf); /* proto */
2561 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_32zarma_innovations_algo_fast(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nobs, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_acovf, __Pyx_memviewslice __pyx_v_acovf2); /* proto */
2562 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_34zarma_innovations_filter(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_theta); /* proto */
2563 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_36zarma_innovations(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_double_complex __pyx_v_sigma2); /* proto */
2564 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_38zarma_loglikeobs_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_double_complex __pyx_v_sigma2); /* proto */
2565 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 */
2566 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 */
2567 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2568 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2569 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2570 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
2571 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2572 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 */
2573 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
2574 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 */
2575 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2576 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2577 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2578 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2579 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 */
2580 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2581 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
2582 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 */
2583 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 */
2584 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2585 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2586 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2587 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2588 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2589 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2590 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2591 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2592 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2593 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2594 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2595 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2596 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2597 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2598 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2599 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2600 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2601 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 */
2602 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2603 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2604 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2605 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 */
2606 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 */
2607 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2608 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2609 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2610 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2611 static PyObject *__pyx_int_0;
2612 static PyObject *__pyx_int_1;
2613 static PyObject *__pyx_int_184977713;
2614 static PyObject *__pyx_int_neg_1;
2615 static PyObject *__pyx_tuple_;
2616 static PyObject *__pyx_tuple__2;
2617 static PyObject *__pyx_tuple__3;
2618 static PyObject *__pyx_tuple__4;
2619 static PyObject *__pyx_tuple__5;
2620 static PyObject *__pyx_tuple__6;
2621 static PyObject *__pyx_tuple__7;
2622 static PyObject *__pyx_tuple__8;
2623 static PyObject *__pyx_tuple__9;
2624 static PyObject *__pyx_slice__17;
2625 static PyObject *__pyx_tuple__10;
2626 static PyObject *__pyx_tuple__11;
2627 static PyObject *__pyx_tuple__12;
2628 static PyObject *__pyx_tuple__13;
2629 static PyObject *__pyx_tuple__14;
2630 static PyObject *__pyx_tuple__15;
2631 static PyObject *__pyx_tuple__16;
2632 static PyObject *__pyx_tuple__18;
2633 static PyObject *__pyx_tuple__19;
2634 static PyObject *__pyx_tuple__20;
2635 static PyObject *__pyx_tuple__21;
2636 static PyObject *__pyx_tuple__22;
2637 static PyObject *__pyx_tuple__23;
2638 static PyObject *__pyx_tuple__24;
2639 static PyObject *__pyx_tuple__25;
2640 static PyObject *__pyx_tuple__26;
2641 static PyObject *__pyx_codeobj__27;
2642 /* Late includes */
2643 
2644 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":25
2645  *
2646  *
2647  * cdef stoeplitz(int n, int offset0, int offset1,             # <<<<<<<<<<<<<<
2648  *                         cnp.float32_t [:] in_column,
2649  *                         cnp.float32_t [:, :] out_matrix):
2650  */
2651 
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_stoeplitz(int __pyx_v_n,int __pyx_v_offset0,int __pyx_v_offset1,__Pyx_memviewslice __pyx_v_in_column,__Pyx_memviewslice __pyx_v_out_matrix)2652 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_stoeplitz(int __pyx_v_n, int __pyx_v_offset0, int __pyx_v_offset1, __Pyx_memviewslice __pyx_v_in_column, __Pyx_memviewslice __pyx_v_out_matrix) {
2653   Py_ssize_t __pyx_v_i;
2654   Py_ssize_t __pyx_v_j;
2655   PyObject *__pyx_r = NULL;
2656   __Pyx_RefNannyDeclarations
2657   int __pyx_t_1;
2658   int __pyx_t_2;
2659   Py_ssize_t __pyx_t_3;
2660   Py_ssize_t __pyx_t_4;
2661   Py_ssize_t __pyx_t_5;
2662   Py_ssize_t __pyx_t_6;
2663   Py_ssize_t __pyx_t_7;
2664   Py_ssize_t __pyx_t_8;
2665   Py_ssize_t __pyx_t_9;
2666   int __pyx_t_10;
2667   __Pyx_RefNannySetupContext("stoeplitz", 0);
2668 
2669   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":55
2670  *     cdef Py_ssize_t i, j
2671  *
2672  *     for i in range(n):             # <<<<<<<<<<<<<<
2673  *         for j in range(i + 1):
2674  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
2675  */
2676   __pyx_t_1 = __pyx_v_n;
2677   __pyx_t_2 = __pyx_t_1;
2678   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2679     __pyx_v_i = __pyx_t_3;
2680 
2681     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":56
2682  *
2683  *     for i in range(n):
2684  *         for j in range(i + 1):             # <<<<<<<<<<<<<<
2685  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
2686  *             if i != j:
2687  */
2688     __pyx_t_4 = (__pyx_v_i + 1);
2689     __pyx_t_5 = __pyx_t_4;
2690     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
2691       __pyx_v_j = __pyx_t_6;
2692 
2693       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":57
2694  *     for i in range(n):
2695  *         for j in range(i + 1):
2696  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]             # <<<<<<<<<<<<<<
2697  *             if i != j:
2698  *               # Note: scipy by default does complex conjugate, but not
2699  */
2700       __pyx_t_7 = (__pyx_v_i - __pyx_v_j);
2701       __pyx_t_8 = (__pyx_v_offset0 + __pyx_v_i);
2702       __pyx_t_9 = (__pyx_v_offset1 + __pyx_v_j);
2703       *((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out_matrix.data + __pyx_t_8 * __pyx_v_out_matrix.strides[0]) ) + __pyx_t_9 * __pyx_v_out_matrix.strides[1]) )) = (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_in_column.data + __pyx_t_7 * __pyx_v_in_column.strides[0]) )));
2704 
2705       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":58
2706  *         for j in range(i + 1):
2707  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
2708  *             if i != j:             # <<<<<<<<<<<<<<
2709  *               # Note: scipy by default does complex conjugate, but not
2710  *               # necessary here since we're only dealing with covariances,
2711  */
2712       __pyx_t_10 = ((__pyx_v_i != __pyx_v_j) != 0);
2713       if (__pyx_t_10) {
2714 
2715         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":64
2716  *               # differentiation, but in that case we do not want to apply
2717  *               # the conjugation anyway)
2718  *               out_matrix[offset0 + j, offset1 + i] = in_column[i - j]             # <<<<<<<<<<<<<<
2719  *
2720  *
2721  */
2722         __pyx_t_7 = (__pyx_v_i - __pyx_v_j);
2723         __pyx_t_9 = (__pyx_v_offset0 + __pyx_v_j);
2724         __pyx_t_8 = (__pyx_v_offset1 + __pyx_v_i);
2725         *((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out_matrix.data + __pyx_t_9 * __pyx_v_out_matrix.strides[0]) ) + __pyx_t_8 * __pyx_v_out_matrix.strides[1]) )) = (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_in_column.data + __pyx_t_7 * __pyx_v_in_column.strides[0]) )));
2726 
2727         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":58
2728  *         for j in range(i + 1):
2729  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
2730  *             if i != j:             # <<<<<<<<<<<<<<
2731  *               # Note: scipy by default does complex conjugate, but not
2732  *               # necessary here since we're only dealing with covariances,
2733  */
2734       }
2735     }
2736   }
2737 
2738   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":25
2739  *
2740  *
2741  * cdef stoeplitz(int n, int offset0, int offset1,             # <<<<<<<<<<<<<<
2742  *                         cnp.float32_t [:] in_column,
2743  *                         cnp.float32_t [:, :] out_matrix):
2744  */
2745 
2746   /* function exit code */
2747   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2748   __Pyx_XGIVEREF(__pyx_r);
2749   __Pyx_RefNannyFinishContext();
2750   return __pyx_r;
2751 }
2752 
2753 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":67
2754  *
2755  *
2756  * cpdef sarma_transformed_acovf_fast(cnp.float32_t [:] ar,             # <<<<<<<<<<<<<<
2757  *                                             cnp.float32_t [:] ma,
2758  *                                             cnp.float32_t [:] arma_acovf):
2759  */
2760 
2761 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_1sarma_transformed_acovf_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_transformed_acovf_fast(__Pyx_memviewslice __pyx_v_ar,__Pyx_memviewslice __pyx_v_ma,__Pyx_memviewslice __pyx_v_arma_acovf,CYTHON_UNUSED int __pyx_skip_dispatch)2762 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_transformed_acovf_fast(__Pyx_memviewslice __pyx_v_ar, __Pyx_memviewslice __pyx_v_ma, __Pyx_memviewslice __pyx_v_arma_acovf, CYTHON_UNUSED int __pyx_skip_dispatch) {
2763   Py_ssize_t __pyx_v_nobs;
2764   Py_ssize_t __pyx_v_p;
2765   Py_ssize_t __pyx_v_q;
2766   Py_ssize_t __pyx_v_m;
2767   Py_ssize_t __pyx_v_m2;
2768   Py_ssize_t __pyx_v_n;
2769   Py_ssize_t __pyx_v_i;
2770   Py_ssize_t __pyx_v_j;
2771   Py_ssize_t __pyx_v_r;
2772   Py_ssize_t __pyx_v_tmp_ix;
2773   npy_intp __pyx_v_dim1[1];
2774   npy_intp __pyx_v_dim2[2];
2775   __Pyx_memviewslice __pyx_v_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
2776   __Pyx_memviewslice __pyx_v_acovf2 = { 0, 0, { 0 }, { 0 }, { 0 } };
2777   PyObject *__pyx_r = NULL;
2778   __Pyx_RefNannyDeclarations
2779   size_t __pyx_t_1;
2780   Py_ssize_t __pyx_t_2;
2781   Py_ssize_t __pyx_t_3;
2782   Py_ssize_t __pyx_t_4;
2783   PyObject *__pyx_t_5 = NULL;
2784   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
2785   long __pyx_t_7;
2786   __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
2787   int __pyx_t_9;
2788   Py_ssize_t __pyx_t_10;
2789   Py_ssize_t __pyx_t_11;
2790   Py_ssize_t __pyx_t_12;
2791   Py_ssize_t __pyx_t_13;
2792   Py_ssize_t __pyx_t_14;
2793   Py_ssize_t __pyx_t_15;
2794   Py_ssize_t __pyx_t_16;
2795   Py_ssize_t __pyx_t_17;
2796   Py_ssize_t __pyx_t_18;
2797   PyObject *__pyx_t_19 = NULL;
2798   Py_ssize_t __pyx_t_20;
2799   Py_ssize_t __pyx_t_21;
2800   Py_ssize_t __pyx_t_22;
2801   Py_ssize_t __pyx_t_23;
2802   int __pyx_t_24;
2803   __Pyx_memviewslice __pyx_t_25 = { 0, 0, { 0 }, { 0 }, { 0 } };
2804   PyObject *__pyx_t_26 = NULL;
2805   int __pyx_lineno = 0;
2806   const char *__pyx_filename = NULL;
2807   int __pyx_clineno = 0;
2808   __Pyx_RefNannySetupContext("sarma_transformed_acovf_fast", 0);
2809 
2810   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":137
2811  *     cdef cnp.float32_t [:] acovf2
2812  *
2813  *     nobs = arma_acovf.shape[0]             # <<<<<<<<<<<<<<
2814  *     p = len(ar) - 1
2815  *     q = len(ma) - 1
2816  */
2817   __pyx_v_nobs = (__pyx_v_arma_acovf.shape[0]);
2818 
2819   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":138
2820  *
2821  *     nobs = arma_acovf.shape[0]
2822  *     p = len(ar) - 1             # <<<<<<<<<<<<<<
2823  *     q = len(ma) - 1
2824  *     m = max(p, q)
2825  */
2826   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar);
2827   __pyx_v_p = (__pyx_t_1 - 1);
2828 
2829   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":139
2830  *     nobs = arma_acovf.shape[0]
2831  *     p = len(ar) - 1
2832  *     q = len(ma) - 1             # <<<<<<<<<<<<<<
2833  *     m = max(p, q)
2834  *     m2 = 2 * m
2835  */
2836   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma);
2837   __pyx_v_q = (__pyx_t_1 - 1);
2838 
2839   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":140
2840  *     p = len(ar) - 1
2841  *     q = len(ma) - 1
2842  *     m = max(p, q)             # <<<<<<<<<<<<<<
2843  *     m2 = 2 * m
2844  *     n = min(m2, nobs)
2845  */
2846   __pyx_t_2 = __pyx_v_q;
2847   __pyx_t_3 = __pyx_v_p;
2848   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
2849     __pyx_t_4 = __pyx_t_2;
2850   } else {
2851     __pyx_t_4 = __pyx_t_3;
2852   }
2853   __pyx_v_m = __pyx_t_4;
2854 
2855   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":141
2856  *     q = len(ma) - 1
2857  *     m = max(p, q)
2858  *     m2 = 2 * m             # <<<<<<<<<<<<<<
2859  *     n = min(m2, nobs)
2860  *
2861  */
2862   __pyx_v_m2 = (2 * __pyx_v_m);
2863 
2864   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":142
2865  *     m = max(p, q)
2866  *     m2 = 2 * m
2867  *     n = min(m2, nobs)             # <<<<<<<<<<<<<<
2868  *
2869  *     dim2[0] = m2;
2870  */
2871   __pyx_t_4 = __pyx_v_nobs;
2872   __pyx_t_2 = __pyx_v_m2;
2873   if (((__pyx_t_4 < __pyx_t_2) != 0)) {
2874     __pyx_t_3 = __pyx_t_4;
2875   } else {
2876     __pyx_t_3 = __pyx_t_2;
2877   }
2878   __pyx_v_n = __pyx_t_3;
2879 
2880   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":144
2881  *     n = min(m2, nobs)
2882  *
2883  *     dim2[0] = m2;             # <<<<<<<<<<<<<<
2884  *     dim2[1] = m2;
2885  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT32, C)
2886  */
2887   (__pyx_v_dim2[0]) = __pyx_v_m2;
2888 
2889   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":145
2890  *
2891  *     dim2[0] = m2;
2892  *     dim2[1] = m2;             # <<<<<<<<<<<<<<
2893  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT32, C)
2894  *     dim1[0] = max(nobs - m, 0);
2895  */
2896   (__pyx_v_dim2[1]) = __pyx_v_m2;
2897 
2898   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":146
2899  *     dim2[0] = m2;
2900  *     dim2[1] = m2;
2901  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT32, C)             # <<<<<<<<<<<<<<
2902  *     dim1[0] = max(nobs - m, 0);
2903  *     acovf2 = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
2904  */
2905   __pyx_t_5 = PyArray_ZEROS(2, __pyx_v_dim2, NPY_FLOAT32, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error)
2906   __Pyx_GOTREF(__pyx_t_5);
2907   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float32_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 146, __pyx_L1_error)
2908   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2909   __pyx_v_acovf = __pyx_t_6;
2910   __pyx_t_6.memview = NULL;
2911   __pyx_t_6.data = NULL;
2912 
2913   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":147
2914  *     dim2[1] = m2;
2915  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT32, C)
2916  *     dim1[0] = max(nobs - m, 0);             # <<<<<<<<<<<<<<
2917  *     acovf2 = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
2918  *
2919  */
2920   __pyx_t_7 = 0;
2921   __pyx_t_3 = (__pyx_v_nobs - __pyx_v_m);
2922   if (((__pyx_t_7 > __pyx_t_3) != 0)) {
2923     __pyx_t_4 = __pyx_t_7;
2924   } else {
2925     __pyx_t_4 = __pyx_t_3;
2926   }
2927   (__pyx_v_dim1[0]) = __pyx_t_4;
2928 
2929   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":148
2930  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT32, C)
2931  *     dim1[0] = max(nobs - m, 0);
2932  *     acovf2 = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)             # <<<<<<<<<<<<<<
2933  *
2934  *     # Set i, j = 1, ..., m   (which is then done)
2935  */
2936   __pyx_t_5 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_FLOAT32, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error)
2937   __Pyx_GOTREF(__pyx_t_5);
2938   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 148, __pyx_L1_error)
2939   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2940   __pyx_v_acovf2 = __pyx_t_8;
2941   __pyx_t_8.memview = NULL;
2942   __pyx_t_8.data = NULL;
2943 
2944   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":151
2945  *
2946  *     # Set i, j = 1, ..., m   (which is then done)
2947  *     stoeplitz(m, 0, 0, arma_acovf, acovf)             # <<<<<<<<<<<<<<
2948  *
2949  *     # Set i = 1, ..., m;         j = m + 1, ..., 2 m
2950  */
2951   __pyx_t_5 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_stoeplitz(__pyx_v_m, 0, 0, __pyx_v_arma_acovf, __pyx_v_acovf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 151, __pyx_L1_error)
2952   __Pyx_GOTREF(__pyx_t_5);
2953   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2954 
2955   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":155
2956  *     # Set i = 1, ..., m;         j = m + 1, ..., 2 m
2957  *     # and i = m + 1, ..., 2 m;   j = 1, ..., m
2958  *     if nobs > m:             # <<<<<<<<<<<<<<
2959  *         for j in range(m):
2960  *             for i in range(m, m2):
2961  */
2962   __pyx_t_9 = ((__pyx_v_nobs > __pyx_v_m) != 0);
2963   if (__pyx_t_9) {
2964 
2965     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":156
2966  *     # and i = m + 1, ..., 2 m;   j = 1, ..., m
2967  *     if nobs > m:
2968  *         for j in range(m):             # <<<<<<<<<<<<<<
2969  *             for i in range(m, m2):
2970  *                 acovf[i, j] = arma_acovf[i - j]
2971  */
2972     __pyx_t_4 = __pyx_v_m;
2973     __pyx_t_3 = __pyx_t_4;
2974     for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2+=1) {
2975       __pyx_v_j = __pyx_t_2;
2976 
2977       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":157
2978  *     if nobs > m:
2979  *         for j in range(m):
2980  *             for i in range(m, m2):             # <<<<<<<<<<<<<<
2981  *                 acovf[i, j] = arma_acovf[i - j]
2982  *                 for r in range(1, p + 1):
2983  */
2984       __pyx_t_10 = __pyx_v_m2;
2985       __pyx_t_11 = __pyx_t_10;
2986       for (__pyx_t_12 = __pyx_v_m; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
2987         __pyx_v_i = __pyx_t_12;
2988 
2989         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":158
2990  *         for j in range(m):
2991  *             for i in range(m, m2):
2992  *                 acovf[i, j] = arma_acovf[i - j]             # <<<<<<<<<<<<<<
2993  *                 for r in range(1, p + 1):
2994  *                     tmp_ix = abs(r - (i - j))
2995  */
2996         __pyx_t_13 = (__pyx_v_i - __pyx_v_j);
2997         __pyx_t_14 = __pyx_v_i;
2998         __pyx_t_15 = __pyx_v_j;
2999         *((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_14 * __pyx_v_acovf.strides[0]) ) + __pyx_t_15 * __pyx_v_acovf.strides[1]) )) = (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_arma_acovf.data + __pyx_t_13 * __pyx_v_arma_acovf.strides[0]) )));
3000 
3001         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":159
3002  *             for i in range(m, m2):
3003  *                 acovf[i, j] = arma_acovf[i - j]
3004  *                 for r in range(1, p + 1):             # <<<<<<<<<<<<<<
3005  *                     tmp_ix = abs(r - (i - j))
3006  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])
3007  */
3008         __pyx_t_16 = (__pyx_v_p + 1);
3009         __pyx_t_17 = __pyx_t_16;
3010         for (__pyx_t_18 = 1; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
3011           __pyx_v_r = __pyx_t_18;
3012 
3013           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":160
3014  *                 acovf[i, j] = arma_acovf[i - j]
3015  *                 for r in range(1, p + 1):
3016  *                     tmp_ix = abs(r - (i - j))             # <<<<<<<<<<<<<<
3017  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])
3018  *         acovf[:m, m:m2] = acovf[m:m2, :m].T
3019  */
3020           __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_r - (__pyx_v_i - __pyx_v_j))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L1_error)
3021           __Pyx_GOTREF(__pyx_t_5);
3022           __pyx_t_19 = __Pyx_PyNumber_Absolute(__pyx_t_5); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
3023           __Pyx_GOTREF(__pyx_t_19);
3024           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3025           __pyx_t_20 = __Pyx_PyIndex_AsSsize_t(__pyx_t_19); if (unlikely((__pyx_t_20 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error)
3026           __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
3027           __pyx_v_tmp_ix = __pyx_t_20;
3028 
3029           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":161
3030  *                 for r in range(1, p + 1):
3031  *                     tmp_ix = abs(r - (i - j))
3032  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])             # <<<<<<<<<<<<<<
3033  *         acovf[:m, m:m2] = acovf[m:m2, :m].T
3034  *
3035  */
3036           __pyx_t_13 = __pyx_v_i;
3037           __pyx_t_15 = __pyx_v_j;
3038           __pyx_t_14 = __pyx_v_r;
3039           __pyx_t_21 = __pyx_v_tmp_ix;
3040           __pyx_t_22 = __pyx_v_i;
3041           __pyx_t_23 = __pyx_v_j;
3042           *((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_22 * __pyx_v_acovf.strides[0]) ) + __pyx_t_23 * __pyx_v_acovf.strides[1]) )) = ((*((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_13 * __pyx_v_acovf.strides[0]) ) + __pyx_t_15 * __pyx_v_acovf.strides[1]) ))) - ((-(*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_ar.data + __pyx_t_14 * __pyx_v_ar.strides[0]) )))) * (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_arma_acovf.data + __pyx_t_21 * __pyx_v_arma_acovf.strides[0]) )))));
3043         }
3044       }
3045     }
3046 
3047     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":162
3048  *                     tmp_ix = abs(r - (i - j))
3049  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])
3050  *         acovf[:m, m:m2] = acovf[m:m2, :m].T             # <<<<<<<<<<<<<<
3051  *
3052  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
3053  */
3054     __pyx_t_6.data = __pyx_v_acovf.data;
3055     __pyx_t_6.memview = __pyx_v_acovf.memview;
3056     __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
3057     __pyx_t_24 = -1;
3058     if (unlikely(__pyx_memoryview_slice_memviewslice(
3059     &__pyx_t_6,
3060     __pyx_v_acovf.shape[0], __pyx_v_acovf.strides[0], __pyx_v_acovf.suboffsets[0],
3061     0,
3062     0,
3063     &__pyx_t_24,
3064     __pyx_v_m,
3065     __pyx_v_m2,
3066     0,
3067     1,
3068     1,
3069     0,
3070     1) < 0))
3071 {
3072     __PYX_ERR(0, 162, __pyx_L1_error)
3073 }
3074 
3075 if (unlikely(__pyx_memoryview_slice_memviewslice(
3076     &__pyx_t_6,
3077     __pyx_v_acovf.shape[1], __pyx_v_acovf.strides[1], __pyx_v_acovf.suboffsets[1],
3078     1,
3079     1,
3080     &__pyx_t_24,
3081     0,
3082     __pyx_v_m,
3083     0,
3084     0,
3085     1,
3086     0,
3087     1) < 0))
3088 {
3089     __PYX_ERR(0, 162, __pyx_L1_error)
3090 }
3091 
3092 __pyx_t_25 = __pyx_t_6;
3093     __PYX_INC_MEMVIEW(&__pyx_t_25, 1);
3094     if (unlikely(__pyx_memslice_transpose(&__pyx_t_25) == 0)) __PYX_ERR(0, 162, __pyx_L1_error)
3095     __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
3096     __pyx_t_6.memview = NULL;
3097     __pyx_t_6.data = NULL;
3098     __pyx_t_6.data = __pyx_v_acovf.data;
3099     __pyx_t_6.memview = __pyx_v_acovf.memview;
3100     __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
3101     __pyx_t_24 = -1;
3102     if (unlikely(__pyx_memoryview_slice_memviewslice(
3103     &__pyx_t_6,
3104     __pyx_v_acovf.shape[0], __pyx_v_acovf.strides[0], __pyx_v_acovf.suboffsets[0],
3105     0,
3106     0,
3107     &__pyx_t_24,
3108     0,
3109     __pyx_v_m,
3110     0,
3111     0,
3112     1,
3113     0,
3114     1) < 0))
3115 {
3116     __PYX_ERR(0, 162, __pyx_L1_error)
3117 }
3118 
3119 if (unlikely(__pyx_memoryview_slice_memviewslice(
3120     &__pyx_t_6,
3121     __pyx_v_acovf.shape[1], __pyx_v_acovf.strides[1], __pyx_v_acovf.suboffsets[1],
3122     1,
3123     1,
3124     &__pyx_t_24,
3125     __pyx_v_m,
3126     __pyx_v_m2,
3127     0,
3128     1,
3129     1,
3130     0,
3131     1) < 0))
3132 {
3133     __PYX_ERR(0, 162, __pyx_L1_error)
3134 }
3135 
3136 if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_25, __pyx_t_6, 2, 2, 0) < 0)) __PYX_ERR(0, 162, __pyx_L1_error)
3137     __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
3138     __pyx_t_6.memview = NULL;
3139     __pyx_t_6.data = NULL;
3140     __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
3141     __pyx_t_25.memview = NULL;
3142     __pyx_t_25.data = NULL;
3143 
3144     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":155
3145  *     # Set i = 1, ..., m;         j = m + 1, ..., 2 m
3146  *     # and i = m + 1, ..., 2 m;   j = 1, ..., m
3147  *     if nobs > m:             # <<<<<<<<<<<<<<
3148  *         for j in range(m):
3149  *             for i in range(m, m2):
3150  */
3151   }
3152 
3153   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":165
3154  *
3155  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
3156  *     if nobs > m:             # <<<<<<<<<<<<<<
3157  *         for i in range(nobs - m):
3158  *             for r in range(q + 1 - i):
3159  */
3160   __pyx_t_9 = ((__pyx_v_nobs > __pyx_v_m) != 0);
3161   if (__pyx_t_9) {
3162 
3163     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":166
3164  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
3165  *     if nobs > m:
3166  *         for i in range(nobs - m):             # <<<<<<<<<<<<<<
3167  *             for r in range(q + 1 - i):
3168  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]
3169  */
3170     __pyx_t_4 = (__pyx_v_nobs - __pyx_v_m);
3171     __pyx_t_3 = __pyx_t_4;
3172     for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2+=1) {
3173       __pyx_v_i = __pyx_t_2;
3174 
3175       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":167
3176  *     if nobs > m:
3177  *         for i in range(nobs - m):
3178  *             for r in range(q + 1 - i):             # <<<<<<<<<<<<<<
3179  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]
3180  *
3181  */
3182       __pyx_t_10 = ((__pyx_v_q + 1) - __pyx_v_i);
3183       __pyx_t_11 = __pyx_t_10;
3184       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
3185         __pyx_v_r = __pyx_t_12;
3186 
3187         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":168
3188  *         for i in range(nobs - m):
3189  *             for r in range(q + 1 - i):
3190  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]             # <<<<<<<<<<<<<<
3191  *
3192  *     return acovf[:n, :n], acovf2
3193  */
3194         __pyx_t_21 = __pyx_v_i;
3195         __pyx_t_14 = __pyx_v_r;
3196         __pyx_t_15 = (__pyx_v_r + __pyx_v_i);
3197         __pyx_t_13 = __pyx_v_i;
3198         *((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_13 * __pyx_v_acovf2.strides[0]) )) = ((*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_21 * __pyx_v_acovf2.strides[0]) ))) + ((*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_ma.data + __pyx_t_14 * __pyx_v_ma.strides[0]) ))) * (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_ma.data + __pyx_t_15 * __pyx_v_ma.strides[0]) )))));
3199       }
3200     }
3201 
3202     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":165
3203  *
3204  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
3205  *     if nobs > m:             # <<<<<<<<<<<<<<
3206  *         for i in range(nobs - m):
3207  *             for r in range(q + 1 - i):
3208  */
3209   }
3210 
3211   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":170
3212  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]
3213  *
3214  *     return acovf[:n, :n], acovf2             # <<<<<<<<<<<<<<
3215  *
3216  *
3217  */
3218   __Pyx_XDECREF(__pyx_r);
3219   __pyx_t_25.data = __pyx_v_acovf.data;
3220   __pyx_t_25.memview = __pyx_v_acovf.memview;
3221   __PYX_INC_MEMVIEW(&__pyx_t_25, 0);
3222   __pyx_t_24 = -1;
3223   if (unlikely(__pyx_memoryview_slice_memviewslice(
3224     &__pyx_t_25,
3225     __pyx_v_acovf.shape[0], __pyx_v_acovf.strides[0], __pyx_v_acovf.suboffsets[0],
3226     0,
3227     0,
3228     &__pyx_t_24,
3229     0,
3230     __pyx_v_n,
3231     0,
3232     0,
3233     1,
3234     0,
3235     1) < 0))
3236 {
3237     __PYX_ERR(0, 170, __pyx_L1_error)
3238 }
3239 
3240 if (unlikely(__pyx_memoryview_slice_memviewslice(
3241     &__pyx_t_25,
3242     __pyx_v_acovf.shape[1], __pyx_v_acovf.strides[1], __pyx_v_acovf.suboffsets[1],
3243     1,
3244     1,
3245     &__pyx_t_24,
3246     0,
3247     __pyx_v_n,
3248     0,
3249     0,
3250     1,
3251     0,
3252     1) < 0))
3253 {
3254     __PYX_ERR(0, 170, __pyx_L1_error)
3255 }
3256 
3257 __pyx_t_19 = __pyx_memoryview_fromslice(__pyx_t_25, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float32_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float32_t, 0);; if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 170, __pyx_L1_error)
3258   __Pyx_GOTREF(__pyx_t_19);
3259   __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
3260   __pyx_t_25.memview = NULL;
3261   __pyx_t_25.data = NULL;
3262   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_acovf2, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float32_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float32_t, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error)
3263   __Pyx_GOTREF(__pyx_t_5);
3264   __pyx_t_26 = PyTuple_New(2); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 170, __pyx_L1_error)
3265   __Pyx_GOTREF(__pyx_t_26);
3266   __Pyx_GIVEREF(__pyx_t_19);
3267   PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_19);
3268   __Pyx_GIVEREF(__pyx_t_5);
3269   PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_5);
3270   __pyx_t_19 = 0;
3271   __pyx_t_5 = 0;
3272   __pyx_r = __pyx_t_26;
3273   __pyx_t_26 = 0;
3274   goto __pyx_L0;
3275 
3276   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":67
3277  *
3278  *
3279  * cpdef sarma_transformed_acovf_fast(cnp.float32_t [:] ar,             # <<<<<<<<<<<<<<
3280  *                                             cnp.float32_t [:] ma,
3281  *                                             cnp.float32_t [:] arma_acovf):
3282  */
3283 
3284   /* function exit code */
3285   __pyx_L1_error:;
3286   __Pyx_XDECREF(__pyx_t_5);
3287   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
3288   __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
3289   __Pyx_XDECREF(__pyx_t_19);
3290   __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
3291   __Pyx_XDECREF(__pyx_t_26);
3292   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_transformed_acovf_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
3293   __pyx_r = 0;
3294   __pyx_L0:;
3295   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf, 1);
3296   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf2, 1);
3297   __Pyx_XGIVEREF(__pyx_r);
3298   __Pyx_RefNannyFinishContext();
3299   return __pyx_r;
3300 }
3301 
3302 /* Python wrapper */
3303 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_1sarma_transformed_acovf_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3304 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_transformed_acovf_fast[] = "\n    arma_transformed_acovf_fast(cnp.float32_t [:] ar, cnp.float32_t [:] ma, cnp.float32_t [:] arma_acovf)\n    \n    Quickly construct the autocovariance matrix for a transformed process.\n\n    Using the autocovariance function for an ARMA process, constructs the\n    autocovariances associated with the transformed process described\n    in equation (3.3.1) of _[1] in a memory efficient, and so fast, way.\n\n    Parameters\n    ----------\n    ar : ndarray\n        Autoregressive coefficients, including the zero lag, where the sign\n        convention assumes the coefficients are part of the lag polynomial on\n        the left-hand-side of the ARMA definition (i.e. they have the opposite\n        sign from the usual econometrics convention in which the coefficients\n        are on the right-hand-side of the ARMA definition).\n    ma : ndarray\n        Moving average coefficients, including the zero lag, where the sign\n        convention assumes the coefficients are part of the lag polynomial on\n        the right-hand-side of the ARMA definition (i.e. they have the same\n        sign from the usual econometrics convention in which the coefficients\n        are on the right-hand-side of the ARMA definition).\n    arma_acovf : ndarray\n        The vector of autocovariances of the ARMA process.\n\n    Returns\n    -------\n    acovf : ndarray\n        A matrix containing the autocovariances of the portion of the\n        transformed process with time-varying autocovariances. Its dimension\n        is equal to `min(m * 2, n)` where `m = max(len(ar) - 1, len(ma) - 1)`\n        and `n` is the length of the input array `arma_acovf`. It is important\n        to note that only the values in the first `m` columns or `m` rows are\n        valid. In particular, the entries in the block `acovf[m:, m:]` should\n        not be used in any case (and in fact will always be equal to zeros).\n    acovf2 : ndarray\n        An array containing the autocovariance function of the port""ion of the\n        transformed process with time-invariant autocovariances. Its dimension\n        is equal to `max(n - m, 0)` where `n` is the length of the input\n        array `arma_acovf`.\n\n    Notes\n    -----\n    The definition of this autocovariance matrix is from _[1] equation 3.3.3.\n\n    This function assumes that the variance of the ARMA innovation term is\n    equal to one. If this is not true, then the calling program should replace\n    `arma_acovf` with `arma_acovf / sigma2`, where sigma2 is that variance.\n\n    This function is relatively fast even when `arma_acovf` is large, since\n    it only constructs the full autocovariance matrix for a generally small\n    subset of observations. The trade-off is that the output of this function\n    is somewhat more difficult to use.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_1sarma_transformed_acovf_fast(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3305 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_1sarma_transformed_acovf_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3306   __Pyx_memviewslice __pyx_v_ar = { 0, 0, { 0 }, { 0 }, { 0 } };
3307   __Pyx_memviewslice __pyx_v_ma = { 0, 0, { 0 }, { 0 }, { 0 } };
3308   __Pyx_memviewslice __pyx_v_arma_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
3309   int __pyx_lineno = 0;
3310   const char *__pyx_filename = NULL;
3311   int __pyx_clineno = 0;
3312   PyObject *__pyx_r = 0;
3313   __Pyx_RefNannyDeclarations
3314   __Pyx_RefNannySetupContext("sarma_transformed_acovf_fast (wrapper)", 0);
3315   {
3316     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ar,&__pyx_n_s_ma,&__pyx_n_s_arma_acovf,0};
3317     PyObject* values[3] = {0,0,0};
3318     if (unlikely(__pyx_kwds)) {
3319       Py_ssize_t kw_args;
3320       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3321       switch (pos_args) {
3322         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3323         CYTHON_FALLTHROUGH;
3324         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3325         CYTHON_FALLTHROUGH;
3326         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3327         CYTHON_FALLTHROUGH;
3328         case  0: break;
3329         default: goto __pyx_L5_argtuple_error;
3330       }
3331       kw_args = PyDict_Size(__pyx_kwds);
3332       switch (pos_args) {
3333         case  0:
3334         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar)) != 0)) kw_args--;
3335         else goto __pyx_L5_argtuple_error;
3336         CYTHON_FALLTHROUGH;
3337         case  1:
3338         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma)) != 0)) kw_args--;
3339         else {
3340           __Pyx_RaiseArgtupleInvalid("sarma_transformed_acovf_fast", 1, 3, 3, 1); __PYX_ERR(0, 67, __pyx_L3_error)
3341         }
3342         CYTHON_FALLTHROUGH;
3343         case  2:
3344         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arma_acovf)) != 0)) kw_args--;
3345         else {
3346           __Pyx_RaiseArgtupleInvalid("sarma_transformed_acovf_fast", 1, 3, 3, 2); __PYX_ERR(0, 67, __pyx_L3_error)
3347         }
3348       }
3349       if (unlikely(kw_args > 0)) {
3350         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sarma_transformed_acovf_fast") < 0)) __PYX_ERR(0, 67, __pyx_L3_error)
3351       }
3352     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3353       goto __pyx_L5_argtuple_error;
3354     } else {
3355       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3356       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3357       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3358     }
3359     __pyx_v_ar = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar.memview)) __PYX_ERR(0, 67, __pyx_L3_error)
3360     __pyx_v_ma = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma.memview)) __PYX_ERR(0, 68, __pyx_L3_error)
3361     __pyx_v_arma_acovf = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_arma_acovf.memview)) __PYX_ERR(0, 69, __pyx_L3_error)
3362   }
3363   goto __pyx_L4_argument_unpacking_done;
3364   __pyx_L5_argtuple_error:;
3365   __Pyx_RaiseArgtupleInvalid("sarma_transformed_acovf_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 67, __pyx_L3_error)
3366   __pyx_L3_error:;
3367   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_transformed_acovf_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
3368   __Pyx_RefNannyFinishContext();
3369   return NULL;
3370   __pyx_L4_argument_unpacking_done:;
3371   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_transformed_acovf_fast(__pyx_self, __pyx_v_ar, __pyx_v_ma, __pyx_v_arma_acovf);
3372 
3373   /* function exit code */
3374   __Pyx_RefNannyFinishContext();
3375   return __pyx_r;
3376 }
3377 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_transformed_acovf_fast(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_ar,__Pyx_memviewslice __pyx_v_ma,__Pyx_memviewslice __pyx_v_arma_acovf)3378 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_transformed_acovf_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ar, __Pyx_memviewslice __pyx_v_ma, __Pyx_memviewslice __pyx_v_arma_acovf) {
3379   PyObject *__pyx_r = NULL;
3380   __Pyx_RefNannyDeclarations
3381   PyObject *__pyx_t_1 = NULL;
3382   int __pyx_lineno = 0;
3383   const char *__pyx_filename = NULL;
3384   int __pyx_clineno = 0;
3385   __Pyx_RefNannySetupContext("sarma_transformed_acovf_fast", 0);
3386   __Pyx_XDECREF(__pyx_r);
3387   if (unlikely(!__pyx_v_ar.memview)) { __Pyx_RaiseUnboundLocalError("ar"); __PYX_ERR(0, 67, __pyx_L1_error) }
3388   if (unlikely(!__pyx_v_ma.memview)) { __Pyx_RaiseUnboundLocalError("ma"); __PYX_ERR(0, 67, __pyx_L1_error) }
3389   if (unlikely(!__pyx_v_arma_acovf.memview)) { __Pyx_RaiseUnboundLocalError("arma_acovf"); __PYX_ERR(0, 67, __pyx_L1_error) }
3390   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_transformed_acovf_fast(__pyx_v_ar, __pyx_v_ma, __pyx_v_arma_acovf, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
3391   __Pyx_GOTREF(__pyx_t_1);
3392   __pyx_r = __pyx_t_1;
3393   __pyx_t_1 = 0;
3394   goto __pyx_L0;
3395 
3396   /* function exit code */
3397   __pyx_L1_error:;
3398   __Pyx_XDECREF(__pyx_t_1);
3399   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_transformed_acovf_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
3400   __pyx_r = NULL;
3401   __pyx_L0:;
3402   __PYX_XDEC_MEMVIEW(&__pyx_v_ar, 1);
3403   __PYX_XDEC_MEMVIEW(&__pyx_v_ma, 1);
3404   __PYX_XDEC_MEMVIEW(&__pyx_v_arma_acovf, 1);
3405   __Pyx_XGIVEREF(__pyx_r);
3406   __Pyx_RefNannyFinishContext();
3407   return __pyx_r;
3408 }
3409 
3410 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":173
3411  *
3412  *
3413  * cpdef sarma_innovations_algo_fast(int nobs,             # <<<<<<<<<<<<<<
3414  *                                            cnp.float32_t [:] ar_params,
3415  *                                            cnp.float32_t [:] ma_params,
3416  */
3417 
3418 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_3sarma_innovations_algo_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations_algo_fast(int __pyx_v_nobs,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_acovf,__Pyx_memviewslice __pyx_v_acovf2,CYTHON_UNUSED int __pyx_skip_dispatch)3419 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations_algo_fast(int __pyx_v_nobs, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_acovf, __Pyx_memviewslice __pyx_v_acovf2, CYTHON_UNUSED int __pyx_skip_dispatch) {
3420   Py_ssize_t __pyx_v_i;
3421   Py_ssize_t __pyx_v_j;
3422   Py_ssize_t __pyx_v_k;
3423   Py_ssize_t __pyx_v_n;
3424   Py_ssize_t __pyx_v__n;
3425   Py_ssize_t __pyx_v_m;
3426   Py_ssize_t __pyx_v_m2;
3427   Py_ssize_t __pyx_v_p;
3428   Py_ssize_t __pyx_v_q;
3429   Py_ssize_t __pyx_v_start;
3430   Py_ssize_t __pyx_v_start2;
3431   npy_intp __pyx_v_dim1[1];
3432   npy_intp __pyx_v_dim2[2];
3433   __Pyx_memviewslice __pyx_v_theta = { 0, 0, { 0 }, { 0 }, { 0 } };
3434   __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
3435   PyObject *__pyx_r = NULL;
3436   __Pyx_RefNannyDeclarations
3437   size_t __pyx_t_1;
3438   Py_ssize_t __pyx_t_2;
3439   Py_ssize_t __pyx_t_3;
3440   Py_ssize_t __pyx_t_4;
3441   PyObject *__pyx_t_5 = NULL;
3442   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
3443   __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
3444   int __pyx_t_8;
3445   Py_ssize_t __pyx_t_9;
3446   Py_ssize_t __pyx_t_10;
3447   Py_ssize_t __pyx_t_11;
3448   long __pyx_t_12;
3449   long __pyx_t_13;
3450   Py_ssize_t __pyx_t_14;
3451   int __pyx_t_15;
3452   Py_ssize_t __pyx_t_16;
3453   Py_ssize_t __pyx_t_17;
3454   Py_ssize_t __pyx_t_18;
3455   Py_ssize_t __pyx_t_19;
3456   Py_ssize_t __pyx_t_20;
3457   Py_ssize_t __pyx_t_21;
3458   Py_ssize_t __pyx_t_22;
3459   Py_ssize_t __pyx_t_23;
3460   Py_ssize_t __pyx_t_24;
3461   __pyx_t_5numpy_float32_t __pyx_t_25;
3462   __pyx_t_5numpy_float32_t __pyx_t_26;
3463   long __pyx_t_27;
3464   PyObject *__pyx_t_28 = NULL;
3465   PyObject *__pyx_t_29 = NULL;
3466   int __pyx_lineno = 0;
3467   const char *__pyx_filename = NULL;
3468   int __pyx_clineno = 0;
3469   __Pyx_RefNannySetupContext("sarma_innovations_algo_fast", 0);
3470 
3471   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":227
3472  *     cdef cnp.float32_t [:] v
3473  *
3474  *     p = len(ar_params)             # <<<<<<<<<<<<<<
3475  *     q = len(ma_params)
3476  *     m = max(p, q)
3477  */
3478   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
3479   __pyx_v_p = __pyx_t_1;
3480 
3481   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":228
3482  *
3483  *     p = len(ar_params)
3484  *     q = len(ma_params)             # <<<<<<<<<<<<<<
3485  *     m = max(p, q)
3486  *     m2 = 2 * m
3487  */
3488   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma_params);
3489   __pyx_v_q = __pyx_t_1;
3490 
3491   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":229
3492  *     p = len(ar_params)
3493  *     q = len(ma_params)
3494  *     m = max(p, q)             # <<<<<<<<<<<<<<
3495  *     m2 = 2 * m
3496  *
3497  */
3498   __pyx_t_2 = __pyx_v_q;
3499   __pyx_t_3 = __pyx_v_p;
3500   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
3501     __pyx_t_4 = __pyx_t_2;
3502   } else {
3503     __pyx_t_4 = __pyx_t_3;
3504   }
3505   __pyx_v_m = __pyx_t_4;
3506 
3507   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":230
3508  *     q = len(ma_params)
3509  *     m = max(p, q)
3510  *     m2 = 2 * m             # <<<<<<<<<<<<<<
3511  *
3512  *     dim1[0] = nobs;
3513  */
3514   __pyx_v_m2 = (2 * __pyx_v_m);
3515 
3516   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":232
3517  *     m2 = 2 * m
3518  *
3519  *     dim1[0] = nobs;             # <<<<<<<<<<<<<<
3520  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
3521  *     dim2[0] = nobs;
3522  */
3523   (__pyx_v_dim1[0]) = __pyx_v_nobs;
3524 
3525   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":233
3526  *
3527  *     dim1[0] = nobs;
3528  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)             # <<<<<<<<<<<<<<
3529  *     dim2[0] = nobs;
3530  *     dim2[1] = m + 1;
3531  */
3532   __pyx_t_5 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_FLOAT32, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 233, __pyx_L1_error)
3533   __Pyx_GOTREF(__pyx_t_5);
3534   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 233, __pyx_L1_error)
3535   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3536   __pyx_v_v = __pyx_t_6;
3537   __pyx_t_6.memview = NULL;
3538   __pyx_t_6.data = NULL;
3539 
3540   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":234
3541  *     dim1[0] = nobs;
3542  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
3543  *     dim2[0] = nobs;             # <<<<<<<<<<<<<<
3544  *     dim2[1] = m + 1;
3545  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT32, C)
3546  */
3547   (__pyx_v_dim2[0]) = __pyx_v_nobs;
3548 
3549   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":235
3550  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
3551  *     dim2[0] = nobs;
3552  *     dim2[1] = m + 1;             # <<<<<<<<<<<<<<
3553  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT32, C)
3554  *
3555  */
3556   (__pyx_v_dim2[1]) = (__pyx_v_m + 1);
3557 
3558   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":236
3559  *     dim2[0] = nobs;
3560  *     dim2[1] = m + 1;
3561  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT32, C)             # <<<<<<<<<<<<<<
3562  *
3563  *     if m > 0:
3564  */
3565   __pyx_t_5 = PyArray_ZEROS(2, __pyx_v_dim2, NPY_FLOAT32, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L1_error)
3566   __Pyx_GOTREF(__pyx_t_5);
3567   __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float32_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 236, __pyx_L1_error)
3568   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3569   __pyx_v_theta = __pyx_t_7;
3570   __pyx_t_7.memview = NULL;
3571   __pyx_t_7.data = NULL;
3572 
3573   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":238
3574  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT32, C)
3575  *
3576  *     if m > 0:             # <<<<<<<<<<<<<<
3577  *         v[0] = acovf[0, 0]
3578  *     else:
3579  */
3580   __pyx_t_8 = ((__pyx_v_m > 0) != 0);
3581   if (__pyx_t_8) {
3582 
3583     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":239
3584  *
3585  *     if m > 0:
3586  *         v[0] = acovf[0, 0]             # <<<<<<<<<<<<<<
3587  *     else:
3588  *         # (handle the corner case where p = q = 0)
3589  */
3590     __pyx_t_9 = 0;
3591     __pyx_t_10 = 0;
3592     __pyx_t_11 = 0;
3593     *((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_11 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_9 * __pyx_v_acovf.strides[0]) ) + __pyx_t_10 * __pyx_v_acovf.strides[1]) )));
3594 
3595     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":238
3596  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT32, C)
3597  *
3598  *     if m > 0:             # <<<<<<<<<<<<<<
3599  *         v[0] = acovf[0, 0]
3600  *     else:
3601  */
3602     goto __pyx_L3;
3603   }
3604 
3605   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":242
3606  *     else:
3607  *         # (handle the corner case where p = q = 0)
3608  *         v[0] = acovf2[0]             # <<<<<<<<<<<<<<
3609  *
3610  *     for n in range(nobs - 1):
3611  */
3612   /*else*/ {
3613     __pyx_t_10 = 0;
3614     __pyx_t_9 = 0;
3615     *((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_9 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_10 * __pyx_v_acovf2.strides[0]) )));
3616   }
3617   __pyx_L3:;
3618 
3619   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":244
3620  *         v[0] = acovf2[0]
3621  *
3622  *     for n in range(nobs - 1):             # <<<<<<<<<<<<<<
3623  *         _n = n + 1
3624  *
3625  */
3626   __pyx_t_12 = (__pyx_v_nobs - 1);
3627   __pyx_t_13 = __pyx_t_12;
3628   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_13; __pyx_t_4+=1) {
3629     __pyx_v_n = __pyx_t_4;
3630 
3631     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":245
3632  *
3633  *     for n in range(nobs - 1):
3634  *         _n = n + 1             # <<<<<<<<<<<<<<
3635  *
3636  *         start = 0 if n < m else n + 1 - q
3637  */
3638     __pyx_v__n = (__pyx_v_n + 1);
3639 
3640     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":247
3641  *         _n = n + 1
3642  *
3643  *         start = 0 if n < m else n + 1 - q             # <<<<<<<<<<<<<<
3644  *         for k in range(start, n + 1):
3645  *             # See Brockwell and Davis, p. 100-101
3646  */
3647     if (((__pyx_v_n < __pyx_v_m) != 0)) {
3648       __pyx_t_2 = 0;
3649     } else {
3650       __pyx_t_2 = ((__pyx_v_n + 1) - __pyx_v_q);
3651     }
3652     __pyx_v_start = __pyx_t_2;
3653 
3654     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":248
3655  *
3656  *         start = 0 if n < m else n + 1 - q
3657  *         for k in range(start, n + 1):             # <<<<<<<<<<<<<<
3658  *             # See Brockwell and Davis, p. 100-101
3659  *             # (here we have weak rather than strict inequality due to Python's
3660  */
3661     __pyx_t_2 = (__pyx_v_n + 1);
3662     __pyx_t_3 = __pyx_t_2;
3663     for (__pyx_t_14 = __pyx_v_start; __pyx_t_14 < __pyx_t_3; __pyx_t_14+=1) {
3664       __pyx_v_k = __pyx_t_14;
3665 
3666       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":252
3667  *             # (here we have weak rather than strict inequality due to Python's
3668  *             # zero indexing)
3669  *             if n >= m and n - k >= q:             # <<<<<<<<<<<<<<
3670  *                 continue
3671  *
3672  */
3673       __pyx_t_15 = ((__pyx_v_n >= __pyx_v_m) != 0);
3674       if (__pyx_t_15) {
3675       } else {
3676         __pyx_t_8 = __pyx_t_15;
3677         goto __pyx_L9_bool_binop_done;
3678       }
3679       __pyx_t_15 = (((__pyx_v_n - __pyx_v_k) >= __pyx_v_q) != 0);
3680       __pyx_t_8 = __pyx_t_15;
3681       __pyx_L9_bool_binop_done:;
3682       if (__pyx_t_8) {
3683 
3684         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":253
3685  *             # zero indexing)
3686  *             if n >= m and n - k >= q:
3687  *                 continue             # <<<<<<<<<<<<<<
3688  *
3689  *             if n + 1 < m2 and k < m:
3690  */
3691         goto __pyx_L6_continue;
3692 
3693         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":252
3694  *             # (here we have weak rather than strict inequality due to Python's
3695  *             # zero indexing)
3696  *             if n >= m and n - k >= q:             # <<<<<<<<<<<<<<
3697  *                 continue
3698  *
3699  */
3700       }
3701 
3702       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":255
3703  *                 continue
3704  *
3705  *             if n + 1 < m2 and k < m:             # <<<<<<<<<<<<<<
3706  *                 theta[_n, n - k] = acovf[n + 1, k]
3707  *             else:
3708  */
3709       __pyx_t_15 = (((__pyx_v_n + 1) < __pyx_v_m2) != 0);
3710       if (__pyx_t_15) {
3711       } else {
3712         __pyx_t_8 = __pyx_t_15;
3713         goto __pyx_L12_bool_binop_done;
3714       }
3715       __pyx_t_15 = ((__pyx_v_k < __pyx_v_m) != 0);
3716       __pyx_t_8 = __pyx_t_15;
3717       __pyx_L12_bool_binop_done:;
3718       if (__pyx_t_8) {
3719 
3720         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":256
3721  *
3722  *             if n + 1 < m2 and k < m:
3723  *                 theta[_n, n - k] = acovf[n + 1, k]             # <<<<<<<<<<<<<<
3724  *             else:
3725  *                 theta[_n, n - k] = acovf2[n + 1 - k]
3726  */
3727         __pyx_t_10 = (__pyx_v_n + 1);
3728         __pyx_t_9 = __pyx_v_k;
3729         __pyx_t_11 = __pyx_v__n;
3730         __pyx_t_16 = (__pyx_v_n - __pyx_v_k);
3731         *((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_11 * __pyx_v_theta.strides[0]) ) + __pyx_t_16 * __pyx_v_theta.strides[1]) )) = (*((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_10 * __pyx_v_acovf.strides[0]) ) + __pyx_t_9 * __pyx_v_acovf.strides[1]) )));
3732 
3733         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":255
3734  *                 continue
3735  *
3736  *             if n + 1 < m2 and k < m:             # <<<<<<<<<<<<<<
3737  *                 theta[_n, n - k] = acovf[n + 1, k]
3738  *             else:
3739  */
3740         goto __pyx_L11;
3741       }
3742 
3743       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":258
3744  *                 theta[_n, n - k] = acovf[n + 1, k]
3745  *             else:
3746  *                 theta[_n, n - k] = acovf2[n + 1 - k]             # <<<<<<<<<<<<<<
3747  *
3748  *             start2 = 0 if n < m else n - m
3749  */
3750       /*else*/ {
3751         __pyx_t_9 = ((__pyx_v_n + 1) - __pyx_v_k);
3752         __pyx_t_10 = __pyx_v__n;
3753         __pyx_t_16 = (__pyx_v_n - __pyx_v_k);
3754         *((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_10 * __pyx_v_theta.strides[0]) ) + __pyx_t_16 * __pyx_v_theta.strides[1]) )) = (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_9 * __pyx_v_acovf2.strides[0]) )));
3755       }
3756       __pyx_L11:;
3757 
3758       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":260
3759  *                 theta[_n, n - k] = acovf2[n + 1 - k]
3760  *
3761  *             start2 = 0 if n < m else n - m             # <<<<<<<<<<<<<<
3762  *             for j in range(start2, k):
3763  *                 if n - j < m + 1:
3764  */
3765       if (((__pyx_v_n < __pyx_v_m) != 0)) {
3766         __pyx_t_17 = 0;
3767       } else {
3768         __pyx_t_17 = (__pyx_v_n - __pyx_v_m);
3769       }
3770       __pyx_v_start2 = __pyx_t_17;
3771 
3772       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":261
3773  *
3774  *             start2 = 0 if n < m else n - m
3775  *             for j in range(start2, k):             # <<<<<<<<<<<<<<
3776  *                 if n - j < m + 1:
3777  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
3778  */
3779       __pyx_t_17 = __pyx_v_k;
3780       __pyx_t_18 = __pyx_t_17;
3781       for (__pyx_t_19 = __pyx_v_start2; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
3782         __pyx_v_j = __pyx_t_19;
3783 
3784         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":262
3785  *             start2 = 0 if n < m else n - m
3786  *             for j in range(start2, k):
3787  *                 if n - j < m + 1:             # <<<<<<<<<<<<<<
3788  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
3789  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
3790  */
3791         __pyx_t_8 = (((__pyx_v_n - __pyx_v_j) < (__pyx_v_m + 1)) != 0);
3792         if (__pyx_t_8) {
3793 
3794           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":263
3795  *             for j in range(start2, k):
3796  *                 if n - j < m + 1:
3797  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]             # <<<<<<<<<<<<<<
3798  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
3799  *
3800  */
3801           __pyx_t_9 = __pyx_v__n;
3802           __pyx_t_16 = (__pyx_v_n - __pyx_v_k);
3803           __pyx_t_10 = ((__pyx_v_k - 1) + 1);
3804           __pyx_t_11 = ((__pyx_v_k - __pyx_v_j) - 1);
3805           __pyx_t_20 = __pyx_v__n;
3806           __pyx_t_21 = (__pyx_v_n - __pyx_v_j);
3807           __pyx_t_22 = __pyx_v_j;
3808           __pyx_t_23 = __pyx_v__n;
3809           __pyx_t_24 = (__pyx_v_n - __pyx_v_k);
3810           *((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_23 * __pyx_v_theta.strides[0]) ) + __pyx_t_24 * __pyx_v_theta.strides[1]) )) = ((*((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_9 * __pyx_v_theta.strides[0]) ) + __pyx_t_16 * __pyx_v_theta.strides[1]) ))) - (((*((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_10 * __pyx_v_theta.strides[0]) ) + __pyx_t_11 * __pyx_v_theta.strides[1]) ))) * (*((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_20 * __pyx_v_theta.strides[0]) ) + __pyx_t_21 * __pyx_v_theta.strides[1]) )))) * (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) )))));
3811 
3812           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":262
3813  *             start2 = 0 if n < m else n - m
3814  *             for j in range(start2, k):
3815  *                 if n - j < m + 1:             # <<<<<<<<<<<<<<
3816  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
3817  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
3818  */
3819         }
3820       }
3821 
3822       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":264
3823  *                 if n - j < m + 1:
3824  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
3825  *             theta[_n, n - k] = theta[_n, n - k] / v[k]             # <<<<<<<<<<<<<<
3826  *
3827  *         if n + 1 < m:
3828  */
3829       __pyx_t_22 = __pyx_v__n;
3830       __pyx_t_21 = (__pyx_v_n - __pyx_v_k);
3831       __pyx_t_25 = (*((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_22 * __pyx_v_theta.strides[0]) ) + __pyx_t_21 * __pyx_v_theta.strides[1]) )));
3832       __pyx_t_21 = __pyx_v_k;
3833       __pyx_t_26 = (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) )));
3834       if (unlikely(__pyx_t_26 == 0)) {
3835         PyErr_SetString(PyExc_ZeroDivisionError, "float division");
3836         __PYX_ERR(0, 264, __pyx_L1_error)
3837       }
3838       __pyx_t_21 = __pyx_v__n;
3839       __pyx_t_22 = (__pyx_v_n - __pyx_v_k);
3840       *((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_21 * __pyx_v_theta.strides[0]) ) + __pyx_t_22 * __pyx_v_theta.strides[1]) )) = (__pyx_t_25 / __pyx_t_26);
3841       __pyx_L6_continue:;
3842     }
3843 
3844     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":266
3845  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
3846  *
3847  *         if n + 1 < m:             # <<<<<<<<<<<<<<
3848  *             v[n + 1] = acovf[n + 1, n + 1]
3849  *         else:
3850  */
3851     __pyx_t_8 = (((__pyx_v_n + 1) < __pyx_v_m) != 0);
3852     if (__pyx_t_8) {
3853 
3854       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":267
3855  *
3856  *         if n + 1 < m:
3857  *             v[n + 1] = acovf[n + 1, n + 1]             # <<<<<<<<<<<<<<
3858  *         else:
3859  *             v[n + 1] = acovf2[0]
3860  */
3861       __pyx_t_22 = (__pyx_v_n + 1);
3862       __pyx_t_21 = (__pyx_v_n + 1);
3863       __pyx_t_20 = (__pyx_v_n + 1);
3864       *((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_20 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_22 * __pyx_v_acovf.strides[0]) ) + __pyx_t_21 * __pyx_v_acovf.strides[1]) )));
3865 
3866       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":266
3867  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
3868  *
3869  *         if n + 1 < m:             # <<<<<<<<<<<<<<
3870  *             v[n + 1] = acovf[n + 1, n + 1]
3871  *         else:
3872  */
3873       goto __pyx_L17;
3874     }
3875 
3876     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":269
3877  *             v[n + 1] = acovf[n + 1, n + 1]
3878  *         else:
3879  *             v[n + 1] = acovf2[0]             # <<<<<<<<<<<<<<
3880  *         start = max(0, n - (m + 1) + 2)
3881  *         for i in range(start, n + 1):
3882  */
3883     /*else*/ {
3884       __pyx_t_21 = 0;
3885       __pyx_t_22 = (__pyx_v_n + 1);
3886       *((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_21 * __pyx_v_acovf2.strides[0]) )));
3887     }
3888     __pyx_L17:;
3889 
3890     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":270
3891  *         else:
3892  *             v[n + 1] = acovf2[0]
3893  *         start = max(0, n - (m + 1) + 2)             # <<<<<<<<<<<<<<
3894  *         for i in range(start, n + 1):
3895  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]
3896  */
3897     __pyx_t_2 = ((__pyx_v_n - (__pyx_v_m + 1)) + 2);
3898     __pyx_t_27 = 0;
3899     if (((__pyx_t_2 > __pyx_t_27) != 0)) {
3900       __pyx_t_3 = __pyx_t_2;
3901     } else {
3902       __pyx_t_3 = __pyx_t_27;
3903     }
3904     __pyx_v_start = __pyx_t_3;
3905 
3906     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":271
3907  *             v[n + 1] = acovf2[0]
3908  *         start = max(0, n - (m + 1) + 2)
3909  *         for i in range(start, n + 1):             # <<<<<<<<<<<<<<
3910  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]
3911  *
3912  */
3913     __pyx_t_3 = (__pyx_v_n + 1);
3914     __pyx_t_2 = __pyx_t_3;
3915     for (__pyx_t_14 = __pyx_v_start; __pyx_t_14 < __pyx_t_2; __pyx_t_14+=1) {
3916       __pyx_v_i = __pyx_t_14;
3917 
3918       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":272
3919  *         start = max(0, n - (m + 1) + 2)
3920  *         for i in range(start, n + 1):
3921  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]             # <<<<<<<<<<<<<<
3922  *
3923  *     return theta, v
3924  */
3925       __pyx_t_21 = (__pyx_v_n + 1);
3926       __pyx_t_22 = __pyx_v__n;
3927       __pyx_t_20 = (__pyx_v_n - __pyx_v_i);
3928       __pyx_t_11 = __pyx_v_i;
3929       __pyx_t_10 = (__pyx_v_n + 1);
3930       *((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_10 * __pyx_v_v.strides[0]) )) = ((*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) ))) - (powf((*((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_22 * __pyx_v_theta.strides[0]) ) + __pyx_t_20 * __pyx_v_theta.strides[1]) ))), 2.0) * (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_11 * __pyx_v_v.strides[0]) )))));
3931     }
3932   }
3933 
3934   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":274
3935  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]
3936  *
3937  *     return theta, v             # <<<<<<<<<<<<<<
3938  *
3939  *
3940  */
3941   __Pyx_XDECREF(__pyx_r);
3942   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_theta, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float32_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float32_t, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 274, __pyx_L1_error)
3943   __Pyx_GOTREF(__pyx_t_5);
3944   __pyx_t_28 = __pyx_memoryview_fromslice(__pyx_v_v, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float32_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float32_t, 0);; if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 274, __pyx_L1_error)
3945   __Pyx_GOTREF(__pyx_t_28);
3946   __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 274, __pyx_L1_error)
3947   __Pyx_GOTREF(__pyx_t_29);
3948   __Pyx_GIVEREF(__pyx_t_5);
3949   PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_t_5);
3950   __Pyx_GIVEREF(__pyx_t_28);
3951   PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_28);
3952   __pyx_t_5 = 0;
3953   __pyx_t_28 = 0;
3954   __pyx_r = __pyx_t_29;
3955   __pyx_t_29 = 0;
3956   goto __pyx_L0;
3957 
3958   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":173
3959  *
3960  *
3961  * cpdef sarma_innovations_algo_fast(int nobs,             # <<<<<<<<<<<<<<
3962  *                                            cnp.float32_t [:] ar_params,
3963  *                                            cnp.float32_t [:] ma_params,
3964  */
3965 
3966   /* function exit code */
3967   __pyx_L1_error:;
3968   __Pyx_XDECREF(__pyx_t_5);
3969   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
3970   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
3971   __Pyx_XDECREF(__pyx_t_28);
3972   __Pyx_XDECREF(__pyx_t_29);
3973   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_innovations_algo_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
3974   __pyx_r = 0;
3975   __pyx_L0:;
3976   __PYX_XDEC_MEMVIEW(&__pyx_v_theta, 1);
3977   __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
3978   __Pyx_XGIVEREF(__pyx_r);
3979   __Pyx_RefNannyFinishContext();
3980   return __pyx_r;
3981 }
3982 
3983 /* Python wrapper */
3984 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_3sarma_innovations_algo_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3985 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_2sarma_innovations_algo_fast[] = "\n    arma_innovations_algo_fast(int nobs, cnp.float32_t [:] ar_params, cnp.float32_t [:] ma_params, cnp.float32_t [:, :] acovf, cnp.float32_t [:] acovf2)\n    \n    Quickly apply innovations algorithm for an ARMA process.\n\n    Parameters\n    ----------\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    acovf : ndarray\n        An `m * 2` x `m * 2` autocovariance matrix at least the first `m`\n        columns filled in, where `m = max(len(ar_params), ma_params)`\n        (see `arma_transformed_acovf_fast`).\n    acovf2 : ndarray\n        A `max(0, nobs - m)` length vector containing the autocovariance\n        function associated with the final `nobs - m` observations.\n\n    Returns\n    -------\n    theta : ndarray\n        The matrix of moving average coefficients from the innovations\n        algorithm.\n    v : ndarray\n        The vector of mean squared errors.\n\n    Notes\n    -----\n    The innovations algorithm is presented in _[1], section 2.5.2.\n\n    Details of the innovations algorithm applied to ARMA processes is given\n    in _[1] section 3.3 and in section 5.2.7.\n\n    This function is relatively fast even with a large number of observations\n    since we can exploit a number of known zeros in the theta array.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_3sarma_innovations_algo_fast(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3986 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_3sarma_innovations_algo_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3987   int __pyx_v_nobs;
3988   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
3989   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
3990   __Pyx_memviewslice __pyx_v_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
3991   __Pyx_memviewslice __pyx_v_acovf2 = { 0, 0, { 0 }, { 0 }, { 0 } };
3992   int __pyx_lineno = 0;
3993   const char *__pyx_filename = NULL;
3994   int __pyx_clineno = 0;
3995   PyObject *__pyx_r = 0;
3996   __Pyx_RefNannyDeclarations
3997   __Pyx_RefNannySetupContext("sarma_innovations_algo_fast (wrapper)", 0);
3998   {
3999     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nobs,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_acovf,&__pyx_n_s_acovf2,0};
4000     PyObject* values[5] = {0,0,0,0,0};
4001     if (unlikely(__pyx_kwds)) {
4002       Py_ssize_t kw_args;
4003       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4004       switch (pos_args) {
4005         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4006         CYTHON_FALLTHROUGH;
4007         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4008         CYTHON_FALLTHROUGH;
4009         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4010         CYTHON_FALLTHROUGH;
4011         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4012         CYTHON_FALLTHROUGH;
4013         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4014         CYTHON_FALLTHROUGH;
4015         case  0: break;
4016         default: goto __pyx_L5_argtuple_error;
4017       }
4018       kw_args = PyDict_Size(__pyx_kwds);
4019       switch (pos_args) {
4020         case  0:
4021         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nobs)) != 0)) kw_args--;
4022         else goto __pyx_L5_argtuple_error;
4023         CYTHON_FALLTHROUGH;
4024         case  1:
4025         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
4026         else {
4027           __Pyx_RaiseArgtupleInvalid("sarma_innovations_algo_fast", 1, 5, 5, 1); __PYX_ERR(0, 173, __pyx_L3_error)
4028         }
4029         CYTHON_FALLTHROUGH;
4030         case  2:
4031         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
4032         else {
4033           __Pyx_RaiseArgtupleInvalid("sarma_innovations_algo_fast", 1, 5, 5, 2); __PYX_ERR(0, 173, __pyx_L3_error)
4034         }
4035         CYTHON_FALLTHROUGH;
4036         case  3:
4037         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_acovf)) != 0)) kw_args--;
4038         else {
4039           __Pyx_RaiseArgtupleInvalid("sarma_innovations_algo_fast", 1, 5, 5, 3); __PYX_ERR(0, 173, __pyx_L3_error)
4040         }
4041         CYTHON_FALLTHROUGH;
4042         case  4:
4043         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_acovf2)) != 0)) kw_args--;
4044         else {
4045           __Pyx_RaiseArgtupleInvalid("sarma_innovations_algo_fast", 1, 5, 5, 4); __PYX_ERR(0, 173, __pyx_L3_error)
4046         }
4047       }
4048       if (unlikely(kw_args > 0)) {
4049         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sarma_innovations_algo_fast") < 0)) __PYX_ERR(0, 173, __pyx_L3_error)
4050       }
4051     } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4052       goto __pyx_L5_argtuple_error;
4053     } else {
4054       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4055       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4056       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4057       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4058       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4059     }
4060     __pyx_v_nobs = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nobs == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L3_error)
4061     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 174, __pyx_L3_error)
4062     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 175, __pyx_L3_error)
4063     __pyx_v_acovf = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float32_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_acovf.memview)) __PYX_ERR(0, 176, __pyx_L3_error)
4064     __pyx_v_acovf2 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_acovf2.memview)) __PYX_ERR(0, 177, __pyx_L3_error)
4065   }
4066   goto __pyx_L4_argument_unpacking_done;
4067   __pyx_L5_argtuple_error:;
4068   __Pyx_RaiseArgtupleInvalid("sarma_innovations_algo_fast", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 173, __pyx_L3_error)
4069   __pyx_L3_error:;
4070   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_innovations_algo_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
4071   __Pyx_RefNannyFinishContext();
4072   return NULL;
4073   __pyx_L4_argument_unpacking_done:;
4074   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_2sarma_innovations_algo_fast(__pyx_self, __pyx_v_nobs, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_acovf, __pyx_v_acovf2);
4075 
4076   /* function exit code */
4077   __Pyx_RefNannyFinishContext();
4078   return __pyx_r;
4079 }
4080 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_2sarma_innovations_algo_fast(CYTHON_UNUSED PyObject * __pyx_self,int __pyx_v_nobs,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_acovf,__Pyx_memviewslice __pyx_v_acovf2)4081 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_2sarma_innovations_algo_fast(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nobs, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_acovf, __Pyx_memviewslice __pyx_v_acovf2) {
4082   PyObject *__pyx_r = NULL;
4083   __Pyx_RefNannyDeclarations
4084   PyObject *__pyx_t_1 = NULL;
4085   int __pyx_lineno = 0;
4086   const char *__pyx_filename = NULL;
4087   int __pyx_clineno = 0;
4088   __Pyx_RefNannySetupContext("sarma_innovations_algo_fast", 0);
4089   __Pyx_XDECREF(__pyx_r);
4090   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 173, __pyx_L1_error) }
4091   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 173, __pyx_L1_error) }
4092   if (unlikely(!__pyx_v_acovf.memview)) { __Pyx_RaiseUnboundLocalError("acovf"); __PYX_ERR(0, 173, __pyx_L1_error) }
4093   if (unlikely(!__pyx_v_acovf2.memview)) { __Pyx_RaiseUnboundLocalError("acovf2"); __PYX_ERR(0, 173, __pyx_L1_error) }
4094   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations_algo_fast(__pyx_v_nobs, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_acovf, __pyx_v_acovf2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
4095   __Pyx_GOTREF(__pyx_t_1);
4096   __pyx_r = __pyx_t_1;
4097   __pyx_t_1 = 0;
4098   goto __pyx_L0;
4099 
4100   /* function exit code */
4101   __pyx_L1_error:;
4102   __Pyx_XDECREF(__pyx_t_1);
4103   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_innovations_algo_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
4104   __pyx_r = NULL;
4105   __pyx_L0:;
4106   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
4107   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
4108   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf, 1);
4109   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf2, 1);
4110   __Pyx_XGIVEREF(__pyx_r);
4111   __Pyx_RefNannyFinishContext();
4112   return __pyx_r;
4113 }
4114 
4115 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":277
4116  *
4117  *
4118  * cpdef sarma_innovations_filter(cnp.float32_t [:] endog,             # <<<<<<<<<<<<<<
4119  *                                         cnp.float32_t [:] ar_params,
4120  *                                         cnp.float32_t [:] ma_params,
4121  */
4122 
4123 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_5sarma_innovations_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations_filter(__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_theta,CYTHON_UNUSED int __pyx_skip_dispatch)4124 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations_filter(__Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_theta, CYTHON_UNUSED int __pyx_skip_dispatch) {
4125   Py_ssize_t __pyx_v_nobs;
4126   Py_ssize_t __pyx_v_i;
4127   CYTHON_UNUSED Py_ssize_t __pyx_v_k;
4128   Py_ssize_t __pyx_v_j;
4129   Py_ssize_t __pyx_v_m;
4130   Py_ssize_t __pyx_v_p;
4131   Py_ssize_t __pyx_v_q;
4132   npy_intp __pyx_v_dim1[1];
4133   __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
4134   __pyx_t_5numpy_float32_t __pyx_v_hat;
4135   PyObject *__pyx_r = NULL;
4136   __Pyx_RefNannyDeclarations
4137   size_t __pyx_t_1;
4138   Py_ssize_t __pyx_t_2;
4139   Py_ssize_t __pyx_t_3;
4140   Py_ssize_t __pyx_t_4;
4141   PyObject *__pyx_t_5 = NULL;
4142   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
4143   Py_ssize_t __pyx_t_7;
4144   Py_ssize_t __pyx_t_8;
4145   int __pyx_t_9;
4146   Py_ssize_t __pyx_t_10;
4147   Py_ssize_t __pyx_t_11;
4148   Py_ssize_t __pyx_t_12;
4149   Py_ssize_t __pyx_t_13;
4150   int __pyx_lineno = 0;
4151   const char *__pyx_filename = NULL;
4152   int __pyx_clineno = 0;
4153   __Pyx_RefNannySetupContext("sarma_innovations_filter", 0);
4154 
4155   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":322
4156  *     cdef cnp.float32_t hat
4157  *
4158  *     p = len(ar_params)             # <<<<<<<<<<<<<<
4159  *     q = len(ma_params)
4160  *     m = max(p, q)
4161  */
4162   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
4163   __pyx_v_p = __pyx_t_1;
4164 
4165   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":323
4166  *
4167  *     p = len(ar_params)
4168  *     q = len(ma_params)             # <<<<<<<<<<<<<<
4169  *     m = max(p, q)
4170  *
4171  */
4172   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma_params);
4173   __pyx_v_q = __pyx_t_1;
4174 
4175   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":324
4176  *     p = len(ar_params)
4177  *     q = len(ma_params)
4178  *     m = max(p, q)             # <<<<<<<<<<<<<<
4179  *
4180  *     nobs = theta.shape[0]
4181  */
4182   __pyx_t_2 = __pyx_v_q;
4183   __pyx_t_3 = __pyx_v_p;
4184   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
4185     __pyx_t_4 = __pyx_t_2;
4186   } else {
4187     __pyx_t_4 = __pyx_t_3;
4188   }
4189   __pyx_v_m = __pyx_t_4;
4190 
4191   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":326
4192  *     m = max(p, q)
4193  *
4194  *     nobs = theta.shape[0]             # <<<<<<<<<<<<<<
4195  *     k = theta.shape[1]
4196  *
4197  */
4198   __pyx_v_nobs = (__pyx_v_theta.shape[0]);
4199 
4200   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":327
4201  *
4202  *     nobs = theta.shape[0]
4203  *     k = theta.shape[1]             # <<<<<<<<<<<<<<
4204  *
4205  *     dim1[0] = nobs;
4206  */
4207   __pyx_v_k = (__pyx_v_theta.shape[1]);
4208 
4209   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":329
4210  *     k = theta.shape[1]
4211  *
4212  *     dim1[0] = nobs;             # <<<<<<<<<<<<<<
4213  *     u = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
4214  *     u[0] = endog[0]
4215  */
4216   (__pyx_v_dim1[0]) = __pyx_v_nobs;
4217 
4218   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":330
4219  *
4220  *     dim1[0] = nobs;
4221  *     u = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)             # <<<<<<<<<<<<<<
4222  *     u[0] = endog[0]
4223  *
4224  */
4225   __pyx_t_5 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_FLOAT32, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 330, __pyx_L1_error)
4226   __Pyx_GOTREF(__pyx_t_5);
4227   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 330, __pyx_L1_error)
4228   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4229   __pyx_v_u = __pyx_t_6;
4230   __pyx_t_6.memview = NULL;
4231   __pyx_t_6.data = NULL;
4232 
4233   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":331
4234  *     dim1[0] = nobs;
4235  *     u = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
4236  *     u[0] = endog[0]             # <<<<<<<<<<<<<<
4237  *
4238  *     for i in range(1, nobs):
4239  */
4240   __pyx_t_7 = 0;
4241   __pyx_t_8 = 0;
4242   *((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_8 * __pyx_v_u.strides[0]) )) = (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_endog.data + __pyx_t_7 * __pyx_v_endog.strides[0]) )));
4243 
4244   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":333
4245  *     u[0] = endog[0]
4246  *
4247  *     for i in range(1, nobs):             # <<<<<<<<<<<<<<
4248  *         hat = 0
4249  *         if i < m:
4250  */
4251   __pyx_t_4 = __pyx_v_nobs;
4252   __pyx_t_2 = __pyx_t_4;
4253   for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4254     __pyx_v_i = __pyx_t_3;
4255 
4256     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":334
4257  *
4258  *     for i in range(1, nobs):
4259  *         hat = 0             # <<<<<<<<<<<<<<
4260  *         if i < m:
4261  *             for j in range(i):
4262  */
4263     __pyx_v_hat = 0.0;
4264 
4265     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":335
4266  *     for i in range(1, nobs):
4267  *         hat = 0
4268  *         if i < m:             # <<<<<<<<<<<<<<
4269  *             for j in range(i):
4270  *                 hat = hat + theta[i, j] * u[i - j - 1]
4271  */
4272     __pyx_t_9 = ((__pyx_v_i < __pyx_v_m) != 0);
4273     if (__pyx_t_9) {
4274 
4275       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":336
4276  *         hat = 0
4277  *         if i < m:
4278  *             for j in range(i):             # <<<<<<<<<<<<<<
4279  *                 hat = hat + theta[i, j] * u[i - j - 1]
4280  *         else:
4281  */
4282       __pyx_t_10 = __pyx_v_i;
4283       __pyx_t_11 = __pyx_t_10;
4284       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
4285         __pyx_v_j = __pyx_t_12;
4286 
4287         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":337
4288  *         if i < m:
4289  *             for j in range(i):
4290  *                 hat = hat + theta[i, j] * u[i - j - 1]             # <<<<<<<<<<<<<<
4291  *         else:
4292  *             for j in range(p):
4293  */
4294         __pyx_t_7 = __pyx_v_i;
4295         __pyx_t_8 = __pyx_v_j;
4296         __pyx_t_13 = ((__pyx_v_i - __pyx_v_j) - 1);
4297         __pyx_v_hat = (__pyx_v_hat + ((*((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_7 * __pyx_v_theta.strides[0]) ) + __pyx_t_8 * __pyx_v_theta.strides[1]) ))) * (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_13 * __pyx_v_u.strides[0]) )))));
4298       }
4299 
4300       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":335
4301  *     for i in range(1, nobs):
4302  *         hat = 0
4303  *         if i < m:             # <<<<<<<<<<<<<<
4304  *             for j in range(i):
4305  *                 hat = hat + theta[i, j] * u[i - j - 1]
4306  */
4307       goto __pyx_L5;
4308     }
4309 
4310     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":339
4311  *                 hat = hat + theta[i, j] * u[i - j - 1]
4312  *         else:
4313  *             for j in range(p):             # <<<<<<<<<<<<<<
4314  *                 hat = hat + ar_params[j] * endog[i - j - 1]
4315  *             for j in range(q):
4316  */
4317     /*else*/ {
4318       __pyx_t_10 = __pyx_v_p;
4319       __pyx_t_11 = __pyx_t_10;
4320       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
4321         __pyx_v_j = __pyx_t_12;
4322 
4323         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":340
4324  *         else:
4325  *             for j in range(p):
4326  *                 hat = hat + ar_params[j] * endog[i - j - 1]             # <<<<<<<<<<<<<<
4327  *             for j in range(q):
4328  *                 hat = hat + theta[i, j] * u[i - j - 1]
4329  */
4330         __pyx_t_13 = __pyx_v_j;
4331         __pyx_t_8 = ((__pyx_v_i - __pyx_v_j) - 1);
4332         __pyx_v_hat = (__pyx_v_hat + ((*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_ar_params.data + __pyx_t_13 * __pyx_v_ar_params.strides[0]) ))) * (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_endog.data + __pyx_t_8 * __pyx_v_endog.strides[0]) )))));
4333       }
4334 
4335       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":341
4336  *             for j in range(p):
4337  *                 hat = hat + ar_params[j] * endog[i - j - 1]
4338  *             for j in range(q):             # <<<<<<<<<<<<<<
4339  *                 hat = hat + theta[i, j] * u[i - j - 1]
4340  *         u[i] = endog[i] - hat
4341  */
4342       __pyx_t_10 = __pyx_v_q;
4343       __pyx_t_11 = __pyx_t_10;
4344       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
4345         __pyx_v_j = __pyx_t_12;
4346 
4347         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":342
4348  *                 hat = hat + ar_params[j] * endog[i - j - 1]
4349  *             for j in range(q):
4350  *                 hat = hat + theta[i, j] * u[i - j - 1]             # <<<<<<<<<<<<<<
4351  *         u[i] = endog[i] - hat
4352  *
4353  */
4354         __pyx_t_8 = __pyx_v_i;
4355         __pyx_t_13 = __pyx_v_j;
4356         __pyx_t_7 = ((__pyx_v_i - __pyx_v_j) - 1);
4357         __pyx_v_hat = (__pyx_v_hat + ((*((__pyx_t_5numpy_float32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_8 * __pyx_v_theta.strides[0]) ) + __pyx_t_13 * __pyx_v_theta.strides[1]) ))) * (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_7 * __pyx_v_u.strides[0]) )))));
4358       }
4359     }
4360     __pyx_L5:;
4361 
4362     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":343
4363  *             for j in range(q):
4364  *                 hat = hat + theta[i, j] * u[i - j - 1]
4365  *         u[i] = endog[i] - hat             # <<<<<<<<<<<<<<
4366  *
4367  *     return u
4368  */
4369     __pyx_t_7 = __pyx_v_i;
4370     __pyx_t_13 = __pyx_v_i;
4371     *((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_13 * __pyx_v_u.strides[0]) )) = ((*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_endog.data + __pyx_t_7 * __pyx_v_endog.strides[0]) ))) - __pyx_v_hat);
4372   }
4373 
4374   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":345
4375  *         u[i] = endog[i] - hat
4376  *
4377  *     return u             # <<<<<<<<<<<<<<
4378  *
4379  *
4380  */
4381   __Pyx_XDECREF(__pyx_r);
4382   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_u, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float32_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float32_t, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 345, __pyx_L1_error)
4383   __Pyx_GOTREF(__pyx_t_5);
4384   __pyx_r = __pyx_t_5;
4385   __pyx_t_5 = 0;
4386   goto __pyx_L0;
4387 
4388   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":277
4389  *
4390  *
4391  * cpdef sarma_innovations_filter(cnp.float32_t [:] endog,             # <<<<<<<<<<<<<<
4392  *                                         cnp.float32_t [:] ar_params,
4393  *                                         cnp.float32_t [:] ma_params,
4394  */
4395 
4396   /* function exit code */
4397   __pyx_L1_error:;
4398   __Pyx_XDECREF(__pyx_t_5);
4399   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4400   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_innovations_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
4401   __pyx_r = 0;
4402   __pyx_L0:;
4403   __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
4404   __Pyx_XGIVEREF(__pyx_r);
4405   __Pyx_RefNannyFinishContext();
4406   return __pyx_r;
4407 }
4408 
4409 /* Python wrapper */
4410 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_5sarma_innovations_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4411 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_4sarma_innovations_filter[] = "\n    arma_innovations_filter(cnp.float32_t [:] endog, cnp.float32_t [:] ar_params, cnp.float32_t [:] ma_params, cnp.float32_t [:, :] theta):\n    \n    Innovations filter for an ARMA process.\n\n    Parameters\n    ----------\n    endog : ndarray\n        The observed time-series process.\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    theta : ndarray\n        The matrix of moving average coefficients from the innovations\n        algorithm (see `arma_innovations_algo` or `arma_innovations_algo_fast`)\n\n    Returns\n    -------\n    u : ndarray\n        The vector of innovations: the one-step-ahead prediction errors from\n        applying the innovations algorithm.\n\n    Notes\n    -----\n    The innovations algorithm is presented in _[1], section 2.5.2.\n\n    Details of the innovations algorithm applied to ARMA processes is given\n    in _[1] section 3.3 and in section 5.2.7.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_5sarma_innovations_filter(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4412 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_5sarma_innovations_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4413   __Pyx_memviewslice __pyx_v_endog = { 0, 0, { 0 }, { 0 }, { 0 } };
4414   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
4415   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
4416   __Pyx_memviewslice __pyx_v_theta = { 0, 0, { 0 }, { 0 }, { 0 } };
4417   int __pyx_lineno = 0;
4418   const char *__pyx_filename = NULL;
4419   int __pyx_clineno = 0;
4420   PyObject *__pyx_r = 0;
4421   __Pyx_RefNannyDeclarations
4422   __Pyx_RefNannySetupContext("sarma_innovations_filter (wrapper)", 0);
4423   {
4424     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_theta,0};
4425     PyObject* values[4] = {0,0,0,0};
4426     if (unlikely(__pyx_kwds)) {
4427       Py_ssize_t kw_args;
4428       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4429       switch (pos_args) {
4430         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4431         CYTHON_FALLTHROUGH;
4432         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4433         CYTHON_FALLTHROUGH;
4434         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4435         CYTHON_FALLTHROUGH;
4436         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4437         CYTHON_FALLTHROUGH;
4438         case  0: break;
4439         default: goto __pyx_L5_argtuple_error;
4440       }
4441       kw_args = PyDict_Size(__pyx_kwds);
4442       switch (pos_args) {
4443         case  0:
4444         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
4445         else goto __pyx_L5_argtuple_error;
4446         CYTHON_FALLTHROUGH;
4447         case  1:
4448         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
4449         else {
4450           __Pyx_RaiseArgtupleInvalid("sarma_innovations_filter", 1, 4, 4, 1); __PYX_ERR(0, 277, __pyx_L3_error)
4451         }
4452         CYTHON_FALLTHROUGH;
4453         case  2:
4454         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
4455         else {
4456           __Pyx_RaiseArgtupleInvalid("sarma_innovations_filter", 1, 4, 4, 2); __PYX_ERR(0, 277, __pyx_L3_error)
4457         }
4458         CYTHON_FALLTHROUGH;
4459         case  3:
4460         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
4461         else {
4462           __Pyx_RaiseArgtupleInvalid("sarma_innovations_filter", 1, 4, 4, 3); __PYX_ERR(0, 277, __pyx_L3_error)
4463         }
4464       }
4465       if (unlikely(kw_args > 0)) {
4466         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sarma_innovations_filter") < 0)) __PYX_ERR(0, 277, __pyx_L3_error)
4467       }
4468     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
4469       goto __pyx_L5_argtuple_error;
4470     } else {
4471       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4472       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4473       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4474       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4475     }
4476     __pyx_v_endog = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_endog.memview)) __PYX_ERR(0, 277, __pyx_L3_error)
4477     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 278, __pyx_L3_error)
4478     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 279, __pyx_L3_error)
4479     __pyx_v_theta = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float32_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_theta.memview)) __PYX_ERR(0, 280, __pyx_L3_error)
4480   }
4481   goto __pyx_L4_argument_unpacking_done;
4482   __pyx_L5_argtuple_error:;
4483   __Pyx_RaiseArgtupleInvalid("sarma_innovations_filter", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 277, __pyx_L3_error)
4484   __pyx_L3_error:;
4485   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_innovations_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
4486   __Pyx_RefNannyFinishContext();
4487   return NULL;
4488   __pyx_L4_argument_unpacking_done:;
4489   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_4sarma_innovations_filter(__pyx_self, __pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_theta);
4490 
4491   /* function exit code */
4492   __Pyx_RefNannyFinishContext();
4493   return __pyx_r;
4494 }
4495 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_4sarma_innovations_filter(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_theta)4496 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_4sarma_innovations_filter(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_theta) {
4497   PyObject *__pyx_r = NULL;
4498   __Pyx_RefNannyDeclarations
4499   PyObject *__pyx_t_1 = NULL;
4500   int __pyx_lineno = 0;
4501   const char *__pyx_filename = NULL;
4502   int __pyx_clineno = 0;
4503   __Pyx_RefNannySetupContext("sarma_innovations_filter", 0);
4504   __Pyx_XDECREF(__pyx_r);
4505   if (unlikely(!__pyx_v_endog.memview)) { __Pyx_RaiseUnboundLocalError("endog"); __PYX_ERR(0, 277, __pyx_L1_error) }
4506   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 277, __pyx_L1_error) }
4507   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 277, __pyx_L1_error) }
4508   if (unlikely(!__pyx_v_theta.memview)) { __Pyx_RaiseUnboundLocalError("theta"); __PYX_ERR(0, 277, __pyx_L1_error) }
4509   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations_filter(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_theta, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error)
4510   __Pyx_GOTREF(__pyx_t_1);
4511   __pyx_r = __pyx_t_1;
4512   __pyx_t_1 = 0;
4513   goto __pyx_L0;
4514 
4515   /* function exit code */
4516   __pyx_L1_error:;
4517   __Pyx_XDECREF(__pyx_t_1);
4518   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_innovations_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
4519   __pyx_r = NULL;
4520   __pyx_L0:;
4521   __PYX_XDEC_MEMVIEW(&__pyx_v_endog, 1);
4522   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
4523   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
4524   __PYX_XDEC_MEMVIEW(&__pyx_v_theta, 1);
4525   __Pyx_XGIVEREF(__pyx_r);
4526   __Pyx_RefNannyFinishContext();
4527   return __pyx_r;
4528 }
4529 
4530 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":348
4531  *
4532  *
4533  * cpdef sarma_innovations(cnp.float32_t [:] endog,             # <<<<<<<<<<<<<<
4534  *                                       cnp.float32_t [:] ar_params,
4535  *                                       cnp.float32_t [:] ma_params,
4536  */
4537 
4538 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_7sarma_innovations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations(__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_5numpy_float32_t __pyx_v_sigma2,CYTHON_UNUSED int __pyx_skip_dispatch)4539 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations(__Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_5numpy_float32_t __pyx_v_sigma2, CYTHON_UNUSED int __pyx_skip_dispatch) {
4540   Py_ssize_t __pyx_v_nobs;
4541   Py_ssize_t __pyx_v_i;
4542   __Pyx_memviewslice __pyx_v_ar = { 0, 0, { 0 }, { 0 }, { 0 } };
4543   __Pyx_memviewslice __pyx_v_ma = { 0, 0, { 0 }, { 0 }, { 0 } };
4544   __Pyx_memviewslice __pyx_v_arma_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
4545   __Pyx_memviewslice __pyx_v_acovf2 = { 0, 0, { 0 }, { 0 }, { 0 } };
4546   __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
4547   __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
4548   __Pyx_memviewslice __pyx_v_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
4549   npy_intp __pyx_v_dim1[1];
4550   PyObject *__pyx_v_theta = NULL;
4551   PyObject *__pyx_r = NULL;
4552   __Pyx_RefNannyDeclarations
4553   size_t __pyx_t_1;
4554   PyObject *__pyx_t_2 = NULL;
4555   __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
4556   Py_ssize_t __pyx_t_4;
4557   Py_ssize_t __pyx_t_5;
4558   Py_ssize_t __pyx_t_6;
4559   Py_ssize_t __pyx_t_7;
4560   Py_ssize_t __pyx_t_8;
4561   int __pyx_t_9;
4562   PyObject *__pyx_t_10 = NULL;
4563   PyObject *__pyx_t_11 = NULL;
4564   PyObject *__pyx_t_12 = NULL;
4565   PyObject *__pyx_t_13 = NULL;
4566   PyObject *__pyx_t_14 = NULL;
4567   PyObject *(*__pyx_t_15)(PyObject *);
4568   __Pyx_memviewslice __pyx_t_16 = { 0, 0, { 0 }, { 0 }, { 0 } };
4569   int __pyx_lineno = 0;
4570   const char *__pyx_filename = NULL;
4571   int __pyx_clineno = 0;
4572   __Pyx_RefNannySetupContext("sarma_innovations", 0);
4573 
4574   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":386
4575  *        New York, NY: Springer.
4576  *     """
4577  *     cdef Py_ssize_t nobs = len(endog), i             # <<<<<<<<<<<<<<
4578  *     cdef cnp.float32_t const
4579  *     cdef cnp.float32_t [:] ar, ma, arma_acovf, llf_obs, acovf2, u, v
4580  */
4581   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_endog);
4582   __pyx_v_nobs = __pyx_t_1;
4583 
4584   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":392
4585  *     cdef cnp.npy_intp dim1[1]
4586  *
4587  *     dim1[0] = len(ar_params) + 1;             # <<<<<<<<<<<<<<
4588  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
4589  *     dim1[0] = len(ma_params) + 1;
4590  */
4591   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
4592   (__pyx_v_dim1[0]) = (__pyx_t_1 + 1);
4593 
4594   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":393
4595  *
4596  *     dim1[0] = len(ar_params) + 1;
4597  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)             # <<<<<<<<<<<<<<
4598  *     dim1[0] = len(ma_params) + 1;
4599  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
4600  */
4601   __pyx_t_2 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_FLOAT32, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 393, __pyx_L1_error)
4602   __Pyx_GOTREF(__pyx_t_2);
4603   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 393, __pyx_L1_error)
4604   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4605   __pyx_v_ar = __pyx_t_3;
4606   __pyx_t_3.memview = NULL;
4607   __pyx_t_3.data = NULL;
4608 
4609   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":394
4610  *     dim1[0] = len(ar_params) + 1;
4611  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
4612  *     dim1[0] = len(ma_params) + 1;             # <<<<<<<<<<<<<<
4613  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
4614  *
4615  */
4616   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma_params);
4617   (__pyx_v_dim1[0]) = (__pyx_t_1 + 1);
4618 
4619   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":395
4620  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
4621  *     dim1[0] = len(ma_params) + 1;
4622  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)             # <<<<<<<<<<<<<<
4623  *
4624  *     ar[0] = 1
4625  */
4626   __pyx_t_2 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_FLOAT32, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error)
4627   __Pyx_GOTREF(__pyx_t_2);
4628   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 395, __pyx_L1_error)
4629   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4630   __pyx_v_ma = __pyx_t_3;
4631   __pyx_t_3.memview = NULL;
4632   __pyx_t_3.data = NULL;
4633 
4634   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":397
4635  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
4636  *
4637  *     ar[0] = 1             # <<<<<<<<<<<<<<
4638  *     for i in range(1, len(ar_params) + 1):
4639  *         ar[i] = -1 * ar_params[i - 1]
4640  */
4641   __pyx_t_4 = 0;
4642   *((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_ar.data + __pyx_t_4 * __pyx_v_ar.strides[0]) )) = 1.0;
4643 
4644   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":398
4645  *
4646  *     ar[0] = 1
4647  *     for i in range(1, len(ar_params) + 1):             # <<<<<<<<<<<<<<
4648  *         ar[i] = -1 * ar_params[i - 1]
4649  *     ma[0] = 1
4650  */
4651   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
4652   __pyx_t_5 = (__pyx_t_1 + 1);
4653   __pyx_t_6 = __pyx_t_5;
4654   for (__pyx_t_7 = 1; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
4655     __pyx_v_i = __pyx_t_7;
4656 
4657     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":399
4658  *     ar[0] = 1
4659  *     for i in range(1, len(ar_params) + 1):
4660  *         ar[i] = -1 * ar_params[i - 1]             # <<<<<<<<<<<<<<
4661  *     ma[0] = 1
4662  *     ma[1:] = ma_params
4663  */
4664     __pyx_t_4 = (__pyx_v_i - 1);
4665     __pyx_t_8 = __pyx_v_i;
4666     *((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_ar.data + __pyx_t_8 * __pyx_v_ar.strides[0]) )) = (-1.0 * (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_ar_params.data + __pyx_t_4 * __pyx_v_ar_params.strides[0]) ))));
4667   }
4668 
4669   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":400
4670  *     for i in range(1, len(ar_params) + 1):
4671  *         ar[i] = -1 * ar_params[i - 1]
4672  *     ma[0] = 1             # <<<<<<<<<<<<<<
4673  *     ma[1:] = ma_params
4674  *
4675  */
4676   __pyx_t_4 = 0;
4677   *((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_ma.data + __pyx_t_4 * __pyx_v_ma.strides[0]) )) = 1.0;
4678 
4679   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":401
4680  *         ar[i] = -1 * ar_params[i - 1]
4681  *     ma[0] = 1
4682  *     ma[1:] = ma_params             # <<<<<<<<<<<<<<
4683  *
4684  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=np.float32) / sigma2
4685  */
4686   __pyx_t_3.data = __pyx_v_ma.data;
4687   __pyx_t_3.memview = __pyx_v_ma.memview;
4688   __PYX_INC_MEMVIEW(&__pyx_t_3, 0);
4689   __pyx_t_9 = -1;
4690   if (unlikely(__pyx_memoryview_slice_memviewslice(
4691     &__pyx_t_3,
4692     __pyx_v_ma.shape[0], __pyx_v_ma.strides[0], __pyx_v_ma.suboffsets[0],
4693     0,
4694     0,
4695     &__pyx_t_9,
4696     1,
4697     0,
4698     0,
4699     1,
4700     0,
4701     0,
4702     1) < 0))
4703 {
4704     __PYX_ERR(0, 401, __pyx_L1_error)
4705 }
4706 
4707 if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_ma_params, __pyx_t_3, 1, 1, 0) < 0)) __PYX_ERR(0, 401, __pyx_L1_error)
4708   __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
4709   __pyx_t_3.memview = NULL;
4710   __pyx_t_3.data = NULL;
4711 
4712   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":403
4713  *     ma[1:] = ma_params
4714  *
4715  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=np.float32) / sigma2             # <<<<<<<<<<<<<<
4716  *     acovf, acovf2 = sarma_transformed_acovf_fast(ar, ma, arma_acovf)
4717  *     theta, v = sarma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)
4718  */
4719   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_arima_process); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 403, __pyx_L1_error)
4720   __Pyx_GOTREF(__pyx_t_2);
4721   __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_arma_acovf); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 403, __pyx_L1_error)
4722   __Pyx_GOTREF(__pyx_t_10);
4723   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4724   __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_ar, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float32_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float32_t, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 403, __pyx_L1_error)
4725   __Pyx_GOTREF(__pyx_t_2);
4726   __pyx_t_11 = __pyx_memoryview_fromslice(__pyx_v_ma, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float32_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float32_t, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 403, __pyx_L1_error)
4727   __Pyx_GOTREF(__pyx_t_11);
4728   __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_nobs); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 403, __pyx_L1_error)
4729   __Pyx_GOTREF(__pyx_t_12);
4730   __pyx_t_13 = PyFloat_FromDouble(__pyx_v_sigma2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 403, __pyx_L1_error)
4731   __Pyx_GOTREF(__pyx_t_13);
4732   __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 403, __pyx_L1_error)
4733   __Pyx_GOTREF(__pyx_t_14);
4734   __Pyx_GIVEREF(__pyx_t_2);
4735   PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2);
4736   __Pyx_GIVEREF(__pyx_t_11);
4737   PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_11);
4738   __Pyx_GIVEREF(__pyx_t_12);
4739   PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_12);
4740   __Pyx_GIVEREF(__pyx_t_13);
4741   PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_13);
4742   __pyx_t_2 = 0;
4743   __pyx_t_11 = 0;
4744   __pyx_t_12 = 0;
4745   __pyx_t_13 = 0;
4746   __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 403, __pyx_L1_error)
4747   __Pyx_GOTREF(__pyx_t_13);
4748   __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 403, __pyx_L1_error)
4749   __Pyx_GOTREF(__pyx_t_12);
4750   __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float32); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 403, __pyx_L1_error)
4751   __Pyx_GOTREF(__pyx_t_11);
4752   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4753   if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 403, __pyx_L1_error)
4754   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4755   __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 403, __pyx_L1_error)
4756   __Pyx_GOTREF(__pyx_t_11);
4757   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4758   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4759   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4760   __pyx_t_13 = PyFloat_FromDouble(__pyx_v_sigma2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 403, __pyx_L1_error)
4761   __Pyx_GOTREF(__pyx_t_13);
4762   __pyx_t_14 = __Pyx_PyNumber_Divide(__pyx_t_11, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 403, __pyx_L1_error)
4763   __Pyx_GOTREF(__pyx_t_14);
4764   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4765   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4766   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(__pyx_t_14, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 403, __pyx_L1_error)
4767   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4768   __pyx_v_arma_acovf = __pyx_t_3;
4769   __pyx_t_3.memview = NULL;
4770   __pyx_t_3.data = NULL;
4771 
4772   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":404
4773  *
4774  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=np.float32) / sigma2
4775  *     acovf, acovf2 = sarma_transformed_acovf_fast(ar, ma, arma_acovf)             # <<<<<<<<<<<<<<
4776  *     theta, v = sarma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)
4777  *     u = sarma_innovations_filter(endog, ar_params, ma_params, theta)
4778  */
4779   __pyx_t_14 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_transformed_acovf_fast(__pyx_v_ar, __pyx_v_ma, __pyx_v_arma_acovf, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 404, __pyx_L1_error)
4780   __Pyx_GOTREF(__pyx_t_14);
4781   if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
4782     PyObject* sequence = __pyx_t_14;
4783     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4784     if (unlikely(size != 2)) {
4785       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4786       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4787       __PYX_ERR(0, 404, __pyx_L1_error)
4788     }
4789     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4790     if (likely(PyTuple_CheckExact(sequence))) {
4791       __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0);
4792       __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
4793     } else {
4794       __pyx_t_13 = PyList_GET_ITEM(sequence, 0);
4795       __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
4796     }
4797     __Pyx_INCREF(__pyx_t_13);
4798     __Pyx_INCREF(__pyx_t_11);
4799     #else
4800     __pyx_t_13 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 404, __pyx_L1_error)
4801     __Pyx_GOTREF(__pyx_t_13);
4802     __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 404, __pyx_L1_error)
4803     __Pyx_GOTREF(__pyx_t_11);
4804     #endif
4805     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4806   } else {
4807     Py_ssize_t index = -1;
4808     __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 404, __pyx_L1_error)
4809     __Pyx_GOTREF(__pyx_t_10);
4810     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4811     __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
4812     index = 0; __pyx_t_13 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_13)) goto __pyx_L5_unpacking_failed;
4813     __Pyx_GOTREF(__pyx_t_13);
4814     index = 1; __pyx_t_11 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_11)) goto __pyx_L5_unpacking_failed;
4815     __Pyx_GOTREF(__pyx_t_11);
4816     if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_10), 2) < 0) __PYX_ERR(0, 404, __pyx_L1_error)
4817     __pyx_t_15 = NULL;
4818     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4819     goto __pyx_L6_unpacking_done;
4820     __pyx_L5_unpacking_failed:;
4821     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4822     __pyx_t_15 = NULL;
4823     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4824     __PYX_ERR(0, 404, __pyx_L1_error)
4825     __pyx_L6_unpacking_done:;
4826   }
4827   __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float32_t(__pyx_t_13, PyBUF_WRITABLE); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 404, __pyx_L1_error)
4828   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4829   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(__pyx_t_11, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 404, __pyx_L1_error)
4830   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4831   __pyx_v_acovf = __pyx_t_16;
4832   __pyx_t_16.memview = NULL;
4833   __pyx_t_16.data = NULL;
4834   __pyx_v_acovf2 = __pyx_t_3;
4835   __pyx_t_3.memview = NULL;
4836   __pyx_t_3.data = NULL;
4837 
4838   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":405
4839  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=np.float32) / sigma2
4840  *     acovf, acovf2 = sarma_transformed_acovf_fast(ar, ma, arma_acovf)
4841  *     theta, v = sarma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)             # <<<<<<<<<<<<<<
4842  *     u = sarma_innovations_filter(endog, ar_params, ma_params, theta)
4843  *
4844  */
4845   __pyx_t_14 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations_algo_fast(__pyx_v_nobs, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_acovf, __pyx_v_acovf2, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 405, __pyx_L1_error)
4846   __Pyx_GOTREF(__pyx_t_14);
4847   if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
4848     PyObject* sequence = __pyx_t_14;
4849     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4850     if (unlikely(size != 2)) {
4851       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4852       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4853       __PYX_ERR(0, 405, __pyx_L1_error)
4854     }
4855     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4856     if (likely(PyTuple_CheckExact(sequence))) {
4857       __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0);
4858       __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
4859     } else {
4860       __pyx_t_11 = PyList_GET_ITEM(sequence, 0);
4861       __pyx_t_13 = PyList_GET_ITEM(sequence, 1);
4862     }
4863     __Pyx_INCREF(__pyx_t_11);
4864     __Pyx_INCREF(__pyx_t_13);
4865     #else
4866     __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 405, __pyx_L1_error)
4867     __Pyx_GOTREF(__pyx_t_11);
4868     __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 405, __pyx_L1_error)
4869     __Pyx_GOTREF(__pyx_t_13);
4870     #endif
4871     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4872   } else {
4873     Py_ssize_t index = -1;
4874     __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 405, __pyx_L1_error)
4875     __Pyx_GOTREF(__pyx_t_10);
4876     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4877     __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
4878     index = 0; __pyx_t_11 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_11)) goto __pyx_L7_unpacking_failed;
4879     __Pyx_GOTREF(__pyx_t_11);
4880     index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_13)) goto __pyx_L7_unpacking_failed;
4881     __Pyx_GOTREF(__pyx_t_13);
4882     if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_10), 2) < 0) __PYX_ERR(0, 405, __pyx_L1_error)
4883     __pyx_t_15 = NULL;
4884     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4885     goto __pyx_L8_unpacking_done;
4886     __pyx_L7_unpacking_failed:;
4887     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4888     __pyx_t_15 = NULL;
4889     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4890     __PYX_ERR(0, 405, __pyx_L1_error)
4891     __pyx_L8_unpacking_done:;
4892   }
4893   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(__pyx_t_13, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 405, __pyx_L1_error)
4894   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4895   __pyx_v_theta = __pyx_t_11;
4896   __pyx_t_11 = 0;
4897   __pyx_v_v = __pyx_t_3;
4898   __pyx_t_3.memview = NULL;
4899   __pyx_t_3.data = NULL;
4900 
4901   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":406
4902  *     acovf, acovf2 = sarma_transformed_acovf_fast(ar, ma, arma_acovf)
4903  *     theta, v = sarma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)
4904  *     u = sarma_innovations_filter(endog, ar_params, ma_params, theta)             # <<<<<<<<<<<<<<
4905  *
4906  *     return u, v
4907  */
4908   __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float32_t(__pyx_v_theta, PyBUF_WRITABLE); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 406, __pyx_L1_error)
4909   __pyx_t_14 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations_filter(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_t_16, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 406, __pyx_L1_error)
4910   __Pyx_GOTREF(__pyx_t_14);
4911   __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
4912   __pyx_t_16.memview = NULL;
4913   __pyx_t_16.data = NULL;
4914   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(__pyx_t_14, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 406, __pyx_L1_error)
4915   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4916   __pyx_v_u = __pyx_t_3;
4917   __pyx_t_3.memview = NULL;
4918   __pyx_t_3.data = NULL;
4919 
4920   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":408
4921  *     u = sarma_innovations_filter(endog, ar_params, ma_params, theta)
4922  *
4923  *     return u, v             # <<<<<<<<<<<<<<
4924  *
4925  *
4926  */
4927   __Pyx_XDECREF(__pyx_r);
4928   __pyx_t_14 = __pyx_memoryview_fromslice(__pyx_v_u, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float32_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float32_t, 0);; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 408, __pyx_L1_error)
4929   __Pyx_GOTREF(__pyx_t_14);
4930   __pyx_t_13 = __pyx_memoryview_fromslice(__pyx_v_v, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float32_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float32_t, 0);; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 408, __pyx_L1_error)
4931   __Pyx_GOTREF(__pyx_t_13);
4932   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 408, __pyx_L1_error)
4933   __Pyx_GOTREF(__pyx_t_11);
4934   __Pyx_GIVEREF(__pyx_t_14);
4935   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_14);
4936   __Pyx_GIVEREF(__pyx_t_13);
4937   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_13);
4938   __pyx_t_14 = 0;
4939   __pyx_t_13 = 0;
4940   __pyx_r = __pyx_t_11;
4941   __pyx_t_11 = 0;
4942   goto __pyx_L0;
4943 
4944   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":348
4945  *
4946  *
4947  * cpdef sarma_innovations(cnp.float32_t [:] endog,             # <<<<<<<<<<<<<<
4948  *                                       cnp.float32_t [:] ar_params,
4949  *                                       cnp.float32_t [:] ma_params,
4950  */
4951 
4952   /* function exit code */
4953   __pyx_L1_error:;
4954   __Pyx_XDECREF(__pyx_t_2);
4955   __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
4956   __Pyx_XDECREF(__pyx_t_10);
4957   __Pyx_XDECREF(__pyx_t_11);
4958   __Pyx_XDECREF(__pyx_t_12);
4959   __Pyx_XDECREF(__pyx_t_13);
4960   __Pyx_XDECREF(__pyx_t_14);
4961   __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
4962   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
4963   __pyx_r = 0;
4964   __pyx_L0:;
4965   __PYX_XDEC_MEMVIEW(&__pyx_v_ar, 1);
4966   __PYX_XDEC_MEMVIEW(&__pyx_v_ma, 1);
4967   __PYX_XDEC_MEMVIEW(&__pyx_v_arma_acovf, 1);
4968   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf2, 1);
4969   __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
4970   __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
4971   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf, 1);
4972   __Pyx_XDECREF(__pyx_v_theta);
4973   __Pyx_XGIVEREF(__pyx_r);
4974   __Pyx_RefNannyFinishContext();
4975   return __pyx_r;
4976 }
4977 
4978 /* Python wrapper */
4979 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_7sarma_innovations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4980 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_6sarma_innovations[] = "\n    arma_innovations(cnp.float32_t [:] endog, cnp.float32_t [:] ar_params, cnp.float32_t [:] ma_params):\n    \n    Compute innovations and variances based on an ARMA process.\n\n    Parameters\n    ----------\n    endog : ndarray\n        The observed time-series process.\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    sigma2 : ndarray\n        The ARMA innovation variance.\n\n    Returns\n    -------\n    u : ndarray\n        The vector of innovations: the one-step-ahead prediction errors from\n        applying the innovations algorithm.\n    v : ndarray\n        The vector of innovation variances.\n\n    Notes\n    -----\n    The innovations algorithm is presented in _[1], section 2.5.2.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_7sarma_innovations(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4981 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_7sarma_innovations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4982   __Pyx_memviewslice __pyx_v_endog = { 0, 0, { 0 }, { 0 }, { 0 } };
4983   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
4984   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
4985   __pyx_t_5numpy_float32_t __pyx_v_sigma2;
4986   int __pyx_lineno = 0;
4987   const char *__pyx_filename = NULL;
4988   int __pyx_clineno = 0;
4989   PyObject *__pyx_r = 0;
4990   __Pyx_RefNannyDeclarations
4991   __Pyx_RefNannySetupContext("sarma_innovations (wrapper)", 0);
4992   {
4993     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_sigma2,0};
4994     PyObject* values[4] = {0,0,0,0};
4995     if (unlikely(__pyx_kwds)) {
4996       Py_ssize_t kw_args;
4997       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4998       switch (pos_args) {
4999         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5000         CYTHON_FALLTHROUGH;
5001         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5002         CYTHON_FALLTHROUGH;
5003         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5004         CYTHON_FALLTHROUGH;
5005         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5006         CYTHON_FALLTHROUGH;
5007         case  0: break;
5008         default: goto __pyx_L5_argtuple_error;
5009       }
5010       kw_args = PyDict_Size(__pyx_kwds);
5011       switch (pos_args) {
5012         case  0:
5013         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
5014         else goto __pyx_L5_argtuple_error;
5015         CYTHON_FALLTHROUGH;
5016         case  1:
5017         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
5018         else {
5019           __Pyx_RaiseArgtupleInvalid("sarma_innovations", 1, 4, 4, 1); __PYX_ERR(0, 348, __pyx_L3_error)
5020         }
5021         CYTHON_FALLTHROUGH;
5022         case  2:
5023         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
5024         else {
5025           __Pyx_RaiseArgtupleInvalid("sarma_innovations", 1, 4, 4, 2); __PYX_ERR(0, 348, __pyx_L3_error)
5026         }
5027         CYTHON_FALLTHROUGH;
5028         case  3:
5029         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma2)) != 0)) kw_args--;
5030         else {
5031           __Pyx_RaiseArgtupleInvalid("sarma_innovations", 1, 4, 4, 3); __PYX_ERR(0, 348, __pyx_L3_error)
5032         }
5033       }
5034       if (unlikely(kw_args > 0)) {
5035         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sarma_innovations") < 0)) __PYX_ERR(0, 348, __pyx_L3_error)
5036       }
5037     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
5038       goto __pyx_L5_argtuple_error;
5039     } else {
5040       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5041       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5042       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5043       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5044     }
5045     __pyx_v_endog = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_endog.memview)) __PYX_ERR(0, 348, __pyx_L3_error)
5046     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 349, __pyx_L3_error)
5047     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 350, __pyx_L3_error)
5048     __pyx_v_sigma2 = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_sigma2 == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 351, __pyx_L3_error)
5049   }
5050   goto __pyx_L4_argument_unpacking_done;
5051   __pyx_L5_argtuple_error:;
5052   __Pyx_RaiseArgtupleInvalid("sarma_innovations", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 348, __pyx_L3_error)
5053   __pyx_L3_error:;
5054   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
5055   __Pyx_RefNannyFinishContext();
5056   return NULL;
5057   __pyx_L4_argument_unpacking_done:;
5058   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_6sarma_innovations(__pyx_self, __pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2);
5059 
5060   /* function exit code */
5061   __Pyx_RefNannyFinishContext();
5062   return __pyx_r;
5063 }
5064 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_6sarma_innovations(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_5numpy_float32_t __pyx_v_sigma2)5065 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_6sarma_innovations(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_5numpy_float32_t __pyx_v_sigma2) {
5066   PyObject *__pyx_r = NULL;
5067   __Pyx_RefNannyDeclarations
5068   PyObject *__pyx_t_1 = NULL;
5069   int __pyx_lineno = 0;
5070   const char *__pyx_filename = NULL;
5071   int __pyx_clineno = 0;
5072   __Pyx_RefNannySetupContext("sarma_innovations", 0);
5073   __Pyx_XDECREF(__pyx_r);
5074   if (unlikely(!__pyx_v_endog.memview)) { __Pyx_RaiseUnboundLocalError("endog"); __PYX_ERR(0, 348, __pyx_L1_error) }
5075   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 348, __pyx_L1_error) }
5076   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 348, __pyx_L1_error) }
5077   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error)
5078   __Pyx_GOTREF(__pyx_t_1);
5079   __pyx_r = __pyx_t_1;
5080   __pyx_t_1 = 0;
5081   goto __pyx_L0;
5082 
5083   /* function exit code */
5084   __pyx_L1_error:;
5085   __Pyx_XDECREF(__pyx_t_1);
5086   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
5087   __pyx_r = NULL;
5088   __pyx_L0:;
5089   __PYX_XDEC_MEMVIEW(&__pyx_v_endog, 1);
5090   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
5091   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
5092   __Pyx_XGIVEREF(__pyx_r);
5093   __Pyx_RefNannyFinishContext();
5094   return __pyx_r;
5095 }
5096 
5097 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":411
5098  *
5099  *
5100  * cpdef sarma_loglikeobs_fast(cnp.float32_t [:] endog,             # <<<<<<<<<<<<<<
5101  *                                      cnp.float32_t [:] ar_params,
5102  *                                      cnp.float32_t [:] ma_params,
5103  */
5104 
5105 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_9sarma_loglikeobs_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_loglikeobs_fast(__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_5numpy_float32_t __pyx_v_sigma2,CYTHON_UNUSED int __pyx_skip_dispatch)5106 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_loglikeobs_fast(__Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_5numpy_float32_t __pyx_v_sigma2, CYTHON_UNUSED int __pyx_skip_dispatch) {
5107   Py_ssize_t __pyx_v_nobs;
5108   Py_ssize_t __pyx_v_i;
5109   __pyx_t_5numpy_float32_t __pyx_v_const;
5110   __Pyx_memviewslice __pyx_v_llf_obs = { 0, 0, { 0 }, { 0 }, { 0 } };
5111   __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
5112   __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
5113   npy_intp __pyx_v_dim1[1];
5114   PyObject *__pyx_r = NULL;
5115   __Pyx_RefNannyDeclarations
5116   size_t __pyx_t_1;
5117   PyObject *__pyx_t_2 = NULL;
5118   PyObject *__pyx_t_3 = NULL;
5119   PyObject *__pyx_t_4 = NULL;
5120   PyObject *__pyx_t_5 = NULL;
5121   PyObject *(*__pyx_t_6)(PyObject *);
5122   __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
5123   __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
5124   Py_ssize_t __pyx_t_9;
5125   Py_ssize_t __pyx_t_10;
5126   Py_ssize_t __pyx_t_11;
5127   Py_ssize_t __pyx_t_12;
5128   double __pyx_t_13;
5129   __pyx_t_5numpy_float32_t __pyx_t_14;
5130   Py_ssize_t __pyx_t_15;
5131   PyObject *__pyx_t_16 = NULL;
5132   int __pyx_lineno = 0;
5133   const char *__pyx_filename = NULL;
5134   int __pyx_clineno = 0;
5135   __Pyx_RefNannySetupContext("sarma_loglikeobs_fast", 0);
5136 
5137   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":448
5138  *     """
5139  *
5140  *     cdef Py_ssize_t nobs = len(endog), i             # <<<<<<<<<<<<<<
5141  *     cdef cnp.float32_t const
5142  *     cdef cnp.float32_t [:] llf_obs, u, v
5143  */
5144   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_endog);
5145   __pyx_v_nobs = __pyx_t_1;
5146 
5147   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":453
5148  *     cdef cnp.npy_intp dim1[1]
5149  *
5150  *     u, v = sarma_innovations(endog, ar_params, ma_params, sigma2)             # <<<<<<<<<<<<<<
5151  *
5152  *     dim1[0] = nobs;
5153  */
5154   __pyx_t_2 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_innovations(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L1_error)
5155   __Pyx_GOTREF(__pyx_t_2);
5156   if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
5157     PyObject* sequence = __pyx_t_2;
5158     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
5159     if (unlikely(size != 2)) {
5160       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
5161       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
5162       __PYX_ERR(0, 453, __pyx_L1_error)
5163     }
5164     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5165     if (likely(PyTuple_CheckExact(sequence))) {
5166       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
5167       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
5168     } else {
5169       __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
5170       __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
5171     }
5172     __Pyx_INCREF(__pyx_t_3);
5173     __Pyx_INCREF(__pyx_t_4);
5174     #else
5175     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error)
5176     __Pyx_GOTREF(__pyx_t_3);
5177     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 453, __pyx_L1_error)
5178     __Pyx_GOTREF(__pyx_t_4);
5179     #endif
5180     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5181   } else {
5182     Py_ssize_t index = -1;
5183     __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 453, __pyx_L1_error)
5184     __Pyx_GOTREF(__pyx_t_5);
5185     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5186     __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
5187     index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
5188     __Pyx_GOTREF(__pyx_t_3);
5189     index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
5190     __Pyx_GOTREF(__pyx_t_4);
5191     if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 453, __pyx_L1_error)
5192     __pyx_t_6 = NULL;
5193     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5194     goto __pyx_L4_unpacking_done;
5195     __pyx_L3_unpacking_failed:;
5196     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5197     __pyx_t_6 = NULL;
5198     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
5199     __PYX_ERR(0, 453, __pyx_L1_error)
5200     __pyx_L4_unpacking_done:;
5201   }
5202   __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 453, __pyx_L1_error)
5203   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5204   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 453, __pyx_L1_error)
5205   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5206   __pyx_v_u = __pyx_t_7;
5207   __pyx_t_7.memview = NULL;
5208   __pyx_t_7.data = NULL;
5209   __pyx_v_v = __pyx_t_8;
5210   __pyx_t_8.memview = NULL;
5211   __pyx_t_8.data = NULL;
5212 
5213   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":455
5214  *     u, v = sarma_innovations(endog, ar_params, ma_params, sigma2)
5215  *
5216  *     dim1[0] = nobs;             # <<<<<<<<<<<<<<
5217  *     llf_obs = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
5218  *
5219  */
5220   (__pyx_v_dim1[0]) = __pyx_v_nobs;
5221 
5222   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":456
5223  *
5224  *     dim1[0] = nobs;
5225  *     llf_obs = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)             # <<<<<<<<<<<<<<
5226  *
5227  *     const = dlog(2*NPY_PI)
5228  */
5229   __pyx_t_2 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_FLOAT32, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 456, __pyx_L1_error)
5230   __Pyx_GOTREF(__pyx_t_2);
5231   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 456, __pyx_L1_error)
5232   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5233   __pyx_v_llf_obs = __pyx_t_8;
5234   __pyx_t_8.memview = NULL;
5235   __pyx_t_8.data = NULL;
5236 
5237   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":458
5238  *     llf_obs = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT32, C)
5239  *
5240  *     const = dlog(2*NPY_PI)             # <<<<<<<<<<<<<<
5241  *     for i in range(nobs):
5242  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + dlog(sigma2 * v[i]))
5243  */
5244   __pyx_v_const = log((2.0 * NPY_PI));
5245 
5246   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":459
5247  *
5248  *     const = dlog(2*NPY_PI)
5249  *     for i in range(nobs):             # <<<<<<<<<<<<<<
5250  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + dlog(sigma2 * v[i]))
5251  *
5252  */
5253   __pyx_t_9 = __pyx_v_nobs;
5254   __pyx_t_10 = __pyx_t_9;
5255   for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5256     __pyx_v_i = __pyx_t_11;
5257 
5258     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":460
5259  *     const = dlog(2*NPY_PI)
5260  *     for i in range(nobs):
5261  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + dlog(sigma2 * v[i]))             # <<<<<<<<<<<<<<
5262  *
5263  *     return np.array(llf_obs, dtype=np.float32)
5264  */
5265     __pyx_t_12 = __pyx_v_i;
5266     __pyx_t_13 = (-0.5 * powf((*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_12 * __pyx_v_u.strides[0]) ))), 2.0));
5267     __pyx_t_12 = __pyx_v_i;
5268     __pyx_t_14 = (__pyx_v_sigma2 * (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_12 * __pyx_v_v.strides[0]) ))));
5269     if (unlikely(__pyx_t_14 == 0)) {
5270       PyErr_SetString(PyExc_ZeroDivisionError, "float division");
5271       __PYX_ERR(0, 460, __pyx_L1_error)
5272     }
5273     __pyx_t_12 = __pyx_v_i;
5274     __pyx_t_15 = __pyx_v_i;
5275     *((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_llf_obs.data + __pyx_t_15 * __pyx_v_llf_obs.strides[0]) )) = ((__pyx_t_13 / ((double)__pyx_t_14)) - (0.5 * (__pyx_v_const + log((__pyx_v_sigma2 * (*((__pyx_t_5numpy_float32_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_12 * __pyx_v_v.strides[0]) ))))))));
5276   }
5277 
5278   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":462
5279  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + dlog(sigma2 * v[i]))
5280  *
5281  *     return np.array(llf_obs, dtype=np.float32)             # <<<<<<<<<<<<<<
5282  *
5283  *
5284  */
5285   __Pyx_XDECREF(__pyx_r);
5286   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
5287   __Pyx_GOTREF(__pyx_t_2);
5288   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 462, __pyx_L1_error)
5289   __Pyx_GOTREF(__pyx_t_4);
5290   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5291   __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_llf_obs, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float32_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float32_t, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
5292   __Pyx_GOTREF(__pyx_t_2);
5293   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L1_error)
5294   __Pyx_GOTREF(__pyx_t_3);
5295   __Pyx_GIVEREF(__pyx_t_2);
5296   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
5297   __pyx_t_2 = 0;
5298   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
5299   __Pyx_GOTREF(__pyx_t_2);
5300   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
5301   __Pyx_GOTREF(__pyx_t_5);
5302   __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 462, __pyx_L1_error)
5303   __Pyx_GOTREF(__pyx_t_16);
5304   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5305   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_16) < 0) __PYX_ERR(0, 462, __pyx_L1_error)
5306   __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5307   __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 462, __pyx_L1_error)
5308   __Pyx_GOTREF(__pyx_t_16);
5309   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5310   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5311   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5312   __pyx_r = __pyx_t_16;
5313   __pyx_t_16 = 0;
5314   goto __pyx_L0;
5315 
5316   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":411
5317  *
5318  *
5319  * cpdef sarma_loglikeobs_fast(cnp.float32_t [:] endog,             # <<<<<<<<<<<<<<
5320  *                                      cnp.float32_t [:] ar_params,
5321  *                                      cnp.float32_t [:] ma_params,
5322  */
5323 
5324   /* function exit code */
5325   __pyx_L1_error:;
5326   __Pyx_XDECREF(__pyx_t_2);
5327   __Pyx_XDECREF(__pyx_t_3);
5328   __Pyx_XDECREF(__pyx_t_4);
5329   __Pyx_XDECREF(__pyx_t_5);
5330   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
5331   __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
5332   __Pyx_XDECREF(__pyx_t_16);
5333   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_loglikeobs_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
5334   __pyx_r = 0;
5335   __pyx_L0:;
5336   __PYX_XDEC_MEMVIEW(&__pyx_v_llf_obs, 1);
5337   __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
5338   __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
5339   __Pyx_XGIVEREF(__pyx_r);
5340   __Pyx_RefNannyFinishContext();
5341   return __pyx_r;
5342 }
5343 
5344 /* Python wrapper */
5345 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_9sarma_loglikeobs_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5346 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_8sarma_loglikeobs_fast[] = "\n    sarma_loglikeobs_fast(cnp.float32_t [:] endog, cnp.float32_t [:] ar_params, cnp.float32_t [:] ma_params, cnp.float32_t sigma2)\n\n    Quickly calculate the loglikelihood of each observation for an ARMA process\n\n    Parameters\n    ----------\n    endog : ndarray\n        The observed time-series process.\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    sigma2 : ndarray\n        The ARMA innovation variance.\n\n    Returns\n    -------\n    loglike : ndarray of float\n        Array of loglikelihood values for each observation.\n\n    Notes\n    -----\n    Details related to computing the loglikelihood associated with an ARMA\n    process using the innovations algorithm are given in _[1] section 5.2.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_9sarma_loglikeobs_fast(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5347 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_9sarma_loglikeobs_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5348   __Pyx_memviewslice __pyx_v_endog = { 0, 0, { 0 }, { 0 }, { 0 } };
5349   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
5350   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
5351   __pyx_t_5numpy_float32_t __pyx_v_sigma2;
5352   int __pyx_lineno = 0;
5353   const char *__pyx_filename = NULL;
5354   int __pyx_clineno = 0;
5355   PyObject *__pyx_r = 0;
5356   __Pyx_RefNannyDeclarations
5357   __Pyx_RefNannySetupContext("sarma_loglikeobs_fast (wrapper)", 0);
5358   {
5359     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_sigma2,0};
5360     PyObject* values[4] = {0,0,0,0};
5361     if (unlikely(__pyx_kwds)) {
5362       Py_ssize_t kw_args;
5363       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5364       switch (pos_args) {
5365         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5366         CYTHON_FALLTHROUGH;
5367         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5368         CYTHON_FALLTHROUGH;
5369         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5370         CYTHON_FALLTHROUGH;
5371         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5372         CYTHON_FALLTHROUGH;
5373         case  0: break;
5374         default: goto __pyx_L5_argtuple_error;
5375       }
5376       kw_args = PyDict_Size(__pyx_kwds);
5377       switch (pos_args) {
5378         case  0:
5379         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
5380         else goto __pyx_L5_argtuple_error;
5381         CYTHON_FALLTHROUGH;
5382         case  1:
5383         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
5384         else {
5385           __Pyx_RaiseArgtupleInvalid("sarma_loglikeobs_fast", 1, 4, 4, 1); __PYX_ERR(0, 411, __pyx_L3_error)
5386         }
5387         CYTHON_FALLTHROUGH;
5388         case  2:
5389         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
5390         else {
5391           __Pyx_RaiseArgtupleInvalid("sarma_loglikeobs_fast", 1, 4, 4, 2); __PYX_ERR(0, 411, __pyx_L3_error)
5392         }
5393         CYTHON_FALLTHROUGH;
5394         case  3:
5395         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma2)) != 0)) kw_args--;
5396         else {
5397           __Pyx_RaiseArgtupleInvalid("sarma_loglikeobs_fast", 1, 4, 4, 3); __PYX_ERR(0, 411, __pyx_L3_error)
5398         }
5399       }
5400       if (unlikely(kw_args > 0)) {
5401         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sarma_loglikeobs_fast") < 0)) __PYX_ERR(0, 411, __pyx_L3_error)
5402       }
5403     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
5404       goto __pyx_L5_argtuple_error;
5405     } else {
5406       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5407       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5408       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5409       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5410     }
5411     __pyx_v_endog = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_endog.memview)) __PYX_ERR(0, 411, __pyx_L3_error)
5412     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 412, __pyx_L3_error)
5413     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 413, __pyx_L3_error)
5414     __pyx_v_sigma2 = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_sigma2 == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L3_error)
5415   }
5416   goto __pyx_L4_argument_unpacking_done;
5417   __pyx_L5_argtuple_error:;
5418   __Pyx_RaiseArgtupleInvalid("sarma_loglikeobs_fast", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 411, __pyx_L3_error)
5419   __pyx_L3_error:;
5420   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_loglikeobs_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
5421   __Pyx_RefNannyFinishContext();
5422   return NULL;
5423   __pyx_L4_argument_unpacking_done:;
5424   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_8sarma_loglikeobs_fast(__pyx_self, __pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2);
5425 
5426   /* function exit code */
5427   __Pyx_RefNannyFinishContext();
5428   return __pyx_r;
5429 }
5430 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_8sarma_loglikeobs_fast(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_5numpy_float32_t __pyx_v_sigma2)5431 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_8sarma_loglikeobs_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_5numpy_float32_t __pyx_v_sigma2) {
5432   PyObject *__pyx_r = NULL;
5433   __Pyx_RefNannyDeclarations
5434   PyObject *__pyx_t_1 = NULL;
5435   int __pyx_lineno = 0;
5436   const char *__pyx_filename = NULL;
5437   int __pyx_clineno = 0;
5438   __Pyx_RefNannySetupContext("sarma_loglikeobs_fast", 0);
5439   __Pyx_XDECREF(__pyx_r);
5440   if (unlikely(!__pyx_v_endog.memview)) { __Pyx_RaiseUnboundLocalError("endog"); __PYX_ERR(0, 411, __pyx_L1_error) }
5441   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 411, __pyx_L1_error) }
5442   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 411, __pyx_L1_error) }
5443   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_loglikeobs_fast(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error)
5444   __Pyx_GOTREF(__pyx_t_1);
5445   __pyx_r = __pyx_t_1;
5446   __pyx_t_1 = 0;
5447   goto __pyx_L0;
5448 
5449   /* function exit code */
5450   __pyx_L1_error:;
5451   __Pyx_XDECREF(__pyx_t_1);
5452   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.sarma_loglikeobs_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
5453   __pyx_r = NULL;
5454   __pyx_L0:;
5455   __PYX_XDEC_MEMVIEW(&__pyx_v_endog, 1);
5456   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
5457   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
5458   __Pyx_XGIVEREF(__pyx_r);
5459   __Pyx_RefNannyFinishContext();
5460   return __pyx_r;
5461 }
5462 
5463 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":465
5464  *
5465  *
5466  * cdef dtoeplitz(int n, int offset0, int offset1,             # <<<<<<<<<<<<<<
5467  *                         cnp.float64_t [:] in_column,
5468  *                         cnp.float64_t [:, :] out_matrix):
5469  */
5470 
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_dtoeplitz(int __pyx_v_n,int __pyx_v_offset0,int __pyx_v_offset1,__Pyx_memviewslice __pyx_v_in_column,__Pyx_memviewslice __pyx_v_out_matrix)5471 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_dtoeplitz(int __pyx_v_n, int __pyx_v_offset0, int __pyx_v_offset1, __Pyx_memviewslice __pyx_v_in_column, __Pyx_memviewslice __pyx_v_out_matrix) {
5472   Py_ssize_t __pyx_v_i;
5473   Py_ssize_t __pyx_v_j;
5474   PyObject *__pyx_r = NULL;
5475   __Pyx_RefNannyDeclarations
5476   int __pyx_t_1;
5477   int __pyx_t_2;
5478   Py_ssize_t __pyx_t_3;
5479   Py_ssize_t __pyx_t_4;
5480   Py_ssize_t __pyx_t_5;
5481   Py_ssize_t __pyx_t_6;
5482   Py_ssize_t __pyx_t_7;
5483   Py_ssize_t __pyx_t_8;
5484   Py_ssize_t __pyx_t_9;
5485   int __pyx_t_10;
5486   __Pyx_RefNannySetupContext("dtoeplitz", 0);
5487 
5488   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":495
5489  *     cdef Py_ssize_t i, j
5490  *
5491  *     for i in range(n):             # <<<<<<<<<<<<<<
5492  *         for j in range(i + 1):
5493  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
5494  */
5495   __pyx_t_1 = __pyx_v_n;
5496   __pyx_t_2 = __pyx_t_1;
5497   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5498     __pyx_v_i = __pyx_t_3;
5499 
5500     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":496
5501  *
5502  *     for i in range(n):
5503  *         for j in range(i + 1):             # <<<<<<<<<<<<<<
5504  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
5505  *             if i != j:
5506  */
5507     __pyx_t_4 = (__pyx_v_i + 1);
5508     __pyx_t_5 = __pyx_t_4;
5509     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
5510       __pyx_v_j = __pyx_t_6;
5511 
5512       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":497
5513  *     for i in range(n):
5514  *         for j in range(i + 1):
5515  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]             # <<<<<<<<<<<<<<
5516  *             if i != j:
5517  *               # Note: scipy by default does complex conjugate, but not
5518  */
5519       __pyx_t_7 = (__pyx_v_i - __pyx_v_j);
5520       __pyx_t_8 = (__pyx_v_offset0 + __pyx_v_i);
5521       __pyx_t_9 = (__pyx_v_offset1 + __pyx_v_j);
5522       *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out_matrix.data + __pyx_t_8 * __pyx_v_out_matrix.strides[0]) ) + __pyx_t_9 * __pyx_v_out_matrix.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_in_column.data + __pyx_t_7 * __pyx_v_in_column.strides[0]) )));
5523 
5524       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":498
5525  *         for j in range(i + 1):
5526  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
5527  *             if i != j:             # <<<<<<<<<<<<<<
5528  *               # Note: scipy by default does complex conjugate, but not
5529  *               # necessary here since we're only dealing with covariances,
5530  */
5531       __pyx_t_10 = ((__pyx_v_i != __pyx_v_j) != 0);
5532       if (__pyx_t_10) {
5533 
5534         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":504
5535  *               # differentiation, but in that case we do not want to apply
5536  *               # the conjugation anyway)
5537  *               out_matrix[offset0 + j, offset1 + i] = in_column[i - j]             # <<<<<<<<<<<<<<
5538  *
5539  *
5540  */
5541         __pyx_t_7 = (__pyx_v_i - __pyx_v_j);
5542         __pyx_t_9 = (__pyx_v_offset0 + __pyx_v_j);
5543         __pyx_t_8 = (__pyx_v_offset1 + __pyx_v_i);
5544         *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out_matrix.data + __pyx_t_9 * __pyx_v_out_matrix.strides[0]) ) + __pyx_t_8 * __pyx_v_out_matrix.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_in_column.data + __pyx_t_7 * __pyx_v_in_column.strides[0]) )));
5545 
5546         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":498
5547  *         for j in range(i + 1):
5548  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
5549  *             if i != j:             # <<<<<<<<<<<<<<
5550  *               # Note: scipy by default does complex conjugate, but not
5551  *               # necessary here since we're only dealing with covariances,
5552  */
5553       }
5554     }
5555   }
5556 
5557   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":465
5558  *
5559  *
5560  * cdef dtoeplitz(int n, int offset0, int offset1,             # <<<<<<<<<<<<<<
5561  *                         cnp.float64_t [:] in_column,
5562  *                         cnp.float64_t [:, :] out_matrix):
5563  */
5564 
5565   /* function exit code */
5566   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5567   __Pyx_XGIVEREF(__pyx_r);
5568   __Pyx_RefNannyFinishContext();
5569   return __pyx_r;
5570 }
5571 
5572 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":507
5573  *
5574  *
5575  * cpdef darma_transformed_acovf_fast(cnp.float64_t [:] ar,             # <<<<<<<<<<<<<<
5576  *                                             cnp.float64_t [:] ma,
5577  *                                             cnp.float64_t [:] arma_acovf):
5578  */
5579 
5580 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_11darma_transformed_acovf_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_transformed_acovf_fast(__Pyx_memviewslice __pyx_v_ar,__Pyx_memviewslice __pyx_v_ma,__Pyx_memviewslice __pyx_v_arma_acovf,CYTHON_UNUSED int __pyx_skip_dispatch)5581 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_transformed_acovf_fast(__Pyx_memviewslice __pyx_v_ar, __Pyx_memviewslice __pyx_v_ma, __Pyx_memviewslice __pyx_v_arma_acovf, CYTHON_UNUSED int __pyx_skip_dispatch) {
5582   Py_ssize_t __pyx_v_nobs;
5583   Py_ssize_t __pyx_v_p;
5584   Py_ssize_t __pyx_v_q;
5585   Py_ssize_t __pyx_v_m;
5586   Py_ssize_t __pyx_v_m2;
5587   Py_ssize_t __pyx_v_n;
5588   Py_ssize_t __pyx_v_i;
5589   Py_ssize_t __pyx_v_j;
5590   Py_ssize_t __pyx_v_r;
5591   Py_ssize_t __pyx_v_tmp_ix;
5592   npy_intp __pyx_v_dim1[1];
5593   npy_intp __pyx_v_dim2[2];
5594   __Pyx_memviewslice __pyx_v_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
5595   __Pyx_memviewslice __pyx_v_acovf2 = { 0, 0, { 0 }, { 0 }, { 0 } };
5596   PyObject *__pyx_r = NULL;
5597   __Pyx_RefNannyDeclarations
5598   size_t __pyx_t_1;
5599   Py_ssize_t __pyx_t_2;
5600   Py_ssize_t __pyx_t_3;
5601   Py_ssize_t __pyx_t_4;
5602   PyObject *__pyx_t_5 = NULL;
5603   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
5604   long __pyx_t_7;
5605   __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
5606   int __pyx_t_9;
5607   Py_ssize_t __pyx_t_10;
5608   Py_ssize_t __pyx_t_11;
5609   Py_ssize_t __pyx_t_12;
5610   Py_ssize_t __pyx_t_13;
5611   Py_ssize_t __pyx_t_14;
5612   Py_ssize_t __pyx_t_15;
5613   Py_ssize_t __pyx_t_16;
5614   Py_ssize_t __pyx_t_17;
5615   Py_ssize_t __pyx_t_18;
5616   PyObject *__pyx_t_19 = NULL;
5617   Py_ssize_t __pyx_t_20;
5618   Py_ssize_t __pyx_t_21;
5619   Py_ssize_t __pyx_t_22;
5620   Py_ssize_t __pyx_t_23;
5621   int __pyx_t_24;
5622   __Pyx_memviewslice __pyx_t_25 = { 0, 0, { 0 }, { 0 }, { 0 } };
5623   PyObject *__pyx_t_26 = NULL;
5624   int __pyx_lineno = 0;
5625   const char *__pyx_filename = NULL;
5626   int __pyx_clineno = 0;
5627   __Pyx_RefNannySetupContext("darma_transformed_acovf_fast", 0);
5628 
5629   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":577
5630  *     cdef cnp.float64_t [:] acovf2
5631  *
5632  *     nobs = arma_acovf.shape[0]             # <<<<<<<<<<<<<<
5633  *     p = len(ar) - 1
5634  *     q = len(ma) - 1
5635  */
5636   __pyx_v_nobs = (__pyx_v_arma_acovf.shape[0]);
5637 
5638   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":578
5639  *
5640  *     nobs = arma_acovf.shape[0]
5641  *     p = len(ar) - 1             # <<<<<<<<<<<<<<
5642  *     q = len(ma) - 1
5643  *     m = max(p, q)
5644  */
5645   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar);
5646   __pyx_v_p = (__pyx_t_1 - 1);
5647 
5648   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":579
5649  *     nobs = arma_acovf.shape[0]
5650  *     p = len(ar) - 1
5651  *     q = len(ma) - 1             # <<<<<<<<<<<<<<
5652  *     m = max(p, q)
5653  *     m2 = 2 * m
5654  */
5655   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma);
5656   __pyx_v_q = (__pyx_t_1 - 1);
5657 
5658   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":580
5659  *     p = len(ar) - 1
5660  *     q = len(ma) - 1
5661  *     m = max(p, q)             # <<<<<<<<<<<<<<
5662  *     m2 = 2 * m
5663  *     n = min(m2, nobs)
5664  */
5665   __pyx_t_2 = __pyx_v_q;
5666   __pyx_t_3 = __pyx_v_p;
5667   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
5668     __pyx_t_4 = __pyx_t_2;
5669   } else {
5670     __pyx_t_4 = __pyx_t_3;
5671   }
5672   __pyx_v_m = __pyx_t_4;
5673 
5674   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":581
5675  *     q = len(ma) - 1
5676  *     m = max(p, q)
5677  *     m2 = 2 * m             # <<<<<<<<<<<<<<
5678  *     n = min(m2, nobs)
5679  *
5680  */
5681   __pyx_v_m2 = (2 * __pyx_v_m);
5682 
5683   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":582
5684  *     m = max(p, q)
5685  *     m2 = 2 * m
5686  *     n = min(m2, nobs)             # <<<<<<<<<<<<<<
5687  *
5688  *     dim2[0] = m2;
5689  */
5690   __pyx_t_4 = __pyx_v_nobs;
5691   __pyx_t_2 = __pyx_v_m2;
5692   if (((__pyx_t_4 < __pyx_t_2) != 0)) {
5693     __pyx_t_3 = __pyx_t_4;
5694   } else {
5695     __pyx_t_3 = __pyx_t_2;
5696   }
5697   __pyx_v_n = __pyx_t_3;
5698 
5699   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":584
5700  *     n = min(m2, nobs)
5701  *
5702  *     dim2[0] = m2;             # <<<<<<<<<<<<<<
5703  *     dim2[1] = m2;
5704  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT64, C)
5705  */
5706   (__pyx_v_dim2[0]) = __pyx_v_m2;
5707 
5708   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":585
5709  *
5710  *     dim2[0] = m2;
5711  *     dim2[1] = m2;             # <<<<<<<<<<<<<<
5712  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT64, C)
5713  *     dim1[0] = max(nobs - m, 0);
5714  */
5715   (__pyx_v_dim2[1]) = __pyx_v_m2;
5716 
5717   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":586
5718  *     dim2[0] = m2;
5719  *     dim2[1] = m2;
5720  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT64, C)             # <<<<<<<<<<<<<<
5721  *     dim1[0] = max(nobs - m, 0);
5722  *     acovf2 = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
5723  */
5724   __pyx_t_5 = PyArray_ZEROS(2, __pyx_v_dim2, NPY_FLOAT64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 586, __pyx_L1_error)
5725   __Pyx_GOTREF(__pyx_t_5);
5726   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 586, __pyx_L1_error)
5727   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5728   __pyx_v_acovf = __pyx_t_6;
5729   __pyx_t_6.memview = NULL;
5730   __pyx_t_6.data = NULL;
5731 
5732   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":587
5733  *     dim2[1] = m2;
5734  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT64, C)
5735  *     dim1[0] = max(nobs - m, 0);             # <<<<<<<<<<<<<<
5736  *     acovf2 = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
5737  *
5738  */
5739   __pyx_t_7 = 0;
5740   __pyx_t_3 = (__pyx_v_nobs - __pyx_v_m);
5741   if (((__pyx_t_7 > __pyx_t_3) != 0)) {
5742     __pyx_t_4 = __pyx_t_7;
5743   } else {
5744     __pyx_t_4 = __pyx_t_3;
5745   }
5746   (__pyx_v_dim1[0]) = __pyx_t_4;
5747 
5748   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":588
5749  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT64, C)
5750  *     dim1[0] = max(nobs - m, 0);
5751  *     acovf2 = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)             # <<<<<<<<<<<<<<
5752  *
5753  *     # Set i, j = 1, ..., m   (which is then done)
5754  */
5755   __pyx_t_5 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_FLOAT64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 588, __pyx_L1_error)
5756   __Pyx_GOTREF(__pyx_t_5);
5757   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 588, __pyx_L1_error)
5758   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5759   __pyx_v_acovf2 = __pyx_t_8;
5760   __pyx_t_8.memview = NULL;
5761   __pyx_t_8.data = NULL;
5762 
5763   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":591
5764  *
5765  *     # Set i, j = 1, ..., m   (which is then done)
5766  *     dtoeplitz(m, 0, 0, arma_acovf, acovf)             # <<<<<<<<<<<<<<
5767  *
5768  *     # Set i = 1, ..., m;         j = m + 1, ..., 2 m
5769  */
5770   __pyx_t_5 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_dtoeplitz(__pyx_v_m, 0, 0, __pyx_v_arma_acovf, __pyx_v_acovf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 591, __pyx_L1_error)
5771   __Pyx_GOTREF(__pyx_t_5);
5772   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5773 
5774   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":595
5775  *     # Set i = 1, ..., m;         j = m + 1, ..., 2 m
5776  *     # and i = m + 1, ..., 2 m;   j = 1, ..., m
5777  *     if nobs > m:             # <<<<<<<<<<<<<<
5778  *         for j in range(m):
5779  *             for i in range(m, m2):
5780  */
5781   __pyx_t_9 = ((__pyx_v_nobs > __pyx_v_m) != 0);
5782   if (__pyx_t_9) {
5783 
5784     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":596
5785  *     # and i = m + 1, ..., 2 m;   j = 1, ..., m
5786  *     if nobs > m:
5787  *         for j in range(m):             # <<<<<<<<<<<<<<
5788  *             for i in range(m, m2):
5789  *                 acovf[i, j] = arma_acovf[i - j]
5790  */
5791     __pyx_t_4 = __pyx_v_m;
5792     __pyx_t_3 = __pyx_t_4;
5793     for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2+=1) {
5794       __pyx_v_j = __pyx_t_2;
5795 
5796       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":597
5797  *     if nobs > m:
5798  *         for j in range(m):
5799  *             for i in range(m, m2):             # <<<<<<<<<<<<<<
5800  *                 acovf[i, j] = arma_acovf[i - j]
5801  *                 for r in range(1, p + 1):
5802  */
5803       __pyx_t_10 = __pyx_v_m2;
5804       __pyx_t_11 = __pyx_t_10;
5805       for (__pyx_t_12 = __pyx_v_m; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
5806         __pyx_v_i = __pyx_t_12;
5807 
5808         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":598
5809  *         for j in range(m):
5810  *             for i in range(m, m2):
5811  *                 acovf[i, j] = arma_acovf[i - j]             # <<<<<<<<<<<<<<
5812  *                 for r in range(1, p + 1):
5813  *                     tmp_ix = abs(r - (i - j))
5814  */
5815         __pyx_t_13 = (__pyx_v_i - __pyx_v_j);
5816         __pyx_t_14 = __pyx_v_i;
5817         __pyx_t_15 = __pyx_v_j;
5818         *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_14 * __pyx_v_acovf.strides[0]) ) + __pyx_t_15 * __pyx_v_acovf.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_arma_acovf.data + __pyx_t_13 * __pyx_v_arma_acovf.strides[0]) )));
5819 
5820         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":599
5821  *             for i in range(m, m2):
5822  *                 acovf[i, j] = arma_acovf[i - j]
5823  *                 for r in range(1, p + 1):             # <<<<<<<<<<<<<<
5824  *                     tmp_ix = abs(r - (i - j))
5825  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])
5826  */
5827         __pyx_t_16 = (__pyx_v_p + 1);
5828         __pyx_t_17 = __pyx_t_16;
5829         for (__pyx_t_18 = 1; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
5830           __pyx_v_r = __pyx_t_18;
5831 
5832           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":600
5833  *                 acovf[i, j] = arma_acovf[i - j]
5834  *                 for r in range(1, p + 1):
5835  *                     tmp_ix = abs(r - (i - j))             # <<<<<<<<<<<<<<
5836  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])
5837  *         acovf[:m, m:m2] = acovf[m:m2, :m].T
5838  */
5839           __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_r - (__pyx_v_i - __pyx_v_j))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 600, __pyx_L1_error)
5840           __Pyx_GOTREF(__pyx_t_5);
5841           __pyx_t_19 = __Pyx_PyNumber_Absolute(__pyx_t_5); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 600, __pyx_L1_error)
5842           __Pyx_GOTREF(__pyx_t_19);
5843           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5844           __pyx_t_20 = __Pyx_PyIndex_AsSsize_t(__pyx_t_19); if (unlikely((__pyx_t_20 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 600, __pyx_L1_error)
5845           __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5846           __pyx_v_tmp_ix = __pyx_t_20;
5847 
5848           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":601
5849  *                 for r in range(1, p + 1):
5850  *                     tmp_ix = abs(r - (i - j))
5851  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])             # <<<<<<<<<<<<<<
5852  *         acovf[:m, m:m2] = acovf[m:m2, :m].T
5853  *
5854  */
5855           __pyx_t_13 = __pyx_v_i;
5856           __pyx_t_15 = __pyx_v_j;
5857           __pyx_t_14 = __pyx_v_r;
5858           __pyx_t_21 = __pyx_v_tmp_ix;
5859           __pyx_t_22 = __pyx_v_i;
5860           __pyx_t_23 = __pyx_v_j;
5861           *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_22 * __pyx_v_acovf.strides[0]) ) + __pyx_t_23 * __pyx_v_acovf.strides[1]) )) = ((*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_13 * __pyx_v_acovf.strides[0]) ) + __pyx_t_15 * __pyx_v_acovf.strides[1]) ))) - ((-(*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_ar.data + __pyx_t_14 * __pyx_v_ar.strides[0]) )))) * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_arma_acovf.data + __pyx_t_21 * __pyx_v_arma_acovf.strides[0]) )))));
5862         }
5863       }
5864     }
5865 
5866     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":602
5867  *                     tmp_ix = abs(r - (i - j))
5868  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])
5869  *         acovf[:m, m:m2] = acovf[m:m2, :m].T             # <<<<<<<<<<<<<<
5870  *
5871  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
5872  */
5873     __pyx_t_6.data = __pyx_v_acovf.data;
5874     __pyx_t_6.memview = __pyx_v_acovf.memview;
5875     __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
5876     __pyx_t_24 = -1;
5877     if (unlikely(__pyx_memoryview_slice_memviewslice(
5878     &__pyx_t_6,
5879     __pyx_v_acovf.shape[0], __pyx_v_acovf.strides[0], __pyx_v_acovf.suboffsets[0],
5880     0,
5881     0,
5882     &__pyx_t_24,
5883     __pyx_v_m,
5884     __pyx_v_m2,
5885     0,
5886     1,
5887     1,
5888     0,
5889     1) < 0))
5890 {
5891     __PYX_ERR(0, 602, __pyx_L1_error)
5892 }
5893 
5894 if (unlikely(__pyx_memoryview_slice_memviewslice(
5895     &__pyx_t_6,
5896     __pyx_v_acovf.shape[1], __pyx_v_acovf.strides[1], __pyx_v_acovf.suboffsets[1],
5897     1,
5898     1,
5899     &__pyx_t_24,
5900     0,
5901     __pyx_v_m,
5902     0,
5903     0,
5904     1,
5905     0,
5906     1) < 0))
5907 {
5908     __PYX_ERR(0, 602, __pyx_L1_error)
5909 }
5910 
5911 __pyx_t_25 = __pyx_t_6;
5912     __PYX_INC_MEMVIEW(&__pyx_t_25, 1);
5913     if (unlikely(__pyx_memslice_transpose(&__pyx_t_25) == 0)) __PYX_ERR(0, 602, __pyx_L1_error)
5914     __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
5915     __pyx_t_6.memview = NULL;
5916     __pyx_t_6.data = NULL;
5917     __pyx_t_6.data = __pyx_v_acovf.data;
5918     __pyx_t_6.memview = __pyx_v_acovf.memview;
5919     __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
5920     __pyx_t_24 = -1;
5921     if (unlikely(__pyx_memoryview_slice_memviewslice(
5922     &__pyx_t_6,
5923     __pyx_v_acovf.shape[0], __pyx_v_acovf.strides[0], __pyx_v_acovf.suboffsets[0],
5924     0,
5925     0,
5926     &__pyx_t_24,
5927     0,
5928     __pyx_v_m,
5929     0,
5930     0,
5931     1,
5932     0,
5933     1) < 0))
5934 {
5935     __PYX_ERR(0, 602, __pyx_L1_error)
5936 }
5937 
5938 if (unlikely(__pyx_memoryview_slice_memviewslice(
5939     &__pyx_t_6,
5940     __pyx_v_acovf.shape[1], __pyx_v_acovf.strides[1], __pyx_v_acovf.suboffsets[1],
5941     1,
5942     1,
5943     &__pyx_t_24,
5944     __pyx_v_m,
5945     __pyx_v_m2,
5946     0,
5947     1,
5948     1,
5949     0,
5950     1) < 0))
5951 {
5952     __PYX_ERR(0, 602, __pyx_L1_error)
5953 }
5954 
5955 if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_25, __pyx_t_6, 2, 2, 0) < 0)) __PYX_ERR(0, 602, __pyx_L1_error)
5956     __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
5957     __pyx_t_6.memview = NULL;
5958     __pyx_t_6.data = NULL;
5959     __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
5960     __pyx_t_25.memview = NULL;
5961     __pyx_t_25.data = NULL;
5962 
5963     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":595
5964  *     # Set i = 1, ..., m;         j = m + 1, ..., 2 m
5965  *     # and i = m + 1, ..., 2 m;   j = 1, ..., m
5966  *     if nobs > m:             # <<<<<<<<<<<<<<
5967  *         for j in range(m):
5968  *             for i in range(m, m2):
5969  */
5970   }
5971 
5972   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":605
5973  *
5974  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
5975  *     if nobs > m:             # <<<<<<<<<<<<<<
5976  *         for i in range(nobs - m):
5977  *             for r in range(q + 1 - i):
5978  */
5979   __pyx_t_9 = ((__pyx_v_nobs > __pyx_v_m) != 0);
5980   if (__pyx_t_9) {
5981 
5982     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":606
5983  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
5984  *     if nobs > m:
5985  *         for i in range(nobs - m):             # <<<<<<<<<<<<<<
5986  *             for r in range(q + 1 - i):
5987  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]
5988  */
5989     __pyx_t_4 = (__pyx_v_nobs - __pyx_v_m);
5990     __pyx_t_3 = __pyx_t_4;
5991     for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2+=1) {
5992       __pyx_v_i = __pyx_t_2;
5993 
5994       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":607
5995  *     if nobs > m:
5996  *         for i in range(nobs - m):
5997  *             for r in range(q + 1 - i):             # <<<<<<<<<<<<<<
5998  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]
5999  *
6000  */
6001       __pyx_t_10 = ((__pyx_v_q + 1) - __pyx_v_i);
6002       __pyx_t_11 = __pyx_t_10;
6003       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
6004         __pyx_v_r = __pyx_t_12;
6005 
6006         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":608
6007  *         for i in range(nobs - m):
6008  *             for r in range(q + 1 - i):
6009  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]             # <<<<<<<<<<<<<<
6010  *
6011  *     return acovf[:n, :n], acovf2
6012  */
6013         __pyx_t_21 = __pyx_v_i;
6014         __pyx_t_14 = __pyx_v_r;
6015         __pyx_t_15 = (__pyx_v_r + __pyx_v_i);
6016         __pyx_t_13 = __pyx_v_i;
6017         *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_13 * __pyx_v_acovf2.strides[0]) )) = ((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_21 * __pyx_v_acovf2.strides[0]) ))) + ((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_ma.data + __pyx_t_14 * __pyx_v_ma.strides[0]) ))) * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_ma.data + __pyx_t_15 * __pyx_v_ma.strides[0]) )))));
6018       }
6019     }
6020 
6021     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":605
6022  *
6023  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
6024  *     if nobs > m:             # <<<<<<<<<<<<<<
6025  *         for i in range(nobs - m):
6026  *             for r in range(q + 1 - i):
6027  */
6028   }
6029 
6030   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":610
6031  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]
6032  *
6033  *     return acovf[:n, :n], acovf2             # <<<<<<<<<<<<<<
6034  *
6035  *
6036  */
6037   __Pyx_XDECREF(__pyx_r);
6038   __pyx_t_25.data = __pyx_v_acovf.data;
6039   __pyx_t_25.memview = __pyx_v_acovf.memview;
6040   __PYX_INC_MEMVIEW(&__pyx_t_25, 0);
6041   __pyx_t_24 = -1;
6042   if (unlikely(__pyx_memoryview_slice_memviewslice(
6043     &__pyx_t_25,
6044     __pyx_v_acovf.shape[0], __pyx_v_acovf.strides[0], __pyx_v_acovf.suboffsets[0],
6045     0,
6046     0,
6047     &__pyx_t_24,
6048     0,
6049     __pyx_v_n,
6050     0,
6051     0,
6052     1,
6053     0,
6054     1) < 0))
6055 {
6056     __PYX_ERR(0, 610, __pyx_L1_error)
6057 }
6058 
6059 if (unlikely(__pyx_memoryview_slice_memviewslice(
6060     &__pyx_t_25,
6061     __pyx_v_acovf.shape[1], __pyx_v_acovf.strides[1], __pyx_v_acovf.suboffsets[1],
6062     1,
6063     1,
6064     &__pyx_t_24,
6065     0,
6066     __pyx_v_n,
6067     0,
6068     0,
6069     1,
6070     0,
6071     1) < 0))
6072 {
6073     __PYX_ERR(0, 610, __pyx_L1_error)
6074 }
6075 
6076 __pyx_t_19 = __pyx_memoryview_fromslice(__pyx_t_25, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 610, __pyx_L1_error)
6077   __Pyx_GOTREF(__pyx_t_19);
6078   __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
6079   __pyx_t_25.memview = NULL;
6080   __pyx_t_25.data = NULL;
6081   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_acovf2, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 610, __pyx_L1_error)
6082   __Pyx_GOTREF(__pyx_t_5);
6083   __pyx_t_26 = PyTuple_New(2); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 610, __pyx_L1_error)
6084   __Pyx_GOTREF(__pyx_t_26);
6085   __Pyx_GIVEREF(__pyx_t_19);
6086   PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_19);
6087   __Pyx_GIVEREF(__pyx_t_5);
6088   PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_5);
6089   __pyx_t_19 = 0;
6090   __pyx_t_5 = 0;
6091   __pyx_r = __pyx_t_26;
6092   __pyx_t_26 = 0;
6093   goto __pyx_L0;
6094 
6095   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":507
6096  *
6097  *
6098  * cpdef darma_transformed_acovf_fast(cnp.float64_t [:] ar,             # <<<<<<<<<<<<<<
6099  *                                             cnp.float64_t [:] ma,
6100  *                                             cnp.float64_t [:] arma_acovf):
6101  */
6102 
6103   /* function exit code */
6104   __pyx_L1_error:;
6105   __Pyx_XDECREF(__pyx_t_5);
6106   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
6107   __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
6108   __Pyx_XDECREF(__pyx_t_19);
6109   __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
6110   __Pyx_XDECREF(__pyx_t_26);
6111   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_transformed_acovf_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
6112   __pyx_r = 0;
6113   __pyx_L0:;
6114   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf, 1);
6115   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf2, 1);
6116   __Pyx_XGIVEREF(__pyx_r);
6117   __Pyx_RefNannyFinishContext();
6118   return __pyx_r;
6119 }
6120 
6121 /* Python wrapper */
6122 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_11darma_transformed_acovf_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6123 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_10darma_transformed_acovf_fast[] = "\n    arma_transformed_acovf_fast(cnp.float64_t [:] ar, cnp.float64_t [:] ma, cnp.float64_t [:] arma_acovf)\n    \n    Quickly construct the autocovariance matrix for a transformed process.\n\n    Using the autocovariance function for an ARMA process, constructs the\n    autocovariances associated with the transformed process described\n    in equation (3.3.1) of _[1] in a memory efficient, and so fast, way.\n\n    Parameters\n    ----------\n    ar : ndarray\n        Autoregressive coefficients, including the zero lag, where the sign\n        convention assumes the coefficients are part of the lag polynomial on\n        the left-hand-side of the ARMA definition (i.e. they have the opposite\n        sign from the usual econometrics convention in which the coefficients\n        are on the right-hand-side of the ARMA definition).\n    ma : ndarray\n        Moving average coefficients, including the zero lag, where the sign\n        convention assumes the coefficients are part of the lag polynomial on\n        the right-hand-side of the ARMA definition (i.e. they have the same\n        sign from the usual econometrics convention in which the coefficients\n        are on the right-hand-side of the ARMA definition).\n    arma_acovf : ndarray\n        The vector of autocovariances of the ARMA process.\n\n    Returns\n    -------\n    acovf : ndarray\n        A matrix containing the autocovariances of the portion of the\n        transformed process with time-varying autocovariances. Its dimension\n        is equal to `min(m * 2, n)` where `m = max(len(ar) - 1, len(ma) - 1)`\n        and `n` is the length of the input array `arma_acovf`. It is important\n        to note that only the values in the first `m` columns or `m` rows are\n        valid. In particular, the entries in the block `acovf[m:, m:]` should\n        not be used in any case (and in fact will always be equal to zeros).\n    acovf2 : ndarray\n        An array containing the autocovariance function of the port""ion of the\n        transformed process with time-invariant autocovariances. Its dimension\n        is equal to `max(n - m, 0)` where `n` is the length of the input\n        array `arma_acovf`.\n\n    Notes\n    -----\n    The definition of this autocovariance matrix is from _[1] equation 3.3.3.\n\n    This function assumes that the variance of the ARMA innovation term is\n    equal to one. If this is not true, then the calling program should replace\n    `arma_acovf` with `arma_acovf / sigma2`, where sigma2 is that variance.\n\n    This function is relatively fast even when `arma_acovf` is large, since\n    it only constructs the full autocovariance matrix for a generally small\n    subset of observations. The trade-off is that the output of this function\n    is somewhat more difficult to use.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_11darma_transformed_acovf_fast(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6124 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_11darma_transformed_acovf_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6125   __Pyx_memviewslice __pyx_v_ar = { 0, 0, { 0 }, { 0 }, { 0 } };
6126   __Pyx_memviewslice __pyx_v_ma = { 0, 0, { 0 }, { 0 }, { 0 } };
6127   __Pyx_memviewslice __pyx_v_arma_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
6128   int __pyx_lineno = 0;
6129   const char *__pyx_filename = NULL;
6130   int __pyx_clineno = 0;
6131   PyObject *__pyx_r = 0;
6132   __Pyx_RefNannyDeclarations
6133   __Pyx_RefNannySetupContext("darma_transformed_acovf_fast (wrapper)", 0);
6134   {
6135     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ar,&__pyx_n_s_ma,&__pyx_n_s_arma_acovf,0};
6136     PyObject* values[3] = {0,0,0};
6137     if (unlikely(__pyx_kwds)) {
6138       Py_ssize_t kw_args;
6139       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6140       switch (pos_args) {
6141         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6142         CYTHON_FALLTHROUGH;
6143         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6144         CYTHON_FALLTHROUGH;
6145         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6146         CYTHON_FALLTHROUGH;
6147         case  0: break;
6148         default: goto __pyx_L5_argtuple_error;
6149       }
6150       kw_args = PyDict_Size(__pyx_kwds);
6151       switch (pos_args) {
6152         case  0:
6153         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar)) != 0)) kw_args--;
6154         else goto __pyx_L5_argtuple_error;
6155         CYTHON_FALLTHROUGH;
6156         case  1:
6157         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma)) != 0)) kw_args--;
6158         else {
6159           __Pyx_RaiseArgtupleInvalid("darma_transformed_acovf_fast", 1, 3, 3, 1); __PYX_ERR(0, 507, __pyx_L3_error)
6160         }
6161         CYTHON_FALLTHROUGH;
6162         case  2:
6163         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arma_acovf)) != 0)) kw_args--;
6164         else {
6165           __Pyx_RaiseArgtupleInvalid("darma_transformed_acovf_fast", 1, 3, 3, 2); __PYX_ERR(0, 507, __pyx_L3_error)
6166         }
6167       }
6168       if (unlikely(kw_args > 0)) {
6169         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "darma_transformed_acovf_fast") < 0)) __PYX_ERR(0, 507, __pyx_L3_error)
6170       }
6171     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
6172       goto __pyx_L5_argtuple_error;
6173     } else {
6174       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6175       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6176       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6177     }
6178     __pyx_v_ar = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar.memview)) __PYX_ERR(0, 507, __pyx_L3_error)
6179     __pyx_v_ma = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma.memview)) __PYX_ERR(0, 508, __pyx_L3_error)
6180     __pyx_v_arma_acovf = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_arma_acovf.memview)) __PYX_ERR(0, 509, __pyx_L3_error)
6181   }
6182   goto __pyx_L4_argument_unpacking_done;
6183   __pyx_L5_argtuple_error:;
6184   __Pyx_RaiseArgtupleInvalid("darma_transformed_acovf_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 507, __pyx_L3_error)
6185   __pyx_L3_error:;
6186   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_transformed_acovf_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
6187   __Pyx_RefNannyFinishContext();
6188   return NULL;
6189   __pyx_L4_argument_unpacking_done:;
6190   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_10darma_transformed_acovf_fast(__pyx_self, __pyx_v_ar, __pyx_v_ma, __pyx_v_arma_acovf);
6191 
6192   /* function exit code */
6193   __Pyx_RefNannyFinishContext();
6194   return __pyx_r;
6195 }
6196 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_10darma_transformed_acovf_fast(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_ar,__Pyx_memviewslice __pyx_v_ma,__Pyx_memviewslice __pyx_v_arma_acovf)6197 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_10darma_transformed_acovf_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ar, __Pyx_memviewslice __pyx_v_ma, __Pyx_memviewslice __pyx_v_arma_acovf) {
6198   PyObject *__pyx_r = NULL;
6199   __Pyx_RefNannyDeclarations
6200   PyObject *__pyx_t_1 = NULL;
6201   int __pyx_lineno = 0;
6202   const char *__pyx_filename = NULL;
6203   int __pyx_clineno = 0;
6204   __Pyx_RefNannySetupContext("darma_transformed_acovf_fast", 0);
6205   __Pyx_XDECREF(__pyx_r);
6206   if (unlikely(!__pyx_v_ar.memview)) { __Pyx_RaiseUnboundLocalError("ar"); __PYX_ERR(0, 507, __pyx_L1_error) }
6207   if (unlikely(!__pyx_v_ma.memview)) { __Pyx_RaiseUnboundLocalError("ma"); __PYX_ERR(0, 507, __pyx_L1_error) }
6208   if (unlikely(!__pyx_v_arma_acovf.memview)) { __Pyx_RaiseUnboundLocalError("arma_acovf"); __PYX_ERR(0, 507, __pyx_L1_error) }
6209   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_transformed_acovf_fast(__pyx_v_ar, __pyx_v_ma, __pyx_v_arma_acovf, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error)
6210   __Pyx_GOTREF(__pyx_t_1);
6211   __pyx_r = __pyx_t_1;
6212   __pyx_t_1 = 0;
6213   goto __pyx_L0;
6214 
6215   /* function exit code */
6216   __pyx_L1_error:;
6217   __Pyx_XDECREF(__pyx_t_1);
6218   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_transformed_acovf_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
6219   __pyx_r = NULL;
6220   __pyx_L0:;
6221   __PYX_XDEC_MEMVIEW(&__pyx_v_ar, 1);
6222   __PYX_XDEC_MEMVIEW(&__pyx_v_ma, 1);
6223   __PYX_XDEC_MEMVIEW(&__pyx_v_arma_acovf, 1);
6224   __Pyx_XGIVEREF(__pyx_r);
6225   __Pyx_RefNannyFinishContext();
6226   return __pyx_r;
6227 }
6228 
6229 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":613
6230  *
6231  *
6232  * cpdef darma_innovations_algo_fast(int nobs,             # <<<<<<<<<<<<<<
6233  *                                            cnp.float64_t [:] ar_params,
6234  *                                            cnp.float64_t [:] ma_params,
6235  */
6236 
6237 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_13darma_innovations_algo_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations_algo_fast(int __pyx_v_nobs,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_acovf,__Pyx_memviewslice __pyx_v_acovf2,CYTHON_UNUSED int __pyx_skip_dispatch)6238 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations_algo_fast(int __pyx_v_nobs, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_acovf, __Pyx_memviewslice __pyx_v_acovf2, CYTHON_UNUSED int __pyx_skip_dispatch) {
6239   Py_ssize_t __pyx_v_i;
6240   Py_ssize_t __pyx_v_j;
6241   Py_ssize_t __pyx_v_k;
6242   Py_ssize_t __pyx_v_n;
6243   Py_ssize_t __pyx_v__n;
6244   Py_ssize_t __pyx_v_m;
6245   Py_ssize_t __pyx_v_m2;
6246   Py_ssize_t __pyx_v_p;
6247   Py_ssize_t __pyx_v_q;
6248   Py_ssize_t __pyx_v_start;
6249   Py_ssize_t __pyx_v_start2;
6250   npy_intp __pyx_v_dim1[1];
6251   npy_intp __pyx_v_dim2[2];
6252   __Pyx_memviewslice __pyx_v_theta = { 0, 0, { 0 }, { 0 }, { 0 } };
6253   __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
6254   PyObject *__pyx_r = NULL;
6255   __Pyx_RefNannyDeclarations
6256   size_t __pyx_t_1;
6257   Py_ssize_t __pyx_t_2;
6258   Py_ssize_t __pyx_t_3;
6259   Py_ssize_t __pyx_t_4;
6260   PyObject *__pyx_t_5 = NULL;
6261   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
6262   __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
6263   int __pyx_t_8;
6264   Py_ssize_t __pyx_t_9;
6265   Py_ssize_t __pyx_t_10;
6266   Py_ssize_t __pyx_t_11;
6267   long __pyx_t_12;
6268   long __pyx_t_13;
6269   Py_ssize_t __pyx_t_14;
6270   int __pyx_t_15;
6271   Py_ssize_t __pyx_t_16;
6272   Py_ssize_t __pyx_t_17;
6273   Py_ssize_t __pyx_t_18;
6274   Py_ssize_t __pyx_t_19;
6275   Py_ssize_t __pyx_t_20;
6276   Py_ssize_t __pyx_t_21;
6277   Py_ssize_t __pyx_t_22;
6278   Py_ssize_t __pyx_t_23;
6279   Py_ssize_t __pyx_t_24;
6280   __pyx_t_5numpy_float64_t __pyx_t_25;
6281   __pyx_t_5numpy_float64_t __pyx_t_26;
6282   long __pyx_t_27;
6283   PyObject *__pyx_t_28 = NULL;
6284   PyObject *__pyx_t_29 = NULL;
6285   int __pyx_lineno = 0;
6286   const char *__pyx_filename = NULL;
6287   int __pyx_clineno = 0;
6288   __Pyx_RefNannySetupContext("darma_innovations_algo_fast", 0);
6289 
6290   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":667
6291  *     cdef cnp.float64_t [:] v
6292  *
6293  *     p = len(ar_params)             # <<<<<<<<<<<<<<
6294  *     q = len(ma_params)
6295  *     m = max(p, q)
6296  */
6297   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
6298   __pyx_v_p = __pyx_t_1;
6299 
6300   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":668
6301  *
6302  *     p = len(ar_params)
6303  *     q = len(ma_params)             # <<<<<<<<<<<<<<
6304  *     m = max(p, q)
6305  *     m2 = 2 * m
6306  */
6307   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma_params);
6308   __pyx_v_q = __pyx_t_1;
6309 
6310   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":669
6311  *     p = len(ar_params)
6312  *     q = len(ma_params)
6313  *     m = max(p, q)             # <<<<<<<<<<<<<<
6314  *     m2 = 2 * m
6315  *
6316  */
6317   __pyx_t_2 = __pyx_v_q;
6318   __pyx_t_3 = __pyx_v_p;
6319   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
6320     __pyx_t_4 = __pyx_t_2;
6321   } else {
6322     __pyx_t_4 = __pyx_t_3;
6323   }
6324   __pyx_v_m = __pyx_t_4;
6325 
6326   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":670
6327  *     q = len(ma_params)
6328  *     m = max(p, q)
6329  *     m2 = 2 * m             # <<<<<<<<<<<<<<
6330  *
6331  *     dim1[0] = nobs;
6332  */
6333   __pyx_v_m2 = (2 * __pyx_v_m);
6334 
6335   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":672
6336  *     m2 = 2 * m
6337  *
6338  *     dim1[0] = nobs;             # <<<<<<<<<<<<<<
6339  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
6340  *     dim2[0] = nobs;
6341  */
6342   (__pyx_v_dim1[0]) = __pyx_v_nobs;
6343 
6344   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":673
6345  *
6346  *     dim1[0] = nobs;
6347  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)             # <<<<<<<<<<<<<<
6348  *     dim2[0] = nobs;
6349  *     dim2[1] = m + 1;
6350  */
6351   __pyx_t_5 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_FLOAT64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 673, __pyx_L1_error)
6352   __Pyx_GOTREF(__pyx_t_5);
6353   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 673, __pyx_L1_error)
6354   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6355   __pyx_v_v = __pyx_t_6;
6356   __pyx_t_6.memview = NULL;
6357   __pyx_t_6.data = NULL;
6358 
6359   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":674
6360  *     dim1[0] = nobs;
6361  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
6362  *     dim2[0] = nobs;             # <<<<<<<<<<<<<<
6363  *     dim2[1] = m + 1;
6364  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT64, C)
6365  */
6366   (__pyx_v_dim2[0]) = __pyx_v_nobs;
6367 
6368   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":675
6369  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
6370  *     dim2[0] = nobs;
6371  *     dim2[1] = m + 1;             # <<<<<<<<<<<<<<
6372  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT64, C)
6373  *
6374  */
6375   (__pyx_v_dim2[1]) = (__pyx_v_m + 1);
6376 
6377   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":676
6378  *     dim2[0] = nobs;
6379  *     dim2[1] = m + 1;
6380  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT64, C)             # <<<<<<<<<<<<<<
6381  *
6382  *     if m > 0:
6383  */
6384   __pyx_t_5 = PyArray_ZEROS(2, __pyx_v_dim2, NPY_FLOAT64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 676, __pyx_L1_error)
6385   __Pyx_GOTREF(__pyx_t_5);
6386   __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 676, __pyx_L1_error)
6387   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6388   __pyx_v_theta = __pyx_t_7;
6389   __pyx_t_7.memview = NULL;
6390   __pyx_t_7.data = NULL;
6391 
6392   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":678
6393  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT64, C)
6394  *
6395  *     if m > 0:             # <<<<<<<<<<<<<<
6396  *         v[0] = acovf[0, 0]
6397  *     else:
6398  */
6399   __pyx_t_8 = ((__pyx_v_m > 0) != 0);
6400   if (__pyx_t_8) {
6401 
6402     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":679
6403  *
6404  *     if m > 0:
6405  *         v[0] = acovf[0, 0]             # <<<<<<<<<<<<<<
6406  *     else:
6407  *         # (handle the corner case where p = q = 0)
6408  */
6409     __pyx_t_9 = 0;
6410     __pyx_t_10 = 0;
6411     __pyx_t_11 = 0;
6412     *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_11 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_9 * __pyx_v_acovf.strides[0]) ) + __pyx_t_10 * __pyx_v_acovf.strides[1]) )));
6413 
6414     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":678
6415  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_FLOAT64, C)
6416  *
6417  *     if m > 0:             # <<<<<<<<<<<<<<
6418  *         v[0] = acovf[0, 0]
6419  *     else:
6420  */
6421     goto __pyx_L3;
6422   }
6423 
6424   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":682
6425  *     else:
6426  *         # (handle the corner case where p = q = 0)
6427  *         v[0] = acovf2[0]             # <<<<<<<<<<<<<<
6428  *
6429  *     for n in range(nobs - 1):
6430  */
6431   /*else*/ {
6432     __pyx_t_10 = 0;
6433     __pyx_t_9 = 0;
6434     *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_9 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_10 * __pyx_v_acovf2.strides[0]) )));
6435   }
6436   __pyx_L3:;
6437 
6438   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":684
6439  *         v[0] = acovf2[0]
6440  *
6441  *     for n in range(nobs - 1):             # <<<<<<<<<<<<<<
6442  *         _n = n + 1
6443  *
6444  */
6445   __pyx_t_12 = (__pyx_v_nobs - 1);
6446   __pyx_t_13 = __pyx_t_12;
6447   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_13; __pyx_t_4+=1) {
6448     __pyx_v_n = __pyx_t_4;
6449 
6450     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":685
6451  *
6452  *     for n in range(nobs - 1):
6453  *         _n = n + 1             # <<<<<<<<<<<<<<
6454  *
6455  *         start = 0 if n < m else n + 1 - q
6456  */
6457     __pyx_v__n = (__pyx_v_n + 1);
6458 
6459     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":687
6460  *         _n = n + 1
6461  *
6462  *         start = 0 if n < m else n + 1 - q             # <<<<<<<<<<<<<<
6463  *         for k in range(start, n + 1):
6464  *             # See Brockwell and Davis, p. 100-101
6465  */
6466     if (((__pyx_v_n < __pyx_v_m) != 0)) {
6467       __pyx_t_2 = 0;
6468     } else {
6469       __pyx_t_2 = ((__pyx_v_n + 1) - __pyx_v_q);
6470     }
6471     __pyx_v_start = __pyx_t_2;
6472 
6473     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":688
6474  *
6475  *         start = 0 if n < m else n + 1 - q
6476  *         for k in range(start, n + 1):             # <<<<<<<<<<<<<<
6477  *             # See Brockwell and Davis, p. 100-101
6478  *             # (here we have weak rather than strict inequality due to Python's
6479  */
6480     __pyx_t_2 = (__pyx_v_n + 1);
6481     __pyx_t_3 = __pyx_t_2;
6482     for (__pyx_t_14 = __pyx_v_start; __pyx_t_14 < __pyx_t_3; __pyx_t_14+=1) {
6483       __pyx_v_k = __pyx_t_14;
6484 
6485       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":692
6486  *             # (here we have weak rather than strict inequality due to Python's
6487  *             # zero indexing)
6488  *             if n >= m and n - k >= q:             # <<<<<<<<<<<<<<
6489  *                 continue
6490  *
6491  */
6492       __pyx_t_15 = ((__pyx_v_n >= __pyx_v_m) != 0);
6493       if (__pyx_t_15) {
6494       } else {
6495         __pyx_t_8 = __pyx_t_15;
6496         goto __pyx_L9_bool_binop_done;
6497       }
6498       __pyx_t_15 = (((__pyx_v_n - __pyx_v_k) >= __pyx_v_q) != 0);
6499       __pyx_t_8 = __pyx_t_15;
6500       __pyx_L9_bool_binop_done:;
6501       if (__pyx_t_8) {
6502 
6503         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":693
6504  *             # zero indexing)
6505  *             if n >= m and n - k >= q:
6506  *                 continue             # <<<<<<<<<<<<<<
6507  *
6508  *             if n + 1 < m2 and k < m:
6509  */
6510         goto __pyx_L6_continue;
6511 
6512         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":692
6513  *             # (here we have weak rather than strict inequality due to Python's
6514  *             # zero indexing)
6515  *             if n >= m and n - k >= q:             # <<<<<<<<<<<<<<
6516  *                 continue
6517  *
6518  */
6519       }
6520 
6521       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":695
6522  *                 continue
6523  *
6524  *             if n + 1 < m2 and k < m:             # <<<<<<<<<<<<<<
6525  *                 theta[_n, n - k] = acovf[n + 1, k]
6526  *             else:
6527  */
6528       __pyx_t_15 = (((__pyx_v_n + 1) < __pyx_v_m2) != 0);
6529       if (__pyx_t_15) {
6530       } else {
6531         __pyx_t_8 = __pyx_t_15;
6532         goto __pyx_L12_bool_binop_done;
6533       }
6534       __pyx_t_15 = ((__pyx_v_k < __pyx_v_m) != 0);
6535       __pyx_t_8 = __pyx_t_15;
6536       __pyx_L12_bool_binop_done:;
6537       if (__pyx_t_8) {
6538 
6539         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":696
6540  *
6541  *             if n + 1 < m2 and k < m:
6542  *                 theta[_n, n - k] = acovf[n + 1, k]             # <<<<<<<<<<<<<<
6543  *             else:
6544  *                 theta[_n, n - k] = acovf2[n + 1 - k]
6545  */
6546         __pyx_t_10 = (__pyx_v_n + 1);
6547         __pyx_t_9 = __pyx_v_k;
6548         __pyx_t_11 = __pyx_v__n;
6549         __pyx_t_16 = (__pyx_v_n - __pyx_v_k);
6550         *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_11 * __pyx_v_theta.strides[0]) ) + __pyx_t_16 * __pyx_v_theta.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_10 * __pyx_v_acovf.strides[0]) ) + __pyx_t_9 * __pyx_v_acovf.strides[1]) )));
6551 
6552         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":695
6553  *                 continue
6554  *
6555  *             if n + 1 < m2 and k < m:             # <<<<<<<<<<<<<<
6556  *                 theta[_n, n - k] = acovf[n + 1, k]
6557  *             else:
6558  */
6559         goto __pyx_L11;
6560       }
6561 
6562       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":698
6563  *                 theta[_n, n - k] = acovf[n + 1, k]
6564  *             else:
6565  *                 theta[_n, n - k] = acovf2[n + 1 - k]             # <<<<<<<<<<<<<<
6566  *
6567  *             start2 = 0 if n < m else n - m
6568  */
6569       /*else*/ {
6570         __pyx_t_9 = ((__pyx_v_n + 1) - __pyx_v_k);
6571         __pyx_t_10 = __pyx_v__n;
6572         __pyx_t_16 = (__pyx_v_n - __pyx_v_k);
6573         *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_10 * __pyx_v_theta.strides[0]) ) + __pyx_t_16 * __pyx_v_theta.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_9 * __pyx_v_acovf2.strides[0]) )));
6574       }
6575       __pyx_L11:;
6576 
6577       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":700
6578  *                 theta[_n, n - k] = acovf2[n + 1 - k]
6579  *
6580  *             start2 = 0 if n < m else n - m             # <<<<<<<<<<<<<<
6581  *             for j in range(start2, k):
6582  *                 if n - j < m + 1:
6583  */
6584       if (((__pyx_v_n < __pyx_v_m) != 0)) {
6585         __pyx_t_17 = 0;
6586       } else {
6587         __pyx_t_17 = (__pyx_v_n - __pyx_v_m);
6588       }
6589       __pyx_v_start2 = __pyx_t_17;
6590 
6591       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":701
6592  *
6593  *             start2 = 0 if n < m else n - m
6594  *             for j in range(start2, k):             # <<<<<<<<<<<<<<
6595  *                 if n - j < m + 1:
6596  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
6597  */
6598       __pyx_t_17 = __pyx_v_k;
6599       __pyx_t_18 = __pyx_t_17;
6600       for (__pyx_t_19 = __pyx_v_start2; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
6601         __pyx_v_j = __pyx_t_19;
6602 
6603         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":702
6604  *             start2 = 0 if n < m else n - m
6605  *             for j in range(start2, k):
6606  *                 if n - j < m + 1:             # <<<<<<<<<<<<<<
6607  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
6608  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
6609  */
6610         __pyx_t_8 = (((__pyx_v_n - __pyx_v_j) < (__pyx_v_m + 1)) != 0);
6611         if (__pyx_t_8) {
6612 
6613           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":703
6614  *             for j in range(start2, k):
6615  *                 if n - j < m + 1:
6616  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]             # <<<<<<<<<<<<<<
6617  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
6618  *
6619  */
6620           __pyx_t_9 = __pyx_v__n;
6621           __pyx_t_16 = (__pyx_v_n - __pyx_v_k);
6622           __pyx_t_10 = ((__pyx_v_k - 1) + 1);
6623           __pyx_t_11 = ((__pyx_v_k - __pyx_v_j) - 1);
6624           __pyx_t_20 = __pyx_v__n;
6625           __pyx_t_21 = (__pyx_v_n - __pyx_v_j);
6626           __pyx_t_22 = __pyx_v_j;
6627           __pyx_t_23 = __pyx_v__n;
6628           __pyx_t_24 = (__pyx_v_n - __pyx_v_k);
6629           *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_23 * __pyx_v_theta.strides[0]) ) + __pyx_t_24 * __pyx_v_theta.strides[1]) )) = ((*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_9 * __pyx_v_theta.strides[0]) ) + __pyx_t_16 * __pyx_v_theta.strides[1]) ))) - (((*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_10 * __pyx_v_theta.strides[0]) ) + __pyx_t_11 * __pyx_v_theta.strides[1]) ))) * (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_20 * __pyx_v_theta.strides[0]) ) + __pyx_t_21 * __pyx_v_theta.strides[1]) )))) * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) )))));
6630 
6631           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":702
6632  *             start2 = 0 if n < m else n - m
6633  *             for j in range(start2, k):
6634  *                 if n - j < m + 1:             # <<<<<<<<<<<<<<
6635  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
6636  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
6637  */
6638         }
6639       }
6640 
6641       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":704
6642  *                 if n - j < m + 1:
6643  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
6644  *             theta[_n, n - k] = theta[_n, n - k] / v[k]             # <<<<<<<<<<<<<<
6645  *
6646  *         if n + 1 < m:
6647  */
6648       __pyx_t_22 = __pyx_v__n;
6649       __pyx_t_21 = (__pyx_v_n - __pyx_v_k);
6650       __pyx_t_25 = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_22 * __pyx_v_theta.strides[0]) ) + __pyx_t_21 * __pyx_v_theta.strides[1]) )));
6651       __pyx_t_21 = __pyx_v_k;
6652       __pyx_t_26 = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) )));
6653       if (unlikely(__pyx_t_26 == 0)) {
6654         PyErr_SetString(PyExc_ZeroDivisionError, "float division");
6655         __PYX_ERR(0, 704, __pyx_L1_error)
6656       }
6657       __pyx_t_21 = __pyx_v__n;
6658       __pyx_t_22 = (__pyx_v_n - __pyx_v_k);
6659       *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_21 * __pyx_v_theta.strides[0]) ) + __pyx_t_22 * __pyx_v_theta.strides[1]) )) = (__pyx_t_25 / __pyx_t_26);
6660       __pyx_L6_continue:;
6661     }
6662 
6663     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":706
6664  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
6665  *
6666  *         if n + 1 < m:             # <<<<<<<<<<<<<<
6667  *             v[n + 1] = acovf[n + 1, n + 1]
6668  *         else:
6669  */
6670     __pyx_t_8 = (((__pyx_v_n + 1) < __pyx_v_m) != 0);
6671     if (__pyx_t_8) {
6672 
6673       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":707
6674  *
6675  *         if n + 1 < m:
6676  *             v[n + 1] = acovf[n + 1, n + 1]             # <<<<<<<<<<<<<<
6677  *         else:
6678  *             v[n + 1] = acovf2[0]
6679  */
6680       __pyx_t_22 = (__pyx_v_n + 1);
6681       __pyx_t_21 = (__pyx_v_n + 1);
6682       __pyx_t_20 = (__pyx_v_n + 1);
6683       *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_20 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_22 * __pyx_v_acovf.strides[0]) ) + __pyx_t_21 * __pyx_v_acovf.strides[1]) )));
6684 
6685       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":706
6686  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
6687  *
6688  *         if n + 1 < m:             # <<<<<<<<<<<<<<
6689  *             v[n + 1] = acovf[n + 1, n + 1]
6690  *         else:
6691  */
6692       goto __pyx_L17;
6693     }
6694 
6695     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":709
6696  *             v[n + 1] = acovf[n + 1, n + 1]
6697  *         else:
6698  *             v[n + 1] = acovf2[0]             # <<<<<<<<<<<<<<
6699  *         start = max(0, n - (m + 1) + 2)
6700  *         for i in range(start, n + 1):
6701  */
6702     /*else*/ {
6703       __pyx_t_21 = 0;
6704       __pyx_t_22 = (__pyx_v_n + 1);
6705       *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_21 * __pyx_v_acovf2.strides[0]) )));
6706     }
6707     __pyx_L17:;
6708 
6709     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":710
6710  *         else:
6711  *             v[n + 1] = acovf2[0]
6712  *         start = max(0, n - (m + 1) + 2)             # <<<<<<<<<<<<<<
6713  *         for i in range(start, n + 1):
6714  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]
6715  */
6716     __pyx_t_2 = ((__pyx_v_n - (__pyx_v_m + 1)) + 2);
6717     __pyx_t_27 = 0;
6718     if (((__pyx_t_2 > __pyx_t_27) != 0)) {
6719       __pyx_t_3 = __pyx_t_2;
6720     } else {
6721       __pyx_t_3 = __pyx_t_27;
6722     }
6723     __pyx_v_start = __pyx_t_3;
6724 
6725     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":711
6726  *             v[n + 1] = acovf2[0]
6727  *         start = max(0, n - (m + 1) + 2)
6728  *         for i in range(start, n + 1):             # <<<<<<<<<<<<<<
6729  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]
6730  *
6731  */
6732     __pyx_t_3 = (__pyx_v_n + 1);
6733     __pyx_t_2 = __pyx_t_3;
6734     for (__pyx_t_14 = __pyx_v_start; __pyx_t_14 < __pyx_t_2; __pyx_t_14+=1) {
6735       __pyx_v_i = __pyx_t_14;
6736 
6737       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":712
6738  *         start = max(0, n - (m + 1) + 2)
6739  *         for i in range(start, n + 1):
6740  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]             # <<<<<<<<<<<<<<
6741  *
6742  *     return theta, v
6743  */
6744       __pyx_t_21 = (__pyx_v_n + 1);
6745       __pyx_t_22 = __pyx_v__n;
6746       __pyx_t_20 = (__pyx_v_n - __pyx_v_i);
6747       __pyx_t_11 = __pyx_v_i;
6748       __pyx_t_10 = (__pyx_v_n + 1);
6749       *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_10 * __pyx_v_v.strides[0]) )) = ((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) ))) - (pow((*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_22 * __pyx_v_theta.strides[0]) ) + __pyx_t_20 * __pyx_v_theta.strides[1]) ))), 2.0) * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_11 * __pyx_v_v.strides[0]) )))));
6750     }
6751   }
6752 
6753   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":714
6754  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]
6755  *
6756  *     return theta, v             # <<<<<<<<<<<<<<
6757  *
6758  *
6759  */
6760   __Pyx_XDECREF(__pyx_r);
6761   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_theta, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 714, __pyx_L1_error)
6762   __Pyx_GOTREF(__pyx_t_5);
6763   __pyx_t_28 = __pyx_memoryview_fromslice(__pyx_v_v, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 714, __pyx_L1_error)
6764   __Pyx_GOTREF(__pyx_t_28);
6765   __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 714, __pyx_L1_error)
6766   __Pyx_GOTREF(__pyx_t_29);
6767   __Pyx_GIVEREF(__pyx_t_5);
6768   PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_t_5);
6769   __Pyx_GIVEREF(__pyx_t_28);
6770   PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_28);
6771   __pyx_t_5 = 0;
6772   __pyx_t_28 = 0;
6773   __pyx_r = __pyx_t_29;
6774   __pyx_t_29 = 0;
6775   goto __pyx_L0;
6776 
6777   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":613
6778  *
6779  *
6780  * cpdef darma_innovations_algo_fast(int nobs,             # <<<<<<<<<<<<<<
6781  *                                            cnp.float64_t [:] ar_params,
6782  *                                            cnp.float64_t [:] ma_params,
6783  */
6784 
6785   /* function exit code */
6786   __pyx_L1_error:;
6787   __Pyx_XDECREF(__pyx_t_5);
6788   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
6789   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
6790   __Pyx_XDECREF(__pyx_t_28);
6791   __Pyx_XDECREF(__pyx_t_29);
6792   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_innovations_algo_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
6793   __pyx_r = 0;
6794   __pyx_L0:;
6795   __PYX_XDEC_MEMVIEW(&__pyx_v_theta, 1);
6796   __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
6797   __Pyx_XGIVEREF(__pyx_r);
6798   __Pyx_RefNannyFinishContext();
6799   return __pyx_r;
6800 }
6801 
6802 /* Python wrapper */
6803 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_13darma_innovations_algo_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6804 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_12darma_innovations_algo_fast[] = "\n    arma_innovations_algo_fast(int nobs, cnp.float64_t [:] ar_params, cnp.float64_t [:] ma_params, cnp.float64_t [:, :] acovf, cnp.float64_t [:] acovf2)\n    \n    Quickly apply innovations algorithm for an ARMA process.\n\n    Parameters\n    ----------\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    acovf : ndarray\n        An `m * 2` x `m * 2` autocovariance matrix at least the first `m`\n        columns filled in, where `m = max(len(ar_params), ma_params)`\n        (see `arma_transformed_acovf_fast`).\n    acovf2 : ndarray\n        A `max(0, nobs - m)` length vector containing the autocovariance\n        function associated with the final `nobs - m` observations.\n\n    Returns\n    -------\n    theta : ndarray\n        The matrix of moving average coefficients from the innovations\n        algorithm.\n    v : ndarray\n        The vector of mean squared errors.\n\n    Notes\n    -----\n    The innovations algorithm is presented in _[1], section 2.5.2.\n\n    Details of the innovations algorithm applied to ARMA processes is given\n    in _[1] section 3.3 and in section 5.2.7.\n\n    This function is relatively fast even with a large number of observations\n    since we can exploit a number of known zeros in the theta array.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_13darma_innovations_algo_fast(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6805 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_13darma_innovations_algo_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6806   int __pyx_v_nobs;
6807   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
6808   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
6809   __Pyx_memviewslice __pyx_v_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
6810   __Pyx_memviewslice __pyx_v_acovf2 = { 0, 0, { 0 }, { 0 }, { 0 } };
6811   int __pyx_lineno = 0;
6812   const char *__pyx_filename = NULL;
6813   int __pyx_clineno = 0;
6814   PyObject *__pyx_r = 0;
6815   __Pyx_RefNannyDeclarations
6816   __Pyx_RefNannySetupContext("darma_innovations_algo_fast (wrapper)", 0);
6817   {
6818     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nobs,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_acovf,&__pyx_n_s_acovf2,0};
6819     PyObject* values[5] = {0,0,0,0,0};
6820     if (unlikely(__pyx_kwds)) {
6821       Py_ssize_t kw_args;
6822       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6823       switch (pos_args) {
6824         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6825         CYTHON_FALLTHROUGH;
6826         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6827         CYTHON_FALLTHROUGH;
6828         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6829         CYTHON_FALLTHROUGH;
6830         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6831         CYTHON_FALLTHROUGH;
6832         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6833         CYTHON_FALLTHROUGH;
6834         case  0: break;
6835         default: goto __pyx_L5_argtuple_error;
6836       }
6837       kw_args = PyDict_Size(__pyx_kwds);
6838       switch (pos_args) {
6839         case  0:
6840         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nobs)) != 0)) kw_args--;
6841         else goto __pyx_L5_argtuple_error;
6842         CYTHON_FALLTHROUGH;
6843         case  1:
6844         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
6845         else {
6846           __Pyx_RaiseArgtupleInvalid("darma_innovations_algo_fast", 1, 5, 5, 1); __PYX_ERR(0, 613, __pyx_L3_error)
6847         }
6848         CYTHON_FALLTHROUGH;
6849         case  2:
6850         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
6851         else {
6852           __Pyx_RaiseArgtupleInvalid("darma_innovations_algo_fast", 1, 5, 5, 2); __PYX_ERR(0, 613, __pyx_L3_error)
6853         }
6854         CYTHON_FALLTHROUGH;
6855         case  3:
6856         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_acovf)) != 0)) kw_args--;
6857         else {
6858           __Pyx_RaiseArgtupleInvalid("darma_innovations_algo_fast", 1, 5, 5, 3); __PYX_ERR(0, 613, __pyx_L3_error)
6859         }
6860         CYTHON_FALLTHROUGH;
6861         case  4:
6862         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_acovf2)) != 0)) kw_args--;
6863         else {
6864           __Pyx_RaiseArgtupleInvalid("darma_innovations_algo_fast", 1, 5, 5, 4); __PYX_ERR(0, 613, __pyx_L3_error)
6865         }
6866       }
6867       if (unlikely(kw_args > 0)) {
6868         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "darma_innovations_algo_fast") < 0)) __PYX_ERR(0, 613, __pyx_L3_error)
6869       }
6870     } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
6871       goto __pyx_L5_argtuple_error;
6872     } else {
6873       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6874       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6875       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6876       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6877       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6878     }
6879     __pyx_v_nobs = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nobs == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 613, __pyx_L3_error)
6880     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 614, __pyx_L3_error)
6881     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 615, __pyx_L3_error)
6882     __pyx_v_acovf = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_acovf.memview)) __PYX_ERR(0, 616, __pyx_L3_error)
6883     __pyx_v_acovf2 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_acovf2.memview)) __PYX_ERR(0, 617, __pyx_L3_error)
6884   }
6885   goto __pyx_L4_argument_unpacking_done;
6886   __pyx_L5_argtuple_error:;
6887   __Pyx_RaiseArgtupleInvalid("darma_innovations_algo_fast", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 613, __pyx_L3_error)
6888   __pyx_L3_error:;
6889   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_innovations_algo_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
6890   __Pyx_RefNannyFinishContext();
6891   return NULL;
6892   __pyx_L4_argument_unpacking_done:;
6893   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_12darma_innovations_algo_fast(__pyx_self, __pyx_v_nobs, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_acovf, __pyx_v_acovf2);
6894 
6895   /* function exit code */
6896   __Pyx_RefNannyFinishContext();
6897   return __pyx_r;
6898 }
6899 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_12darma_innovations_algo_fast(CYTHON_UNUSED PyObject * __pyx_self,int __pyx_v_nobs,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_acovf,__Pyx_memviewslice __pyx_v_acovf2)6900 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_12darma_innovations_algo_fast(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nobs, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_acovf, __Pyx_memviewslice __pyx_v_acovf2) {
6901   PyObject *__pyx_r = NULL;
6902   __Pyx_RefNannyDeclarations
6903   PyObject *__pyx_t_1 = NULL;
6904   int __pyx_lineno = 0;
6905   const char *__pyx_filename = NULL;
6906   int __pyx_clineno = 0;
6907   __Pyx_RefNannySetupContext("darma_innovations_algo_fast", 0);
6908   __Pyx_XDECREF(__pyx_r);
6909   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 613, __pyx_L1_error) }
6910   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 613, __pyx_L1_error) }
6911   if (unlikely(!__pyx_v_acovf.memview)) { __Pyx_RaiseUnboundLocalError("acovf"); __PYX_ERR(0, 613, __pyx_L1_error) }
6912   if (unlikely(!__pyx_v_acovf2.memview)) { __Pyx_RaiseUnboundLocalError("acovf2"); __PYX_ERR(0, 613, __pyx_L1_error) }
6913   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations_algo_fast(__pyx_v_nobs, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_acovf, __pyx_v_acovf2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error)
6914   __Pyx_GOTREF(__pyx_t_1);
6915   __pyx_r = __pyx_t_1;
6916   __pyx_t_1 = 0;
6917   goto __pyx_L0;
6918 
6919   /* function exit code */
6920   __pyx_L1_error:;
6921   __Pyx_XDECREF(__pyx_t_1);
6922   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_innovations_algo_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
6923   __pyx_r = NULL;
6924   __pyx_L0:;
6925   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
6926   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
6927   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf, 1);
6928   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf2, 1);
6929   __Pyx_XGIVEREF(__pyx_r);
6930   __Pyx_RefNannyFinishContext();
6931   return __pyx_r;
6932 }
6933 
6934 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":717
6935  *
6936  *
6937  * cpdef darma_innovations_filter(cnp.float64_t [:] endog,             # <<<<<<<<<<<<<<
6938  *                                         cnp.float64_t [:] ar_params,
6939  *                                         cnp.float64_t [:] ma_params,
6940  */
6941 
6942 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_15darma_innovations_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations_filter(__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_theta,CYTHON_UNUSED int __pyx_skip_dispatch)6943 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations_filter(__Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_theta, CYTHON_UNUSED int __pyx_skip_dispatch) {
6944   Py_ssize_t __pyx_v_nobs;
6945   Py_ssize_t __pyx_v_i;
6946   CYTHON_UNUSED Py_ssize_t __pyx_v_k;
6947   Py_ssize_t __pyx_v_j;
6948   Py_ssize_t __pyx_v_m;
6949   Py_ssize_t __pyx_v_p;
6950   Py_ssize_t __pyx_v_q;
6951   npy_intp __pyx_v_dim1[1];
6952   __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
6953   __pyx_t_5numpy_float64_t __pyx_v_hat;
6954   PyObject *__pyx_r = NULL;
6955   __Pyx_RefNannyDeclarations
6956   size_t __pyx_t_1;
6957   Py_ssize_t __pyx_t_2;
6958   Py_ssize_t __pyx_t_3;
6959   Py_ssize_t __pyx_t_4;
6960   PyObject *__pyx_t_5 = NULL;
6961   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
6962   Py_ssize_t __pyx_t_7;
6963   Py_ssize_t __pyx_t_8;
6964   int __pyx_t_9;
6965   Py_ssize_t __pyx_t_10;
6966   Py_ssize_t __pyx_t_11;
6967   Py_ssize_t __pyx_t_12;
6968   Py_ssize_t __pyx_t_13;
6969   int __pyx_lineno = 0;
6970   const char *__pyx_filename = NULL;
6971   int __pyx_clineno = 0;
6972   __Pyx_RefNannySetupContext("darma_innovations_filter", 0);
6973 
6974   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":762
6975  *     cdef cnp.float64_t hat
6976  *
6977  *     p = len(ar_params)             # <<<<<<<<<<<<<<
6978  *     q = len(ma_params)
6979  *     m = max(p, q)
6980  */
6981   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
6982   __pyx_v_p = __pyx_t_1;
6983 
6984   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":763
6985  *
6986  *     p = len(ar_params)
6987  *     q = len(ma_params)             # <<<<<<<<<<<<<<
6988  *     m = max(p, q)
6989  *
6990  */
6991   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma_params);
6992   __pyx_v_q = __pyx_t_1;
6993 
6994   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":764
6995  *     p = len(ar_params)
6996  *     q = len(ma_params)
6997  *     m = max(p, q)             # <<<<<<<<<<<<<<
6998  *
6999  *     nobs = theta.shape[0]
7000  */
7001   __pyx_t_2 = __pyx_v_q;
7002   __pyx_t_3 = __pyx_v_p;
7003   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
7004     __pyx_t_4 = __pyx_t_2;
7005   } else {
7006     __pyx_t_4 = __pyx_t_3;
7007   }
7008   __pyx_v_m = __pyx_t_4;
7009 
7010   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":766
7011  *     m = max(p, q)
7012  *
7013  *     nobs = theta.shape[0]             # <<<<<<<<<<<<<<
7014  *     k = theta.shape[1]
7015  *
7016  */
7017   __pyx_v_nobs = (__pyx_v_theta.shape[0]);
7018 
7019   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":767
7020  *
7021  *     nobs = theta.shape[0]
7022  *     k = theta.shape[1]             # <<<<<<<<<<<<<<
7023  *
7024  *     dim1[0] = nobs;
7025  */
7026   __pyx_v_k = (__pyx_v_theta.shape[1]);
7027 
7028   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":769
7029  *     k = theta.shape[1]
7030  *
7031  *     dim1[0] = nobs;             # <<<<<<<<<<<<<<
7032  *     u = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
7033  *     u[0] = endog[0]
7034  */
7035   (__pyx_v_dim1[0]) = __pyx_v_nobs;
7036 
7037   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":770
7038  *
7039  *     dim1[0] = nobs;
7040  *     u = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)             # <<<<<<<<<<<<<<
7041  *     u[0] = endog[0]
7042  *
7043  */
7044   __pyx_t_5 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_FLOAT64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 770, __pyx_L1_error)
7045   __Pyx_GOTREF(__pyx_t_5);
7046   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 770, __pyx_L1_error)
7047   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7048   __pyx_v_u = __pyx_t_6;
7049   __pyx_t_6.memview = NULL;
7050   __pyx_t_6.data = NULL;
7051 
7052   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":771
7053  *     dim1[0] = nobs;
7054  *     u = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
7055  *     u[0] = endog[0]             # <<<<<<<<<<<<<<
7056  *
7057  *     for i in range(1, nobs):
7058  */
7059   __pyx_t_7 = 0;
7060   __pyx_t_8 = 0;
7061   *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_8 * __pyx_v_u.strides[0]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_endog.data + __pyx_t_7 * __pyx_v_endog.strides[0]) )));
7062 
7063   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":773
7064  *     u[0] = endog[0]
7065  *
7066  *     for i in range(1, nobs):             # <<<<<<<<<<<<<<
7067  *         hat = 0
7068  *         if i < m:
7069  */
7070   __pyx_t_4 = __pyx_v_nobs;
7071   __pyx_t_2 = __pyx_t_4;
7072   for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
7073     __pyx_v_i = __pyx_t_3;
7074 
7075     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":774
7076  *
7077  *     for i in range(1, nobs):
7078  *         hat = 0             # <<<<<<<<<<<<<<
7079  *         if i < m:
7080  *             for j in range(i):
7081  */
7082     __pyx_v_hat = 0.0;
7083 
7084     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":775
7085  *     for i in range(1, nobs):
7086  *         hat = 0
7087  *         if i < m:             # <<<<<<<<<<<<<<
7088  *             for j in range(i):
7089  *                 hat = hat + theta[i, j] * u[i - j - 1]
7090  */
7091     __pyx_t_9 = ((__pyx_v_i < __pyx_v_m) != 0);
7092     if (__pyx_t_9) {
7093 
7094       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":776
7095  *         hat = 0
7096  *         if i < m:
7097  *             for j in range(i):             # <<<<<<<<<<<<<<
7098  *                 hat = hat + theta[i, j] * u[i - j - 1]
7099  *         else:
7100  */
7101       __pyx_t_10 = __pyx_v_i;
7102       __pyx_t_11 = __pyx_t_10;
7103       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
7104         __pyx_v_j = __pyx_t_12;
7105 
7106         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":777
7107  *         if i < m:
7108  *             for j in range(i):
7109  *                 hat = hat + theta[i, j] * u[i - j - 1]             # <<<<<<<<<<<<<<
7110  *         else:
7111  *             for j in range(p):
7112  */
7113         __pyx_t_7 = __pyx_v_i;
7114         __pyx_t_8 = __pyx_v_j;
7115         __pyx_t_13 = ((__pyx_v_i - __pyx_v_j) - 1);
7116         __pyx_v_hat = (__pyx_v_hat + ((*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_7 * __pyx_v_theta.strides[0]) ) + __pyx_t_8 * __pyx_v_theta.strides[1]) ))) * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_13 * __pyx_v_u.strides[0]) )))));
7117       }
7118 
7119       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":775
7120  *     for i in range(1, nobs):
7121  *         hat = 0
7122  *         if i < m:             # <<<<<<<<<<<<<<
7123  *             for j in range(i):
7124  *                 hat = hat + theta[i, j] * u[i - j - 1]
7125  */
7126       goto __pyx_L5;
7127     }
7128 
7129     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":779
7130  *                 hat = hat + theta[i, j] * u[i - j - 1]
7131  *         else:
7132  *             for j in range(p):             # <<<<<<<<<<<<<<
7133  *                 hat = hat + ar_params[j] * endog[i - j - 1]
7134  *             for j in range(q):
7135  */
7136     /*else*/ {
7137       __pyx_t_10 = __pyx_v_p;
7138       __pyx_t_11 = __pyx_t_10;
7139       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
7140         __pyx_v_j = __pyx_t_12;
7141 
7142         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":780
7143  *         else:
7144  *             for j in range(p):
7145  *                 hat = hat + ar_params[j] * endog[i - j - 1]             # <<<<<<<<<<<<<<
7146  *             for j in range(q):
7147  *                 hat = hat + theta[i, j] * u[i - j - 1]
7148  */
7149         __pyx_t_13 = __pyx_v_j;
7150         __pyx_t_8 = ((__pyx_v_i - __pyx_v_j) - 1);
7151         __pyx_v_hat = (__pyx_v_hat + ((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_ar_params.data + __pyx_t_13 * __pyx_v_ar_params.strides[0]) ))) * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_endog.data + __pyx_t_8 * __pyx_v_endog.strides[0]) )))));
7152       }
7153 
7154       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":781
7155  *             for j in range(p):
7156  *                 hat = hat + ar_params[j] * endog[i - j - 1]
7157  *             for j in range(q):             # <<<<<<<<<<<<<<
7158  *                 hat = hat + theta[i, j] * u[i - j - 1]
7159  *         u[i] = endog[i] - hat
7160  */
7161       __pyx_t_10 = __pyx_v_q;
7162       __pyx_t_11 = __pyx_t_10;
7163       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
7164         __pyx_v_j = __pyx_t_12;
7165 
7166         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":782
7167  *                 hat = hat + ar_params[j] * endog[i - j - 1]
7168  *             for j in range(q):
7169  *                 hat = hat + theta[i, j] * u[i - j - 1]             # <<<<<<<<<<<<<<
7170  *         u[i] = endog[i] - hat
7171  *
7172  */
7173         __pyx_t_8 = __pyx_v_i;
7174         __pyx_t_13 = __pyx_v_j;
7175         __pyx_t_7 = ((__pyx_v_i - __pyx_v_j) - 1);
7176         __pyx_v_hat = (__pyx_v_hat + ((*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_8 * __pyx_v_theta.strides[0]) ) + __pyx_t_13 * __pyx_v_theta.strides[1]) ))) * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_7 * __pyx_v_u.strides[0]) )))));
7177       }
7178     }
7179     __pyx_L5:;
7180 
7181     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":783
7182  *             for j in range(q):
7183  *                 hat = hat + theta[i, j] * u[i - j - 1]
7184  *         u[i] = endog[i] - hat             # <<<<<<<<<<<<<<
7185  *
7186  *     return u
7187  */
7188     __pyx_t_7 = __pyx_v_i;
7189     __pyx_t_13 = __pyx_v_i;
7190     *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_13 * __pyx_v_u.strides[0]) )) = ((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_endog.data + __pyx_t_7 * __pyx_v_endog.strides[0]) ))) - __pyx_v_hat);
7191   }
7192 
7193   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":785
7194  *         u[i] = endog[i] - hat
7195  *
7196  *     return u             # <<<<<<<<<<<<<<
7197  *
7198  *
7199  */
7200   __Pyx_XDECREF(__pyx_r);
7201   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_u, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 785, __pyx_L1_error)
7202   __Pyx_GOTREF(__pyx_t_5);
7203   __pyx_r = __pyx_t_5;
7204   __pyx_t_5 = 0;
7205   goto __pyx_L0;
7206 
7207   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":717
7208  *
7209  *
7210  * cpdef darma_innovations_filter(cnp.float64_t [:] endog,             # <<<<<<<<<<<<<<
7211  *                                         cnp.float64_t [:] ar_params,
7212  *                                         cnp.float64_t [:] ma_params,
7213  */
7214 
7215   /* function exit code */
7216   __pyx_L1_error:;
7217   __Pyx_XDECREF(__pyx_t_5);
7218   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
7219   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_innovations_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
7220   __pyx_r = 0;
7221   __pyx_L0:;
7222   __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
7223   __Pyx_XGIVEREF(__pyx_r);
7224   __Pyx_RefNannyFinishContext();
7225   return __pyx_r;
7226 }
7227 
7228 /* Python wrapper */
7229 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_15darma_innovations_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7230 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_14darma_innovations_filter[] = "\n    arma_innovations_filter(cnp.float64_t [:] endog, cnp.float64_t [:] ar_params, cnp.float64_t [:] ma_params, cnp.float64_t [:, :] theta):\n    \n    Innovations filter for an ARMA process.\n\n    Parameters\n    ----------\n    endog : ndarray\n        The observed time-series process.\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    theta : ndarray\n        The matrix of moving average coefficients from the innovations\n        algorithm (see `arma_innovations_algo` or `arma_innovations_algo_fast`)\n\n    Returns\n    -------\n    u : ndarray\n        The vector of innovations: the one-step-ahead prediction errors from\n        applying the innovations algorithm.\n\n    Notes\n    -----\n    The innovations algorithm is presented in _[1], section 2.5.2.\n\n    Details of the innovations algorithm applied to ARMA processes is given\n    in _[1] section 3.3 and in section 5.2.7.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_15darma_innovations_filter(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7231 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_15darma_innovations_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7232   __Pyx_memviewslice __pyx_v_endog = { 0, 0, { 0 }, { 0 }, { 0 } };
7233   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
7234   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
7235   __Pyx_memviewslice __pyx_v_theta = { 0, 0, { 0 }, { 0 }, { 0 } };
7236   int __pyx_lineno = 0;
7237   const char *__pyx_filename = NULL;
7238   int __pyx_clineno = 0;
7239   PyObject *__pyx_r = 0;
7240   __Pyx_RefNannyDeclarations
7241   __Pyx_RefNannySetupContext("darma_innovations_filter (wrapper)", 0);
7242   {
7243     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_theta,0};
7244     PyObject* values[4] = {0,0,0,0};
7245     if (unlikely(__pyx_kwds)) {
7246       Py_ssize_t kw_args;
7247       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7248       switch (pos_args) {
7249         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7250         CYTHON_FALLTHROUGH;
7251         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7252         CYTHON_FALLTHROUGH;
7253         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7254         CYTHON_FALLTHROUGH;
7255         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7256         CYTHON_FALLTHROUGH;
7257         case  0: break;
7258         default: goto __pyx_L5_argtuple_error;
7259       }
7260       kw_args = PyDict_Size(__pyx_kwds);
7261       switch (pos_args) {
7262         case  0:
7263         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
7264         else goto __pyx_L5_argtuple_error;
7265         CYTHON_FALLTHROUGH;
7266         case  1:
7267         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
7268         else {
7269           __Pyx_RaiseArgtupleInvalid("darma_innovations_filter", 1, 4, 4, 1); __PYX_ERR(0, 717, __pyx_L3_error)
7270         }
7271         CYTHON_FALLTHROUGH;
7272         case  2:
7273         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
7274         else {
7275           __Pyx_RaiseArgtupleInvalid("darma_innovations_filter", 1, 4, 4, 2); __PYX_ERR(0, 717, __pyx_L3_error)
7276         }
7277         CYTHON_FALLTHROUGH;
7278         case  3:
7279         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
7280         else {
7281           __Pyx_RaiseArgtupleInvalid("darma_innovations_filter", 1, 4, 4, 3); __PYX_ERR(0, 717, __pyx_L3_error)
7282         }
7283       }
7284       if (unlikely(kw_args > 0)) {
7285         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "darma_innovations_filter") < 0)) __PYX_ERR(0, 717, __pyx_L3_error)
7286       }
7287     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
7288       goto __pyx_L5_argtuple_error;
7289     } else {
7290       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7291       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7292       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7293       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7294     }
7295     __pyx_v_endog = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_endog.memview)) __PYX_ERR(0, 717, __pyx_L3_error)
7296     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 718, __pyx_L3_error)
7297     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 719, __pyx_L3_error)
7298     __pyx_v_theta = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_theta.memview)) __PYX_ERR(0, 720, __pyx_L3_error)
7299   }
7300   goto __pyx_L4_argument_unpacking_done;
7301   __pyx_L5_argtuple_error:;
7302   __Pyx_RaiseArgtupleInvalid("darma_innovations_filter", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 717, __pyx_L3_error)
7303   __pyx_L3_error:;
7304   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_innovations_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
7305   __Pyx_RefNannyFinishContext();
7306   return NULL;
7307   __pyx_L4_argument_unpacking_done:;
7308   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_14darma_innovations_filter(__pyx_self, __pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_theta);
7309 
7310   /* function exit code */
7311   __Pyx_RefNannyFinishContext();
7312   return __pyx_r;
7313 }
7314 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_14darma_innovations_filter(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_theta)7315 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_14darma_innovations_filter(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_theta) {
7316   PyObject *__pyx_r = NULL;
7317   __Pyx_RefNannyDeclarations
7318   PyObject *__pyx_t_1 = NULL;
7319   int __pyx_lineno = 0;
7320   const char *__pyx_filename = NULL;
7321   int __pyx_clineno = 0;
7322   __Pyx_RefNannySetupContext("darma_innovations_filter", 0);
7323   __Pyx_XDECREF(__pyx_r);
7324   if (unlikely(!__pyx_v_endog.memview)) { __Pyx_RaiseUnboundLocalError("endog"); __PYX_ERR(0, 717, __pyx_L1_error) }
7325   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 717, __pyx_L1_error) }
7326   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 717, __pyx_L1_error) }
7327   if (unlikely(!__pyx_v_theta.memview)) { __Pyx_RaiseUnboundLocalError("theta"); __PYX_ERR(0, 717, __pyx_L1_error) }
7328   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations_filter(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_theta, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
7329   __Pyx_GOTREF(__pyx_t_1);
7330   __pyx_r = __pyx_t_1;
7331   __pyx_t_1 = 0;
7332   goto __pyx_L0;
7333 
7334   /* function exit code */
7335   __pyx_L1_error:;
7336   __Pyx_XDECREF(__pyx_t_1);
7337   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_innovations_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
7338   __pyx_r = NULL;
7339   __pyx_L0:;
7340   __PYX_XDEC_MEMVIEW(&__pyx_v_endog, 1);
7341   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
7342   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
7343   __PYX_XDEC_MEMVIEW(&__pyx_v_theta, 1);
7344   __Pyx_XGIVEREF(__pyx_r);
7345   __Pyx_RefNannyFinishContext();
7346   return __pyx_r;
7347 }
7348 
7349 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":788
7350  *
7351  *
7352  * cpdef darma_innovations(cnp.float64_t [:] endog,             # <<<<<<<<<<<<<<
7353  *                                       cnp.float64_t [:] ar_params,
7354  *                                       cnp.float64_t [:] ma_params,
7355  */
7356 
7357 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_17darma_innovations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations(__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_5numpy_float64_t __pyx_v_sigma2,CYTHON_UNUSED int __pyx_skip_dispatch)7358 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations(__Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_5numpy_float64_t __pyx_v_sigma2, CYTHON_UNUSED int __pyx_skip_dispatch) {
7359   Py_ssize_t __pyx_v_nobs;
7360   Py_ssize_t __pyx_v_i;
7361   __Pyx_memviewslice __pyx_v_ar = { 0, 0, { 0 }, { 0 }, { 0 } };
7362   __Pyx_memviewslice __pyx_v_ma = { 0, 0, { 0 }, { 0 }, { 0 } };
7363   __Pyx_memviewslice __pyx_v_arma_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
7364   __Pyx_memviewslice __pyx_v_acovf2 = { 0, 0, { 0 }, { 0 }, { 0 } };
7365   __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
7366   __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
7367   __Pyx_memviewslice __pyx_v_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
7368   npy_intp __pyx_v_dim1[1];
7369   PyObject *__pyx_v_theta = NULL;
7370   PyObject *__pyx_r = NULL;
7371   __Pyx_RefNannyDeclarations
7372   size_t __pyx_t_1;
7373   PyObject *__pyx_t_2 = NULL;
7374   __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
7375   Py_ssize_t __pyx_t_4;
7376   Py_ssize_t __pyx_t_5;
7377   Py_ssize_t __pyx_t_6;
7378   Py_ssize_t __pyx_t_7;
7379   Py_ssize_t __pyx_t_8;
7380   int __pyx_t_9;
7381   PyObject *__pyx_t_10 = NULL;
7382   PyObject *__pyx_t_11 = NULL;
7383   PyObject *__pyx_t_12 = NULL;
7384   PyObject *__pyx_t_13 = NULL;
7385   PyObject *__pyx_t_14 = NULL;
7386   PyObject *(*__pyx_t_15)(PyObject *);
7387   __Pyx_memviewslice __pyx_t_16 = { 0, 0, { 0 }, { 0 }, { 0 } };
7388   int __pyx_lineno = 0;
7389   const char *__pyx_filename = NULL;
7390   int __pyx_clineno = 0;
7391   __Pyx_RefNannySetupContext("darma_innovations", 0);
7392 
7393   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":826
7394  *        New York, NY: Springer.
7395  *     """
7396  *     cdef Py_ssize_t nobs = len(endog), i             # <<<<<<<<<<<<<<
7397  *     cdef cnp.float64_t const
7398  *     cdef cnp.float64_t [:] ar, ma, arma_acovf, llf_obs, acovf2, u, v
7399  */
7400   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_endog);
7401   __pyx_v_nobs = __pyx_t_1;
7402 
7403   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":832
7404  *     cdef cnp.npy_intp dim1[1]
7405  *
7406  *     dim1[0] = len(ar_params) + 1;             # <<<<<<<<<<<<<<
7407  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
7408  *     dim1[0] = len(ma_params) + 1;
7409  */
7410   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
7411   (__pyx_v_dim1[0]) = (__pyx_t_1 + 1);
7412 
7413   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":833
7414  *
7415  *     dim1[0] = len(ar_params) + 1;
7416  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)             # <<<<<<<<<<<<<<
7417  *     dim1[0] = len(ma_params) + 1;
7418  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
7419  */
7420   __pyx_t_2 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_FLOAT64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 833, __pyx_L1_error)
7421   __Pyx_GOTREF(__pyx_t_2);
7422   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 833, __pyx_L1_error)
7423   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7424   __pyx_v_ar = __pyx_t_3;
7425   __pyx_t_3.memview = NULL;
7426   __pyx_t_3.data = NULL;
7427 
7428   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":834
7429  *     dim1[0] = len(ar_params) + 1;
7430  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
7431  *     dim1[0] = len(ma_params) + 1;             # <<<<<<<<<<<<<<
7432  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
7433  *
7434  */
7435   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma_params);
7436   (__pyx_v_dim1[0]) = (__pyx_t_1 + 1);
7437 
7438   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":835
7439  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
7440  *     dim1[0] = len(ma_params) + 1;
7441  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)             # <<<<<<<<<<<<<<
7442  *
7443  *     ar[0] = 1
7444  */
7445   __pyx_t_2 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_FLOAT64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 835, __pyx_L1_error)
7446   __Pyx_GOTREF(__pyx_t_2);
7447   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 835, __pyx_L1_error)
7448   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7449   __pyx_v_ma = __pyx_t_3;
7450   __pyx_t_3.memview = NULL;
7451   __pyx_t_3.data = NULL;
7452 
7453   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":837
7454  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
7455  *
7456  *     ar[0] = 1             # <<<<<<<<<<<<<<
7457  *     for i in range(1, len(ar_params) + 1):
7458  *         ar[i] = -1 * ar_params[i - 1]
7459  */
7460   __pyx_t_4 = 0;
7461   *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_ar.data + __pyx_t_4 * __pyx_v_ar.strides[0]) )) = 1.0;
7462 
7463   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":838
7464  *
7465  *     ar[0] = 1
7466  *     for i in range(1, len(ar_params) + 1):             # <<<<<<<<<<<<<<
7467  *         ar[i] = -1 * ar_params[i - 1]
7468  *     ma[0] = 1
7469  */
7470   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
7471   __pyx_t_5 = (__pyx_t_1 + 1);
7472   __pyx_t_6 = __pyx_t_5;
7473   for (__pyx_t_7 = 1; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
7474     __pyx_v_i = __pyx_t_7;
7475 
7476     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":839
7477  *     ar[0] = 1
7478  *     for i in range(1, len(ar_params) + 1):
7479  *         ar[i] = -1 * ar_params[i - 1]             # <<<<<<<<<<<<<<
7480  *     ma[0] = 1
7481  *     ma[1:] = ma_params
7482  */
7483     __pyx_t_4 = (__pyx_v_i - 1);
7484     __pyx_t_8 = __pyx_v_i;
7485     *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_ar.data + __pyx_t_8 * __pyx_v_ar.strides[0]) )) = (-1.0 * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_ar_params.data + __pyx_t_4 * __pyx_v_ar_params.strides[0]) ))));
7486   }
7487 
7488   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":840
7489  *     for i in range(1, len(ar_params) + 1):
7490  *         ar[i] = -1 * ar_params[i - 1]
7491  *     ma[0] = 1             # <<<<<<<<<<<<<<
7492  *     ma[1:] = ma_params
7493  *
7494  */
7495   __pyx_t_4 = 0;
7496   *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_ma.data + __pyx_t_4 * __pyx_v_ma.strides[0]) )) = 1.0;
7497 
7498   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":841
7499  *         ar[i] = -1 * ar_params[i - 1]
7500  *     ma[0] = 1
7501  *     ma[1:] = ma_params             # <<<<<<<<<<<<<<
7502  *
7503  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=float) / sigma2
7504  */
7505   __pyx_t_3.data = __pyx_v_ma.data;
7506   __pyx_t_3.memview = __pyx_v_ma.memview;
7507   __PYX_INC_MEMVIEW(&__pyx_t_3, 0);
7508   __pyx_t_9 = -1;
7509   if (unlikely(__pyx_memoryview_slice_memviewslice(
7510     &__pyx_t_3,
7511     __pyx_v_ma.shape[0], __pyx_v_ma.strides[0], __pyx_v_ma.suboffsets[0],
7512     0,
7513     0,
7514     &__pyx_t_9,
7515     1,
7516     0,
7517     0,
7518     1,
7519     0,
7520     0,
7521     1) < 0))
7522 {
7523     __PYX_ERR(0, 841, __pyx_L1_error)
7524 }
7525 
7526 if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_ma_params, __pyx_t_3, 1, 1, 0) < 0)) __PYX_ERR(0, 841, __pyx_L1_error)
7527   __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
7528   __pyx_t_3.memview = NULL;
7529   __pyx_t_3.data = NULL;
7530 
7531   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":843
7532  *     ma[1:] = ma_params
7533  *
7534  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=float) / sigma2             # <<<<<<<<<<<<<<
7535  *     acovf, acovf2 = darma_transformed_acovf_fast(ar, ma, arma_acovf)
7536  *     theta, v = darma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)
7537  */
7538   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_arima_process); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 843, __pyx_L1_error)
7539   __Pyx_GOTREF(__pyx_t_2);
7540   __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_arma_acovf); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 843, __pyx_L1_error)
7541   __Pyx_GOTREF(__pyx_t_10);
7542   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7543   __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_ar, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 843, __pyx_L1_error)
7544   __Pyx_GOTREF(__pyx_t_2);
7545   __pyx_t_11 = __pyx_memoryview_fromslice(__pyx_v_ma, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 843, __pyx_L1_error)
7546   __Pyx_GOTREF(__pyx_t_11);
7547   __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_nobs); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 843, __pyx_L1_error)
7548   __Pyx_GOTREF(__pyx_t_12);
7549   __pyx_t_13 = PyFloat_FromDouble(__pyx_v_sigma2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 843, __pyx_L1_error)
7550   __Pyx_GOTREF(__pyx_t_13);
7551   __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 843, __pyx_L1_error)
7552   __Pyx_GOTREF(__pyx_t_14);
7553   __Pyx_GIVEREF(__pyx_t_2);
7554   PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2);
7555   __Pyx_GIVEREF(__pyx_t_11);
7556   PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_11);
7557   __Pyx_GIVEREF(__pyx_t_12);
7558   PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_12);
7559   __Pyx_GIVEREF(__pyx_t_13);
7560   PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_13);
7561   __pyx_t_2 = 0;
7562   __pyx_t_11 = 0;
7563   __pyx_t_12 = 0;
7564   __pyx_t_13 = 0;
7565   __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 843, __pyx_L1_error)
7566   __Pyx_GOTREF(__pyx_t_13);
7567   if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 843, __pyx_L1_error)
7568   __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 843, __pyx_L1_error)
7569   __Pyx_GOTREF(__pyx_t_12);
7570   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7571   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7572   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7573   __pyx_t_13 = PyFloat_FromDouble(__pyx_v_sigma2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 843, __pyx_L1_error)
7574   __Pyx_GOTREF(__pyx_t_13);
7575   __pyx_t_14 = __Pyx_PyNumber_Divide(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 843, __pyx_L1_error)
7576   __Pyx_GOTREF(__pyx_t_14);
7577   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7578   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7579   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_14, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 843, __pyx_L1_error)
7580   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7581   __pyx_v_arma_acovf = __pyx_t_3;
7582   __pyx_t_3.memview = NULL;
7583   __pyx_t_3.data = NULL;
7584 
7585   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":844
7586  *
7587  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=float) / sigma2
7588  *     acovf, acovf2 = darma_transformed_acovf_fast(ar, ma, arma_acovf)             # <<<<<<<<<<<<<<
7589  *     theta, v = darma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)
7590  *     u = darma_innovations_filter(endog, ar_params, ma_params, theta)
7591  */
7592   __pyx_t_14 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_transformed_acovf_fast(__pyx_v_ar, __pyx_v_ma, __pyx_v_arma_acovf, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 844, __pyx_L1_error)
7593   __Pyx_GOTREF(__pyx_t_14);
7594   if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
7595     PyObject* sequence = __pyx_t_14;
7596     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7597     if (unlikely(size != 2)) {
7598       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7599       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7600       __PYX_ERR(0, 844, __pyx_L1_error)
7601     }
7602     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7603     if (likely(PyTuple_CheckExact(sequence))) {
7604       __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0);
7605       __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1);
7606     } else {
7607       __pyx_t_13 = PyList_GET_ITEM(sequence, 0);
7608       __pyx_t_12 = PyList_GET_ITEM(sequence, 1);
7609     }
7610     __Pyx_INCREF(__pyx_t_13);
7611     __Pyx_INCREF(__pyx_t_12);
7612     #else
7613     __pyx_t_13 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 844, __pyx_L1_error)
7614     __Pyx_GOTREF(__pyx_t_13);
7615     __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 844, __pyx_L1_error)
7616     __Pyx_GOTREF(__pyx_t_12);
7617     #endif
7618     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7619   } else {
7620     Py_ssize_t index = -1;
7621     __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 844, __pyx_L1_error)
7622     __Pyx_GOTREF(__pyx_t_10);
7623     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7624     __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
7625     index = 0; __pyx_t_13 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_13)) goto __pyx_L5_unpacking_failed;
7626     __Pyx_GOTREF(__pyx_t_13);
7627     index = 1; __pyx_t_12 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_12)) goto __pyx_L5_unpacking_failed;
7628     __Pyx_GOTREF(__pyx_t_12);
7629     if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_10), 2) < 0) __PYX_ERR(0, 844, __pyx_L1_error)
7630     __pyx_t_15 = NULL;
7631     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7632     goto __pyx_L6_unpacking_done;
7633     __pyx_L5_unpacking_failed:;
7634     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7635     __pyx_t_15 = NULL;
7636     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7637     __PYX_ERR(0, 844, __pyx_L1_error)
7638     __pyx_L6_unpacking_done:;
7639   }
7640   __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_t_13, PyBUF_WRITABLE); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 844, __pyx_L1_error)
7641   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7642   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_12, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 844, __pyx_L1_error)
7643   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7644   __pyx_v_acovf = __pyx_t_16;
7645   __pyx_t_16.memview = NULL;
7646   __pyx_t_16.data = NULL;
7647   __pyx_v_acovf2 = __pyx_t_3;
7648   __pyx_t_3.memview = NULL;
7649   __pyx_t_3.data = NULL;
7650 
7651   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":845
7652  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=float) / sigma2
7653  *     acovf, acovf2 = darma_transformed_acovf_fast(ar, ma, arma_acovf)
7654  *     theta, v = darma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)             # <<<<<<<<<<<<<<
7655  *     u = darma_innovations_filter(endog, ar_params, ma_params, theta)
7656  *
7657  */
7658   __pyx_t_14 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations_algo_fast(__pyx_v_nobs, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_acovf, __pyx_v_acovf2, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 845, __pyx_L1_error)
7659   __Pyx_GOTREF(__pyx_t_14);
7660   if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
7661     PyObject* sequence = __pyx_t_14;
7662     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7663     if (unlikely(size != 2)) {
7664       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7665       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7666       __PYX_ERR(0, 845, __pyx_L1_error)
7667     }
7668     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7669     if (likely(PyTuple_CheckExact(sequence))) {
7670       __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0);
7671       __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
7672     } else {
7673       __pyx_t_12 = PyList_GET_ITEM(sequence, 0);
7674       __pyx_t_13 = PyList_GET_ITEM(sequence, 1);
7675     }
7676     __Pyx_INCREF(__pyx_t_12);
7677     __Pyx_INCREF(__pyx_t_13);
7678     #else
7679     __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 845, __pyx_L1_error)
7680     __Pyx_GOTREF(__pyx_t_12);
7681     __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 845, __pyx_L1_error)
7682     __Pyx_GOTREF(__pyx_t_13);
7683     #endif
7684     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7685   } else {
7686     Py_ssize_t index = -1;
7687     __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 845, __pyx_L1_error)
7688     __Pyx_GOTREF(__pyx_t_10);
7689     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7690     __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
7691     index = 0; __pyx_t_12 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_12)) goto __pyx_L7_unpacking_failed;
7692     __Pyx_GOTREF(__pyx_t_12);
7693     index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_13)) goto __pyx_L7_unpacking_failed;
7694     __Pyx_GOTREF(__pyx_t_13);
7695     if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_10), 2) < 0) __PYX_ERR(0, 845, __pyx_L1_error)
7696     __pyx_t_15 = NULL;
7697     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7698     goto __pyx_L8_unpacking_done;
7699     __pyx_L7_unpacking_failed:;
7700     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7701     __pyx_t_15 = NULL;
7702     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7703     __PYX_ERR(0, 845, __pyx_L1_error)
7704     __pyx_L8_unpacking_done:;
7705   }
7706   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_13, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 845, __pyx_L1_error)
7707   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7708   __pyx_v_theta = __pyx_t_12;
7709   __pyx_t_12 = 0;
7710   __pyx_v_v = __pyx_t_3;
7711   __pyx_t_3.memview = NULL;
7712   __pyx_t_3.data = NULL;
7713 
7714   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":846
7715  *     acovf, acovf2 = darma_transformed_acovf_fast(ar, ma, arma_acovf)
7716  *     theta, v = darma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)
7717  *     u = darma_innovations_filter(endog, ar_params, ma_params, theta)             # <<<<<<<<<<<<<<
7718  *
7719  *     return u, v
7720  */
7721   __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_v_theta, PyBUF_WRITABLE); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 846, __pyx_L1_error)
7722   __pyx_t_14 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations_filter(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_t_16, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 846, __pyx_L1_error)
7723   __Pyx_GOTREF(__pyx_t_14);
7724   __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
7725   __pyx_t_16.memview = NULL;
7726   __pyx_t_16.data = NULL;
7727   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_14, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 846, __pyx_L1_error)
7728   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7729   __pyx_v_u = __pyx_t_3;
7730   __pyx_t_3.memview = NULL;
7731   __pyx_t_3.data = NULL;
7732 
7733   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":848
7734  *     u = darma_innovations_filter(endog, ar_params, ma_params, theta)
7735  *
7736  *     return u, v             # <<<<<<<<<<<<<<
7737  *
7738  *
7739  */
7740   __Pyx_XDECREF(__pyx_r);
7741   __pyx_t_14 = __pyx_memoryview_fromslice(__pyx_v_u, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 848, __pyx_L1_error)
7742   __Pyx_GOTREF(__pyx_t_14);
7743   __pyx_t_13 = __pyx_memoryview_fromslice(__pyx_v_v, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 848, __pyx_L1_error)
7744   __Pyx_GOTREF(__pyx_t_13);
7745   __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 848, __pyx_L1_error)
7746   __Pyx_GOTREF(__pyx_t_12);
7747   __Pyx_GIVEREF(__pyx_t_14);
7748   PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14);
7749   __Pyx_GIVEREF(__pyx_t_13);
7750   PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_13);
7751   __pyx_t_14 = 0;
7752   __pyx_t_13 = 0;
7753   __pyx_r = __pyx_t_12;
7754   __pyx_t_12 = 0;
7755   goto __pyx_L0;
7756 
7757   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":788
7758  *
7759  *
7760  * cpdef darma_innovations(cnp.float64_t [:] endog,             # <<<<<<<<<<<<<<
7761  *                                       cnp.float64_t [:] ar_params,
7762  *                                       cnp.float64_t [:] ma_params,
7763  */
7764 
7765   /* function exit code */
7766   __pyx_L1_error:;
7767   __Pyx_XDECREF(__pyx_t_2);
7768   __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
7769   __Pyx_XDECREF(__pyx_t_10);
7770   __Pyx_XDECREF(__pyx_t_11);
7771   __Pyx_XDECREF(__pyx_t_12);
7772   __Pyx_XDECREF(__pyx_t_13);
7773   __Pyx_XDECREF(__pyx_t_14);
7774   __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
7775   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
7776   __pyx_r = 0;
7777   __pyx_L0:;
7778   __PYX_XDEC_MEMVIEW(&__pyx_v_ar, 1);
7779   __PYX_XDEC_MEMVIEW(&__pyx_v_ma, 1);
7780   __PYX_XDEC_MEMVIEW(&__pyx_v_arma_acovf, 1);
7781   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf2, 1);
7782   __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
7783   __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
7784   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf, 1);
7785   __Pyx_XDECREF(__pyx_v_theta);
7786   __Pyx_XGIVEREF(__pyx_r);
7787   __Pyx_RefNannyFinishContext();
7788   return __pyx_r;
7789 }
7790 
7791 /* Python wrapper */
7792 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_17darma_innovations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7793 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_16darma_innovations[] = "\n    arma_innovations(cnp.float64_t [:] endog, cnp.float64_t [:] ar_params, cnp.float64_t [:] ma_params):\n    \n    Compute innovations and variances based on an ARMA process.\n\n    Parameters\n    ----------\n    endog : ndarray\n        The observed time-series process.\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    sigma2 : ndarray\n        The ARMA innovation variance.\n\n    Returns\n    -------\n    u : ndarray\n        The vector of innovations: the one-step-ahead prediction errors from\n        applying the innovations algorithm.\n    v : ndarray\n        The vector of innovation variances.\n\n    Notes\n    -----\n    The innovations algorithm is presented in _[1], section 2.5.2.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_17darma_innovations(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7794 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_17darma_innovations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7795   __Pyx_memviewslice __pyx_v_endog = { 0, 0, { 0 }, { 0 }, { 0 } };
7796   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
7797   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
7798   __pyx_t_5numpy_float64_t __pyx_v_sigma2;
7799   int __pyx_lineno = 0;
7800   const char *__pyx_filename = NULL;
7801   int __pyx_clineno = 0;
7802   PyObject *__pyx_r = 0;
7803   __Pyx_RefNannyDeclarations
7804   __Pyx_RefNannySetupContext("darma_innovations (wrapper)", 0);
7805   {
7806     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_sigma2,0};
7807     PyObject* values[4] = {0,0,0,0};
7808     if (unlikely(__pyx_kwds)) {
7809       Py_ssize_t kw_args;
7810       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7811       switch (pos_args) {
7812         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7813         CYTHON_FALLTHROUGH;
7814         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7815         CYTHON_FALLTHROUGH;
7816         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7817         CYTHON_FALLTHROUGH;
7818         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7819         CYTHON_FALLTHROUGH;
7820         case  0: break;
7821         default: goto __pyx_L5_argtuple_error;
7822       }
7823       kw_args = PyDict_Size(__pyx_kwds);
7824       switch (pos_args) {
7825         case  0:
7826         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
7827         else goto __pyx_L5_argtuple_error;
7828         CYTHON_FALLTHROUGH;
7829         case  1:
7830         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
7831         else {
7832           __Pyx_RaiseArgtupleInvalid("darma_innovations", 1, 4, 4, 1); __PYX_ERR(0, 788, __pyx_L3_error)
7833         }
7834         CYTHON_FALLTHROUGH;
7835         case  2:
7836         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
7837         else {
7838           __Pyx_RaiseArgtupleInvalid("darma_innovations", 1, 4, 4, 2); __PYX_ERR(0, 788, __pyx_L3_error)
7839         }
7840         CYTHON_FALLTHROUGH;
7841         case  3:
7842         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma2)) != 0)) kw_args--;
7843         else {
7844           __Pyx_RaiseArgtupleInvalid("darma_innovations", 1, 4, 4, 3); __PYX_ERR(0, 788, __pyx_L3_error)
7845         }
7846       }
7847       if (unlikely(kw_args > 0)) {
7848         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "darma_innovations") < 0)) __PYX_ERR(0, 788, __pyx_L3_error)
7849       }
7850     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
7851       goto __pyx_L5_argtuple_error;
7852     } else {
7853       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7854       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7855       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7856       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7857     }
7858     __pyx_v_endog = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_endog.memview)) __PYX_ERR(0, 788, __pyx_L3_error)
7859     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 789, __pyx_L3_error)
7860     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 790, __pyx_L3_error)
7861     __pyx_v_sigma2 = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_sigma2 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 791, __pyx_L3_error)
7862   }
7863   goto __pyx_L4_argument_unpacking_done;
7864   __pyx_L5_argtuple_error:;
7865   __Pyx_RaiseArgtupleInvalid("darma_innovations", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 788, __pyx_L3_error)
7866   __pyx_L3_error:;
7867   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
7868   __Pyx_RefNannyFinishContext();
7869   return NULL;
7870   __pyx_L4_argument_unpacking_done:;
7871   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_16darma_innovations(__pyx_self, __pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2);
7872 
7873   /* function exit code */
7874   __Pyx_RefNannyFinishContext();
7875   return __pyx_r;
7876 }
7877 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_16darma_innovations(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_5numpy_float64_t __pyx_v_sigma2)7878 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_16darma_innovations(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_5numpy_float64_t __pyx_v_sigma2) {
7879   PyObject *__pyx_r = NULL;
7880   __Pyx_RefNannyDeclarations
7881   PyObject *__pyx_t_1 = NULL;
7882   int __pyx_lineno = 0;
7883   const char *__pyx_filename = NULL;
7884   int __pyx_clineno = 0;
7885   __Pyx_RefNannySetupContext("darma_innovations", 0);
7886   __Pyx_XDECREF(__pyx_r);
7887   if (unlikely(!__pyx_v_endog.memview)) { __Pyx_RaiseUnboundLocalError("endog"); __PYX_ERR(0, 788, __pyx_L1_error) }
7888   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 788, __pyx_L1_error) }
7889   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 788, __pyx_L1_error) }
7890   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 788, __pyx_L1_error)
7891   __Pyx_GOTREF(__pyx_t_1);
7892   __pyx_r = __pyx_t_1;
7893   __pyx_t_1 = 0;
7894   goto __pyx_L0;
7895 
7896   /* function exit code */
7897   __pyx_L1_error:;
7898   __Pyx_XDECREF(__pyx_t_1);
7899   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
7900   __pyx_r = NULL;
7901   __pyx_L0:;
7902   __PYX_XDEC_MEMVIEW(&__pyx_v_endog, 1);
7903   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
7904   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
7905   __Pyx_XGIVEREF(__pyx_r);
7906   __Pyx_RefNannyFinishContext();
7907   return __pyx_r;
7908 }
7909 
7910 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":851
7911  *
7912  *
7913  * cpdef darma_loglikeobs_fast(cnp.float64_t [:] endog,             # <<<<<<<<<<<<<<
7914  *                                      cnp.float64_t [:] ar_params,
7915  *                                      cnp.float64_t [:] ma_params,
7916  */
7917 
7918 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_19darma_loglikeobs_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_loglikeobs_fast(__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_5numpy_float64_t __pyx_v_sigma2,CYTHON_UNUSED int __pyx_skip_dispatch)7919 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_loglikeobs_fast(__Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_5numpy_float64_t __pyx_v_sigma2, CYTHON_UNUSED int __pyx_skip_dispatch) {
7920   Py_ssize_t __pyx_v_nobs;
7921   Py_ssize_t __pyx_v_i;
7922   __pyx_t_5numpy_float64_t __pyx_v_const;
7923   __Pyx_memviewslice __pyx_v_llf_obs = { 0, 0, { 0 }, { 0 }, { 0 } };
7924   __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
7925   __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
7926   npy_intp __pyx_v_dim1[1];
7927   PyObject *__pyx_r = NULL;
7928   __Pyx_RefNannyDeclarations
7929   size_t __pyx_t_1;
7930   PyObject *__pyx_t_2 = NULL;
7931   PyObject *__pyx_t_3 = NULL;
7932   PyObject *__pyx_t_4 = NULL;
7933   PyObject *__pyx_t_5 = NULL;
7934   PyObject *(*__pyx_t_6)(PyObject *);
7935   __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
7936   __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
7937   Py_ssize_t __pyx_t_9;
7938   Py_ssize_t __pyx_t_10;
7939   Py_ssize_t __pyx_t_11;
7940   Py_ssize_t __pyx_t_12;
7941   __pyx_t_5numpy_float64_t __pyx_t_13;
7942   __pyx_t_5numpy_float64_t __pyx_t_14;
7943   Py_ssize_t __pyx_t_15;
7944   int __pyx_lineno = 0;
7945   const char *__pyx_filename = NULL;
7946   int __pyx_clineno = 0;
7947   __Pyx_RefNannySetupContext("darma_loglikeobs_fast", 0);
7948 
7949   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":888
7950  *     """
7951  *
7952  *     cdef Py_ssize_t nobs = len(endog), i             # <<<<<<<<<<<<<<
7953  *     cdef cnp.float64_t const
7954  *     cdef cnp.float64_t [:] llf_obs, u, v
7955  */
7956   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_endog);
7957   __pyx_v_nobs = __pyx_t_1;
7958 
7959   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":893
7960  *     cdef cnp.npy_intp dim1[1]
7961  *
7962  *     u, v = darma_innovations(endog, ar_params, ma_params, sigma2)             # <<<<<<<<<<<<<<
7963  *
7964  *     dim1[0] = nobs;
7965  */
7966   __pyx_t_2 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_innovations(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 893, __pyx_L1_error)
7967   __Pyx_GOTREF(__pyx_t_2);
7968   if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
7969     PyObject* sequence = __pyx_t_2;
7970     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7971     if (unlikely(size != 2)) {
7972       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7973       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7974       __PYX_ERR(0, 893, __pyx_L1_error)
7975     }
7976     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7977     if (likely(PyTuple_CheckExact(sequence))) {
7978       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
7979       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
7980     } else {
7981       __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
7982       __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
7983     }
7984     __Pyx_INCREF(__pyx_t_3);
7985     __Pyx_INCREF(__pyx_t_4);
7986     #else
7987     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 893, __pyx_L1_error)
7988     __Pyx_GOTREF(__pyx_t_3);
7989     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 893, __pyx_L1_error)
7990     __Pyx_GOTREF(__pyx_t_4);
7991     #endif
7992     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7993   } else {
7994     Py_ssize_t index = -1;
7995     __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 893, __pyx_L1_error)
7996     __Pyx_GOTREF(__pyx_t_5);
7997     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7998     __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
7999     index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
8000     __Pyx_GOTREF(__pyx_t_3);
8001     index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
8002     __Pyx_GOTREF(__pyx_t_4);
8003     if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 893, __pyx_L1_error)
8004     __pyx_t_6 = NULL;
8005     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8006     goto __pyx_L4_unpacking_done;
8007     __pyx_L3_unpacking_failed:;
8008     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8009     __pyx_t_6 = NULL;
8010     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
8011     __PYX_ERR(0, 893, __pyx_L1_error)
8012     __pyx_L4_unpacking_done:;
8013   }
8014   __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 893, __pyx_L1_error)
8015   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8016   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 893, __pyx_L1_error)
8017   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8018   __pyx_v_u = __pyx_t_7;
8019   __pyx_t_7.memview = NULL;
8020   __pyx_t_7.data = NULL;
8021   __pyx_v_v = __pyx_t_8;
8022   __pyx_t_8.memview = NULL;
8023   __pyx_t_8.data = NULL;
8024 
8025   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":895
8026  *     u, v = darma_innovations(endog, ar_params, ma_params, sigma2)
8027  *
8028  *     dim1[0] = nobs;             # <<<<<<<<<<<<<<
8029  *     llf_obs = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
8030  *
8031  */
8032   (__pyx_v_dim1[0]) = __pyx_v_nobs;
8033 
8034   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":896
8035  *
8036  *     dim1[0] = nobs;
8037  *     llf_obs = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)             # <<<<<<<<<<<<<<
8038  *
8039  *     const = dlog(2*NPY_PI)
8040  */
8041   __pyx_t_2 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_FLOAT64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
8042   __Pyx_GOTREF(__pyx_t_2);
8043   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 896, __pyx_L1_error)
8044   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8045   __pyx_v_llf_obs = __pyx_t_8;
8046   __pyx_t_8.memview = NULL;
8047   __pyx_t_8.data = NULL;
8048 
8049   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":898
8050  *     llf_obs = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_FLOAT64, C)
8051  *
8052  *     const = dlog(2*NPY_PI)             # <<<<<<<<<<<<<<
8053  *     for i in range(nobs):
8054  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + dlog(sigma2 * v[i]))
8055  */
8056   __pyx_v_const = log((2.0 * NPY_PI));
8057 
8058   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":899
8059  *
8060  *     const = dlog(2*NPY_PI)
8061  *     for i in range(nobs):             # <<<<<<<<<<<<<<
8062  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + dlog(sigma2 * v[i]))
8063  *
8064  */
8065   __pyx_t_9 = __pyx_v_nobs;
8066   __pyx_t_10 = __pyx_t_9;
8067   for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
8068     __pyx_v_i = __pyx_t_11;
8069 
8070     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":900
8071  *     const = dlog(2*NPY_PI)
8072  *     for i in range(nobs):
8073  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + dlog(sigma2 * v[i]))             # <<<<<<<<<<<<<<
8074  *
8075  *     return np.array(llf_obs, dtype=float)
8076  */
8077     __pyx_t_12 = __pyx_v_i;
8078     __pyx_t_13 = (-0.5 * pow((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_12 * __pyx_v_u.strides[0]) ))), 2.0));
8079     __pyx_t_12 = __pyx_v_i;
8080     __pyx_t_14 = (__pyx_v_sigma2 * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_12 * __pyx_v_v.strides[0]) ))));
8081     if (unlikely(__pyx_t_14 == 0)) {
8082       PyErr_SetString(PyExc_ZeroDivisionError, "float division");
8083       __PYX_ERR(0, 900, __pyx_L1_error)
8084     }
8085     __pyx_t_12 = __pyx_v_i;
8086     __pyx_t_15 = __pyx_v_i;
8087     *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_llf_obs.data + __pyx_t_15 * __pyx_v_llf_obs.strides[0]) )) = ((__pyx_t_13 / __pyx_t_14) - (0.5 * (__pyx_v_const + log((__pyx_v_sigma2 * (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_12 * __pyx_v_v.strides[0]) ))))))));
8088   }
8089 
8090   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":902
8091  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + dlog(sigma2 * v[i]))
8092  *
8093  *     return np.array(llf_obs, dtype=float)             # <<<<<<<<<<<<<<
8094  *
8095  *
8096  */
8097   __Pyx_XDECREF(__pyx_r);
8098   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 902, __pyx_L1_error)
8099   __Pyx_GOTREF(__pyx_t_2);
8100   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 902, __pyx_L1_error)
8101   __Pyx_GOTREF(__pyx_t_4);
8102   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8103   __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_llf_obs, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 902, __pyx_L1_error)
8104   __Pyx_GOTREF(__pyx_t_2);
8105   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 902, __pyx_L1_error)
8106   __Pyx_GOTREF(__pyx_t_3);
8107   __Pyx_GIVEREF(__pyx_t_2);
8108   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
8109   __pyx_t_2 = 0;
8110   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 902, __pyx_L1_error)
8111   __Pyx_GOTREF(__pyx_t_2);
8112   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 902, __pyx_L1_error)
8113   __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 902, __pyx_L1_error)
8114   __Pyx_GOTREF(__pyx_t_5);
8115   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8116   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8117   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8118   __pyx_r = __pyx_t_5;
8119   __pyx_t_5 = 0;
8120   goto __pyx_L0;
8121 
8122   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":851
8123  *
8124  *
8125  * cpdef darma_loglikeobs_fast(cnp.float64_t [:] endog,             # <<<<<<<<<<<<<<
8126  *                                      cnp.float64_t [:] ar_params,
8127  *                                      cnp.float64_t [:] ma_params,
8128  */
8129 
8130   /* function exit code */
8131   __pyx_L1_error:;
8132   __Pyx_XDECREF(__pyx_t_2);
8133   __Pyx_XDECREF(__pyx_t_3);
8134   __Pyx_XDECREF(__pyx_t_4);
8135   __Pyx_XDECREF(__pyx_t_5);
8136   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
8137   __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
8138   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_loglikeobs_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
8139   __pyx_r = 0;
8140   __pyx_L0:;
8141   __PYX_XDEC_MEMVIEW(&__pyx_v_llf_obs, 1);
8142   __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
8143   __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
8144   __Pyx_XGIVEREF(__pyx_r);
8145   __Pyx_RefNannyFinishContext();
8146   return __pyx_r;
8147 }
8148 
8149 /* Python wrapper */
8150 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_19darma_loglikeobs_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8151 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_18darma_loglikeobs_fast[] = "\n    darma_loglikeobs_fast(cnp.float64_t [:] endog, cnp.float64_t [:] ar_params, cnp.float64_t [:] ma_params, cnp.float64_t sigma2)\n\n    Quickly calculate the loglikelihood of each observation for an ARMA process\n\n    Parameters\n    ----------\n    endog : ndarray\n        The observed time-series process.\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    sigma2 : ndarray\n        The ARMA innovation variance.\n\n    Returns\n    -------\n    loglike : ndarray of float\n        Array of loglikelihood values for each observation.\n\n    Notes\n    -----\n    Details related to computing the loglikelihood associated with an ARMA\n    process using the innovations algorithm are given in _[1] section 5.2.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_19darma_loglikeobs_fast(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8152 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_19darma_loglikeobs_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8153   __Pyx_memviewslice __pyx_v_endog = { 0, 0, { 0 }, { 0 }, { 0 } };
8154   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
8155   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
8156   __pyx_t_5numpy_float64_t __pyx_v_sigma2;
8157   int __pyx_lineno = 0;
8158   const char *__pyx_filename = NULL;
8159   int __pyx_clineno = 0;
8160   PyObject *__pyx_r = 0;
8161   __Pyx_RefNannyDeclarations
8162   __Pyx_RefNannySetupContext("darma_loglikeobs_fast (wrapper)", 0);
8163   {
8164     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_sigma2,0};
8165     PyObject* values[4] = {0,0,0,0};
8166     if (unlikely(__pyx_kwds)) {
8167       Py_ssize_t kw_args;
8168       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8169       switch (pos_args) {
8170         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8171         CYTHON_FALLTHROUGH;
8172         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8173         CYTHON_FALLTHROUGH;
8174         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8175         CYTHON_FALLTHROUGH;
8176         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8177         CYTHON_FALLTHROUGH;
8178         case  0: break;
8179         default: goto __pyx_L5_argtuple_error;
8180       }
8181       kw_args = PyDict_Size(__pyx_kwds);
8182       switch (pos_args) {
8183         case  0:
8184         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
8185         else goto __pyx_L5_argtuple_error;
8186         CYTHON_FALLTHROUGH;
8187         case  1:
8188         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
8189         else {
8190           __Pyx_RaiseArgtupleInvalid("darma_loglikeobs_fast", 1, 4, 4, 1); __PYX_ERR(0, 851, __pyx_L3_error)
8191         }
8192         CYTHON_FALLTHROUGH;
8193         case  2:
8194         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
8195         else {
8196           __Pyx_RaiseArgtupleInvalid("darma_loglikeobs_fast", 1, 4, 4, 2); __PYX_ERR(0, 851, __pyx_L3_error)
8197         }
8198         CYTHON_FALLTHROUGH;
8199         case  3:
8200         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma2)) != 0)) kw_args--;
8201         else {
8202           __Pyx_RaiseArgtupleInvalid("darma_loglikeobs_fast", 1, 4, 4, 3); __PYX_ERR(0, 851, __pyx_L3_error)
8203         }
8204       }
8205       if (unlikely(kw_args > 0)) {
8206         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "darma_loglikeobs_fast") < 0)) __PYX_ERR(0, 851, __pyx_L3_error)
8207       }
8208     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
8209       goto __pyx_L5_argtuple_error;
8210     } else {
8211       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8212       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8213       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8214       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8215     }
8216     __pyx_v_endog = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_endog.memview)) __PYX_ERR(0, 851, __pyx_L3_error)
8217     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 852, __pyx_L3_error)
8218     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 853, __pyx_L3_error)
8219     __pyx_v_sigma2 = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_sigma2 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 854, __pyx_L3_error)
8220   }
8221   goto __pyx_L4_argument_unpacking_done;
8222   __pyx_L5_argtuple_error:;
8223   __Pyx_RaiseArgtupleInvalid("darma_loglikeobs_fast", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 851, __pyx_L3_error)
8224   __pyx_L3_error:;
8225   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_loglikeobs_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
8226   __Pyx_RefNannyFinishContext();
8227   return NULL;
8228   __pyx_L4_argument_unpacking_done:;
8229   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_18darma_loglikeobs_fast(__pyx_self, __pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2);
8230 
8231   /* function exit code */
8232   __Pyx_RefNannyFinishContext();
8233   return __pyx_r;
8234 }
8235 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_18darma_loglikeobs_fast(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_5numpy_float64_t __pyx_v_sigma2)8236 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_18darma_loglikeobs_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_5numpy_float64_t __pyx_v_sigma2) {
8237   PyObject *__pyx_r = NULL;
8238   __Pyx_RefNannyDeclarations
8239   PyObject *__pyx_t_1 = NULL;
8240   int __pyx_lineno = 0;
8241   const char *__pyx_filename = NULL;
8242   int __pyx_clineno = 0;
8243   __Pyx_RefNannySetupContext("darma_loglikeobs_fast", 0);
8244   __Pyx_XDECREF(__pyx_r);
8245   if (unlikely(!__pyx_v_endog.memview)) { __Pyx_RaiseUnboundLocalError("endog"); __PYX_ERR(0, 851, __pyx_L1_error) }
8246   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 851, __pyx_L1_error) }
8247   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 851, __pyx_L1_error) }
8248   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_darma_loglikeobs_fast(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error)
8249   __Pyx_GOTREF(__pyx_t_1);
8250   __pyx_r = __pyx_t_1;
8251   __pyx_t_1 = 0;
8252   goto __pyx_L0;
8253 
8254   /* function exit code */
8255   __pyx_L1_error:;
8256   __Pyx_XDECREF(__pyx_t_1);
8257   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.darma_loglikeobs_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
8258   __pyx_r = NULL;
8259   __pyx_L0:;
8260   __PYX_XDEC_MEMVIEW(&__pyx_v_endog, 1);
8261   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
8262   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
8263   __Pyx_XGIVEREF(__pyx_r);
8264   __Pyx_RefNannyFinishContext();
8265   return __pyx_r;
8266 }
8267 
8268 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":905
8269  *
8270  *
8271  * cdef ctoeplitz(int n, int offset0, int offset1,             # <<<<<<<<<<<<<<
8272  *                         cnp.complex64_t [:] in_column,
8273  *                         cnp.complex64_t [:, :] out_matrix):
8274  */
8275 
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_ctoeplitz(int __pyx_v_n,int __pyx_v_offset0,int __pyx_v_offset1,__Pyx_memviewslice __pyx_v_in_column,__Pyx_memviewslice __pyx_v_out_matrix)8276 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_ctoeplitz(int __pyx_v_n, int __pyx_v_offset0, int __pyx_v_offset1, __Pyx_memviewslice __pyx_v_in_column, __Pyx_memviewslice __pyx_v_out_matrix) {
8277   Py_ssize_t __pyx_v_i;
8278   Py_ssize_t __pyx_v_j;
8279   PyObject *__pyx_r = NULL;
8280   __Pyx_RefNannyDeclarations
8281   int __pyx_t_1;
8282   int __pyx_t_2;
8283   Py_ssize_t __pyx_t_3;
8284   Py_ssize_t __pyx_t_4;
8285   Py_ssize_t __pyx_t_5;
8286   Py_ssize_t __pyx_t_6;
8287   Py_ssize_t __pyx_t_7;
8288   Py_ssize_t __pyx_t_8;
8289   Py_ssize_t __pyx_t_9;
8290   int __pyx_t_10;
8291   __Pyx_RefNannySetupContext("ctoeplitz", 0);
8292 
8293   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":935
8294  *     cdef Py_ssize_t i, j
8295  *
8296  *     for i in range(n):             # <<<<<<<<<<<<<<
8297  *         for j in range(i + 1):
8298  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
8299  */
8300   __pyx_t_1 = __pyx_v_n;
8301   __pyx_t_2 = __pyx_t_1;
8302   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
8303     __pyx_v_i = __pyx_t_3;
8304 
8305     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":936
8306  *
8307  *     for i in range(n):
8308  *         for j in range(i + 1):             # <<<<<<<<<<<<<<
8309  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
8310  *             if i != j:
8311  */
8312     __pyx_t_4 = (__pyx_v_i + 1);
8313     __pyx_t_5 = __pyx_t_4;
8314     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
8315       __pyx_v_j = __pyx_t_6;
8316 
8317       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":937
8318  *     for i in range(n):
8319  *         for j in range(i + 1):
8320  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]             # <<<<<<<<<<<<<<
8321  *             if i != j:
8322  *               # Note: scipy by default does complex conjugate, but not
8323  */
8324       __pyx_t_7 = (__pyx_v_i - __pyx_v_j);
8325       __pyx_t_8 = (__pyx_v_offset0 + __pyx_v_i);
8326       __pyx_t_9 = (__pyx_v_offset1 + __pyx_v_j);
8327       *((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out_matrix.data + __pyx_t_8 * __pyx_v_out_matrix.strides[0]) ) + __pyx_t_9 * __pyx_v_out_matrix.strides[1]) )) = (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_in_column.data + __pyx_t_7 * __pyx_v_in_column.strides[0]) )));
8328 
8329       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":938
8330  *         for j in range(i + 1):
8331  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
8332  *             if i != j:             # <<<<<<<<<<<<<<
8333  *               # Note: scipy by default does complex conjugate, but not
8334  *               # necessary here since we're only dealing with covariances,
8335  */
8336       __pyx_t_10 = ((__pyx_v_i != __pyx_v_j) != 0);
8337       if (__pyx_t_10) {
8338 
8339         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":944
8340  *               # differentiation, but in that case we do not want to apply
8341  *               # the conjugation anyway)
8342  *               out_matrix[offset0 + j, offset1 + i] = in_column[i - j]             # <<<<<<<<<<<<<<
8343  *
8344  *
8345  */
8346         __pyx_t_7 = (__pyx_v_i - __pyx_v_j);
8347         __pyx_t_9 = (__pyx_v_offset0 + __pyx_v_j);
8348         __pyx_t_8 = (__pyx_v_offset1 + __pyx_v_i);
8349         *((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out_matrix.data + __pyx_t_9 * __pyx_v_out_matrix.strides[0]) ) + __pyx_t_8 * __pyx_v_out_matrix.strides[1]) )) = (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_in_column.data + __pyx_t_7 * __pyx_v_in_column.strides[0]) )));
8350 
8351         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":938
8352  *         for j in range(i + 1):
8353  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
8354  *             if i != j:             # <<<<<<<<<<<<<<
8355  *               # Note: scipy by default does complex conjugate, but not
8356  *               # necessary here since we're only dealing with covariances,
8357  */
8358       }
8359     }
8360   }
8361 
8362   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":905
8363  *
8364  *
8365  * cdef ctoeplitz(int n, int offset0, int offset1,             # <<<<<<<<<<<<<<
8366  *                         cnp.complex64_t [:] in_column,
8367  *                         cnp.complex64_t [:, :] out_matrix):
8368  */
8369 
8370   /* function exit code */
8371   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8372   __Pyx_XGIVEREF(__pyx_r);
8373   __Pyx_RefNannyFinishContext();
8374   return __pyx_r;
8375 }
8376 
8377 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":947
8378  *
8379  *
8380  * cpdef carma_transformed_acovf_fast(cnp.complex64_t [:] ar,             # <<<<<<<<<<<<<<
8381  *                                             cnp.complex64_t [:] ma,
8382  *                                             cnp.complex64_t [:] arma_acovf):
8383  */
8384 
8385 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_21carma_transformed_acovf_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_transformed_acovf_fast(__Pyx_memviewslice __pyx_v_ar,__Pyx_memviewslice __pyx_v_ma,__Pyx_memviewslice __pyx_v_arma_acovf,CYTHON_UNUSED int __pyx_skip_dispatch)8386 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_transformed_acovf_fast(__Pyx_memviewslice __pyx_v_ar, __Pyx_memviewslice __pyx_v_ma, __Pyx_memviewslice __pyx_v_arma_acovf, CYTHON_UNUSED int __pyx_skip_dispatch) {
8387   Py_ssize_t __pyx_v_nobs;
8388   Py_ssize_t __pyx_v_p;
8389   Py_ssize_t __pyx_v_q;
8390   Py_ssize_t __pyx_v_m;
8391   Py_ssize_t __pyx_v_m2;
8392   Py_ssize_t __pyx_v_n;
8393   Py_ssize_t __pyx_v_i;
8394   Py_ssize_t __pyx_v_j;
8395   Py_ssize_t __pyx_v_r;
8396   Py_ssize_t __pyx_v_tmp_ix;
8397   npy_intp __pyx_v_dim1[1];
8398   npy_intp __pyx_v_dim2[2];
8399   __Pyx_memviewslice __pyx_v_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
8400   __Pyx_memviewslice __pyx_v_acovf2 = { 0, 0, { 0 }, { 0 }, { 0 } };
8401   PyObject *__pyx_r = NULL;
8402   __Pyx_RefNannyDeclarations
8403   size_t __pyx_t_1;
8404   Py_ssize_t __pyx_t_2;
8405   Py_ssize_t __pyx_t_3;
8406   Py_ssize_t __pyx_t_4;
8407   PyObject *__pyx_t_5 = NULL;
8408   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
8409   long __pyx_t_7;
8410   __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
8411   int __pyx_t_9;
8412   Py_ssize_t __pyx_t_10;
8413   Py_ssize_t __pyx_t_11;
8414   Py_ssize_t __pyx_t_12;
8415   Py_ssize_t __pyx_t_13;
8416   Py_ssize_t __pyx_t_14;
8417   Py_ssize_t __pyx_t_15;
8418   Py_ssize_t __pyx_t_16;
8419   Py_ssize_t __pyx_t_17;
8420   Py_ssize_t __pyx_t_18;
8421   PyObject *__pyx_t_19 = NULL;
8422   Py_ssize_t __pyx_t_20;
8423   Py_ssize_t __pyx_t_21;
8424   Py_ssize_t __pyx_t_22;
8425   Py_ssize_t __pyx_t_23;
8426   int __pyx_t_24;
8427   __Pyx_memviewslice __pyx_t_25 = { 0, 0, { 0 }, { 0 }, { 0 } };
8428   PyObject *__pyx_t_26 = NULL;
8429   int __pyx_lineno = 0;
8430   const char *__pyx_filename = NULL;
8431   int __pyx_clineno = 0;
8432   __Pyx_RefNannySetupContext("carma_transformed_acovf_fast", 0);
8433 
8434   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1017
8435  *     cdef cnp.complex64_t [:] acovf2
8436  *
8437  *     nobs = arma_acovf.shape[0]             # <<<<<<<<<<<<<<
8438  *     p = len(ar) - 1
8439  *     q = len(ma) - 1
8440  */
8441   __pyx_v_nobs = (__pyx_v_arma_acovf.shape[0]);
8442 
8443   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1018
8444  *
8445  *     nobs = arma_acovf.shape[0]
8446  *     p = len(ar) - 1             # <<<<<<<<<<<<<<
8447  *     q = len(ma) - 1
8448  *     m = max(p, q)
8449  */
8450   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar);
8451   __pyx_v_p = (__pyx_t_1 - 1);
8452 
8453   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1019
8454  *     nobs = arma_acovf.shape[0]
8455  *     p = len(ar) - 1
8456  *     q = len(ma) - 1             # <<<<<<<<<<<<<<
8457  *     m = max(p, q)
8458  *     m2 = 2 * m
8459  */
8460   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma);
8461   __pyx_v_q = (__pyx_t_1 - 1);
8462 
8463   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1020
8464  *     p = len(ar) - 1
8465  *     q = len(ma) - 1
8466  *     m = max(p, q)             # <<<<<<<<<<<<<<
8467  *     m2 = 2 * m
8468  *     n = min(m2, nobs)
8469  */
8470   __pyx_t_2 = __pyx_v_q;
8471   __pyx_t_3 = __pyx_v_p;
8472   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
8473     __pyx_t_4 = __pyx_t_2;
8474   } else {
8475     __pyx_t_4 = __pyx_t_3;
8476   }
8477   __pyx_v_m = __pyx_t_4;
8478 
8479   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1021
8480  *     q = len(ma) - 1
8481  *     m = max(p, q)
8482  *     m2 = 2 * m             # <<<<<<<<<<<<<<
8483  *     n = min(m2, nobs)
8484  *
8485  */
8486   __pyx_v_m2 = (2 * __pyx_v_m);
8487 
8488   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1022
8489  *     m = max(p, q)
8490  *     m2 = 2 * m
8491  *     n = min(m2, nobs)             # <<<<<<<<<<<<<<
8492  *
8493  *     dim2[0] = m2;
8494  */
8495   __pyx_t_4 = __pyx_v_nobs;
8496   __pyx_t_2 = __pyx_v_m2;
8497   if (((__pyx_t_4 < __pyx_t_2) != 0)) {
8498     __pyx_t_3 = __pyx_t_4;
8499   } else {
8500     __pyx_t_3 = __pyx_t_2;
8501   }
8502   __pyx_v_n = __pyx_t_3;
8503 
8504   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1024
8505  *     n = min(m2, nobs)
8506  *
8507  *     dim2[0] = m2;             # <<<<<<<<<<<<<<
8508  *     dim2[1] = m2;
8509  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX64, C)
8510  */
8511   (__pyx_v_dim2[0]) = __pyx_v_m2;
8512 
8513   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1025
8514  *
8515  *     dim2[0] = m2;
8516  *     dim2[1] = m2;             # <<<<<<<<<<<<<<
8517  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX64, C)
8518  *     dim1[0] = max(nobs - m, 0);
8519  */
8520   (__pyx_v_dim2[1]) = __pyx_v_m2;
8521 
8522   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1026
8523  *     dim2[0] = m2;
8524  *     dim2[1] = m2;
8525  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX64, C)             # <<<<<<<<<<<<<<
8526  *     dim1[0] = max(nobs - m, 0);
8527  *     acovf2 = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
8528  */
8529   __pyx_t_5 = PyArray_ZEROS(2, __pyx_v_dim2, NPY_COMPLEX64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1026, __pyx_L1_error)
8530   __Pyx_GOTREF(__pyx_t_5);
8531   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_float_complex(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1026, __pyx_L1_error)
8532   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8533   __pyx_v_acovf = __pyx_t_6;
8534   __pyx_t_6.memview = NULL;
8535   __pyx_t_6.data = NULL;
8536 
8537   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1027
8538  *     dim2[1] = m2;
8539  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX64, C)
8540  *     dim1[0] = max(nobs - m, 0);             # <<<<<<<<<<<<<<
8541  *     acovf2 = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
8542  *
8543  */
8544   __pyx_t_7 = 0;
8545   __pyx_t_3 = (__pyx_v_nobs - __pyx_v_m);
8546   if (((__pyx_t_7 > __pyx_t_3) != 0)) {
8547     __pyx_t_4 = __pyx_t_7;
8548   } else {
8549     __pyx_t_4 = __pyx_t_3;
8550   }
8551   (__pyx_v_dim1[0]) = __pyx_t_4;
8552 
8553   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1028
8554  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX64, C)
8555  *     dim1[0] = max(nobs - m, 0);
8556  *     acovf2 = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)             # <<<<<<<<<<<<<<
8557  *
8558  *     # Set i, j = 1, ..., m   (which is then done)
8559  */
8560   __pyx_t_5 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_COMPLEX64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1028, __pyx_L1_error)
8561   __Pyx_GOTREF(__pyx_t_5);
8562   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1028, __pyx_L1_error)
8563   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8564   __pyx_v_acovf2 = __pyx_t_8;
8565   __pyx_t_8.memview = NULL;
8566   __pyx_t_8.data = NULL;
8567 
8568   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1031
8569  *
8570  *     # Set i, j = 1, ..., m   (which is then done)
8571  *     ctoeplitz(m, 0, 0, arma_acovf, acovf)             # <<<<<<<<<<<<<<
8572  *
8573  *     # Set i = 1, ..., m;         j = m + 1, ..., 2 m
8574  */
8575   __pyx_t_5 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_ctoeplitz(__pyx_v_m, 0, 0, __pyx_v_arma_acovf, __pyx_v_acovf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1031, __pyx_L1_error)
8576   __Pyx_GOTREF(__pyx_t_5);
8577   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8578 
8579   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1035
8580  *     # Set i = 1, ..., m;         j = m + 1, ..., 2 m
8581  *     # and i = m + 1, ..., 2 m;   j = 1, ..., m
8582  *     if nobs > m:             # <<<<<<<<<<<<<<
8583  *         for j in range(m):
8584  *             for i in range(m, m2):
8585  */
8586   __pyx_t_9 = ((__pyx_v_nobs > __pyx_v_m) != 0);
8587   if (__pyx_t_9) {
8588 
8589     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1036
8590  *     # and i = m + 1, ..., 2 m;   j = 1, ..., m
8591  *     if nobs > m:
8592  *         for j in range(m):             # <<<<<<<<<<<<<<
8593  *             for i in range(m, m2):
8594  *                 acovf[i, j] = arma_acovf[i - j]
8595  */
8596     __pyx_t_4 = __pyx_v_m;
8597     __pyx_t_3 = __pyx_t_4;
8598     for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2+=1) {
8599       __pyx_v_j = __pyx_t_2;
8600 
8601       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1037
8602  *     if nobs > m:
8603  *         for j in range(m):
8604  *             for i in range(m, m2):             # <<<<<<<<<<<<<<
8605  *                 acovf[i, j] = arma_acovf[i - j]
8606  *                 for r in range(1, p + 1):
8607  */
8608       __pyx_t_10 = __pyx_v_m2;
8609       __pyx_t_11 = __pyx_t_10;
8610       for (__pyx_t_12 = __pyx_v_m; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
8611         __pyx_v_i = __pyx_t_12;
8612 
8613         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1038
8614  *         for j in range(m):
8615  *             for i in range(m, m2):
8616  *                 acovf[i, j] = arma_acovf[i - j]             # <<<<<<<<<<<<<<
8617  *                 for r in range(1, p + 1):
8618  *                     tmp_ix = abs(r - (i - j))
8619  */
8620         __pyx_t_13 = (__pyx_v_i - __pyx_v_j);
8621         __pyx_t_14 = __pyx_v_i;
8622         __pyx_t_15 = __pyx_v_j;
8623         *((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_14 * __pyx_v_acovf.strides[0]) ) + __pyx_t_15 * __pyx_v_acovf.strides[1]) )) = (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_arma_acovf.data + __pyx_t_13 * __pyx_v_arma_acovf.strides[0]) )));
8624 
8625         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1039
8626  *             for i in range(m, m2):
8627  *                 acovf[i, j] = arma_acovf[i - j]
8628  *                 for r in range(1, p + 1):             # <<<<<<<<<<<<<<
8629  *                     tmp_ix = abs(r - (i - j))
8630  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])
8631  */
8632         __pyx_t_16 = (__pyx_v_p + 1);
8633         __pyx_t_17 = __pyx_t_16;
8634         for (__pyx_t_18 = 1; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
8635           __pyx_v_r = __pyx_t_18;
8636 
8637           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1040
8638  *                 acovf[i, j] = arma_acovf[i - j]
8639  *                 for r in range(1, p + 1):
8640  *                     tmp_ix = abs(r - (i - j))             # <<<<<<<<<<<<<<
8641  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])
8642  *         acovf[:m, m:m2] = acovf[m:m2, :m].T
8643  */
8644           __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_r - (__pyx_v_i - __pyx_v_j))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1040, __pyx_L1_error)
8645           __Pyx_GOTREF(__pyx_t_5);
8646           __pyx_t_19 = __Pyx_PyNumber_Absolute(__pyx_t_5); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1040, __pyx_L1_error)
8647           __Pyx_GOTREF(__pyx_t_19);
8648           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8649           __pyx_t_20 = __Pyx_PyIndex_AsSsize_t(__pyx_t_19); if (unlikely((__pyx_t_20 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1040, __pyx_L1_error)
8650           __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8651           __pyx_v_tmp_ix = __pyx_t_20;
8652 
8653           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1041
8654  *                 for r in range(1, p + 1):
8655  *                     tmp_ix = abs(r - (i - j))
8656  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])             # <<<<<<<<<<<<<<
8657  *         acovf[:m, m:m2] = acovf[m:m2, :m].T
8658  *
8659  */
8660           __pyx_t_13 = __pyx_v_i;
8661           __pyx_t_15 = __pyx_v_j;
8662           __pyx_t_14 = __pyx_v_r;
8663           __pyx_t_21 = __pyx_v_tmp_ix;
8664           __pyx_t_22 = __pyx_v_i;
8665           __pyx_t_23 = __pyx_v_j;
8666           *((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_22 * __pyx_v_acovf.strides[0]) ) + __pyx_t_23 * __pyx_v_acovf.strides[1]) )) = __Pyx_c_diff_float((*((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_13 * __pyx_v_acovf.strides[0]) ) + __pyx_t_15 * __pyx_v_acovf.strides[1]) ))), __Pyx_c_prod_float(__Pyx_c_neg_float((*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_ar.data + __pyx_t_14 * __pyx_v_ar.strides[0]) )))), (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_arma_acovf.data + __pyx_t_21 * __pyx_v_arma_acovf.strides[0]) )))));
8667         }
8668       }
8669     }
8670 
8671     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1042
8672  *                     tmp_ix = abs(r - (i - j))
8673  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])
8674  *         acovf[:m, m:m2] = acovf[m:m2, :m].T             # <<<<<<<<<<<<<<
8675  *
8676  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
8677  */
8678     __pyx_t_6.data = __pyx_v_acovf.data;
8679     __pyx_t_6.memview = __pyx_v_acovf.memview;
8680     __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
8681     __pyx_t_24 = -1;
8682     if (unlikely(__pyx_memoryview_slice_memviewslice(
8683     &__pyx_t_6,
8684     __pyx_v_acovf.shape[0], __pyx_v_acovf.strides[0], __pyx_v_acovf.suboffsets[0],
8685     0,
8686     0,
8687     &__pyx_t_24,
8688     __pyx_v_m,
8689     __pyx_v_m2,
8690     0,
8691     1,
8692     1,
8693     0,
8694     1) < 0))
8695 {
8696     __PYX_ERR(0, 1042, __pyx_L1_error)
8697 }
8698 
8699 if (unlikely(__pyx_memoryview_slice_memviewslice(
8700     &__pyx_t_6,
8701     __pyx_v_acovf.shape[1], __pyx_v_acovf.strides[1], __pyx_v_acovf.suboffsets[1],
8702     1,
8703     1,
8704     &__pyx_t_24,
8705     0,
8706     __pyx_v_m,
8707     0,
8708     0,
8709     1,
8710     0,
8711     1) < 0))
8712 {
8713     __PYX_ERR(0, 1042, __pyx_L1_error)
8714 }
8715 
8716 __pyx_t_25 = __pyx_t_6;
8717     __PYX_INC_MEMVIEW(&__pyx_t_25, 1);
8718     if (unlikely(__pyx_memslice_transpose(&__pyx_t_25) == 0)) __PYX_ERR(0, 1042, __pyx_L1_error)
8719     __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
8720     __pyx_t_6.memview = NULL;
8721     __pyx_t_6.data = NULL;
8722     __pyx_t_6.data = __pyx_v_acovf.data;
8723     __pyx_t_6.memview = __pyx_v_acovf.memview;
8724     __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
8725     __pyx_t_24 = -1;
8726     if (unlikely(__pyx_memoryview_slice_memviewslice(
8727     &__pyx_t_6,
8728     __pyx_v_acovf.shape[0], __pyx_v_acovf.strides[0], __pyx_v_acovf.suboffsets[0],
8729     0,
8730     0,
8731     &__pyx_t_24,
8732     0,
8733     __pyx_v_m,
8734     0,
8735     0,
8736     1,
8737     0,
8738     1) < 0))
8739 {
8740     __PYX_ERR(0, 1042, __pyx_L1_error)
8741 }
8742 
8743 if (unlikely(__pyx_memoryview_slice_memviewslice(
8744     &__pyx_t_6,
8745     __pyx_v_acovf.shape[1], __pyx_v_acovf.strides[1], __pyx_v_acovf.suboffsets[1],
8746     1,
8747     1,
8748     &__pyx_t_24,
8749     __pyx_v_m,
8750     __pyx_v_m2,
8751     0,
8752     1,
8753     1,
8754     0,
8755     1) < 0))
8756 {
8757     __PYX_ERR(0, 1042, __pyx_L1_error)
8758 }
8759 
8760 if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_25, __pyx_t_6, 2, 2, 0) < 0)) __PYX_ERR(0, 1042, __pyx_L1_error)
8761     __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
8762     __pyx_t_6.memview = NULL;
8763     __pyx_t_6.data = NULL;
8764     __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
8765     __pyx_t_25.memview = NULL;
8766     __pyx_t_25.data = NULL;
8767 
8768     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1035
8769  *     # Set i = 1, ..., m;         j = m + 1, ..., 2 m
8770  *     # and i = m + 1, ..., 2 m;   j = 1, ..., m
8771  *     if nobs > m:             # <<<<<<<<<<<<<<
8772  *         for j in range(m):
8773  *             for i in range(m, m2):
8774  */
8775   }
8776 
8777   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1045
8778  *
8779  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
8780  *     if nobs > m:             # <<<<<<<<<<<<<<
8781  *         for i in range(nobs - m):
8782  *             for r in range(q + 1 - i):
8783  */
8784   __pyx_t_9 = ((__pyx_v_nobs > __pyx_v_m) != 0);
8785   if (__pyx_t_9) {
8786 
8787     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1046
8788  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
8789  *     if nobs > m:
8790  *         for i in range(nobs - m):             # <<<<<<<<<<<<<<
8791  *             for r in range(q + 1 - i):
8792  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]
8793  */
8794     __pyx_t_4 = (__pyx_v_nobs - __pyx_v_m);
8795     __pyx_t_3 = __pyx_t_4;
8796     for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2+=1) {
8797       __pyx_v_i = __pyx_t_2;
8798 
8799       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1047
8800  *     if nobs > m:
8801  *         for i in range(nobs - m):
8802  *             for r in range(q + 1 - i):             # <<<<<<<<<<<<<<
8803  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]
8804  *
8805  */
8806       __pyx_t_10 = ((__pyx_v_q + 1) - __pyx_v_i);
8807       __pyx_t_11 = __pyx_t_10;
8808       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
8809         __pyx_v_r = __pyx_t_12;
8810 
8811         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1048
8812  *         for i in range(nobs - m):
8813  *             for r in range(q + 1 - i):
8814  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]             # <<<<<<<<<<<<<<
8815  *
8816  *     return acovf[:n, :n], acovf2
8817  */
8818         __pyx_t_21 = __pyx_v_i;
8819         __pyx_t_14 = __pyx_v_r;
8820         __pyx_t_15 = (__pyx_v_r + __pyx_v_i);
8821         __pyx_t_13 = __pyx_v_i;
8822         *((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_13 * __pyx_v_acovf2.strides[0]) )) = __Pyx_c_sum_float((*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_21 * __pyx_v_acovf2.strides[0]) ))), __Pyx_c_prod_float((*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_ma.data + __pyx_t_14 * __pyx_v_ma.strides[0]) ))), (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_ma.data + __pyx_t_15 * __pyx_v_ma.strides[0]) )))));
8823       }
8824     }
8825 
8826     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1045
8827  *
8828  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
8829  *     if nobs > m:             # <<<<<<<<<<<<<<
8830  *         for i in range(nobs - m):
8831  *             for r in range(q + 1 - i):
8832  */
8833   }
8834 
8835   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1050
8836  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]
8837  *
8838  *     return acovf[:n, :n], acovf2             # <<<<<<<<<<<<<<
8839  *
8840  *
8841  */
8842   __Pyx_XDECREF(__pyx_r);
8843   __pyx_t_25.data = __pyx_v_acovf.data;
8844   __pyx_t_25.memview = __pyx_v_acovf.memview;
8845   __PYX_INC_MEMVIEW(&__pyx_t_25, 0);
8846   __pyx_t_24 = -1;
8847   if (unlikely(__pyx_memoryview_slice_memviewslice(
8848     &__pyx_t_25,
8849     __pyx_v_acovf.shape[0], __pyx_v_acovf.strides[0], __pyx_v_acovf.suboffsets[0],
8850     0,
8851     0,
8852     &__pyx_t_24,
8853     0,
8854     __pyx_v_n,
8855     0,
8856     0,
8857     1,
8858     0,
8859     1) < 0))
8860 {
8861     __PYX_ERR(0, 1050, __pyx_L1_error)
8862 }
8863 
8864 if (unlikely(__pyx_memoryview_slice_memviewslice(
8865     &__pyx_t_25,
8866     __pyx_v_acovf.shape[1], __pyx_v_acovf.strides[1], __pyx_v_acovf.suboffsets[1],
8867     1,
8868     1,
8869     &__pyx_t_24,
8870     0,
8871     __pyx_v_n,
8872     0,
8873     0,
8874     1,
8875     0,
8876     1) < 0))
8877 {
8878     __PYX_ERR(0, 1050, __pyx_L1_error)
8879 }
8880 
8881 __pyx_t_19 = __pyx_memoryview_fromslice(__pyx_t_25, 2, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_float_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_float_complex, 0);; if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1050, __pyx_L1_error)
8882   __Pyx_GOTREF(__pyx_t_19);
8883   __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
8884   __pyx_t_25.memview = NULL;
8885   __pyx_t_25.data = NULL;
8886   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_acovf2, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_float_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_float_complex, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1050, __pyx_L1_error)
8887   __Pyx_GOTREF(__pyx_t_5);
8888   __pyx_t_26 = PyTuple_New(2); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 1050, __pyx_L1_error)
8889   __Pyx_GOTREF(__pyx_t_26);
8890   __Pyx_GIVEREF(__pyx_t_19);
8891   PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_19);
8892   __Pyx_GIVEREF(__pyx_t_5);
8893   PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_5);
8894   __pyx_t_19 = 0;
8895   __pyx_t_5 = 0;
8896   __pyx_r = __pyx_t_26;
8897   __pyx_t_26 = 0;
8898   goto __pyx_L0;
8899 
8900   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":947
8901  *
8902  *
8903  * cpdef carma_transformed_acovf_fast(cnp.complex64_t [:] ar,             # <<<<<<<<<<<<<<
8904  *                                             cnp.complex64_t [:] ma,
8905  *                                             cnp.complex64_t [:] arma_acovf):
8906  */
8907 
8908   /* function exit code */
8909   __pyx_L1_error:;
8910   __Pyx_XDECREF(__pyx_t_5);
8911   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
8912   __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
8913   __Pyx_XDECREF(__pyx_t_19);
8914   __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
8915   __Pyx_XDECREF(__pyx_t_26);
8916   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_transformed_acovf_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
8917   __pyx_r = 0;
8918   __pyx_L0:;
8919   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf, 1);
8920   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf2, 1);
8921   __Pyx_XGIVEREF(__pyx_r);
8922   __Pyx_RefNannyFinishContext();
8923   return __pyx_r;
8924 }
8925 
8926 /* Python wrapper */
8927 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_21carma_transformed_acovf_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8928 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_20carma_transformed_acovf_fast[] = "\n    arma_transformed_acovf_fast(cnp.complex64_t [:] ar, cnp.complex64_t [:] ma, cnp.complex64_t [:] arma_acovf)\n    \n    Quickly construct the autocovariance matrix for a transformed process.\n\n    Using the autocovariance function for an ARMA process, constructs the\n    autocovariances associated with the transformed process described\n    in equation (3.3.1) of _[1] in a memory efficient, and so fast, way.\n\n    Parameters\n    ----------\n    ar : ndarray\n        Autoregressive coefficients, including the zero lag, where the sign\n        convention assumes the coefficients are part of the lag polynomial on\n        the left-hand-side of the ARMA definition (i.e. they have the opposite\n        sign from the usual econometrics convention in which the coefficients\n        are on the right-hand-side of the ARMA definition).\n    ma : ndarray\n        Moving average coefficients, including the zero lag, where the sign\n        convention assumes the coefficients are part of the lag polynomial on\n        the right-hand-side of the ARMA definition (i.e. they have the same\n        sign from the usual econometrics convention in which the coefficients\n        are on the right-hand-side of the ARMA definition).\n    arma_acovf : ndarray\n        The vector of autocovariances of the ARMA process.\n\n    Returns\n    -------\n    acovf : ndarray\n        A matrix containing the autocovariances of the portion of the\n        transformed process with time-varying autocovariances. Its dimension\n        is equal to `min(m * 2, n)` where `m = max(len(ar) - 1, len(ma) - 1)`\n        and `n` is the length of the input array `arma_acovf`. It is important\n        to note that only the values in the first `m` columns or `m` rows are\n        valid. In particular, the entries in the block `acovf[m:, m:]` should\n        not be used in any case (and in fact will always be equal to zeros).\n    acovf2 : ndarray\n        An array containing the autocovariance function of th""e portion of the\n        transformed process with time-invariant autocovariances. Its dimension\n        is equal to `max(n - m, 0)` where `n` is the length of the input\n        array `arma_acovf`.\n\n    Notes\n    -----\n    The definition of this autocovariance matrix is from _[1] equation 3.3.3.\n\n    This function assumes that the variance of the ARMA innovation term is\n    equal to one. If this is not true, then the calling program should replace\n    `arma_acovf` with `arma_acovf / sigma2`, where sigma2 is that variance.\n\n    This function is relatively fast even when `arma_acovf` is large, since\n    it only constructs the full autocovariance matrix for a generally small\n    subset of observations. The trade-off is that the output of this function\n    is somewhat more difficult to use.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_21carma_transformed_acovf_fast(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8929 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_21carma_transformed_acovf_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8930   __Pyx_memviewslice __pyx_v_ar = { 0, 0, { 0 }, { 0 }, { 0 } };
8931   __Pyx_memviewslice __pyx_v_ma = { 0, 0, { 0 }, { 0 }, { 0 } };
8932   __Pyx_memviewslice __pyx_v_arma_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
8933   int __pyx_lineno = 0;
8934   const char *__pyx_filename = NULL;
8935   int __pyx_clineno = 0;
8936   PyObject *__pyx_r = 0;
8937   __Pyx_RefNannyDeclarations
8938   __Pyx_RefNannySetupContext("carma_transformed_acovf_fast (wrapper)", 0);
8939   {
8940     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ar,&__pyx_n_s_ma,&__pyx_n_s_arma_acovf,0};
8941     PyObject* values[3] = {0,0,0};
8942     if (unlikely(__pyx_kwds)) {
8943       Py_ssize_t kw_args;
8944       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8945       switch (pos_args) {
8946         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8947         CYTHON_FALLTHROUGH;
8948         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8949         CYTHON_FALLTHROUGH;
8950         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8951         CYTHON_FALLTHROUGH;
8952         case  0: break;
8953         default: goto __pyx_L5_argtuple_error;
8954       }
8955       kw_args = PyDict_Size(__pyx_kwds);
8956       switch (pos_args) {
8957         case  0:
8958         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar)) != 0)) kw_args--;
8959         else goto __pyx_L5_argtuple_error;
8960         CYTHON_FALLTHROUGH;
8961         case  1:
8962         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma)) != 0)) kw_args--;
8963         else {
8964           __Pyx_RaiseArgtupleInvalid("carma_transformed_acovf_fast", 1, 3, 3, 1); __PYX_ERR(0, 947, __pyx_L3_error)
8965         }
8966         CYTHON_FALLTHROUGH;
8967         case  2:
8968         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arma_acovf)) != 0)) kw_args--;
8969         else {
8970           __Pyx_RaiseArgtupleInvalid("carma_transformed_acovf_fast", 1, 3, 3, 2); __PYX_ERR(0, 947, __pyx_L3_error)
8971         }
8972       }
8973       if (unlikely(kw_args > 0)) {
8974         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "carma_transformed_acovf_fast") < 0)) __PYX_ERR(0, 947, __pyx_L3_error)
8975       }
8976     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
8977       goto __pyx_L5_argtuple_error;
8978     } else {
8979       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8980       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8981       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8982     }
8983     __pyx_v_ar = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar.memview)) __PYX_ERR(0, 947, __pyx_L3_error)
8984     __pyx_v_ma = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma.memview)) __PYX_ERR(0, 948, __pyx_L3_error)
8985     __pyx_v_arma_acovf = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_arma_acovf.memview)) __PYX_ERR(0, 949, __pyx_L3_error)
8986   }
8987   goto __pyx_L4_argument_unpacking_done;
8988   __pyx_L5_argtuple_error:;
8989   __Pyx_RaiseArgtupleInvalid("carma_transformed_acovf_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 947, __pyx_L3_error)
8990   __pyx_L3_error:;
8991   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_transformed_acovf_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
8992   __Pyx_RefNannyFinishContext();
8993   return NULL;
8994   __pyx_L4_argument_unpacking_done:;
8995   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_20carma_transformed_acovf_fast(__pyx_self, __pyx_v_ar, __pyx_v_ma, __pyx_v_arma_acovf);
8996 
8997   /* function exit code */
8998   __Pyx_RefNannyFinishContext();
8999   return __pyx_r;
9000 }
9001 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_20carma_transformed_acovf_fast(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_ar,__Pyx_memviewslice __pyx_v_ma,__Pyx_memviewslice __pyx_v_arma_acovf)9002 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_20carma_transformed_acovf_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ar, __Pyx_memviewslice __pyx_v_ma, __Pyx_memviewslice __pyx_v_arma_acovf) {
9003   PyObject *__pyx_r = NULL;
9004   __Pyx_RefNannyDeclarations
9005   PyObject *__pyx_t_1 = NULL;
9006   int __pyx_lineno = 0;
9007   const char *__pyx_filename = NULL;
9008   int __pyx_clineno = 0;
9009   __Pyx_RefNannySetupContext("carma_transformed_acovf_fast", 0);
9010   __Pyx_XDECREF(__pyx_r);
9011   if (unlikely(!__pyx_v_ar.memview)) { __Pyx_RaiseUnboundLocalError("ar"); __PYX_ERR(0, 947, __pyx_L1_error) }
9012   if (unlikely(!__pyx_v_ma.memview)) { __Pyx_RaiseUnboundLocalError("ma"); __PYX_ERR(0, 947, __pyx_L1_error) }
9013   if (unlikely(!__pyx_v_arma_acovf.memview)) { __Pyx_RaiseUnboundLocalError("arma_acovf"); __PYX_ERR(0, 947, __pyx_L1_error) }
9014   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_transformed_acovf_fast(__pyx_v_ar, __pyx_v_ma, __pyx_v_arma_acovf, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 947, __pyx_L1_error)
9015   __Pyx_GOTREF(__pyx_t_1);
9016   __pyx_r = __pyx_t_1;
9017   __pyx_t_1 = 0;
9018   goto __pyx_L0;
9019 
9020   /* function exit code */
9021   __pyx_L1_error:;
9022   __Pyx_XDECREF(__pyx_t_1);
9023   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_transformed_acovf_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
9024   __pyx_r = NULL;
9025   __pyx_L0:;
9026   __PYX_XDEC_MEMVIEW(&__pyx_v_ar, 1);
9027   __PYX_XDEC_MEMVIEW(&__pyx_v_ma, 1);
9028   __PYX_XDEC_MEMVIEW(&__pyx_v_arma_acovf, 1);
9029   __Pyx_XGIVEREF(__pyx_r);
9030   __Pyx_RefNannyFinishContext();
9031   return __pyx_r;
9032 }
9033 
9034 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1053
9035  *
9036  *
9037  * cpdef carma_innovations_algo_fast(int nobs,             # <<<<<<<<<<<<<<
9038  *                                            cnp.complex64_t [:] ar_params,
9039  *                                            cnp.complex64_t [:] ma_params,
9040  */
9041 
9042 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_23carma_innovations_algo_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations_algo_fast(int __pyx_v_nobs,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_acovf,__Pyx_memviewslice __pyx_v_acovf2,CYTHON_UNUSED int __pyx_skip_dispatch)9043 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations_algo_fast(int __pyx_v_nobs, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_acovf, __Pyx_memviewslice __pyx_v_acovf2, CYTHON_UNUSED int __pyx_skip_dispatch) {
9044   Py_ssize_t __pyx_v_i;
9045   Py_ssize_t __pyx_v_j;
9046   Py_ssize_t __pyx_v_k;
9047   Py_ssize_t __pyx_v_n;
9048   Py_ssize_t __pyx_v__n;
9049   Py_ssize_t __pyx_v_m;
9050   Py_ssize_t __pyx_v_m2;
9051   Py_ssize_t __pyx_v_p;
9052   Py_ssize_t __pyx_v_q;
9053   Py_ssize_t __pyx_v_start;
9054   Py_ssize_t __pyx_v_start2;
9055   npy_intp __pyx_v_dim1[1];
9056   npy_intp __pyx_v_dim2[2];
9057   __Pyx_memviewslice __pyx_v_theta = { 0, 0, { 0 }, { 0 }, { 0 } };
9058   __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
9059   PyObject *__pyx_r = NULL;
9060   __Pyx_RefNannyDeclarations
9061   size_t __pyx_t_1;
9062   Py_ssize_t __pyx_t_2;
9063   Py_ssize_t __pyx_t_3;
9064   Py_ssize_t __pyx_t_4;
9065   PyObject *__pyx_t_5 = NULL;
9066   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
9067   __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
9068   int __pyx_t_8;
9069   Py_ssize_t __pyx_t_9;
9070   Py_ssize_t __pyx_t_10;
9071   Py_ssize_t __pyx_t_11;
9072   long __pyx_t_12;
9073   long __pyx_t_13;
9074   Py_ssize_t __pyx_t_14;
9075   int __pyx_t_15;
9076   Py_ssize_t __pyx_t_16;
9077   Py_ssize_t __pyx_t_17;
9078   Py_ssize_t __pyx_t_18;
9079   Py_ssize_t __pyx_t_19;
9080   Py_ssize_t __pyx_t_20;
9081   Py_ssize_t __pyx_t_21;
9082   Py_ssize_t __pyx_t_22;
9083   Py_ssize_t __pyx_t_23;
9084   Py_ssize_t __pyx_t_24;
9085   __pyx_t_float_complex __pyx_t_25;
9086   __pyx_t_double_complex __pyx_t_26;
9087   __pyx_t_double_complex __pyx_t_27;
9088   __pyx_t_double_complex __pyx_t_28;
9089   long __pyx_t_29;
9090   PyObject *__pyx_t_30 = NULL;
9091   PyObject *__pyx_t_31 = NULL;
9092   int __pyx_lineno = 0;
9093   const char *__pyx_filename = NULL;
9094   int __pyx_clineno = 0;
9095   __Pyx_RefNannySetupContext("carma_innovations_algo_fast", 0);
9096 
9097   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1107
9098  *     cdef cnp.complex64_t [:] v
9099  *
9100  *     p = len(ar_params)             # <<<<<<<<<<<<<<
9101  *     q = len(ma_params)
9102  *     m = max(p, q)
9103  */
9104   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
9105   __pyx_v_p = __pyx_t_1;
9106 
9107   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1108
9108  *
9109  *     p = len(ar_params)
9110  *     q = len(ma_params)             # <<<<<<<<<<<<<<
9111  *     m = max(p, q)
9112  *     m2 = 2 * m
9113  */
9114   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma_params);
9115   __pyx_v_q = __pyx_t_1;
9116 
9117   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1109
9118  *     p = len(ar_params)
9119  *     q = len(ma_params)
9120  *     m = max(p, q)             # <<<<<<<<<<<<<<
9121  *     m2 = 2 * m
9122  *
9123  */
9124   __pyx_t_2 = __pyx_v_q;
9125   __pyx_t_3 = __pyx_v_p;
9126   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
9127     __pyx_t_4 = __pyx_t_2;
9128   } else {
9129     __pyx_t_4 = __pyx_t_3;
9130   }
9131   __pyx_v_m = __pyx_t_4;
9132 
9133   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1110
9134  *     q = len(ma_params)
9135  *     m = max(p, q)
9136  *     m2 = 2 * m             # <<<<<<<<<<<<<<
9137  *
9138  *     dim1[0] = nobs;
9139  */
9140   __pyx_v_m2 = (2 * __pyx_v_m);
9141 
9142   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1112
9143  *     m2 = 2 * m
9144  *
9145  *     dim1[0] = nobs;             # <<<<<<<<<<<<<<
9146  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
9147  *     dim2[0] = nobs;
9148  */
9149   (__pyx_v_dim1[0]) = __pyx_v_nobs;
9150 
9151   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1113
9152  *
9153  *     dim1[0] = nobs;
9154  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)             # <<<<<<<<<<<<<<
9155  *     dim2[0] = nobs;
9156  *     dim2[1] = m + 1;
9157  */
9158   __pyx_t_5 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_COMPLEX64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1113, __pyx_L1_error)
9159   __Pyx_GOTREF(__pyx_t_5);
9160   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1113, __pyx_L1_error)
9161   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9162   __pyx_v_v = __pyx_t_6;
9163   __pyx_t_6.memview = NULL;
9164   __pyx_t_6.data = NULL;
9165 
9166   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1114
9167  *     dim1[0] = nobs;
9168  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
9169  *     dim2[0] = nobs;             # <<<<<<<<<<<<<<
9170  *     dim2[1] = m + 1;
9171  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX64, C)
9172  */
9173   (__pyx_v_dim2[0]) = __pyx_v_nobs;
9174 
9175   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1115
9176  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
9177  *     dim2[0] = nobs;
9178  *     dim2[1] = m + 1;             # <<<<<<<<<<<<<<
9179  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX64, C)
9180  *
9181  */
9182   (__pyx_v_dim2[1]) = (__pyx_v_m + 1);
9183 
9184   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1116
9185  *     dim2[0] = nobs;
9186  *     dim2[1] = m + 1;
9187  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX64, C)             # <<<<<<<<<<<<<<
9188  *
9189  *     if m > 0:
9190  */
9191   __pyx_t_5 = PyArray_ZEROS(2, __pyx_v_dim2, NPY_COMPLEX64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1116, __pyx_L1_error)
9192   __Pyx_GOTREF(__pyx_t_5);
9193   __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_float_complex(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1116, __pyx_L1_error)
9194   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9195   __pyx_v_theta = __pyx_t_7;
9196   __pyx_t_7.memview = NULL;
9197   __pyx_t_7.data = NULL;
9198 
9199   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1118
9200  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX64, C)
9201  *
9202  *     if m > 0:             # <<<<<<<<<<<<<<
9203  *         v[0] = acovf[0, 0]
9204  *     else:
9205  */
9206   __pyx_t_8 = ((__pyx_v_m > 0) != 0);
9207   if (__pyx_t_8) {
9208 
9209     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1119
9210  *
9211  *     if m > 0:
9212  *         v[0] = acovf[0, 0]             # <<<<<<<<<<<<<<
9213  *     else:
9214  *         # (handle the corner case where p = q = 0)
9215  */
9216     __pyx_t_9 = 0;
9217     __pyx_t_10 = 0;
9218     __pyx_t_11 = 0;
9219     *((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_11 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_9 * __pyx_v_acovf.strides[0]) ) + __pyx_t_10 * __pyx_v_acovf.strides[1]) )));
9220 
9221     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1118
9222  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX64, C)
9223  *
9224  *     if m > 0:             # <<<<<<<<<<<<<<
9225  *         v[0] = acovf[0, 0]
9226  *     else:
9227  */
9228     goto __pyx_L3;
9229   }
9230 
9231   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1122
9232  *     else:
9233  *         # (handle the corner case where p = q = 0)
9234  *         v[0] = acovf2[0]             # <<<<<<<<<<<<<<
9235  *
9236  *     for n in range(nobs - 1):
9237  */
9238   /*else*/ {
9239     __pyx_t_10 = 0;
9240     __pyx_t_9 = 0;
9241     *((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_9 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_10 * __pyx_v_acovf2.strides[0]) )));
9242   }
9243   __pyx_L3:;
9244 
9245   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1124
9246  *         v[0] = acovf2[0]
9247  *
9248  *     for n in range(nobs - 1):             # <<<<<<<<<<<<<<
9249  *         _n = n + 1
9250  *
9251  */
9252   __pyx_t_12 = (__pyx_v_nobs - 1);
9253   __pyx_t_13 = __pyx_t_12;
9254   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_13; __pyx_t_4+=1) {
9255     __pyx_v_n = __pyx_t_4;
9256 
9257     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1125
9258  *
9259  *     for n in range(nobs - 1):
9260  *         _n = n + 1             # <<<<<<<<<<<<<<
9261  *
9262  *         start = 0 if n < m else n + 1 - q
9263  */
9264     __pyx_v__n = (__pyx_v_n + 1);
9265 
9266     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1127
9267  *         _n = n + 1
9268  *
9269  *         start = 0 if n < m else n + 1 - q             # <<<<<<<<<<<<<<
9270  *         for k in range(start, n + 1):
9271  *             # See Brockwell and Davis, p. 100-101
9272  */
9273     if (((__pyx_v_n < __pyx_v_m) != 0)) {
9274       __pyx_t_2 = 0;
9275     } else {
9276       __pyx_t_2 = ((__pyx_v_n + 1) - __pyx_v_q);
9277     }
9278     __pyx_v_start = __pyx_t_2;
9279 
9280     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1128
9281  *
9282  *         start = 0 if n < m else n + 1 - q
9283  *         for k in range(start, n + 1):             # <<<<<<<<<<<<<<
9284  *             # See Brockwell and Davis, p. 100-101
9285  *             # (here we have weak rather than strict inequality due to Python's
9286  */
9287     __pyx_t_2 = (__pyx_v_n + 1);
9288     __pyx_t_3 = __pyx_t_2;
9289     for (__pyx_t_14 = __pyx_v_start; __pyx_t_14 < __pyx_t_3; __pyx_t_14+=1) {
9290       __pyx_v_k = __pyx_t_14;
9291 
9292       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1132
9293  *             # (here we have weak rather than strict inequality due to Python's
9294  *             # zero indexing)
9295  *             if n >= m and n - k >= q:             # <<<<<<<<<<<<<<
9296  *                 continue
9297  *
9298  */
9299       __pyx_t_15 = ((__pyx_v_n >= __pyx_v_m) != 0);
9300       if (__pyx_t_15) {
9301       } else {
9302         __pyx_t_8 = __pyx_t_15;
9303         goto __pyx_L9_bool_binop_done;
9304       }
9305       __pyx_t_15 = (((__pyx_v_n - __pyx_v_k) >= __pyx_v_q) != 0);
9306       __pyx_t_8 = __pyx_t_15;
9307       __pyx_L9_bool_binop_done:;
9308       if (__pyx_t_8) {
9309 
9310         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1133
9311  *             # zero indexing)
9312  *             if n >= m and n - k >= q:
9313  *                 continue             # <<<<<<<<<<<<<<
9314  *
9315  *             if n + 1 < m2 and k < m:
9316  */
9317         goto __pyx_L6_continue;
9318 
9319         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1132
9320  *             # (here we have weak rather than strict inequality due to Python's
9321  *             # zero indexing)
9322  *             if n >= m and n - k >= q:             # <<<<<<<<<<<<<<
9323  *                 continue
9324  *
9325  */
9326       }
9327 
9328       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1135
9329  *                 continue
9330  *
9331  *             if n + 1 < m2 and k < m:             # <<<<<<<<<<<<<<
9332  *                 theta[_n, n - k] = acovf[n + 1, k]
9333  *             else:
9334  */
9335       __pyx_t_15 = (((__pyx_v_n + 1) < __pyx_v_m2) != 0);
9336       if (__pyx_t_15) {
9337       } else {
9338         __pyx_t_8 = __pyx_t_15;
9339         goto __pyx_L12_bool_binop_done;
9340       }
9341       __pyx_t_15 = ((__pyx_v_k < __pyx_v_m) != 0);
9342       __pyx_t_8 = __pyx_t_15;
9343       __pyx_L12_bool_binop_done:;
9344       if (__pyx_t_8) {
9345 
9346         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1136
9347  *
9348  *             if n + 1 < m2 and k < m:
9349  *                 theta[_n, n - k] = acovf[n + 1, k]             # <<<<<<<<<<<<<<
9350  *             else:
9351  *                 theta[_n, n - k] = acovf2[n + 1 - k]
9352  */
9353         __pyx_t_10 = (__pyx_v_n + 1);
9354         __pyx_t_9 = __pyx_v_k;
9355         __pyx_t_11 = __pyx_v__n;
9356         __pyx_t_16 = (__pyx_v_n - __pyx_v_k);
9357         *((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_11 * __pyx_v_theta.strides[0]) ) + __pyx_t_16 * __pyx_v_theta.strides[1]) )) = (*((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_10 * __pyx_v_acovf.strides[0]) ) + __pyx_t_9 * __pyx_v_acovf.strides[1]) )));
9358 
9359         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1135
9360  *                 continue
9361  *
9362  *             if n + 1 < m2 and k < m:             # <<<<<<<<<<<<<<
9363  *                 theta[_n, n - k] = acovf[n + 1, k]
9364  *             else:
9365  */
9366         goto __pyx_L11;
9367       }
9368 
9369       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1138
9370  *                 theta[_n, n - k] = acovf[n + 1, k]
9371  *             else:
9372  *                 theta[_n, n - k] = acovf2[n + 1 - k]             # <<<<<<<<<<<<<<
9373  *
9374  *             start2 = 0 if n < m else n - m
9375  */
9376       /*else*/ {
9377         __pyx_t_9 = ((__pyx_v_n + 1) - __pyx_v_k);
9378         __pyx_t_10 = __pyx_v__n;
9379         __pyx_t_16 = (__pyx_v_n - __pyx_v_k);
9380         *((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_10 * __pyx_v_theta.strides[0]) ) + __pyx_t_16 * __pyx_v_theta.strides[1]) )) = (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_9 * __pyx_v_acovf2.strides[0]) )));
9381       }
9382       __pyx_L11:;
9383 
9384       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1140
9385  *                 theta[_n, n - k] = acovf2[n + 1 - k]
9386  *
9387  *             start2 = 0 if n < m else n - m             # <<<<<<<<<<<<<<
9388  *             for j in range(start2, k):
9389  *                 if n - j < m + 1:
9390  */
9391       if (((__pyx_v_n < __pyx_v_m) != 0)) {
9392         __pyx_t_17 = 0;
9393       } else {
9394         __pyx_t_17 = (__pyx_v_n - __pyx_v_m);
9395       }
9396       __pyx_v_start2 = __pyx_t_17;
9397 
9398       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1141
9399  *
9400  *             start2 = 0 if n < m else n - m
9401  *             for j in range(start2, k):             # <<<<<<<<<<<<<<
9402  *                 if n - j < m + 1:
9403  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
9404  */
9405       __pyx_t_17 = __pyx_v_k;
9406       __pyx_t_18 = __pyx_t_17;
9407       for (__pyx_t_19 = __pyx_v_start2; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
9408         __pyx_v_j = __pyx_t_19;
9409 
9410         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1142
9411  *             start2 = 0 if n < m else n - m
9412  *             for j in range(start2, k):
9413  *                 if n - j < m + 1:             # <<<<<<<<<<<<<<
9414  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
9415  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
9416  */
9417         __pyx_t_8 = (((__pyx_v_n - __pyx_v_j) < (__pyx_v_m + 1)) != 0);
9418         if (__pyx_t_8) {
9419 
9420           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1143
9421  *             for j in range(start2, k):
9422  *                 if n - j < m + 1:
9423  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]             # <<<<<<<<<<<<<<
9424  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
9425  *
9426  */
9427           __pyx_t_9 = __pyx_v__n;
9428           __pyx_t_16 = (__pyx_v_n - __pyx_v_k);
9429           __pyx_t_10 = ((__pyx_v_k - 1) + 1);
9430           __pyx_t_11 = ((__pyx_v_k - __pyx_v_j) - 1);
9431           __pyx_t_20 = __pyx_v__n;
9432           __pyx_t_21 = (__pyx_v_n - __pyx_v_j);
9433           __pyx_t_22 = __pyx_v_j;
9434           __pyx_t_23 = __pyx_v__n;
9435           __pyx_t_24 = (__pyx_v_n - __pyx_v_k);
9436           *((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_23 * __pyx_v_theta.strides[0]) ) + __pyx_t_24 * __pyx_v_theta.strides[1]) )) = __Pyx_c_diff_float((*((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_9 * __pyx_v_theta.strides[0]) ) + __pyx_t_16 * __pyx_v_theta.strides[1]) ))), __Pyx_c_prod_float(__Pyx_c_prod_float((*((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_10 * __pyx_v_theta.strides[0]) ) + __pyx_t_11 * __pyx_v_theta.strides[1]) ))), (*((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_20 * __pyx_v_theta.strides[0]) ) + __pyx_t_21 * __pyx_v_theta.strides[1]) )))), (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) )))));
9437 
9438           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1142
9439  *             start2 = 0 if n < m else n - m
9440  *             for j in range(start2, k):
9441  *                 if n - j < m + 1:             # <<<<<<<<<<<<<<
9442  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
9443  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
9444  */
9445         }
9446       }
9447 
9448       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1144
9449  *                 if n - j < m + 1:
9450  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
9451  *             theta[_n, n - k] = theta[_n, n - k] / v[k]             # <<<<<<<<<<<<<<
9452  *
9453  *         if n + 1 < m:
9454  */
9455       __pyx_t_22 = __pyx_v__n;
9456       __pyx_t_21 = (__pyx_v_n - __pyx_v_k);
9457       __pyx_t_25 = (*((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_22 * __pyx_v_theta.strides[0]) ) + __pyx_t_21 * __pyx_v_theta.strides[1]) )));
9458       __pyx_t_26 = __pyx_t_double_complex_from_parts(__Pyx_CREAL(__pyx_t_25), __Pyx_CIMAG(__pyx_t_25));
9459       __pyx_t_21 = __pyx_v_k;
9460       __pyx_t_25 = (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) )));
9461       __pyx_t_27 = __pyx_t_double_complex_from_parts(__Pyx_CREAL(__pyx_t_25), __Pyx_CIMAG(__pyx_t_25));
9462       if (unlikely(__Pyx_c_is_zero_double(__pyx_t_27))) {
9463         PyErr_SetString(PyExc_ZeroDivisionError, "float division");
9464         __PYX_ERR(0, 1144, __pyx_L1_error)
9465       }
9466       __pyx_t_28 = __Pyx_c_quot_double(__pyx_t_26, __pyx_t_27);
9467       __pyx_t_21 = __pyx_v__n;
9468       __pyx_t_22 = (__pyx_v_n - __pyx_v_k);
9469       *((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_21 * __pyx_v_theta.strides[0]) ) + __pyx_t_22 * __pyx_v_theta.strides[1]) )) = __pyx_t_float_complex_from_parts(__Pyx_CREAL(__pyx_t_28), __Pyx_CIMAG(__pyx_t_28));
9470       __pyx_L6_continue:;
9471     }
9472 
9473     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1146
9474  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
9475  *
9476  *         if n + 1 < m:             # <<<<<<<<<<<<<<
9477  *             v[n + 1] = acovf[n + 1, n + 1]
9478  *         else:
9479  */
9480     __pyx_t_8 = (((__pyx_v_n + 1) < __pyx_v_m) != 0);
9481     if (__pyx_t_8) {
9482 
9483       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1147
9484  *
9485  *         if n + 1 < m:
9486  *             v[n + 1] = acovf[n + 1, n + 1]             # <<<<<<<<<<<<<<
9487  *         else:
9488  *             v[n + 1] = acovf2[0]
9489  */
9490       __pyx_t_22 = (__pyx_v_n + 1);
9491       __pyx_t_21 = (__pyx_v_n + 1);
9492       __pyx_t_20 = (__pyx_v_n + 1);
9493       *((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_20 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_22 * __pyx_v_acovf.strides[0]) ) + __pyx_t_21 * __pyx_v_acovf.strides[1]) )));
9494 
9495       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1146
9496  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
9497  *
9498  *         if n + 1 < m:             # <<<<<<<<<<<<<<
9499  *             v[n + 1] = acovf[n + 1, n + 1]
9500  *         else:
9501  */
9502       goto __pyx_L17;
9503     }
9504 
9505     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1149
9506  *             v[n + 1] = acovf[n + 1, n + 1]
9507  *         else:
9508  *             v[n + 1] = acovf2[0]             # <<<<<<<<<<<<<<
9509  *         start = max(0, n - (m + 1) + 2)
9510  *         for i in range(start, n + 1):
9511  */
9512     /*else*/ {
9513       __pyx_t_21 = 0;
9514       __pyx_t_22 = (__pyx_v_n + 1);
9515       *((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_21 * __pyx_v_acovf2.strides[0]) )));
9516     }
9517     __pyx_L17:;
9518 
9519     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1150
9520  *         else:
9521  *             v[n + 1] = acovf2[0]
9522  *         start = max(0, n - (m + 1) + 2)             # <<<<<<<<<<<<<<
9523  *         for i in range(start, n + 1):
9524  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]
9525  */
9526     __pyx_t_2 = ((__pyx_v_n - (__pyx_v_m + 1)) + 2);
9527     __pyx_t_29 = 0;
9528     if (((__pyx_t_2 > __pyx_t_29) != 0)) {
9529       __pyx_t_3 = __pyx_t_2;
9530     } else {
9531       __pyx_t_3 = __pyx_t_29;
9532     }
9533     __pyx_v_start = __pyx_t_3;
9534 
9535     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1151
9536  *             v[n + 1] = acovf2[0]
9537  *         start = max(0, n - (m + 1) + 2)
9538  *         for i in range(start, n + 1):             # <<<<<<<<<<<<<<
9539  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]
9540  *
9541  */
9542     __pyx_t_3 = (__pyx_v_n + 1);
9543     __pyx_t_2 = __pyx_t_3;
9544     for (__pyx_t_14 = __pyx_v_start; __pyx_t_14 < __pyx_t_2; __pyx_t_14+=1) {
9545       __pyx_v_i = __pyx_t_14;
9546 
9547       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1152
9548  *         start = max(0, n - (m + 1) + 2)
9549  *         for i in range(start, n + 1):
9550  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]             # <<<<<<<<<<<<<<
9551  *
9552  *     return theta, v
9553  */
9554       __pyx_t_21 = (__pyx_v_n + 1);
9555       __pyx_t_22 = __pyx_v__n;
9556       __pyx_t_20 = (__pyx_v_n - __pyx_v_i);
9557       __pyx_t_11 = __pyx_v_i;
9558       __pyx_t_10 = (__pyx_v_n + 1);
9559       *((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_10 * __pyx_v_v.strides[0]) )) = __Pyx_c_diff_float((*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) ))), __Pyx_c_prod_float(__Pyx_c_pow_float((*((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_22 * __pyx_v_theta.strides[0]) ) + __pyx_t_20 * __pyx_v_theta.strides[1]) ))), __pyx_t_float_complex_from_parts(2, 0)), (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_11 * __pyx_v_v.strides[0]) )))));
9560     }
9561   }
9562 
9563   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1154
9564  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]
9565  *
9566  *     return theta, v             # <<<<<<<<<<<<<<
9567  *
9568  *
9569  */
9570   __Pyx_XDECREF(__pyx_r);
9571   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_theta, 2, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_float_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_float_complex, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1154, __pyx_L1_error)
9572   __Pyx_GOTREF(__pyx_t_5);
9573   __pyx_t_30 = __pyx_memoryview_fromslice(__pyx_v_v, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_float_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_float_complex, 0);; if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 1154, __pyx_L1_error)
9574   __Pyx_GOTREF(__pyx_t_30);
9575   __pyx_t_31 = PyTuple_New(2); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1154, __pyx_L1_error)
9576   __Pyx_GOTREF(__pyx_t_31);
9577   __Pyx_GIVEREF(__pyx_t_5);
9578   PyTuple_SET_ITEM(__pyx_t_31, 0, __pyx_t_5);
9579   __Pyx_GIVEREF(__pyx_t_30);
9580   PyTuple_SET_ITEM(__pyx_t_31, 1, __pyx_t_30);
9581   __pyx_t_5 = 0;
9582   __pyx_t_30 = 0;
9583   __pyx_r = __pyx_t_31;
9584   __pyx_t_31 = 0;
9585   goto __pyx_L0;
9586 
9587   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1053
9588  *
9589  *
9590  * cpdef carma_innovations_algo_fast(int nobs,             # <<<<<<<<<<<<<<
9591  *                                            cnp.complex64_t [:] ar_params,
9592  *                                            cnp.complex64_t [:] ma_params,
9593  */
9594 
9595   /* function exit code */
9596   __pyx_L1_error:;
9597   __Pyx_XDECREF(__pyx_t_5);
9598   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
9599   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
9600   __Pyx_XDECREF(__pyx_t_30);
9601   __Pyx_XDECREF(__pyx_t_31);
9602   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_innovations_algo_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
9603   __pyx_r = 0;
9604   __pyx_L0:;
9605   __PYX_XDEC_MEMVIEW(&__pyx_v_theta, 1);
9606   __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
9607   __Pyx_XGIVEREF(__pyx_r);
9608   __Pyx_RefNannyFinishContext();
9609   return __pyx_r;
9610 }
9611 
9612 /* Python wrapper */
9613 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_23carma_innovations_algo_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9614 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_22carma_innovations_algo_fast[] = "\n    arma_innovations_algo_fast(int nobs, cnp.complex64_t [:] ar_params, cnp.complex64_t [:] ma_params, cnp.complex64_t [:, :] acovf, cnp.complex64_t [:] acovf2)\n    \n    Quickly apply innovations algorithm for an ARMA process.\n\n    Parameters\n    ----------\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    acovf : ndarray\n        An `m * 2` x `m * 2` autocovariance matrix at least the first `m`\n        columns filled in, where `m = max(len(ar_params), ma_params)`\n        (see `arma_transformed_acovf_fast`).\n    acovf2 : ndarray\n        A `max(0, nobs - m)` length vector containing the autocovariance\n        function associated with the final `nobs - m` observations.\n\n    Returns\n    -------\n    theta : ndarray\n        The matrix of moving average coefficients from the innovations\n        algorithm.\n    v : ndarray\n        The vector of mean squared errors.\n\n    Notes\n    -----\n    The innovations algorithm is presented in _[1], section 2.5.2.\n\n    Details of the innovations algorithm applied to ARMA processes is given\n    in _[1] section 3.3 and in section 5.2.7.\n\n    This function is relatively fast even with a large number of observations\n    since we can exploit a number of known zeros in the theta array.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_23carma_innovations_algo_fast(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)9615 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_23carma_innovations_algo_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9616   int __pyx_v_nobs;
9617   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
9618   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
9619   __Pyx_memviewslice __pyx_v_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
9620   __Pyx_memviewslice __pyx_v_acovf2 = { 0, 0, { 0 }, { 0 }, { 0 } };
9621   int __pyx_lineno = 0;
9622   const char *__pyx_filename = NULL;
9623   int __pyx_clineno = 0;
9624   PyObject *__pyx_r = 0;
9625   __Pyx_RefNannyDeclarations
9626   __Pyx_RefNannySetupContext("carma_innovations_algo_fast (wrapper)", 0);
9627   {
9628     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nobs,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_acovf,&__pyx_n_s_acovf2,0};
9629     PyObject* values[5] = {0,0,0,0,0};
9630     if (unlikely(__pyx_kwds)) {
9631       Py_ssize_t kw_args;
9632       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9633       switch (pos_args) {
9634         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9635         CYTHON_FALLTHROUGH;
9636         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9637         CYTHON_FALLTHROUGH;
9638         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9639         CYTHON_FALLTHROUGH;
9640         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9641         CYTHON_FALLTHROUGH;
9642         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9643         CYTHON_FALLTHROUGH;
9644         case  0: break;
9645         default: goto __pyx_L5_argtuple_error;
9646       }
9647       kw_args = PyDict_Size(__pyx_kwds);
9648       switch (pos_args) {
9649         case  0:
9650         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nobs)) != 0)) kw_args--;
9651         else goto __pyx_L5_argtuple_error;
9652         CYTHON_FALLTHROUGH;
9653         case  1:
9654         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
9655         else {
9656           __Pyx_RaiseArgtupleInvalid("carma_innovations_algo_fast", 1, 5, 5, 1); __PYX_ERR(0, 1053, __pyx_L3_error)
9657         }
9658         CYTHON_FALLTHROUGH;
9659         case  2:
9660         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
9661         else {
9662           __Pyx_RaiseArgtupleInvalid("carma_innovations_algo_fast", 1, 5, 5, 2); __PYX_ERR(0, 1053, __pyx_L3_error)
9663         }
9664         CYTHON_FALLTHROUGH;
9665         case  3:
9666         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_acovf)) != 0)) kw_args--;
9667         else {
9668           __Pyx_RaiseArgtupleInvalid("carma_innovations_algo_fast", 1, 5, 5, 3); __PYX_ERR(0, 1053, __pyx_L3_error)
9669         }
9670         CYTHON_FALLTHROUGH;
9671         case  4:
9672         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_acovf2)) != 0)) kw_args--;
9673         else {
9674           __Pyx_RaiseArgtupleInvalid("carma_innovations_algo_fast", 1, 5, 5, 4); __PYX_ERR(0, 1053, __pyx_L3_error)
9675         }
9676       }
9677       if (unlikely(kw_args > 0)) {
9678         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "carma_innovations_algo_fast") < 0)) __PYX_ERR(0, 1053, __pyx_L3_error)
9679       }
9680     } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
9681       goto __pyx_L5_argtuple_error;
9682     } else {
9683       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9684       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9685       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9686       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9687       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9688     }
9689     __pyx_v_nobs = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nobs == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1053, __pyx_L3_error)
9690     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 1054, __pyx_L3_error)
9691     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 1055, __pyx_L3_error)
9692     __pyx_v_acovf = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_float_complex(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_acovf.memview)) __PYX_ERR(0, 1056, __pyx_L3_error)
9693     __pyx_v_acovf2 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_acovf2.memview)) __PYX_ERR(0, 1057, __pyx_L3_error)
9694   }
9695   goto __pyx_L4_argument_unpacking_done;
9696   __pyx_L5_argtuple_error:;
9697   __Pyx_RaiseArgtupleInvalid("carma_innovations_algo_fast", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1053, __pyx_L3_error)
9698   __pyx_L3_error:;
9699   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_innovations_algo_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
9700   __Pyx_RefNannyFinishContext();
9701   return NULL;
9702   __pyx_L4_argument_unpacking_done:;
9703   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_22carma_innovations_algo_fast(__pyx_self, __pyx_v_nobs, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_acovf, __pyx_v_acovf2);
9704 
9705   /* function exit code */
9706   __Pyx_RefNannyFinishContext();
9707   return __pyx_r;
9708 }
9709 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_22carma_innovations_algo_fast(CYTHON_UNUSED PyObject * __pyx_self,int __pyx_v_nobs,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_acovf,__Pyx_memviewslice __pyx_v_acovf2)9710 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_22carma_innovations_algo_fast(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nobs, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_acovf, __Pyx_memviewslice __pyx_v_acovf2) {
9711   PyObject *__pyx_r = NULL;
9712   __Pyx_RefNannyDeclarations
9713   PyObject *__pyx_t_1 = NULL;
9714   int __pyx_lineno = 0;
9715   const char *__pyx_filename = NULL;
9716   int __pyx_clineno = 0;
9717   __Pyx_RefNannySetupContext("carma_innovations_algo_fast", 0);
9718   __Pyx_XDECREF(__pyx_r);
9719   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 1053, __pyx_L1_error) }
9720   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 1053, __pyx_L1_error) }
9721   if (unlikely(!__pyx_v_acovf.memview)) { __Pyx_RaiseUnboundLocalError("acovf"); __PYX_ERR(0, 1053, __pyx_L1_error) }
9722   if (unlikely(!__pyx_v_acovf2.memview)) { __Pyx_RaiseUnboundLocalError("acovf2"); __PYX_ERR(0, 1053, __pyx_L1_error) }
9723   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations_algo_fast(__pyx_v_nobs, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_acovf, __pyx_v_acovf2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1053, __pyx_L1_error)
9724   __Pyx_GOTREF(__pyx_t_1);
9725   __pyx_r = __pyx_t_1;
9726   __pyx_t_1 = 0;
9727   goto __pyx_L0;
9728 
9729   /* function exit code */
9730   __pyx_L1_error:;
9731   __Pyx_XDECREF(__pyx_t_1);
9732   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_innovations_algo_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
9733   __pyx_r = NULL;
9734   __pyx_L0:;
9735   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
9736   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
9737   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf, 1);
9738   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf2, 1);
9739   __Pyx_XGIVEREF(__pyx_r);
9740   __Pyx_RefNannyFinishContext();
9741   return __pyx_r;
9742 }
9743 
9744 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1157
9745  *
9746  *
9747  * cpdef carma_innovations_filter(cnp.complex64_t [:] endog,             # <<<<<<<<<<<<<<
9748  *                                         cnp.complex64_t [:] ar_params,
9749  *                                         cnp.complex64_t [:] ma_params,
9750  */
9751 
9752 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_25carma_innovations_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations_filter(__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_theta,CYTHON_UNUSED int __pyx_skip_dispatch)9753 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations_filter(__Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_theta, CYTHON_UNUSED int __pyx_skip_dispatch) {
9754   Py_ssize_t __pyx_v_nobs;
9755   Py_ssize_t __pyx_v_i;
9756   CYTHON_UNUSED Py_ssize_t __pyx_v_k;
9757   Py_ssize_t __pyx_v_j;
9758   Py_ssize_t __pyx_v_m;
9759   Py_ssize_t __pyx_v_p;
9760   Py_ssize_t __pyx_v_q;
9761   npy_intp __pyx_v_dim1[1];
9762   __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
9763   __pyx_t_float_complex __pyx_v_hat;
9764   PyObject *__pyx_r = NULL;
9765   __Pyx_RefNannyDeclarations
9766   size_t __pyx_t_1;
9767   Py_ssize_t __pyx_t_2;
9768   Py_ssize_t __pyx_t_3;
9769   Py_ssize_t __pyx_t_4;
9770   PyObject *__pyx_t_5 = NULL;
9771   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
9772   Py_ssize_t __pyx_t_7;
9773   Py_ssize_t __pyx_t_8;
9774   int __pyx_t_9;
9775   Py_ssize_t __pyx_t_10;
9776   Py_ssize_t __pyx_t_11;
9777   Py_ssize_t __pyx_t_12;
9778   Py_ssize_t __pyx_t_13;
9779   int __pyx_lineno = 0;
9780   const char *__pyx_filename = NULL;
9781   int __pyx_clineno = 0;
9782   __Pyx_RefNannySetupContext("carma_innovations_filter", 0);
9783 
9784   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1202
9785  *     cdef cnp.complex64_t hat
9786  *
9787  *     p = len(ar_params)             # <<<<<<<<<<<<<<
9788  *     q = len(ma_params)
9789  *     m = max(p, q)
9790  */
9791   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
9792   __pyx_v_p = __pyx_t_1;
9793 
9794   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1203
9795  *
9796  *     p = len(ar_params)
9797  *     q = len(ma_params)             # <<<<<<<<<<<<<<
9798  *     m = max(p, q)
9799  *
9800  */
9801   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma_params);
9802   __pyx_v_q = __pyx_t_1;
9803 
9804   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1204
9805  *     p = len(ar_params)
9806  *     q = len(ma_params)
9807  *     m = max(p, q)             # <<<<<<<<<<<<<<
9808  *
9809  *     nobs = theta.shape[0]
9810  */
9811   __pyx_t_2 = __pyx_v_q;
9812   __pyx_t_3 = __pyx_v_p;
9813   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
9814     __pyx_t_4 = __pyx_t_2;
9815   } else {
9816     __pyx_t_4 = __pyx_t_3;
9817   }
9818   __pyx_v_m = __pyx_t_4;
9819 
9820   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1206
9821  *     m = max(p, q)
9822  *
9823  *     nobs = theta.shape[0]             # <<<<<<<<<<<<<<
9824  *     k = theta.shape[1]
9825  *
9826  */
9827   __pyx_v_nobs = (__pyx_v_theta.shape[0]);
9828 
9829   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1207
9830  *
9831  *     nobs = theta.shape[0]
9832  *     k = theta.shape[1]             # <<<<<<<<<<<<<<
9833  *
9834  *     dim1[0] = nobs;
9835  */
9836   __pyx_v_k = (__pyx_v_theta.shape[1]);
9837 
9838   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1209
9839  *     k = theta.shape[1]
9840  *
9841  *     dim1[0] = nobs;             # <<<<<<<<<<<<<<
9842  *     u = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
9843  *     u[0] = endog[0]
9844  */
9845   (__pyx_v_dim1[0]) = __pyx_v_nobs;
9846 
9847   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1210
9848  *
9849  *     dim1[0] = nobs;
9850  *     u = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)             # <<<<<<<<<<<<<<
9851  *     u[0] = endog[0]
9852  *
9853  */
9854   __pyx_t_5 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_COMPLEX64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1210, __pyx_L1_error)
9855   __Pyx_GOTREF(__pyx_t_5);
9856   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1210, __pyx_L1_error)
9857   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9858   __pyx_v_u = __pyx_t_6;
9859   __pyx_t_6.memview = NULL;
9860   __pyx_t_6.data = NULL;
9861 
9862   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1211
9863  *     dim1[0] = nobs;
9864  *     u = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
9865  *     u[0] = endog[0]             # <<<<<<<<<<<<<<
9866  *
9867  *     for i in range(1, nobs):
9868  */
9869   __pyx_t_7 = 0;
9870   __pyx_t_8 = 0;
9871   *((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_8 * __pyx_v_u.strides[0]) )) = (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_endog.data + __pyx_t_7 * __pyx_v_endog.strides[0]) )));
9872 
9873   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1213
9874  *     u[0] = endog[0]
9875  *
9876  *     for i in range(1, nobs):             # <<<<<<<<<<<<<<
9877  *         hat = 0
9878  *         if i < m:
9879  */
9880   __pyx_t_4 = __pyx_v_nobs;
9881   __pyx_t_2 = __pyx_t_4;
9882   for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
9883     __pyx_v_i = __pyx_t_3;
9884 
9885     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1214
9886  *
9887  *     for i in range(1, nobs):
9888  *         hat = 0             # <<<<<<<<<<<<<<
9889  *         if i < m:
9890  *             for j in range(i):
9891  */
9892     __pyx_v_hat = __pyx_t_float_complex_from_parts(0, 0);
9893 
9894     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1215
9895  *     for i in range(1, nobs):
9896  *         hat = 0
9897  *         if i < m:             # <<<<<<<<<<<<<<
9898  *             for j in range(i):
9899  *                 hat = hat + theta[i, j] * u[i - j - 1]
9900  */
9901     __pyx_t_9 = ((__pyx_v_i < __pyx_v_m) != 0);
9902     if (__pyx_t_9) {
9903 
9904       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1216
9905  *         hat = 0
9906  *         if i < m:
9907  *             for j in range(i):             # <<<<<<<<<<<<<<
9908  *                 hat = hat + theta[i, j] * u[i - j - 1]
9909  *         else:
9910  */
9911       __pyx_t_10 = __pyx_v_i;
9912       __pyx_t_11 = __pyx_t_10;
9913       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
9914         __pyx_v_j = __pyx_t_12;
9915 
9916         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1217
9917  *         if i < m:
9918  *             for j in range(i):
9919  *                 hat = hat + theta[i, j] * u[i - j - 1]             # <<<<<<<<<<<<<<
9920  *         else:
9921  *             for j in range(p):
9922  */
9923         __pyx_t_7 = __pyx_v_i;
9924         __pyx_t_8 = __pyx_v_j;
9925         __pyx_t_13 = ((__pyx_v_i - __pyx_v_j) - 1);
9926         __pyx_v_hat = __Pyx_c_sum_float(__pyx_v_hat, __Pyx_c_prod_float((*((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_7 * __pyx_v_theta.strides[0]) ) + __pyx_t_8 * __pyx_v_theta.strides[1]) ))), (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_13 * __pyx_v_u.strides[0]) )))));
9927       }
9928 
9929       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1215
9930  *     for i in range(1, nobs):
9931  *         hat = 0
9932  *         if i < m:             # <<<<<<<<<<<<<<
9933  *             for j in range(i):
9934  *                 hat = hat + theta[i, j] * u[i - j - 1]
9935  */
9936       goto __pyx_L5;
9937     }
9938 
9939     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1219
9940  *                 hat = hat + theta[i, j] * u[i - j - 1]
9941  *         else:
9942  *             for j in range(p):             # <<<<<<<<<<<<<<
9943  *                 hat = hat + ar_params[j] * endog[i - j - 1]
9944  *             for j in range(q):
9945  */
9946     /*else*/ {
9947       __pyx_t_10 = __pyx_v_p;
9948       __pyx_t_11 = __pyx_t_10;
9949       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
9950         __pyx_v_j = __pyx_t_12;
9951 
9952         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1220
9953  *         else:
9954  *             for j in range(p):
9955  *                 hat = hat + ar_params[j] * endog[i - j - 1]             # <<<<<<<<<<<<<<
9956  *             for j in range(q):
9957  *                 hat = hat + theta[i, j] * u[i - j - 1]
9958  */
9959         __pyx_t_13 = __pyx_v_j;
9960         __pyx_t_8 = ((__pyx_v_i - __pyx_v_j) - 1);
9961         __pyx_v_hat = __Pyx_c_sum_float(__pyx_v_hat, __Pyx_c_prod_float((*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_ar_params.data + __pyx_t_13 * __pyx_v_ar_params.strides[0]) ))), (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_endog.data + __pyx_t_8 * __pyx_v_endog.strides[0]) )))));
9962       }
9963 
9964       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1221
9965  *             for j in range(p):
9966  *                 hat = hat + ar_params[j] * endog[i - j - 1]
9967  *             for j in range(q):             # <<<<<<<<<<<<<<
9968  *                 hat = hat + theta[i, j] * u[i - j - 1]
9969  *         u[i] = endog[i] - hat
9970  */
9971       __pyx_t_10 = __pyx_v_q;
9972       __pyx_t_11 = __pyx_t_10;
9973       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
9974         __pyx_v_j = __pyx_t_12;
9975 
9976         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1222
9977  *                 hat = hat + ar_params[j] * endog[i - j - 1]
9978  *             for j in range(q):
9979  *                 hat = hat + theta[i, j] * u[i - j - 1]             # <<<<<<<<<<<<<<
9980  *         u[i] = endog[i] - hat
9981  *
9982  */
9983         __pyx_t_8 = __pyx_v_i;
9984         __pyx_t_13 = __pyx_v_j;
9985         __pyx_t_7 = ((__pyx_v_i - __pyx_v_j) - 1);
9986         __pyx_v_hat = __Pyx_c_sum_float(__pyx_v_hat, __Pyx_c_prod_float((*((__pyx_t_float_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_8 * __pyx_v_theta.strides[0]) ) + __pyx_t_13 * __pyx_v_theta.strides[1]) ))), (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_7 * __pyx_v_u.strides[0]) )))));
9987       }
9988     }
9989     __pyx_L5:;
9990 
9991     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1223
9992  *             for j in range(q):
9993  *                 hat = hat + theta[i, j] * u[i - j - 1]
9994  *         u[i] = endog[i] - hat             # <<<<<<<<<<<<<<
9995  *
9996  *     return u
9997  */
9998     __pyx_t_7 = __pyx_v_i;
9999     __pyx_t_13 = __pyx_v_i;
10000     *((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_13 * __pyx_v_u.strides[0]) )) = __Pyx_c_diff_float((*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_endog.data + __pyx_t_7 * __pyx_v_endog.strides[0]) ))), __pyx_v_hat);
10001   }
10002 
10003   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1225
10004  *         u[i] = endog[i] - hat
10005  *
10006  *     return u             # <<<<<<<<<<<<<<
10007  *
10008  *
10009  */
10010   __Pyx_XDECREF(__pyx_r);
10011   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_u, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_float_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_float_complex, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1225, __pyx_L1_error)
10012   __Pyx_GOTREF(__pyx_t_5);
10013   __pyx_r = __pyx_t_5;
10014   __pyx_t_5 = 0;
10015   goto __pyx_L0;
10016 
10017   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1157
10018  *
10019  *
10020  * cpdef carma_innovations_filter(cnp.complex64_t [:] endog,             # <<<<<<<<<<<<<<
10021  *                                         cnp.complex64_t [:] ar_params,
10022  *                                         cnp.complex64_t [:] ma_params,
10023  */
10024 
10025   /* function exit code */
10026   __pyx_L1_error:;
10027   __Pyx_XDECREF(__pyx_t_5);
10028   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
10029   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_innovations_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
10030   __pyx_r = 0;
10031   __pyx_L0:;
10032   __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
10033   __Pyx_XGIVEREF(__pyx_r);
10034   __Pyx_RefNannyFinishContext();
10035   return __pyx_r;
10036 }
10037 
10038 /* Python wrapper */
10039 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_25carma_innovations_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10040 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_24carma_innovations_filter[] = "\n    arma_innovations_filter(cnp.complex64_t [:] endog, cnp.complex64_t [:] ar_params, cnp.complex64_t [:] ma_params, cnp.complex64_t [:, :] theta):\n    \n    Innovations filter for an ARMA process.\n\n    Parameters\n    ----------\n    endog : ndarray\n        The observed time-series process.\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    theta : ndarray\n        The matrix of moving average coefficients from the innovations\n        algorithm (see `arma_innovations_algo` or `arma_innovations_algo_fast`)\n\n    Returns\n    -------\n    u : ndarray\n        The vector of innovations: the one-step-ahead prediction errors from\n        applying the innovations algorithm.\n\n    Notes\n    -----\n    The innovations algorithm is presented in _[1], section 2.5.2.\n\n    Details of the innovations algorithm applied to ARMA processes is given\n    in _[1] section 3.3 and in section 5.2.7.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_25carma_innovations_filter(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)10041 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_25carma_innovations_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10042   __Pyx_memviewslice __pyx_v_endog = { 0, 0, { 0 }, { 0 }, { 0 } };
10043   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
10044   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
10045   __Pyx_memviewslice __pyx_v_theta = { 0, 0, { 0 }, { 0 }, { 0 } };
10046   int __pyx_lineno = 0;
10047   const char *__pyx_filename = NULL;
10048   int __pyx_clineno = 0;
10049   PyObject *__pyx_r = 0;
10050   __Pyx_RefNannyDeclarations
10051   __Pyx_RefNannySetupContext("carma_innovations_filter (wrapper)", 0);
10052   {
10053     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_theta,0};
10054     PyObject* values[4] = {0,0,0,0};
10055     if (unlikely(__pyx_kwds)) {
10056       Py_ssize_t kw_args;
10057       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10058       switch (pos_args) {
10059         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10060         CYTHON_FALLTHROUGH;
10061         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10062         CYTHON_FALLTHROUGH;
10063         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10064         CYTHON_FALLTHROUGH;
10065         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10066         CYTHON_FALLTHROUGH;
10067         case  0: break;
10068         default: goto __pyx_L5_argtuple_error;
10069       }
10070       kw_args = PyDict_Size(__pyx_kwds);
10071       switch (pos_args) {
10072         case  0:
10073         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
10074         else goto __pyx_L5_argtuple_error;
10075         CYTHON_FALLTHROUGH;
10076         case  1:
10077         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
10078         else {
10079           __Pyx_RaiseArgtupleInvalid("carma_innovations_filter", 1, 4, 4, 1); __PYX_ERR(0, 1157, __pyx_L3_error)
10080         }
10081         CYTHON_FALLTHROUGH;
10082         case  2:
10083         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
10084         else {
10085           __Pyx_RaiseArgtupleInvalid("carma_innovations_filter", 1, 4, 4, 2); __PYX_ERR(0, 1157, __pyx_L3_error)
10086         }
10087         CYTHON_FALLTHROUGH;
10088         case  3:
10089         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
10090         else {
10091           __Pyx_RaiseArgtupleInvalid("carma_innovations_filter", 1, 4, 4, 3); __PYX_ERR(0, 1157, __pyx_L3_error)
10092         }
10093       }
10094       if (unlikely(kw_args > 0)) {
10095         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "carma_innovations_filter") < 0)) __PYX_ERR(0, 1157, __pyx_L3_error)
10096       }
10097     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
10098       goto __pyx_L5_argtuple_error;
10099     } else {
10100       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10101       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10102       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10103       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10104     }
10105     __pyx_v_endog = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_endog.memview)) __PYX_ERR(0, 1157, __pyx_L3_error)
10106     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 1158, __pyx_L3_error)
10107     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 1159, __pyx_L3_error)
10108     __pyx_v_theta = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_float_complex(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_theta.memview)) __PYX_ERR(0, 1160, __pyx_L3_error)
10109   }
10110   goto __pyx_L4_argument_unpacking_done;
10111   __pyx_L5_argtuple_error:;
10112   __Pyx_RaiseArgtupleInvalid("carma_innovations_filter", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1157, __pyx_L3_error)
10113   __pyx_L3_error:;
10114   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_innovations_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
10115   __Pyx_RefNannyFinishContext();
10116   return NULL;
10117   __pyx_L4_argument_unpacking_done:;
10118   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_24carma_innovations_filter(__pyx_self, __pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_theta);
10119 
10120   /* function exit code */
10121   __Pyx_RefNannyFinishContext();
10122   return __pyx_r;
10123 }
10124 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_24carma_innovations_filter(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_theta)10125 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_24carma_innovations_filter(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_theta) {
10126   PyObject *__pyx_r = NULL;
10127   __Pyx_RefNannyDeclarations
10128   PyObject *__pyx_t_1 = NULL;
10129   int __pyx_lineno = 0;
10130   const char *__pyx_filename = NULL;
10131   int __pyx_clineno = 0;
10132   __Pyx_RefNannySetupContext("carma_innovations_filter", 0);
10133   __Pyx_XDECREF(__pyx_r);
10134   if (unlikely(!__pyx_v_endog.memview)) { __Pyx_RaiseUnboundLocalError("endog"); __PYX_ERR(0, 1157, __pyx_L1_error) }
10135   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 1157, __pyx_L1_error) }
10136   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 1157, __pyx_L1_error) }
10137   if (unlikely(!__pyx_v_theta.memview)) { __Pyx_RaiseUnboundLocalError("theta"); __PYX_ERR(0, 1157, __pyx_L1_error) }
10138   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations_filter(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_theta, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1157, __pyx_L1_error)
10139   __Pyx_GOTREF(__pyx_t_1);
10140   __pyx_r = __pyx_t_1;
10141   __pyx_t_1 = 0;
10142   goto __pyx_L0;
10143 
10144   /* function exit code */
10145   __pyx_L1_error:;
10146   __Pyx_XDECREF(__pyx_t_1);
10147   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_innovations_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
10148   __pyx_r = NULL;
10149   __pyx_L0:;
10150   __PYX_XDEC_MEMVIEW(&__pyx_v_endog, 1);
10151   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
10152   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
10153   __PYX_XDEC_MEMVIEW(&__pyx_v_theta, 1);
10154   __Pyx_XGIVEREF(__pyx_r);
10155   __Pyx_RefNannyFinishContext();
10156   return __pyx_r;
10157 }
10158 
10159 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1228
10160  *
10161  *
10162  * cpdef carma_innovations(cnp.complex64_t [:] endog,             # <<<<<<<<<<<<<<
10163  *                                       cnp.complex64_t [:] ar_params,
10164  *                                       cnp.complex64_t [:] ma_params,
10165  */
10166 
10167 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_27carma_innovations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations(__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_float_complex __pyx_v_sigma2,CYTHON_UNUSED int __pyx_skip_dispatch)10168 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations(__Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_float_complex __pyx_v_sigma2, CYTHON_UNUSED int __pyx_skip_dispatch) {
10169   Py_ssize_t __pyx_v_nobs;
10170   Py_ssize_t __pyx_v_i;
10171   __Pyx_memviewslice __pyx_v_ar = { 0, 0, { 0 }, { 0 }, { 0 } };
10172   __Pyx_memviewslice __pyx_v_ma = { 0, 0, { 0 }, { 0 }, { 0 } };
10173   __Pyx_memviewslice __pyx_v_arma_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
10174   __Pyx_memviewslice __pyx_v_acovf2 = { 0, 0, { 0 }, { 0 }, { 0 } };
10175   __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
10176   __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
10177   __Pyx_memviewslice __pyx_v_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
10178   npy_intp __pyx_v_dim1[1];
10179   PyObject *__pyx_v_theta = NULL;
10180   PyObject *__pyx_r = NULL;
10181   __Pyx_RefNannyDeclarations
10182   size_t __pyx_t_1;
10183   PyObject *__pyx_t_2 = NULL;
10184   __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
10185   Py_ssize_t __pyx_t_4;
10186   Py_ssize_t __pyx_t_5;
10187   Py_ssize_t __pyx_t_6;
10188   Py_ssize_t __pyx_t_7;
10189   Py_ssize_t __pyx_t_8;
10190   int __pyx_t_9;
10191   PyObject *__pyx_t_10 = NULL;
10192   PyObject *__pyx_t_11 = NULL;
10193   PyObject *__pyx_t_12 = NULL;
10194   PyObject *__pyx_t_13 = NULL;
10195   PyObject *__pyx_t_14 = NULL;
10196   PyObject *(*__pyx_t_15)(PyObject *);
10197   __Pyx_memviewslice __pyx_t_16 = { 0, 0, { 0 }, { 0 }, { 0 } };
10198   int __pyx_lineno = 0;
10199   const char *__pyx_filename = NULL;
10200   int __pyx_clineno = 0;
10201   __Pyx_RefNannySetupContext("carma_innovations", 0);
10202 
10203   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1266
10204  *        New York, NY: Springer.
10205  *     """
10206  *     cdef Py_ssize_t nobs = len(endog), i             # <<<<<<<<<<<<<<
10207  *     cdef cnp.complex64_t const
10208  *     cdef cnp.complex64_t [:] ar, ma, arma_acovf, llf_obs, acovf2, u, v
10209  */
10210   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_endog);
10211   __pyx_v_nobs = __pyx_t_1;
10212 
10213   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1272
10214  *     cdef cnp.npy_intp dim1[1]
10215  *
10216  *     dim1[0] = len(ar_params) + 1;             # <<<<<<<<<<<<<<
10217  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
10218  *     dim1[0] = len(ma_params) + 1;
10219  */
10220   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
10221   (__pyx_v_dim1[0]) = (__pyx_t_1 + 1);
10222 
10223   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1273
10224  *
10225  *     dim1[0] = len(ar_params) + 1;
10226  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)             # <<<<<<<<<<<<<<
10227  *     dim1[0] = len(ma_params) + 1;
10228  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
10229  */
10230   __pyx_t_2 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_COMPLEX64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1273, __pyx_L1_error)
10231   __Pyx_GOTREF(__pyx_t_2);
10232   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1273, __pyx_L1_error)
10233   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10234   __pyx_v_ar = __pyx_t_3;
10235   __pyx_t_3.memview = NULL;
10236   __pyx_t_3.data = NULL;
10237 
10238   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1274
10239  *     dim1[0] = len(ar_params) + 1;
10240  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
10241  *     dim1[0] = len(ma_params) + 1;             # <<<<<<<<<<<<<<
10242  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
10243  *
10244  */
10245   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma_params);
10246   (__pyx_v_dim1[0]) = (__pyx_t_1 + 1);
10247 
10248   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1275
10249  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
10250  *     dim1[0] = len(ma_params) + 1;
10251  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)             # <<<<<<<<<<<<<<
10252  *
10253  *     ar[0] = 1
10254  */
10255   __pyx_t_2 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_COMPLEX64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1275, __pyx_L1_error)
10256   __Pyx_GOTREF(__pyx_t_2);
10257   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1275, __pyx_L1_error)
10258   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10259   __pyx_v_ma = __pyx_t_3;
10260   __pyx_t_3.memview = NULL;
10261   __pyx_t_3.data = NULL;
10262 
10263   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1277
10264  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
10265  *
10266  *     ar[0] = 1             # <<<<<<<<<<<<<<
10267  *     for i in range(1, len(ar_params) + 1):
10268  *         ar[i] = -1 * ar_params[i - 1]
10269  */
10270   __pyx_t_4 = 0;
10271   *((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_ar.data + __pyx_t_4 * __pyx_v_ar.strides[0]) )) = __pyx_t_float_complex_from_parts(1, 0);
10272 
10273   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1278
10274  *
10275  *     ar[0] = 1
10276  *     for i in range(1, len(ar_params) + 1):             # <<<<<<<<<<<<<<
10277  *         ar[i] = -1 * ar_params[i - 1]
10278  *     ma[0] = 1
10279  */
10280   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
10281   __pyx_t_5 = (__pyx_t_1 + 1);
10282   __pyx_t_6 = __pyx_t_5;
10283   for (__pyx_t_7 = 1; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
10284     __pyx_v_i = __pyx_t_7;
10285 
10286     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1279
10287  *     ar[0] = 1
10288  *     for i in range(1, len(ar_params) + 1):
10289  *         ar[i] = -1 * ar_params[i - 1]             # <<<<<<<<<<<<<<
10290  *     ma[0] = 1
10291  *     ma[1:] = ma_params
10292  */
10293     __pyx_t_4 = (__pyx_v_i - 1);
10294     __pyx_t_8 = __pyx_v_i;
10295     *((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_ar.data + __pyx_t_8 * __pyx_v_ar.strides[0]) )) = __Pyx_c_prod_float(__pyx_t_float_complex_from_parts(-1L, 0), (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_ar_params.data + __pyx_t_4 * __pyx_v_ar_params.strides[0]) ))));
10296   }
10297 
10298   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1280
10299  *     for i in range(1, len(ar_params) + 1):
10300  *         ar[i] = -1 * ar_params[i - 1]
10301  *     ma[0] = 1             # <<<<<<<<<<<<<<
10302  *     ma[1:] = ma_params
10303  *
10304  */
10305   __pyx_t_4 = 0;
10306   *((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_ma.data + __pyx_t_4 * __pyx_v_ma.strides[0]) )) = __pyx_t_float_complex_from_parts(1, 0);
10307 
10308   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1281
10309  *         ar[i] = -1 * ar_params[i - 1]
10310  *     ma[0] = 1
10311  *     ma[1:] = ma_params             # <<<<<<<<<<<<<<
10312  *
10313  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=np.complex64) / sigma2
10314  */
10315   __pyx_t_3.data = __pyx_v_ma.data;
10316   __pyx_t_3.memview = __pyx_v_ma.memview;
10317   __PYX_INC_MEMVIEW(&__pyx_t_3, 0);
10318   __pyx_t_9 = -1;
10319   if (unlikely(__pyx_memoryview_slice_memviewslice(
10320     &__pyx_t_3,
10321     __pyx_v_ma.shape[0], __pyx_v_ma.strides[0], __pyx_v_ma.suboffsets[0],
10322     0,
10323     0,
10324     &__pyx_t_9,
10325     1,
10326     0,
10327     0,
10328     1,
10329     0,
10330     0,
10331     1) < 0))
10332 {
10333     __PYX_ERR(0, 1281, __pyx_L1_error)
10334 }
10335 
10336 if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_ma_params, __pyx_t_3, 1, 1, 0) < 0)) __PYX_ERR(0, 1281, __pyx_L1_error)
10337   __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
10338   __pyx_t_3.memview = NULL;
10339   __pyx_t_3.data = NULL;
10340 
10341   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1283
10342  *     ma[1:] = ma_params
10343  *
10344  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=np.complex64) / sigma2             # <<<<<<<<<<<<<<
10345  *     acovf, acovf2 = carma_transformed_acovf_fast(ar, ma, arma_acovf)
10346  *     theta, v = carma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)
10347  */
10348   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_arima_process); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1283, __pyx_L1_error)
10349   __Pyx_GOTREF(__pyx_t_2);
10350   __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_arma_acovf); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1283, __pyx_L1_error)
10351   __Pyx_GOTREF(__pyx_t_10);
10352   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10353   __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_ar, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_float_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_float_complex, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1283, __pyx_L1_error)
10354   __Pyx_GOTREF(__pyx_t_2);
10355   __pyx_t_11 = __pyx_memoryview_fromslice(__pyx_v_ma, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_float_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_float_complex, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1283, __pyx_L1_error)
10356   __Pyx_GOTREF(__pyx_t_11);
10357   __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_nobs); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1283, __pyx_L1_error)
10358   __Pyx_GOTREF(__pyx_t_12);
10359   __pyx_t_13 = __pyx_PyComplex_FromComplex(__pyx_v_sigma2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1283, __pyx_L1_error)
10360   __Pyx_GOTREF(__pyx_t_13);
10361   __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1283, __pyx_L1_error)
10362   __Pyx_GOTREF(__pyx_t_14);
10363   __Pyx_GIVEREF(__pyx_t_2);
10364   PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2);
10365   __Pyx_GIVEREF(__pyx_t_11);
10366   PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_11);
10367   __Pyx_GIVEREF(__pyx_t_12);
10368   PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_12);
10369   __Pyx_GIVEREF(__pyx_t_13);
10370   PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_13);
10371   __pyx_t_2 = 0;
10372   __pyx_t_11 = 0;
10373   __pyx_t_12 = 0;
10374   __pyx_t_13 = 0;
10375   __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1283, __pyx_L1_error)
10376   __Pyx_GOTREF(__pyx_t_13);
10377   __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1283, __pyx_L1_error)
10378   __Pyx_GOTREF(__pyx_t_12);
10379   __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_complex64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1283, __pyx_L1_error)
10380   __Pyx_GOTREF(__pyx_t_11);
10381   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
10382   if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 1283, __pyx_L1_error)
10383   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
10384   __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1283, __pyx_L1_error)
10385   __Pyx_GOTREF(__pyx_t_11);
10386   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10387   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
10388   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
10389   __pyx_t_13 = __pyx_PyComplex_FromComplex(__pyx_v_sigma2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1283, __pyx_L1_error)
10390   __Pyx_GOTREF(__pyx_t_13);
10391   __pyx_t_14 = __Pyx_PyNumber_Divide(__pyx_t_11, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1283, __pyx_L1_error)
10392   __Pyx_GOTREF(__pyx_t_14);
10393   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
10394   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
10395   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(__pyx_t_14, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1283, __pyx_L1_error)
10396   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
10397   __pyx_v_arma_acovf = __pyx_t_3;
10398   __pyx_t_3.memview = NULL;
10399   __pyx_t_3.data = NULL;
10400 
10401   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1284
10402  *
10403  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=np.complex64) / sigma2
10404  *     acovf, acovf2 = carma_transformed_acovf_fast(ar, ma, arma_acovf)             # <<<<<<<<<<<<<<
10405  *     theta, v = carma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)
10406  *     u = carma_innovations_filter(endog, ar_params, ma_params, theta)
10407  */
10408   __pyx_t_14 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_transformed_acovf_fast(__pyx_v_ar, __pyx_v_ma, __pyx_v_arma_acovf, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1284, __pyx_L1_error)
10409   __Pyx_GOTREF(__pyx_t_14);
10410   if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
10411     PyObject* sequence = __pyx_t_14;
10412     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10413     if (unlikely(size != 2)) {
10414       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10415       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10416       __PYX_ERR(0, 1284, __pyx_L1_error)
10417     }
10418     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10419     if (likely(PyTuple_CheckExact(sequence))) {
10420       __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0);
10421       __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
10422     } else {
10423       __pyx_t_13 = PyList_GET_ITEM(sequence, 0);
10424       __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
10425     }
10426     __Pyx_INCREF(__pyx_t_13);
10427     __Pyx_INCREF(__pyx_t_11);
10428     #else
10429     __pyx_t_13 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1284, __pyx_L1_error)
10430     __Pyx_GOTREF(__pyx_t_13);
10431     __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1284, __pyx_L1_error)
10432     __Pyx_GOTREF(__pyx_t_11);
10433     #endif
10434     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
10435   } else {
10436     Py_ssize_t index = -1;
10437     __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1284, __pyx_L1_error)
10438     __Pyx_GOTREF(__pyx_t_10);
10439     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
10440     __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
10441     index = 0; __pyx_t_13 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_13)) goto __pyx_L5_unpacking_failed;
10442     __Pyx_GOTREF(__pyx_t_13);
10443     index = 1; __pyx_t_11 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_11)) goto __pyx_L5_unpacking_failed;
10444     __Pyx_GOTREF(__pyx_t_11);
10445     if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_10), 2) < 0) __PYX_ERR(0, 1284, __pyx_L1_error)
10446     __pyx_t_15 = NULL;
10447     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10448     goto __pyx_L6_unpacking_done;
10449     __pyx_L5_unpacking_failed:;
10450     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10451     __pyx_t_15 = NULL;
10452     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
10453     __PYX_ERR(0, 1284, __pyx_L1_error)
10454     __pyx_L6_unpacking_done:;
10455   }
10456   __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_float_complex(__pyx_t_13, PyBUF_WRITABLE); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 1284, __pyx_L1_error)
10457   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
10458   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(__pyx_t_11, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1284, __pyx_L1_error)
10459   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
10460   __pyx_v_acovf = __pyx_t_16;
10461   __pyx_t_16.memview = NULL;
10462   __pyx_t_16.data = NULL;
10463   __pyx_v_acovf2 = __pyx_t_3;
10464   __pyx_t_3.memview = NULL;
10465   __pyx_t_3.data = NULL;
10466 
10467   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1285
10468  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=np.complex64) / sigma2
10469  *     acovf, acovf2 = carma_transformed_acovf_fast(ar, ma, arma_acovf)
10470  *     theta, v = carma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)             # <<<<<<<<<<<<<<
10471  *     u = carma_innovations_filter(endog, ar_params, ma_params, theta)
10472  *
10473  */
10474   __pyx_t_14 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations_algo_fast(__pyx_v_nobs, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_acovf, __pyx_v_acovf2, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1285, __pyx_L1_error)
10475   __Pyx_GOTREF(__pyx_t_14);
10476   if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
10477     PyObject* sequence = __pyx_t_14;
10478     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10479     if (unlikely(size != 2)) {
10480       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10481       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10482       __PYX_ERR(0, 1285, __pyx_L1_error)
10483     }
10484     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10485     if (likely(PyTuple_CheckExact(sequence))) {
10486       __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0);
10487       __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
10488     } else {
10489       __pyx_t_11 = PyList_GET_ITEM(sequence, 0);
10490       __pyx_t_13 = PyList_GET_ITEM(sequence, 1);
10491     }
10492     __Pyx_INCREF(__pyx_t_11);
10493     __Pyx_INCREF(__pyx_t_13);
10494     #else
10495     __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1285, __pyx_L1_error)
10496     __Pyx_GOTREF(__pyx_t_11);
10497     __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1285, __pyx_L1_error)
10498     __Pyx_GOTREF(__pyx_t_13);
10499     #endif
10500     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
10501   } else {
10502     Py_ssize_t index = -1;
10503     __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1285, __pyx_L1_error)
10504     __Pyx_GOTREF(__pyx_t_10);
10505     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
10506     __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
10507     index = 0; __pyx_t_11 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_11)) goto __pyx_L7_unpacking_failed;
10508     __Pyx_GOTREF(__pyx_t_11);
10509     index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_13)) goto __pyx_L7_unpacking_failed;
10510     __Pyx_GOTREF(__pyx_t_13);
10511     if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_10), 2) < 0) __PYX_ERR(0, 1285, __pyx_L1_error)
10512     __pyx_t_15 = NULL;
10513     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10514     goto __pyx_L8_unpacking_done;
10515     __pyx_L7_unpacking_failed:;
10516     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10517     __pyx_t_15 = NULL;
10518     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
10519     __PYX_ERR(0, 1285, __pyx_L1_error)
10520     __pyx_L8_unpacking_done:;
10521   }
10522   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(__pyx_t_13, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1285, __pyx_L1_error)
10523   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
10524   __pyx_v_theta = __pyx_t_11;
10525   __pyx_t_11 = 0;
10526   __pyx_v_v = __pyx_t_3;
10527   __pyx_t_3.memview = NULL;
10528   __pyx_t_3.data = NULL;
10529 
10530   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1286
10531  *     acovf, acovf2 = carma_transformed_acovf_fast(ar, ma, arma_acovf)
10532  *     theta, v = carma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)
10533  *     u = carma_innovations_filter(endog, ar_params, ma_params, theta)             # <<<<<<<<<<<<<<
10534  *
10535  *     return u, v
10536  */
10537   __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_float_complex(__pyx_v_theta, PyBUF_WRITABLE); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 1286, __pyx_L1_error)
10538   __pyx_t_14 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations_filter(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_t_16, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1286, __pyx_L1_error)
10539   __Pyx_GOTREF(__pyx_t_14);
10540   __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
10541   __pyx_t_16.memview = NULL;
10542   __pyx_t_16.data = NULL;
10543   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(__pyx_t_14, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1286, __pyx_L1_error)
10544   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
10545   __pyx_v_u = __pyx_t_3;
10546   __pyx_t_3.memview = NULL;
10547   __pyx_t_3.data = NULL;
10548 
10549   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1288
10550  *     u = carma_innovations_filter(endog, ar_params, ma_params, theta)
10551  *
10552  *     return u, v             # <<<<<<<<<<<<<<
10553  *
10554  *
10555  */
10556   __Pyx_XDECREF(__pyx_r);
10557   __pyx_t_14 = __pyx_memoryview_fromslice(__pyx_v_u, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_float_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_float_complex, 0);; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1288, __pyx_L1_error)
10558   __Pyx_GOTREF(__pyx_t_14);
10559   __pyx_t_13 = __pyx_memoryview_fromslice(__pyx_v_v, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_float_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_float_complex, 0);; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1288, __pyx_L1_error)
10560   __Pyx_GOTREF(__pyx_t_13);
10561   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1288, __pyx_L1_error)
10562   __Pyx_GOTREF(__pyx_t_11);
10563   __Pyx_GIVEREF(__pyx_t_14);
10564   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_14);
10565   __Pyx_GIVEREF(__pyx_t_13);
10566   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_13);
10567   __pyx_t_14 = 0;
10568   __pyx_t_13 = 0;
10569   __pyx_r = __pyx_t_11;
10570   __pyx_t_11 = 0;
10571   goto __pyx_L0;
10572 
10573   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1228
10574  *
10575  *
10576  * cpdef carma_innovations(cnp.complex64_t [:] endog,             # <<<<<<<<<<<<<<
10577  *                                       cnp.complex64_t [:] ar_params,
10578  *                                       cnp.complex64_t [:] ma_params,
10579  */
10580 
10581   /* function exit code */
10582   __pyx_L1_error:;
10583   __Pyx_XDECREF(__pyx_t_2);
10584   __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
10585   __Pyx_XDECREF(__pyx_t_10);
10586   __Pyx_XDECREF(__pyx_t_11);
10587   __Pyx_XDECREF(__pyx_t_12);
10588   __Pyx_XDECREF(__pyx_t_13);
10589   __Pyx_XDECREF(__pyx_t_14);
10590   __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
10591   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
10592   __pyx_r = 0;
10593   __pyx_L0:;
10594   __PYX_XDEC_MEMVIEW(&__pyx_v_ar, 1);
10595   __PYX_XDEC_MEMVIEW(&__pyx_v_ma, 1);
10596   __PYX_XDEC_MEMVIEW(&__pyx_v_arma_acovf, 1);
10597   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf2, 1);
10598   __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
10599   __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
10600   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf, 1);
10601   __Pyx_XDECREF(__pyx_v_theta);
10602   __Pyx_XGIVEREF(__pyx_r);
10603   __Pyx_RefNannyFinishContext();
10604   return __pyx_r;
10605 }
10606 
10607 /* Python wrapper */
10608 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_27carma_innovations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10609 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_26carma_innovations[] = "\n    arma_innovations(cnp.complex64_t [:] endog, cnp.complex64_t [:] ar_params, cnp.complex64_t [:] ma_params):\n    \n    Compute innovations and variances based on an ARMA process.\n\n    Parameters\n    ----------\n    endog : ndarray\n        The observed time-series process.\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    sigma2 : ndarray\n        The ARMA innovation variance.\n\n    Returns\n    -------\n    u : ndarray\n        The vector of innovations: the one-step-ahead prediction errors from\n        applying the innovations algorithm.\n    v : ndarray\n        The vector of innovation variances.\n\n    Notes\n    -----\n    The innovations algorithm is presented in _[1], section 2.5.2.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_27carma_innovations(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)10610 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_27carma_innovations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10611   __Pyx_memviewslice __pyx_v_endog = { 0, 0, { 0 }, { 0 }, { 0 } };
10612   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
10613   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
10614   __pyx_t_float_complex __pyx_v_sigma2;
10615   int __pyx_lineno = 0;
10616   const char *__pyx_filename = NULL;
10617   int __pyx_clineno = 0;
10618   PyObject *__pyx_r = 0;
10619   __Pyx_RefNannyDeclarations
10620   __Pyx_RefNannySetupContext("carma_innovations (wrapper)", 0);
10621   {
10622     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_sigma2,0};
10623     PyObject* values[4] = {0,0,0,0};
10624     if (unlikely(__pyx_kwds)) {
10625       Py_ssize_t kw_args;
10626       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10627       switch (pos_args) {
10628         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10629         CYTHON_FALLTHROUGH;
10630         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10631         CYTHON_FALLTHROUGH;
10632         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10633         CYTHON_FALLTHROUGH;
10634         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10635         CYTHON_FALLTHROUGH;
10636         case  0: break;
10637         default: goto __pyx_L5_argtuple_error;
10638       }
10639       kw_args = PyDict_Size(__pyx_kwds);
10640       switch (pos_args) {
10641         case  0:
10642         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
10643         else goto __pyx_L5_argtuple_error;
10644         CYTHON_FALLTHROUGH;
10645         case  1:
10646         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
10647         else {
10648           __Pyx_RaiseArgtupleInvalid("carma_innovations", 1, 4, 4, 1); __PYX_ERR(0, 1228, __pyx_L3_error)
10649         }
10650         CYTHON_FALLTHROUGH;
10651         case  2:
10652         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
10653         else {
10654           __Pyx_RaiseArgtupleInvalid("carma_innovations", 1, 4, 4, 2); __PYX_ERR(0, 1228, __pyx_L3_error)
10655         }
10656         CYTHON_FALLTHROUGH;
10657         case  3:
10658         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma2)) != 0)) kw_args--;
10659         else {
10660           __Pyx_RaiseArgtupleInvalid("carma_innovations", 1, 4, 4, 3); __PYX_ERR(0, 1228, __pyx_L3_error)
10661         }
10662       }
10663       if (unlikely(kw_args > 0)) {
10664         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "carma_innovations") < 0)) __PYX_ERR(0, 1228, __pyx_L3_error)
10665       }
10666     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
10667       goto __pyx_L5_argtuple_error;
10668     } else {
10669       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10670       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10671       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10672       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10673     }
10674     __pyx_v_endog = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_endog.memview)) __PYX_ERR(0, 1228, __pyx_L3_error)
10675     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 1229, __pyx_L3_error)
10676     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 1230, __pyx_L3_error)
10677     __pyx_v_sigma2 = __Pyx_PyComplex_As___pyx_t_float_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1231, __pyx_L3_error)
10678   }
10679   goto __pyx_L4_argument_unpacking_done;
10680   __pyx_L5_argtuple_error:;
10681   __Pyx_RaiseArgtupleInvalid("carma_innovations", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1228, __pyx_L3_error)
10682   __pyx_L3_error:;
10683   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
10684   __Pyx_RefNannyFinishContext();
10685   return NULL;
10686   __pyx_L4_argument_unpacking_done:;
10687   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_26carma_innovations(__pyx_self, __pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2);
10688 
10689   /* function exit code */
10690   __Pyx_RefNannyFinishContext();
10691   return __pyx_r;
10692 }
10693 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_26carma_innovations(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_float_complex __pyx_v_sigma2)10694 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_26carma_innovations(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_float_complex __pyx_v_sigma2) {
10695   PyObject *__pyx_r = NULL;
10696   __Pyx_RefNannyDeclarations
10697   PyObject *__pyx_t_1 = NULL;
10698   int __pyx_lineno = 0;
10699   const char *__pyx_filename = NULL;
10700   int __pyx_clineno = 0;
10701   __Pyx_RefNannySetupContext("carma_innovations", 0);
10702   __Pyx_XDECREF(__pyx_r);
10703   if (unlikely(!__pyx_v_endog.memview)) { __Pyx_RaiseUnboundLocalError("endog"); __PYX_ERR(0, 1228, __pyx_L1_error) }
10704   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 1228, __pyx_L1_error) }
10705   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 1228, __pyx_L1_error) }
10706   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1228, __pyx_L1_error)
10707   __Pyx_GOTREF(__pyx_t_1);
10708   __pyx_r = __pyx_t_1;
10709   __pyx_t_1 = 0;
10710   goto __pyx_L0;
10711 
10712   /* function exit code */
10713   __pyx_L1_error:;
10714   __Pyx_XDECREF(__pyx_t_1);
10715   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
10716   __pyx_r = NULL;
10717   __pyx_L0:;
10718   __PYX_XDEC_MEMVIEW(&__pyx_v_endog, 1);
10719   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
10720   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
10721   __Pyx_XGIVEREF(__pyx_r);
10722   __Pyx_RefNannyFinishContext();
10723   return __pyx_r;
10724 }
10725 
10726 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1291
10727  *
10728  *
10729  * cpdef carma_loglikeobs_fast(cnp.complex64_t [:] endog,             # <<<<<<<<<<<<<<
10730  *                                      cnp.complex64_t [:] ar_params,
10731  *                                      cnp.complex64_t [:] ma_params,
10732  */
10733 
10734 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_29carma_loglikeobs_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_loglikeobs_fast(__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_float_complex __pyx_v_sigma2,CYTHON_UNUSED int __pyx_skip_dispatch)10735 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_loglikeobs_fast(__Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_float_complex __pyx_v_sigma2, CYTHON_UNUSED int __pyx_skip_dispatch) {
10736   Py_ssize_t __pyx_v_nobs;
10737   Py_ssize_t __pyx_v_i;
10738   __pyx_t_float_complex __pyx_v_const;
10739   __Pyx_memviewslice __pyx_v_llf_obs = { 0, 0, { 0 }, { 0 }, { 0 } };
10740   __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
10741   __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
10742   npy_intp __pyx_v_dim1[1];
10743   PyObject *__pyx_r = NULL;
10744   __Pyx_RefNannyDeclarations
10745   size_t __pyx_t_1;
10746   PyObject *__pyx_t_2 = NULL;
10747   PyObject *__pyx_t_3 = NULL;
10748   PyObject *__pyx_t_4 = NULL;
10749   PyObject *__pyx_t_5 = NULL;
10750   PyObject *(*__pyx_t_6)(PyObject *);
10751   __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
10752   __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
10753   __pyx_t_double_complex __pyx_t_9;
10754   Py_ssize_t __pyx_t_10;
10755   Py_ssize_t __pyx_t_11;
10756   Py_ssize_t __pyx_t_12;
10757   Py_ssize_t __pyx_t_13;
10758   __pyx_t_float_complex __pyx_t_14;
10759   __pyx_t_double_complex __pyx_t_15;
10760   __pyx_t_double_complex __pyx_t_16;
10761   PyObject *__pyx_t_17 = NULL;
10762   int __pyx_lineno = 0;
10763   const char *__pyx_filename = NULL;
10764   int __pyx_clineno = 0;
10765   __Pyx_RefNannySetupContext("carma_loglikeobs_fast", 0);
10766 
10767   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1328
10768  *     """
10769  *
10770  *     cdef Py_ssize_t nobs = len(endog), i             # <<<<<<<<<<<<<<
10771  *     cdef cnp.complex64_t const
10772  *     cdef cnp.complex64_t [:] llf_obs, u, v
10773  */
10774   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_endog);
10775   __pyx_v_nobs = __pyx_t_1;
10776 
10777   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1333
10778  *     cdef cnp.npy_intp dim1[1]
10779  *
10780  *     u, v = carma_innovations(endog, ar_params, ma_params, sigma2)             # <<<<<<<<<<<<<<
10781  *
10782  *     dim1[0] = nobs;
10783  */
10784   __pyx_t_2 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_innovations(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1333, __pyx_L1_error)
10785   __Pyx_GOTREF(__pyx_t_2);
10786   if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
10787     PyObject* sequence = __pyx_t_2;
10788     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10789     if (unlikely(size != 2)) {
10790       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10791       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10792       __PYX_ERR(0, 1333, __pyx_L1_error)
10793     }
10794     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10795     if (likely(PyTuple_CheckExact(sequence))) {
10796       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
10797       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
10798     } else {
10799       __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
10800       __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
10801     }
10802     __Pyx_INCREF(__pyx_t_3);
10803     __Pyx_INCREF(__pyx_t_4);
10804     #else
10805     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1333, __pyx_L1_error)
10806     __Pyx_GOTREF(__pyx_t_3);
10807     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1333, __pyx_L1_error)
10808     __Pyx_GOTREF(__pyx_t_4);
10809     #endif
10810     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10811   } else {
10812     Py_ssize_t index = -1;
10813     __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1333, __pyx_L1_error)
10814     __Pyx_GOTREF(__pyx_t_5);
10815     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10816     __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
10817     index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
10818     __Pyx_GOTREF(__pyx_t_3);
10819     index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
10820     __Pyx_GOTREF(__pyx_t_4);
10821     if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1333, __pyx_L1_error)
10822     __pyx_t_6 = NULL;
10823     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10824     goto __pyx_L4_unpacking_done;
10825     __pyx_L3_unpacking_failed:;
10826     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10827     __pyx_t_6 = NULL;
10828     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
10829     __PYX_ERR(0, 1333, __pyx_L1_error)
10830     __pyx_L4_unpacking_done:;
10831   }
10832   __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1333, __pyx_L1_error)
10833   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10834   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1333, __pyx_L1_error)
10835   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10836   __pyx_v_u = __pyx_t_7;
10837   __pyx_t_7.memview = NULL;
10838   __pyx_t_7.data = NULL;
10839   __pyx_v_v = __pyx_t_8;
10840   __pyx_t_8.memview = NULL;
10841   __pyx_t_8.data = NULL;
10842 
10843   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1335
10844  *     u, v = carma_innovations(endog, ar_params, ma_params, sigma2)
10845  *
10846  *     dim1[0] = nobs;             # <<<<<<<<<<<<<<
10847  *     llf_obs = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
10848  *
10849  */
10850   (__pyx_v_dim1[0]) = __pyx_v_nobs;
10851 
10852   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1336
10853  *
10854  *     dim1[0] = nobs;
10855  *     llf_obs = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)             # <<<<<<<<<<<<<<
10856  *
10857  *     const = zlog(2*NPY_PI)
10858  */
10859   __pyx_t_2 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_COMPLEX64, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1336, __pyx_L1_error)
10860   __Pyx_GOTREF(__pyx_t_2);
10861   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1336, __pyx_L1_error)
10862   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10863   __pyx_v_llf_obs = __pyx_t_8;
10864   __pyx_t_8.memview = NULL;
10865   __pyx_t_8.data = NULL;
10866 
10867   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1338
10868  *     llf_obs = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX64, C)
10869  *
10870  *     const = zlog(2*NPY_PI)             # <<<<<<<<<<<<<<
10871  *     for i in range(nobs):
10872  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + zlog(sigma2 * v[i]))
10873  */
10874   __pyx_t_9 = __pyx_f_11statsmodels_3src_4math_zlog(__pyx_t_double_complex_from_parts((2.0 * NPY_PI), 0));
10875   __pyx_v_const = __pyx_t_float_complex_from_parts(__Pyx_CREAL(__pyx_t_9), __Pyx_CIMAG(__pyx_t_9));
10876 
10877   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1339
10878  *
10879  *     const = zlog(2*NPY_PI)
10880  *     for i in range(nobs):             # <<<<<<<<<<<<<<
10881  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + zlog(sigma2 * v[i]))
10882  *
10883  */
10884   __pyx_t_10 = __pyx_v_nobs;
10885   __pyx_t_11 = __pyx_t_10;
10886   for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
10887     __pyx_v_i = __pyx_t_12;
10888 
10889     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1340
10890  *     const = zlog(2*NPY_PI)
10891  *     for i in range(nobs):
10892  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + zlog(sigma2 * v[i]))             # <<<<<<<<<<<<<<
10893  *
10894  *     return np.array(llf_obs, dtype=np.complex64)
10895  */
10896     __pyx_t_13 = __pyx_v_i;
10897     __pyx_t_14 = __Pyx_c_pow_float((*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_13 * __pyx_v_u.strides[0]) ))), __pyx_t_float_complex_from_parts(2, 0));
10898     __pyx_t_9 = __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(-0.5, 0), __pyx_t_double_complex_from_parts(__Pyx_CREAL(__pyx_t_14), __Pyx_CIMAG(__pyx_t_14)));
10899     __pyx_t_13 = __pyx_v_i;
10900     __pyx_t_14 = __Pyx_c_prod_float(__pyx_v_sigma2, (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_13 * __pyx_v_v.strides[0]) ))));
10901     __pyx_t_15 = __pyx_t_double_complex_from_parts(__Pyx_CREAL(__pyx_t_14), __Pyx_CIMAG(__pyx_t_14));
10902     if (unlikely(__Pyx_c_is_zero_double(__pyx_t_15))) {
10903       PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10904       __PYX_ERR(0, 1340, __pyx_L1_error)
10905     }
10906     __pyx_t_13 = __pyx_v_i;
10907     __pyx_t_14 = __Pyx_c_prod_float(__pyx_v_sigma2, (*((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_13 * __pyx_v_v.strides[0]) ))));
10908     __pyx_t_16 = __Pyx_c_diff_double(__Pyx_c_quot_double(__pyx_t_9, __pyx_t_15), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(0.5, 0), __Pyx_c_sum_double(__pyx_t_double_complex_from_parts(__Pyx_CREAL(__pyx_v_const), __Pyx_CIMAG(__pyx_v_const)), __pyx_f_11statsmodels_3src_4math_zlog(__pyx_t_double_complex_from_parts(__Pyx_CREAL(__pyx_t_14), __Pyx_CIMAG(__pyx_t_14))))));
10909     __pyx_t_13 = __pyx_v_i;
10910     *((__pyx_t_float_complex *) ( /* dim=0 */ (__pyx_v_llf_obs.data + __pyx_t_13 * __pyx_v_llf_obs.strides[0]) )) = __pyx_t_float_complex_from_parts(__Pyx_CREAL(__pyx_t_16), __Pyx_CIMAG(__pyx_t_16));
10911   }
10912 
10913   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1342
10914  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + zlog(sigma2 * v[i]))
10915  *
10916  *     return np.array(llf_obs, dtype=np.complex64)             # <<<<<<<<<<<<<<
10917  *
10918  *
10919  */
10920   __Pyx_XDECREF(__pyx_r);
10921   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1342, __pyx_L1_error)
10922   __Pyx_GOTREF(__pyx_t_2);
10923   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1342, __pyx_L1_error)
10924   __Pyx_GOTREF(__pyx_t_4);
10925   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10926   __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_llf_obs, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_float_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_float_complex, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1342, __pyx_L1_error)
10927   __Pyx_GOTREF(__pyx_t_2);
10928   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1342, __pyx_L1_error)
10929   __Pyx_GOTREF(__pyx_t_3);
10930   __Pyx_GIVEREF(__pyx_t_2);
10931   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
10932   __pyx_t_2 = 0;
10933   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1342, __pyx_L1_error)
10934   __Pyx_GOTREF(__pyx_t_2);
10935   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1342, __pyx_L1_error)
10936   __Pyx_GOTREF(__pyx_t_5);
10937   __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_complex64); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1342, __pyx_L1_error)
10938   __Pyx_GOTREF(__pyx_t_17);
10939   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10940   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_17) < 0) __PYX_ERR(0, 1342, __pyx_L1_error)
10941   __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10942   __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1342, __pyx_L1_error)
10943   __Pyx_GOTREF(__pyx_t_17);
10944   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10945   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10946   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10947   __pyx_r = __pyx_t_17;
10948   __pyx_t_17 = 0;
10949   goto __pyx_L0;
10950 
10951   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1291
10952  *
10953  *
10954  * cpdef carma_loglikeobs_fast(cnp.complex64_t [:] endog,             # <<<<<<<<<<<<<<
10955  *                                      cnp.complex64_t [:] ar_params,
10956  *                                      cnp.complex64_t [:] ma_params,
10957  */
10958 
10959   /* function exit code */
10960   __pyx_L1_error:;
10961   __Pyx_XDECREF(__pyx_t_2);
10962   __Pyx_XDECREF(__pyx_t_3);
10963   __Pyx_XDECREF(__pyx_t_4);
10964   __Pyx_XDECREF(__pyx_t_5);
10965   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
10966   __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
10967   __Pyx_XDECREF(__pyx_t_17);
10968   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_loglikeobs_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
10969   __pyx_r = 0;
10970   __pyx_L0:;
10971   __PYX_XDEC_MEMVIEW(&__pyx_v_llf_obs, 1);
10972   __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
10973   __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
10974   __Pyx_XGIVEREF(__pyx_r);
10975   __Pyx_RefNannyFinishContext();
10976   return __pyx_r;
10977 }
10978 
10979 /* Python wrapper */
10980 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_29carma_loglikeobs_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10981 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_28carma_loglikeobs_fast[] = "\n    carma_loglikeobs_fast(cnp.complex64_t [:] endog, cnp.complex64_t [:] ar_params, cnp.complex64_t [:] ma_params, cnp.complex64_t sigma2)\n\n    Quickly calculate the loglikelihood of each observation for an ARMA process\n\n    Parameters\n    ----------\n    endog : ndarray\n        The observed time-series process.\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    sigma2 : ndarray\n        The ARMA innovation variance.\n\n    Returns\n    -------\n    loglike : ndarray of float\n        Array of loglikelihood values for each observation.\n\n    Notes\n    -----\n    Details related to computing the loglikelihood associated with an ARMA\n    process using the innovations algorithm are given in _[1] section 5.2.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_29carma_loglikeobs_fast(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)10982 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_29carma_loglikeobs_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10983   __Pyx_memviewslice __pyx_v_endog = { 0, 0, { 0 }, { 0 }, { 0 } };
10984   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
10985   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
10986   __pyx_t_float_complex __pyx_v_sigma2;
10987   int __pyx_lineno = 0;
10988   const char *__pyx_filename = NULL;
10989   int __pyx_clineno = 0;
10990   PyObject *__pyx_r = 0;
10991   __Pyx_RefNannyDeclarations
10992   __Pyx_RefNannySetupContext("carma_loglikeobs_fast (wrapper)", 0);
10993   {
10994     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_sigma2,0};
10995     PyObject* values[4] = {0,0,0,0};
10996     if (unlikely(__pyx_kwds)) {
10997       Py_ssize_t kw_args;
10998       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10999       switch (pos_args) {
11000         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11001         CYTHON_FALLTHROUGH;
11002         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11003         CYTHON_FALLTHROUGH;
11004         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11005         CYTHON_FALLTHROUGH;
11006         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11007         CYTHON_FALLTHROUGH;
11008         case  0: break;
11009         default: goto __pyx_L5_argtuple_error;
11010       }
11011       kw_args = PyDict_Size(__pyx_kwds);
11012       switch (pos_args) {
11013         case  0:
11014         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
11015         else goto __pyx_L5_argtuple_error;
11016         CYTHON_FALLTHROUGH;
11017         case  1:
11018         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
11019         else {
11020           __Pyx_RaiseArgtupleInvalid("carma_loglikeobs_fast", 1, 4, 4, 1); __PYX_ERR(0, 1291, __pyx_L3_error)
11021         }
11022         CYTHON_FALLTHROUGH;
11023         case  2:
11024         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
11025         else {
11026           __Pyx_RaiseArgtupleInvalid("carma_loglikeobs_fast", 1, 4, 4, 2); __PYX_ERR(0, 1291, __pyx_L3_error)
11027         }
11028         CYTHON_FALLTHROUGH;
11029         case  3:
11030         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma2)) != 0)) kw_args--;
11031         else {
11032           __Pyx_RaiseArgtupleInvalid("carma_loglikeobs_fast", 1, 4, 4, 3); __PYX_ERR(0, 1291, __pyx_L3_error)
11033         }
11034       }
11035       if (unlikely(kw_args > 0)) {
11036         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "carma_loglikeobs_fast") < 0)) __PYX_ERR(0, 1291, __pyx_L3_error)
11037       }
11038     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
11039       goto __pyx_L5_argtuple_error;
11040     } else {
11041       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11042       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11043       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11044       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11045     }
11046     __pyx_v_endog = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_endog.memview)) __PYX_ERR(0, 1291, __pyx_L3_error)
11047     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 1292, __pyx_L3_error)
11048     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 1293, __pyx_L3_error)
11049     __pyx_v_sigma2 = __Pyx_PyComplex_As___pyx_t_float_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1294, __pyx_L3_error)
11050   }
11051   goto __pyx_L4_argument_unpacking_done;
11052   __pyx_L5_argtuple_error:;
11053   __Pyx_RaiseArgtupleInvalid("carma_loglikeobs_fast", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1291, __pyx_L3_error)
11054   __pyx_L3_error:;
11055   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_loglikeobs_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
11056   __Pyx_RefNannyFinishContext();
11057   return NULL;
11058   __pyx_L4_argument_unpacking_done:;
11059   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_28carma_loglikeobs_fast(__pyx_self, __pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2);
11060 
11061   /* function exit code */
11062   __Pyx_RefNannyFinishContext();
11063   return __pyx_r;
11064 }
11065 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_28carma_loglikeobs_fast(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_float_complex __pyx_v_sigma2)11066 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_28carma_loglikeobs_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_float_complex __pyx_v_sigma2) {
11067   PyObject *__pyx_r = NULL;
11068   __Pyx_RefNannyDeclarations
11069   PyObject *__pyx_t_1 = NULL;
11070   int __pyx_lineno = 0;
11071   const char *__pyx_filename = NULL;
11072   int __pyx_clineno = 0;
11073   __Pyx_RefNannySetupContext("carma_loglikeobs_fast", 0);
11074   __Pyx_XDECREF(__pyx_r);
11075   if (unlikely(!__pyx_v_endog.memview)) { __Pyx_RaiseUnboundLocalError("endog"); __PYX_ERR(0, 1291, __pyx_L1_error) }
11076   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 1291, __pyx_L1_error) }
11077   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 1291, __pyx_L1_error) }
11078   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_carma_loglikeobs_fast(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1291, __pyx_L1_error)
11079   __Pyx_GOTREF(__pyx_t_1);
11080   __pyx_r = __pyx_t_1;
11081   __pyx_t_1 = 0;
11082   goto __pyx_L0;
11083 
11084   /* function exit code */
11085   __pyx_L1_error:;
11086   __Pyx_XDECREF(__pyx_t_1);
11087   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.carma_loglikeobs_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
11088   __pyx_r = NULL;
11089   __pyx_L0:;
11090   __PYX_XDEC_MEMVIEW(&__pyx_v_endog, 1);
11091   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
11092   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
11093   __Pyx_XGIVEREF(__pyx_r);
11094   __Pyx_RefNannyFinishContext();
11095   return __pyx_r;
11096 }
11097 
11098 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1345
11099  *
11100  *
11101  * cdef ztoeplitz(int n, int offset0, int offset1,             # <<<<<<<<<<<<<<
11102  *                         cnp.complex128_t [:] in_column,
11103  *                         cnp.complex128_t [:, :] out_matrix):
11104  */
11105 
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_ztoeplitz(int __pyx_v_n,int __pyx_v_offset0,int __pyx_v_offset1,__Pyx_memviewslice __pyx_v_in_column,__Pyx_memviewslice __pyx_v_out_matrix)11106 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_ztoeplitz(int __pyx_v_n, int __pyx_v_offset0, int __pyx_v_offset1, __Pyx_memviewslice __pyx_v_in_column, __Pyx_memviewslice __pyx_v_out_matrix) {
11107   Py_ssize_t __pyx_v_i;
11108   Py_ssize_t __pyx_v_j;
11109   PyObject *__pyx_r = NULL;
11110   __Pyx_RefNannyDeclarations
11111   int __pyx_t_1;
11112   int __pyx_t_2;
11113   Py_ssize_t __pyx_t_3;
11114   Py_ssize_t __pyx_t_4;
11115   Py_ssize_t __pyx_t_5;
11116   Py_ssize_t __pyx_t_6;
11117   Py_ssize_t __pyx_t_7;
11118   Py_ssize_t __pyx_t_8;
11119   Py_ssize_t __pyx_t_9;
11120   int __pyx_t_10;
11121   __Pyx_RefNannySetupContext("ztoeplitz", 0);
11122 
11123   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1375
11124  *     cdef Py_ssize_t i, j
11125  *
11126  *     for i in range(n):             # <<<<<<<<<<<<<<
11127  *         for j in range(i + 1):
11128  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
11129  */
11130   __pyx_t_1 = __pyx_v_n;
11131   __pyx_t_2 = __pyx_t_1;
11132   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
11133     __pyx_v_i = __pyx_t_3;
11134 
11135     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1376
11136  *
11137  *     for i in range(n):
11138  *         for j in range(i + 1):             # <<<<<<<<<<<<<<
11139  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
11140  *             if i != j:
11141  */
11142     __pyx_t_4 = (__pyx_v_i + 1);
11143     __pyx_t_5 = __pyx_t_4;
11144     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
11145       __pyx_v_j = __pyx_t_6;
11146 
11147       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1377
11148  *     for i in range(n):
11149  *         for j in range(i + 1):
11150  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]             # <<<<<<<<<<<<<<
11151  *             if i != j:
11152  *               # Note: scipy by default does complex conjugate, but not
11153  */
11154       __pyx_t_7 = (__pyx_v_i - __pyx_v_j);
11155       __pyx_t_8 = (__pyx_v_offset0 + __pyx_v_i);
11156       __pyx_t_9 = (__pyx_v_offset1 + __pyx_v_j);
11157       *((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out_matrix.data + __pyx_t_8 * __pyx_v_out_matrix.strides[0]) ) + __pyx_t_9 * __pyx_v_out_matrix.strides[1]) )) = (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_in_column.data + __pyx_t_7 * __pyx_v_in_column.strides[0]) )));
11158 
11159       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1378
11160  *         for j in range(i + 1):
11161  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
11162  *             if i != j:             # <<<<<<<<<<<<<<
11163  *               # Note: scipy by default does complex conjugate, but not
11164  *               # necessary here since we're only dealing with covariances,
11165  */
11166       __pyx_t_10 = ((__pyx_v_i != __pyx_v_j) != 0);
11167       if (__pyx_t_10) {
11168 
11169         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1384
11170  *               # differentiation, but in that case we do not want to apply
11171  *               # the conjugation anyway)
11172  *               out_matrix[offset0 + j, offset1 + i] = in_column[i - j]             # <<<<<<<<<<<<<<
11173  *
11174  *
11175  */
11176         __pyx_t_7 = (__pyx_v_i - __pyx_v_j);
11177         __pyx_t_9 = (__pyx_v_offset0 + __pyx_v_j);
11178         __pyx_t_8 = (__pyx_v_offset1 + __pyx_v_i);
11179         *((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out_matrix.data + __pyx_t_9 * __pyx_v_out_matrix.strides[0]) ) + __pyx_t_8 * __pyx_v_out_matrix.strides[1]) )) = (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_in_column.data + __pyx_t_7 * __pyx_v_in_column.strides[0]) )));
11180 
11181         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1378
11182  *         for j in range(i + 1):
11183  *             out_matrix[offset0 + i, offset1 + j] = in_column[i - j]
11184  *             if i != j:             # <<<<<<<<<<<<<<
11185  *               # Note: scipy by default does complex conjugate, but not
11186  *               # necessary here since we're only dealing with covariances,
11187  */
11188       }
11189     }
11190   }
11191 
11192   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1345
11193  *
11194  *
11195  * cdef ztoeplitz(int n, int offset0, int offset1,             # <<<<<<<<<<<<<<
11196  *                         cnp.complex128_t [:] in_column,
11197  *                         cnp.complex128_t [:, :] out_matrix):
11198  */
11199 
11200   /* function exit code */
11201   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11202   __Pyx_XGIVEREF(__pyx_r);
11203   __Pyx_RefNannyFinishContext();
11204   return __pyx_r;
11205 }
11206 
11207 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1387
11208  *
11209  *
11210  * cpdef zarma_transformed_acovf_fast(cnp.complex128_t [:] ar,             # <<<<<<<<<<<<<<
11211  *                                             cnp.complex128_t [:] ma,
11212  *                                             cnp.complex128_t [:] arma_acovf):
11213  */
11214 
11215 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_31zarma_transformed_acovf_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_transformed_acovf_fast(__Pyx_memviewslice __pyx_v_ar,__Pyx_memviewslice __pyx_v_ma,__Pyx_memviewslice __pyx_v_arma_acovf,CYTHON_UNUSED int __pyx_skip_dispatch)11216 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_transformed_acovf_fast(__Pyx_memviewslice __pyx_v_ar, __Pyx_memviewslice __pyx_v_ma, __Pyx_memviewslice __pyx_v_arma_acovf, CYTHON_UNUSED int __pyx_skip_dispatch) {
11217   Py_ssize_t __pyx_v_nobs;
11218   Py_ssize_t __pyx_v_p;
11219   Py_ssize_t __pyx_v_q;
11220   Py_ssize_t __pyx_v_m;
11221   Py_ssize_t __pyx_v_m2;
11222   Py_ssize_t __pyx_v_n;
11223   Py_ssize_t __pyx_v_i;
11224   Py_ssize_t __pyx_v_j;
11225   Py_ssize_t __pyx_v_r;
11226   Py_ssize_t __pyx_v_tmp_ix;
11227   npy_intp __pyx_v_dim1[1];
11228   npy_intp __pyx_v_dim2[2];
11229   __Pyx_memviewslice __pyx_v_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
11230   __Pyx_memviewslice __pyx_v_acovf2 = { 0, 0, { 0 }, { 0 }, { 0 } };
11231   PyObject *__pyx_r = NULL;
11232   __Pyx_RefNannyDeclarations
11233   size_t __pyx_t_1;
11234   Py_ssize_t __pyx_t_2;
11235   Py_ssize_t __pyx_t_3;
11236   Py_ssize_t __pyx_t_4;
11237   PyObject *__pyx_t_5 = NULL;
11238   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
11239   long __pyx_t_7;
11240   __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
11241   int __pyx_t_9;
11242   Py_ssize_t __pyx_t_10;
11243   Py_ssize_t __pyx_t_11;
11244   Py_ssize_t __pyx_t_12;
11245   Py_ssize_t __pyx_t_13;
11246   Py_ssize_t __pyx_t_14;
11247   Py_ssize_t __pyx_t_15;
11248   Py_ssize_t __pyx_t_16;
11249   Py_ssize_t __pyx_t_17;
11250   Py_ssize_t __pyx_t_18;
11251   PyObject *__pyx_t_19 = NULL;
11252   Py_ssize_t __pyx_t_20;
11253   Py_ssize_t __pyx_t_21;
11254   Py_ssize_t __pyx_t_22;
11255   Py_ssize_t __pyx_t_23;
11256   int __pyx_t_24;
11257   __Pyx_memviewslice __pyx_t_25 = { 0, 0, { 0 }, { 0 }, { 0 } };
11258   PyObject *__pyx_t_26 = NULL;
11259   int __pyx_lineno = 0;
11260   const char *__pyx_filename = NULL;
11261   int __pyx_clineno = 0;
11262   __Pyx_RefNannySetupContext("zarma_transformed_acovf_fast", 0);
11263 
11264   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1457
11265  *     cdef cnp.complex128_t [:] acovf2
11266  *
11267  *     nobs = arma_acovf.shape[0]             # <<<<<<<<<<<<<<
11268  *     p = len(ar) - 1
11269  *     q = len(ma) - 1
11270  */
11271   __pyx_v_nobs = (__pyx_v_arma_acovf.shape[0]);
11272 
11273   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1458
11274  *
11275  *     nobs = arma_acovf.shape[0]
11276  *     p = len(ar) - 1             # <<<<<<<<<<<<<<
11277  *     q = len(ma) - 1
11278  *     m = max(p, q)
11279  */
11280   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar);
11281   __pyx_v_p = (__pyx_t_1 - 1);
11282 
11283   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1459
11284  *     nobs = arma_acovf.shape[0]
11285  *     p = len(ar) - 1
11286  *     q = len(ma) - 1             # <<<<<<<<<<<<<<
11287  *     m = max(p, q)
11288  *     m2 = 2 * m
11289  */
11290   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma);
11291   __pyx_v_q = (__pyx_t_1 - 1);
11292 
11293   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1460
11294  *     p = len(ar) - 1
11295  *     q = len(ma) - 1
11296  *     m = max(p, q)             # <<<<<<<<<<<<<<
11297  *     m2 = 2 * m
11298  *     n = min(m2, nobs)
11299  */
11300   __pyx_t_2 = __pyx_v_q;
11301   __pyx_t_3 = __pyx_v_p;
11302   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
11303     __pyx_t_4 = __pyx_t_2;
11304   } else {
11305     __pyx_t_4 = __pyx_t_3;
11306   }
11307   __pyx_v_m = __pyx_t_4;
11308 
11309   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1461
11310  *     q = len(ma) - 1
11311  *     m = max(p, q)
11312  *     m2 = 2 * m             # <<<<<<<<<<<<<<
11313  *     n = min(m2, nobs)
11314  *
11315  */
11316   __pyx_v_m2 = (2 * __pyx_v_m);
11317 
11318   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1462
11319  *     m = max(p, q)
11320  *     m2 = 2 * m
11321  *     n = min(m2, nobs)             # <<<<<<<<<<<<<<
11322  *
11323  *     dim2[0] = m2;
11324  */
11325   __pyx_t_4 = __pyx_v_nobs;
11326   __pyx_t_2 = __pyx_v_m2;
11327   if (((__pyx_t_4 < __pyx_t_2) != 0)) {
11328     __pyx_t_3 = __pyx_t_4;
11329   } else {
11330     __pyx_t_3 = __pyx_t_2;
11331   }
11332   __pyx_v_n = __pyx_t_3;
11333 
11334   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1464
11335  *     n = min(m2, nobs)
11336  *
11337  *     dim2[0] = m2;             # <<<<<<<<<<<<<<
11338  *     dim2[1] = m2;
11339  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX128, C)
11340  */
11341   (__pyx_v_dim2[0]) = __pyx_v_m2;
11342 
11343   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1465
11344  *
11345  *     dim2[0] = m2;
11346  *     dim2[1] = m2;             # <<<<<<<<<<<<<<
11347  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX128, C)
11348  *     dim1[0] = max(nobs - m, 0);
11349  */
11350   (__pyx_v_dim2[1]) = __pyx_v_m2;
11351 
11352   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1466
11353  *     dim2[0] = m2;
11354  *     dim2[1] = m2;
11355  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX128, C)             # <<<<<<<<<<<<<<
11356  *     dim1[0] = max(nobs - m, 0);
11357  *     acovf2 = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
11358  */
11359   __pyx_t_5 = PyArray_ZEROS(2, __pyx_v_dim2, NPY_COMPLEX128, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1466, __pyx_L1_error)
11360   __Pyx_GOTREF(__pyx_t_5);
11361   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1466, __pyx_L1_error)
11362   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11363   __pyx_v_acovf = __pyx_t_6;
11364   __pyx_t_6.memview = NULL;
11365   __pyx_t_6.data = NULL;
11366 
11367   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1467
11368  *     dim2[1] = m2;
11369  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX128, C)
11370  *     dim1[0] = max(nobs - m, 0);             # <<<<<<<<<<<<<<
11371  *     acovf2 = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
11372  *
11373  */
11374   __pyx_t_7 = 0;
11375   __pyx_t_3 = (__pyx_v_nobs - __pyx_v_m);
11376   if (((__pyx_t_7 > __pyx_t_3) != 0)) {
11377     __pyx_t_4 = __pyx_t_7;
11378   } else {
11379     __pyx_t_4 = __pyx_t_3;
11380   }
11381   (__pyx_v_dim1[0]) = __pyx_t_4;
11382 
11383   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1468
11384  *     acovf = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX128, C)
11385  *     dim1[0] = max(nobs - m, 0);
11386  *     acovf2 = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)             # <<<<<<<<<<<<<<
11387  *
11388  *     # Set i, j = 1, ..., m   (which is then done)
11389  */
11390   __pyx_t_5 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_COMPLEX128, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1468, __pyx_L1_error)
11391   __Pyx_GOTREF(__pyx_t_5);
11392   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1468, __pyx_L1_error)
11393   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11394   __pyx_v_acovf2 = __pyx_t_8;
11395   __pyx_t_8.memview = NULL;
11396   __pyx_t_8.data = NULL;
11397 
11398   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1471
11399  *
11400  *     # Set i, j = 1, ..., m   (which is then done)
11401  *     ztoeplitz(m, 0, 0, arma_acovf, acovf)             # <<<<<<<<<<<<<<
11402  *
11403  *     # Set i = 1, ..., m;         j = m + 1, ..., 2 m
11404  */
11405   __pyx_t_5 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_ztoeplitz(__pyx_v_m, 0, 0, __pyx_v_arma_acovf, __pyx_v_acovf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1471, __pyx_L1_error)
11406   __Pyx_GOTREF(__pyx_t_5);
11407   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11408 
11409   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1475
11410  *     # Set i = 1, ..., m;         j = m + 1, ..., 2 m
11411  *     # and i = m + 1, ..., 2 m;   j = 1, ..., m
11412  *     if nobs > m:             # <<<<<<<<<<<<<<
11413  *         for j in range(m):
11414  *             for i in range(m, m2):
11415  */
11416   __pyx_t_9 = ((__pyx_v_nobs > __pyx_v_m) != 0);
11417   if (__pyx_t_9) {
11418 
11419     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1476
11420  *     # and i = m + 1, ..., 2 m;   j = 1, ..., m
11421  *     if nobs > m:
11422  *         for j in range(m):             # <<<<<<<<<<<<<<
11423  *             for i in range(m, m2):
11424  *                 acovf[i, j] = arma_acovf[i - j]
11425  */
11426     __pyx_t_4 = __pyx_v_m;
11427     __pyx_t_3 = __pyx_t_4;
11428     for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2+=1) {
11429       __pyx_v_j = __pyx_t_2;
11430 
11431       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1477
11432  *     if nobs > m:
11433  *         for j in range(m):
11434  *             for i in range(m, m2):             # <<<<<<<<<<<<<<
11435  *                 acovf[i, j] = arma_acovf[i - j]
11436  *                 for r in range(1, p + 1):
11437  */
11438       __pyx_t_10 = __pyx_v_m2;
11439       __pyx_t_11 = __pyx_t_10;
11440       for (__pyx_t_12 = __pyx_v_m; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
11441         __pyx_v_i = __pyx_t_12;
11442 
11443         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1478
11444  *         for j in range(m):
11445  *             for i in range(m, m2):
11446  *                 acovf[i, j] = arma_acovf[i - j]             # <<<<<<<<<<<<<<
11447  *                 for r in range(1, p + 1):
11448  *                     tmp_ix = abs(r - (i - j))
11449  */
11450         __pyx_t_13 = (__pyx_v_i - __pyx_v_j);
11451         __pyx_t_14 = __pyx_v_i;
11452         __pyx_t_15 = __pyx_v_j;
11453         *((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_14 * __pyx_v_acovf.strides[0]) ) + __pyx_t_15 * __pyx_v_acovf.strides[1]) )) = (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_arma_acovf.data + __pyx_t_13 * __pyx_v_arma_acovf.strides[0]) )));
11454 
11455         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1479
11456  *             for i in range(m, m2):
11457  *                 acovf[i, j] = arma_acovf[i - j]
11458  *                 for r in range(1, p + 1):             # <<<<<<<<<<<<<<
11459  *                     tmp_ix = abs(r - (i - j))
11460  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])
11461  */
11462         __pyx_t_16 = (__pyx_v_p + 1);
11463         __pyx_t_17 = __pyx_t_16;
11464         for (__pyx_t_18 = 1; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
11465           __pyx_v_r = __pyx_t_18;
11466 
11467           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1480
11468  *                 acovf[i, j] = arma_acovf[i - j]
11469  *                 for r in range(1, p + 1):
11470  *                     tmp_ix = abs(r - (i - j))             # <<<<<<<<<<<<<<
11471  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])
11472  *         acovf[:m, m:m2] = acovf[m:m2, :m].T
11473  */
11474           __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_r - (__pyx_v_i - __pyx_v_j))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1480, __pyx_L1_error)
11475           __Pyx_GOTREF(__pyx_t_5);
11476           __pyx_t_19 = __Pyx_PyNumber_Absolute(__pyx_t_5); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1480, __pyx_L1_error)
11477           __Pyx_GOTREF(__pyx_t_19);
11478           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11479           __pyx_t_20 = __Pyx_PyIndex_AsSsize_t(__pyx_t_19); if (unlikely((__pyx_t_20 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1480, __pyx_L1_error)
11480           __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
11481           __pyx_v_tmp_ix = __pyx_t_20;
11482 
11483           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1481
11484  *                 for r in range(1, p + 1):
11485  *                     tmp_ix = abs(r - (i - j))
11486  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])             # <<<<<<<<<<<<<<
11487  *         acovf[:m, m:m2] = acovf[m:m2, :m].T
11488  *
11489  */
11490           __pyx_t_13 = __pyx_v_i;
11491           __pyx_t_15 = __pyx_v_j;
11492           __pyx_t_14 = __pyx_v_r;
11493           __pyx_t_21 = __pyx_v_tmp_ix;
11494           __pyx_t_22 = __pyx_v_i;
11495           __pyx_t_23 = __pyx_v_j;
11496           *((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_22 * __pyx_v_acovf.strides[0]) ) + __pyx_t_23 * __pyx_v_acovf.strides[1]) )) = __Pyx_c_diff_double((*((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_13 * __pyx_v_acovf.strides[0]) ) + __pyx_t_15 * __pyx_v_acovf.strides[1]) ))), __Pyx_c_prod_double(__Pyx_c_neg_double((*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_ar.data + __pyx_t_14 * __pyx_v_ar.strides[0]) )))), (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_arma_acovf.data + __pyx_t_21 * __pyx_v_arma_acovf.strides[0]) )))));
11497         }
11498       }
11499     }
11500 
11501     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1482
11502  *                     tmp_ix = abs(r - (i - j))
11503  *                     acovf[i, j] = acovf[i, j] - (-ar[r] * arma_acovf[tmp_ix])
11504  *         acovf[:m, m:m2] = acovf[m:m2, :m].T             # <<<<<<<<<<<<<<
11505  *
11506  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
11507  */
11508     __pyx_t_6.data = __pyx_v_acovf.data;
11509     __pyx_t_6.memview = __pyx_v_acovf.memview;
11510     __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
11511     __pyx_t_24 = -1;
11512     if (unlikely(__pyx_memoryview_slice_memviewslice(
11513     &__pyx_t_6,
11514     __pyx_v_acovf.shape[0], __pyx_v_acovf.strides[0], __pyx_v_acovf.suboffsets[0],
11515     0,
11516     0,
11517     &__pyx_t_24,
11518     __pyx_v_m,
11519     __pyx_v_m2,
11520     0,
11521     1,
11522     1,
11523     0,
11524     1) < 0))
11525 {
11526     __PYX_ERR(0, 1482, __pyx_L1_error)
11527 }
11528 
11529 if (unlikely(__pyx_memoryview_slice_memviewslice(
11530     &__pyx_t_6,
11531     __pyx_v_acovf.shape[1], __pyx_v_acovf.strides[1], __pyx_v_acovf.suboffsets[1],
11532     1,
11533     1,
11534     &__pyx_t_24,
11535     0,
11536     __pyx_v_m,
11537     0,
11538     0,
11539     1,
11540     0,
11541     1) < 0))
11542 {
11543     __PYX_ERR(0, 1482, __pyx_L1_error)
11544 }
11545 
11546 __pyx_t_25 = __pyx_t_6;
11547     __PYX_INC_MEMVIEW(&__pyx_t_25, 1);
11548     if (unlikely(__pyx_memslice_transpose(&__pyx_t_25) == 0)) __PYX_ERR(0, 1482, __pyx_L1_error)
11549     __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
11550     __pyx_t_6.memview = NULL;
11551     __pyx_t_6.data = NULL;
11552     __pyx_t_6.data = __pyx_v_acovf.data;
11553     __pyx_t_6.memview = __pyx_v_acovf.memview;
11554     __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
11555     __pyx_t_24 = -1;
11556     if (unlikely(__pyx_memoryview_slice_memviewslice(
11557     &__pyx_t_6,
11558     __pyx_v_acovf.shape[0], __pyx_v_acovf.strides[0], __pyx_v_acovf.suboffsets[0],
11559     0,
11560     0,
11561     &__pyx_t_24,
11562     0,
11563     __pyx_v_m,
11564     0,
11565     0,
11566     1,
11567     0,
11568     1) < 0))
11569 {
11570     __PYX_ERR(0, 1482, __pyx_L1_error)
11571 }
11572 
11573 if (unlikely(__pyx_memoryview_slice_memviewslice(
11574     &__pyx_t_6,
11575     __pyx_v_acovf.shape[1], __pyx_v_acovf.strides[1], __pyx_v_acovf.suboffsets[1],
11576     1,
11577     1,
11578     &__pyx_t_24,
11579     __pyx_v_m,
11580     __pyx_v_m2,
11581     0,
11582     1,
11583     1,
11584     0,
11585     1) < 0))
11586 {
11587     __PYX_ERR(0, 1482, __pyx_L1_error)
11588 }
11589 
11590 if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_25, __pyx_t_6, 2, 2, 0) < 0)) __PYX_ERR(0, 1482, __pyx_L1_error)
11591     __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
11592     __pyx_t_6.memview = NULL;
11593     __pyx_t_6.data = NULL;
11594     __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
11595     __pyx_t_25.memview = NULL;
11596     __pyx_t_25.data = NULL;
11597 
11598     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1475
11599  *     # Set i = 1, ..., m;         j = m + 1, ..., 2 m
11600  *     # and i = m + 1, ..., 2 m;   j = 1, ..., m
11601  *     if nobs > m:             # <<<<<<<<<<<<<<
11602  *         for j in range(m):
11603  *             for i in range(m, m2):
11604  */
11605   }
11606 
11607   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1485
11608  *
11609  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
11610  *     if nobs > m:             # <<<<<<<<<<<<<<
11611  *         for i in range(nobs - m):
11612  *             for r in range(q + 1 - i):
11613  */
11614   __pyx_t_9 = ((__pyx_v_nobs > __pyx_v_m) != 0);
11615   if (__pyx_t_9) {
11616 
11617     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1486
11618  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
11619  *     if nobs > m:
11620  *         for i in range(nobs - m):             # <<<<<<<<<<<<<<
11621  *             for r in range(q + 1 - i):
11622  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]
11623  */
11624     __pyx_t_4 = (__pyx_v_nobs - __pyx_v_m);
11625     __pyx_t_3 = __pyx_t_4;
11626     for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2+=1) {
11627       __pyx_v_i = __pyx_t_2;
11628 
11629       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1487
11630  *     if nobs > m:
11631  *         for i in range(nobs - m):
11632  *             for r in range(q + 1 - i):             # <<<<<<<<<<<<<<
11633  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]
11634  *
11635  */
11636       __pyx_t_10 = ((__pyx_v_q + 1) - __pyx_v_i);
11637       __pyx_t_11 = __pyx_t_10;
11638       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
11639         __pyx_v_r = __pyx_t_12;
11640 
11641         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1488
11642  *         for i in range(nobs - m):
11643  *             for r in range(q + 1 - i):
11644  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]             # <<<<<<<<<<<<<<
11645  *
11646  *     return acovf[:n, :n], acovf2
11647  */
11648         __pyx_t_21 = __pyx_v_i;
11649         __pyx_t_14 = __pyx_v_r;
11650         __pyx_t_15 = (__pyx_v_r + __pyx_v_i);
11651         __pyx_t_13 = __pyx_v_i;
11652         *((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_13 * __pyx_v_acovf2.strides[0]) )) = __Pyx_c_sum_double((*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_21 * __pyx_v_acovf2.strides[0]) ))), __Pyx_c_prod_double((*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_ma.data + __pyx_t_14 * __pyx_v_ma.strides[0]) ))), (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_ma.data + __pyx_t_15 * __pyx_v_ma.strides[0]) )))));
11653       }
11654     }
11655 
11656     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1485
11657  *
11658  *     # Set values for |i - j| <= q, min(i, j) = m + 1, and max(i, j) <= nobs
11659  *     if nobs > m:             # <<<<<<<<<<<<<<
11660  *         for i in range(nobs - m):
11661  *             for r in range(q + 1 - i):
11662  */
11663   }
11664 
11665   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1490
11666  *                 acovf2[i] = acovf2[i] + ma[r] * ma[r + i]
11667  *
11668  *     return acovf[:n, :n], acovf2             # <<<<<<<<<<<<<<
11669  *
11670  *
11671  */
11672   __Pyx_XDECREF(__pyx_r);
11673   __pyx_t_25.data = __pyx_v_acovf.data;
11674   __pyx_t_25.memview = __pyx_v_acovf.memview;
11675   __PYX_INC_MEMVIEW(&__pyx_t_25, 0);
11676   __pyx_t_24 = -1;
11677   if (unlikely(__pyx_memoryview_slice_memviewslice(
11678     &__pyx_t_25,
11679     __pyx_v_acovf.shape[0], __pyx_v_acovf.strides[0], __pyx_v_acovf.suboffsets[0],
11680     0,
11681     0,
11682     &__pyx_t_24,
11683     0,
11684     __pyx_v_n,
11685     0,
11686     0,
11687     1,
11688     0,
11689     1) < 0))
11690 {
11691     __PYX_ERR(0, 1490, __pyx_L1_error)
11692 }
11693 
11694 if (unlikely(__pyx_memoryview_slice_memviewslice(
11695     &__pyx_t_25,
11696     __pyx_v_acovf.shape[1], __pyx_v_acovf.strides[1], __pyx_v_acovf.suboffsets[1],
11697     1,
11698     1,
11699     &__pyx_t_24,
11700     0,
11701     __pyx_v_n,
11702     0,
11703     0,
11704     1,
11705     0,
11706     1) < 0))
11707 {
11708     __PYX_ERR(0, 1490, __pyx_L1_error)
11709 }
11710 
11711 __pyx_t_19 = __pyx_memoryview_fromslice(__pyx_t_25, 2, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1490, __pyx_L1_error)
11712   __Pyx_GOTREF(__pyx_t_19);
11713   __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
11714   __pyx_t_25.memview = NULL;
11715   __pyx_t_25.data = NULL;
11716   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_acovf2, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1490, __pyx_L1_error)
11717   __Pyx_GOTREF(__pyx_t_5);
11718   __pyx_t_26 = PyTuple_New(2); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 1490, __pyx_L1_error)
11719   __Pyx_GOTREF(__pyx_t_26);
11720   __Pyx_GIVEREF(__pyx_t_19);
11721   PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_19);
11722   __Pyx_GIVEREF(__pyx_t_5);
11723   PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_5);
11724   __pyx_t_19 = 0;
11725   __pyx_t_5 = 0;
11726   __pyx_r = __pyx_t_26;
11727   __pyx_t_26 = 0;
11728   goto __pyx_L0;
11729 
11730   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1387
11731  *
11732  *
11733  * cpdef zarma_transformed_acovf_fast(cnp.complex128_t [:] ar,             # <<<<<<<<<<<<<<
11734  *                                             cnp.complex128_t [:] ma,
11735  *                                             cnp.complex128_t [:] arma_acovf):
11736  */
11737 
11738   /* function exit code */
11739   __pyx_L1_error:;
11740   __Pyx_XDECREF(__pyx_t_5);
11741   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
11742   __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
11743   __Pyx_XDECREF(__pyx_t_19);
11744   __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
11745   __Pyx_XDECREF(__pyx_t_26);
11746   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_transformed_acovf_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
11747   __pyx_r = 0;
11748   __pyx_L0:;
11749   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf, 1);
11750   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf2, 1);
11751   __Pyx_XGIVEREF(__pyx_r);
11752   __Pyx_RefNannyFinishContext();
11753   return __pyx_r;
11754 }
11755 
11756 /* Python wrapper */
11757 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_31zarma_transformed_acovf_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11758 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_30zarma_transformed_acovf_fast[] = "\n    arma_transformed_acovf_fast(cnp.complex128_t [:] ar, cnp.complex128_t [:] ma, cnp.complex128_t [:] arma_acovf)\n    \n    Quickly construct the autocovariance matrix for a transformed process.\n\n    Using the autocovariance function for an ARMA process, constructs the\n    autocovariances associated with the transformed process described\n    in equation (3.3.1) of _[1] in a memory efficient, and so fast, way.\n\n    Parameters\n    ----------\n    ar : ndarray\n        Autoregressive coefficients, including the zero lag, where the sign\n        convention assumes the coefficients are part of the lag polynomial on\n        the left-hand-side of the ARMA definition (i.e. they have the opposite\n        sign from the usual econometrics convention in which the coefficients\n        are on the right-hand-side of the ARMA definition).\n    ma : ndarray\n        Moving average coefficients, including the zero lag, where the sign\n        convention assumes the coefficients are part of the lag polynomial on\n        the right-hand-side of the ARMA definition (i.e. they have the same\n        sign from the usual econometrics convention in which the coefficients\n        are on the right-hand-side of the ARMA definition).\n    arma_acovf : ndarray\n        The vector of autocovariances of the ARMA process.\n\n    Returns\n    -------\n    acovf : ndarray\n        A matrix containing the autocovariances of the portion of the\n        transformed process with time-varying autocovariances. Its dimension\n        is equal to `min(m * 2, n)` where `m = max(len(ar) - 1, len(ma) - 1)`\n        and `n` is the length of the input array `arma_acovf`. It is important\n        to note that only the values in the first `m` columns or `m` rows are\n        valid. In particular, the entries in the block `acovf[m:, m:]` should\n        not be used in any case (and in fact will always be equal to zeros).\n    acovf2 : ndarray\n        An array containing the autocovariance function of"" the portion of the\n        transformed process with time-invariant autocovariances. Its dimension\n        is equal to `max(n - m, 0)` where `n` is the length of the input\n        array `arma_acovf`.\n\n    Notes\n    -----\n    The definition of this autocovariance matrix is from _[1] equation 3.3.3.\n\n    This function assumes that the variance of the ARMA innovation term is\n    equal to one. If this is not true, then the calling program should replace\n    `arma_acovf` with `arma_acovf / sigma2`, where sigma2 is that variance.\n\n    This function is relatively fast even when `arma_acovf` is large, since\n    it only constructs the full autocovariance matrix for a generally small\n    subset of observations. The trade-off is that the output of this function\n    is somewhat more difficult to use.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_31zarma_transformed_acovf_fast(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)11759 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_31zarma_transformed_acovf_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11760   __Pyx_memviewslice __pyx_v_ar = { 0, 0, { 0 }, { 0 }, { 0 } };
11761   __Pyx_memviewslice __pyx_v_ma = { 0, 0, { 0 }, { 0 }, { 0 } };
11762   __Pyx_memviewslice __pyx_v_arma_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
11763   int __pyx_lineno = 0;
11764   const char *__pyx_filename = NULL;
11765   int __pyx_clineno = 0;
11766   PyObject *__pyx_r = 0;
11767   __Pyx_RefNannyDeclarations
11768   __Pyx_RefNannySetupContext("zarma_transformed_acovf_fast (wrapper)", 0);
11769   {
11770     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ar,&__pyx_n_s_ma,&__pyx_n_s_arma_acovf,0};
11771     PyObject* values[3] = {0,0,0};
11772     if (unlikely(__pyx_kwds)) {
11773       Py_ssize_t kw_args;
11774       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11775       switch (pos_args) {
11776         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11777         CYTHON_FALLTHROUGH;
11778         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11779         CYTHON_FALLTHROUGH;
11780         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11781         CYTHON_FALLTHROUGH;
11782         case  0: break;
11783         default: goto __pyx_L5_argtuple_error;
11784       }
11785       kw_args = PyDict_Size(__pyx_kwds);
11786       switch (pos_args) {
11787         case  0:
11788         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar)) != 0)) kw_args--;
11789         else goto __pyx_L5_argtuple_error;
11790         CYTHON_FALLTHROUGH;
11791         case  1:
11792         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma)) != 0)) kw_args--;
11793         else {
11794           __Pyx_RaiseArgtupleInvalid("zarma_transformed_acovf_fast", 1, 3, 3, 1); __PYX_ERR(0, 1387, __pyx_L3_error)
11795         }
11796         CYTHON_FALLTHROUGH;
11797         case  2:
11798         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arma_acovf)) != 0)) kw_args--;
11799         else {
11800           __Pyx_RaiseArgtupleInvalid("zarma_transformed_acovf_fast", 1, 3, 3, 2); __PYX_ERR(0, 1387, __pyx_L3_error)
11801         }
11802       }
11803       if (unlikely(kw_args > 0)) {
11804         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zarma_transformed_acovf_fast") < 0)) __PYX_ERR(0, 1387, __pyx_L3_error)
11805       }
11806     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
11807       goto __pyx_L5_argtuple_error;
11808     } else {
11809       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11810       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11811       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11812     }
11813     __pyx_v_ar = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar.memview)) __PYX_ERR(0, 1387, __pyx_L3_error)
11814     __pyx_v_ma = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma.memview)) __PYX_ERR(0, 1388, __pyx_L3_error)
11815     __pyx_v_arma_acovf = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_arma_acovf.memview)) __PYX_ERR(0, 1389, __pyx_L3_error)
11816   }
11817   goto __pyx_L4_argument_unpacking_done;
11818   __pyx_L5_argtuple_error:;
11819   __Pyx_RaiseArgtupleInvalid("zarma_transformed_acovf_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1387, __pyx_L3_error)
11820   __pyx_L3_error:;
11821   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_transformed_acovf_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
11822   __Pyx_RefNannyFinishContext();
11823   return NULL;
11824   __pyx_L4_argument_unpacking_done:;
11825   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_30zarma_transformed_acovf_fast(__pyx_self, __pyx_v_ar, __pyx_v_ma, __pyx_v_arma_acovf);
11826 
11827   /* function exit code */
11828   __Pyx_RefNannyFinishContext();
11829   return __pyx_r;
11830 }
11831 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_30zarma_transformed_acovf_fast(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_ar,__Pyx_memviewslice __pyx_v_ma,__Pyx_memviewslice __pyx_v_arma_acovf)11832 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_30zarma_transformed_acovf_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ar, __Pyx_memviewslice __pyx_v_ma, __Pyx_memviewslice __pyx_v_arma_acovf) {
11833   PyObject *__pyx_r = NULL;
11834   __Pyx_RefNannyDeclarations
11835   PyObject *__pyx_t_1 = NULL;
11836   int __pyx_lineno = 0;
11837   const char *__pyx_filename = NULL;
11838   int __pyx_clineno = 0;
11839   __Pyx_RefNannySetupContext("zarma_transformed_acovf_fast", 0);
11840   __Pyx_XDECREF(__pyx_r);
11841   if (unlikely(!__pyx_v_ar.memview)) { __Pyx_RaiseUnboundLocalError("ar"); __PYX_ERR(0, 1387, __pyx_L1_error) }
11842   if (unlikely(!__pyx_v_ma.memview)) { __Pyx_RaiseUnboundLocalError("ma"); __PYX_ERR(0, 1387, __pyx_L1_error) }
11843   if (unlikely(!__pyx_v_arma_acovf.memview)) { __Pyx_RaiseUnboundLocalError("arma_acovf"); __PYX_ERR(0, 1387, __pyx_L1_error) }
11844   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_transformed_acovf_fast(__pyx_v_ar, __pyx_v_ma, __pyx_v_arma_acovf, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1387, __pyx_L1_error)
11845   __Pyx_GOTREF(__pyx_t_1);
11846   __pyx_r = __pyx_t_1;
11847   __pyx_t_1 = 0;
11848   goto __pyx_L0;
11849 
11850   /* function exit code */
11851   __pyx_L1_error:;
11852   __Pyx_XDECREF(__pyx_t_1);
11853   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_transformed_acovf_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
11854   __pyx_r = NULL;
11855   __pyx_L0:;
11856   __PYX_XDEC_MEMVIEW(&__pyx_v_ar, 1);
11857   __PYX_XDEC_MEMVIEW(&__pyx_v_ma, 1);
11858   __PYX_XDEC_MEMVIEW(&__pyx_v_arma_acovf, 1);
11859   __Pyx_XGIVEREF(__pyx_r);
11860   __Pyx_RefNannyFinishContext();
11861   return __pyx_r;
11862 }
11863 
11864 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1493
11865  *
11866  *
11867  * cpdef zarma_innovations_algo_fast(int nobs,             # <<<<<<<<<<<<<<
11868  *                                            cnp.complex128_t [:] ar_params,
11869  *                                            cnp.complex128_t [:] ma_params,
11870  */
11871 
11872 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_33zarma_innovations_algo_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations_algo_fast(int __pyx_v_nobs,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_acovf,__Pyx_memviewslice __pyx_v_acovf2,CYTHON_UNUSED int __pyx_skip_dispatch)11873 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations_algo_fast(int __pyx_v_nobs, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_acovf, __Pyx_memviewslice __pyx_v_acovf2, CYTHON_UNUSED int __pyx_skip_dispatch) {
11874   Py_ssize_t __pyx_v_i;
11875   Py_ssize_t __pyx_v_j;
11876   Py_ssize_t __pyx_v_k;
11877   Py_ssize_t __pyx_v_n;
11878   Py_ssize_t __pyx_v__n;
11879   Py_ssize_t __pyx_v_m;
11880   Py_ssize_t __pyx_v_m2;
11881   Py_ssize_t __pyx_v_p;
11882   Py_ssize_t __pyx_v_q;
11883   Py_ssize_t __pyx_v_start;
11884   Py_ssize_t __pyx_v_start2;
11885   npy_intp __pyx_v_dim1[1];
11886   npy_intp __pyx_v_dim2[2];
11887   __Pyx_memviewslice __pyx_v_theta = { 0, 0, { 0 }, { 0 }, { 0 } };
11888   __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
11889   PyObject *__pyx_r = NULL;
11890   __Pyx_RefNannyDeclarations
11891   size_t __pyx_t_1;
11892   Py_ssize_t __pyx_t_2;
11893   Py_ssize_t __pyx_t_3;
11894   Py_ssize_t __pyx_t_4;
11895   PyObject *__pyx_t_5 = NULL;
11896   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
11897   __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
11898   int __pyx_t_8;
11899   Py_ssize_t __pyx_t_9;
11900   Py_ssize_t __pyx_t_10;
11901   Py_ssize_t __pyx_t_11;
11902   long __pyx_t_12;
11903   long __pyx_t_13;
11904   Py_ssize_t __pyx_t_14;
11905   int __pyx_t_15;
11906   Py_ssize_t __pyx_t_16;
11907   Py_ssize_t __pyx_t_17;
11908   Py_ssize_t __pyx_t_18;
11909   Py_ssize_t __pyx_t_19;
11910   Py_ssize_t __pyx_t_20;
11911   Py_ssize_t __pyx_t_21;
11912   Py_ssize_t __pyx_t_22;
11913   Py_ssize_t __pyx_t_23;
11914   Py_ssize_t __pyx_t_24;
11915   __pyx_t_double_complex __pyx_t_25;
11916   __pyx_t_double_complex __pyx_t_26;
11917   long __pyx_t_27;
11918   PyObject *__pyx_t_28 = NULL;
11919   PyObject *__pyx_t_29 = NULL;
11920   int __pyx_lineno = 0;
11921   const char *__pyx_filename = NULL;
11922   int __pyx_clineno = 0;
11923   __Pyx_RefNannySetupContext("zarma_innovations_algo_fast", 0);
11924 
11925   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1547
11926  *     cdef cnp.complex128_t [:] v
11927  *
11928  *     p = len(ar_params)             # <<<<<<<<<<<<<<
11929  *     q = len(ma_params)
11930  *     m = max(p, q)
11931  */
11932   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
11933   __pyx_v_p = __pyx_t_1;
11934 
11935   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1548
11936  *
11937  *     p = len(ar_params)
11938  *     q = len(ma_params)             # <<<<<<<<<<<<<<
11939  *     m = max(p, q)
11940  *     m2 = 2 * m
11941  */
11942   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma_params);
11943   __pyx_v_q = __pyx_t_1;
11944 
11945   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1549
11946  *     p = len(ar_params)
11947  *     q = len(ma_params)
11948  *     m = max(p, q)             # <<<<<<<<<<<<<<
11949  *     m2 = 2 * m
11950  *
11951  */
11952   __pyx_t_2 = __pyx_v_q;
11953   __pyx_t_3 = __pyx_v_p;
11954   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
11955     __pyx_t_4 = __pyx_t_2;
11956   } else {
11957     __pyx_t_4 = __pyx_t_3;
11958   }
11959   __pyx_v_m = __pyx_t_4;
11960 
11961   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1550
11962  *     q = len(ma_params)
11963  *     m = max(p, q)
11964  *     m2 = 2 * m             # <<<<<<<<<<<<<<
11965  *
11966  *     dim1[0] = nobs;
11967  */
11968   __pyx_v_m2 = (2 * __pyx_v_m);
11969 
11970   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1552
11971  *     m2 = 2 * m
11972  *
11973  *     dim1[0] = nobs;             # <<<<<<<<<<<<<<
11974  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
11975  *     dim2[0] = nobs;
11976  */
11977   (__pyx_v_dim1[0]) = __pyx_v_nobs;
11978 
11979   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1553
11980  *
11981  *     dim1[0] = nobs;
11982  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)             # <<<<<<<<<<<<<<
11983  *     dim2[0] = nobs;
11984  *     dim2[1] = m + 1;
11985  */
11986   __pyx_t_5 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_COMPLEX128, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1553, __pyx_L1_error)
11987   __Pyx_GOTREF(__pyx_t_5);
11988   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1553, __pyx_L1_error)
11989   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11990   __pyx_v_v = __pyx_t_6;
11991   __pyx_t_6.memview = NULL;
11992   __pyx_t_6.data = NULL;
11993 
11994   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1554
11995  *     dim1[0] = nobs;
11996  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
11997  *     dim2[0] = nobs;             # <<<<<<<<<<<<<<
11998  *     dim2[1] = m + 1;
11999  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX128, C)
12000  */
12001   (__pyx_v_dim2[0]) = __pyx_v_nobs;
12002 
12003   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1555
12004  *     v = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
12005  *     dim2[0] = nobs;
12006  *     dim2[1] = m + 1;             # <<<<<<<<<<<<<<
12007  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX128, C)
12008  *
12009  */
12010   (__pyx_v_dim2[1]) = (__pyx_v_m + 1);
12011 
12012   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1556
12013  *     dim2[0] = nobs;
12014  *     dim2[1] = m + 1;
12015  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX128, C)             # <<<<<<<<<<<<<<
12016  *
12017  *     if m > 0:
12018  */
12019   __pyx_t_5 = PyArray_ZEROS(2, __pyx_v_dim2, NPY_COMPLEX128, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1556, __pyx_L1_error)
12020   __Pyx_GOTREF(__pyx_t_5);
12021   __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1556, __pyx_L1_error)
12022   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12023   __pyx_v_theta = __pyx_t_7;
12024   __pyx_t_7.memview = NULL;
12025   __pyx_t_7.data = NULL;
12026 
12027   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1558
12028  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX128, C)
12029  *
12030  *     if m > 0:             # <<<<<<<<<<<<<<
12031  *         v[0] = acovf[0, 0]
12032  *     else:
12033  */
12034   __pyx_t_8 = ((__pyx_v_m > 0) != 0);
12035   if (__pyx_t_8) {
12036 
12037     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1559
12038  *
12039  *     if m > 0:
12040  *         v[0] = acovf[0, 0]             # <<<<<<<<<<<<<<
12041  *     else:
12042  *         # (handle the corner case where p = q = 0)
12043  */
12044     __pyx_t_9 = 0;
12045     __pyx_t_10 = 0;
12046     __pyx_t_11 = 0;
12047     *((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_11 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_9 * __pyx_v_acovf.strides[0]) ) + __pyx_t_10 * __pyx_v_acovf.strides[1]) )));
12048 
12049     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1558
12050  *     theta = cnp.PyArray_ZEROS(2, dim2, cnp.NPY_COMPLEX128, C)
12051  *
12052  *     if m > 0:             # <<<<<<<<<<<<<<
12053  *         v[0] = acovf[0, 0]
12054  *     else:
12055  */
12056     goto __pyx_L3;
12057   }
12058 
12059   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1562
12060  *     else:
12061  *         # (handle the corner case where p = q = 0)
12062  *         v[0] = acovf2[0]             # <<<<<<<<<<<<<<
12063  *
12064  *     for n in range(nobs - 1):
12065  */
12066   /*else*/ {
12067     __pyx_t_10 = 0;
12068     __pyx_t_9 = 0;
12069     *((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_9 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_10 * __pyx_v_acovf2.strides[0]) )));
12070   }
12071   __pyx_L3:;
12072 
12073   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1564
12074  *         v[0] = acovf2[0]
12075  *
12076  *     for n in range(nobs - 1):             # <<<<<<<<<<<<<<
12077  *         _n = n + 1
12078  *
12079  */
12080   __pyx_t_12 = (__pyx_v_nobs - 1);
12081   __pyx_t_13 = __pyx_t_12;
12082   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_13; __pyx_t_4+=1) {
12083     __pyx_v_n = __pyx_t_4;
12084 
12085     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1565
12086  *
12087  *     for n in range(nobs - 1):
12088  *         _n = n + 1             # <<<<<<<<<<<<<<
12089  *
12090  *         start = 0 if n < m else n + 1 - q
12091  */
12092     __pyx_v__n = (__pyx_v_n + 1);
12093 
12094     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1567
12095  *         _n = n + 1
12096  *
12097  *         start = 0 if n < m else n + 1 - q             # <<<<<<<<<<<<<<
12098  *         for k in range(start, n + 1):
12099  *             # See Brockwell and Davis, p. 100-101
12100  */
12101     if (((__pyx_v_n < __pyx_v_m) != 0)) {
12102       __pyx_t_2 = 0;
12103     } else {
12104       __pyx_t_2 = ((__pyx_v_n + 1) - __pyx_v_q);
12105     }
12106     __pyx_v_start = __pyx_t_2;
12107 
12108     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1568
12109  *
12110  *         start = 0 if n < m else n + 1 - q
12111  *         for k in range(start, n + 1):             # <<<<<<<<<<<<<<
12112  *             # See Brockwell and Davis, p. 100-101
12113  *             # (here we have weak rather than strict inequality due to Python's
12114  */
12115     __pyx_t_2 = (__pyx_v_n + 1);
12116     __pyx_t_3 = __pyx_t_2;
12117     for (__pyx_t_14 = __pyx_v_start; __pyx_t_14 < __pyx_t_3; __pyx_t_14+=1) {
12118       __pyx_v_k = __pyx_t_14;
12119 
12120       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1572
12121  *             # (here we have weak rather than strict inequality due to Python's
12122  *             # zero indexing)
12123  *             if n >= m and n - k >= q:             # <<<<<<<<<<<<<<
12124  *                 continue
12125  *
12126  */
12127       __pyx_t_15 = ((__pyx_v_n >= __pyx_v_m) != 0);
12128       if (__pyx_t_15) {
12129       } else {
12130         __pyx_t_8 = __pyx_t_15;
12131         goto __pyx_L9_bool_binop_done;
12132       }
12133       __pyx_t_15 = (((__pyx_v_n - __pyx_v_k) >= __pyx_v_q) != 0);
12134       __pyx_t_8 = __pyx_t_15;
12135       __pyx_L9_bool_binop_done:;
12136       if (__pyx_t_8) {
12137 
12138         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1573
12139  *             # zero indexing)
12140  *             if n >= m and n - k >= q:
12141  *                 continue             # <<<<<<<<<<<<<<
12142  *
12143  *             if n + 1 < m2 and k < m:
12144  */
12145         goto __pyx_L6_continue;
12146 
12147         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1572
12148  *             # (here we have weak rather than strict inequality due to Python's
12149  *             # zero indexing)
12150  *             if n >= m and n - k >= q:             # <<<<<<<<<<<<<<
12151  *                 continue
12152  *
12153  */
12154       }
12155 
12156       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1575
12157  *                 continue
12158  *
12159  *             if n + 1 < m2 and k < m:             # <<<<<<<<<<<<<<
12160  *                 theta[_n, n - k] = acovf[n + 1, k]
12161  *             else:
12162  */
12163       __pyx_t_15 = (((__pyx_v_n + 1) < __pyx_v_m2) != 0);
12164       if (__pyx_t_15) {
12165       } else {
12166         __pyx_t_8 = __pyx_t_15;
12167         goto __pyx_L12_bool_binop_done;
12168       }
12169       __pyx_t_15 = ((__pyx_v_k < __pyx_v_m) != 0);
12170       __pyx_t_8 = __pyx_t_15;
12171       __pyx_L12_bool_binop_done:;
12172       if (__pyx_t_8) {
12173 
12174         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1576
12175  *
12176  *             if n + 1 < m2 and k < m:
12177  *                 theta[_n, n - k] = acovf[n + 1, k]             # <<<<<<<<<<<<<<
12178  *             else:
12179  *                 theta[_n, n - k] = acovf2[n + 1 - k]
12180  */
12181         __pyx_t_10 = (__pyx_v_n + 1);
12182         __pyx_t_9 = __pyx_v_k;
12183         __pyx_t_11 = __pyx_v__n;
12184         __pyx_t_16 = (__pyx_v_n - __pyx_v_k);
12185         *((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_11 * __pyx_v_theta.strides[0]) ) + __pyx_t_16 * __pyx_v_theta.strides[1]) )) = (*((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_10 * __pyx_v_acovf.strides[0]) ) + __pyx_t_9 * __pyx_v_acovf.strides[1]) )));
12186 
12187         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1575
12188  *                 continue
12189  *
12190  *             if n + 1 < m2 and k < m:             # <<<<<<<<<<<<<<
12191  *                 theta[_n, n - k] = acovf[n + 1, k]
12192  *             else:
12193  */
12194         goto __pyx_L11;
12195       }
12196 
12197       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1578
12198  *                 theta[_n, n - k] = acovf[n + 1, k]
12199  *             else:
12200  *                 theta[_n, n - k] = acovf2[n + 1 - k]             # <<<<<<<<<<<<<<
12201  *
12202  *             start2 = 0 if n < m else n - m
12203  */
12204       /*else*/ {
12205         __pyx_t_9 = ((__pyx_v_n + 1) - __pyx_v_k);
12206         __pyx_t_10 = __pyx_v__n;
12207         __pyx_t_16 = (__pyx_v_n - __pyx_v_k);
12208         *((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_10 * __pyx_v_theta.strides[0]) ) + __pyx_t_16 * __pyx_v_theta.strides[1]) )) = (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_9 * __pyx_v_acovf2.strides[0]) )));
12209       }
12210       __pyx_L11:;
12211 
12212       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1580
12213  *                 theta[_n, n - k] = acovf2[n + 1 - k]
12214  *
12215  *             start2 = 0 if n < m else n - m             # <<<<<<<<<<<<<<
12216  *             for j in range(start2, k):
12217  *                 if n - j < m + 1:
12218  */
12219       if (((__pyx_v_n < __pyx_v_m) != 0)) {
12220         __pyx_t_17 = 0;
12221       } else {
12222         __pyx_t_17 = (__pyx_v_n - __pyx_v_m);
12223       }
12224       __pyx_v_start2 = __pyx_t_17;
12225 
12226       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1581
12227  *
12228  *             start2 = 0 if n < m else n - m
12229  *             for j in range(start2, k):             # <<<<<<<<<<<<<<
12230  *                 if n - j < m + 1:
12231  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
12232  */
12233       __pyx_t_17 = __pyx_v_k;
12234       __pyx_t_18 = __pyx_t_17;
12235       for (__pyx_t_19 = __pyx_v_start2; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
12236         __pyx_v_j = __pyx_t_19;
12237 
12238         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1582
12239  *             start2 = 0 if n < m else n - m
12240  *             for j in range(start2, k):
12241  *                 if n - j < m + 1:             # <<<<<<<<<<<<<<
12242  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
12243  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
12244  */
12245         __pyx_t_8 = (((__pyx_v_n - __pyx_v_j) < (__pyx_v_m + 1)) != 0);
12246         if (__pyx_t_8) {
12247 
12248           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1583
12249  *             for j in range(start2, k):
12250  *                 if n - j < m + 1:
12251  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]             # <<<<<<<<<<<<<<
12252  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
12253  *
12254  */
12255           __pyx_t_9 = __pyx_v__n;
12256           __pyx_t_16 = (__pyx_v_n - __pyx_v_k);
12257           __pyx_t_10 = ((__pyx_v_k - 1) + 1);
12258           __pyx_t_11 = ((__pyx_v_k - __pyx_v_j) - 1);
12259           __pyx_t_20 = __pyx_v__n;
12260           __pyx_t_21 = (__pyx_v_n - __pyx_v_j);
12261           __pyx_t_22 = __pyx_v_j;
12262           __pyx_t_23 = __pyx_v__n;
12263           __pyx_t_24 = (__pyx_v_n - __pyx_v_k);
12264           *((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_23 * __pyx_v_theta.strides[0]) ) + __pyx_t_24 * __pyx_v_theta.strides[1]) )) = __Pyx_c_diff_double((*((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_9 * __pyx_v_theta.strides[0]) ) + __pyx_t_16 * __pyx_v_theta.strides[1]) ))), __Pyx_c_prod_double(__Pyx_c_prod_double((*((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_10 * __pyx_v_theta.strides[0]) ) + __pyx_t_11 * __pyx_v_theta.strides[1]) ))), (*((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_20 * __pyx_v_theta.strides[0]) ) + __pyx_t_21 * __pyx_v_theta.strides[1]) )))), (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) )))));
12265 
12266           /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1582
12267  *             start2 = 0 if n < m else n - m
12268  *             for j in range(start2, k):
12269  *                 if n - j < m + 1:             # <<<<<<<<<<<<<<
12270  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
12271  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
12272  */
12273         }
12274       }
12275 
12276       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1584
12277  *                 if n - j < m + 1:
12278  *                     theta[_n, n - k] = theta[_n, n - k] - theta[k - 1 + 1, k - j - 1] * theta[_n, n - j] * v[j]
12279  *             theta[_n, n - k] = theta[_n, n - k] / v[k]             # <<<<<<<<<<<<<<
12280  *
12281  *         if n + 1 < m:
12282  */
12283       __pyx_t_22 = __pyx_v__n;
12284       __pyx_t_21 = (__pyx_v_n - __pyx_v_k);
12285       __pyx_t_25 = (*((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_22 * __pyx_v_theta.strides[0]) ) + __pyx_t_21 * __pyx_v_theta.strides[1]) )));
12286       __pyx_t_21 = __pyx_v_k;
12287       __pyx_t_26 = (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) )));
12288       if (unlikely(__Pyx_c_is_zero_double(__pyx_t_26))) {
12289         PyErr_SetString(PyExc_ZeroDivisionError, "float division");
12290         __PYX_ERR(0, 1584, __pyx_L1_error)
12291       }
12292       __pyx_t_21 = __pyx_v__n;
12293       __pyx_t_22 = (__pyx_v_n - __pyx_v_k);
12294       *((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_21 * __pyx_v_theta.strides[0]) ) + __pyx_t_22 * __pyx_v_theta.strides[1]) )) = __Pyx_c_quot_double(__pyx_t_25, __pyx_t_26);
12295       __pyx_L6_continue:;
12296     }
12297 
12298     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1586
12299  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
12300  *
12301  *         if n + 1 < m:             # <<<<<<<<<<<<<<
12302  *             v[n + 1] = acovf[n + 1, n + 1]
12303  *         else:
12304  */
12305     __pyx_t_8 = (((__pyx_v_n + 1) < __pyx_v_m) != 0);
12306     if (__pyx_t_8) {
12307 
12308       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1587
12309  *
12310  *         if n + 1 < m:
12311  *             v[n + 1] = acovf[n + 1, n + 1]             # <<<<<<<<<<<<<<
12312  *         else:
12313  *             v[n + 1] = acovf2[0]
12314  */
12315       __pyx_t_22 = (__pyx_v_n + 1);
12316       __pyx_t_21 = (__pyx_v_n + 1);
12317       __pyx_t_20 = (__pyx_v_n + 1);
12318       *((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_20 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_acovf.data + __pyx_t_22 * __pyx_v_acovf.strides[0]) ) + __pyx_t_21 * __pyx_v_acovf.strides[1]) )));
12319 
12320       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1586
12321  *             theta[_n, n - k] = theta[_n, n - k] / v[k]
12322  *
12323  *         if n + 1 < m:             # <<<<<<<<<<<<<<
12324  *             v[n + 1] = acovf[n + 1, n + 1]
12325  *         else:
12326  */
12327       goto __pyx_L17;
12328     }
12329 
12330     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1589
12331  *             v[n + 1] = acovf[n + 1, n + 1]
12332  *         else:
12333  *             v[n + 1] = acovf2[0]             # <<<<<<<<<<<<<<
12334  *         start = max(0, n - (m + 1) + 2)
12335  *         for i in range(start, n + 1):
12336  */
12337     /*else*/ {
12338       __pyx_t_21 = 0;
12339       __pyx_t_22 = (__pyx_v_n + 1);
12340       *((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_22 * __pyx_v_v.strides[0]) )) = (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_acovf2.data + __pyx_t_21 * __pyx_v_acovf2.strides[0]) )));
12341     }
12342     __pyx_L17:;
12343 
12344     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1590
12345  *         else:
12346  *             v[n + 1] = acovf2[0]
12347  *         start = max(0, n - (m + 1) + 2)             # <<<<<<<<<<<<<<
12348  *         for i in range(start, n + 1):
12349  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]
12350  */
12351     __pyx_t_2 = ((__pyx_v_n - (__pyx_v_m + 1)) + 2);
12352     __pyx_t_27 = 0;
12353     if (((__pyx_t_2 > __pyx_t_27) != 0)) {
12354       __pyx_t_3 = __pyx_t_2;
12355     } else {
12356       __pyx_t_3 = __pyx_t_27;
12357     }
12358     __pyx_v_start = __pyx_t_3;
12359 
12360     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1591
12361  *             v[n + 1] = acovf2[0]
12362  *         start = max(0, n - (m + 1) + 2)
12363  *         for i in range(start, n + 1):             # <<<<<<<<<<<<<<
12364  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]
12365  *
12366  */
12367     __pyx_t_3 = (__pyx_v_n + 1);
12368     __pyx_t_2 = __pyx_t_3;
12369     for (__pyx_t_14 = __pyx_v_start; __pyx_t_14 < __pyx_t_2; __pyx_t_14+=1) {
12370       __pyx_v_i = __pyx_t_14;
12371 
12372       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1592
12373  *         start = max(0, n - (m + 1) + 2)
12374  *         for i in range(start, n + 1):
12375  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]             # <<<<<<<<<<<<<<
12376  *
12377  *     return theta, v
12378  */
12379       __pyx_t_21 = (__pyx_v_n + 1);
12380       __pyx_t_22 = __pyx_v__n;
12381       __pyx_t_20 = (__pyx_v_n - __pyx_v_i);
12382       __pyx_t_11 = __pyx_v_i;
12383       __pyx_t_10 = (__pyx_v_n + 1);
12384       *((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_10 * __pyx_v_v.strides[0]) )) = __Pyx_c_diff_double((*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_21 * __pyx_v_v.strides[0]) ))), __Pyx_c_prod_double(__Pyx_c_pow_double((*((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_22 * __pyx_v_theta.strides[0]) ) + __pyx_t_20 * __pyx_v_theta.strides[1]) ))), __pyx_t_double_complex_from_parts(2, 0)), (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_11 * __pyx_v_v.strides[0]) )))));
12385     }
12386   }
12387 
12388   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1594
12389  *             v[n + 1] = v[n + 1] - theta[_n, n - i]**2 * v[i]
12390  *
12391  *     return theta, v             # <<<<<<<<<<<<<<
12392  *
12393  *
12394  */
12395   __Pyx_XDECREF(__pyx_r);
12396   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_theta, 2, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1594, __pyx_L1_error)
12397   __Pyx_GOTREF(__pyx_t_5);
12398   __pyx_t_28 = __pyx_memoryview_fromslice(__pyx_v_v, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 1594, __pyx_L1_error)
12399   __Pyx_GOTREF(__pyx_t_28);
12400   __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 1594, __pyx_L1_error)
12401   __Pyx_GOTREF(__pyx_t_29);
12402   __Pyx_GIVEREF(__pyx_t_5);
12403   PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_t_5);
12404   __Pyx_GIVEREF(__pyx_t_28);
12405   PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_28);
12406   __pyx_t_5 = 0;
12407   __pyx_t_28 = 0;
12408   __pyx_r = __pyx_t_29;
12409   __pyx_t_29 = 0;
12410   goto __pyx_L0;
12411 
12412   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1493
12413  *
12414  *
12415  * cpdef zarma_innovations_algo_fast(int nobs,             # <<<<<<<<<<<<<<
12416  *                                            cnp.complex128_t [:] ar_params,
12417  *                                            cnp.complex128_t [:] ma_params,
12418  */
12419 
12420   /* function exit code */
12421   __pyx_L1_error:;
12422   __Pyx_XDECREF(__pyx_t_5);
12423   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
12424   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
12425   __Pyx_XDECREF(__pyx_t_28);
12426   __Pyx_XDECREF(__pyx_t_29);
12427   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_innovations_algo_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
12428   __pyx_r = 0;
12429   __pyx_L0:;
12430   __PYX_XDEC_MEMVIEW(&__pyx_v_theta, 1);
12431   __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
12432   __Pyx_XGIVEREF(__pyx_r);
12433   __Pyx_RefNannyFinishContext();
12434   return __pyx_r;
12435 }
12436 
12437 /* Python wrapper */
12438 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_33zarma_innovations_algo_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12439 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_32zarma_innovations_algo_fast[] = "\n    arma_innovations_algo_fast(int nobs, cnp.complex128_t [:] ar_params, cnp.complex128_t [:] ma_params, cnp.complex128_t [:, :] acovf, cnp.complex128_t [:] acovf2)\n    \n    Quickly apply innovations algorithm for an ARMA process.\n\n    Parameters\n    ----------\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    acovf : ndarray\n        An `m * 2` x `m * 2` autocovariance matrix at least the first `m`\n        columns filled in, where `m = max(len(ar_params), ma_params)`\n        (see `arma_transformed_acovf_fast`).\n    acovf2 : ndarray\n        A `max(0, nobs - m)` length vector containing the autocovariance\n        function associated with the final `nobs - m` observations.\n\n    Returns\n    -------\n    theta : ndarray\n        The matrix of moving average coefficients from the innovations\n        algorithm.\n    v : ndarray\n        The vector of mean squared errors.\n\n    Notes\n    -----\n    The innovations algorithm is presented in _[1], section 2.5.2.\n\n    Details of the innovations algorithm applied to ARMA processes is given\n    in _[1] section 3.3 and in section 5.2.7.\n\n    This function is relatively fast even with a large number of observations\n    since we can exploit a number of known zeros in the theta array.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_33zarma_innovations_algo_fast(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)12440 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_33zarma_innovations_algo_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12441   int __pyx_v_nobs;
12442   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
12443   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
12444   __Pyx_memviewslice __pyx_v_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
12445   __Pyx_memviewslice __pyx_v_acovf2 = { 0, 0, { 0 }, { 0 }, { 0 } };
12446   int __pyx_lineno = 0;
12447   const char *__pyx_filename = NULL;
12448   int __pyx_clineno = 0;
12449   PyObject *__pyx_r = 0;
12450   __Pyx_RefNannyDeclarations
12451   __Pyx_RefNannySetupContext("zarma_innovations_algo_fast (wrapper)", 0);
12452   {
12453     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nobs,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_acovf,&__pyx_n_s_acovf2,0};
12454     PyObject* values[5] = {0,0,0,0,0};
12455     if (unlikely(__pyx_kwds)) {
12456       Py_ssize_t kw_args;
12457       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12458       switch (pos_args) {
12459         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
12460         CYTHON_FALLTHROUGH;
12461         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
12462         CYTHON_FALLTHROUGH;
12463         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12464         CYTHON_FALLTHROUGH;
12465         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12466         CYTHON_FALLTHROUGH;
12467         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12468         CYTHON_FALLTHROUGH;
12469         case  0: break;
12470         default: goto __pyx_L5_argtuple_error;
12471       }
12472       kw_args = PyDict_Size(__pyx_kwds);
12473       switch (pos_args) {
12474         case  0:
12475         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nobs)) != 0)) kw_args--;
12476         else goto __pyx_L5_argtuple_error;
12477         CYTHON_FALLTHROUGH;
12478         case  1:
12479         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
12480         else {
12481           __Pyx_RaiseArgtupleInvalid("zarma_innovations_algo_fast", 1, 5, 5, 1); __PYX_ERR(0, 1493, __pyx_L3_error)
12482         }
12483         CYTHON_FALLTHROUGH;
12484         case  2:
12485         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
12486         else {
12487           __Pyx_RaiseArgtupleInvalid("zarma_innovations_algo_fast", 1, 5, 5, 2); __PYX_ERR(0, 1493, __pyx_L3_error)
12488         }
12489         CYTHON_FALLTHROUGH;
12490         case  3:
12491         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_acovf)) != 0)) kw_args--;
12492         else {
12493           __Pyx_RaiseArgtupleInvalid("zarma_innovations_algo_fast", 1, 5, 5, 3); __PYX_ERR(0, 1493, __pyx_L3_error)
12494         }
12495         CYTHON_FALLTHROUGH;
12496         case  4:
12497         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_acovf2)) != 0)) kw_args--;
12498         else {
12499           __Pyx_RaiseArgtupleInvalid("zarma_innovations_algo_fast", 1, 5, 5, 4); __PYX_ERR(0, 1493, __pyx_L3_error)
12500         }
12501       }
12502       if (unlikely(kw_args > 0)) {
12503         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zarma_innovations_algo_fast") < 0)) __PYX_ERR(0, 1493, __pyx_L3_error)
12504       }
12505     } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
12506       goto __pyx_L5_argtuple_error;
12507     } else {
12508       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12509       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12510       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12511       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
12512       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
12513     }
12514     __pyx_v_nobs = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nobs == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1493, __pyx_L3_error)
12515     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 1494, __pyx_L3_error)
12516     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 1495, __pyx_L3_error)
12517     __pyx_v_acovf = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_acovf.memview)) __PYX_ERR(0, 1496, __pyx_L3_error)
12518     __pyx_v_acovf2 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_acovf2.memview)) __PYX_ERR(0, 1497, __pyx_L3_error)
12519   }
12520   goto __pyx_L4_argument_unpacking_done;
12521   __pyx_L5_argtuple_error:;
12522   __Pyx_RaiseArgtupleInvalid("zarma_innovations_algo_fast", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1493, __pyx_L3_error)
12523   __pyx_L3_error:;
12524   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_innovations_algo_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
12525   __Pyx_RefNannyFinishContext();
12526   return NULL;
12527   __pyx_L4_argument_unpacking_done:;
12528   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_32zarma_innovations_algo_fast(__pyx_self, __pyx_v_nobs, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_acovf, __pyx_v_acovf2);
12529 
12530   /* function exit code */
12531   __Pyx_RefNannyFinishContext();
12532   return __pyx_r;
12533 }
12534 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_32zarma_innovations_algo_fast(CYTHON_UNUSED PyObject * __pyx_self,int __pyx_v_nobs,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_acovf,__Pyx_memviewslice __pyx_v_acovf2)12535 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_32zarma_innovations_algo_fast(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nobs, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_acovf, __Pyx_memviewslice __pyx_v_acovf2) {
12536   PyObject *__pyx_r = NULL;
12537   __Pyx_RefNannyDeclarations
12538   PyObject *__pyx_t_1 = NULL;
12539   int __pyx_lineno = 0;
12540   const char *__pyx_filename = NULL;
12541   int __pyx_clineno = 0;
12542   __Pyx_RefNannySetupContext("zarma_innovations_algo_fast", 0);
12543   __Pyx_XDECREF(__pyx_r);
12544   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 1493, __pyx_L1_error) }
12545   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 1493, __pyx_L1_error) }
12546   if (unlikely(!__pyx_v_acovf.memview)) { __Pyx_RaiseUnboundLocalError("acovf"); __PYX_ERR(0, 1493, __pyx_L1_error) }
12547   if (unlikely(!__pyx_v_acovf2.memview)) { __Pyx_RaiseUnboundLocalError("acovf2"); __PYX_ERR(0, 1493, __pyx_L1_error) }
12548   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations_algo_fast(__pyx_v_nobs, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_acovf, __pyx_v_acovf2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1493, __pyx_L1_error)
12549   __Pyx_GOTREF(__pyx_t_1);
12550   __pyx_r = __pyx_t_1;
12551   __pyx_t_1 = 0;
12552   goto __pyx_L0;
12553 
12554   /* function exit code */
12555   __pyx_L1_error:;
12556   __Pyx_XDECREF(__pyx_t_1);
12557   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_innovations_algo_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
12558   __pyx_r = NULL;
12559   __pyx_L0:;
12560   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
12561   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
12562   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf, 1);
12563   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf2, 1);
12564   __Pyx_XGIVEREF(__pyx_r);
12565   __Pyx_RefNannyFinishContext();
12566   return __pyx_r;
12567 }
12568 
12569 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1597
12570  *
12571  *
12572  * cpdef zarma_innovations_filter(cnp.complex128_t [:] endog,             # <<<<<<<<<<<<<<
12573  *                                         cnp.complex128_t [:] ar_params,
12574  *                                         cnp.complex128_t [:] ma_params,
12575  */
12576 
12577 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_35zarma_innovations_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations_filter(__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_theta,CYTHON_UNUSED int __pyx_skip_dispatch)12578 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations_filter(__Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_theta, CYTHON_UNUSED int __pyx_skip_dispatch) {
12579   Py_ssize_t __pyx_v_nobs;
12580   Py_ssize_t __pyx_v_i;
12581   CYTHON_UNUSED Py_ssize_t __pyx_v_k;
12582   Py_ssize_t __pyx_v_j;
12583   Py_ssize_t __pyx_v_m;
12584   Py_ssize_t __pyx_v_p;
12585   Py_ssize_t __pyx_v_q;
12586   npy_intp __pyx_v_dim1[1];
12587   __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
12588   __pyx_t_double_complex __pyx_v_hat;
12589   PyObject *__pyx_r = NULL;
12590   __Pyx_RefNannyDeclarations
12591   size_t __pyx_t_1;
12592   Py_ssize_t __pyx_t_2;
12593   Py_ssize_t __pyx_t_3;
12594   Py_ssize_t __pyx_t_4;
12595   PyObject *__pyx_t_5 = NULL;
12596   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
12597   Py_ssize_t __pyx_t_7;
12598   Py_ssize_t __pyx_t_8;
12599   int __pyx_t_9;
12600   Py_ssize_t __pyx_t_10;
12601   Py_ssize_t __pyx_t_11;
12602   Py_ssize_t __pyx_t_12;
12603   Py_ssize_t __pyx_t_13;
12604   int __pyx_lineno = 0;
12605   const char *__pyx_filename = NULL;
12606   int __pyx_clineno = 0;
12607   __Pyx_RefNannySetupContext("zarma_innovations_filter", 0);
12608 
12609   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1642
12610  *     cdef cnp.complex128_t hat
12611  *
12612  *     p = len(ar_params)             # <<<<<<<<<<<<<<
12613  *     q = len(ma_params)
12614  *     m = max(p, q)
12615  */
12616   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
12617   __pyx_v_p = __pyx_t_1;
12618 
12619   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1643
12620  *
12621  *     p = len(ar_params)
12622  *     q = len(ma_params)             # <<<<<<<<<<<<<<
12623  *     m = max(p, q)
12624  *
12625  */
12626   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma_params);
12627   __pyx_v_q = __pyx_t_1;
12628 
12629   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1644
12630  *     p = len(ar_params)
12631  *     q = len(ma_params)
12632  *     m = max(p, q)             # <<<<<<<<<<<<<<
12633  *
12634  *     nobs = theta.shape[0]
12635  */
12636   __pyx_t_2 = __pyx_v_q;
12637   __pyx_t_3 = __pyx_v_p;
12638   if (((__pyx_t_2 > __pyx_t_3) != 0)) {
12639     __pyx_t_4 = __pyx_t_2;
12640   } else {
12641     __pyx_t_4 = __pyx_t_3;
12642   }
12643   __pyx_v_m = __pyx_t_4;
12644 
12645   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1646
12646  *     m = max(p, q)
12647  *
12648  *     nobs = theta.shape[0]             # <<<<<<<<<<<<<<
12649  *     k = theta.shape[1]
12650  *
12651  */
12652   __pyx_v_nobs = (__pyx_v_theta.shape[0]);
12653 
12654   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1647
12655  *
12656  *     nobs = theta.shape[0]
12657  *     k = theta.shape[1]             # <<<<<<<<<<<<<<
12658  *
12659  *     dim1[0] = nobs;
12660  */
12661   __pyx_v_k = (__pyx_v_theta.shape[1]);
12662 
12663   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1649
12664  *     k = theta.shape[1]
12665  *
12666  *     dim1[0] = nobs;             # <<<<<<<<<<<<<<
12667  *     u = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
12668  *     u[0] = endog[0]
12669  */
12670   (__pyx_v_dim1[0]) = __pyx_v_nobs;
12671 
12672   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1650
12673  *
12674  *     dim1[0] = nobs;
12675  *     u = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)             # <<<<<<<<<<<<<<
12676  *     u[0] = endog[0]
12677  *
12678  */
12679   __pyx_t_5 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_COMPLEX128, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1650, __pyx_L1_error)
12680   __Pyx_GOTREF(__pyx_t_5);
12681   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1650, __pyx_L1_error)
12682   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12683   __pyx_v_u = __pyx_t_6;
12684   __pyx_t_6.memview = NULL;
12685   __pyx_t_6.data = NULL;
12686 
12687   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1651
12688  *     dim1[0] = nobs;
12689  *     u = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
12690  *     u[0] = endog[0]             # <<<<<<<<<<<<<<
12691  *
12692  *     for i in range(1, nobs):
12693  */
12694   __pyx_t_7 = 0;
12695   __pyx_t_8 = 0;
12696   *((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_8 * __pyx_v_u.strides[0]) )) = (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_endog.data + __pyx_t_7 * __pyx_v_endog.strides[0]) )));
12697 
12698   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1653
12699  *     u[0] = endog[0]
12700  *
12701  *     for i in range(1, nobs):             # <<<<<<<<<<<<<<
12702  *         hat = 0
12703  *         if i < m:
12704  */
12705   __pyx_t_4 = __pyx_v_nobs;
12706   __pyx_t_2 = __pyx_t_4;
12707   for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
12708     __pyx_v_i = __pyx_t_3;
12709 
12710     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1654
12711  *
12712  *     for i in range(1, nobs):
12713  *         hat = 0             # <<<<<<<<<<<<<<
12714  *         if i < m:
12715  *             for j in range(i):
12716  */
12717     __pyx_v_hat = __pyx_t_double_complex_from_parts(0, 0);
12718 
12719     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1655
12720  *     for i in range(1, nobs):
12721  *         hat = 0
12722  *         if i < m:             # <<<<<<<<<<<<<<
12723  *             for j in range(i):
12724  *                 hat = hat + theta[i, j] * u[i - j - 1]
12725  */
12726     __pyx_t_9 = ((__pyx_v_i < __pyx_v_m) != 0);
12727     if (__pyx_t_9) {
12728 
12729       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1656
12730  *         hat = 0
12731  *         if i < m:
12732  *             for j in range(i):             # <<<<<<<<<<<<<<
12733  *                 hat = hat + theta[i, j] * u[i - j - 1]
12734  *         else:
12735  */
12736       __pyx_t_10 = __pyx_v_i;
12737       __pyx_t_11 = __pyx_t_10;
12738       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
12739         __pyx_v_j = __pyx_t_12;
12740 
12741         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1657
12742  *         if i < m:
12743  *             for j in range(i):
12744  *                 hat = hat + theta[i, j] * u[i - j - 1]             # <<<<<<<<<<<<<<
12745  *         else:
12746  *             for j in range(p):
12747  */
12748         __pyx_t_7 = __pyx_v_i;
12749         __pyx_t_8 = __pyx_v_j;
12750         __pyx_t_13 = ((__pyx_v_i - __pyx_v_j) - 1);
12751         __pyx_v_hat = __Pyx_c_sum_double(__pyx_v_hat, __Pyx_c_prod_double((*((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_7 * __pyx_v_theta.strides[0]) ) + __pyx_t_8 * __pyx_v_theta.strides[1]) ))), (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_13 * __pyx_v_u.strides[0]) )))));
12752       }
12753 
12754       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1655
12755  *     for i in range(1, nobs):
12756  *         hat = 0
12757  *         if i < m:             # <<<<<<<<<<<<<<
12758  *             for j in range(i):
12759  *                 hat = hat + theta[i, j] * u[i - j - 1]
12760  */
12761       goto __pyx_L5;
12762     }
12763 
12764     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1659
12765  *                 hat = hat + theta[i, j] * u[i - j - 1]
12766  *         else:
12767  *             for j in range(p):             # <<<<<<<<<<<<<<
12768  *                 hat = hat + ar_params[j] * endog[i - j - 1]
12769  *             for j in range(q):
12770  */
12771     /*else*/ {
12772       __pyx_t_10 = __pyx_v_p;
12773       __pyx_t_11 = __pyx_t_10;
12774       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
12775         __pyx_v_j = __pyx_t_12;
12776 
12777         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1660
12778  *         else:
12779  *             for j in range(p):
12780  *                 hat = hat + ar_params[j] * endog[i - j - 1]             # <<<<<<<<<<<<<<
12781  *             for j in range(q):
12782  *                 hat = hat + theta[i, j] * u[i - j - 1]
12783  */
12784         __pyx_t_13 = __pyx_v_j;
12785         __pyx_t_8 = ((__pyx_v_i - __pyx_v_j) - 1);
12786         __pyx_v_hat = __Pyx_c_sum_double(__pyx_v_hat, __Pyx_c_prod_double((*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_ar_params.data + __pyx_t_13 * __pyx_v_ar_params.strides[0]) ))), (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_endog.data + __pyx_t_8 * __pyx_v_endog.strides[0]) )))));
12787       }
12788 
12789       /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1661
12790  *             for j in range(p):
12791  *                 hat = hat + ar_params[j] * endog[i - j - 1]
12792  *             for j in range(q):             # <<<<<<<<<<<<<<
12793  *                 hat = hat + theta[i, j] * u[i - j - 1]
12794  *         u[i] = endog[i] - hat
12795  */
12796       __pyx_t_10 = __pyx_v_q;
12797       __pyx_t_11 = __pyx_t_10;
12798       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
12799         __pyx_v_j = __pyx_t_12;
12800 
12801         /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1662
12802  *                 hat = hat + ar_params[j] * endog[i - j - 1]
12803  *             for j in range(q):
12804  *                 hat = hat + theta[i, j] * u[i - j - 1]             # <<<<<<<<<<<<<<
12805  *         u[i] = endog[i] - hat
12806  *
12807  */
12808         __pyx_t_8 = __pyx_v_i;
12809         __pyx_t_13 = __pyx_v_j;
12810         __pyx_t_7 = ((__pyx_v_i - __pyx_v_j) - 1);
12811         __pyx_v_hat = __Pyx_c_sum_double(__pyx_v_hat, __Pyx_c_prod_double((*((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_theta.data + __pyx_t_8 * __pyx_v_theta.strides[0]) ) + __pyx_t_13 * __pyx_v_theta.strides[1]) ))), (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_7 * __pyx_v_u.strides[0]) )))));
12812       }
12813     }
12814     __pyx_L5:;
12815 
12816     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1663
12817  *             for j in range(q):
12818  *                 hat = hat + theta[i, j] * u[i - j - 1]
12819  *         u[i] = endog[i] - hat             # <<<<<<<<<<<<<<
12820  *
12821  *     return u
12822  */
12823     __pyx_t_7 = __pyx_v_i;
12824     __pyx_t_13 = __pyx_v_i;
12825     *((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_13 * __pyx_v_u.strides[0]) )) = __Pyx_c_diff_double((*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_endog.data + __pyx_t_7 * __pyx_v_endog.strides[0]) ))), __pyx_v_hat);
12826   }
12827 
12828   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1665
12829  *         u[i] = endog[i] - hat
12830  *
12831  *     return u             # <<<<<<<<<<<<<<
12832  *
12833  *
12834  */
12835   __Pyx_XDECREF(__pyx_r);
12836   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_u, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1665, __pyx_L1_error)
12837   __Pyx_GOTREF(__pyx_t_5);
12838   __pyx_r = __pyx_t_5;
12839   __pyx_t_5 = 0;
12840   goto __pyx_L0;
12841 
12842   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1597
12843  *
12844  *
12845  * cpdef zarma_innovations_filter(cnp.complex128_t [:] endog,             # <<<<<<<<<<<<<<
12846  *                                         cnp.complex128_t [:] ar_params,
12847  *                                         cnp.complex128_t [:] ma_params,
12848  */
12849 
12850   /* function exit code */
12851   __pyx_L1_error:;
12852   __Pyx_XDECREF(__pyx_t_5);
12853   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
12854   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_innovations_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
12855   __pyx_r = 0;
12856   __pyx_L0:;
12857   __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
12858   __Pyx_XGIVEREF(__pyx_r);
12859   __Pyx_RefNannyFinishContext();
12860   return __pyx_r;
12861 }
12862 
12863 /* Python wrapper */
12864 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_35zarma_innovations_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12865 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_34zarma_innovations_filter[] = "\n    arma_innovations_filter(cnp.complex128_t [:] endog, cnp.complex128_t [:] ar_params, cnp.complex128_t [:] ma_params, cnp.complex128_t [:, :] theta):\n    \n    Innovations filter for an ARMA process.\n\n    Parameters\n    ----------\n    endog : ndarray\n        The observed time-series process.\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    theta : ndarray\n        The matrix of moving average coefficients from the innovations\n        algorithm (see `arma_innovations_algo` or `arma_innovations_algo_fast`)\n\n    Returns\n    -------\n    u : ndarray\n        The vector of innovations: the one-step-ahead prediction errors from\n        applying the innovations algorithm.\n\n    Notes\n    -----\n    The innovations algorithm is presented in _[1], section 2.5.2.\n\n    Details of the innovations algorithm applied to ARMA processes is given\n    in _[1] section 3.3 and in section 5.2.7.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_35zarma_innovations_filter(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)12866 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_35zarma_innovations_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12867   __Pyx_memviewslice __pyx_v_endog = { 0, 0, { 0 }, { 0 }, { 0 } };
12868   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
12869   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
12870   __Pyx_memviewslice __pyx_v_theta = { 0, 0, { 0 }, { 0 }, { 0 } };
12871   int __pyx_lineno = 0;
12872   const char *__pyx_filename = NULL;
12873   int __pyx_clineno = 0;
12874   PyObject *__pyx_r = 0;
12875   __Pyx_RefNannyDeclarations
12876   __Pyx_RefNannySetupContext("zarma_innovations_filter (wrapper)", 0);
12877   {
12878     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_theta,0};
12879     PyObject* values[4] = {0,0,0,0};
12880     if (unlikely(__pyx_kwds)) {
12881       Py_ssize_t kw_args;
12882       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12883       switch (pos_args) {
12884         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
12885         CYTHON_FALLTHROUGH;
12886         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12887         CYTHON_FALLTHROUGH;
12888         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12889         CYTHON_FALLTHROUGH;
12890         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12891         CYTHON_FALLTHROUGH;
12892         case  0: break;
12893         default: goto __pyx_L5_argtuple_error;
12894       }
12895       kw_args = PyDict_Size(__pyx_kwds);
12896       switch (pos_args) {
12897         case  0:
12898         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
12899         else goto __pyx_L5_argtuple_error;
12900         CYTHON_FALLTHROUGH;
12901         case  1:
12902         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
12903         else {
12904           __Pyx_RaiseArgtupleInvalid("zarma_innovations_filter", 1, 4, 4, 1); __PYX_ERR(0, 1597, __pyx_L3_error)
12905         }
12906         CYTHON_FALLTHROUGH;
12907         case  2:
12908         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
12909         else {
12910           __Pyx_RaiseArgtupleInvalid("zarma_innovations_filter", 1, 4, 4, 2); __PYX_ERR(0, 1597, __pyx_L3_error)
12911         }
12912         CYTHON_FALLTHROUGH;
12913         case  3:
12914         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
12915         else {
12916           __Pyx_RaiseArgtupleInvalid("zarma_innovations_filter", 1, 4, 4, 3); __PYX_ERR(0, 1597, __pyx_L3_error)
12917         }
12918       }
12919       if (unlikely(kw_args > 0)) {
12920         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zarma_innovations_filter") < 0)) __PYX_ERR(0, 1597, __pyx_L3_error)
12921       }
12922     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
12923       goto __pyx_L5_argtuple_error;
12924     } else {
12925       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12926       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12927       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12928       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
12929     }
12930     __pyx_v_endog = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_endog.memview)) __PYX_ERR(0, 1597, __pyx_L3_error)
12931     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 1598, __pyx_L3_error)
12932     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 1599, __pyx_L3_error)
12933     __pyx_v_theta = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_theta.memview)) __PYX_ERR(0, 1600, __pyx_L3_error)
12934   }
12935   goto __pyx_L4_argument_unpacking_done;
12936   __pyx_L5_argtuple_error:;
12937   __Pyx_RaiseArgtupleInvalid("zarma_innovations_filter", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1597, __pyx_L3_error)
12938   __pyx_L3_error:;
12939   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_innovations_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
12940   __Pyx_RefNannyFinishContext();
12941   return NULL;
12942   __pyx_L4_argument_unpacking_done:;
12943   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_34zarma_innovations_filter(__pyx_self, __pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_theta);
12944 
12945   /* function exit code */
12946   __Pyx_RefNannyFinishContext();
12947   return __pyx_r;
12948 }
12949 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_34zarma_innovations_filter(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__Pyx_memviewslice __pyx_v_theta)12950 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_34zarma_innovations_filter(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __Pyx_memviewslice __pyx_v_theta) {
12951   PyObject *__pyx_r = NULL;
12952   __Pyx_RefNannyDeclarations
12953   PyObject *__pyx_t_1 = NULL;
12954   int __pyx_lineno = 0;
12955   const char *__pyx_filename = NULL;
12956   int __pyx_clineno = 0;
12957   __Pyx_RefNannySetupContext("zarma_innovations_filter", 0);
12958   __Pyx_XDECREF(__pyx_r);
12959   if (unlikely(!__pyx_v_endog.memview)) { __Pyx_RaiseUnboundLocalError("endog"); __PYX_ERR(0, 1597, __pyx_L1_error) }
12960   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 1597, __pyx_L1_error) }
12961   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 1597, __pyx_L1_error) }
12962   if (unlikely(!__pyx_v_theta.memview)) { __Pyx_RaiseUnboundLocalError("theta"); __PYX_ERR(0, 1597, __pyx_L1_error) }
12963   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations_filter(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_theta, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1597, __pyx_L1_error)
12964   __Pyx_GOTREF(__pyx_t_1);
12965   __pyx_r = __pyx_t_1;
12966   __pyx_t_1 = 0;
12967   goto __pyx_L0;
12968 
12969   /* function exit code */
12970   __pyx_L1_error:;
12971   __Pyx_XDECREF(__pyx_t_1);
12972   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_innovations_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
12973   __pyx_r = NULL;
12974   __pyx_L0:;
12975   __PYX_XDEC_MEMVIEW(&__pyx_v_endog, 1);
12976   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
12977   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
12978   __PYX_XDEC_MEMVIEW(&__pyx_v_theta, 1);
12979   __Pyx_XGIVEREF(__pyx_r);
12980   __Pyx_RefNannyFinishContext();
12981   return __pyx_r;
12982 }
12983 
12984 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1668
12985  *
12986  *
12987  * cpdef zarma_innovations(cnp.complex128_t [:] endog,             # <<<<<<<<<<<<<<
12988  *                                       cnp.complex128_t [:] ar_params,
12989  *                                       cnp.complex128_t [:] ma_params,
12990  */
12991 
12992 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_37zarma_innovations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations(__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_double_complex __pyx_v_sigma2,CYTHON_UNUSED int __pyx_skip_dispatch)12993 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations(__Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_double_complex __pyx_v_sigma2, CYTHON_UNUSED int __pyx_skip_dispatch) {
12994   Py_ssize_t __pyx_v_nobs;
12995   Py_ssize_t __pyx_v_i;
12996   __Pyx_memviewslice __pyx_v_ar = { 0, 0, { 0 }, { 0 }, { 0 } };
12997   __Pyx_memviewslice __pyx_v_ma = { 0, 0, { 0 }, { 0 }, { 0 } };
12998   __Pyx_memviewslice __pyx_v_arma_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
12999   __Pyx_memviewslice __pyx_v_acovf2 = { 0, 0, { 0 }, { 0 }, { 0 } };
13000   __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
13001   __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
13002   __Pyx_memviewslice __pyx_v_acovf = { 0, 0, { 0 }, { 0 }, { 0 } };
13003   npy_intp __pyx_v_dim1[1];
13004   PyObject *__pyx_v_theta = NULL;
13005   PyObject *__pyx_r = NULL;
13006   __Pyx_RefNannyDeclarations
13007   size_t __pyx_t_1;
13008   PyObject *__pyx_t_2 = NULL;
13009   __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
13010   Py_ssize_t __pyx_t_4;
13011   Py_ssize_t __pyx_t_5;
13012   Py_ssize_t __pyx_t_6;
13013   Py_ssize_t __pyx_t_7;
13014   Py_ssize_t __pyx_t_8;
13015   int __pyx_t_9;
13016   PyObject *__pyx_t_10 = NULL;
13017   PyObject *__pyx_t_11 = NULL;
13018   PyObject *__pyx_t_12 = NULL;
13019   PyObject *__pyx_t_13 = NULL;
13020   PyObject *__pyx_t_14 = NULL;
13021   PyObject *(*__pyx_t_15)(PyObject *);
13022   __Pyx_memviewslice __pyx_t_16 = { 0, 0, { 0 }, { 0 }, { 0 } };
13023   int __pyx_lineno = 0;
13024   const char *__pyx_filename = NULL;
13025   int __pyx_clineno = 0;
13026   __Pyx_RefNannySetupContext("zarma_innovations", 0);
13027 
13028   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1706
13029  *        New York, NY: Springer.
13030  *     """
13031  *     cdef Py_ssize_t nobs = len(endog), i             # <<<<<<<<<<<<<<
13032  *     cdef cnp.complex128_t const
13033  *     cdef cnp.complex128_t [:] ar, ma, arma_acovf, llf_obs, acovf2, u, v
13034  */
13035   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_endog);
13036   __pyx_v_nobs = __pyx_t_1;
13037 
13038   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1712
13039  *     cdef cnp.npy_intp dim1[1]
13040  *
13041  *     dim1[0] = len(ar_params) + 1;             # <<<<<<<<<<<<<<
13042  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
13043  *     dim1[0] = len(ma_params) + 1;
13044  */
13045   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
13046   (__pyx_v_dim1[0]) = (__pyx_t_1 + 1);
13047 
13048   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1713
13049  *
13050  *     dim1[0] = len(ar_params) + 1;
13051  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)             # <<<<<<<<<<<<<<
13052  *     dim1[0] = len(ma_params) + 1;
13053  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
13054  */
13055   __pyx_t_2 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_COMPLEX128, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1713, __pyx_L1_error)
13056   __Pyx_GOTREF(__pyx_t_2);
13057   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1713, __pyx_L1_error)
13058   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13059   __pyx_v_ar = __pyx_t_3;
13060   __pyx_t_3.memview = NULL;
13061   __pyx_t_3.data = NULL;
13062 
13063   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1714
13064  *     dim1[0] = len(ar_params) + 1;
13065  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
13066  *     dim1[0] = len(ma_params) + 1;             # <<<<<<<<<<<<<<
13067  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
13068  *
13069  */
13070   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ma_params);
13071   (__pyx_v_dim1[0]) = (__pyx_t_1 + 1);
13072 
13073   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1715
13074  *     ar = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
13075  *     dim1[0] = len(ma_params) + 1;
13076  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)             # <<<<<<<<<<<<<<
13077  *
13078  *     ar[0] = 1
13079  */
13080   __pyx_t_2 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_COMPLEX128, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1715, __pyx_L1_error)
13081   __Pyx_GOTREF(__pyx_t_2);
13082   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1715, __pyx_L1_error)
13083   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13084   __pyx_v_ma = __pyx_t_3;
13085   __pyx_t_3.memview = NULL;
13086   __pyx_t_3.data = NULL;
13087 
13088   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1717
13089  *     ma = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
13090  *
13091  *     ar[0] = 1             # <<<<<<<<<<<<<<
13092  *     for i in range(1, len(ar_params) + 1):
13093  *         ar[i] = -1 * ar_params[i - 1]
13094  */
13095   __pyx_t_4 = 0;
13096   *((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_ar.data + __pyx_t_4 * __pyx_v_ar.strides[0]) )) = __pyx_t_double_complex_from_parts(1, 0);
13097 
13098   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1718
13099  *
13100  *     ar[0] = 1
13101  *     for i in range(1, len(ar_params) + 1):             # <<<<<<<<<<<<<<
13102  *         ar[i] = -1 * ar_params[i - 1]
13103  *     ma[0] = 1
13104  */
13105   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ar_params);
13106   __pyx_t_5 = (__pyx_t_1 + 1);
13107   __pyx_t_6 = __pyx_t_5;
13108   for (__pyx_t_7 = 1; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
13109     __pyx_v_i = __pyx_t_7;
13110 
13111     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1719
13112  *     ar[0] = 1
13113  *     for i in range(1, len(ar_params) + 1):
13114  *         ar[i] = -1 * ar_params[i - 1]             # <<<<<<<<<<<<<<
13115  *     ma[0] = 1
13116  *     ma[1:] = ma_params
13117  */
13118     __pyx_t_4 = (__pyx_v_i - 1);
13119     __pyx_t_8 = __pyx_v_i;
13120     *((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_ar.data + __pyx_t_8 * __pyx_v_ar.strides[0]) )) = __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(-1L, 0), (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_ar_params.data + __pyx_t_4 * __pyx_v_ar_params.strides[0]) ))));
13121   }
13122 
13123   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1720
13124  *     for i in range(1, len(ar_params) + 1):
13125  *         ar[i] = -1 * ar_params[i - 1]
13126  *     ma[0] = 1             # <<<<<<<<<<<<<<
13127  *     ma[1:] = ma_params
13128  *
13129  */
13130   __pyx_t_4 = 0;
13131   *((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_ma.data + __pyx_t_4 * __pyx_v_ma.strides[0]) )) = __pyx_t_double_complex_from_parts(1, 0);
13132 
13133   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1721
13134  *         ar[i] = -1 * ar_params[i - 1]
13135  *     ma[0] = 1
13136  *     ma[1:] = ma_params             # <<<<<<<<<<<<<<
13137  *
13138  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=complex) / sigma2
13139  */
13140   __pyx_t_3.data = __pyx_v_ma.data;
13141   __pyx_t_3.memview = __pyx_v_ma.memview;
13142   __PYX_INC_MEMVIEW(&__pyx_t_3, 0);
13143   __pyx_t_9 = -1;
13144   if (unlikely(__pyx_memoryview_slice_memviewslice(
13145     &__pyx_t_3,
13146     __pyx_v_ma.shape[0], __pyx_v_ma.strides[0], __pyx_v_ma.suboffsets[0],
13147     0,
13148     0,
13149     &__pyx_t_9,
13150     1,
13151     0,
13152     0,
13153     1,
13154     0,
13155     0,
13156     1) < 0))
13157 {
13158     __PYX_ERR(0, 1721, __pyx_L1_error)
13159 }
13160 
13161 if (unlikely(__pyx_memoryview_copy_contents(__pyx_v_ma_params, __pyx_t_3, 1, 1, 0) < 0)) __PYX_ERR(0, 1721, __pyx_L1_error)
13162   __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
13163   __pyx_t_3.memview = NULL;
13164   __pyx_t_3.data = NULL;
13165 
13166   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1723
13167  *     ma[1:] = ma_params
13168  *
13169  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=complex) / sigma2             # <<<<<<<<<<<<<<
13170  *     acovf, acovf2 = zarma_transformed_acovf_fast(ar, ma, arma_acovf)
13171  *     theta, v = zarma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)
13172  */
13173   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_arima_process); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1723, __pyx_L1_error)
13174   __Pyx_GOTREF(__pyx_t_2);
13175   __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_arma_acovf); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1723, __pyx_L1_error)
13176   __Pyx_GOTREF(__pyx_t_10);
13177   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13178   __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_ar, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1723, __pyx_L1_error)
13179   __Pyx_GOTREF(__pyx_t_2);
13180   __pyx_t_11 = __pyx_memoryview_fromslice(__pyx_v_ma, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1723, __pyx_L1_error)
13181   __Pyx_GOTREF(__pyx_t_11);
13182   __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_nobs); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1723, __pyx_L1_error)
13183   __Pyx_GOTREF(__pyx_t_12);
13184   __pyx_t_13 = __pyx_PyComplex_FromComplex(__pyx_v_sigma2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1723, __pyx_L1_error)
13185   __Pyx_GOTREF(__pyx_t_13);
13186   __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1723, __pyx_L1_error)
13187   __Pyx_GOTREF(__pyx_t_14);
13188   __Pyx_GIVEREF(__pyx_t_2);
13189   PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2);
13190   __Pyx_GIVEREF(__pyx_t_11);
13191   PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_11);
13192   __Pyx_GIVEREF(__pyx_t_12);
13193   PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_12);
13194   __Pyx_GIVEREF(__pyx_t_13);
13195   PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_13);
13196   __pyx_t_2 = 0;
13197   __pyx_t_11 = 0;
13198   __pyx_t_12 = 0;
13199   __pyx_t_13 = 0;
13200   __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1723, __pyx_L1_error)
13201   __Pyx_GOTREF(__pyx_t_13);
13202   if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_dtype, ((PyObject *)(&PyComplex_Type))) < 0) __PYX_ERR(0, 1723, __pyx_L1_error)
13203   __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1723, __pyx_L1_error)
13204   __Pyx_GOTREF(__pyx_t_12);
13205   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13206   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
13207   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
13208   __pyx_t_13 = __pyx_PyComplex_FromComplex(__pyx_v_sigma2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1723, __pyx_L1_error)
13209   __Pyx_GOTREF(__pyx_t_13);
13210   __pyx_t_14 = __Pyx_PyNumber_Divide(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1723, __pyx_L1_error)
13211   __Pyx_GOTREF(__pyx_t_14);
13212   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
13213   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
13214   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(__pyx_t_14, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1723, __pyx_L1_error)
13215   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
13216   __pyx_v_arma_acovf = __pyx_t_3;
13217   __pyx_t_3.memview = NULL;
13218   __pyx_t_3.data = NULL;
13219 
13220   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1724
13221  *
13222  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=complex) / sigma2
13223  *     acovf, acovf2 = zarma_transformed_acovf_fast(ar, ma, arma_acovf)             # <<<<<<<<<<<<<<
13224  *     theta, v = zarma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)
13225  *     u = zarma_innovations_filter(endog, ar_params, ma_params, theta)
13226  */
13227   __pyx_t_14 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_transformed_acovf_fast(__pyx_v_ar, __pyx_v_ma, __pyx_v_arma_acovf, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1724, __pyx_L1_error)
13228   __Pyx_GOTREF(__pyx_t_14);
13229   if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
13230     PyObject* sequence = __pyx_t_14;
13231     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
13232     if (unlikely(size != 2)) {
13233       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
13234       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
13235       __PYX_ERR(0, 1724, __pyx_L1_error)
13236     }
13237     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13238     if (likely(PyTuple_CheckExact(sequence))) {
13239       __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0);
13240       __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1);
13241     } else {
13242       __pyx_t_13 = PyList_GET_ITEM(sequence, 0);
13243       __pyx_t_12 = PyList_GET_ITEM(sequence, 1);
13244     }
13245     __Pyx_INCREF(__pyx_t_13);
13246     __Pyx_INCREF(__pyx_t_12);
13247     #else
13248     __pyx_t_13 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1724, __pyx_L1_error)
13249     __Pyx_GOTREF(__pyx_t_13);
13250     __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1724, __pyx_L1_error)
13251     __Pyx_GOTREF(__pyx_t_12);
13252     #endif
13253     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
13254   } else {
13255     Py_ssize_t index = -1;
13256     __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1724, __pyx_L1_error)
13257     __Pyx_GOTREF(__pyx_t_10);
13258     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
13259     __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
13260     index = 0; __pyx_t_13 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_13)) goto __pyx_L5_unpacking_failed;
13261     __Pyx_GOTREF(__pyx_t_13);
13262     index = 1; __pyx_t_12 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_12)) goto __pyx_L5_unpacking_failed;
13263     __Pyx_GOTREF(__pyx_t_12);
13264     if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_10), 2) < 0) __PYX_ERR(0, 1724, __pyx_L1_error)
13265     __pyx_t_15 = NULL;
13266     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13267     goto __pyx_L6_unpacking_done;
13268     __pyx_L5_unpacking_failed:;
13269     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13270     __pyx_t_15 = NULL;
13271     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
13272     __PYX_ERR(0, 1724, __pyx_L1_error)
13273     __pyx_L6_unpacking_done:;
13274   }
13275   __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(__pyx_t_13, PyBUF_WRITABLE); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 1724, __pyx_L1_error)
13276   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
13277   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(__pyx_t_12, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1724, __pyx_L1_error)
13278   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
13279   __pyx_v_acovf = __pyx_t_16;
13280   __pyx_t_16.memview = NULL;
13281   __pyx_t_16.data = NULL;
13282   __pyx_v_acovf2 = __pyx_t_3;
13283   __pyx_t_3.memview = NULL;
13284   __pyx_t_3.data = NULL;
13285 
13286   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1725
13287  *     arma_acovf = arima_process.arma_acovf(ar, ma, nobs, sigma2, dtype=complex) / sigma2
13288  *     acovf, acovf2 = zarma_transformed_acovf_fast(ar, ma, arma_acovf)
13289  *     theta, v = zarma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)             # <<<<<<<<<<<<<<
13290  *     u = zarma_innovations_filter(endog, ar_params, ma_params, theta)
13291  *
13292  */
13293   __pyx_t_14 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations_algo_fast(__pyx_v_nobs, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_acovf, __pyx_v_acovf2, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1725, __pyx_L1_error)
13294   __Pyx_GOTREF(__pyx_t_14);
13295   if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
13296     PyObject* sequence = __pyx_t_14;
13297     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
13298     if (unlikely(size != 2)) {
13299       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
13300       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
13301       __PYX_ERR(0, 1725, __pyx_L1_error)
13302     }
13303     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13304     if (likely(PyTuple_CheckExact(sequence))) {
13305       __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0);
13306       __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
13307     } else {
13308       __pyx_t_12 = PyList_GET_ITEM(sequence, 0);
13309       __pyx_t_13 = PyList_GET_ITEM(sequence, 1);
13310     }
13311     __Pyx_INCREF(__pyx_t_12);
13312     __Pyx_INCREF(__pyx_t_13);
13313     #else
13314     __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1725, __pyx_L1_error)
13315     __Pyx_GOTREF(__pyx_t_12);
13316     __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1725, __pyx_L1_error)
13317     __Pyx_GOTREF(__pyx_t_13);
13318     #endif
13319     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
13320   } else {
13321     Py_ssize_t index = -1;
13322     __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1725, __pyx_L1_error)
13323     __Pyx_GOTREF(__pyx_t_10);
13324     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
13325     __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
13326     index = 0; __pyx_t_12 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_12)) goto __pyx_L7_unpacking_failed;
13327     __Pyx_GOTREF(__pyx_t_12);
13328     index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_10); if (unlikely(!__pyx_t_13)) goto __pyx_L7_unpacking_failed;
13329     __Pyx_GOTREF(__pyx_t_13);
13330     if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_10), 2) < 0) __PYX_ERR(0, 1725, __pyx_L1_error)
13331     __pyx_t_15 = NULL;
13332     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13333     goto __pyx_L8_unpacking_done;
13334     __pyx_L7_unpacking_failed:;
13335     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13336     __pyx_t_15 = NULL;
13337     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
13338     __PYX_ERR(0, 1725, __pyx_L1_error)
13339     __pyx_L8_unpacking_done:;
13340   }
13341   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(__pyx_t_13, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1725, __pyx_L1_error)
13342   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
13343   __pyx_v_theta = __pyx_t_12;
13344   __pyx_t_12 = 0;
13345   __pyx_v_v = __pyx_t_3;
13346   __pyx_t_3.memview = NULL;
13347   __pyx_t_3.data = NULL;
13348 
13349   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1726
13350  *     acovf, acovf2 = zarma_transformed_acovf_fast(ar, ma, arma_acovf)
13351  *     theta, v = zarma_innovations_algo_fast(nobs, ar_params, ma_params, acovf, acovf2)
13352  *     u = zarma_innovations_filter(endog, ar_params, ma_params, theta)             # <<<<<<<<<<<<<<
13353  *
13354  *     return u, v
13355  */
13356   __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(__pyx_v_theta, PyBUF_WRITABLE); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 1726, __pyx_L1_error)
13357   __pyx_t_14 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations_filter(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_t_16, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1726, __pyx_L1_error)
13358   __Pyx_GOTREF(__pyx_t_14);
13359   __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
13360   __pyx_t_16.memview = NULL;
13361   __pyx_t_16.data = NULL;
13362   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(__pyx_t_14, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1726, __pyx_L1_error)
13363   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
13364   __pyx_v_u = __pyx_t_3;
13365   __pyx_t_3.memview = NULL;
13366   __pyx_t_3.data = NULL;
13367 
13368   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1728
13369  *     u = zarma_innovations_filter(endog, ar_params, ma_params, theta)
13370  *
13371  *     return u, v             # <<<<<<<<<<<<<<
13372  *
13373  *
13374  */
13375   __Pyx_XDECREF(__pyx_r);
13376   __pyx_t_14 = __pyx_memoryview_fromslice(__pyx_v_u, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1728, __pyx_L1_error)
13377   __Pyx_GOTREF(__pyx_t_14);
13378   __pyx_t_13 = __pyx_memoryview_fromslice(__pyx_v_v, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1728, __pyx_L1_error)
13379   __Pyx_GOTREF(__pyx_t_13);
13380   __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1728, __pyx_L1_error)
13381   __Pyx_GOTREF(__pyx_t_12);
13382   __Pyx_GIVEREF(__pyx_t_14);
13383   PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14);
13384   __Pyx_GIVEREF(__pyx_t_13);
13385   PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_13);
13386   __pyx_t_14 = 0;
13387   __pyx_t_13 = 0;
13388   __pyx_r = __pyx_t_12;
13389   __pyx_t_12 = 0;
13390   goto __pyx_L0;
13391 
13392   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1668
13393  *
13394  *
13395  * cpdef zarma_innovations(cnp.complex128_t [:] endog,             # <<<<<<<<<<<<<<
13396  *                                       cnp.complex128_t [:] ar_params,
13397  *                                       cnp.complex128_t [:] ma_params,
13398  */
13399 
13400   /* function exit code */
13401   __pyx_L1_error:;
13402   __Pyx_XDECREF(__pyx_t_2);
13403   __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
13404   __Pyx_XDECREF(__pyx_t_10);
13405   __Pyx_XDECREF(__pyx_t_11);
13406   __Pyx_XDECREF(__pyx_t_12);
13407   __Pyx_XDECREF(__pyx_t_13);
13408   __Pyx_XDECREF(__pyx_t_14);
13409   __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
13410   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
13411   __pyx_r = 0;
13412   __pyx_L0:;
13413   __PYX_XDEC_MEMVIEW(&__pyx_v_ar, 1);
13414   __PYX_XDEC_MEMVIEW(&__pyx_v_ma, 1);
13415   __PYX_XDEC_MEMVIEW(&__pyx_v_arma_acovf, 1);
13416   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf2, 1);
13417   __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
13418   __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
13419   __PYX_XDEC_MEMVIEW(&__pyx_v_acovf, 1);
13420   __Pyx_XDECREF(__pyx_v_theta);
13421   __Pyx_XGIVEREF(__pyx_r);
13422   __Pyx_RefNannyFinishContext();
13423   return __pyx_r;
13424 }
13425 
13426 /* Python wrapper */
13427 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_37zarma_innovations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13428 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_36zarma_innovations[] = "\n    arma_innovations(cnp.complex128_t [:] endog, cnp.complex128_t [:] ar_params, cnp.complex128_t [:] ma_params):\n    \n    Compute innovations and variances based on an ARMA process.\n\n    Parameters\n    ----------\n    endog : ndarray\n        The observed time-series process.\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    sigma2 : ndarray\n        The ARMA innovation variance.\n\n    Returns\n    -------\n    u : ndarray\n        The vector of innovations: the one-step-ahead prediction errors from\n        applying the innovations algorithm.\n    v : ndarray\n        The vector of innovation variances.\n\n    Notes\n    -----\n    The innovations algorithm is presented in _[1], section 2.5.2.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_37zarma_innovations(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)13429 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_37zarma_innovations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13430   __Pyx_memviewslice __pyx_v_endog = { 0, 0, { 0 }, { 0 }, { 0 } };
13431   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
13432   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
13433   __pyx_t_double_complex __pyx_v_sigma2;
13434   int __pyx_lineno = 0;
13435   const char *__pyx_filename = NULL;
13436   int __pyx_clineno = 0;
13437   PyObject *__pyx_r = 0;
13438   __Pyx_RefNannyDeclarations
13439   __Pyx_RefNannySetupContext("zarma_innovations (wrapper)", 0);
13440   {
13441     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_sigma2,0};
13442     PyObject* values[4] = {0,0,0,0};
13443     if (unlikely(__pyx_kwds)) {
13444       Py_ssize_t kw_args;
13445       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13446       switch (pos_args) {
13447         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13448         CYTHON_FALLTHROUGH;
13449         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13450         CYTHON_FALLTHROUGH;
13451         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13452         CYTHON_FALLTHROUGH;
13453         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13454         CYTHON_FALLTHROUGH;
13455         case  0: break;
13456         default: goto __pyx_L5_argtuple_error;
13457       }
13458       kw_args = PyDict_Size(__pyx_kwds);
13459       switch (pos_args) {
13460         case  0:
13461         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
13462         else goto __pyx_L5_argtuple_error;
13463         CYTHON_FALLTHROUGH;
13464         case  1:
13465         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
13466         else {
13467           __Pyx_RaiseArgtupleInvalid("zarma_innovations", 1, 4, 4, 1); __PYX_ERR(0, 1668, __pyx_L3_error)
13468         }
13469         CYTHON_FALLTHROUGH;
13470         case  2:
13471         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
13472         else {
13473           __Pyx_RaiseArgtupleInvalid("zarma_innovations", 1, 4, 4, 2); __PYX_ERR(0, 1668, __pyx_L3_error)
13474         }
13475         CYTHON_FALLTHROUGH;
13476         case  3:
13477         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma2)) != 0)) kw_args--;
13478         else {
13479           __Pyx_RaiseArgtupleInvalid("zarma_innovations", 1, 4, 4, 3); __PYX_ERR(0, 1668, __pyx_L3_error)
13480         }
13481       }
13482       if (unlikely(kw_args > 0)) {
13483         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zarma_innovations") < 0)) __PYX_ERR(0, 1668, __pyx_L3_error)
13484       }
13485     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
13486       goto __pyx_L5_argtuple_error;
13487     } else {
13488       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13489       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13490       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13491       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13492     }
13493     __pyx_v_endog = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_endog.memview)) __PYX_ERR(0, 1668, __pyx_L3_error)
13494     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 1669, __pyx_L3_error)
13495     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 1670, __pyx_L3_error)
13496     __pyx_v_sigma2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1671, __pyx_L3_error)
13497   }
13498   goto __pyx_L4_argument_unpacking_done;
13499   __pyx_L5_argtuple_error:;
13500   __Pyx_RaiseArgtupleInvalid("zarma_innovations", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1668, __pyx_L3_error)
13501   __pyx_L3_error:;
13502   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
13503   __Pyx_RefNannyFinishContext();
13504   return NULL;
13505   __pyx_L4_argument_unpacking_done:;
13506   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_36zarma_innovations(__pyx_self, __pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2);
13507 
13508   /* function exit code */
13509   __Pyx_RefNannyFinishContext();
13510   return __pyx_r;
13511 }
13512 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_36zarma_innovations(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_double_complex __pyx_v_sigma2)13513 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_36zarma_innovations(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_double_complex __pyx_v_sigma2) {
13514   PyObject *__pyx_r = NULL;
13515   __Pyx_RefNannyDeclarations
13516   PyObject *__pyx_t_1 = NULL;
13517   int __pyx_lineno = 0;
13518   const char *__pyx_filename = NULL;
13519   int __pyx_clineno = 0;
13520   __Pyx_RefNannySetupContext("zarma_innovations", 0);
13521   __Pyx_XDECREF(__pyx_r);
13522   if (unlikely(!__pyx_v_endog.memview)) { __Pyx_RaiseUnboundLocalError("endog"); __PYX_ERR(0, 1668, __pyx_L1_error) }
13523   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 1668, __pyx_L1_error) }
13524   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 1668, __pyx_L1_error) }
13525   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1668, __pyx_L1_error)
13526   __Pyx_GOTREF(__pyx_t_1);
13527   __pyx_r = __pyx_t_1;
13528   __pyx_t_1 = 0;
13529   goto __pyx_L0;
13530 
13531   /* function exit code */
13532   __pyx_L1_error:;
13533   __Pyx_XDECREF(__pyx_t_1);
13534   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
13535   __pyx_r = NULL;
13536   __pyx_L0:;
13537   __PYX_XDEC_MEMVIEW(&__pyx_v_endog, 1);
13538   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
13539   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
13540   __Pyx_XGIVEREF(__pyx_r);
13541   __Pyx_RefNannyFinishContext();
13542   return __pyx_r;
13543 }
13544 
13545 /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1731
13546  *
13547  *
13548  * cpdef zarma_loglikeobs_fast(cnp.complex128_t [:] endog,             # <<<<<<<<<<<<<<
13549  *                                      cnp.complex128_t [:] ar_params,
13550  *                                      cnp.complex128_t [:] ma_params,
13551  */
13552 
13553 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_39zarma_loglikeobs_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_loglikeobs_fast(__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_double_complex __pyx_v_sigma2,CYTHON_UNUSED int __pyx_skip_dispatch)13554 static PyObject *__pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_loglikeobs_fast(__Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_double_complex __pyx_v_sigma2, CYTHON_UNUSED int __pyx_skip_dispatch) {
13555   Py_ssize_t __pyx_v_nobs;
13556   Py_ssize_t __pyx_v_i;
13557   __pyx_t_double_complex __pyx_v_const;
13558   __Pyx_memviewslice __pyx_v_llf_obs = { 0, 0, { 0 }, { 0 }, { 0 } };
13559   __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
13560   __Pyx_memviewslice __pyx_v_v = { 0, 0, { 0 }, { 0 }, { 0 } };
13561   npy_intp __pyx_v_dim1[1];
13562   PyObject *__pyx_r = NULL;
13563   __Pyx_RefNannyDeclarations
13564   size_t __pyx_t_1;
13565   PyObject *__pyx_t_2 = NULL;
13566   PyObject *__pyx_t_3 = NULL;
13567   PyObject *__pyx_t_4 = NULL;
13568   PyObject *__pyx_t_5 = NULL;
13569   PyObject *(*__pyx_t_6)(PyObject *);
13570   __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
13571   __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
13572   Py_ssize_t __pyx_t_9;
13573   Py_ssize_t __pyx_t_10;
13574   Py_ssize_t __pyx_t_11;
13575   Py_ssize_t __pyx_t_12;
13576   __pyx_t_double_complex __pyx_t_13;
13577   __pyx_t_double_complex __pyx_t_14;
13578   Py_ssize_t __pyx_t_15;
13579   int __pyx_lineno = 0;
13580   const char *__pyx_filename = NULL;
13581   int __pyx_clineno = 0;
13582   __Pyx_RefNannySetupContext("zarma_loglikeobs_fast", 0);
13583 
13584   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1768
13585  *     """
13586  *
13587  *     cdef Py_ssize_t nobs = len(endog), i             # <<<<<<<<<<<<<<
13588  *     cdef cnp.complex128_t const
13589  *     cdef cnp.complex128_t [:] llf_obs, u, v
13590  */
13591   __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_endog);
13592   __pyx_v_nobs = __pyx_t_1;
13593 
13594   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1773
13595  *     cdef cnp.npy_intp dim1[1]
13596  *
13597  *     u, v = zarma_innovations(endog, ar_params, ma_params, sigma2)             # <<<<<<<<<<<<<<
13598  *
13599  *     dim1[0] = nobs;
13600  */
13601   __pyx_t_2 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_innovations(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1773, __pyx_L1_error)
13602   __Pyx_GOTREF(__pyx_t_2);
13603   if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
13604     PyObject* sequence = __pyx_t_2;
13605     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
13606     if (unlikely(size != 2)) {
13607       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
13608       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
13609       __PYX_ERR(0, 1773, __pyx_L1_error)
13610     }
13611     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13612     if (likely(PyTuple_CheckExact(sequence))) {
13613       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
13614       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
13615     } else {
13616       __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
13617       __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
13618     }
13619     __Pyx_INCREF(__pyx_t_3);
13620     __Pyx_INCREF(__pyx_t_4);
13621     #else
13622     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1773, __pyx_L1_error)
13623     __Pyx_GOTREF(__pyx_t_3);
13624     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1773, __pyx_L1_error)
13625     __Pyx_GOTREF(__pyx_t_4);
13626     #endif
13627     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13628   } else {
13629     Py_ssize_t index = -1;
13630     __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1773, __pyx_L1_error)
13631     __Pyx_GOTREF(__pyx_t_5);
13632     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13633     __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
13634     index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
13635     __Pyx_GOTREF(__pyx_t_3);
13636     index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
13637     __Pyx_GOTREF(__pyx_t_4);
13638     if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1773, __pyx_L1_error)
13639     __pyx_t_6 = NULL;
13640     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13641     goto __pyx_L4_unpacking_done;
13642     __pyx_L3_unpacking_failed:;
13643     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13644     __pyx_t_6 = NULL;
13645     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
13646     __PYX_ERR(0, 1773, __pyx_L1_error)
13647     __pyx_L4_unpacking_done:;
13648   }
13649   __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1773, __pyx_L1_error)
13650   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13651   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1773, __pyx_L1_error)
13652   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13653   __pyx_v_u = __pyx_t_7;
13654   __pyx_t_7.memview = NULL;
13655   __pyx_t_7.data = NULL;
13656   __pyx_v_v = __pyx_t_8;
13657   __pyx_t_8.memview = NULL;
13658   __pyx_t_8.data = NULL;
13659 
13660   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1775
13661  *     u, v = zarma_innovations(endog, ar_params, ma_params, sigma2)
13662  *
13663  *     dim1[0] = nobs;             # <<<<<<<<<<<<<<
13664  *     llf_obs = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
13665  *
13666  */
13667   (__pyx_v_dim1[0]) = __pyx_v_nobs;
13668 
13669   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1776
13670  *
13671  *     dim1[0] = nobs;
13672  *     llf_obs = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)             # <<<<<<<<<<<<<<
13673  *
13674  *     const = zlog(2*NPY_PI)
13675  */
13676   __pyx_t_2 = PyArray_ZEROS(1, __pyx_v_dim1, NPY_COMPLEX128, __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1776, __pyx_L1_error)
13677   __Pyx_GOTREF(__pyx_t_2);
13678   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1776, __pyx_L1_error)
13679   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13680   __pyx_v_llf_obs = __pyx_t_8;
13681   __pyx_t_8.memview = NULL;
13682   __pyx_t_8.data = NULL;
13683 
13684   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1778
13685  *     llf_obs = cnp.PyArray_ZEROS(1, dim1, cnp.NPY_COMPLEX128, C)
13686  *
13687  *     const = zlog(2*NPY_PI)             # <<<<<<<<<<<<<<
13688  *     for i in range(nobs):
13689  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + zlog(sigma2 * v[i]))
13690  */
13691   __pyx_v_const = __pyx_f_11statsmodels_3src_4math_zlog(__pyx_t_double_complex_from_parts((2.0 * NPY_PI), 0));
13692 
13693   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1779
13694  *
13695  *     const = zlog(2*NPY_PI)
13696  *     for i in range(nobs):             # <<<<<<<<<<<<<<
13697  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + zlog(sigma2 * v[i]))
13698  *
13699  */
13700   __pyx_t_9 = __pyx_v_nobs;
13701   __pyx_t_10 = __pyx_t_9;
13702   for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
13703     __pyx_v_i = __pyx_t_11;
13704 
13705     /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1780
13706  *     const = zlog(2*NPY_PI)
13707  *     for i in range(nobs):
13708  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + zlog(sigma2 * v[i]))             # <<<<<<<<<<<<<<
13709  *
13710  *     return np.array(llf_obs, dtype=complex)
13711  */
13712     __pyx_t_12 = __pyx_v_i;
13713     __pyx_t_13 = __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(-0.5, 0), __Pyx_c_pow_double((*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_12 * __pyx_v_u.strides[0]) ))), __pyx_t_double_complex_from_parts(2, 0)));
13714     __pyx_t_12 = __pyx_v_i;
13715     __pyx_t_14 = __Pyx_c_prod_double(__pyx_v_sigma2, (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_12 * __pyx_v_v.strides[0]) ))));
13716     if (unlikely(__Pyx_c_is_zero_double(__pyx_t_14))) {
13717       PyErr_SetString(PyExc_ZeroDivisionError, "float division");
13718       __PYX_ERR(0, 1780, __pyx_L1_error)
13719     }
13720     __pyx_t_12 = __pyx_v_i;
13721     __pyx_t_15 = __pyx_v_i;
13722     *((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_llf_obs.data + __pyx_t_15 * __pyx_v_llf_obs.strides[0]) )) = __Pyx_c_diff_double(__Pyx_c_quot_double(__pyx_t_13, __pyx_t_14), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(0.5, 0), __Pyx_c_sum_double(__pyx_v_const, __pyx_f_11statsmodels_3src_4math_zlog(__Pyx_c_prod_double(__pyx_v_sigma2, (*((__pyx_t_double_complex *) ( /* dim=0 */ (__pyx_v_v.data + __pyx_t_12 * __pyx_v_v.strides[0]) ))))))));
13723   }
13724 
13725   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1782
13726  *         llf_obs[i] = -0.5 * u[i]**2 / (sigma2 * v[i]) - 0.5 * (const + zlog(sigma2 * v[i]))
13727  *
13728  *     return np.array(llf_obs, dtype=complex)             # <<<<<<<<<<<<<<
13729  */
13730   __Pyx_XDECREF(__pyx_r);
13731   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1782, __pyx_L1_error)
13732   __Pyx_GOTREF(__pyx_t_2);
13733   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1782, __pyx_L1_error)
13734   __Pyx_GOTREF(__pyx_t_4);
13735   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13736   __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_llf_obs, 1, (PyObject *(*)(char *)) __pyx_memview_get___pyx_t_double_complex, (int (*)(char *, PyObject *)) __pyx_memview_set___pyx_t_double_complex, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1782, __pyx_L1_error)
13737   __Pyx_GOTREF(__pyx_t_2);
13738   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1782, __pyx_L1_error)
13739   __Pyx_GOTREF(__pyx_t_3);
13740   __Pyx_GIVEREF(__pyx_t_2);
13741   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
13742   __pyx_t_2 = 0;
13743   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1782, __pyx_L1_error)
13744   __Pyx_GOTREF(__pyx_t_2);
13745   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, ((PyObject *)(&PyComplex_Type))) < 0) __PYX_ERR(0, 1782, __pyx_L1_error)
13746   __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1782, __pyx_L1_error)
13747   __Pyx_GOTREF(__pyx_t_5);
13748   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13749   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13750   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13751   __pyx_r = __pyx_t_5;
13752   __pyx_t_5 = 0;
13753   goto __pyx_L0;
13754 
13755   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1731
13756  *
13757  *
13758  * cpdef zarma_loglikeobs_fast(cnp.complex128_t [:] endog,             # <<<<<<<<<<<<<<
13759  *                                      cnp.complex128_t [:] ar_params,
13760  *                                      cnp.complex128_t [:] ma_params,
13761  */
13762 
13763   /* function exit code */
13764   __pyx_L1_error:;
13765   __Pyx_XDECREF(__pyx_t_2);
13766   __Pyx_XDECREF(__pyx_t_3);
13767   __Pyx_XDECREF(__pyx_t_4);
13768   __Pyx_XDECREF(__pyx_t_5);
13769   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
13770   __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
13771   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_loglikeobs_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
13772   __pyx_r = 0;
13773   __pyx_L0:;
13774   __PYX_XDEC_MEMVIEW(&__pyx_v_llf_obs, 1);
13775   __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
13776   __PYX_XDEC_MEMVIEW(&__pyx_v_v, 1);
13777   __Pyx_XGIVEREF(__pyx_r);
13778   __Pyx_RefNannyFinishContext();
13779   return __pyx_r;
13780 }
13781 
13782 /* Python wrapper */
13783 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_39zarma_loglikeobs_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13784 static char __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_38zarma_loglikeobs_fast[] = "\n    zarma_loglikeobs_fast(cnp.complex128_t [:] endog, cnp.complex128_t [:] ar_params, cnp.complex128_t [:] ma_params, cnp.complex128_t sigma2)\n\n    Quickly calculate the loglikelihood of each observation for an ARMA process\n\n    Parameters\n    ----------\n    endog : ndarray\n        The observed time-series process.\n    ar_params : ndarray\n        Autoregressive parameters.\n    ma_params : ndarray\n        Moving average parameters.\n    sigma2 : ndarray\n        The ARMA innovation variance.\n\n    Returns\n    -------\n    loglike : ndarray of float\n        Array of loglikelihood values for each observation.\n\n    Notes\n    -----\n    Details related to computing the loglikelihood associated with an ARMA\n    process using the innovations algorithm are given in _[1] section 5.2.\n\n    References\n    ----------\n    .. [1] Brockwell, Peter J., and Richard A. Davis. 2009.\n       Time Series: Theory and Methods. 2nd ed. 1991.\n       New York, NY: Springer.\n    ";
__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_39zarma_loglikeobs_fast(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)13785 static PyObject *__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_39zarma_loglikeobs_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13786   __Pyx_memviewslice __pyx_v_endog = { 0, 0, { 0 }, { 0 }, { 0 } };
13787   __Pyx_memviewslice __pyx_v_ar_params = { 0, 0, { 0 }, { 0 }, { 0 } };
13788   __Pyx_memviewslice __pyx_v_ma_params = { 0, 0, { 0 }, { 0 }, { 0 } };
13789   __pyx_t_double_complex __pyx_v_sigma2;
13790   int __pyx_lineno = 0;
13791   const char *__pyx_filename = NULL;
13792   int __pyx_clineno = 0;
13793   PyObject *__pyx_r = 0;
13794   __Pyx_RefNannyDeclarations
13795   __Pyx_RefNannySetupContext("zarma_loglikeobs_fast (wrapper)", 0);
13796   {
13797     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_endog,&__pyx_n_s_ar_params,&__pyx_n_s_ma_params,&__pyx_n_s_sigma2,0};
13798     PyObject* values[4] = {0,0,0,0};
13799     if (unlikely(__pyx_kwds)) {
13800       Py_ssize_t kw_args;
13801       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13802       switch (pos_args) {
13803         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13804         CYTHON_FALLTHROUGH;
13805         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13806         CYTHON_FALLTHROUGH;
13807         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13808         CYTHON_FALLTHROUGH;
13809         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13810         CYTHON_FALLTHROUGH;
13811         case  0: break;
13812         default: goto __pyx_L5_argtuple_error;
13813       }
13814       kw_args = PyDict_Size(__pyx_kwds);
13815       switch (pos_args) {
13816         case  0:
13817         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endog)) != 0)) kw_args--;
13818         else goto __pyx_L5_argtuple_error;
13819         CYTHON_FALLTHROUGH;
13820         case  1:
13821         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar_params)) != 0)) kw_args--;
13822         else {
13823           __Pyx_RaiseArgtupleInvalid("zarma_loglikeobs_fast", 1, 4, 4, 1); __PYX_ERR(0, 1731, __pyx_L3_error)
13824         }
13825         CYTHON_FALLTHROUGH;
13826         case  2:
13827         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ma_params)) != 0)) kw_args--;
13828         else {
13829           __Pyx_RaiseArgtupleInvalid("zarma_loglikeobs_fast", 1, 4, 4, 2); __PYX_ERR(0, 1731, __pyx_L3_error)
13830         }
13831         CYTHON_FALLTHROUGH;
13832         case  3:
13833         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma2)) != 0)) kw_args--;
13834         else {
13835           __Pyx_RaiseArgtupleInvalid("zarma_loglikeobs_fast", 1, 4, 4, 3); __PYX_ERR(0, 1731, __pyx_L3_error)
13836         }
13837       }
13838       if (unlikely(kw_args > 0)) {
13839         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zarma_loglikeobs_fast") < 0)) __PYX_ERR(0, 1731, __pyx_L3_error)
13840       }
13841     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
13842       goto __pyx_L5_argtuple_error;
13843     } else {
13844       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13845       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13846       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13847       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13848     }
13849     __pyx_v_endog = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_endog.memview)) __PYX_ERR(0, 1731, __pyx_L3_error)
13850     __pyx_v_ar_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ar_params.memview)) __PYX_ERR(0, 1732, __pyx_L3_error)
13851     __pyx_v_ma_params = __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ma_params.memview)) __PYX_ERR(0, 1733, __pyx_L3_error)
13852     __pyx_v_sigma2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1734, __pyx_L3_error)
13853   }
13854   goto __pyx_L4_argument_unpacking_done;
13855   __pyx_L5_argtuple_error:;
13856   __Pyx_RaiseArgtupleInvalid("zarma_loglikeobs_fast", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1731, __pyx_L3_error)
13857   __pyx_L3_error:;
13858   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_loglikeobs_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
13859   __Pyx_RefNannyFinishContext();
13860   return NULL;
13861   __pyx_L4_argument_unpacking_done:;
13862   __pyx_r = __pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_38zarma_loglikeobs_fast(__pyx_self, __pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2);
13863 
13864   /* function exit code */
13865   __Pyx_RefNannyFinishContext();
13866   return __pyx_r;
13867 }
13868 
__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_38zarma_loglikeobs_fast(CYTHON_UNUSED PyObject * __pyx_self,__Pyx_memviewslice __pyx_v_endog,__Pyx_memviewslice __pyx_v_ar_params,__Pyx_memviewslice __pyx_v_ma_params,__pyx_t_double_complex __pyx_v_sigma2)13869 static PyObject *__pyx_pf_11statsmodels_3tsa_11innovations_17_arma_innovations_38zarma_loglikeobs_fast(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_endog, __Pyx_memviewslice __pyx_v_ar_params, __Pyx_memviewslice __pyx_v_ma_params, __pyx_t_double_complex __pyx_v_sigma2) {
13870   PyObject *__pyx_r = NULL;
13871   __Pyx_RefNannyDeclarations
13872   PyObject *__pyx_t_1 = NULL;
13873   int __pyx_lineno = 0;
13874   const char *__pyx_filename = NULL;
13875   int __pyx_clineno = 0;
13876   __Pyx_RefNannySetupContext("zarma_loglikeobs_fast", 0);
13877   __Pyx_XDECREF(__pyx_r);
13878   if (unlikely(!__pyx_v_endog.memview)) { __Pyx_RaiseUnboundLocalError("endog"); __PYX_ERR(0, 1731, __pyx_L1_error) }
13879   if (unlikely(!__pyx_v_ar_params.memview)) { __Pyx_RaiseUnboundLocalError("ar_params"); __PYX_ERR(0, 1731, __pyx_L1_error) }
13880   if (unlikely(!__pyx_v_ma_params.memview)) { __Pyx_RaiseUnboundLocalError("ma_params"); __PYX_ERR(0, 1731, __pyx_L1_error) }
13881   __pyx_t_1 = __pyx_f_11statsmodels_3tsa_11innovations_17_arma_innovations_zarma_loglikeobs_fast(__pyx_v_endog, __pyx_v_ar_params, __pyx_v_ma_params, __pyx_v_sigma2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1731, __pyx_L1_error)
13882   __Pyx_GOTREF(__pyx_t_1);
13883   __pyx_r = __pyx_t_1;
13884   __pyx_t_1 = 0;
13885   goto __pyx_L0;
13886 
13887   /* function exit code */
13888   __pyx_L1_error:;
13889   __Pyx_XDECREF(__pyx_t_1);
13890   __Pyx_AddTraceback("statsmodels.tsa.innovations._arma_innovations.zarma_loglikeobs_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
13891   __pyx_r = NULL;
13892   __pyx_L0:;
13893   __PYX_XDEC_MEMVIEW(&__pyx_v_endog, 1);
13894   __PYX_XDEC_MEMVIEW(&__pyx_v_ar_params, 1);
13895   __PYX_XDEC_MEMVIEW(&__pyx_v_ma_params, 1);
13896   __Pyx_XGIVEREF(__pyx_r);
13897   __Pyx_RefNannyFinishContext();
13898   return __pyx_r;
13899 }
13900 
13901 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":735
13902  * ctypedef npy_cdouble     complex_t
13903  *
13904  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
13905  *     return PyArray_MultiIterNew(1, <void*>a)
13906  *
13907  */
13908 
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)13909 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
13910   PyObject *__pyx_r = NULL;
13911   __Pyx_RefNannyDeclarations
13912   PyObject *__pyx_t_1 = NULL;
13913   int __pyx_lineno = 0;
13914   const char *__pyx_filename = NULL;
13915   int __pyx_clineno = 0;
13916   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
13917 
13918   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":736
13919  *
13920  * cdef inline object PyArray_MultiIterNew1(a):
13921  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
13922  *
13923  * cdef inline object PyArray_MultiIterNew2(a, b):
13924  */
13925   __Pyx_XDECREF(__pyx_r);
13926   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
13927   __Pyx_GOTREF(__pyx_t_1);
13928   __pyx_r = __pyx_t_1;
13929   __pyx_t_1 = 0;
13930   goto __pyx_L0;
13931 
13932   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":735
13933  * ctypedef npy_cdouble     complex_t
13934  *
13935  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
13936  *     return PyArray_MultiIterNew(1, <void*>a)
13937  *
13938  */
13939 
13940   /* function exit code */
13941   __pyx_L1_error:;
13942   __Pyx_XDECREF(__pyx_t_1);
13943   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
13944   __pyx_r = 0;
13945   __pyx_L0:;
13946   __Pyx_XGIVEREF(__pyx_r);
13947   __Pyx_RefNannyFinishContext();
13948   return __pyx_r;
13949 }
13950 
13951 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":738
13952  *     return PyArray_MultiIterNew(1, <void*>a)
13953  *
13954  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
13955  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
13956  *
13957  */
13958 
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)13959 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
13960   PyObject *__pyx_r = NULL;
13961   __Pyx_RefNannyDeclarations
13962   PyObject *__pyx_t_1 = NULL;
13963   int __pyx_lineno = 0;
13964   const char *__pyx_filename = NULL;
13965   int __pyx_clineno = 0;
13966   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
13967 
13968   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":739
13969  *
13970  * cdef inline object PyArray_MultiIterNew2(a, b):
13971  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
13972  *
13973  * cdef inline object PyArray_MultiIterNew3(a, b, c):
13974  */
13975   __Pyx_XDECREF(__pyx_r);
13976   __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)
13977   __Pyx_GOTREF(__pyx_t_1);
13978   __pyx_r = __pyx_t_1;
13979   __pyx_t_1 = 0;
13980   goto __pyx_L0;
13981 
13982   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":738
13983  *     return PyArray_MultiIterNew(1, <void*>a)
13984  *
13985  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
13986  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
13987  *
13988  */
13989 
13990   /* function exit code */
13991   __pyx_L1_error:;
13992   __Pyx_XDECREF(__pyx_t_1);
13993   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
13994   __pyx_r = 0;
13995   __pyx_L0:;
13996   __Pyx_XGIVEREF(__pyx_r);
13997   __Pyx_RefNannyFinishContext();
13998   return __pyx_r;
13999 }
14000 
14001 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":741
14002  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
14003  *
14004  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
14005  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
14006  *
14007  */
14008 
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)14009 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
14010   PyObject *__pyx_r = NULL;
14011   __Pyx_RefNannyDeclarations
14012   PyObject *__pyx_t_1 = NULL;
14013   int __pyx_lineno = 0;
14014   const char *__pyx_filename = NULL;
14015   int __pyx_clineno = 0;
14016   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
14017 
14018   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":742
14019  *
14020  * cdef inline object PyArray_MultiIterNew3(a, b, c):
14021  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
14022  *
14023  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
14024  */
14025   __Pyx_XDECREF(__pyx_r);
14026   __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)
14027   __Pyx_GOTREF(__pyx_t_1);
14028   __pyx_r = __pyx_t_1;
14029   __pyx_t_1 = 0;
14030   goto __pyx_L0;
14031 
14032   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":741
14033  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
14034  *
14035  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
14036  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
14037  *
14038  */
14039 
14040   /* function exit code */
14041   __pyx_L1_error:;
14042   __Pyx_XDECREF(__pyx_t_1);
14043   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
14044   __pyx_r = 0;
14045   __pyx_L0:;
14046   __Pyx_XGIVEREF(__pyx_r);
14047   __Pyx_RefNannyFinishContext();
14048   return __pyx_r;
14049 }
14050 
14051 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":744
14052  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
14053  *
14054  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
14055  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
14056  *
14057  */
14058 
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)14059 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) {
14060   PyObject *__pyx_r = NULL;
14061   __Pyx_RefNannyDeclarations
14062   PyObject *__pyx_t_1 = NULL;
14063   int __pyx_lineno = 0;
14064   const char *__pyx_filename = NULL;
14065   int __pyx_clineno = 0;
14066   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
14067 
14068   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":745
14069  *
14070  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
14071  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
14072  *
14073  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
14074  */
14075   __Pyx_XDECREF(__pyx_r);
14076   __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)
14077   __Pyx_GOTREF(__pyx_t_1);
14078   __pyx_r = __pyx_t_1;
14079   __pyx_t_1 = 0;
14080   goto __pyx_L0;
14081 
14082   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":744
14083  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
14084  *
14085  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
14086  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
14087  *
14088  */
14089 
14090   /* function exit code */
14091   __pyx_L1_error:;
14092   __Pyx_XDECREF(__pyx_t_1);
14093   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
14094   __pyx_r = 0;
14095   __pyx_L0:;
14096   __Pyx_XGIVEREF(__pyx_r);
14097   __Pyx_RefNannyFinishContext();
14098   return __pyx_r;
14099 }
14100 
14101 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":747
14102  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
14103  *
14104  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
14105  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
14106  *
14107  */
14108 
__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)14109 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) {
14110   PyObject *__pyx_r = NULL;
14111   __Pyx_RefNannyDeclarations
14112   PyObject *__pyx_t_1 = NULL;
14113   int __pyx_lineno = 0;
14114   const char *__pyx_filename = NULL;
14115   int __pyx_clineno = 0;
14116   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
14117 
14118   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":748
14119  *
14120  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
14121  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
14122  *
14123  * cdef inline tuple PyDataType_SHAPE(dtype d):
14124  */
14125   __Pyx_XDECREF(__pyx_r);
14126   __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)
14127   __Pyx_GOTREF(__pyx_t_1);
14128   __pyx_r = __pyx_t_1;
14129   __pyx_t_1 = 0;
14130   goto __pyx_L0;
14131 
14132   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":747
14133  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
14134  *
14135  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
14136  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
14137  *
14138  */
14139 
14140   /* function exit code */
14141   __pyx_L1_error:;
14142   __Pyx_XDECREF(__pyx_t_1);
14143   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
14144   __pyx_r = 0;
14145   __pyx_L0:;
14146   __Pyx_XGIVEREF(__pyx_r);
14147   __Pyx_RefNannyFinishContext();
14148   return __pyx_r;
14149 }
14150 
14151 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":750
14152  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
14153  *
14154  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
14155  *     if PyDataType_HASSUBARRAY(d):
14156  *         return <tuple>d.subarray.shape
14157  */
14158 
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)14159 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
14160   PyObject *__pyx_r = NULL;
14161   __Pyx_RefNannyDeclarations
14162   int __pyx_t_1;
14163   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
14164 
14165   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":751
14166  *
14167  * cdef inline tuple PyDataType_SHAPE(dtype d):
14168  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
14169  *         return <tuple>d.subarray.shape
14170  *     else:
14171  */
14172   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
14173   if (__pyx_t_1) {
14174 
14175     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":752
14176  * cdef inline tuple PyDataType_SHAPE(dtype d):
14177  *     if PyDataType_HASSUBARRAY(d):
14178  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
14179  *     else:
14180  *         return ()
14181  */
14182     __Pyx_XDECREF(__pyx_r);
14183     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
14184     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
14185     goto __pyx_L0;
14186 
14187     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":751
14188  *
14189  * cdef inline tuple PyDataType_SHAPE(dtype d):
14190  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
14191  *         return <tuple>d.subarray.shape
14192  *     else:
14193  */
14194   }
14195 
14196   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":754
14197  *         return <tuple>d.subarray.shape
14198  *     else:
14199  *         return ()             # <<<<<<<<<<<<<<
14200  *
14201  *
14202  */
14203   /*else*/ {
14204     __Pyx_XDECREF(__pyx_r);
14205     __Pyx_INCREF(__pyx_empty_tuple);
14206     __pyx_r = __pyx_empty_tuple;
14207     goto __pyx_L0;
14208   }
14209 
14210   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":750
14211  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
14212  *
14213  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
14214  *     if PyDataType_HASSUBARRAY(d):
14215  *         return <tuple>d.subarray.shape
14216  */
14217 
14218   /* function exit code */
14219   __pyx_L0:;
14220   __Pyx_XGIVEREF(__pyx_r);
14221   __Pyx_RefNannyFinishContext();
14222   return __pyx_r;
14223 }
14224 
14225 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":929
14226  *     int _import_umath() except -1
14227  *
14228  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
14229  *     Py_INCREF(base) # important to do this before stealing the reference below!
14230  *     PyArray_SetBaseObject(arr, base)
14231  */
14232 
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)14233 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
14234   __Pyx_RefNannyDeclarations
14235   __Pyx_RefNannySetupContext("set_array_base", 0);
14236 
14237   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":930
14238  *
14239  * cdef inline void set_array_base(ndarray arr, object base):
14240  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
14241  *     PyArray_SetBaseObject(arr, base)
14242  *
14243  */
14244   Py_INCREF(__pyx_v_base);
14245 
14246   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":931
14247  * cdef inline void set_array_base(ndarray arr, object base):
14248  *     Py_INCREF(base) # important to do this before stealing the reference below!
14249  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
14250  *
14251  * cdef inline object get_array_base(ndarray arr):
14252  */
14253   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
14254 
14255   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":929
14256  *     int _import_umath() except -1
14257  *
14258  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
14259  *     Py_INCREF(base) # important to do this before stealing the reference below!
14260  *     PyArray_SetBaseObject(arr, base)
14261  */
14262 
14263   /* function exit code */
14264   __Pyx_RefNannyFinishContext();
14265 }
14266 
14267 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":933
14268  *     PyArray_SetBaseObject(arr, base)
14269  *
14270  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
14271  *     base = PyArray_BASE(arr)
14272  *     if base is NULL:
14273  */
14274 
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)14275 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
14276   PyObject *__pyx_v_base;
14277   PyObject *__pyx_r = NULL;
14278   __Pyx_RefNannyDeclarations
14279   int __pyx_t_1;
14280   __Pyx_RefNannySetupContext("get_array_base", 0);
14281 
14282   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":934
14283  *
14284  * cdef inline object get_array_base(ndarray arr):
14285  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
14286  *     if base is NULL:
14287  *         return None
14288  */
14289   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
14290 
14291   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":935
14292  * cdef inline object get_array_base(ndarray arr):
14293  *     base = PyArray_BASE(arr)
14294  *     if base is NULL:             # <<<<<<<<<<<<<<
14295  *         return None
14296  *     return <object>base
14297  */
14298   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
14299   if (__pyx_t_1) {
14300 
14301     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":936
14302  *     base = PyArray_BASE(arr)
14303  *     if base is NULL:
14304  *         return None             # <<<<<<<<<<<<<<
14305  *     return <object>base
14306  *
14307  */
14308     __Pyx_XDECREF(__pyx_r);
14309     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14310     goto __pyx_L0;
14311 
14312     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":935
14313  * cdef inline object get_array_base(ndarray arr):
14314  *     base = PyArray_BASE(arr)
14315  *     if base is NULL:             # <<<<<<<<<<<<<<
14316  *         return None
14317  *     return <object>base
14318  */
14319   }
14320 
14321   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":937
14322  *     if base is NULL:
14323  *         return None
14324  *     return <object>base             # <<<<<<<<<<<<<<
14325  *
14326  * # Versions of the import_* functions which are more suitable for
14327  */
14328   __Pyx_XDECREF(__pyx_r);
14329   __Pyx_INCREF(((PyObject *)__pyx_v_base));
14330   __pyx_r = ((PyObject *)__pyx_v_base);
14331   goto __pyx_L0;
14332 
14333   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":933
14334  *     PyArray_SetBaseObject(arr, base)
14335  *
14336  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
14337  *     base = PyArray_BASE(arr)
14338  *     if base is NULL:
14339  */
14340 
14341   /* function exit code */
14342   __pyx_L0:;
14343   __Pyx_XGIVEREF(__pyx_r);
14344   __Pyx_RefNannyFinishContext();
14345   return __pyx_r;
14346 }
14347 
14348 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":941
14349  * # Versions of the import_* functions which are more suitable for
14350  * # Cython code.
14351  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
14352  *     try:
14353  *         __pyx_import_array()
14354  */
14355 
__pyx_f_5numpy_import_array(void)14356 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
14357   int __pyx_r;
14358   __Pyx_RefNannyDeclarations
14359   PyObject *__pyx_t_1 = NULL;
14360   PyObject *__pyx_t_2 = NULL;
14361   PyObject *__pyx_t_3 = NULL;
14362   int __pyx_t_4;
14363   PyObject *__pyx_t_5 = NULL;
14364   PyObject *__pyx_t_6 = NULL;
14365   PyObject *__pyx_t_7 = NULL;
14366   PyObject *__pyx_t_8 = NULL;
14367   int __pyx_lineno = 0;
14368   const char *__pyx_filename = NULL;
14369   int __pyx_clineno = 0;
14370   __Pyx_RefNannySetupContext("import_array", 0);
14371 
14372   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":942
14373  * # Cython code.
14374  * cdef inline int import_array() except -1:
14375  *     try:             # <<<<<<<<<<<<<<
14376  *         __pyx_import_array()
14377  *     except Exception:
14378  */
14379   {
14380     __Pyx_PyThreadState_declare
14381     __Pyx_PyThreadState_assign
14382     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
14383     __Pyx_XGOTREF(__pyx_t_1);
14384     __Pyx_XGOTREF(__pyx_t_2);
14385     __Pyx_XGOTREF(__pyx_t_3);
14386     /*try:*/ {
14387 
14388       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":943
14389  * cdef inline int import_array() except -1:
14390  *     try:
14391  *         __pyx_import_array()             # <<<<<<<<<<<<<<
14392  *     except Exception:
14393  *         raise ImportError("numpy.core.multiarray failed to import")
14394  */
14395       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
14396 
14397       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":942
14398  * # Cython code.
14399  * cdef inline int import_array() except -1:
14400  *     try:             # <<<<<<<<<<<<<<
14401  *         __pyx_import_array()
14402  *     except Exception:
14403  */
14404     }
14405     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
14406     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14407     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14408     goto __pyx_L8_try_end;
14409     __pyx_L3_error:;
14410 
14411     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":944
14412  *     try:
14413  *         __pyx_import_array()
14414  *     except Exception:             # <<<<<<<<<<<<<<
14415  *         raise ImportError("numpy.core.multiarray failed to import")
14416  *
14417  */
14418     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
14419     if (__pyx_t_4) {
14420       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
14421       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error)
14422       __Pyx_GOTREF(__pyx_t_5);
14423       __Pyx_GOTREF(__pyx_t_6);
14424       __Pyx_GOTREF(__pyx_t_7);
14425 
14426       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":945
14427  *         __pyx_import_array()
14428  *     except Exception:
14429  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
14430  *
14431  * cdef inline int import_umath() except -1:
14432  */
14433       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 945, __pyx_L5_except_error)
14434       __Pyx_GOTREF(__pyx_t_8);
14435       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
14436       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14437       __PYX_ERR(1, 945, __pyx_L5_except_error)
14438     }
14439     goto __pyx_L5_except_error;
14440     __pyx_L5_except_error:;
14441 
14442     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":942
14443  * # Cython code.
14444  * cdef inline int import_array() except -1:
14445  *     try:             # <<<<<<<<<<<<<<
14446  *         __pyx_import_array()
14447  *     except Exception:
14448  */
14449     __Pyx_XGIVEREF(__pyx_t_1);
14450     __Pyx_XGIVEREF(__pyx_t_2);
14451     __Pyx_XGIVEREF(__pyx_t_3);
14452     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
14453     goto __pyx_L1_error;
14454     __pyx_L8_try_end:;
14455   }
14456 
14457   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":941
14458  * # Versions of the import_* functions which are more suitable for
14459  * # Cython code.
14460  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
14461  *     try:
14462  *         __pyx_import_array()
14463  */
14464 
14465   /* function exit code */
14466   __pyx_r = 0;
14467   goto __pyx_L0;
14468   __pyx_L1_error:;
14469   __Pyx_XDECREF(__pyx_t_5);
14470   __Pyx_XDECREF(__pyx_t_6);
14471   __Pyx_XDECREF(__pyx_t_7);
14472   __Pyx_XDECREF(__pyx_t_8);
14473   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
14474   __pyx_r = -1;
14475   __pyx_L0:;
14476   __Pyx_RefNannyFinishContext();
14477   return __pyx_r;
14478 }
14479 
14480 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":947
14481  *         raise ImportError("numpy.core.multiarray failed to import")
14482  *
14483  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
14484  *     try:
14485  *         _import_umath()
14486  */
14487 
__pyx_f_5numpy_import_umath(void)14488 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
14489   int __pyx_r;
14490   __Pyx_RefNannyDeclarations
14491   PyObject *__pyx_t_1 = NULL;
14492   PyObject *__pyx_t_2 = NULL;
14493   PyObject *__pyx_t_3 = NULL;
14494   int __pyx_t_4;
14495   PyObject *__pyx_t_5 = NULL;
14496   PyObject *__pyx_t_6 = NULL;
14497   PyObject *__pyx_t_7 = NULL;
14498   PyObject *__pyx_t_8 = NULL;
14499   int __pyx_lineno = 0;
14500   const char *__pyx_filename = NULL;
14501   int __pyx_clineno = 0;
14502   __Pyx_RefNannySetupContext("import_umath", 0);
14503 
14504   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":948
14505  *
14506  * cdef inline int import_umath() except -1:
14507  *     try:             # <<<<<<<<<<<<<<
14508  *         _import_umath()
14509  *     except Exception:
14510  */
14511   {
14512     __Pyx_PyThreadState_declare
14513     __Pyx_PyThreadState_assign
14514     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
14515     __Pyx_XGOTREF(__pyx_t_1);
14516     __Pyx_XGOTREF(__pyx_t_2);
14517     __Pyx_XGOTREF(__pyx_t_3);
14518     /*try:*/ {
14519 
14520       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":949
14521  * cdef inline int import_umath() except -1:
14522  *     try:
14523  *         _import_umath()             # <<<<<<<<<<<<<<
14524  *     except Exception:
14525  *         raise ImportError("numpy.core.umath failed to import")
14526  */
14527       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
14528 
14529       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":948
14530  *
14531  * cdef inline int import_umath() except -1:
14532  *     try:             # <<<<<<<<<<<<<<
14533  *         _import_umath()
14534  *     except Exception:
14535  */
14536     }
14537     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
14538     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14539     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14540     goto __pyx_L8_try_end;
14541     __pyx_L3_error:;
14542 
14543     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":950
14544  *     try:
14545  *         _import_umath()
14546  *     except Exception:             # <<<<<<<<<<<<<<
14547  *         raise ImportError("numpy.core.umath failed to import")
14548  *
14549  */
14550     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
14551     if (__pyx_t_4) {
14552       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
14553       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error)
14554       __Pyx_GOTREF(__pyx_t_5);
14555       __Pyx_GOTREF(__pyx_t_6);
14556       __Pyx_GOTREF(__pyx_t_7);
14557 
14558       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":951
14559  *         _import_umath()
14560  *     except Exception:
14561  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
14562  *
14563  * cdef inline int import_ufunc() except -1:
14564  */
14565       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 951, __pyx_L5_except_error)
14566       __Pyx_GOTREF(__pyx_t_8);
14567       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
14568       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14569       __PYX_ERR(1, 951, __pyx_L5_except_error)
14570     }
14571     goto __pyx_L5_except_error;
14572     __pyx_L5_except_error:;
14573 
14574     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":948
14575  *
14576  * cdef inline int import_umath() except -1:
14577  *     try:             # <<<<<<<<<<<<<<
14578  *         _import_umath()
14579  *     except Exception:
14580  */
14581     __Pyx_XGIVEREF(__pyx_t_1);
14582     __Pyx_XGIVEREF(__pyx_t_2);
14583     __Pyx_XGIVEREF(__pyx_t_3);
14584     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
14585     goto __pyx_L1_error;
14586     __pyx_L8_try_end:;
14587   }
14588 
14589   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":947
14590  *         raise ImportError("numpy.core.multiarray failed to import")
14591  *
14592  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
14593  *     try:
14594  *         _import_umath()
14595  */
14596 
14597   /* function exit code */
14598   __pyx_r = 0;
14599   goto __pyx_L0;
14600   __pyx_L1_error:;
14601   __Pyx_XDECREF(__pyx_t_5);
14602   __Pyx_XDECREF(__pyx_t_6);
14603   __Pyx_XDECREF(__pyx_t_7);
14604   __Pyx_XDECREF(__pyx_t_8);
14605   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
14606   __pyx_r = -1;
14607   __pyx_L0:;
14608   __Pyx_RefNannyFinishContext();
14609   return __pyx_r;
14610 }
14611 
14612 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":953
14613  *         raise ImportError("numpy.core.umath failed to import")
14614  *
14615  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
14616  *     try:
14617  *         _import_umath()
14618  */
14619 
__pyx_f_5numpy_import_ufunc(void)14620 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
14621   int __pyx_r;
14622   __Pyx_RefNannyDeclarations
14623   PyObject *__pyx_t_1 = NULL;
14624   PyObject *__pyx_t_2 = NULL;
14625   PyObject *__pyx_t_3 = NULL;
14626   int __pyx_t_4;
14627   PyObject *__pyx_t_5 = NULL;
14628   PyObject *__pyx_t_6 = NULL;
14629   PyObject *__pyx_t_7 = NULL;
14630   PyObject *__pyx_t_8 = NULL;
14631   int __pyx_lineno = 0;
14632   const char *__pyx_filename = NULL;
14633   int __pyx_clineno = 0;
14634   __Pyx_RefNannySetupContext("import_ufunc", 0);
14635 
14636   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":954
14637  *
14638  * cdef inline int import_ufunc() except -1:
14639  *     try:             # <<<<<<<<<<<<<<
14640  *         _import_umath()
14641  *     except Exception:
14642  */
14643   {
14644     __Pyx_PyThreadState_declare
14645     __Pyx_PyThreadState_assign
14646     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
14647     __Pyx_XGOTREF(__pyx_t_1);
14648     __Pyx_XGOTREF(__pyx_t_2);
14649     __Pyx_XGOTREF(__pyx_t_3);
14650     /*try:*/ {
14651 
14652       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":955
14653  * cdef inline int import_ufunc() except -1:
14654  *     try:
14655  *         _import_umath()             # <<<<<<<<<<<<<<
14656  *     except Exception:
14657  *         raise ImportError("numpy.core.umath failed to import")
14658  */
14659       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
14660 
14661       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":954
14662  *
14663  * cdef inline int import_ufunc() except -1:
14664  *     try:             # <<<<<<<<<<<<<<
14665  *         _import_umath()
14666  *     except Exception:
14667  */
14668     }
14669     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
14670     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14671     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14672     goto __pyx_L8_try_end;
14673     __pyx_L3_error:;
14674 
14675     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":956
14676  *     try:
14677  *         _import_umath()
14678  *     except Exception:             # <<<<<<<<<<<<<<
14679  *         raise ImportError("numpy.core.umath failed to import")
14680  *
14681  */
14682     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
14683     if (__pyx_t_4) {
14684       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
14685       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error)
14686       __Pyx_GOTREF(__pyx_t_5);
14687       __Pyx_GOTREF(__pyx_t_6);
14688       __Pyx_GOTREF(__pyx_t_7);
14689 
14690       /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":957
14691  *         _import_umath()
14692  *     except Exception:
14693  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
14694  *
14695  * cdef extern from *:
14696  */
14697       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 957, __pyx_L5_except_error)
14698       __Pyx_GOTREF(__pyx_t_8);
14699       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
14700       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14701       __PYX_ERR(1, 957, __pyx_L5_except_error)
14702     }
14703     goto __pyx_L5_except_error;
14704     __pyx_L5_except_error:;
14705 
14706     /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":954
14707  *
14708  * cdef inline int import_ufunc() except -1:
14709  *     try:             # <<<<<<<<<<<<<<
14710  *         _import_umath()
14711  *     except Exception:
14712  */
14713     __Pyx_XGIVEREF(__pyx_t_1);
14714     __Pyx_XGIVEREF(__pyx_t_2);
14715     __Pyx_XGIVEREF(__pyx_t_3);
14716     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
14717     goto __pyx_L1_error;
14718     __pyx_L8_try_end:;
14719   }
14720 
14721   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":953
14722  *         raise ImportError("numpy.core.umath failed to import")
14723  *
14724  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
14725  *     try:
14726  *         _import_umath()
14727  */
14728 
14729   /* function exit code */
14730   __pyx_r = 0;
14731   goto __pyx_L0;
14732   __pyx_L1_error:;
14733   __Pyx_XDECREF(__pyx_t_5);
14734   __Pyx_XDECREF(__pyx_t_6);
14735   __Pyx_XDECREF(__pyx_t_7);
14736   __Pyx_XDECREF(__pyx_t_8);
14737   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
14738   __pyx_r = -1;
14739   __pyx_L0:;
14740   __Pyx_RefNannyFinishContext();
14741   return __pyx_r;
14742 }
14743 
14744 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":967
14745  *
14746  *
14747  * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
14748  *     """
14749  *     Cython equivalent of `isinstance(obj, np.timedelta64)`
14750  */
14751 
__pyx_f_5numpy_is_timedelta64_object(PyObject * __pyx_v_obj)14752 static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
14753   int __pyx_r;
14754   __Pyx_RefNannyDeclarations
14755   __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
14756 
14757   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":979
14758  *     bool
14759  *     """
14760  *     return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)             # <<<<<<<<<<<<<<
14761  *
14762  *
14763  */
14764   __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
14765   goto __pyx_L0;
14766 
14767   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":967
14768  *
14769  *
14770  * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
14771  *     """
14772  *     Cython equivalent of `isinstance(obj, np.timedelta64)`
14773  */
14774 
14775   /* function exit code */
14776   __pyx_L0:;
14777   __Pyx_RefNannyFinishContext();
14778   return __pyx_r;
14779 }
14780 
14781 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":982
14782  *
14783  *
14784  * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
14785  *     """
14786  *     Cython equivalent of `isinstance(obj, np.datetime64)`
14787  */
14788 
__pyx_f_5numpy_is_datetime64_object(PyObject * __pyx_v_obj)14789 static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
14790   int __pyx_r;
14791   __Pyx_RefNannyDeclarations
14792   __Pyx_RefNannySetupContext("is_datetime64_object", 0);
14793 
14794   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":994
14795  *     bool
14796  *     """
14797  *     return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)             # <<<<<<<<<<<<<<
14798  *
14799  *
14800  */
14801   __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
14802   goto __pyx_L0;
14803 
14804   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":982
14805  *
14806  *
14807  * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
14808  *     """
14809  *     Cython equivalent of `isinstance(obj, np.datetime64)`
14810  */
14811 
14812   /* function exit code */
14813   __pyx_L0:;
14814   __Pyx_RefNannyFinishContext();
14815   return __pyx_r;
14816 }
14817 
14818 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":997
14819  *
14820  *
14821  * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
14822  *     """
14823  *     returns the int64 value underlying scalar numpy datetime64 object
14824  */
14825 
__pyx_f_5numpy_get_datetime64_value(PyObject * __pyx_v_obj)14826 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
14827   npy_datetime __pyx_r;
14828 
14829   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1004
14830  *     also needed.  That can be found using `get_datetime64_unit`.
14831  *     """
14832  *     return (<PyDatetimeScalarObject*>obj).obval             # <<<<<<<<<<<<<<
14833  *
14834  *
14835  */
14836   __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
14837   goto __pyx_L0;
14838 
14839   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":997
14840  *
14841  *
14842  * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
14843  *     """
14844  *     returns the int64 value underlying scalar numpy datetime64 object
14845  */
14846 
14847   /* function exit code */
14848   __pyx_L0:;
14849   return __pyx_r;
14850 }
14851 
14852 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1007
14853  *
14854  *
14855  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
14856  *     """
14857  *     returns the int64 value underlying scalar numpy timedelta64 object
14858  */
14859 
__pyx_f_5numpy_get_timedelta64_value(PyObject * __pyx_v_obj)14860 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
14861   npy_timedelta __pyx_r;
14862 
14863   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1011
14864  *     returns the int64 value underlying scalar numpy timedelta64 object
14865  *     """
14866  *     return (<PyTimedeltaScalarObject*>obj).obval             # <<<<<<<<<<<<<<
14867  *
14868  *
14869  */
14870   __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
14871   goto __pyx_L0;
14872 
14873   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1007
14874  *
14875  *
14876  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
14877  *     """
14878  *     returns the int64 value underlying scalar numpy timedelta64 object
14879  */
14880 
14881   /* function exit code */
14882   __pyx_L0:;
14883   return __pyx_r;
14884 }
14885 
14886 /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1014
14887  *
14888  *
14889  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
14890  *     """
14891  *     returns the unit part of the dtype for a numpy datetime64 object.
14892  */
14893 
__pyx_f_5numpy_get_datetime64_unit(PyObject * __pyx_v_obj)14894 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
14895   NPY_DATETIMEUNIT __pyx_r;
14896 
14897   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1018
14898  *     returns the unit part of the dtype for a numpy datetime64 object.
14899  *     """
14900  *     return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base             # <<<<<<<<<<<<<<
14901  */
14902   __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
14903   goto __pyx_L0;
14904 
14905   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":1014
14906  *
14907  *
14908  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
14909  *     """
14910  *     returns the unit part of the dtype for a numpy datetime64 object.
14911  */
14912 
14913   /* function exit code */
14914   __pyx_L0:;
14915   return __pyx_r;
14916 }
14917 
14918 /* "statsmodels/src/math.pxd":12
14919  *     np.npy_cdouble npy_cexp(np.npy_cdouble z) nogil
14920  *
14921  * cdef inline np.float64_t zabs(np.complex128_t z) nogil:             # <<<<<<<<<<<<<<
14922  *     return npy_cabs((<np.npy_cdouble *> &z)[0])
14923  *
14924  */
14925 
__pyx_f_11statsmodels_3src_4math_zabs(__pyx_t_double_complex __pyx_v_z)14926 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_11statsmodels_3src_4math_zabs(__pyx_t_double_complex __pyx_v_z) {
14927   __pyx_t_5numpy_float64_t __pyx_r;
14928 
14929   /* "statsmodels/src/math.pxd":13
14930  *
14931  * cdef inline np.float64_t zabs(np.complex128_t z) nogil:
14932  *     return npy_cabs((<np.npy_cdouble *> &z)[0])             # <<<<<<<<<<<<<<
14933  *
14934  * cdef inline np.complex128_t zlog(np.complex128_t z) nogil:
14935  */
14936   __pyx_r = npy_cabs((((npy_cdouble *)(&__pyx_v_z))[0]));
14937   goto __pyx_L0;
14938 
14939   /* "statsmodels/src/math.pxd":12
14940  *     np.npy_cdouble npy_cexp(np.npy_cdouble z) nogil
14941  *
14942  * cdef inline np.float64_t zabs(np.complex128_t z) nogil:             # <<<<<<<<<<<<<<
14943  *     return npy_cabs((<np.npy_cdouble *> &z)[0])
14944  *
14945  */
14946 
14947   /* function exit code */
14948   __pyx_L0:;
14949   return __pyx_r;
14950 }
14951 
14952 /* "statsmodels/src/math.pxd":15
14953  *     return npy_cabs((<np.npy_cdouble *> &z)[0])
14954  *
14955  * cdef inline np.complex128_t zlog(np.complex128_t z) nogil:             # <<<<<<<<<<<<<<
14956  *     cdef np.npy_cdouble x
14957  *     x = npy_clog((<np.npy_cdouble*> &z)[0])
14958  */
14959 
__pyx_f_11statsmodels_3src_4math_zlog(__pyx_t_double_complex __pyx_v_z)14960 static CYTHON_INLINE __pyx_t_double_complex __pyx_f_11statsmodels_3src_4math_zlog(__pyx_t_double_complex __pyx_v_z) {
14961   npy_cdouble __pyx_v_x;
14962   __pyx_t_double_complex __pyx_r;
14963 
14964   /* "statsmodels/src/math.pxd":17
14965  * cdef inline np.complex128_t zlog(np.complex128_t z) nogil:
14966  *     cdef np.npy_cdouble x
14967  *     x = npy_clog((<np.npy_cdouble*> &z)[0])             # <<<<<<<<<<<<<<
14968  *     return (<np.complex128_t *> &x)[0]
14969  *
14970  */
14971   __pyx_v_x = npy_clog((((npy_cdouble *)(&__pyx_v_z))[0]));
14972 
14973   /* "statsmodels/src/math.pxd":18
14974  *     cdef np.npy_cdouble x
14975  *     x = npy_clog((<np.npy_cdouble*> &z)[0])
14976  *     return (<np.complex128_t *> &x)[0]             # <<<<<<<<<<<<<<
14977  *
14978  * cdef inline np.complex128_t zexp(np.complex128_t z) nogil:
14979  */
14980   __pyx_r = (((__pyx_t_double_complex *)(&__pyx_v_x))[0]);
14981   goto __pyx_L0;
14982 
14983   /* "statsmodels/src/math.pxd":15
14984  *     return npy_cabs((<np.npy_cdouble *> &z)[0])
14985  *
14986  * cdef inline np.complex128_t zlog(np.complex128_t z) nogil:             # <<<<<<<<<<<<<<
14987  *     cdef np.npy_cdouble x
14988  *     x = npy_clog((<np.npy_cdouble*> &z)[0])
14989  */
14990 
14991   /* function exit code */
14992   __pyx_L0:;
14993   return __pyx_r;
14994 }
14995 
14996 /* "statsmodels/src/math.pxd":20
14997  *     return (<np.complex128_t *> &x)[0]
14998  *
14999  * cdef inline np.complex128_t zexp(np.complex128_t z) nogil:             # <<<<<<<<<<<<<<
15000  *     cdef np.npy_cdouble x
15001  *     x = npy_cexp((<np.npy_cdouble*> &z)[0])
15002  */
15003 
__pyx_f_11statsmodels_3src_4math_zexp(__pyx_t_double_complex __pyx_v_z)15004 static CYTHON_INLINE __pyx_t_double_complex __pyx_f_11statsmodels_3src_4math_zexp(__pyx_t_double_complex __pyx_v_z) {
15005   npy_cdouble __pyx_v_x;
15006   __pyx_t_double_complex __pyx_r;
15007 
15008   /* "statsmodels/src/math.pxd":22
15009  * cdef inline np.complex128_t zexp(np.complex128_t z) nogil:
15010  *     cdef np.npy_cdouble x
15011  *     x = npy_cexp((<np.npy_cdouble*> &z)[0])             # <<<<<<<<<<<<<<
15012  *     return (<np.complex128_t *> &x)[0]
15013  */
15014   __pyx_v_x = npy_cexp((((npy_cdouble *)(&__pyx_v_z))[0]));
15015 
15016   /* "statsmodels/src/math.pxd":23
15017  *     cdef np.npy_cdouble x
15018  *     x = npy_cexp((<np.npy_cdouble*> &z)[0])
15019  *     return (<np.complex128_t *> &x)[0]             # <<<<<<<<<<<<<<
15020  */
15021   __pyx_r = (((__pyx_t_double_complex *)(&__pyx_v_x))[0]);
15022   goto __pyx_L0;
15023 
15024   /* "statsmodels/src/math.pxd":20
15025  *     return (<np.complex128_t *> &x)[0]
15026  *
15027  * cdef inline np.complex128_t zexp(np.complex128_t z) nogil:             # <<<<<<<<<<<<<<
15028  *     cdef np.npy_cdouble x
15029  *     x = npy_cexp((<np.npy_cdouble*> &z)[0])
15030  */
15031 
15032   /* function exit code */
15033   __pyx_L0:;
15034   return __pyx_r;
15035 }
15036 
15037 /* "View.MemoryView":122
15038  *         cdef bint dtype_is_object
15039  *
15040  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
15041  *                   mode="c", bint allocate_buffer=True):
15042  *
15043  */
15044 
15045 /* Python wrapper */
15046 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)15047 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15048   PyObject *__pyx_v_shape = 0;
15049   Py_ssize_t __pyx_v_itemsize;
15050   PyObject *__pyx_v_format = 0;
15051   PyObject *__pyx_v_mode = 0;
15052   int __pyx_v_allocate_buffer;
15053   int __pyx_lineno = 0;
15054   const char *__pyx_filename = NULL;
15055   int __pyx_clineno = 0;
15056   int __pyx_r;
15057   __Pyx_RefNannyDeclarations
15058   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
15059   {
15060     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};
15061     PyObject* values[5] = {0,0,0,0,0};
15062     values[3] = ((PyObject *)__pyx_n_s_c);
15063     if (unlikely(__pyx_kwds)) {
15064       Py_ssize_t kw_args;
15065       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15066       switch (pos_args) {
15067         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15068         CYTHON_FALLTHROUGH;
15069         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15070         CYTHON_FALLTHROUGH;
15071         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15072         CYTHON_FALLTHROUGH;
15073         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15074         CYTHON_FALLTHROUGH;
15075         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15076         CYTHON_FALLTHROUGH;
15077         case  0: break;
15078         default: goto __pyx_L5_argtuple_error;
15079       }
15080       kw_args = PyDict_Size(__pyx_kwds);
15081       switch (pos_args) {
15082         case  0:
15083         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
15084         else goto __pyx_L5_argtuple_error;
15085         CYTHON_FALLTHROUGH;
15086         case  1:
15087         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
15088         else {
15089           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
15090         }
15091         CYTHON_FALLTHROUGH;
15092         case  2:
15093         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
15094         else {
15095           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
15096         }
15097         CYTHON_FALLTHROUGH;
15098         case  3:
15099         if (kw_args > 0) {
15100           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
15101           if (value) { values[3] = value; kw_args--; }
15102         }
15103         CYTHON_FALLTHROUGH;
15104         case  4:
15105         if (kw_args > 0) {
15106           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
15107           if (value) { values[4] = value; kw_args--; }
15108         }
15109       }
15110       if (unlikely(kw_args > 0)) {
15111         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error)
15112       }
15113     } else {
15114       switch (PyTuple_GET_SIZE(__pyx_args)) {
15115         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15116         CYTHON_FALLTHROUGH;
15117         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15118         CYTHON_FALLTHROUGH;
15119         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15120         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15121         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15122         break;
15123         default: goto __pyx_L5_argtuple_error;
15124       }
15125     }
15126     __pyx_v_shape = ((PyObject*)values[0]);
15127     __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)
15128     __pyx_v_format = values[2];
15129     __pyx_v_mode = values[3];
15130     if (values[4]) {
15131       __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)
15132     } else {
15133 
15134       /* "View.MemoryView":123
15135  *
15136  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
15137  *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
15138  *
15139  *         cdef int idx
15140  */
15141       __pyx_v_allocate_buffer = ((int)1);
15142     }
15143   }
15144   goto __pyx_L4_argument_unpacking_done;
15145   __pyx_L5_argtuple_error:;
15146   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error)
15147   __pyx_L3_error:;
15148   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15149   __Pyx_RefNannyFinishContext();
15150   return -1;
15151   __pyx_L4_argument_unpacking_done:;
15152   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error)
15153   if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
15154     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error)
15155   }
15156   __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);
15157 
15158   /* "View.MemoryView":122
15159  *         cdef bint dtype_is_object
15160  *
15161  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
15162  *                   mode="c", bint allocate_buffer=True):
15163  *
15164  */
15165 
15166   /* function exit code */
15167   goto __pyx_L0;
15168   __pyx_L1_error:;
15169   __pyx_r = -1;
15170   __pyx_L0:;
15171   __Pyx_RefNannyFinishContext();
15172   return __pyx_r;
15173 }
15174 
__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)15175 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) {
15176   int __pyx_v_idx;
15177   Py_ssize_t __pyx_v_i;
15178   Py_ssize_t __pyx_v_dim;
15179   PyObject **__pyx_v_p;
15180   char __pyx_v_order;
15181   int __pyx_r;
15182   __Pyx_RefNannyDeclarations
15183   Py_ssize_t __pyx_t_1;
15184   int __pyx_t_2;
15185   PyObject *__pyx_t_3 = NULL;
15186   int __pyx_t_4;
15187   PyObject *__pyx_t_5 = NULL;
15188   PyObject *__pyx_t_6 = NULL;
15189   char *__pyx_t_7;
15190   int __pyx_t_8;
15191   Py_ssize_t __pyx_t_9;
15192   PyObject *__pyx_t_10 = NULL;
15193   Py_ssize_t __pyx_t_11;
15194   int __pyx_lineno = 0;
15195   const char *__pyx_filename = NULL;
15196   int __pyx_clineno = 0;
15197   __Pyx_RefNannySetupContext("__cinit__", 0);
15198   __Pyx_INCREF(__pyx_v_format);
15199 
15200   /* "View.MemoryView":129
15201  *         cdef PyObject **p
15202  *
15203  *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
15204  *         self.itemsize = itemsize
15205  *
15206  */
15207   if (unlikely(__pyx_v_shape == Py_None)) {
15208     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
15209     __PYX_ERR(2, 129, __pyx_L1_error)
15210   }
15211   __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)
15212   __pyx_v_self->ndim = ((int)__pyx_t_1);
15213 
15214   /* "View.MemoryView":130
15215  *
15216  *         self.ndim = <int> len(shape)
15217  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
15218  *
15219  *         if not self.ndim:
15220  */
15221   __pyx_v_self->itemsize = __pyx_v_itemsize;
15222 
15223   /* "View.MemoryView":132
15224  *         self.itemsize = itemsize
15225  *
15226  *         if not self.ndim:             # <<<<<<<<<<<<<<
15227  *             raise ValueError("Empty shape tuple for cython.array")
15228  *
15229  */
15230   __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
15231   if (unlikely(__pyx_t_2)) {
15232 
15233     /* "View.MemoryView":133
15234  *
15235  *         if not self.ndim:
15236  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
15237  *
15238  *         if itemsize <= 0:
15239  */
15240     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error)
15241     __Pyx_GOTREF(__pyx_t_3);
15242     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15243     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15244     __PYX_ERR(2, 133, __pyx_L1_error)
15245 
15246     /* "View.MemoryView":132
15247  *         self.itemsize = itemsize
15248  *
15249  *         if not self.ndim:             # <<<<<<<<<<<<<<
15250  *             raise ValueError("Empty shape tuple for cython.array")
15251  *
15252  */
15253   }
15254 
15255   /* "View.MemoryView":135
15256  *             raise ValueError("Empty shape tuple for cython.array")
15257  *
15258  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
15259  *             raise ValueError("itemsize <= 0 for cython.array")
15260  *
15261  */
15262   __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
15263   if (unlikely(__pyx_t_2)) {
15264 
15265     /* "View.MemoryView":136
15266  *
15267  *         if itemsize <= 0:
15268  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
15269  *
15270  *         if not isinstance(format, bytes):
15271  */
15272     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error)
15273     __Pyx_GOTREF(__pyx_t_3);
15274     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15275     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15276     __PYX_ERR(2, 136, __pyx_L1_error)
15277 
15278     /* "View.MemoryView":135
15279  *             raise ValueError("Empty shape tuple for cython.array")
15280  *
15281  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
15282  *             raise ValueError("itemsize <= 0 for cython.array")
15283  *
15284  */
15285   }
15286 
15287   /* "View.MemoryView":138
15288  *             raise ValueError("itemsize <= 0 for cython.array")
15289  *
15290  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
15291  *             format = format.encode('ASCII')
15292  *         self._format = format  # keep a reference to the byte string
15293  */
15294   __pyx_t_2 = PyBytes_Check(__pyx_v_format);
15295   __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
15296   if (__pyx_t_4) {
15297 
15298     /* "View.MemoryView":139
15299  *
15300  *         if not isinstance(format, bytes):
15301  *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
15302  *         self._format = format  # keep a reference to the byte string
15303  *         self.format = self._format
15304  */
15305     __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)
15306     __Pyx_GOTREF(__pyx_t_5);
15307     __pyx_t_6 = NULL;
15308     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
15309       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
15310       if (likely(__pyx_t_6)) {
15311         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
15312         __Pyx_INCREF(__pyx_t_6);
15313         __Pyx_INCREF(function);
15314         __Pyx_DECREF_SET(__pyx_t_5, function);
15315       }
15316     }
15317     __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);
15318     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
15319     if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error)
15320     __Pyx_GOTREF(__pyx_t_3);
15321     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15322     __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
15323     __pyx_t_3 = 0;
15324 
15325     /* "View.MemoryView":138
15326  *             raise ValueError("itemsize <= 0 for cython.array")
15327  *
15328  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
15329  *             format = format.encode('ASCII')
15330  *         self._format = format  # keep a reference to the byte string
15331  */
15332   }
15333 
15334   /* "View.MemoryView":140
15335  *         if not isinstance(format, bytes):
15336  *             format = format.encode('ASCII')
15337  *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
15338  *         self.format = self._format
15339  *
15340  */
15341   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)
15342   __pyx_t_3 = __pyx_v_format;
15343   __Pyx_INCREF(__pyx_t_3);
15344   __Pyx_GIVEREF(__pyx_t_3);
15345   __Pyx_GOTREF(__pyx_v_self->_format);
15346   __Pyx_DECREF(__pyx_v_self->_format);
15347   __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
15348   __pyx_t_3 = 0;
15349 
15350   /* "View.MemoryView":141
15351  *             format = format.encode('ASCII')
15352  *         self._format = format  # keep a reference to the byte string
15353  *         self.format = self._format             # <<<<<<<<<<<<<<
15354  *
15355  *
15356  */
15357   if (unlikely(__pyx_v_self->_format == Py_None)) {
15358     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
15359     __PYX_ERR(2, 141, __pyx_L1_error)
15360   }
15361   __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error)
15362   __pyx_v_self->format = __pyx_t_7;
15363 
15364   /* "View.MemoryView":144
15365  *
15366  *
15367  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
15368  *         self._strides = self._shape + self.ndim
15369  *
15370  */
15371   __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
15372 
15373   /* "View.MemoryView":145
15374  *
15375  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
15376  *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
15377  *
15378  *         if not self._shape:
15379  */
15380   __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
15381 
15382   /* "View.MemoryView":147
15383  *         self._strides = self._shape + self.ndim
15384  *
15385  *         if not self._shape:             # <<<<<<<<<<<<<<
15386  *             raise MemoryError("unable to allocate shape and strides.")
15387  *
15388  */
15389   __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
15390   if (unlikely(__pyx_t_4)) {
15391 
15392     /* "View.MemoryView":148
15393  *
15394  *         if not self._shape:
15395  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
15396  *
15397  *
15398  */
15399     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
15400     __Pyx_GOTREF(__pyx_t_3);
15401     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15402     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15403     __PYX_ERR(2, 148, __pyx_L1_error)
15404 
15405     /* "View.MemoryView":147
15406  *         self._strides = self._shape + self.ndim
15407  *
15408  *         if not self._shape:             # <<<<<<<<<<<<<<
15409  *             raise MemoryError("unable to allocate shape and strides.")
15410  *
15411  */
15412   }
15413 
15414   /* "View.MemoryView":151
15415  *
15416  *
15417  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
15418  *             if dim <= 0:
15419  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
15420  */
15421   __pyx_t_8 = 0;
15422   __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
15423   for (;;) {
15424     if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
15425     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15426     __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)
15427     #else
15428     __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)
15429     __Pyx_GOTREF(__pyx_t_5);
15430     #endif
15431     __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)
15432     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15433     __pyx_v_dim = __pyx_t_9;
15434     __pyx_v_idx = __pyx_t_8;
15435     __pyx_t_8 = (__pyx_t_8 + 1);
15436 
15437     /* "View.MemoryView":152
15438  *
15439  *         for idx, dim in enumerate(shape):
15440  *             if dim <= 0:             # <<<<<<<<<<<<<<
15441  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
15442  *             self._shape[idx] = dim
15443  */
15444     __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
15445     if (unlikely(__pyx_t_4)) {
15446 
15447       /* "View.MemoryView":153
15448  *         for idx, dim in enumerate(shape):
15449  *             if dim <= 0:
15450  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
15451  *             self._shape[idx] = dim
15452  *
15453  */
15454       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error)
15455       __Pyx_GOTREF(__pyx_t_5);
15456       __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
15457       __Pyx_GOTREF(__pyx_t_6);
15458       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
15459       __Pyx_GOTREF(__pyx_t_10);
15460       __Pyx_GIVEREF(__pyx_t_5);
15461       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
15462       __Pyx_GIVEREF(__pyx_t_6);
15463       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
15464       __pyx_t_5 = 0;
15465       __pyx_t_6 = 0;
15466       __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)
15467       __Pyx_GOTREF(__pyx_t_6);
15468       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
15469       __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
15470       __Pyx_GOTREF(__pyx_t_10);
15471       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15472       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
15473       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
15474       __PYX_ERR(2, 153, __pyx_L1_error)
15475 
15476       /* "View.MemoryView":152
15477  *
15478  *         for idx, dim in enumerate(shape):
15479  *             if dim <= 0:             # <<<<<<<<<<<<<<
15480  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
15481  *             self._shape[idx] = dim
15482  */
15483     }
15484 
15485     /* "View.MemoryView":154
15486  *             if dim <= 0:
15487  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
15488  *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
15489  *
15490  *         cdef char order
15491  */
15492     (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
15493 
15494     /* "View.MemoryView":151
15495  *
15496  *
15497  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
15498  *             if dim <= 0:
15499  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
15500  */
15501   }
15502   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15503 
15504   /* "View.MemoryView":157
15505  *
15506  *         cdef char order
15507  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
15508  *             order = b'F'
15509  *             self.mode = u'fortran'
15510  */
15511   __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)
15512   if (__pyx_t_4) {
15513 
15514     /* "View.MemoryView":158
15515  *         cdef char order
15516  *         if mode == 'fortran':
15517  *             order = b'F'             # <<<<<<<<<<<<<<
15518  *             self.mode = u'fortran'
15519  *         elif mode == 'c':
15520  */
15521     __pyx_v_order = 'F';
15522 
15523     /* "View.MemoryView":159
15524  *         if mode == 'fortran':
15525  *             order = b'F'
15526  *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
15527  *         elif mode == 'c':
15528  *             order = b'C'
15529  */
15530     __Pyx_INCREF(__pyx_n_u_fortran);
15531     __Pyx_GIVEREF(__pyx_n_u_fortran);
15532     __Pyx_GOTREF(__pyx_v_self->mode);
15533     __Pyx_DECREF(__pyx_v_self->mode);
15534     __pyx_v_self->mode = __pyx_n_u_fortran;
15535 
15536     /* "View.MemoryView":157
15537  *
15538  *         cdef char order
15539  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
15540  *             order = b'F'
15541  *             self.mode = u'fortran'
15542  */
15543     goto __pyx_L10;
15544   }
15545 
15546   /* "View.MemoryView":160
15547  *             order = b'F'
15548  *             self.mode = u'fortran'
15549  *         elif mode == 'c':             # <<<<<<<<<<<<<<
15550  *             order = b'C'
15551  *             self.mode = u'c'
15552  */
15553   __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)
15554   if (likely(__pyx_t_4)) {
15555 
15556     /* "View.MemoryView":161
15557  *             self.mode = u'fortran'
15558  *         elif mode == 'c':
15559  *             order = b'C'             # <<<<<<<<<<<<<<
15560  *             self.mode = u'c'
15561  *         else:
15562  */
15563     __pyx_v_order = 'C';
15564 
15565     /* "View.MemoryView":162
15566  *         elif mode == 'c':
15567  *             order = b'C'
15568  *             self.mode = u'c'             # <<<<<<<<<<<<<<
15569  *         else:
15570  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
15571  */
15572     __Pyx_INCREF(__pyx_n_u_c);
15573     __Pyx_GIVEREF(__pyx_n_u_c);
15574     __Pyx_GOTREF(__pyx_v_self->mode);
15575     __Pyx_DECREF(__pyx_v_self->mode);
15576     __pyx_v_self->mode = __pyx_n_u_c;
15577 
15578     /* "View.MemoryView":160
15579  *             order = b'F'
15580  *             self.mode = u'fortran'
15581  *         elif mode == 'c':             # <<<<<<<<<<<<<<
15582  *             order = b'C'
15583  *             self.mode = u'c'
15584  */
15585     goto __pyx_L10;
15586   }
15587 
15588   /* "View.MemoryView":164
15589  *             self.mode = u'c'
15590  *         else:
15591  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
15592  *
15593  *         self.len = fill_contig_strides_array(self._shape, self._strides,
15594  */
15595   /*else*/ {
15596     __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)
15597     __Pyx_GOTREF(__pyx_t_3);
15598     __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error)
15599     __Pyx_GOTREF(__pyx_t_10);
15600     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15601     __Pyx_Raise(__pyx_t_10, 0, 0, 0);
15602     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
15603     __PYX_ERR(2, 164, __pyx_L1_error)
15604   }
15605   __pyx_L10:;
15606 
15607   /* "View.MemoryView":166
15608  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
15609  *
15610  *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
15611  *                                              itemsize, self.ndim, order)
15612  *
15613  */
15614   __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);
15615 
15616   /* "View.MemoryView":169
15617  *                                              itemsize, self.ndim, order)
15618  *
15619  *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
15620  *         self.dtype_is_object = format == b'O'
15621  *         if allocate_buffer:
15622  */
15623   __pyx_v_self->free_data = __pyx_v_allocate_buffer;
15624 
15625   /* "View.MemoryView":170
15626  *
15627  *         self.free_data = allocate_buffer
15628  *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
15629  *         if allocate_buffer:
15630  *
15631  */
15632   __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)
15633   __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)
15634   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
15635   __pyx_v_self->dtype_is_object = __pyx_t_4;
15636 
15637   /* "View.MemoryView":171
15638  *         self.free_data = allocate_buffer
15639  *         self.dtype_is_object = format == b'O'
15640  *         if allocate_buffer:             # <<<<<<<<<<<<<<
15641  *
15642  *
15643  */
15644   __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
15645   if (__pyx_t_4) {
15646 
15647     /* "View.MemoryView":174
15648  *
15649  *
15650  *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
15651  *             if not self.data:
15652  *                 raise MemoryError("unable to allocate array data.")
15653  */
15654     __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
15655 
15656     /* "View.MemoryView":175
15657  *
15658  *             self.data = <char *>malloc(self.len)
15659  *             if not self.data:             # <<<<<<<<<<<<<<
15660  *                 raise MemoryError("unable to allocate array data.")
15661  *
15662  */
15663     __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
15664     if (unlikely(__pyx_t_4)) {
15665 
15666       /* "View.MemoryView":176
15667  *             self.data = <char *>malloc(self.len)
15668  *             if not self.data:
15669  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
15670  *
15671  *             if self.dtype_is_object:
15672  */
15673       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error)
15674       __Pyx_GOTREF(__pyx_t_10);
15675       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
15676       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
15677       __PYX_ERR(2, 176, __pyx_L1_error)
15678 
15679       /* "View.MemoryView":175
15680  *
15681  *             self.data = <char *>malloc(self.len)
15682  *             if not self.data:             # <<<<<<<<<<<<<<
15683  *                 raise MemoryError("unable to allocate array data.")
15684  *
15685  */
15686     }
15687 
15688     /* "View.MemoryView":178
15689  *                 raise MemoryError("unable to allocate array data.")
15690  *
15691  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
15692  *                 p = <PyObject **> self.data
15693  *                 for i in range(self.len / itemsize):
15694  */
15695     __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
15696     if (__pyx_t_4) {
15697 
15698       /* "View.MemoryView":179
15699  *
15700  *             if self.dtype_is_object:
15701  *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
15702  *                 for i in range(self.len / itemsize):
15703  *                     p[i] = Py_None
15704  */
15705       __pyx_v_p = ((PyObject **)__pyx_v_self->data);
15706 
15707       /* "View.MemoryView":180
15708  *             if self.dtype_is_object:
15709  *                 p = <PyObject **> self.data
15710  *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
15711  *                     p[i] = Py_None
15712  *                     Py_INCREF(Py_None)
15713  */
15714       if (unlikely(__pyx_v_itemsize == 0)) {
15715         PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
15716         __PYX_ERR(2, 180, __pyx_L1_error)
15717       }
15718       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))) {
15719         PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
15720         __PYX_ERR(2, 180, __pyx_L1_error)
15721       }
15722       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
15723       __pyx_t_9 = __pyx_t_1;
15724       for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
15725         __pyx_v_i = __pyx_t_11;
15726 
15727         /* "View.MemoryView":181
15728  *                 p = <PyObject **> self.data
15729  *                 for i in range(self.len / itemsize):
15730  *                     p[i] = Py_None             # <<<<<<<<<<<<<<
15731  *                     Py_INCREF(Py_None)
15732  *
15733  */
15734         (__pyx_v_p[__pyx_v_i]) = Py_None;
15735 
15736         /* "View.MemoryView":182
15737  *                 for i in range(self.len / itemsize):
15738  *                     p[i] = Py_None
15739  *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
15740  *
15741  *     @cname('getbuffer')
15742  */
15743         Py_INCREF(Py_None);
15744       }
15745 
15746       /* "View.MemoryView":178
15747  *                 raise MemoryError("unable to allocate array data.")
15748  *
15749  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
15750  *                 p = <PyObject **> self.data
15751  *                 for i in range(self.len / itemsize):
15752  */
15753     }
15754 
15755     /* "View.MemoryView":171
15756  *         self.free_data = allocate_buffer
15757  *         self.dtype_is_object = format == b'O'
15758  *         if allocate_buffer:             # <<<<<<<<<<<<<<
15759  *
15760  *
15761  */
15762   }
15763 
15764   /* "View.MemoryView":122
15765  *         cdef bint dtype_is_object
15766  *
15767  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
15768  *                   mode="c", bint allocate_buffer=True):
15769  *
15770  */
15771 
15772   /* function exit code */
15773   __pyx_r = 0;
15774   goto __pyx_L0;
15775   __pyx_L1_error:;
15776   __Pyx_XDECREF(__pyx_t_3);
15777   __Pyx_XDECREF(__pyx_t_5);
15778   __Pyx_XDECREF(__pyx_t_6);
15779   __Pyx_XDECREF(__pyx_t_10);
15780   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15781   __pyx_r = -1;
15782   __pyx_L0:;
15783   __Pyx_XDECREF(__pyx_v_format);
15784   __Pyx_RefNannyFinishContext();
15785   return __pyx_r;
15786 }
15787 
15788 /* "View.MemoryView":185
15789  *
15790  *     @cname('getbuffer')
15791  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
15792  *         cdef int bufmode = -1
15793  *         if self.mode == u"c":
15794  */
15795 
15796 /* Python wrapper */
15797 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)15798 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
15799   int __pyx_r;
15800   __Pyx_RefNannyDeclarations
15801   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
15802   __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));
15803 
15804   /* function exit code */
15805   __Pyx_RefNannyFinishContext();
15806   return __pyx_r;
15807 }
15808 
__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)15809 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) {
15810   int __pyx_v_bufmode;
15811   int __pyx_r;
15812   __Pyx_RefNannyDeclarations
15813   int __pyx_t_1;
15814   int __pyx_t_2;
15815   PyObject *__pyx_t_3 = NULL;
15816   char *__pyx_t_4;
15817   Py_ssize_t __pyx_t_5;
15818   int __pyx_t_6;
15819   Py_ssize_t *__pyx_t_7;
15820   int __pyx_lineno = 0;
15821   const char *__pyx_filename = NULL;
15822   int __pyx_clineno = 0;
15823   if (__pyx_v_info == NULL) {
15824     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
15825     return -1;
15826   }
15827   __Pyx_RefNannySetupContext("__getbuffer__", 0);
15828   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
15829   __Pyx_GIVEREF(__pyx_v_info->obj);
15830 
15831   /* "View.MemoryView":186
15832  *     @cname('getbuffer')
15833  *     def __getbuffer__(self, Py_buffer *info, int flags):
15834  *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
15835  *         if self.mode == u"c":
15836  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
15837  */
15838   __pyx_v_bufmode = -1;
15839 
15840   /* "View.MemoryView":187
15841  *     def __getbuffer__(self, Py_buffer *info, int flags):
15842  *         cdef int bufmode = -1
15843  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
15844  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
15845  *         elif self.mode == u"fortran":
15846  */
15847   __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)
15848   __pyx_t_2 = (__pyx_t_1 != 0);
15849   if (__pyx_t_2) {
15850 
15851     /* "View.MemoryView":188
15852  *         cdef int bufmode = -1
15853  *         if self.mode == u"c":
15854  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
15855  *         elif self.mode == u"fortran":
15856  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
15857  */
15858     __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
15859 
15860     /* "View.MemoryView":187
15861  *     def __getbuffer__(self, Py_buffer *info, int flags):
15862  *         cdef int bufmode = -1
15863  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
15864  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
15865  *         elif self.mode == u"fortran":
15866  */
15867     goto __pyx_L3;
15868   }
15869 
15870   /* "View.MemoryView":189
15871  *         if self.mode == u"c":
15872  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
15873  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
15874  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
15875  *         if not (flags & bufmode):
15876  */
15877   __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)
15878   __pyx_t_1 = (__pyx_t_2 != 0);
15879   if (__pyx_t_1) {
15880 
15881     /* "View.MemoryView":190
15882  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
15883  *         elif self.mode == u"fortran":
15884  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
15885  *         if not (flags & bufmode):
15886  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
15887  */
15888     __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
15889 
15890     /* "View.MemoryView":189
15891  *         if self.mode == u"c":
15892  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
15893  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
15894  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
15895  *         if not (flags & bufmode):
15896  */
15897   }
15898   __pyx_L3:;
15899 
15900   /* "View.MemoryView":191
15901  *         elif self.mode == u"fortran":
15902  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
15903  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
15904  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
15905  *         info.buf = self.data
15906  */
15907   __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
15908   if (unlikely(__pyx_t_1)) {
15909 
15910     /* "View.MemoryView":192
15911  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
15912  *         if not (flags & bufmode):
15913  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
15914  *         info.buf = self.data
15915  *         info.len = self.len
15916  */
15917     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error)
15918     __Pyx_GOTREF(__pyx_t_3);
15919     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15920     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15921     __PYX_ERR(2, 192, __pyx_L1_error)
15922 
15923     /* "View.MemoryView":191
15924  *         elif self.mode == u"fortran":
15925  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
15926  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
15927  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
15928  *         info.buf = self.data
15929  */
15930   }
15931 
15932   /* "View.MemoryView":193
15933  *         if not (flags & bufmode):
15934  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
15935  *         info.buf = self.data             # <<<<<<<<<<<<<<
15936  *         info.len = self.len
15937  *         info.ndim = self.ndim
15938  */
15939   __pyx_t_4 = __pyx_v_self->data;
15940   __pyx_v_info->buf = __pyx_t_4;
15941 
15942   /* "View.MemoryView":194
15943  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
15944  *         info.buf = self.data
15945  *         info.len = self.len             # <<<<<<<<<<<<<<
15946  *         info.ndim = self.ndim
15947  *         info.shape = self._shape
15948  */
15949   __pyx_t_5 = __pyx_v_self->len;
15950   __pyx_v_info->len = __pyx_t_5;
15951 
15952   /* "View.MemoryView":195
15953  *         info.buf = self.data
15954  *         info.len = self.len
15955  *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
15956  *         info.shape = self._shape
15957  *         info.strides = self._strides
15958  */
15959   __pyx_t_6 = __pyx_v_self->ndim;
15960   __pyx_v_info->ndim = __pyx_t_6;
15961 
15962   /* "View.MemoryView":196
15963  *         info.len = self.len
15964  *         info.ndim = self.ndim
15965  *         info.shape = self._shape             # <<<<<<<<<<<<<<
15966  *         info.strides = self._strides
15967  *         info.suboffsets = NULL
15968  */
15969   __pyx_t_7 = __pyx_v_self->_shape;
15970   __pyx_v_info->shape = __pyx_t_7;
15971 
15972   /* "View.MemoryView":197
15973  *         info.ndim = self.ndim
15974  *         info.shape = self._shape
15975  *         info.strides = self._strides             # <<<<<<<<<<<<<<
15976  *         info.suboffsets = NULL
15977  *         info.itemsize = self.itemsize
15978  */
15979   __pyx_t_7 = __pyx_v_self->_strides;
15980   __pyx_v_info->strides = __pyx_t_7;
15981 
15982   /* "View.MemoryView":198
15983  *         info.shape = self._shape
15984  *         info.strides = self._strides
15985  *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
15986  *         info.itemsize = self.itemsize
15987  *         info.readonly = 0
15988  */
15989   __pyx_v_info->suboffsets = NULL;
15990 
15991   /* "View.MemoryView":199
15992  *         info.strides = self._strides
15993  *         info.suboffsets = NULL
15994  *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
15995  *         info.readonly = 0
15996  *
15997  */
15998   __pyx_t_5 = __pyx_v_self->itemsize;
15999   __pyx_v_info->itemsize = __pyx_t_5;
16000 
16001   /* "View.MemoryView":200
16002  *         info.suboffsets = NULL
16003  *         info.itemsize = self.itemsize
16004  *         info.readonly = 0             # <<<<<<<<<<<<<<
16005  *
16006  *         if flags & PyBUF_FORMAT:
16007  */
16008   __pyx_v_info->readonly = 0;
16009 
16010   /* "View.MemoryView":202
16011  *         info.readonly = 0
16012  *
16013  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
16014  *             info.format = self.format
16015  *         else:
16016  */
16017   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
16018   if (__pyx_t_1) {
16019 
16020     /* "View.MemoryView":203
16021  *
16022  *         if flags & PyBUF_FORMAT:
16023  *             info.format = self.format             # <<<<<<<<<<<<<<
16024  *         else:
16025  *             info.format = NULL
16026  */
16027     __pyx_t_4 = __pyx_v_self->format;
16028     __pyx_v_info->format = __pyx_t_4;
16029 
16030     /* "View.MemoryView":202
16031  *         info.readonly = 0
16032  *
16033  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
16034  *             info.format = self.format
16035  *         else:
16036  */
16037     goto __pyx_L5;
16038   }
16039 
16040   /* "View.MemoryView":205
16041  *             info.format = self.format
16042  *         else:
16043  *             info.format = NULL             # <<<<<<<<<<<<<<
16044  *
16045  *         info.obj = self
16046  */
16047   /*else*/ {
16048     __pyx_v_info->format = NULL;
16049   }
16050   __pyx_L5:;
16051 
16052   /* "View.MemoryView":207
16053  *             info.format = NULL
16054  *
16055  *         info.obj = self             # <<<<<<<<<<<<<<
16056  *
16057  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
16058  */
16059   __Pyx_INCREF(((PyObject *)__pyx_v_self));
16060   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
16061   __Pyx_GOTREF(__pyx_v_info->obj);
16062   __Pyx_DECREF(__pyx_v_info->obj);
16063   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
16064 
16065   /* "View.MemoryView":185
16066  *
16067  *     @cname('getbuffer')
16068  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
16069  *         cdef int bufmode = -1
16070  *         if self.mode == u"c":
16071  */
16072 
16073   /* function exit code */
16074   __pyx_r = 0;
16075   goto __pyx_L0;
16076   __pyx_L1_error:;
16077   __Pyx_XDECREF(__pyx_t_3);
16078   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16079   __pyx_r = -1;
16080   if (__pyx_v_info->obj != NULL) {
16081     __Pyx_GOTREF(__pyx_v_info->obj);
16082     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
16083   }
16084   goto __pyx_L2;
16085   __pyx_L0:;
16086   if (__pyx_v_info->obj == Py_None) {
16087     __Pyx_GOTREF(__pyx_v_info->obj);
16088     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
16089   }
16090   __pyx_L2:;
16091   __Pyx_RefNannyFinishContext();
16092   return __pyx_r;
16093 }
16094 
16095 /* "View.MemoryView":211
16096  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
16097  *
16098  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
16099  *         if self.callback_free_data != NULL:
16100  *             self.callback_free_data(self.data)
16101  */
16102 
16103 /* Python wrapper */
16104 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___dealloc__(PyObject * __pyx_v_self)16105 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
16106   __Pyx_RefNannyDeclarations
16107   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
16108   __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
16109 
16110   /* function exit code */
16111   __Pyx_RefNannyFinishContext();
16112 }
16113 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj * __pyx_v_self)16114 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
16115   __Pyx_RefNannyDeclarations
16116   int __pyx_t_1;
16117   __Pyx_RefNannySetupContext("__dealloc__", 0);
16118 
16119   /* "View.MemoryView":212
16120  *
16121  *     def __dealloc__(array self):
16122  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
16123  *             self.callback_free_data(self.data)
16124  *         elif self.free_data:
16125  */
16126   __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
16127   if (__pyx_t_1) {
16128 
16129     /* "View.MemoryView":213
16130  *     def __dealloc__(array self):
16131  *         if self.callback_free_data != NULL:
16132  *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
16133  *         elif self.free_data:
16134  *             if self.dtype_is_object:
16135  */
16136     __pyx_v_self->callback_free_data(__pyx_v_self->data);
16137 
16138     /* "View.MemoryView":212
16139  *
16140  *     def __dealloc__(array self):
16141  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
16142  *             self.callback_free_data(self.data)
16143  *         elif self.free_data:
16144  */
16145     goto __pyx_L3;
16146   }
16147 
16148   /* "View.MemoryView":214
16149  *         if self.callback_free_data != NULL:
16150  *             self.callback_free_data(self.data)
16151  *         elif self.free_data:             # <<<<<<<<<<<<<<
16152  *             if self.dtype_is_object:
16153  *                 refcount_objects_in_slice(self.data, self._shape,
16154  */
16155   __pyx_t_1 = (__pyx_v_self->free_data != 0);
16156   if (__pyx_t_1) {
16157 
16158     /* "View.MemoryView":215
16159  *             self.callback_free_data(self.data)
16160  *         elif self.free_data:
16161  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
16162  *                 refcount_objects_in_slice(self.data, self._shape,
16163  *                                           self._strides, self.ndim, False)
16164  */
16165     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
16166     if (__pyx_t_1) {
16167 
16168       /* "View.MemoryView":216
16169  *         elif self.free_data:
16170  *             if self.dtype_is_object:
16171  *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
16172  *                                           self._strides, self.ndim, False)
16173  *             free(self.data)
16174  */
16175       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
16176 
16177       /* "View.MemoryView":215
16178  *             self.callback_free_data(self.data)
16179  *         elif self.free_data:
16180  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
16181  *                 refcount_objects_in_slice(self.data, self._shape,
16182  *                                           self._strides, self.ndim, False)
16183  */
16184     }
16185 
16186     /* "View.MemoryView":218
16187  *                 refcount_objects_in_slice(self.data, self._shape,
16188  *                                           self._strides, self.ndim, False)
16189  *             free(self.data)             # <<<<<<<<<<<<<<
16190  *         PyObject_Free(self._shape)
16191  *
16192  */
16193     free(__pyx_v_self->data);
16194 
16195     /* "View.MemoryView":214
16196  *         if self.callback_free_data != NULL:
16197  *             self.callback_free_data(self.data)
16198  *         elif self.free_data:             # <<<<<<<<<<<<<<
16199  *             if self.dtype_is_object:
16200  *                 refcount_objects_in_slice(self.data, self._shape,
16201  */
16202   }
16203   __pyx_L3:;
16204 
16205   /* "View.MemoryView":219
16206  *                                           self._strides, self.ndim, False)
16207  *             free(self.data)
16208  *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
16209  *
16210  *     @property
16211  */
16212   PyObject_Free(__pyx_v_self->_shape);
16213 
16214   /* "View.MemoryView":211
16215  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
16216  *
16217  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
16218  *         if self.callback_free_data != NULL:
16219  *             self.callback_free_data(self.data)
16220  */
16221 
16222   /* function exit code */
16223   __Pyx_RefNannyFinishContext();
16224 }
16225 
16226 /* "View.MemoryView":222
16227  *
16228  *     @property
16229  *     def memview(self):             # <<<<<<<<<<<<<<
16230  *         return self.get_memview()
16231  *
16232  */
16233 
16234 /* Python wrapper */
16235 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)16236 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
16237   PyObject *__pyx_r = 0;
16238   __Pyx_RefNannyDeclarations
16239   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
16240   __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
16241 
16242   /* function exit code */
16243   __Pyx_RefNannyFinishContext();
16244   return __pyx_r;
16245 }
16246 
__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj * __pyx_v_self)16247 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
16248   PyObject *__pyx_r = NULL;
16249   __Pyx_RefNannyDeclarations
16250   PyObject *__pyx_t_1 = NULL;
16251   int __pyx_lineno = 0;
16252   const char *__pyx_filename = NULL;
16253   int __pyx_clineno = 0;
16254   __Pyx_RefNannySetupContext("__get__", 0);
16255 
16256   /* "View.MemoryView":223
16257  *     @property
16258  *     def memview(self):
16259  *         return self.get_memview()             # <<<<<<<<<<<<<<
16260  *
16261  *     @cname('get_memview')
16262  */
16263   __Pyx_XDECREF(__pyx_r);
16264   __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)
16265   __Pyx_GOTREF(__pyx_t_1);
16266   __pyx_r = __pyx_t_1;
16267   __pyx_t_1 = 0;
16268   goto __pyx_L0;
16269 
16270   /* "View.MemoryView":222
16271  *
16272  *     @property
16273  *     def memview(self):             # <<<<<<<<<<<<<<
16274  *         return self.get_memview()
16275  *
16276  */
16277 
16278   /* function exit code */
16279   __pyx_L1_error:;
16280   __Pyx_XDECREF(__pyx_t_1);
16281   __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16282   __pyx_r = NULL;
16283   __pyx_L0:;
16284   __Pyx_XGIVEREF(__pyx_r);
16285   __Pyx_RefNannyFinishContext();
16286   return __pyx_r;
16287 }
16288 
16289 /* "View.MemoryView":226
16290  *
16291  *     @cname('get_memview')
16292  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
16293  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
16294  *         return  memoryview(self, flags, self.dtype_is_object)
16295  */
16296 
__pyx_array_get_memview(struct __pyx_array_obj * __pyx_v_self)16297 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
16298   int __pyx_v_flags;
16299   PyObject *__pyx_r = NULL;
16300   __Pyx_RefNannyDeclarations
16301   PyObject *__pyx_t_1 = NULL;
16302   PyObject *__pyx_t_2 = NULL;
16303   PyObject *__pyx_t_3 = NULL;
16304   int __pyx_lineno = 0;
16305   const char *__pyx_filename = NULL;
16306   int __pyx_clineno = 0;
16307   __Pyx_RefNannySetupContext("get_memview", 0);
16308 
16309   /* "View.MemoryView":227
16310  *     @cname('get_memview')
16311  *     cdef get_memview(self):
16312  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
16313  *         return  memoryview(self, flags, self.dtype_is_object)
16314  *
16315  */
16316   __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
16317 
16318   /* "View.MemoryView":228
16319  *     cdef get_memview(self):
16320  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
16321  *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
16322  *
16323  *     def __len__(self):
16324  */
16325   __Pyx_XDECREF(__pyx_r);
16326   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error)
16327   __Pyx_GOTREF(__pyx_t_1);
16328   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
16329   __Pyx_GOTREF(__pyx_t_2);
16330   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error)
16331   __Pyx_GOTREF(__pyx_t_3);
16332   __Pyx_INCREF(((PyObject *)__pyx_v_self));
16333   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
16334   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
16335   __Pyx_GIVEREF(__pyx_t_1);
16336   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
16337   __Pyx_GIVEREF(__pyx_t_2);
16338   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
16339   __pyx_t_1 = 0;
16340   __pyx_t_2 = 0;
16341   __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)
16342   __Pyx_GOTREF(__pyx_t_2);
16343   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16344   __pyx_r = __pyx_t_2;
16345   __pyx_t_2 = 0;
16346   goto __pyx_L0;
16347 
16348   /* "View.MemoryView":226
16349  *
16350  *     @cname('get_memview')
16351  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
16352  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
16353  *         return  memoryview(self, flags, self.dtype_is_object)
16354  */
16355 
16356   /* function exit code */
16357   __pyx_L1_error:;
16358   __Pyx_XDECREF(__pyx_t_1);
16359   __Pyx_XDECREF(__pyx_t_2);
16360   __Pyx_XDECREF(__pyx_t_3);
16361   __Pyx_AddTraceback("View.MemoryView.array.get_memview", __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":230
16370  *         return  memoryview(self, flags, self.dtype_is_object)
16371  *
16372  *     def __len__(self):             # <<<<<<<<<<<<<<
16373  *         return self._shape[0]
16374  *
16375  */
16376 
16377 /* Python wrapper */
16378 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___len__(PyObject * __pyx_v_self)16379 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
16380   Py_ssize_t __pyx_r;
16381   __Pyx_RefNannyDeclarations
16382   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
16383   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
16384 
16385   /* function exit code */
16386   __Pyx_RefNannyFinishContext();
16387   return __pyx_r;
16388 }
16389 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj * __pyx_v_self)16390 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
16391   Py_ssize_t __pyx_r;
16392   __Pyx_RefNannyDeclarations
16393   __Pyx_RefNannySetupContext("__len__", 0);
16394 
16395   /* "View.MemoryView":231
16396  *
16397  *     def __len__(self):
16398  *         return self._shape[0]             # <<<<<<<<<<<<<<
16399  *
16400  *     def __getattr__(self, attr):
16401  */
16402   __pyx_r = (__pyx_v_self->_shape[0]);
16403   goto __pyx_L0;
16404 
16405   /* "View.MemoryView":230
16406  *         return  memoryview(self, flags, self.dtype_is_object)
16407  *
16408  *     def __len__(self):             # <<<<<<<<<<<<<<
16409  *         return self._shape[0]
16410  *
16411  */
16412 
16413   /* function exit code */
16414   __pyx_L0:;
16415   __Pyx_RefNannyFinishContext();
16416   return __pyx_r;
16417 }
16418 
16419 /* "View.MemoryView":233
16420  *         return self._shape[0]
16421  *
16422  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
16423  *         return getattr(self.memview, attr)
16424  *
16425  */
16426 
16427 /* Python wrapper */
16428 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)16429 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
16430   PyObject *__pyx_r = 0;
16431   __Pyx_RefNannyDeclarations
16432   __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
16433   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
16434 
16435   /* function exit code */
16436   __Pyx_RefNannyFinishContext();
16437   return __pyx_r;
16438 }
16439 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_attr)16440 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
16441   PyObject *__pyx_r = NULL;
16442   __Pyx_RefNannyDeclarations
16443   PyObject *__pyx_t_1 = NULL;
16444   PyObject *__pyx_t_2 = NULL;
16445   int __pyx_lineno = 0;
16446   const char *__pyx_filename = NULL;
16447   int __pyx_clineno = 0;
16448   __Pyx_RefNannySetupContext("__getattr__", 0);
16449 
16450   /* "View.MemoryView":234
16451  *
16452  *     def __getattr__(self, attr):
16453  *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
16454  *
16455  *     def __getitem__(self, item):
16456  */
16457   __Pyx_XDECREF(__pyx_r);
16458   __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)
16459   __Pyx_GOTREF(__pyx_t_1);
16460   __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error)
16461   __Pyx_GOTREF(__pyx_t_2);
16462   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16463   __pyx_r = __pyx_t_2;
16464   __pyx_t_2 = 0;
16465   goto __pyx_L0;
16466 
16467   /* "View.MemoryView":233
16468  *         return self._shape[0]
16469  *
16470  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
16471  *         return getattr(self.memview, attr)
16472  *
16473  */
16474 
16475   /* function exit code */
16476   __pyx_L1_error:;
16477   __Pyx_XDECREF(__pyx_t_1);
16478   __Pyx_XDECREF(__pyx_t_2);
16479   __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16480   __pyx_r = NULL;
16481   __pyx_L0:;
16482   __Pyx_XGIVEREF(__pyx_r);
16483   __Pyx_RefNannyFinishContext();
16484   return __pyx_r;
16485 }
16486 
16487 /* "View.MemoryView":236
16488  *         return getattr(self.memview, attr)
16489  *
16490  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
16491  *         return self.memview[item]
16492  *
16493  */
16494 
16495 /* Python wrapper */
16496 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)16497 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
16498   PyObject *__pyx_r = 0;
16499   __Pyx_RefNannyDeclarations
16500   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
16501   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
16502 
16503   /* function exit code */
16504   __Pyx_RefNannyFinishContext();
16505   return __pyx_r;
16506 }
16507 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item)16508 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
16509   PyObject *__pyx_r = NULL;
16510   __Pyx_RefNannyDeclarations
16511   PyObject *__pyx_t_1 = NULL;
16512   PyObject *__pyx_t_2 = NULL;
16513   int __pyx_lineno = 0;
16514   const char *__pyx_filename = NULL;
16515   int __pyx_clineno = 0;
16516   __Pyx_RefNannySetupContext("__getitem__", 0);
16517 
16518   /* "View.MemoryView":237
16519  *
16520  *     def __getitem__(self, item):
16521  *         return self.memview[item]             # <<<<<<<<<<<<<<
16522  *
16523  *     def __setitem__(self, item, value):
16524  */
16525   __Pyx_XDECREF(__pyx_r);
16526   __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)
16527   __Pyx_GOTREF(__pyx_t_1);
16528   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error)
16529   __Pyx_GOTREF(__pyx_t_2);
16530   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16531   __pyx_r = __pyx_t_2;
16532   __pyx_t_2 = 0;
16533   goto __pyx_L0;
16534 
16535   /* "View.MemoryView":236
16536  *         return getattr(self.memview, attr)
16537  *
16538  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
16539  *         return self.memview[item]
16540  *
16541  */
16542 
16543   /* function exit code */
16544   __pyx_L1_error:;
16545   __Pyx_XDECREF(__pyx_t_1);
16546   __Pyx_XDECREF(__pyx_t_2);
16547   __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16548   __pyx_r = NULL;
16549   __pyx_L0:;
16550   __Pyx_XGIVEREF(__pyx_r);
16551   __Pyx_RefNannyFinishContext();
16552   return __pyx_r;
16553 }
16554 
16555 /* "View.MemoryView":239
16556  *         return self.memview[item]
16557  *
16558  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
16559  *         self.memview[item] = value
16560  *
16561  */
16562 
16563 /* Python wrapper */
16564 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)16565 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
16566   int __pyx_r;
16567   __Pyx_RefNannyDeclarations
16568   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
16569   __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));
16570 
16571   /* function exit code */
16572   __Pyx_RefNannyFinishContext();
16573   return __pyx_r;
16574 }
16575 
__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)16576 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) {
16577   int __pyx_r;
16578   __Pyx_RefNannyDeclarations
16579   PyObject *__pyx_t_1 = NULL;
16580   int __pyx_lineno = 0;
16581   const char *__pyx_filename = NULL;
16582   int __pyx_clineno = 0;
16583   __Pyx_RefNannySetupContext("__setitem__", 0);
16584 
16585   /* "View.MemoryView":240
16586  *
16587  *     def __setitem__(self, item, value):
16588  *         self.memview[item] = value             # <<<<<<<<<<<<<<
16589  *
16590  *
16591  */
16592   __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)
16593   __Pyx_GOTREF(__pyx_t_1);
16594   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error)
16595   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16596 
16597   /* "View.MemoryView":239
16598  *         return self.memview[item]
16599  *
16600  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
16601  *         self.memview[item] = value
16602  *
16603  */
16604 
16605   /* function exit code */
16606   __pyx_r = 0;
16607   goto __pyx_L0;
16608   __pyx_L1_error:;
16609   __Pyx_XDECREF(__pyx_t_1);
16610   __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16611   __pyx_r = -1;
16612   __pyx_L0:;
16613   __Pyx_RefNannyFinishContext();
16614   return __pyx_r;
16615 }
16616 
16617 /* "(tree fragment)":1
16618  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
16619  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16620  * def __setstate_cython__(self, __pyx_state):
16621  */
16622 
16623 /* Python wrapper */
16624 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)16625 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16626   PyObject *__pyx_r = 0;
16627   __Pyx_RefNannyDeclarations
16628   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
16629   __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
16630 
16631   /* function exit code */
16632   __Pyx_RefNannyFinishContext();
16633   return __pyx_r;
16634 }
16635 
__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self)16636 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
16637   PyObject *__pyx_r = NULL;
16638   __Pyx_RefNannyDeclarations
16639   PyObject *__pyx_t_1 = NULL;
16640   int __pyx_lineno = 0;
16641   const char *__pyx_filename = NULL;
16642   int __pyx_clineno = 0;
16643   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
16644 
16645   /* "(tree fragment)":2
16646  * def __reduce_cython__(self):
16647  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
16648  * def __setstate_cython__(self, __pyx_state):
16649  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16650  */
16651   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
16652   __Pyx_GOTREF(__pyx_t_1);
16653   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16654   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16655   __PYX_ERR(2, 2, __pyx_L1_error)
16656 
16657   /* "(tree fragment)":1
16658  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
16659  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16660  * def __setstate_cython__(self, __pyx_state):
16661  */
16662 
16663   /* function exit code */
16664   __pyx_L1_error:;
16665   __Pyx_XDECREF(__pyx_t_1);
16666   __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16667   __pyx_r = NULL;
16668   __Pyx_XGIVEREF(__pyx_r);
16669   __Pyx_RefNannyFinishContext();
16670   return __pyx_r;
16671 }
16672 
16673 /* "(tree fragment)":3
16674  * def __reduce_cython__(self):
16675  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16676  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
16677  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16678  */
16679 
16680 /* Python wrapper */
16681 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)16682 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
16683   PyObject *__pyx_r = 0;
16684   __Pyx_RefNannyDeclarations
16685   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
16686   __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
16687 
16688   /* function exit code */
16689   __Pyx_RefNannyFinishContext();
16690   return __pyx_r;
16691 }
16692 
__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)16693 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) {
16694   PyObject *__pyx_r = NULL;
16695   __Pyx_RefNannyDeclarations
16696   PyObject *__pyx_t_1 = NULL;
16697   int __pyx_lineno = 0;
16698   const char *__pyx_filename = NULL;
16699   int __pyx_clineno = 0;
16700   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
16701 
16702   /* "(tree fragment)":4
16703  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16704  * def __setstate_cython__(self, __pyx_state):
16705  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
16706  */
16707   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
16708   __Pyx_GOTREF(__pyx_t_1);
16709   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16710   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16711   __PYX_ERR(2, 4, __pyx_L1_error)
16712 
16713   /* "(tree fragment)":3
16714  * def __reduce_cython__(self):
16715  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16716  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
16717  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16718  */
16719 
16720   /* function exit code */
16721   __pyx_L1_error:;
16722   __Pyx_XDECREF(__pyx_t_1);
16723   __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16724   __pyx_r = NULL;
16725   __Pyx_XGIVEREF(__pyx_r);
16726   __Pyx_RefNannyFinishContext();
16727   return __pyx_r;
16728 }
16729 
16730 /* "View.MemoryView":244
16731  *
16732  * @cname("__pyx_array_new")
16733  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
16734  *                           char *mode, char *buf):
16735  *     cdef array result
16736  */
16737 
__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)16738 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) {
16739   struct __pyx_array_obj *__pyx_v_result = 0;
16740   struct __pyx_array_obj *__pyx_r = NULL;
16741   __Pyx_RefNannyDeclarations
16742   int __pyx_t_1;
16743   PyObject *__pyx_t_2 = NULL;
16744   PyObject *__pyx_t_3 = NULL;
16745   PyObject *__pyx_t_4 = NULL;
16746   PyObject *__pyx_t_5 = NULL;
16747   int __pyx_lineno = 0;
16748   const char *__pyx_filename = NULL;
16749   int __pyx_clineno = 0;
16750   __Pyx_RefNannySetupContext("array_cwrapper", 0);
16751 
16752   /* "View.MemoryView":248
16753  *     cdef array result
16754  *
16755  *     if buf == NULL:             # <<<<<<<<<<<<<<
16756  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
16757  *     else:
16758  */
16759   __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
16760   if (__pyx_t_1) {
16761 
16762     /* "View.MemoryView":249
16763  *
16764  *     if buf == NULL:
16765  *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
16766  *     else:
16767  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
16768  */
16769     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
16770     __Pyx_GOTREF(__pyx_t_2);
16771     __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error)
16772     __Pyx_GOTREF(__pyx_t_3);
16773     __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)
16774     __Pyx_GOTREF(__pyx_t_4);
16775     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
16776     __Pyx_GOTREF(__pyx_t_5);
16777     __Pyx_INCREF(__pyx_v_shape);
16778     __Pyx_GIVEREF(__pyx_v_shape);
16779     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
16780     __Pyx_GIVEREF(__pyx_t_2);
16781     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
16782     __Pyx_GIVEREF(__pyx_t_3);
16783     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
16784     __Pyx_GIVEREF(__pyx_t_4);
16785     PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
16786     __pyx_t_2 = 0;
16787     __pyx_t_3 = 0;
16788     __pyx_t_4 = 0;
16789     __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)
16790     __Pyx_GOTREF(__pyx_t_4);
16791     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16792     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
16793     __pyx_t_4 = 0;
16794 
16795     /* "View.MemoryView":248
16796  *     cdef array result
16797  *
16798  *     if buf == NULL:             # <<<<<<<<<<<<<<
16799  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
16800  *     else:
16801  */
16802     goto __pyx_L3;
16803   }
16804 
16805   /* "View.MemoryView":251
16806  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
16807  *     else:
16808  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
16809  *                        allocate_buffer=False)
16810  *         result.data = buf
16811  */
16812   /*else*/ {
16813     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error)
16814     __Pyx_GOTREF(__pyx_t_4);
16815     __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
16816     __Pyx_GOTREF(__pyx_t_5);
16817     __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)
16818     __Pyx_GOTREF(__pyx_t_3);
16819     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error)
16820     __Pyx_GOTREF(__pyx_t_2);
16821     __Pyx_INCREF(__pyx_v_shape);
16822     __Pyx_GIVEREF(__pyx_v_shape);
16823     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
16824     __Pyx_GIVEREF(__pyx_t_4);
16825     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
16826     __Pyx_GIVEREF(__pyx_t_5);
16827     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
16828     __Pyx_GIVEREF(__pyx_t_3);
16829     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
16830     __pyx_t_4 = 0;
16831     __pyx_t_5 = 0;
16832     __pyx_t_3 = 0;
16833 
16834     /* "View.MemoryView":252
16835  *     else:
16836  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
16837  *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
16838  *         result.data = buf
16839  *
16840  */
16841     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
16842     __Pyx_GOTREF(__pyx_t_3);
16843     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error)
16844 
16845     /* "View.MemoryView":251
16846  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
16847  *     else:
16848  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
16849  *                        allocate_buffer=False)
16850  *         result.data = buf
16851  */
16852     __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)
16853     __Pyx_GOTREF(__pyx_t_5);
16854     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16855     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16856     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
16857     __pyx_t_5 = 0;
16858 
16859     /* "View.MemoryView":253
16860  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
16861  *                        allocate_buffer=False)
16862  *         result.data = buf             # <<<<<<<<<<<<<<
16863  *
16864  *     return result
16865  */
16866     __pyx_v_result->data = __pyx_v_buf;
16867   }
16868   __pyx_L3:;
16869 
16870   /* "View.MemoryView":255
16871  *         result.data = buf
16872  *
16873  *     return result             # <<<<<<<<<<<<<<
16874  *
16875  *
16876  */
16877   __Pyx_XDECREF(((PyObject *)__pyx_r));
16878   __Pyx_INCREF(((PyObject *)__pyx_v_result));
16879   __pyx_r = __pyx_v_result;
16880   goto __pyx_L0;
16881 
16882   /* "View.MemoryView":244
16883  *
16884  * @cname("__pyx_array_new")
16885  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
16886  *                           char *mode, char *buf):
16887  *     cdef array result
16888  */
16889 
16890   /* function exit code */
16891   __pyx_L1_error:;
16892   __Pyx_XDECREF(__pyx_t_2);
16893   __Pyx_XDECREF(__pyx_t_3);
16894   __Pyx_XDECREF(__pyx_t_4);
16895   __Pyx_XDECREF(__pyx_t_5);
16896   __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
16897   __pyx_r = 0;
16898   __pyx_L0:;
16899   __Pyx_XDECREF((PyObject *)__pyx_v_result);
16900   __Pyx_XGIVEREF((PyObject *)__pyx_r);
16901   __Pyx_RefNannyFinishContext();
16902   return __pyx_r;
16903 }
16904 
16905 /* "View.MemoryView":281
16906  * cdef class Enum(object):
16907  *     cdef object name
16908  *     def __init__(self, name):             # <<<<<<<<<<<<<<
16909  *         self.name = name
16910  *     def __repr__(self):
16911  */
16912 
16913 /* Python wrapper */
16914 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)16915 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16916   PyObject *__pyx_v_name = 0;
16917   int __pyx_lineno = 0;
16918   const char *__pyx_filename = NULL;
16919   int __pyx_clineno = 0;
16920   int __pyx_r;
16921   __Pyx_RefNannyDeclarations
16922   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
16923   {
16924     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
16925     PyObject* values[1] = {0};
16926     if (unlikely(__pyx_kwds)) {
16927       Py_ssize_t kw_args;
16928       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16929       switch (pos_args) {
16930         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16931         CYTHON_FALLTHROUGH;
16932         case  0: break;
16933         default: goto __pyx_L5_argtuple_error;
16934       }
16935       kw_args = PyDict_Size(__pyx_kwds);
16936       switch (pos_args) {
16937         case  0:
16938         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
16939         else goto __pyx_L5_argtuple_error;
16940       }
16941       if (unlikely(kw_args > 0)) {
16942         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error)
16943       }
16944     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
16945       goto __pyx_L5_argtuple_error;
16946     } else {
16947       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16948     }
16949     __pyx_v_name = values[0];
16950   }
16951   goto __pyx_L4_argument_unpacking_done;
16952   __pyx_L5_argtuple_error:;
16953   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error)
16954   __pyx_L3_error:;
16955   __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16956   __Pyx_RefNannyFinishContext();
16957   return -1;
16958   __pyx_L4_argument_unpacking_done:;
16959   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
16960 
16961   /* function exit code */
16962   __Pyx_RefNannyFinishContext();
16963   return __pyx_r;
16964 }
16965 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v_name)16966 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
16967   int __pyx_r;
16968   __Pyx_RefNannyDeclarations
16969   __Pyx_RefNannySetupContext("__init__", 0);
16970 
16971   /* "View.MemoryView":282
16972  *     cdef object name
16973  *     def __init__(self, name):
16974  *         self.name = name             # <<<<<<<<<<<<<<
16975  *     def __repr__(self):
16976  *         return self.name
16977  */
16978   __Pyx_INCREF(__pyx_v_name);
16979   __Pyx_GIVEREF(__pyx_v_name);
16980   __Pyx_GOTREF(__pyx_v_self->name);
16981   __Pyx_DECREF(__pyx_v_self->name);
16982   __pyx_v_self->name = __pyx_v_name;
16983 
16984   /* "View.MemoryView":281
16985  * cdef class Enum(object):
16986  *     cdef object name
16987  *     def __init__(self, name):             # <<<<<<<<<<<<<<
16988  *         self.name = name
16989  *     def __repr__(self):
16990  */
16991 
16992   /* function exit code */
16993   __pyx_r = 0;
16994   __Pyx_RefNannyFinishContext();
16995   return __pyx_r;
16996 }
16997 
16998 /* "View.MemoryView":283
16999  *     def __init__(self, name):
17000  *         self.name = name
17001  *     def __repr__(self):             # <<<<<<<<<<<<<<
17002  *         return self.name
17003  *
17004  */
17005 
17006 /* Python wrapper */
17007 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_MemviewEnum___repr__(PyObject * __pyx_v_self)17008 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
17009   PyObject *__pyx_r = 0;
17010   __Pyx_RefNannyDeclarations
17011   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
17012   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
17013 
17014   /* function exit code */
17015   __Pyx_RefNannyFinishContext();
17016   return __pyx_r;
17017 }
17018 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj * __pyx_v_self)17019 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
17020   PyObject *__pyx_r = NULL;
17021   __Pyx_RefNannyDeclarations
17022   __Pyx_RefNannySetupContext("__repr__", 0);
17023 
17024   /* "View.MemoryView":284
17025  *         self.name = name
17026  *     def __repr__(self):
17027  *         return self.name             # <<<<<<<<<<<<<<
17028  *
17029  * cdef generic = Enum("<strided and direct or indirect>")
17030  */
17031   __Pyx_XDECREF(__pyx_r);
17032   __Pyx_INCREF(__pyx_v_self->name);
17033   __pyx_r = __pyx_v_self->name;
17034   goto __pyx_L0;
17035 
17036   /* "View.MemoryView":283
17037  *     def __init__(self, name):
17038  *         self.name = name
17039  *     def __repr__(self):             # <<<<<<<<<<<<<<
17040  *         return self.name
17041  *
17042  */
17043 
17044   /* function exit code */
17045   __pyx_L0:;
17046   __Pyx_XGIVEREF(__pyx_r);
17047   __Pyx_RefNannyFinishContext();
17048   return __pyx_r;
17049 }
17050 
17051 /* "(tree fragment)":1
17052  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
17053  *     cdef tuple state
17054  *     cdef object _dict
17055  */
17056 
17057 /* Python wrapper */
17058 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)17059 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
17060   PyObject *__pyx_r = 0;
17061   __Pyx_RefNannyDeclarations
17062   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
17063   __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
17064 
17065   /* function exit code */
17066   __Pyx_RefNannyFinishContext();
17067   return __pyx_r;
17068 }
17069 
__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self)17070 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
17071   PyObject *__pyx_v_state = 0;
17072   PyObject *__pyx_v__dict = 0;
17073   int __pyx_v_use_setstate;
17074   PyObject *__pyx_r = NULL;
17075   __Pyx_RefNannyDeclarations
17076   PyObject *__pyx_t_1 = NULL;
17077   int __pyx_t_2;
17078   int __pyx_t_3;
17079   PyObject *__pyx_t_4 = NULL;
17080   PyObject *__pyx_t_5 = NULL;
17081   int __pyx_lineno = 0;
17082   const char *__pyx_filename = NULL;
17083   int __pyx_clineno = 0;
17084   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
17085 
17086   /* "(tree fragment)":5
17087  *     cdef object _dict
17088  *     cdef bint use_setstate
17089  *     state = (self.name,)             # <<<<<<<<<<<<<<
17090  *     _dict = getattr(self, '__dict__', None)
17091  *     if _dict is not None:
17092  */
17093   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
17094   __Pyx_GOTREF(__pyx_t_1);
17095   __Pyx_INCREF(__pyx_v_self->name);
17096   __Pyx_GIVEREF(__pyx_v_self->name);
17097   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
17098   __pyx_v_state = ((PyObject*)__pyx_t_1);
17099   __pyx_t_1 = 0;
17100 
17101   /* "(tree fragment)":6
17102  *     cdef bint use_setstate
17103  *     state = (self.name,)
17104  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
17105  *     if _dict is not None:
17106  *         state += (_dict,)
17107  */
17108   __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)
17109   __Pyx_GOTREF(__pyx_t_1);
17110   __pyx_v__dict = __pyx_t_1;
17111   __pyx_t_1 = 0;
17112 
17113   /* "(tree fragment)":7
17114  *     state = (self.name,)
17115  *     _dict = getattr(self, '__dict__', None)
17116  *     if _dict is not None:             # <<<<<<<<<<<<<<
17117  *         state += (_dict,)
17118  *         use_setstate = True
17119  */
17120   __pyx_t_2 = (__pyx_v__dict != Py_None);
17121   __pyx_t_3 = (__pyx_t_2 != 0);
17122   if (__pyx_t_3) {
17123 
17124     /* "(tree fragment)":8
17125  *     _dict = getattr(self, '__dict__', None)
17126  *     if _dict is not None:
17127  *         state += (_dict,)             # <<<<<<<<<<<<<<
17128  *         use_setstate = True
17129  *     else:
17130  */
17131     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
17132     __Pyx_GOTREF(__pyx_t_1);
17133     __Pyx_INCREF(__pyx_v__dict);
17134     __Pyx_GIVEREF(__pyx_v__dict);
17135     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
17136     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
17137     __Pyx_GOTREF(__pyx_t_4);
17138     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17139     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
17140     __pyx_t_4 = 0;
17141 
17142     /* "(tree fragment)":9
17143  *     if _dict is not None:
17144  *         state += (_dict,)
17145  *         use_setstate = True             # <<<<<<<<<<<<<<
17146  *     else:
17147  *         use_setstate = self.name is not None
17148  */
17149     __pyx_v_use_setstate = 1;
17150 
17151     /* "(tree fragment)":7
17152  *     state = (self.name,)
17153  *     _dict = getattr(self, '__dict__', None)
17154  *     if _dict is not None:             # <<<<<<<<<<<<<<
17155  *         state += (_dict,)
17156  *         use_setstate = True
17157  */
17158     goto __pyx_L3;
17159   }
17160 
17161   /* "(tree fragment)":11
17162  *         use_setstate = True
17163  *     else:
17164  *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
17165  *     if use_setstate:
17166  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
17167  */
17168   /*else*/ {
17169     __pyx_t_3 = (__pyx_v_self->name != Py_None);
17170     __pyx_v_use_setstate = __pyx_t_3;
17171   }
17172   __pyx_L3:;
17173 
17174   /* "(tree fragment)":12
17175  *     else:
17176  *         use_setstate = self.name is not None
17177  *     if use_setstate:             # <<<<<<<<<<<<<<
17178  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
17179  *     else:
17180  */
17181   __pyx_t_3 = (__pyx_v_use_setstate != 0);
17182   if (__pyx_t_3) {
17183 
17184     /* "(tree fragment)":13
17185  *         use_setstate = self.name is not None
17186  *     if use_setstate:
17187  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
17188  *     else:
17189  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
17190  */
17191     __Pyx_XDECREF(__pyx_r);
17192     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
17193     __Pyx_GOTREF(__pyx_t_4);
17194     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
17195     __Pyx_GOTREF(__pyx_t_1);
17196     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
17197     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
17198     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
17199     __Pyx_INCREF(__pyx_int_184977713);
17200     __Pyx_GIVEREF(__pyx_int_184977713);
17201     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
17202     __Pyx_INCREF(Py_None);
17203     __Pyx_GIVEREF(Py_None);
17204     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
17205     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
17206     __Pyx_GOTREF(__pyx_t_5);
17207     __Pyx_GIVEREF(__pyx_t_4);
17208     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
17209     __Pyx_GIVEREF(__pyx_t_1);
17210     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
17211     __Pyx_INCREF(__pyx_v_state);
17212     __Pyx_GIVEREF(__pyx_v_state);
17213     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
17214     __pyx_t_4 = 0;
17215     __pyx_t_1 = 0;
17216     __pyx_r = __pyx_t_5;
17217     __pyx_t_5 = 0;
17218     goto __pyx_L0;
17219 
17220     /* "(tree fragment)":12
17221  *     else:
17222  *         use_setstate = self.name is not None
17223  *     if use_setstate:             # <<<<<<<<<<<<<<
17224  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
17225  *     else:
17226  */
17227   }
17228 
17229   /* "(tree fragment)":15
17230  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
17231  *     else:
17232  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
17233  * def __setstate_cython__(self, __pyx_state):
17234  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
17235  */
17236   /*else*/ {
17237     __Pyx_XDECREF(__pyx_r);
17238     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
17239     __Pyx_GOTREF(__pyx_t_5);
17240     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
17241     __Pyx_GOTREF(__pyx_t_1);
17242     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
17243     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
17244     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
17245     __Pyx_INCREF(__pyx_int_184977713);
17246     __Pyx_GIVEREF(__pyx_int_184977713);
17247     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
17248     __Pyx_INCREF(__pyx_v_state);
17249     __Pyx_GIVEREF(__pyx_v_state);
17250     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
17251     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
17252     __Pyx_GOTREF(__pyx_t_4);
17253     __Pyx_GIVEREF(__pyx_t_5);
17254     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
17255     __Pyx_GIVEREF(__pyx_t_1);
17256     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
17257     __pyx_t_5 = 0;
17258     __pyx_t_1 = 0;
17259     __pyx_r = __pyx_t_4;
17260     __pyx_t_4 = 0;
17261     goto __pyx_L0;
17262   }
17263 
17264   /* "(tree fragment)":1
17265  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
17266  *     cdef tuple state
17267  *     cdef object _dict
17268  */
17269 
17270   /* function exit code */
17271   __pyx_L1_error:;
17272   __Pyx_XDECREF(__pyx_t_1);
17273   __Pyx_XDECREF(__pyx_t_4);
17274   __Pyx_XDECREF(__pyx_t_5);
17275   __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17276   __pyx_r = NULL;
17277   __pyx_L0:;
17278   __Pyx_XDECREF(__pyx_v_state);
17279   __Pyx_XDECREF(__pyx_v__dict);
17280   __Pyx_XGIVEREF(__pyx_r);
17281   __Pyx_RefNannyFinishContext();
17282   return __pyx_r;
17283 }
17284 
17285 /* "(tree fragment)":16
17286  *     else:
17287  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
17288  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
17289  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
17290  */
17291 
17292 /* Python wrapper */
17293 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)17294 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
17295   PyObject *__pyx_r = 0;
17296   __Pyx_RefNannyDeclarations
17297   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
17298   __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
17299 
17300   /* function exit code */
17301   __Pyx_RefNannyFinishContext();
17302   return __pyx_r;
17303 }
17304 
__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v___pyx_state)17305 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
17306   PyObject *__pyx_r = NULL;
17307   __Pyx_RefNannyDeclarations
17308   PyObject *__pyx_t_1 = NULL;
17309   int __pyx_lineno = 0;
17310   const char *__pyx_filename = NULL;
17311   int __pyx_clineno = 0;
17312   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
17313 
17314   /* "(tree fragment)":17
17315  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
17316  * def __setstate_cython__(self, __pyx_state):
17317  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
17318  */
17319   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)
17320   __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)
17321   __Pyx_GOTREF(__pyx_t_1);
17322   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17323 
17324   /* "(tree fragment)":16
17325  *     else:
17326  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
17327  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
17328  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
17329  */
17330 
17331   /* function exit code */
17332   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17333   goto __pyx_L0;
17334   __pyx_L1_error:;
17335   __Pyx_XDECREF(__pyx_t_1);
17336   __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17337   __pyx_r = NULL;
17338   __pyx_L0:;
17339   __Pyx_XGIVEREF(__pyx_r);
17340   __Pyx_RefNannyFinishContext();
17341   return __pyx_r;
17342 }
17343 
17344 /* "View.MemoryView":298
17345  *
17346  * @cname('__pyx_align_pointer')
17347  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
17348  *     "Align pointer memory on a given boundary"
17349  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
17350  */
17351 
__pyx_align_pointer(void * __pyx_v_memory,size_t __pyx_v_alignment)17352 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
17353   Py_intptr_t __pyx_v_aligned_p;
17354   size_t __pyx_v_offset;
17355   void *__pyx_r;
17356   int __pyx_t_1;
17357 
17358   /* "View.MemoryView":300
17359  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
17360  *     "Align pointer memory on a given boundary"
17361  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
17362  *     cdef size_t offset
17363  *
17364  */
17365   __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
17366 
17367   /* "View.MemoryView":304
17368  *
17369  *     with cython.cdivision(True):
17370  *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
17371  *
17372  *     if offset > 0:
17373  */
17374   __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
17375 
17376   /* "View.MemoryView":306
17377  *         offset = aligned_p % alignment
17378  *
17379  *     if offset > 0:             # <<<<<<<<<<<<<<
17380  *         aligned_p += alignment - offset
17381  *
17382  */
17383   __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
17384   if (__pyx_t_1) {
17385 
17386     /* "View.MemoryView":307
17387  *
17388  *     if offset > 0:
17389  *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
17390  *
17391  *     return <void *> aligned_p
17392  */
17393     __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
17394 
17395     /* "View.MemoryView":306
17396  *         offset = aligned_p % alignment
17397  *
17398  *     if offset > 0:             # <<<<<<<<<<<<<<
17399  *         aligned_p += alignment - offset
17400  *
17401  */
17402   }
17403 
17404   /* "View.MemoryView":309
17405  *         aligned_p += alignment - offset
17406  *
17407  *     return <void *> aligned_p             # <<<<<<<<<<<<<<
17408  *
17409  *
17410  */
17411   __pyx_r = ((void *)__pyx_v_aligned_p);
17412   goto __pyx_L0;
17413 
17414   /* "View.MemoryView":298
17415  *
17416  * @cname('__pyx_align_pointer')
17417  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
17418  *     "Align pointer memory on a given boundary"
17419  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
17420  */
17421 
17422   /* function exit code */
17423   __pyx_L0:;
17424   return __pyx_r;
17425 }
17426 
17427 /* "View.MemoryView":345
17428  *     cdef __Pyx_TypeInfo *typeinfo
17429  *
17430  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
17431  *         self.obj = obj
17432  *         self.flags = flags
17433  */
17434 
17435 /* Python wrapper */
17436 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)17437 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17438   PyObject *__pyx_v_obj = 0;
17439   int __pyx_v_flags;
17440   int __pyx_v_dtype_is_object;
17441   int __pyx_lineno = 0;
17442   const char *__pyx_filename = NULL;
17443   int __pyx_clineno = 0;
17444   int __pyx_r;
17445   __Pyx_RefNannyDeclarations
17446   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
17447   {
17448     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
17449     PyObject* values[3] = {0,0,0};
17450     if (unlikely(__pyx_kwds)) {
17451       Py_ssize_t kw_args;
17452       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17453       switch (pos_args) {
17454         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17455         CYTHON_FALLTHROUGH;
17456         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17457         CYTHON_FALLTHROUGH;
17458         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17459         CYTHON_FALLTHROUGH;
17460         case  0: break;
17461         default: goto __pyx_L5_argtuple_error;
17462       }
17463       kw_args = PyDict_Size(__pyx_kwds);
17464       switch (pos_args) {
17465         case  0:
17466         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
17467         else goto __pyx_L5_argtuple_error;
17468         CYTHON_FALLTHROUGH;
17469         case  1:
17470         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
17471         else {
17472           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
17473         }
17474         CYTHON_FALLTHROUGH;
17475         case  2:
17476         if (kw_args > 0) {
17477           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
17478           if (value) { values[2] = value; kw_args--; }
17479         }
17480       }
17481       if (unlikely(kw_args > 0)) {
17482         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error)
17483       }
17484     } else {
17485       switch (PyTuple_GET_SIZE(__pyx_args)) {
17486         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17487         CYTHON_FALLTHROUGH;
17488         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17489         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17490         break;
17491         default: goto __pyx_L5_argtuple_error;
17492       }
17493     }
17494     __pyx_v_obj = values[0];
17495     __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)
17496     if (values[2]) {
17497       __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)
17498     } else {
17499       __pyx_v_dtype_is_object = ((int)0);
17500     }
17501   }
17502   goto __pyx_L4_argument_unpacking_done;
17503   __pyx_L5_argtuple_error:;
17504   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error)
17505   __pyx_L3_error:;
17506   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17507   __Pyx_RefNannyFinishContext();
17508   return -1;
17509   __pyx_L4_argument_unpacking_done:;
17510   __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);
17511 
17512   /* function exit code */
17513   __Pyx_RefNannyFinishContext();
17514   return __pyx_r;
17515 }
17516 
__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)17517 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) {
17518   int __pyx_r;
17519   __Pyx_RefNannyDeclarations
17520   int __pyx_t_1;
17521   int __pyx_t_2;
17522   int __pyx_t_3;
17523   int __pyx_t_4;
17524   int __pyx_lineno = 0;
17525   const char *__pyx_filename = NULL;
17526   int __pyx_clineno = 0;
17527   __Pyx_RefNannySetupContext("__cinit__", 0);
17528 
17529   /* "View.MemoryView":346
17530  *
17531  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
17532  *         self.obj = obj             # <<<<<<<<<<<<<<
17533  *         self.flags = flags
17534  *         if type(self) is memoryview or obj is not None:
17535  */
17536   __Pyx_INCREF(__pyx_v_obj);
17537   __Pyx_GIVEREF(__pyx_v_obj);
17538   __Pyx_GOTREF(__pyx_v_self->obj);
17539   __Pyx_DECREF(__pyx_v_self->obj);
17540   __pyx_v_self->obj = __pyx_v_obj;
17541 
17542   /* "View.MemoryView":347
17543  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
17544  *         self.obj = obj
17545  *         self.flags = flags             # <<<<<<<<<<<<<<
17546  *         if type(self) is memoryview or obj is not None:
17547  *             __Pyx_GetBuffer(obj, &self.view, flags)
17548  */
17549   __pyx_v_self->flags = __pyx_v_flags;
17550 
17551   /* "View.MemoryView":348
17552  *         self.obj = obj
17553  *         self.flags = flags
17554  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
17555  *             __Pyx_GetBuffer(obj, &self.view, flags)
17556  *             if <PyObject *> self.view.obj == NULL:
17557  */
17558   __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
17559   __pyx_t_3 = (__pyx_t_2 != 0);
17560   if (!__pyx_t_3) {
17561   } else {
17562     __pyx_t_1 = __pyx_t_3;
17563     goto __pyx_L4_bool_binop_done;
17564   }
17565   __pyx_t_3 = (__pyx_v_obj != Py_None);
17566   __pyx_t_2 = (__pyx_t_3 != 0);
17567   __pyx_t_1 = __pyx_t_2;
17568   __pyx_L4_bool_binop_done:;
17569   if (__pyx_t_1) {
17570 
17571     /* "View.MemoryView":349
17572  *         self.flags = flags
17573  *         if type(self) is memoryview or obj is not None:
17574  *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
17575  *             if <PyObject *> self.view.obj == NULL:
17576  *                 (<__pyx_buffer *> &self.view).obj = Py_None
17577  */
17578     __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)
17579 
17580     /* "View.MemoryView":350
17581  *         if type(self) is memoryview or obj is not None:
17582  *             __Pyx_GetBuffer(obj, &self.view, flags)
17583  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
17584  *                 (<__pyx_buffer *> &self.view).obj = Py_None
17585  *                 Py_INCREF(Py_None)
17586  */
17587     __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
17588     if (__pyx_t_1) {
17589 
17590       /* "View.MemoryView":351
17591  *             __Pyx_GetBuffer(obj, &self.view, flags)
17592  *             if <PyObject *> self.view.obj == NULL:
17593  *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
17594  *                 Py_INCREF(Py_None)
17595  *
17596  */
17597       ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
17598 
17599       /* "View.MemoryView":352
17600  *             if <PyObject *> self.view.obj == NULL:
17601  *                 (<__pyx_buffer *> &self.view).obj = Py_None
17602  *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
17603  *
17604  *         global __pyx_memoryview_thread_locks_used
17605  */
17606       Py_INCREF(Py_None);
17607 
17608       /* "View.MemoryView":350
17609  *         if type(self) is memoryview or obj is not None:
17610  *             __Pyx_GetBuffer(obj, &self.view, flags)
17611  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
17612  *                 (<__pyx_buffer *> &self.view).obj = Py_None
17613  *                 Py_INCREF(Py_None)
17614  */
17615     }
17616 
17617     /* "View.MemoryView":348
17618  *         self.obj = obj
17619  *         self.flags = flags
17620  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
17621  *             __Pyx_GetBuffer(obj, &self.view, flags)
17622  *             if <PyObject *> self.view.obj == NULL:
17623  */
17624   }
17625 
17626   /* "View.MemoryView":355
17627  *
17628  *         global __pyx_memoryview_thread_locks_used
17629  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
17630  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
17631  *             __pyx_memoryview_thread_locks_used += 1
17632  */
17633   __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
17634   if (__pyx_t_1) {
17635 
17636     /* "View.MemoryView":356
17637  *         global __pyx_memoryview_thread_locks_used
17638  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
17639  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
17640  *             __pyx_memoryview_thread_locks_used += 1
17641  *         if self.lock is NULL:
17642  */
17643     __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
17644 
17645     /* "View.MemoryView":357
17646  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
17647  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
17648  *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
17649  *         if self.lock is NULL:
17650  *             self.lock = PyThread_allocate_lock()
17651  */
17652     __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
17653 
17654     /* "View.MemoryView":355
17655  *
17656  *         global __pyx_memoryview_thread_locks_used
17657  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
17658  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
17659  *             __pyx_memoryview_thread_locks_used += 1
17660  */
17661   }
17662 
17663   /* "View.MemoryView":358
17664  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
17665  *             __pyx_memoryview_thread_locks_used += 1
17666  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
17667  *             self.lock = PyThread_allocate_lock()
17668  *             if self.lock is NULL:
17669  */
17670   __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
17671   if (__pyx_t_1) {
17672 
17673     /* "View.MemoryView":359
17674  *             __pyx_memoryview_thread_locks_used += 1
17675  *         if self.lock is NULL:
17676  *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
17677  *             if self.lock is NULL:
17678  *                 raise MemoryError
17679  */
17680     __pyx_v_self->lock = PyThread_allocate_lock();
17681 
17682     /* "View.MemoryView":360
17683  *         if self.lock is NULL:
17684  *             self.lock = PyThread_allocate_lock()
17685  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
17686  *                 raise MemoryError
17687  *
17688  */
17689     __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
17690     if (unlikely(__pyx_t_1)) {
17691 
17692       /* "View.MemoryView":361
17693  *             self.lock = PyThread_allocate_lock()
17694  *             if self.lock is NULL:
17695  *                 raise MemoryError             # <<<<<<<<<<<<<<
17696  *
17697  *         if flags & PyBUF_FORMAT:
17698  */
17699       PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
17700 
17701       /* "View.MemoryView":360
17702  *         if self.lock is NULL:
17703  *             self.lock = PyThread_allocate_lock()
17704  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
17705  *                 raise MemoryError
17706  *
17707  */
17708     }
17709 
17710     /* "View.MemoryView":358
17711  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
17712  *             __pyx_memoryview_thread_locks_used += 1
17713  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
17714  *             self.lock = PyThread_allocate_lock()
17715  *             if self.lock is NULL:
17716  */
17717   }
17718 
17719   /* "View.MemoryView":363
17720  *                 raise MemoryError
17721  *
17722  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
17723  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
17724  *         else:
17725  */
17726   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
17727   if (__pyx_t_1) {
17728 
17729     /* "View.MemoryView":364
17730  *
17731  *         if flags & PyBUF_FORMAT:
17732  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
17733  *         else:
17734  *             self.dtype_is_object = dtype_is_object
17735  */
17736     __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
17737     if (__pyx_t_2) {
17738     } else {
17739       __pyx_t_1 = __pyx_t_2;
17740       goto __pyx_L11_bool_binop_done;
17741     }
17742     __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
17743     __pyx_t_1 = __pyx_t_2;
17744     __pyx_L11_bool_binop_done:;
17745     __pyx_v_self->dtype_is_object = __pyx_t_1;
17746 
17747     /* "View.MemoryView":363
17748  *                 raise MemoryError
17749  *
17750  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
17751  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
17752  *         else:
17753  */
17754     goto __pyx_L10;
17755   }
17756 
17757   /* "View.MemoryView":366
17758  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
17759  *         else:
17760  *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
17761  *
17762  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
17763  */
17764   /*else*/ {
17765     __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
17766   }
17767   __pyx_L10:;
17768 
17769   /* "View.MemoryView":368
17770  *             self.dtype_is_object = dtype_is_object
17771  *
17772  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
17773  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
17774  *         self.typeinfo = NULL
17775  */
17776   __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
17777 
17778   /* "View.MemoryView":370
17779  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
17780  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
17781  *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
17782  *
17783  *     def __dealloc__(memoryview self):
17784  */
17785   __pyx_v_self->typeinfo = NULL;
17786 
17787   /* "View.MemoryView":345
17788  *     cdef __Pyx_TypeInfo *typeinfo
17789  *
17790  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
17791  *         self.obj = obj
17792  *         self.flags = flags
17793  */
17794 
17795   /* function exit code */
17796   __pyx_r = 0;
17797   goto __pyx_L0;
17798   __pyx_L1_error:;
17799   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17800   __pyx_r = -1;
17801   __pyx_L0:;
17802   __Pyx_RefNannyFinishContext();
17803   return __pyx_r;
17804 }
17805 
17806 /* "View.MemoryView":372
17807  *         self.typeinfo = NULL
17808  *
17809  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
17810  *         if self.obj is not None:
17811  *             __Pyx_ReleaseBuffer(&self.view)
17812  */
17813 
17814 /* Python wrapper */
17815 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___dealloc__(PyObject * __pyx_v_self)17816 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
17817   __Pyx_RefNannyDeclarations
17818   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
17819   __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
17820 
17821   /* function exit code */
17822   __Pyx_RefNannyFinishContext();
17823 }
17824 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj * __pyx_v_self)17825 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
17826   int __pyx_v_i;
17827   __Pyx_RefNannyDeclarations
17828   int __pyx_t_1;
17829   int __pyx_t_2;
17830   int __pyx_t_3;
17831   int __pyx_t_4;
17832   int __pyx_t_5;
17833   PyThread_type_lock __pyx_t_6;
17834   PyThread_type_lock __pyx_t_7;
17835   __Pyx_RefNannySetupContext("__dealloc__", 0);
17836 
17837   /* "View.MemoryView":373
17838  *
17839  *     def __dealloc__(memoryview self):
17840  *         if self.obj is not None:             # <<<<<<<<<<<<<<
17841  *             __Pyx_ReleaseBuffer(&self.view)
17842  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
17843  */
17844   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
17845   __pyx_t_2 = (__pyx_t_1 != 0);
17846   if (__pyx_t_2) {
17847 
17848     /* "View.MemoryView":374
17849  *     def __dealloc__(memoryview self):
17850  *         if self.obj is not None:
17851  *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
17852  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
17853  *
17854  */
17855     __Pyx_ReleaseBuffer((&__pyx_v_self->view));
17856 
17857     /* "View.MemoryView":373
17858  *
17859  *     def __dealloc__(memoryview self):
17860  *         if self.obj is not None:             # <<<<<<<<<<<<<<
17861  *             __Pyx_ReleaseBuffer(&self.view)
17862  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
17863  */
17864     goto __pyx_L3;
17865   }
17866 
17867   /* "View.MemoryView":375
17868  *         if self.obj is not None:
17869  *             __Pyx_ReleaseBuffer(&self.view)
17870  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
17871  *
17872  *             (<__pyx_buffer *> &self.view).obj = NULL
17873  */
17874   __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
17875   if (__pyx_t_2) {
17876 
17877     /* "View.MemoryView":377
17878  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
17879  *
17880  *             (<__pyx_buffer *> &self.view).obj = NULL             # <<<<<<<<<<<<<<
17881  *             Py_DECREF(Py_None)
17882  *
17883  */
17884     ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
17885 
17886     /* "View.MemoryView":378
17887  *
17888  *             (<__pyx_buffer *> &self.view).obj = NULL
17889  *             Py_DECREF(Py_None)             # <<<<<<<<<<<<<<
17890  *
17891  *         cdef int i
17892  */
17893     Py_DECREF(Py_None);
17894 
17895     /* "View.MemoryView":375
17896  *         if self.obj is not None:
17897  *             __Pyx_ReleaseBuffer(&self.view)
17898  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
17899  *
17900  *             (<__pyx_buffer *> &self.view).obj = NULL
17901  */
17902   }
17903   __pyx_L3:;
17904 
17905   /* "View.MemoryView":382
17906  *         cdef int i
17907  *         global __pyx_memoryview_thread_locks_used
17908  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
17909  *             for i in range(__pyx_memoryview_thread_locks_used):
17910  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
17911  */
17912   __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
17913   if (__pyx_t_2) {
17914 
17915     /* "View.MemoryView":383
17916  *         global __pyx_memoryview_thread_locks_used
17917  *         if self.lock != NULL:
17918  *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
17919  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
17920  *                     __pyx_memoryview_thread_locks_used -= 1
17921  */
17922     __pyx_t_3 = __pyx_memoryview_thread_locks_used;
17923     __pyx_t_4 = __pyx_t_3;
17924     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
17925       __pyx_v_i = __pyx_t_5;
17926 
17927       /* "View.MemoryView":384
17928  *         if self.lock != NULL:
17929  *             for i in range(__pyx_memoryview_thread_locks_used):
17930  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
17931  *                     __pyx_memoryview_thread_locks_used -= 1
17932  *                     if i != __pyx_memoryview_thread_locks_used:
17933  */
17934       __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
17935       if (__pyx_t_2) {
17936 
17937         /* "View.MemoryView":385
17938  *             for i in range(__pyx_memoryview_thread_locks_used):
17939  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
17940  *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
17941  *                     if i != __pyx_memoryview_thread_locks_used:
17942  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
17943  */
17944         __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
17945 
17946         /* "View.MemoryView":386
17947  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
17948  *                     __pyx_memoryview_thread_locks_used -= 1
17949  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
17950  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
17951  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
17952  */
17953         __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
17954         if (__pyx_t_2) {
17955 
17956           /* "View.MemoryView":388
17957  *                     if i != __pyx_memoryview_thread_locks_used:
17958  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
17959  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
17960  *                     break
17961  *             else:
17962  */
17963           __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
17964           __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
17965 
17966           /* "View.MemoryView":387
17967  *                     __pyx_memoryview_thread_locks_used -= 1
17968  *                     if i != __pyx_memoryview_thread_locks_used:
17969  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
17970  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
17971  *                     break
17972  */
17973           (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
17974           (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
17975 
17976           /* "View.MemoryView":386
17977  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
17978  *                     __pyx_memoryview_thread_locks_used -= 1
17979  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
17980  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
17981  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
17982  */
17983         }
17984 
17985         /* "View.MemoryView":389
17986  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
17987  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
17988  *                     break             # <<<<<<<<<<<<<<
17989  *             else:
17990  *                 PyThread_free_lock(self.lock)
17991  */
17992         goto __pyx_L6_break;
17993 
17994         /* "View.MemoryView":384
17995  *         if self.lock != NULL:
17996  *             for i in range(__pyx_memoryview_thread_locks_used):
17997  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
17998  *                     __pyx_memoryview_thread_locks_used -= 1
17999  *                     if i != __pyx_memoryview_thread_locks_used:
18000  */
18001       }
18002     }
18003     /*else*/ {
18004 
18005       /* "View.MemoryView":391
18006  *                     break
18007  *             else:
18008  *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
18009  *
18010  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
18011  */
18012       PyThread_free_lock(__pyx_v_self->lock);
18013     }
18014     __pyx_L6_break:;
18015 
18016     /* "View.MemoryView":382
18017  *         cdef int i
18018  *         global __pyx_memoryview_thread_locks_used
18019  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
18020  *             for i in range(__pyx_memoryview_thread_locks_used):
18021  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
18022  */
18023   }
18024 
18025   /* "View.MemoryView":372
18026  *         self.typeinfo = NULL
18027  *
18028  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
18029  *         if self.obj is not None:
18030  *             __Pyx_ReleaseBuffer(&self.view)
18031  */
18032 
18033   /* function exit code */
18034   __Pyx_RefNannyFinishContext();
18035 }
18036 
18037 /* "View.MemoryView":393
18038  *                 PyThread_free_lock(self.lock)
18039  *
18040  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
18041  *         cdef Py_ssize_t dim
18042  *         cdef char *itemp = <char *> self.view.buf
18043  */
18044 
__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)18045 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
18046   Py_ssize_t __pyx_v_dim;
18047   char *__pyx_v_itemp;
18048   PyObject *__pyx_v_idx = NULL;
18049   char *__pyx_r;
18050   __Pyx_RefNannyDeclarations
18051   Py_ssize_t __pyx_t_1;
18052   PyObject *__pyx_t_2 = NULL;
18053   Py_ssize_t __pyx_t_3;
18054   PyObject *(*__pyx_t_4)(PyObject *);
18055   PyObject *__pyx_t_5 = NULL;
18056   Py_ssize_t __pyx_t_6;
18057   char *__pyx_t_7;
18058   int __pyx_lineno = 0;
18059   const char *__pyx_filename = NULL;
18060   int __pyx_clineno = 0;
18061   __Pyx_RefNannySetupContext("get_item_pointer", 0);
18062 
18063   /* "View.MemoryView":395
18064  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
18065  *         cdef Py_ssize_t dim
18066  *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
18067  *
18068  *         for dim, idx in enumerate(index):
18069  */
18070   __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
18071 
18072   /* "View.MemoryView":397
18073  *         cdef char *itemp = <char *> self.view.buf
18074  *
18075  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
18076  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
18077  *
18078  */
18079   __pyx_t_1 = 0;
18080   if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
18081     __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
18082     __pyx_t_4 = NULL;
18083   } else {
18084     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error)
18085     __Pyx_GOTREF(__pyx_t_2);
18086     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error)
18087   }
18088   for (;;) {
18089     if (likely(!__pyx_t_4)) {
18090       if (likely(PyList_CheckExact(__pyx_t_2))) {
18091         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
18092         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
18093         __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)
18094         #else
18095         __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)
18096         __Pyx_GOTREF(__pyx_t_5);
18097         #endif
18098       } else {
18099         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
18100         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
18101         __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)
18102         #else
18103         __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)
18104         __Pyx_GOTREF(__pyx_t_5);
18105         #endif
18106       }
18107     } else {
18108       __pyx_t_5 = __pyx_t_4(__pyx_t_2);
18109       if (unlikely(!__pyx_t_5)) {
18110         PyObject* exc_type = PyErr_Occurred();
18111         if (exc_type) {
18112           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
18113           else __PYX_ERR(2, 397, __pyx_L1_error)
18114         }
18115         break;
18116       }
18117       __Pyx_GOTREF(__pyx_t_5);
18118     }
18119     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
18120     __pyx_t_5 = 0;
18121     __pyx_v_dim = __pyx_t_1;
18122     __pyx_t_1 = (__pyx_t_1 + 1);
18123 
18124     /* "View.MemoryView":398
18125  *
18126  *         for dim, idx in enumerate(index):
18127  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
18128  *
18129  *         return itemp
18130  */
18131     __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)
18132     __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)
18133     __pyx_v_itemp = __pyx_t_7;
18134 
18135     /* "View.MemoryView":397
18136  *         cdef char *itemp = <char *> self.view.buf
18137  *
18138  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
18139  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
18140  *
18141  */
18142   }
18143   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18144 
18145   /* "View.MemoryView":400
18146  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
18147  *
18148  *         return itemp             # <<<<<<<<<<<<<<
18149  *
18150  *
18151  */
18152   __pyx_r = __pyx_v_itemp;
18153   goto __pyx_L0;
18154 
18155   /* "View.MemoryView":393
18156  *                 PyThread_free_lock(self.lock)
18157  *
18158  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
18159  *         cdef Py_ssize_t dim
18160  *         cdef char *itemp = <char *> self.view.buf
18161  */
18162 
18163   /* function exit code */
18164   __pyx_L1_error:;
18165   __Pyx_XDECREF(__pyx_t_2);
18166   __Pyx_XDECREF(__pyx_t_5);
18167   __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
18168   __pyx_r = NULL;
18169   __pyx_L0:;
18170   __Pyx_XDECREF(__pyx_v_idx);
18171   __Pyx_RefNannyFinishContext();
18172   return __pyx_r;
18173 }
18174 
18175 /* "View.MemoryView":403
18176  *
18177  *
18178  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
18179  *         if index is Ellipsis:
18180  *             return self
18181  */
18182 
18183 /* Python wrapper */
18184 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)18185 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
18186   PyObject *__pyx_r = 0;
18187   __Pyx_RefNannyDeclarations
18188   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
18189   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
18190 
18191   /* function exit code */
18192   __Pyx_RefNannyFinishContext();
18193   return __pyx_r;
18194 }
18195 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)18196 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
18197   PyObject *__pyx_v_have_slices = NULL;
18198   PyObject *__pyx_v_indices = NULL;
18199   char *__pyx_v_itemp;
18200   PyObject *__pyx_r = NULL;
18201   __Pyx_RefNannyDeclarations
18202   int __pyx_t_1;
18203   int __pyx_t_2;
18204   PyObject *__pyx_t_3 = NULL;
18205   PyObject *__pyx_t_4 = NULL;
18206   PyObject *__pyx_t_5 = NULL;
18207   char *__pyx_t_6;
18208   int __pyx_lineno = 0;
18209   const char *__pyx_filename = NULL;
18210   int __pyx_clineno = 0;
18211   __Pyx_RefNannySetupContext("__getitem__", 0);
18212 
18213   /* "View.MemoryView":404
18214  *
18215  *     def __getitem__(memoryview self, object index):
18216  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
18217  *             return self
18218  *
18219  */
18220   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
18221   __pyx_t_2 = (__pyx_t_1 != 0);
18222   if (__pyx_t_2) {
18223 
18224     /* "View.MemoryView":405
18225  *     def __getitem__(memoryview self, object index):
18226  *         if index is Ellipsis:
18227  *             return self             # <<<<<<<<<<<<<<
18228  *
18229  *         have_slices, indices = _unellipsify(index, self.view.ndim)
18230  */
18231     __Pyx_XDECREF(__pyx_r);
18232     __Pyx_INCREF(((PyObject *)__pyx_v_self));
18233     __pyx_r = ((PyObject *)__pyx_v_self);
18234     goto __pyx_L0;
18235 
18236     /* "View.MemoryView":404
18237  *
18238  *     def __getitem__(memoryview self, object index):
18239  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
18240  *             return self
18241  *
18242  */
18243   }
18244 
18245   /* "View.MemoryView":407
18246  *             return self
18247  *
18248  *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
18249  *
18250  *         cdef char *itemp
18251  */
18252   __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error)
18253   __Pyx_GOTREF(__pyx_t_3);
18254   if (likely(__pyx_t_3 != Py_None)) {
18255     PyObject* sequence = __pyx_t_3;
18256     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
18257     if (unlikely(size != 2)) {
18258       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
18259       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
18260       __PYX_ERR(2, 407, __pyx_L1_error)
18261     }
18262     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
18263     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
18264     __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
18265     __Pyx_INCREF(__pyx_t_4);
18266     __Pyx_INCREF(__pyx_t_5);
18267     #else
18268     __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error)
18269     __Pyx_GOTREF(__pyx_t_4);
18270     __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error)
18271     __Pyx_GOTREF(__pyx_t_5);
18272     #endif
18273     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18274   } else {
18275     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error)
18276   }
18277   __pyx_v_have_slices = __pyx_t_4;
18278   __pyx_t_4 = 0;
18279   __pyx_v_indices = __pyx_t_5;
18280   __pyx_t_5 = 0;
18281 
18282   /* "View.MemoryView":410
18283  *
18284  *         cdef char *itemp
18285  *         if have_slices:             # <<<<<<<<<<<<<<
18286  *             return memview_slice(self, indices)
18287  *         else:
18288  */
18289   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error)
18290   if (__pyx_t_2) {
18291 
18292     /* "View.MemoryView":411
18293  *         cdef char *itemp
18294  *         if have_slices:
18295  *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
18296  *         else:
18297  *             itemp = self.get_item_pointer(indices)
18298  */
18299     __Pyx_XDECREF(__pyx_r);
18300     __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)
18301     __Pyx_GOTREF(__pyx_t_3);
18302     __pyx_r = __pyx_t_3;
18303     __pyx_t_3 = 0;
18304     goto __pyx_L0;
18305 
18306     /* "View.MemoryView":410
18307  *
18308  *         cdef char *itemp
18309  *         if have_slices:             # <<<<<<<<<<<<<<
18310  *             return memview_slice(self, indices)
18311  *         else:
18312  */
18313   }
18314 
18315   /* "View.MemoryView":413
18316  *             return memview_slice(self, indices)
18317  *         else:
18318  *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
18319  *             return self.convert_item_to_object(itemp)
18320  *
18321  */
18322   /*else*/ {
18323     __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)
18324     __pyx_v_itemp = __pyx_t_6;
18325 
18326     /* "View.MemoryView":414
18327  *         else:
18328  *             itemp = self.get_item_pointer(indices)
18329  *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
18330  *
18331  *     def __setitem__(memoryview self, object index, object value):
18332  */
18333     __Pyx_XDECREF(__pyx_r);
18334     __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)
18335     __Pyx_GOTREF(__pyx_t_3);
18336     __pyx_r = __pyx_t_3;
18337     __pyx_t_3 = 0;
18338     goto __pyx_L0;
18339   }
18340 
18341   /* "View.MemoryView":403
18342  *
18343  *
18344  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
18345  *         if index is Ellipsis:
18346  *             return self
18347  */
18348 
18349   /* function exit code */
18350   __pyx_L1_error:;
18351   __Pyx_XDECREF(__pyx_t_3);
18352   __Pyx_XDECREF(__pyx_t_4);
18353   __Pyx_XDECREF(__pyx_t_5);
18354   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18355   __pyx_r = NULL;
18356   __pyx_L0:;
18357   __Pyx_XDECREF(__pyx_v_have_slices);
18358   __Pyx_XDECREF(__pyx_v_indices);
18359   __Pyx_XGIVEREF(__pyx_r);
18360   __Pyx_RefNannyFinishContext();
18361   return __pyx_r;
18362 }
18363 
18364 /* "View.MemoryView":416
18365  *             return self.convert_item_to_object(itemp)
18366  *
18367  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
18368  *         if self.view.readonly:
18369  *             raise TypeError("Cannot assign to read-only memoryview")
18370  */
18371 
18372 /* Python wrapper */
18373 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)18374 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
18375   int __pyx_r;
18376   __Pyx_RefNannyDeclarations
18377   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
18378   __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));
18379 
18380   /* function exit code */
18381   __Pyx_RefNannyFinishContext();
18382   return __pyx_r;
18383 }
18384 
__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)18385 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) {
18386   PyObject *__pyx_v_have_slices = NULL;
18387   PyObject *__pyx_v_obj = NULL;
18388   int __pyx_r;
18389   __Pyx_RefNannyDeclarations
18390   int __pyx_t_1;
18391   PyObject *__pyx_t_2 = NULL;
18392   PyObject *__pyx_t_3 = NULL;
18393   PyObject *__pyx_t_4 = NULL;
18394   int __pyx_lineno = 0;
18395   const char *__pyx_filename = NULL;
18396   int __pyx_clineno = 0;
18397   __Pyx_RefNannySetupContext("__setitem__", 0);
18398   __Pyx_INCREF(__pyx_v_index);
18399 
18400   /* "View.MemoryView":417
18401  *
18402  *     def __setitem__(memoryview self, object index, object value):
18403  *         if self.view.readonly:             # <<<<<<<<<<<<<<
18404  *             raise TypeError("Cannot assign to read-only memoryview")
18405  *
18406  */
18407   __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
18408   if (unlikely(__pyx_t_1)) {
18409 
18410     /* "View.MemoryView":418
18411  *     def __setitem__(memoryview self, object index, object value):
18412  *         if self.view.readonly:
18413  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
18414  *
18415  *         have_slices, index = _unellipsify(index, self.view.ndim)
18416  */
18417     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error)
18418     __Pyx_GOTREF(__pyx_t_2);
18419     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
18420     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18421     __PYX_ERR(2, 418, __pyx_L1_error)
18422 
18423     /* "View.MemoryView":417
18424  *
18425  *     def __setitem__(memoryview self, object index, object value):
18426  *         if self.view.readonly:             # <<<<<<<<<<<<<<
18427  *             raise TypeError("Cannot assign to read-only memoryview")
18428  *
18429  */
18430   }
18431 
18432   /* "View.MemoryView":420
18433  *             raise TypeError("Cannot assign to read-only memoryview")
18434  *
18435  *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
18436  *
18437  *         if have_slices:
18438  */
18439   __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
18440   __Pyx_GOTREF(__pyx_t_2);
18441   if (likely(__pyx_t_2 != Py_None)) {
18442     PyObject* sequence = __pyx_t_2;
18443     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
18444     if (unlikely(size != 2)) {
18445       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
18446       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
18447       __PYX_ERR(2, 420, __pyx_L1_error)
18448     }
18449     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
18450     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
18451     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
18452     __Pyx_INCREF(__pyx_t_3);
18453     __Pyx_INCREF(__pyx_t_4);
18454     #else
18455     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error)
18456     __Pyx_GOTREF(__pyx_t_3);
18457     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error)
18458     __Pyx_GOTREF(__pyx_t_4);
18459     #endif
18460     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18461   } else {
18462     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error)
18463   }
18464   __pyx_v_have_slices = __pyx_t_3;
18465   __pyx_t_3 = 0;
18466   __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
18467   __pyx_t_4 = 0;
18468 
18469   /* "View.MemoryView":422
18470  *         have_slices, index = _unellipsify(index, self.view.ndim)
18471  *
18472  *         if have_slices:             # <<<<<<<<<<<<<<
18473  *             obj = self.is_slice(value)
18474  *             if obj:
18475  */
18476   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error)
18477   if (__pyx_t_1) {
18478 
18479     /* "View.MemoryView":423
18480  *
18481  *         if have_slices:
18482  *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
18483  *             if obj:
18484  *                 self.setitem_slice_assignment(self[index], obj)
18485  */
18486     __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)
18487     __Pyx_GOTREF(__pyx_t_2);
18488     __pyx_v_obj = __pyx_t_2;
18489     __pyx_t_2 = 0;
18490 
18491     /* "View.MemoryView":424
18492  *         if have_slices:
18493  *             obj = self.is_slice(value)
18494  *             if obj:             # <<<<<<<<<<<<<<
18495  *                 self.setitem_slice_assignment(self[index], obj)
18496  *             else:
18497  */
18498     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
18499     if (__pyx_t_1) {
18500 
18501       /* "View.MemoryView":425
18502  *             obj = self.is_slice(value)
18503  *             if obj:
18504  *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
18505  *             else:
18506  *                 self.setitem_slice_assign_scalar(self[index], value)
18507  */
18508       __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)
18509       __Pyx_GOTREF(__pyx_t_2);
18510       __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)
18511       __Pyx_GOTREF(__pyx_t_4);
18512       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18513       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18514 
18515       /* "View.MemoryView":424
18516  *         if have_slices:
18517  *             obj = self.is_slice(value)
18518  *             if obj:             # <<<<<<<<<<<<<<
18519  *                 self.setitem_slice_assignment(self[index], obj)
18520  *             else:
18521  */
18522       goto __pyx_L5;
18523     }
18524 
18525     /* "View.MemoryView":427
18526  *                 self.setitem_slice_assignment(self[index], obj)
18527  *             else:
18528  *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
18529  *         else:
18530  *             self.setitem_indexed(index, value)
18531  */
18532     /*else*/ {
18533       __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)
18534       __Pyx_GOTREF(__pyx_t_4);
18535       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error)
18536       __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)
18537       __Pyx_GOTREF(__pyx_t_2);
18538       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18539       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18540     }
18541     __pyx_L5:;
18542 
18543     /* "View.MemoryView":422
18544  *         have_slices, index = _unellipsify(index, self.view.ndim)
18545  *
18546  *         if have_slices:             # <<<<<<<<<<<<<<
18547  *             obj = self.is_slice(value)
18548  *             if obj:
18549  */
18550     goto __pyx_L4;
18551   }
18552 
18553   /* "View.MemoryView":429
18554  *                 self.setitem_slice_assign_scalar(self[index], value)
18555  *         else:
18556  *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
18557  *
18558  *     cdef is_slice(self, obj):
18559  */
18560   /*else*/ {
18561     __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)
18562     __Pyx_GOTREF(__pyx_t_2);
18563     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18564   }
18565   __pyx_L4:;
18566 
18567   /* "View.MemoryView":416
18568  *             return self.convert_item_to_object(itemp)
18569  *
18570  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
18571  *         if self.view.readonly:
18572  *             raise TypeError("Cannot assign to read-only memoryview")
18573  */
18574 
18575   /* function exit code */
18576   __pyx_r = 0;
18577   goto __pyx_L0;
18578   __pyx_L1_error:;
18579   __Pyx_XDECREF(__pyx_t_2);
18580   __Pyx_XDECREF(__pyx_t_3);
18581   __Pyx_XDECREF(__pyx_t_4);
18582   __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18583   __pyx_r = -1;
18584   __pyx_L0:;
18585   __Pyx_XDECREF(__pyx_v_have_slices);
18586   __Pyx_XDECREF(__pyx_v_obj);
18587   __Pyx_XDECREF(__pyx_v_index);
18588   __Pyx_RefNannyFinishContext();
18589   return __pyx_r;
18590 }
18591 
18592 /* "View.MemoryView":431
18593  *             self.setitem_indexed(index, value)
18594  *
18595  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
18596  *         if not isinstance(obj, memoryview):
18597  *             try:
18598  */
18599 
__pyx_memoryview_is_slice(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj)18600 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
18601   PyObject *__pyx_r = NULL;
18602   __Pyx_RefNannyDeclarations
18603   int __pyx_t_1;
18604   int __pyx_t_2;
18605   PyObject *__pyx_t_3 = NULL;
18606   PyObject *__pyx_t_4 = NULL;
18607   PyObject *__pyx_t_5 = NULL;
18608   PyObject *__pyx_t_6 = NULL;
18609   PyObject *__pyx_t_7 = NULL;
18610   PyObject *__pyx_t_8 = NULL;
18611   int __pyx_t_9;
18612   int __pyx_lineno = 0;
18613   const char *__pyx_filename = NULL;
18614   int __pyx_clineno = 0;
18615   __Pyx_RefNannySetupContext("is_slice", 0);
18616   __Pyx_INCREF(__pyx_v_obj);
18617 
18618   /* "View.MemoryView":432
18619  *
18620  *     cdef is_slice(self, obj):
18621  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
18622  *             try:
18623  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
18624  */
18625   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
18626   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
18627   if (__pyx_t_2) {
18628 
18629     /* "View.MemoryView":433
18630  *     cdef is_slice(self, obj):
18631  *         if not isinstance(obj, memoryview):
18632  *             try:             # <<<<<<<<<<<<<<
18633  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
18634  *                                  self.dtype_is_object)
18635  */
18636     {
18637       __Pyx_PyThreadState_declare
18638       __Pyx_PyThreadState_assign
18639       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
18640       __Pyx_XGOTREF(__pyx_t_3);
18641       __Pyx_XGOTREF(__pyx_t_4);
18642       __Pyx_XGOTREF(__pyx_t_5);
18643       /*try:*/ {
18644 
18645         /* "View.MemoryView":434
18646  *         if not isinstance(obj, memoryview):
18647  *             try:
18648  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
18649  *                                  self.dtype_is_object)
18650  *             except TypeError:
18651  */
18652         __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)
18653         __Pyx_GOTREF(__pyx_t_6);
18654 
18655         /* "View.MemoryView":435
18656  *             try:
18657  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
18658  *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
18659  *             except TypeError:
18660  *                 return None
18661  */
18662         __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error)
18663         __Pyx_GOTREF(__pyx_t_7);
18664 
18665         /* "View.MemoryView":434
18666  *         if not isinstance(obj, memoryview):
18667  *             try:
18668  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
18669  *                                  self.dtype_is_object)
18670  *             except TypeError:
18671  */
18672         __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error)
18673         __Pyx_GOTREF(__pyx_t_8);
18674         __Pyx_INCREF(__pyx_v_obj);
18675         __Pyx_GIVEREF(__pyx_v_obj);
18676         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
18677         __Pyx_GIVEREF(__pyx_t_6);
18678         PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
18679         __Pyx_GIVEREF(__pyx_t_7);
18680         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
18681         __pyx_t_6 = 0;
18682         __pyx_t_7 = 0;
18683         __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)
18684         __Pyx_GOTREF(__pyx_t_7);
18685         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
18686         __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
18687         __pyx_t_7 = 0;
18688 
18689         /* "View.MemoryView":433
18690  *     cdef is_slice(self, obj):
18691  *         if not isinstance(obj, memoryview):
18692  *             try:             # <<<<<<<<<<<<<<
18693  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
18694  *                                  self.dtype_is_object)
18695  */
18696       }
18697       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
18698       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
18699       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
18700       goto __pyx_L9_try_end;
18701       __pyx_L4_error:;
18702       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
18703       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
18704       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
18705 
18706       /* "View.MemoryView":436
18707  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
18708  *                                  self.dtype_is_object)
18709  *             except TypeError:             # <<<<<<<<<<<<<<
18710  *                 return None
18711  *
18712  */
18713       __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
18714       if (__pyx_t_9) {
18715         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
18716         if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error)
18717         __Pyx_GOTREF(__pyx_t_7);
18718         __Pyx_GOTREF(__pyx_t_8);
18719         __Pyx_GOTREF(__pyx_t_6);
18720 
18721         /* "View.MemoryView":437
18722  *                                  self.dtype_is_object)
18723  *             except TypeError:
18724  *                 return None             # <<<<<<<<<<<<<<
18725  *
18726  *         return obj
18727  */
18728         __Pyx_XDECREF(__pyx_r);
18729         __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18730         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18731         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
18732         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
18733         goto __pyx_L7_except_return;
18734       }
18735       goto __pyx_L6_except_error;
18736       __pyx_L6_except_error:;
18737 
18738       /* "View.MemoryView":433
18739  *     cdef is_slice(self, obj):
18740  *         if not isinstance(obj, memoryview):
18741  *             try:             # <<<<<<<<<<<<<<
18742  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
18743  *                                  self.dtype_is_object)
18744  */
18745       __Pyx_XGIVEREF(__pyx_t_3);
18746       __Pyx_XGIVEREF(__pyx_t_4);
18747       __Pyx_XGIVEREF(__pyx_t_5);
18748       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
18749       goto __pyx_L1_error;
18750       __pyx_L7_except_return:;
18751       __Pyx_XGIVEREF(__pyx_t_3);
18752       __Pyx_XGIVEREF(__pyx_t_4);
18753       __Pyx_XGIVEREF(__pyx_t_5);
18754       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
18755       goto __pyx_L0;
18756       __pyx_L9_try_end:;
18757     }
18758 
18759     /* "View.MemoryView":432
18760  *
18761  *     cdef is_slice(self, obj):
18762  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
18763  *             try:
18764  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
18765  */
18766   }
18767 
18768   /* "View.MemoryView":439
18769  *                 return None
18770  *
18771  *         return obj             # <<<<<<<<<<<<<<
18772  *
18773  *     cdef setitem_slice_assignment(self, dst, src):
18774  */
18775   __Pyx_XDECREF(__pyx_r);
18776   __Pyx_INCREF(__pyx_v_obj);
18777   __pyx_r = __pyx_v_obj;
18778   goto __pyx_L0;
18779 
18780   /* "View.MemoryView":431
18781  *             self.setitem_indexed(index, value)
18782  *
18783  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
18784  *         if not isinstance(obj, memoryview):
18785  *             try:
18786  */
18787 
18788   /* function exit code */
18789   __pyx_L1_error:;
18790   __Pyx_XDECREF(__pyx_t_6);
18791   __Pyx_XDECREF(__pyx_t_7);
18792   __Pyx_XDECREF(__pyx_t_8);
18793   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
18794   __pyx_r = 0;
18795   __pyx_L0:;
18796   __Pyx_XDECREF(__pyx_v_obj);
18797   __Pyx_XGIVEREF(__pyx_r);
18798   __Pyx_RefNannyFinishContext();
18799   return __pyx_r;
18800 }
18801 
18802 /* "View.MemoryView":441
18803  *         return obj
18804  *
18805  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
18806  *         cdef __Pyx_memviewslice dst_slice
18807  *         cdef __Pyx_memviewslice src_slice
18808  */
18809 
__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_dst,PyObject * __pyx_v_src)18810 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
18811   __Pyx_memviewslice __pyx_v_dst_slice;
18812   __Pyx_memviewslice __pyx_v_src_slice;
18813   PyObject *__pyx_r = NULL;
18814   __Pyx_RefNannyDeclarations
18815   __Pyx_memviewslice *__pyx_t_1;
18816   __Pyx_memviewslice *__pyx_t_2;
18817   PyObject *__pyx_t_3 = NULL;
18818   int __pyx_t_4;
18819   int __pyx_t_5;
18820   int __pyx_t_6;
18821   int __pyx_lineno = 0;
18822   const char *__pyx_filename = NULL;
18823   int __pyx_clineno = 0;
18824   __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
18825 
18826   /* "View.MemoryView":445
18827  *         cdef __Pyx_memviewslice src_slice
18828  *
18829  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
18830  *                                  get_slice_from_memview(dst, &dst_slice)[0],
18831  *                                  src.ndim, dst.ndim, self.dtype_is_object)
18832  */
18833   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error)
18834   __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)
18835 
18836   /* "View.MemoryView":446
18837  *
18838  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
18839  *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
18840  *                                  src.ndim, dst.ndim, self.dtype_is_object)
18841  *
18842  */
18843   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error)
18844   __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)
18845 
18846   /* "View.MemoryView":447
18847  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
18848  *                                  get_slice_from_memview(dst, &dst_slice)[0],
18849  *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
18850  *
18851  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
18852  */
18853   __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)
18854   __Pyx_GOTREF(__pyx_t_3);
18855   __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)
18856   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18857   __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)
18858   __Pyx_GOTREF(__pyx_t_3);
18859   __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)
18860   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18861 
18862   /* "View.MemoryView":445
18863  *         cdef __Pyx_memviewslice src_slice
18864  *
18865  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
18866  *                                  get_slice_from_memview(dst, &dst_slice)[0],
18867  *                                  src.ndim, dst.ndim, self.dtype_is_object)
18868  */
18869   __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)
18870 
18871   /* "View.MemoryView":441
18872  *         return obj
18873  *
18874  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
18875  *         cdef __Pyx_memviewslice dst_slice
18876  *         cdef __Pyx_memviewslice src_slice
18877  */
18878 
18879   /* function exit code */
18880   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18881   goto __pyx_L0;
18882   __pyx_L1_error:;
18883   __Pyx_XDECREF(__pyx_t_3);
18884   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
18885   __pyx_r = 0;
18886   __pyx_L0:;
18887   __Pyx_XGIVEREF(__pyx_r);
18888   __Pyx_RefNannyFinishContext();
18889   return __pyx_r;
18890 }
18891 
18892 /* "View.MemoryView":449
18893  *                                  src.ndim, dst.ndim, self.dtype_is_object)
18894  *
18895  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
18896  *         cdef int array[128]
18897  *         cdef void *tmp = NULL
18898  */
18899 
__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj * __pyx_v_self,struct __pyx_memoryview_obj * __pyx_v_dst,PyObject * __pyx_v_value)18900 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) {
18901   int __pyx_v_array[0x80];
18902   void *__pyx_v_tmp;
18903   void *__pyx_v_item;
18904   __Pyx_memviewslice *__pyx_v_dst_slice;
18905   __Pyx_memviewslice __pyx_v_tmp_slice;
18906   PyObject *__pyx_r = NULL;
18907   __Pyx_RefNannyDeclarations
18908   __Pyx_memviewslice *__pyx_t_1;
18909   int __pyx_t_2;
18910   PyObject *__pyx_t_3 = NULL;
18911   int __pyx_t_4;
18912   int __pyx_t_5;
18913   char const *__pyx_t_6;
18914   PyObject *__pyx_t_7 = NULL;
18915   PyObject *__pyx_t_8 = NULL;
18916   PyObject *__pyx_t_9 = NULL;
18917   PyObject *__pyx_t_10 = NULL;
18918   PyObject *__pyx_t_11 = NULL;
18919   PyObject *__pyx_t_12 = NULL;
18920   int __pyx_lineno = 0;
18921   const char *__pyx_filename = NULL;
18922   int __pyx_clineno = 0;
18923   __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
18924 
18925   /* "View.MemoryView":451
18926  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
18927  *         cdef int array[128]
18928  *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
18929  *         cdef void *item
18930  *
18931  */
18932   __pyx_v_tmp = NULL;
18933 
18934   /* "View.MemoryView":456
18935  *         cdef __Pyx_memviewslice *dst_slice
18936  *         cdef __Pyx_memviewslice tmp_slice
18937  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
18938  *
18939  *         if <size_t>self.view.itemsize > sizeof(array):
18940  */
18941   __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)
18942   __pyx_v_dst_slice = __pyx_t_1;
18943 
18944   /* "View.MemoryView":458
18945  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
18946  *
18947  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
18948  *             tmp = PyMem_Malloc(self.view.itemsize)
18949  *             if tmp == NULL:
18950  */
18951   __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
18952   if (__pyx_t_2) {
18953 
18954     /* "View.MemoryView":459
18955  *
18956  *         if <size_t>self.view.itemsize > sizeof(array):
18957  *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
18958  *             if tmp == NULL:
18959  *                 raise MemoryError
18960  */
18961     __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
18962 
18963     /* "View.MemoryView":460
18964  *         if <size_t>self.view.itemsize > sizeof(array):
18965  *             tmp = PyMem_Malloc(self.view.itemsize)
18966  *             if tmp == NULL:             # <<<<<<<<<<<<<<
18967  *                 raise MemoryError
18968  *             item = tmp
18969  */
18970     __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
18971     if (unlikely(__pyx_t_2)) {
18972 
18973       /* "View.MemoryView":461
18974  *             tmp = PyMem_Malloc(self.view.itemsize)
18975  *             if tmp == NULL:
18976  *                 raise MemoryError             # <<<<<<<<<<<<<<
18977  *             item = tmp
18978  *         else:
18979  */
18980       PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error)
18981 
18982       /* "View.MemoryView":460
18983  *         if <size_t>self.view.itemsize > sizeof(array):
18984  *             tmp = PyMem_Malloc(self.view.itemsize)
18985  *             if tmp == NULL:             # <<<<<<<<<<<<<<
18986  *                 raise MemoryError
18987  *             item = tmp
18988  */
18989     }
18990 
18991     /* "View.MemoryView":462
18992  *             if tmp == NULL:
18993  *                 raise MemoryError
18994  *             item = tmp             # <<<<<<<<<<<<<<
18995  *         else:
18996  *             item = <void *> array
18997  */
18998     __pyx_v_item = __pyx_v_tmp;
18999 
19000     /* "View.MemoryView":458
19001  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
19002  *
19003  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
19004  *             tmp = PyMem_Malloc(self.view.itemsize)
19005  *             if tmp == NULL:
19006  */
19007     goto __pyx_L3;
19008   }
19009 
19010   /* "View.MemoryView":464
19011  *             item = tmp
19012  *         else:
19013  *             item = <void *> array             # <<<<<<<<<<<<<<
19014  *
19015  *         try:
19016  */
19017   /*else*/ {
19018     __pyx_v_item = ((void *)__pyx_v_array);
19019   }
19020   __pyx_L3:;
19021 
19022   /* "View.MemoryView":466
19023  *             item = <void *> array
19024  *
19025  *         try:             # <<<<<<<<<<<<<<
19026  *             if self.dtype_is_object:
19027  *                 (<PyObject **> item)[0] = <PyObject *> value
19028  */
19029   /*try:*/ {
19030 
19031     /* "View.MemoryView":467
19032  *
19033  *         try:
19034  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
19035  *                 (<PyObject **> item)[0] = <PyObject *> value
19036  *             else:
19037  */
19038     __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
19039     if (__pyx_t_2) {
19040 
19041       /* "View.MemoryView":468
19042  *         try:
19043  *             if self.dtype_is_object:
19044  *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
19045  *             else:
19046  *                 self.assign_item_from_object(<char *> item, value)
19047  */
19048       (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
19049 
19050       /* "View.MemoryView":467
19051  *
19052  *         try:
19053  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
19054  *                 (<PyObject **> item)[0] = <PyObject *> value
19055  *             else:
19056  */
19057       goto __pyx_L8;
19058     }
19059 
19060     /* "View.MemoryView":470
19061  *                 (<PyObject **> item)[0] = <PyObject *> value
19062  *             else:
19063  *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
19064  *
19065  *
19066  */
19067     /*else*/ {
19068       __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)
19069       __Pyx_GOTREF(__pyx_t_3);
19070       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19071     }
19072     __pyx_L8:;
19073 
19074     /* "View.MemoryView":474
19075  *
19076  *
19077  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
19078  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
19079  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
19080  */
19081     __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
19082     if (__pyx_t_2) {
19083 
19084       /* "View.MemoryView":475
19085  *
19086  *             if self.view.suboffsets != NULL:
19087  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
19088  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
19089  *                                 item, self.dtype_is_object)
19090  */
19091       __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)
19092       __Pyx_GOTREF(__pyx_t_3);
19093       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19094 
19095       /* "View.MemoryView":474
19096  *
19097  *
19098  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
19099  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
19100  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
19101  */
19102     }
19103 
19104     /* "View.MemoryView":476
19105  *             if self.view.suboffsets != NULL:
19106  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
19107  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
19108  *                                 item, self.dtype_is_object)
19109  *         finally:
19110  */
19111     __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);
19112   }
19113 
19114   /* "View.MemoryView":479
19115  *                                 item, self.dtype_is_object)
19116  *         finally:
19117  *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
19118  *
19119  *     cdef setitem_indexed(self, index, value):
19120  */
19121   /*finally:*/ {
19122     /*normal exit:*/{
19123       PyMem_Free(__pyx_v_tmp);
19124       goto __pyx_L7;
19125     }
19126     __pyx_L6_error:;
19127     /*exception exit:*/{
19128       __Pyx_PyThreadState_declare
19129       __Pyx_PyThreadState_assign
19130       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
19131       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
19132       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
19133       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);
19134       __Pyx_XGOTREF(__pyx_t_7);
19135       __Pyx_XGOTREF(__pyx_t_8);
19136       __Pyx_XGOTREF(__pyx_t_9);
19137       __Pyx_XGOTREF(__pyx_t_10);
19138       __Pyx_XGOTREF(__pyx_t_11);
19139       __Pyx_XGOTREF(__pyx_t_12);
19140       __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
19141       {
19142         PyMem_Free(__pyx_v_tmp);
19143       }
19144       if (PY_MAJOR_VERSION >= 3) {
19145         __Pyx_XGIVEREF(__pyx_t_10);
19146         __Pyx_XGIVEREF(__pyx_t_11);
19147         __Pyx_XGIVEREF(__pyx_t_12);
19148         __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
19149       }
19150       __Pyx_XGIVEREF(__pyx_t_7);
19151       __Pyx_XGIVEREF(__pyx_t_8);
19152       __Pyx_XGIVEREF(__pyx_t_9);
19153       __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
19154       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
19155       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
19156       goto __pyx_L1_error;
19157     }
19158     __pyx_L7:;
19159   }
19160 
19161   /* "View.MemoryView":449
19162  *                                  src.ndim, dst.ndim, self.dtype_is_object)
19163  *
19164  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
19165  *         cdef int array[128]
19166  *         cdef void *tmp = NULL
19167  */
19168 
19169   /* function exit code */
19170   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19171   goto __pyx_L0;
19172   __pyx_L1_error:;
19173   __Pyx_XDECREF(__pyx_t_3);
19174   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
19175   __pyx_r = 0;
19176   __pyx_L0:;
19177   __Pyx_XGIVEREF(__pyx_r);
19178   __Pyx_RefNannyFinishContext();
19179   return __pyx_r;
19180 }
19181 
19182 /* "View.MemoryView":481
19183  *             PyMem_Free(tmp)
19184  *
19185  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
19186  *         cdef char *itemp = self.get_item_pointer(index)
19187  *         self.assign_item_from_object(itemp, value)
19188  */
19189 
__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)19190 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
19191   char *__pyx_v_itemp;
19192   PyObject *__pyx_r = NULL;
19193   __Pyx_RefNannyDeclarations
19194   char *__pyx_t_1;
19195   PyObject *__pyx_t_2 = NULL;
19196   int __pyx_lineno = 0;
19197   const char *__pyx_filename = NULL;
19198   int __pyx_clineno = 0;
19199   __Pyx_RefNannySetupContext("setitem_indexed", 0);
19200 
19201   /* "View.MemoryView":482
19202  *
19203  *     cdef setitem_indexed(self, index, value):
19204  *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
19205  *         self.assign_item_from_object(itemp, value)
19206  *
19207  */
19208   __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)
19209   __pyx_v_itemp = __pyx_t_1;
19210 
19211   /* "View.MemoryView":483
19212  *     cdef setitem_indexed(self, index, value):
19213  *         cdef char *itemp = self.get_item_pointer(index)
19214  *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
19215  *
19216  *     cdef convert_item_to_object(self, char *itemp):
19217  */
19218   __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)
19219   __Pyx_GOTREF(__pyx_t_2);
19220   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19221 
19222   /* "View.MemoryView":481
19223  *             PyMem_Free(tmp)
19224  *
19225  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
19226  *         cdef char *itemp = self.get_item_pointer(index)
19227  *         self.assign_item_from_object(itemp, value)
19228  */
19229 
19230   /* function exit code */
19231   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19232   goto __pyx_L0;
19233   __pyx_L1_error:;
19234   __Pyx_XDECREF(__pyx_t_2);
19235   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
19236   __pyx_r = 0;
19237   __pyx_L0:;
19238   __Pyx_XGIVEREF(__pyx_r);
19239   __Pyx_RefNannyFinishContext();
19240   return __pyx_r;
19241 }
19242 
19243 /* "View.MemoryView":485
19244  *         self.assign_item_from_object(itemp, value)
19245  *
19246  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
19247  *         """Only used if instantiated manually by the user, or if Cython doesn't
19248  *         know how to convert the type"""
19249  */
19250 
__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp)19251 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
19252   PyObject *__pyx_v_struct = NULL;
19253   PyObject *__pyx_v_bytesitem = 0;
19254   PyObject *__pyx_v_result = NULL;
19255   PyObject *__pyx_r = NULL;
19256   __Pyx_RefNannyDeclarations
19257   PyObject *__pyx_t_1 = NULL;
19258   PyObject *__pyx_t_2 = NULL;
19259   PyObject *__pyx_t_3 = NULL;
19260   PyObject *__pyx_t_4 = NULL;
19261   PyObject *__pyx_t_5 = NULL;
19262   PyObject *__pyx_t_6 = NULL;
19263   PyObject *__pyx_t_7 = NULL;
19264   int __pyx_t_8;
19265   PyObject *__pyx_t_9 = NULL;
19266   size_t __pyx_t_10;
19267   int __pyx_t_11;
19268   int __pyx_lineno = 0;
19269   const char *__pyx_filename = NULL;
19270   int __pyx_clineno = 0;
19271   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
19272 
19273   /* "View.MemoryView":488
19274  *         """Only used if instantiated manually by the user, or if Cython doesn't
19275  *         know how to convert the type"""
19276  *         import struct             # <<<<<<<<<<<<<<
19277  *         cdef bytes bytesitem
19278  *
19279  */
19280   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error)
19281   __Pyx_GOTREF(__pyx_t_1);
19282   __pyx_v_struct = __pyx_t_1;
19283   __pyx_t_1 = 0;
19284 
19285   /* "View.MemoryView":491
19286  *         cdef bytes bytesitem
19287  *
19288  *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
19289  *         try:
19290  *             result = struct.unpack(self.view.format, bytesitem)
19291  */
19292   __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)
19293   __Pyx_GOTREF(__pyx_t_1);
19294   __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
19295   __pyx_t_1 = 0;
19296 
19297   /* "View.MemoryView":492
19298  *
19299  *         bytesitem = itemp[:self.view.itemsize]
19300  *         try:             # <<<<<<<<<<<<<<
19301  *             result = struct.unpack(self.view.format, bytesitem)
19302  *         except struct.error:
19303  */
19304   {
19305     __Pyx_PyThreadState_declare
19306     __Pyx_PyThreadState_assign
19307     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
19308     __Pyx_XGOTREF(__pyx_t_2);
19309     __Pyx_XGOTREF(__pyx_t_3);
19310     __Pyx_XGOTREF(__pyx_t_4);
19311     /*try:*/ {
19312 
19313       /* "View.MemoryView":493
19314  *         bytesitem = itemp[:self.view.itemsize]
19315  *         try:
19316  *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
19317  *         except struct.error:
19318  *             raise ValueError("Unable to convert item to object")
19319  */
19320       __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)
19321       __Pyx_GOTREF(__pyx_t_5);
19322       __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error)
19323       __Pyx_GOTREF(__pyx_t_6);
19324       __pyx_t_7 = NULL;
19325       __pyx_t_8 = 0;
19326       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
19327         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
19328         if (likely(__pyx_t_7)) {
19329           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
19330           __Pyx_INCREF(__pyx_t_7);
19331           __Pyx_INCREF(function);
19332           __Pyx_DECREF_SET(__pyx_t_5, function);
19333           __pyx_t_8 = 1;
19334         }
19335       }
19336       #if CYTHON_FAST_PYCALL
19337       if (PyFunction_Check(__pyx_t_5)) {
19338         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
19339         __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)
19340         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
19341         __Pyx_GOTREF(__pyx_t_1);
19342         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19343       } else
19344       #endif
19345       #if CYTHON_FAST_PYCCALL
19346       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
19347         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
19348         __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)
19349         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
19350         __Pyx_GOTREF(__pyx_t_1);
19351         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19352       } else
19353       #endif
19354       {
19355         __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error)
19356         __Pyx_GOTREF(__pyx_t_9);
19357         if (__pyx_t_7) {
19358           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
19359         }
19360         __Pyx_GIVEREF(__pyx_t_6);
19361         PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
19362         __Pyx_INCREF(__pyx_v_bytesitem);
19363         __Pyx_GIVEREF(__pyx_v_bytesitem);
19364         PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
19365         __pyx_t_6 = 0;
19366         __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)
19367         __Pyx_GOTREF(__pyx_t_1);
19368         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
19369       }
19370       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
19371       __pyx_v_result = __pyx_t_1;
19372       __pyx_t_1 = 0;
19373 
19374       /* "View.MemoryView":492
19375  *
19376  *         bytesitem = itemp[:self.view.itemsize]
19377  *         try:             # <<<<<<<<<<<<<<
19378  *             result = struct.unpack(self.view.format, bytesitem)
19379  *         except struct.error:
19380  */
19381     }
19382 
19383     /* "View.MemoryView":497
19384  *             raise ValueError("Unable to convert item to object")
19385  *         else:
19386  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
19387  *                 return result[0]
19388  *             return result
19389  */
19390     /*else:*/ {
19391       __pyx_t_10 = strlen(__pyx_v_self->view.format);
19392       __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
19393       if (__pyx_t_11) {
19394 
19395         /* "View.MemoryView":498
19396  *         else:
19397  *             if len(self.view.format) == 1:
19398  *                 return result[0]             # <<<<<<<<<<<<<<
19399  *             return result
19400  *
19401  */
19402         __Pyx_XDECREF(__pyx_r);
19403         __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)
19404         __Pyx_GOTREF(__pyx_t_1);
19405         __pyx_r = __pyx_t_1;
19406         __pyx_t_1 = 0;
19407         goto __pyx_L6_except_return;
19408 
19409         /* "View.MemoryView":497
19410  *             raise ValueError("Unable to convert item to object")
19411  *         else:
19412  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
19413  *                 return result[0]
19414  *             return result
19415  */
19416       }
19417 
19418       /* "View.MemoryView":499
19419  *             if len(self.view.format) == 1:
19420  *                 return result[0]
19421  *             return result             # <<<<<<<<<<<<<<
19422  *
19423  *     cdef assign_item_from_object(self, char *itemp, object value):
19424  */
19425       __Pyx_XDECREF(__pyx_r);
19426       __Pyx_INCREF(__pyx_v_result);
19427       __pyx_r = __pyx_v_result;
19428       goto __pyx_L6_except_return;
19429     }
19430     __pyx_L3_error:;
19431     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
19432     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19433     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
19434     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
19435     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
19436 
19437     /* "View.MemoryView":494
19438  *         try:
19439  *             result = struct.unpack(self.view.format, bytesitem)
19440  *         except struct.error:             # <<<<<<<<<<<<<<
19441  *             raise ValueError("Unable to convert item to object")
19442  *         else:
19443  */
19444     __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
19445     __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)
19446     __Pyx_GOTREF(__pyx_t_6);
19447     __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
19448     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19449     __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
19450     __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
19451     if (__pyx_t_8) {
19452       __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
19453       if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error)
19454       __Pyx_GOTREF(__pyx_t_9);
19455       __Pyx_GOTREF(__pyx_t_5);
19456       __Pyx_GOTREF(__pyx_t_1);
19457 
19458       /* "View.MemoryView":495
19459  *             result = struct.unpack(self.view.format, bytesitem)
19460  *         except struct.error:
19461  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
19462  *         else:
19463  *             if len(self.view.format) == 1:
19464  */
19465       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L5_except_error)
19466       __Pyx_GOTREF(__pyx_t_6);
19467       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
19468       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19469       __PYX_ERR(2, 495, __pyx_L5_except_error)
19470     }
19471     goto __pyx_L5_except_error;
19472     __pyx_L5_except_error:;
19473 
19474     /* "View.MemoryView":492
19475  *
19476  *         bytesitem = itemp[:self.view.itemsize]
19477  *         try:             # <<<<<<<<<<<<<<
19478  *             result = struct.unpack(self.view.format, bytesitem)
19479  *         except struct.error:
19480  */
19481     __Pyx_XGIVEREF(__pyx_t_2);
19482     __Pyx_XGIVEREF(__pyx_t_3);
19483     __Pyx_XGIVEREF(__pyx_t_4);
19484     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
19485     goto __pyx_L1_error;
19486     __pyx_L6_except_return:;
19487     __Pyx_XGIVEREF(__pyx_t_2);
19488     __Pyx_XGIVEREF(__pyx_t_3);
19489     __Pyx_XGIVEREF(__pyx_t_4);
19490     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
19491     goto __pyx_L0;
19492   }
19493 
19494   /* "View.MemoryView":485
19495  *         self.assign_item_from_object(itemp, value)
19496  *
19497  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
19498  *         """Only used if instantiated manually by the user, or if Cython doesn't
19499  *         know how to convert the type"""
19500  */
19501 
19502   /* function exit code */
19503   __pyx_L1_error:;
19504   __Pyx_XDECREF(__pyx_t_1);
19505   __Pyx_XDECREF(__pyx_t_5);
19506   __Pyx_XDECREF(__pyx_t_6);
19507   __Pyx_XDECREF(__pyx_t_7);
19508   __Pyx_XDECREF(__pyx_t_9);
19509   __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
19510   __pyx_r = 0;
19511   __pyx_L0:;
19512   __Pyx_XDECREF(__pyx_v_struct);
19513   __Pyx_XDECREF(__pyx_v_bytesitem);
19514   __Pyx_XDECREF(__pyx_v_result);
19515   __Pyx_XGIVEREF(__pyx_r);
19516   __Pyx_RefNannyFinishContext();
19517   return __pyx_r;
19518 }
19519 
19520 /* "View.MemoryView":501
19521  *             return result
19522  *
19523  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
19524  *         """Only used if instantiated manually by the user, or if Cython doesn't
19525  *         know how to convert the type"""
19526  */
19527 
__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)19528 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
19529   PyObject *__pyx_v_struct = NULL;
19530   char __pyx_v_c;
19531   PyObject *__pyx_v_bytesvalue = 0;
19532   Py_ssize_t __pyx_v_i;
19533   PyObject *__pyx_r = NULL;
19534   __Pyx_RefNannyDeclarations
19535   PyObject *__pyx_t_1 = NULL;
19536   int __pyx_t_2;
19537   int __pyx_t_3;
19538   PyObject *__pyx_t_4 = NULL;
19539   PyObject *__pyx_t_5 = NULL;
19540   PyObject *__pyx_t_6 = NULL;
19541   int __pyx_t_7;
19542   PyObject *__pyx_t_8 = NULL;
19543   Py_ssize_t __pyx_t_9;
19544   PyObject *__pyx_t_10 = NULL;
19545   char *__pyx_t_11;
19546   char *__pyx_t_12;
19547   char *__pyx_t_13;
19548   char *__pyx_t_14;
19549   int __pyx_lineno = 0;
19550   const char *__pyx_filename = NULL;
19551   int __pyx_clineno = 0;
19552   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
19553 
19554   /* "View.MemoryView":504
19555  *         """Only used if instantiated manually by the user, or if Cython doesn't
19556  *         know how to convert the type"""
19557  *         import struct             # <<<<<<<<<<<<<<
19558  *         cdef char c
19559  *         cdef bytes bytesvalue
19560  */
19561   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error)
19562   __Pyx_GOTREF(__pyx_t_1);
19563   __pyx_v_struct = __pyx_t_1;
19564   __pyx_t_1 = 0;
19565 
19566   /* "View.MemoryView":509
19567  *         cdef Py_ssize_t i
19568  *
19569  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
19570  *             bytesvalue = struct.pack(self.view.format, *value)
19571  *         else:
19572  */
19573   __pyx_t_2 = PyTuple_Check(__pyx_v_value);
19574   __pyx_t_3 = (__pyx_t_2 != 0);
19575   if (__pyx_t_3) {
19576 
19577     /* "View.MemoryView":510
19578  *
19579  *         if isinstance(value, tuple):
19580  *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
19581  *         else:
19582  *             bytesvalue = struct.pack(self.view.format, value)
19583  */
19584     __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)
19585     __Pyx_GOTREF(__pyx_t_1);
19586     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
19587     __Pyx_GOTREF(__pyx_t_4);
19588     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error)
19589     __Pyx_GOTREF(__pyx_t_5);
19590     __Pyx_GIVEREF(__pyx_t_4);
19591     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
19592     __pyx_t_4 = 0;
19593     __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
19594     __Pyx_GOTREF(__pyx_t_4);
19595     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __pyx_L1_error)
19596     __Pyx_GOTREF(__pyx_t_6);
19597     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
19598     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19599     __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)
19600     __Pyx_GOTREF(__pyx_t_4);
19601     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19602     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19603     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)
19604     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
19605     __pyx_t_4 = 0;
19606 
19607     /* "View.MemoryView":509
19608  *         cdef Py_ssize_t i
19609  *
19610  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
19611  *             bytesvalue = struct.pack(self.view.format, *value)
19612  *         else:
19613  */
19614     goto __pyx_L3;
19615   }
19616 
19617   /* "View.MemoryView":512
19618  *             bytesvalue = struct.pack(self.view.format, *value)
19619  *         else:
19620  *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
19621  *
19622  *         for i, c in enumerate(bytesvalue):
19623  */
19624   /*else*/ {
19625     __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)
19626     __Pyx_GOTREF(__pyx_t_6);
19627     __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
19628     __Pyx_GOTREF(__pyx_t_1);
19629     __pyx_t_5 = NULL;
19630     __pyx_t_7 = 0;
19631     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
19632       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
19633       if (likely(__pyx_t_5)) {
19634         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
19635         __Pyx_INCREF(__pyx_t_5);
19636         __Pyx_INCREF(function);
19637         __Pyx_DECREF_SET(__pyx_t_6, function);
19638         __pyx_t_7 = 1;
19639       }
19640     }
19641     #if CYTHON_FAST_PYCALL
19642     if (PyFunction_Check(__pyx_t_6)) {
19643       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
19644       __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)
19645       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19646       __Pyx_GOTREF(__pyx_t_4);
19647       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19648     } else
19649     #endif
19650     #if CYTHON_FAST_PYCCALL
19651     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
19652       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
19653       __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)
19654       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19655       __Pyx_GOTREF(__pyx_t_4);
19656       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19657     } else
19658     #endif
19659     {
19660       __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error)
19661       __Pyx_GOTREF(__pyx_t_8);
19662       if (__pyx_t_5) {
19663         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
19664       }
19665       __Pyx_GIVEREF(__pyx_t_1);
19666       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
19667       __Pyx_INCREF(__pyx_v_value);
19668       __Pyx_GIVEREF(__pyx_v_value);
19669       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
19670       __pyx_t_1 = 0;
19671       __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)
19672       __Pyx_GOTREF(__pyx_t_4);
19673       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
19674     }
19675     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19676     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)
19677     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
19678     __pyx_t_4 = 0;
19679   }
19680   __pyx_L3:;
19681 
19682   /* "View.MemoryView":514
19683  *             bytesvalue = struct.pack(self.view.format, value)
19684  *
19685  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
19686  *             itemp[i] = c
19687  *
19688  */
19689   __pyx_t_9 = 0;
19690   if (unlikely(__pyx_v_bytesvalue == Py_None)) {
19691     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
19692     __PYX_ERR(2, 514, __pyx_L1_error)
19693   }
19694   __Pyx_INCREF(__pyx_v_bytesvalue);
19695   __pyx_t_10 = __pyx_v_bytesvalue;
19696   __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
19697   __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
19698   for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
19699     __pyx_t_11 = __pyx_t_14;
19700     __pyx_v_c = (__pyx_t_11[0]);
19701 
19702     /* "View.MemoryView":515
19703  *
19704  *         for i, c in enumerate(bytesvalue):
19705  *             itemp[i] = c             # <<<<<<<<<<<<<<
19706  *
19707  *     @cname('getbuffer')
19708  */
19709     __pyx_v_i = __pyx_t_9;
19710 
19711     /* "View.MemoryView":514
19712  *             bytesvalue = struct.pack(self.view.format, value)
19713  *
19714  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
19715  *             itemp[i] = c
19716  *
19717  */
19718     __pyx_t_9 = (__pyx_t_9 + 1);
19719 
19720     /* "View.MemoryView":515
19721  *
19722  *         for i, c in enumerate(bytesvalue):
19723  *             itemp[i] = c             # <<<<<<<<<<<<<<
19724  *
19725  *     @cname('getbuffer')
19726  */
19727     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
19728   }
19729   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
19730 
19731   /* "View.MemoryView":501
19732  *             return result
19733  *
19734  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
19735  *         """Only used if instantiated manually by the user, or if Cython doesn't
19736  *         know how to convert the type"""
19737  */
19738 
19739   /* function exit code */
19740   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19741   goto __pyx_L0;
19742   __pyx_L1_error:;
19743   __Pyx_XDECREF(__pyx_t_1);
19744   __Pyx_XDECREF(__pyx_t_4);
19745   __Pyx_XDECREF(__pyx_t_5);
19746   __Pyx_XDECREF(__pyx_t_6);
19747   __Pyx_XDECREF(__pyx_t_8);
19748   __Pyx_XDECREF(__pyx_t_10);
19749   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
19750   __pyx_r = 0;
19751   __pyx_L0:;
19752   __Pyx_XDECREF(__pyx_v_struct);
19753   __Pyx_XDECREF(__pyx_v_bytesvalue);
19754   __Pyx_XGIVEREF(__pyx_r);
19755   __Pyx_RefNannyFinishContext();
19756   return __pyx_r;
19757 }
19758 
19759 /* "View.MemoryView":518
19760  *
19761  *     @cname('getbuffer')
19762  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
19763  *         if flags & PyBUF_WRITABLE and self.view.readonly:
19764  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
19765  */
19766 
19767 /* Python wrapper */
19768 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)19769 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
19770   int __pyx_r;
19771   __Pyx_RefNannyDeclarations
19772   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
19773   __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));
19774 
19775   /* function exit code */
19776   __Pyx_RefNannyFinishContext();
19777   return __pyx_r;
19778 }
19779 
__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)19780 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) {
19781   int __pyx_r;
19782   __Pyx_RefNannyDeclarations
19783   int __pyx_t_1;
19784   int __pyx_t_2;
19785   PyObject *__pyx_t_3 = NULL;
19786   Py_ssize_t *__pyx_t_4;
19787   char *__pyx_t_5;
19788   void *__pyx_t_6;
19789   int __pyx_t_7;
19790   Py_ssize_t __pyx_t_8;
19791   int __pyx_lineno = 0;
19792   const char *__pyx_filename = NULL;
19793   int __pyx_clineno = 0;
19794   if (__pyx_v_info == NULL) {
19795     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
19796     return -1;
19797   }
19798   __Pyx_RefNannySetupContext("__getbuffer__", 0);
19799   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
19800   __Pyx_GIVEREF(__pyx_v_info->obj);
19801 
19802   /* "View.MemoryView":519
19803  *     @cname('getbuffer')
19804  *     def __getbuffer__(self, Py_buffer *info, int flags):
19805  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
19806  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
19807  *
19808  */
19809   __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
19810   if (__pyx_t_2) {
19811   } else {
19812     __pyx_t_1 = __pyx_t_2;
19813     goto __pyx_L4_bool_binop_done;
19814   }
19815   __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
19816   __pyx_t_1 = __pyx_t_2;
19817   __pyx_L4_bool_binop_done:;
19818   if (unlikely(__pyx_t_1)) {
19819 
19820     /* "View.MemoryView":520
19821  *     def __getbuffer__(self, Py_buffer *info, int flags):
19822  *         if flags & PyBUF_WRITABLE and self.view.readonly:
19823  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
19824  *
19825  *         if flags & PyBUF_ND:
19826  */
19827     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 520, __pyx_L1_error)
19828     __Pyx_GOTREF(__pyx_t_3);
19829     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
19830     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19831     __PYX_ERR(2, 520, __pyx_L1_error)
19832 
19833     /* "View.MemoryView":519
19834  *     @cname('getbuffer')
19835  *     def __getbuffer__(self, Py_buffer *info, int flags):
19836  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
19837  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
19838  *
19839  */
19840   }
19841 
19842   /* "View.MemoryView":522
19843  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
19844  *
19845  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
19846  *             info.shape = self.view.shape
19847  *         else:
19848  */
19849   __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
19850   if (__pyx_t_1) {
19851 
19852     /* "View.MemoryView":523
19853  *
19854  *         if flags & PyBUF_ND:
19855  *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
19856  *         else:
19857  *             info.shape = NULL
19858  */
19859     __pyx_t_4 = __pyx_v_self->view.shape;
19860     __pyx_v_info->shape = __pyx_t_4;
19861 
19862     /* "View.MemoryView":522
19863  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
19864  *
19865  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
19866  *             info.shape = self.view.shape
19867  *         else:
19868  */
19869     goto __pyx_L6;
19870   }
19871 
19872   /* "View.MemoryView":525
19873  *             info.shape = self.view.shape
19874  *         else:
19875  *             info.shape = NULL             # <<<<<<<<<<<<<<
19876  *
19877  *         if flags & PyBUF_STRIDES:
19878  */
19879   /*else*/ {
19880     __pyx_v_info->shape = NULL;
19881   }
19882   __pyx_L6:;
19883 
19884   /* "View.MemoryView":527
19885  *             info.shape = NULL
19886  *
19887  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
19888  *             info.strides = self.view.strides
19889  *         else:
19890  */
19891   __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
19892   if (__pyx_t_1) {
19893 
19894     /* "View.MemoryView":528
19895  *
19896  *         if flags & PyBUF_STRIDES:
19897  *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
19898  *         else:
19899  *             info.strides = NULL
19900  */
19901     __pyx_t_4 = __pyx_v_self->view.strides;
19902     __pyx_v_info->strides = __pyx_t_4;
19903 
19904     /* "View.MemoryView":527
19905  *             info.shape = NULL
19906  *
19907  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
19908  *             info.strides = self.view.strides
19909  *         else:
19910  */
19911     goto __pyx_L7;
19912   }
19913 
19914   /* "View.MemoryView":530
19915  *             info.strides = self.view.strides
19916  *         else:
19917  *             info.strides = NULL             # <<<<<<<<<<<<<<
19918  *
19919  *         if flags & PyBUF_INDIRECT:
19920  */
19921   /*else*/ {
19922     __pyx_v_info->strides = NULL;
19923   }
19924   __pyx_L7:;
19925 
19926   /* "View.MemoryView":532
19927  *             info.strides = NULL
19928  *
19929  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
19930  *             info.suboffsets = self.view.suboffsets
19931  *         else:
19932  */
19933   __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
19934   if (__pyx_t_1) {
19935 
19936     /* "View.MemoryView":533
19937  *
19938  *         if flags & PyBUF_INDIRECT:
19939  *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
19940  *         else:
19941  *             info.suboffsets = NULL
19942  */
19943     __pyx_t_4 = __pyx_v_self->view.suboffsets;
19944     __pyx_v_info->suboffsets = __pyx_t_4;
19945 
19946     /* "View.MemoryView":532
19947  *             info.strides = NULL
19948  *
19949  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
19950  *             info.suboffsets = self.view.suboffsets
19951  *         else:
19952  */
19953     goto __pyx_L8;
19954   }
19955 
19956   /* "View.MemoryView":535
19957  *             info.suboffsets = self.view.suboffsets
19958  *         else:
19959  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
19960  *
19961  *         if flags & PyBUF_FORMAT:
19962  */
19963   /*else*/ {
19964     __pyx_v_info->suboffsets = NULL;
19965   }
19966   __pyx_L8:;
19967 
19968   /* "View.MemoryView":537
19969  *             info.suboffsets = NULL
19970  *
19971  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
19972  *             info.format = self.view.format
19973  *         else:
19974  */
19975   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
19976   if (__pyx_t_1) {
19977 
19978     /* "View.MemoryView":538
19979  *
19980  *         if flags & PyBUF_FORMAT:
19981  *             info.format = self.view.format             # <<<<<<<<<<<<<<
19982  *         else:
19983  *             info.format = NULL
19984  */
19985     __pyx_t_5 = __pyx_v_self->view.format;
19986     __pyx_v_info->format = __pyx_t_5;
19987 
19988     /* "View.MemoryView":537
19989  *             info.suboffsets = NULL
19990  *
19991  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
19992  *             info.format = self.view.format
19993  *         else:
19994  */
19995     goto __pyx_L9;
19996   }
19997 
19998   /* "View.MemoryView":540
19999  *             info.format = self.view.format
20000  *         else:
20001  *             info.format = NULL             # <<<<<<<<<<<<<<
20002  *
20003  *         info.buf = self.view.buf
20004  */
20005   /*else*/ {
20006     __pyx_v_info->format = NULL;
20007   }
20008   __pyx_L9:;
20009 
20010   /* "View.MemoryView":542
20011  *             info.format = NULL
20012  *
20013  *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
20014  *         info.ndim = self.view.ndim
20015  *         info.itemsize = self.view.itemsize
20016  */
20017   __pyx_t_6 = __pyx_v_self->view.buf;
20018   __pyx_v_info->buf = __pyx_t_6;
20019 
20020   /* "View.MemoryView":543
20021  *
20022  *         info.buf = self.view.buf
20023  *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
20024  *         info.itemsize = self.view.itemsize
20025  *         info.len = self.view.len
20026  */
20027   __pyx_t_7 = __pyx_v_self->view.ndim;
20028   __pyx_v_info->ndim = __pyx_t_7;
20029 
20030   /* "View.MemoryView":544
20031  *         info.buf = self.view.buf
20032  *         info.ndim = self.view.ndim
20033  *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
20034  *         info.len = self.view.len
20035  *         info.readonly = self.view.readonly
20036  */
20037   __pyx_t_8 = __pyx_v_self->view.itemsize;
20038   __pyx_v_info->itemsize = __pyx_t_8;
20039 
20040   /* "View.MemoryView":545
20041  *         info.ndim = self.view.ndim
20042  *         info.itemsize = self.view.itemsize
20043  *         info.len = self.view.len             # <<<<<<<<<<<<<<
20044  *         info.readonly = self.view.readonly
20045  *         info.obj = self
20046  */
20047   __pyx_t_8 = __pyx_v_self->view.len;
20048   __pyx_v_info->len = __pyx_t_8;
20049 
20050   /* "View.MemoryView":546
20051  *         info.itemsize = self.view.itemsize
20052  *         info.len = self.view.len
20053  *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
20054  *         info.obj = self
20055  *
20056  */
20057   __pyx_t_1 = __pyx_v_self->view.readonly;
20058   __pyx_v_info->readonly = __pyx_t_1;
20059 
20060   /* "View.MemoryView":547
20061  *         info.len = self.view.len
20062  *         info.readonly = self.view.readonly
20063  *         info.obj = self             # <<<<<<<<<<<<<<
20064  *
20065  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
20066  */
20067   __Pyx_INCREF(((PyObject *)__pyx_v_self));
20068   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
20069   __Pyx_GOTREF(__pyx_v_info->obj);
20070   __Pyx_DECREF(__pyx_v_info->obj);
20071   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
20072 
20073   /* "View.MemoryView":518
20074  *
20075  *     @cname('getbuffer')
20076  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
20077  *         if flags & PyBUF_WRITABLE and self.view.readonly:
20078  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
20079  */
20080 
20081   /* function exit code */
20082   __pyx_r = 0;
20083   goto __pyx_L0;
20084   __pyx_L1_error:;
20085   __Pyx_XDECREF(__pyx_t_3);
20086   __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20087   __pyx_r = -1;
20088   if (__pyx_v_info->obj != NULL) {
20089     __Pyx_GOTREF(__pyx_v_info->obj);
20090     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
20091   }
20092   goto __pyx_L2;
20093   __pyx_L0:;
20094   if (__pyx_v_info->obj == Py_None) {
20095     __Pyx_GOTREF(__pyx_v_info->obj);
20096     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
20097   }
20098   __pyx_L2:;
20099   __Pyx_RefNannyFinishContext();
20100   return __pyx_r;
20101 }
20102 
20103 /* "View.MemoryView":553
20104  *
20105  *     @property
20106  *     def T(self):             # <<<<<<<<<<<<<<
20107  *         cdef _memoryviewslice result = memoryview_copy(self)
20108  *         transpose_memslice(&result.from_slice)
20109  */
20110 
20111 /* Python wrapper */
20112 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)20113 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
20114   PyObject *__pyx_r = 0;
20115   __Pyx_RefNannyDeclarations
20116   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
20117   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
20118 
20119   /* function exit code */
20120   __Pyx_RefNannyFinishContext();
20121   return __pyx_r;
20122 }
20123 
__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj * __pyx_v_self)20124 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
20125   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
20126   PyObject *__pyx_r = NULL;
20127   __Pyx_RefNannyDeclarations
20128   PyObject *__pyx_t_1 = NULL;
20129   int __pyx_t_2;
20130   int __pyx_lineno = 0;
20131   const char *__pyx_filename = NULL;
20132   int __pyx_clineno = 0;
20133   __Pyx_RefNannySetupContext("__get__", 0);
20134 
20135   /* "View.MemoryView":554
20136  *     @property
20137  *     def T(self):
20138  *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
20139  *         transpose_memslice(&result.from_slice)
20140  *         return result
20141  */
20142   __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __pyx_L1_error)
20143   __Pyx_GOTREF(__pyx_t_1);
20144   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error)
20145   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
20146   __pyx_t_1 = 0;
20147 
20148   /* "View.MemoryView":555
20149  *     def T(self):
20150  *         cdef _memoryviewslice result = memoryview_copy(self)
20151  *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
20152  *         return result
20153  *
20154  */
20155   __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)
20156 
20157   /* "View.MemoryView":556
20158  *         cdef _memoryviewslice result = memoryview_copy(self)
20159  *         transpose_memslice(&result.from_slice)
20160  *         return result             # <<<<<<<<<<<<<<
20161  *
20162  *     @property
20163  */
20164   __Pyx_XDECREF(__pyx_r);
20165   __Pyx_INCREF(((PyObject *)__pyx_v_result));
20166   __pyx_r = ((PyObject *)__pyx_v_result);
20167   goto __pyx_L0;
20168 
20169   /* "View.MemoryView":553
20170  *
20171  *     @property
20172  *     def T(self):             # <<<<<<<<<<<<<<
20173  *         cdef _memoryviewslice result = memoryview_copy(self)
20174  *         transpose_memslice(&result.from_slice)
20175  */
20176 
20177   /* function exit code */
20178   __pyx_L1_error:;
20179   __Pyx_XDECREF(__pyx_t_1);
20180   __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20181   __pyx_r = NULL;
20182   __pyx_L0:;
20183   __Pyx_XDECREF((PyObject *)__pyx_v_result);
20184   __Pyx_XGIVEREF(__pyx_r);
20185   __Pyx_RefNannyFinishContext();
20186   return __pyx_r;
20187 }
20188 
20189 /* "View.MemoryView":559
20190  *
20191  *     @property
20192  *     def base(self):             # <<<<<<<<<<<<<<
20193  *         return self.obj
20194  *
20195  */
20196 
20197 /* Python wrapper */
20198 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)20199 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
20200   PyObject *__pyx_r = 0;
20201   __Pyx_RefNannyDeclarations
20202   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
20203   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
20204 
20205   /* function exit code */
20206   __Pyx_RefNannyFinishContext();
20207   return __pyx_r;
20208 }
20209 
__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj * __pyx_v_self)20210 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
20211   PyObject *__pyx_r = NULL;
20212   __Pyx_RefNannyDeclarations
20213   __Pyx_RefNannySetupContext("__get__", 0);
20214 
20215   /* "View.MemoryView":560
20216  *     @property
20217  *     def base(self):
20218  *         return self.obj             # <<<<<<<<<<<<<<
20219  *
20220  *     @property
20221  */
20222   __Pyx_XDECREF(__pyx_r);
20223   __Pyx_INCREF(__pyx_v_self->obj);
20224   __pyx_r = __pyx_v_self->obj;
20225   goto __pyx_L0;
20226 
20227   /* "View.MemoryView":559
20228  *
20229  *     @property
20230  *     def base(self):             # <<<<<<<<<<<<<<
20231  *         return self.obj
20232  *
20233  */
20234 
20235   /* function exit code */
20236   __pyx_L0:;
20237   __Pyx_XGIVEREF(__pyx_r);
20238   __Pyx_RefNannyFinishContext();
20239   return __pyx_r;
20240 }
20241 
20242 /* "View.MemoryView":563
20243  *
20244  *     @property
20245  *     def shape(self):             # <<<<<<<<<<<<<<
20246  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
20247  *
20248  */
20249 
20250 /* Python wrapper */
20251 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)20252 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
20253   PyObject *__pyx_r = 0;
20254   __Pyx_RefNannyDeclarations
20255   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
20256   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
20257 
20258   /* function exit code */
20259   __Pyx_RefNannyFinishContext();
20260   return __pyx_r;
20261 }
20262 
__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj * __pyx_v_self)20263 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
20264   Py_ssize_t __pyx_v_length;
20265   PyObject *__pyx_r = NULL;
20266   __Pyx_RefNannyDeclarations
20267   PyObject *__pyx_t_1 = NULL;
20268   Py_ssize_t *__pyx_t_2;
20269   Py_ssize_t *__pyx_t_3;
20270   Py_ssize_t *__pyx_t_4;
20271   PyObject *__pyx_t_5 = NULL;
20272   int __pyx_lineno = 0;
20273   const char *__pyx_filename = NULL;
20274   int __pyx_clineno = 0;
20275   __Pyx_RefNannySetupContext("__get__", 0);
20276 
20277   /* "View.MemoryView":564
20278  *     @property
20279  *     def shape(self):
20280  *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
20281  *
20282  *     @property
20283  */
20284   __Pyx_XDECREF(__pyx_r);
20285   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error)
20286   __Pyx_GOTREF(__pyx_t_1);
20287   __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
20288   for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
20289     __pyx_t_2 = __pyx_t_4;
20290     __pyx_v_length = (__pyx_t_2[0]);
20291     __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
20292     __Pyx_GOTREF(__pyx_t_5);
20293     if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error)
20294     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
20295   }
20296   __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
20297   __Pyx_GOTREF(__pyx_t_5);
20298   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20299   __pyx_r = __pyx_t_5;
20300   __pyx_t_5 = 0;
20301   goto __pyx_L0;
20302 
20303   /* "View.MemoryView":563
20304  *
20305  *     @property
20306  *     def shape(self):             # <<<<<<<<<<<<<<
20307  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
20308  *
20309  */
20310 
20311   /* function exit code */
20312   __pyx_L1_error:;
20313   __Pyx_XDECREF(__pyx_t_1);
20314   __Pyx_XDECREF(__pyx_t_5);
20315   __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20316   __pyx_r = NULL;
20317   __pyx_L0:;
20318   __Pyx_XGIVEREF(__pyx_r);
20319   __Pyx_RefNannyFinishContext();
20320   return __pyx_r;
20321 }
20322 
20323 /* "View.MemoryView":567
20324  *
20325  *     @property
20326  *     def strides(self):             # <<<<<<<<<<<<<<
20327  *         if self.view.strides == NULL:
20328  *
20329  */
20330 
20331 /* Python wrapper */
20332 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)20333 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
20334   PyObject *__pyx_r = 0;
20335   __Pyx_RefNannyDeclarations
20336   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
20337   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
20338 
20339   /* function exit code */
20340   __Pyx_RefNannyFinishContext();
20341   return __pyx_r;
20342 }
20343 
__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj * __pyx_v_self)20344 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
20345   Py_ssize_t __pyx_v_stride;
20346   PyObject *__pyx_r = NULL;
20347   __Pyx_RefNannyDeclarations
20348   int __pyx_t_1;
20349   PyObject *__pyx_t_2 = NULL;
20350   Py_ssize_t *__pyx_t_3;
20351   Py_ssize_t *__pyx_t_4;
20352   Py_ssize_t *__pyx_t_5;
20353   PyObject *__pyx_t_6 = NULL;
20354   int __pyx_lineno = 0;
20355   const char *__pyx_filename = NULL;
20356   int __pyx_clineno = 0;
20357   __Pyx_RefNannySetupContext("__get__", 0);
20358 
20359   /* "View.MemoryView":568
20360  *     @property
20361  *     def strides(self):
20362  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
20363  *
20364  *             raise ValueError("Buffer view does not expose strides")
20365  */
20366   __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
20367   if (unlikely(__pyx_t_1)) {
20368 
20369     /* "View.MemoryView":570
20370  *         if self.view.strides == NULL:
20371  *
20372  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
20373  *
20374  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
20375  */
20376     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 570, __pyx_L1_error)
20377     __Pyx_GOTREF(__pyx_t_2);
20378     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
20379     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20380     __PYX_ERR(2, 570, __pyx_L1_error)
20381 
20382     /* "View.MemoryView":568
20383  *     @property
20384  *     def strides(self):
20385  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
20386  *
20387  *             raise ValueError("Buffer view does not expose strides")
20388  */
20389   }
20390 
20391   /* "View.MemoryView":572
20392  *             raise ValueError("Buffer view does not expose strides")
20393  *
20394  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
20395  *
20396  *     @property
20397  */
20398   __Pyx_XDECREF(__pyx_r);
20399   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
20400   __Pyx_GOTREF(__pyx_t_2);
20401   __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
20402   for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
20403     __pyx_t_3 = __pyx_t_5;
20404     __pyx_v_stride = (__pyx_t_3[0]);
20405     __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
20406     __Pyx_GOTREF(__pyx_t_6);
20407     if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error)
20408     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20409   }
20410   __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
20411   __Pyx_GOTREF(__pyx_t_6);
20412   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20413   __pyx_r = __pyx_t_6;
20414   __pyx_t_6 = 0;
20415   goto __pyx_L0;
20416 
20417   /* "View.MemoryView":567
20418  *
20419  *     @property
20420  *     def strides(self):             # <<<<<<<<<<<<<<
20421  *         if self.view.strides == NULL:
20422  *
20423  */
20424 
20425   /* function exit code */
20426   __pyx_L1_error:;
20427   __Pyx_XDECREF(__pyx_t_2);
20428   __Pyx_XDECREF(__pyx_t_6);
20429   __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20430   __pyx_r = NULL;
20431   __pyx_L0:;
20432   __Pyx_XGIVEREF(__pyx_r);
20433   __Pyx_RefNannyFinishContext();
20434   return __pyx_r;
20435 }
20436 
20437 /* "View.MemoryView":575
20438  *
20439  *     @property
20440  *     def suboffsets(self):             # <<<<<<<<<<<<<<
20441  *         if self.view.suboffsets == NULL:
20442  *             return (-1,) * self.view.ndim
20443  */
20444 
20445 /* Python wrapper */
20446 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)20447 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
20448   PyObject *__pyx_r = 0;
20449   __Pyx_RefNannyDeclarations
20450   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
20451   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
20452 
20453   /* function exit code */
20454   __Pyx_RefNannyFinishContext();
20455   return __pyx_r;
20456 }
20457 
__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj * __pyx_v_self)20458 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
20459   Py_ssize_t __pyx_v_suboffset;
20460   PyObject *__pyx_r = NULL;
20461   __Pyx_RefNannyDeclarations
20462   int __pyx_t_1;
20463   PyObject *__pyx_t_2 = NULL;
20464   PyObject *__pyx_t_3 = NULL;
20465   Py_ssize_t *__pyx_t_4;
20466   Py_ssize_t *__pyx_t_5;
20467   Py_ssize_t *__pyx_t_6;
20468   int __pyx_lineno = 0;
20469   const char *__pyx_filename = NULL;
20470   int __pyx_clineno = 0;
20471   __Pyx_RefNannySetupContext("__get__", 0);
20472 
20473   /* "View.MemoryView":576
20474  *     @property
20475  *     def suboffsets(self):
20476  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
20477  *             return (-1,) * self.view.ndim
20478  *
20479  */
20480   __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
20481   if (__pyx_t_1) {
20482 
20483     /* "View.MemoryView":577
20484  *     def suboffsets(self):
20485  *         if self.view.suboffsets == NULL:
20486  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
20487  *
20488  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
20489  */
20490     __Pyx_XDECREF(__pyx_r);
20491     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error)
20492     __Pyx_GOTREF(__pyx_t_2);
20493     __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__14, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __pyx_L1_error)
20494     __Pyx_GOTREF(__pyx_t_3);
20495     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20496     __pyx_r = __pyx_t_3;
20497     __pyx_t_3 = 0;
20498     goto __pyx_L0;
20499 
20500     /* "View.MemoryView":576
20501  *     @property
20502  *     def suboffsets(self):
20503  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
20504  *             return (-1,) * self.view.ndim
20505  *
20506  */
20507   }
20508 
20509   /* "View.MemoryView":579
20510  *             return (-1,) * self.view.ndim
20511  *
20512  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
20513  *
20514  *     @property
20515  */
20516   __Pyx_XDECREF(__pyx_r);
20517   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
20518   __Pyx_GOTREF(__pyx_t_3);
20519   __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
20520   for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
20521     __pyx_t_4 = __pyx_t_6;
20522     __pyx_v_suboffset = (__pyx_t_4[0]);
20523     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
20524     __Pyx_GOTREF(__pyx_t_2);
20525     if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error)
20526     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20527   }
20528   __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
20529   __Pyx_GOTREF(__pyx_t_2);
20530   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20531   __pyx_r = __pyx_t_2;
20532   __pyx_t_2 = 0;
20533   goto __pyx_L0;
20534 
20535   /* "View.MemoryView":575
20536  *
20537  *     @property
20538  *     def suboffsets(self):             # <<<<<<<<<<<<<<
20539  *         if self.view.suboffsets == NULL:
20540  *             return (-1,) * self.view.ndim
20541  */
20542 
20543   /* function exit code */
20544   __pyx_L1_error:;
20545   __Pyx_XDECREF(__pyx_t_2);
20546   __Pyx_XDECREF(__pyx_t_3);
20547   __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20548   __pyx_r = NULL;
20549   __pyx_L0:;
20550   __Pyx_XGIVEREF(__pyx_r);
20551   __Pyx_RefNannyFinishContext();
20552   return __pyx_r;
20553 }
20554 
20555 /* "View.MemoryView":582
20556  *
20557  *     @property
20558  *     def ndim(self):             # <<<<<<<<<<<<<<
20559  *         return self.view.ndim
20560  *
20561  */
20562 
20563 /* Python wrapper */
20564 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)20565 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
20566   PyObject *__pyx_r = 0;
20567   __Pyx_RefNannyDeclarations
20568   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
20569   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
20570 
20571   /* function exit code */
20572   __Pyx_RefNannyFinishContext();
20573   return __pyx_r;
20574 }
20575 
__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj * __pyx_v_self)20576 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
20577   PyObject *__pyx_r = NULL;
20578   __Pyx_RefNannyDeclarations
20579   PyObject *__pyx_t_1 = NULL;
20580   int __pyx_lineno = 0;
20581   const char *__pyx_filename = NULL;
20582   int __pyx_clineno = 0;
20583   __Pyx_RefNannySetupContext("__get__", 0);
20584 
20585   /* "View.MemoryView":583
20586  *     @property
20587  *     def ndim(self):
20588  *         return self.view.ndim             # <<<<<<<<<<<<<<
20589  *
20590  *     @property
20591  */
20592   __Pyx_XDECREF(__pyx_r);
20593   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error)
20594   __Pyx_GOTREF(__pyx_t_1);
20595   __pyx_r = __pyx_t_1;
20596   __pyx_t_1 = 0;
20597   goto __pyx_L0;
20598 
20599   /* "View.MemoryView":582
20600  *
20601  *     @property
20602  *     def ndim(self):             # <<<<<<<<<<<<<<
20603  *         return self.view.ndim
20604  *
20605  */
20606 
20607   /* function exit code */
20608   __pyx_L1_error:;
20609   __Pyx_XDECREF(__pyx_t_1);
20610   __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20611   __pyx_r = NULL;
20612   __pyx_L0:;
20613   __Pyx_XGIVEREF(__pyx_r);
20614   __Pyx_RefNannyFinishContext();
20615   return __pyx_r;
20616 }
20617 
20618 /* "View.MemoryView":586
20619  *
20620  *     @property
20621  *     def itemsize(self):             # <<<<<<<<<<<<<<
20622  *         return self.view.itemsize
20623  *
20624  */
20625 
20626 /* Python wrapper */
20627 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)20628 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
20629   PyObject *__pyx_r = 0;
20630   __Pyx_RefNannyDeclarations
20631   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
20632   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
20633 
20634   /* function exit code */
20635   __Pyx_RefNannyFinishContext();
20636   return __pyx_r;
20637 }
20638 
__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj * __pyx_v_self)20639 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
20640   PyObject *__pyx_r = NULL;
20641   __Pyx_RefNannyDeclarations
20642   PyObject *__pyx_t_1 = NULL;
20643   int __pyx_lineno = 0;
20644   const char *__pyx_filename = NULL;
20645   int __pyx_clineno = 0;
20646   __Pyx_RefNannySetupContext("__get__", 0);
20647 
20648   /* "View.MemoryView":587
20649  *     @property
20650  *     def itemsize(self):
20651  *         return self.view.itemsize             # <<<<<<<<<<<<<<
20652  *
20653  *     @property
20654  */
20655   __Pyx_XDECREF(__pyx_r);
20656   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error)
20657   __Pyx_GOTREF(__pyx_t_1);
20658   __pyx_r = __pyx_t_1;
20659   __pyx_t_1 = 0;
20660   goto __pyx_L0;
20661 
20662   /* "View.MemoryView":586
20663  *
20664  *     @property
20665  *     def itemsize(self):             # <<<<<<<<<<<<<<
20666  *         return self.view.itemsize
20667  *
20668  */
20669 
20670   /* function exit code */
20671   __pyx_L1_error:;
20672   __Pyx_XDECREF(__pyx_t_1);
20673   __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20674   __pyx_r = NULL;
20675   __pyx_L0:;
20676   __Pyx_XGIVEREF(__pyx_r);
20677   __Pyx_RefNannyFinishContext();
20678   return __pyx_r;
20679 }
20680 
20681 /* "View.MemoryView":590
20682  *
20683  *     @property
20684  *     def nbytes(self):             # <<<<<<<<<<<<<<
20685  *         return self.size * self.view.itemsize
20686  *
20687  */
20688 
20689 /* Python wrapper */
20690 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)20691 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
20692   PyObject *__pyx_r = 0;
20693   __Pyx_RefNannyDeclarations
20694   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
20695   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
20696 
20697   /* function exit code */
20698   __Pyx_RefNannyFinishContext();
20699   return __pyx_r;
20700 }
20701 
__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj * __pyx_v_self)20702 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
20703   PyObject *__pyx_r = NULL;
20704   __Pyx_RefNannyDeclarations
20705   PyObject *__pyx_t_1 = NULL;
20706   PyObject *__pyx_t_2 = NULL;
20707   PyObject *__pyx_t_3 = NULL;
20708   int __pyx_lineno = 0;
20709   const char *__pyx_filename = NULL;
20710   int __pyx_clineno = 0;
20711   __Pyx_RefNannySetupContext("__get__", 0);
20712 
20713   /* "View.MemoryView":591
20714  *     @property
20715  *     def nbytes(self):
20716  *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
20717  *
20718  *     @property
20719  */
20720   __Pyx_XDECREF(__pyx_r);
20721   __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)
20722   __Pyx_GOTREF(__pyx_t_1);
20723   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __pyx_L1_error)
20724   __Pyx_GOTREF(__pyx_t_2);
20725   __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __pyx_L1_error)
20726   __Pyx_GOTREF(__pyx_t_3);
20727   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20728   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20729   __pyx_r = __pyx_t_3;
20730   __pyx_t_3 = 0;
20731   goto __pyx_L0;
20732 
20733   /* "View.MemoryView":590
20734  *
20735  *     @property
20736  *     def nbytes(self):             # <<<<<<<<<<<<<<
20737  *         return self.size * self.view.itemsize
20738  *
20739  */
20740 
20741   /* function exit code */
20742   __pyx_L1_error:;
20743   __Pyx_XDECREF(__pyx_t_1);
20744   __Pyx_XDECREF(__pyx_t_2);
20745   __Pyx_XDECREF(__pyx_t_3);
20746   __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20747   __pyx_r = NULL;
20748   __pyx_L0:;
20749   __Pyx_XGIVEREF(__pyx_r);
20750   __Pyx_RefNannyFinishContext();
20751   return __pyx_r;
20752 }
20753 
20754 /* "View.MemoryView":594
20755  *
20756  *     @property
20757  *     def size(self):             # <<<<<<<<<<<<<<
20758  *         if self._size is None:
20759  *             result = 1
20760  */
20761 
20762 /* Python wrapper */
20763 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)20764 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
20765   PyObject *__pyx_r = 0;
20766   __Pyx_RefNannyDeclarations
20767   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
20768   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
20769 
20770   /* function exit code */
20771   __Pyx_RefNannyFinishContext();
20772   return __pyx_r;
20773 }
20774 
__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj * __pyx_v_self)20775 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
20776   PyObject *__pyx_v_result = NULL;
20777   PyObject *__pyx_v_length = NULL;
20778   PyObject *__pyx_r = NULL;
20779   __Pyx_RefNannyDeclarations
20780   int __pyx_t_1;
20781   int __pyx_t_2;
20782   Py_ssize_t *__pyx_t_3;
20783   Py_ssize_t *__pyx_t_4;
20784   Py_ssize_t *__pyx_t_5;
20785   PyObject *__pyx_t_6 = NULL;
20786   int __pyx_lineno = 0;
20787   const char *__pyx_filename = NULL;
20788   int __pyx_clineno = 0;
20789   __Pyx_RefNannySetupContext("__get__", 0);
20790 
20791   /* "View.MemoryView":595
20792  *     @property
20793  *     def size(self):
20794  *         if self._size is None:             # <<<<<<<<<<<<<<
20795  *             result = 1
20796  *
20797  */
20798   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
20799   __pyx_t_2 = (__pyx_t_1 != 0);
20800   if (__pyx_t_2) {
20801 
20802     /* "View.MemoryView":596
20803  *     def size(self):
20804  *         if self._size is None:
20805  *             result = 1             # <<<<<<<<<<<<<<
20806  *
20807  *             for length in self.view.shape[:self.view.ndim]:
20808  */
20809     __Pyx_INCREF(__pyx_int_1);
20810     __pyx_v_result = __pyx_int_1;
20811 
20812     /* "View.MemoryView":598
20813  *             result = 1
20814  *
20815  *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
20816  *                 result *= length
20817  *
20818  */
20819     __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
20820     for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
20821       __pyx_t_3 = __pyx_t_5;
20822       __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error)
20823       __Pyx_GOTREF(__pyx_t_6);
20824       __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
20825       __pyx_t_6 = 0;
20826 
20827       /* "View.MemoryView":599
20828  *
20829  *             for length in self.view.shape[:self.view.ndim]:
20830  *                 result *= length             # <<<<<<<<<<<<<<
20831  *
20832  *             self._size = result
20833  */
20834       __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error)
20835       __Pyx_GOTREF(__pyx_t_6);
20836       __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
20837       __pyx_t_6 = 0;
20838     }
20839 
20840     /* "View.MemoryView":601
20841  *                 result *= length
20842  *
20843  *             self._size = result             # <<<<<<<<<<<<<<
20844  *
20845  *         return self._size
20846  */
20847     __Pyx_INCREF(__pyx_v_result);
20848     __Pyx_GIVEREF(__pyx_v_result);
20849     __Pyx_GOTREF(__pyx_v_self->_size);
20850     __Pyx_DECREF(__pyx_v_self->_size);
20851     __pyx_v_self->_size = __pyx_v_result;
20852 
20853     /* "View.MemoryView":595
20854  *     @property
20855  *     def size(self):
20856  *         if self._size is None:             # <<<<<<<<<<<<<<
20857  *             result = 1
20858  *
20859  */
20860   }
20861 
20862   /* "View.MemoryView":603
20863  *             self._size = result
20864  *
20865  *         return self._size             # <<<<<<<<<<<<<<
20866  *
20867  *     def __len__(self):
20868  */
20869   __Pyx_XDECREF(__pyx_r);
20870   __Pyx_INCREF(__pyx_v_self->_size);
20871   __pyx_r = __pyx_v_self->_size;
20872   goto __pyx_L0;
20873 
20874   /* "View.MemoryView":594
20875  *
20876  *     @property
20877  *     def size(self):             # <<<<<<<<<<<<<<
20878  *         if self._size is None:
20879  *             result = 1
20880  */
20881 
20882   /* function exit code */
20883   __pyx_L1_error:;
20884   __Pyx_XDECREF(__pyx_t_6);
20885   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20886   __pyx_r = NULL;
20887   __pyx_L0:;
20888   __Pyx_XDECREF(__pyx_v_result);
20889   __Pyx_XDECREF(__pyx_v_length);
20890   __Pyx_XGIVEREF(__pyx_r);
20891   __Pyx_RefNannyFinishContext();
20892   return __pyx_r;
20893 }
20894 
20895 /* "View.MemoryView":605
20896  *         return self._size
20897  *
20898  *     def __len__(self):             # <<<<<<<<<<<<<<
20899  *         if self.view.ndim >= 1:
20900  *             return self.view.shape[0]
20901  */
20902 
20903 /* Python wrapper */
20904 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___len__(PyObject * __pyx_v_self)20905 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
20906   Py_ssize_t __pyx_r;
20907   __Pyx_RefNannyDeclarations
20908   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
20909   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
20910 
20911   /* function exit code */
20912   __Pyx_RefNannyFinishContext();
20913   return __pyx_r;
20914 }
20915 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj * __pyx_v_self)20916 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
20917   Py_ssize_t __pyx_r;
20918   __Pyx_RefNannyDeclarations
20919   int __pyx_t_1;
20920   __Pyx_RefNannySetupContext("__len__", 0);
20921 
20922   /* "View.MemoryView":606
20923  *
20924  *     def __len__(self):
20925  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
20926  *             return self.view.shape[0]
20927  *
20928  */
20929   __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
20930   if (__pyx_t_1) {
20931 
20932     /* "View.MemoryView":607
20933  *     def __len__(self):
20934  *         if self.view.ndim >= 1:
20935  *             return self.view.shape[0]             # <<<<<<<<<<<<<<
20936  *
20937  *         return 0
20938  */
20939     __pyx_r = (__pyx_v_self->view.shape[0]);
20940     goto __pyx_L0;
20941 
20942     /* "View.MemoryView":606
20943  *
20944  *     def __len__(self):
20945  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
20946  *             return self.view.shape[0]
20947  *
20948  */
20949   }
20950 
20951   /* "View.MemoryView":609
20952  *             return self.view.shape[0]
20953  *
20954  *         return 0             # <<<<<<<<<<<<<<
20955  *
20956  *     def __repr__(self):
20957  */
20958   __pyx_r = 0;
20959   goto __pyx_L0;
20960 
20961   /* "View.MemoryView":605
20962  *         return self._size
20963  *
20964  *     def __len__(self):             # <<<<<<<<<<<<<<
20965  *         if self.view.ndim >= 1:
20966  *             return self.view.shape[0]
20967  */
20968 
20969   /* function exit code */
20970   __pyx_L0:;
20971   __Pyx_RefNannyFinishContext();
20972   return __pyx_r;
20973 }
20974 
20975 /* "View.MemoryView":611
20976  *         return 0
20977  *
20978  *     def __repr__(self):             # <<<<<<<<<<<<<<
20979  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
20980  *                                                id(self))
20981  */
20982 
20983 /* Python wrapper */
20984 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___repr__(PyObject * __pyx_v_self)20985 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
20986   PyObject *__pyx_r = 0;
20987   __Pyx_RefNannyDeclarations
20988   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
20989   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
20990 
20991   /* function exit code */
20992   __Pyx_RefNannyFinishContext();
20993   return __pyx_r;
20994 }
20995 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj * __pyx_v_self)20996 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
20997   PyObject *__pyx_r = NULL;
20998   __Pyx_RefNannyDeclarations
20999   PyObject *__pyx_t_1 = NULL;
21000   PyObject *__pyx_t_2 = NULL;
21001   PyObject *__pyx_t_3 = NULL;
21002   int __pyx_lineno = 0;
21003   const char *__pyx_filename = NULL;
21004   int __pyx_clineno = 0;
21005   __Pyx_RefNannySetupContext("__repr__", 0);
21006 
21007   /* "View.MemoryView":612
21008  *
21009  *     def __repr__(self):
21010  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
21011  *                                                id(self))
21012  *
21013  */
21014   __Pyx_XDECREF(__pyx_r);
21015   __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)
21016   __Pyx_GOTREF(__pyx_t_1);
21017   __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)
21018   __Pyx_GOTREF(__pyx_t_2);
21019   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21020   __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)
21021   __Pyx_GOTREF(__pyx_t_1);
21022   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21023 
21024   /* "View.MemoryView":613
21025  *     def __repr__(self):
21026  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
21027  *                                                id(self))             # <<<<<<<<<<<<<<
21028  *
21029  *     def __str__(self):
21030  */
21031   __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)
21032   __Pyx_GOTREF(__pyx_t_2);
21033 
21034   /* "View.MemoryView":612
21035  *
21036  *     def __repr__(self):
21037  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
21038  *                                                id(self))
21039  *
21040  */
21041   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error)
21042   __Pyx_GOTREF(__pyx_t_3);
21043   __Pyx_GIVEREF(__pyx_t_1);
21044   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
21045   __Pyx_GIVEREF(__pyx_t_2);
21046   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
21047   __pyx_t_1 = 0;
21048   __pyx_t_2 = 0;
21049   __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)
21050   __Pyx_GOTREF(__pyx_t_2);
21051   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21052   __pyx_r = __pyx_t_2;
21053   __pyx_t_2 = 0;
21054   goto __pyx_L0;
21055 
21056   /* "View.MemoryView":611
21057  *         return 0
21058  *
21059  *     def __repr__(self):             # <<<<<<<<<<<<<<
21060  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
21061  *                                                id(self))
21062  */
21063 
21064   /* function exit code */
21065   __pyx_L1_error:;
21066   __Pyx_XDECREF(__pyx_t_1);
21067   __Pyx_XDECREF(__pyx_t_2);
21068   __Pyx_XDECREF(__pyx_t_3);
21069   __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21070   __pyx_r = NULL;
21071   __pyx_L0:;
21072   __Pyx_XGIVEREF(__pyx_r);
21073   __Pyx_RefNannyFinishContext();
21074   return __pyx_r;
21075 }
21076 
21077 /* "View.MemoryView":615
21078  *                                                id(self))
21079  *
21080  *     def __str__(self):             # <<<<<<<<<<<<<<
21081  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
21082  *
21083  */
21084 
21085 /* Python wrapper */
21086 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___str__(PyObject * __pyx_v_self)21087 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
21088   PyObject *__pyx_r = 0;
21089   __Pyx_RefNannyDeclarations
21090   __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
21091   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
21092 
21093   /* function exit code */
21094   __Pyx_RefNannyFinishContext();
21095   return __pyx_r;
21096 }
21097 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj * __pyx_v_self)21098 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
21099   PyObject *__pyx_r = NULL;
21100   __Pyx_RefNannyDeclarations
21101   PyObject *__pyx_t_1 = NULL;
21102   PyObject *__pyx_t_2 = NULL;
21103   int __pyx_lineno = 0;
21104   const char *__pyx_filename = NULL;
21105   int __pyx_clineno = 0;
21106   __Pyx_RefNannySetupContext("__str__", 0);
21107 
21108   /* "View.MemoryView":616
21109  *
21110  *     def __str__(self):
21111  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
21112  *
21113  *
21114  */
21115   __Pyx_XDECREF(__pyx_r);
21116   __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)
21117   __Pyx_GOTREF(__pyx_t_1);
21118   __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)
21119   __Pyx_GOTREF(__pyx_t_2);
21120   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21121   __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)
21122   __Pyx_GOTREF(__pyx_t_1);
21123   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21124   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
21125   __Pyx_GOTREF(__pyx_t_2);
21126   __Pyx_GIVEREF(__pyx_t_1);
21127   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
21128   __pyx_t_1 = 0;
21129   __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)
21130   __Pyx_GOTREF(__pyx_t_1);
21131   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21132   __pyx_r = __pyx_t_1;
21133   __pyx_t_1 = 0;
21134   goto __pyx_L0;
21135 
21136   /* "View.MemoryView":615
21137  *                                                id(self))
21138  *
21139  *     def __str__(self):             # <<<<<<<<<<<<<<
21140  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
21141  *
21142  */
21143 
21144   /* function exit code */
21145   __pyx_L1_error:;
21146   __Pyx_XDECREF(__pyx_t_1);
21147   __Pyx_XDECREF(__pyx_t_2);
21148   __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21149   __pyx_r = NULL;
21150   __pyx_L0:;
21151   __Pyx_XGIVEREF(__pyx_r);
21152   __Pyx_RefNannyFinishContext();
21153   return __pyx_r;
21154 }
21155 
21156 /* "View.MemoryView":619
21157  *
21158  *
21159  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
21160  *         cdef __Pyx_memviewslice *mslice
21161  *         cdef __Pyx_memviewslice tmp
21162  */
21163 
21164 /* Python wrapper */
21165 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)21166 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
21167   PyObject *__pyx_r = 0;
21168   __Pyx_RefNannyDeclarations
21169   __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
21170   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
21171 
21172   /* function exit code */
21173   __Pyx_RefNannyFinishContext();
21174   return __pyx_r;
21175 }
21176 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj * __pyx_v_self)21177 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
21178   __Pyx_memviewslice *__pyx_v_mslice;
21179   __Pyx_memviewslice __pyx_v_tmp;
21180   PyObject *__pyx_r = NULL;
21181   __Pyx_RefNannyDeclarations
21182   __Pyx_memviewslice *__pyx_t_1;
21183   PyObject *__pyx_t_2 = NULL;
21184   int __pyx_lineno = 0;
21185   const char *__pyx_filename = NULL;
21186   int __pyx_clineno = 0;
21187   __Pyx_RefNannySetupContext("is_c_contig", 0);
21188 
21189   /* "View.MemoryView":622
21190  *         cdef __Pyx_memviewslice *mslice
21191  *         cdef __Pyx_memviewslice tmp
21192  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
21193  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
21194  *
21195  */
21196   __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)
21197   __pyx_v_mslice = __pyx_t_1;
21198 
21199   /* "View.MemoryView":623
21200  *         cdef __Pyx_memviewslice tmp
21201  *         mslice = get_slice_from_memview(self, &tmp)
21202  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
21203  *
21204  *     def is_f_contig(self):
21205  */
21206   __Pyx_XDECREF(__pyx_r);
21207   __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)
21208   __Pyx_GOTREF(__pyx_t_2);
21209   __pyx_r = __pyx_t_2;
21210   __pyx_t_2 = 0;
21211   goto __pyx_L0;
21212 
21213   /* "View.MemoryView":619
21214  *
21215  *
21216  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
21217  *         cdef __Pyx_memviewslice *mslice
21218  *         cdef __Pyx_memviewslice tmp
21219  */
21220 
21221   /* function exit code */
21222   __pyx_L1_error:;
21223   __Pyx_XDECREF(__pyx_t_2);
21224   __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
21225   __pyx_r = NULL;
21226   __pyx_L0:;
21227   __Pyx_XGIVEREF(__pyx_r);
21228   __Pyx_RefNannyFinishContext();
21229   return __pyx_r;
21230 }
21231 
21232 /* "View.MemoryView":625
21233  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
21234  *
21235  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
21236  *         cdef __Pyx_memviewslice *mslice
21237  *         cdef __Pyx_memviewslice tmp
21238  */
21239 
21240 /* Python wrapper */
21241 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)21242 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
21243   PyObject *__pyx_r = 0;
21244   __Pyx_RefNannyDeclarations
21245   __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
21246   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
21247 
21248   /* function exit code */
21249   __Pyx_RefNannyFinishContext();
21250   return __pyx_r;
21251 }
21252 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj * __pyx_v_self)21253 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
21254   __Pyx_memviewslice *__pyx_v_mslice;
21255   __Pyx_memviewslice __pyx_v_tmp;
21256   PyObject *__pyx_r = NULL;
21257   __Pyx_RefNannyDeclarations
21258   __Pyx_memviewslice *__pyx_t_1;
21259   PyObject *__pyx_t_2 = NULL;
21260   int __pyx_lineno = 0;
21261   const char *__pyx_filename = NULL;
21262   int __pyx_clineno = 0;
21263   __Pyx_RefNannySetupContext("is_f_contig", 0);
21264 
21265   /* "View.MemoryView":628
21266  *         cdef __Pyx_memviewslice *mslice
21267  *         cdef __Pyx_memviewslice tmp
21268  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
21269  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
21270  *
21271  */
21272   __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)
21273   __pyx_v_mslice = __pyx_t_1;
21274 
21275   /* "View.MemoryView":629
21276  *         cdef __Pyx_memviewslice tmp
21277  *         mslice = get_slice_from_memview(self, &tmp)
21278  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
21279  *
21280  *     def copy(self):
21281  */
21282   __Pyx_XDECREF(__pyx_r);
21283   __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)
21284   __Pyx_GOTREF(__pyx_t_2);
21285   __pyx_r = __pyx_t_2;
21286   __pyx_t_2 = 0;
21287   goto __pyx_L0;
21288 
21289   /* "View.MemoryView":625
21290  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
21291  *
21292  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
21293  *         cdef __Pyx_memviewslice *mslice
21294  *         cdef __Pyx_memviewslice tmp
21295  */
21296 
21297   /* function exit code */
21298   __pyx_L1_error:;
21299   __Pyx_XDECREF(__pyx_t_2);
21300   __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
21301   __pyx_r = NULL;
21302   __pyx_L0:;
21303   __Pyx_XGIVEREF(__pyx_r);
21304   __Pyx_RefNannyFinishContext();
21305   return __pyx_r;
21306 }
21307 
21308 /* "View.MemoryView":631
21309  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
21310  *
21311  *     def copy(self):             # <<<<<<<<<<<<<<
21312  *         cdef __Pyx_memviewslice mslice
21313  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
21314  */
21315 
21316 /* Python wrapper */
21317 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)21318 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
21319   PyObject *__pyx_r = 0;
21320   __Pyx_RefNannyDeclarations
21321   __Pyx_RefNannySetupContext("copy (wrapper)", 0);
21322   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
21323 
21324   /* function exit code */
21325   __Pyx_RefNannyFinishContext();
21326   return __pyx_r;
21327 }
21328 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj * __pyx_v_self)21329 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
21330   __Pyx_memviewslice __pyx_v_mslice;
21331   int __pyx_v_flags;
21332   PyObject *__pyx_r = NULL;
21333   __Pyx_RefNannyDeclarations
21334   __Pyx_memviewslice __pyx_t_1;
21335   PyObject *__pyx_t_2 = NULL;
21336   int __pyx_lineno = 0;
21337   const char *__pyx_filename = NULL;
21338   int __pyx_clineno = 0;
21339   __Pyx_RefNannySetupContext("copy", 0);
21340 
21341   /* "View.MemoryView":633
21342  *     def copy(self):
21343  *         cdef __Pyx_memviewslice mslice
21344  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
21345  *
21346  *         slice_copy(self, &mslice)
21347  */
21348   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
21349 
21350   /* "View.MemoryView":635
21351  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
21352  *
21353  *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
21354  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
21355  *                                    self.view.itemsize,
21356  */
21357   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
21358 
21359   /* "View.MemoryView":636
21360  *
21361  *         slice_copy(self, &mslice)
21362  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
21363  *                                    self.view.itemsize,
21364  *                                    flags|PyBUF_C_CONTIGUOUS,
21365  */
21366   __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)
21367   __pyx_v_mslice = __pyx_t_1;
21368 
21369   /* "View.MemoryView":641
21370  *                                    self.dtype_is_object)
21371  *
21372  *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
21373  *
21374  *     def copy_fortran(self):
21375  */
21376   __Pyx_XDECREF(__pyx_r);
21377   __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)
21378   __Pyx_GOTREF(__pyx_t_2);
21379   __pyx_r = __pyx_t_2;
21380   __pyx_t_2 = 0;
21381   goto __pyx_L0;
21382 
21383   /* "View.MemoryView":631
21384  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
21385  *
21386  *     def copy(self):             # <<<<<<<<<<<<<<
21387  *         cdef __Pyx_memviewslice mslice
21388  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
21389  */
21390 
21391   /* function exit code */
21392   __pyx_L1_error:;
21393   __Pyx_XDECREF(__pyx_t_2);
21394   __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
21395   __pyx_r = NULL;
21396   __pyx_L0:;
21397   __Pyx_XGIVEREF(__pyx_r);
21398   __Pyx_RefNannyFinishContext();
21399   return __pyx_r;
21400 }
21401 
21402 /* "View.MemoryView":643
21403  *         return memoryview_copy_from_slice(self, &mslice)
21404  *
21405  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
21406  *         cdef __Pyx_memviewslice src, dst
21407  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
21408  */
21409 
21410 /* Python wrapper */
21411 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)21412 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
21413   PyObject *__pyx_r = 0;
21414   __Pyx_RefNannyDeclarations
21415   __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
21416   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
21417 
21418   /* function exit code */
21419   __Pyx_RefNannyFinishContext();
21420   return __pyx_r;
21421 }
21422 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj * __pyx_v_self)21423 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
21424   __Pyx_memviewslice __pyx_v_src;
21425   __Pyx_memviewslice __pyx_v_dst;
21426   int __pyx_v_flags;
21427   PyObject *__pyx_r = NULL;
21428   __Pyx_RefNannyDeclarations
21429   __Pyx_memviewslice __pyx_t_1;
21430   PyObject *__pyx_t_2 = NULL;
21431   int __pyx_lineno = 0;
21432   const char *__pyx_filename = NULL;
21433   int __pyx_clineno = 0;
21434   __Pyx_RefNannySetupContext("copy_fortran", 0);
21435 
21436   /* "View.MemoryView":645
21437  *     def copy_fortran(self):
21438  *         cdef __Pyx_memviewslice src, dst
21439  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
21440  *
21441  *         slice_copy(self, &src)
21442  */
21443   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
21444 
21445   /* "View.MemoryView":647
21446  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
21447  *
21448  *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
21449  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
21450  *                                 self.view.itemsize,
21451  */
21452   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
21453 
21454   /* "View.MemoryView":648
21455  *
21456  *         slice_copy(self, &src)
21457  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
21458  *                                 self.view.itemsize,
21459  *                                 flags|PyBUF_F_CONTIGUOUS,
21460  */
21461   __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)
21462   __pyx_v_dst = __pyx_t_1;
21463 
21464   /* "View.MemoryView":653
21465  *                                 self.dtype_is_object)
21466  *
21467  *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
21468  *
21469  *
21470  */
21471   __Pyx_XDECREF(__pyx_r);
21472   __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)
21473   __Pyx_GOTREF(__pyx_t_2);
21474   __pyx_r = __pyx_t_2;
21475   __pyx_t_2 = 0;
21476   goto __pyx_L0;
21477 
21478   /* "View.MemoryView":643
21479  *         return memoryview_copy_from_slice(self, &mslice)
21480  *
21481  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
21482  *         cdef __Pyx_memviewslice src, dst
21483  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
21484  */
21485 
21486   /* function exit code */
21487   __pyx_L1_error:;
21488   __Pyx_XDECREF(__pyx_t_2);
21489   __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
21490   __pyx_r = NULL;
21491   __pyx_L0:;
21492   __Pyx_XGIVEREF(__pyx_r);
21493   __Pyx_RefNannyFinishContext();
21494   return __pyx_r;
21495 }
21496 
21497 /* "(tree fragment)":1
21498  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
21499  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21500  * def __setstate_cython__(self, __pyx_state):
21501  */
21502 
21503 /* Python wrapper */
21504 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)21505 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
21506   PyObject *__pyx_r = 0;
21507   __Pyx_RefNannyDeclarations
21508   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
21509   __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
21510 
21511   /* function exit code */
21512   __Pyx_RefNannyFinishContext();
21513   return __pyx_r;
21514 }
21515 
__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self)21516 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
21517   PyObject *__pyx_r = NULL;
21518   __Pyx_RefNannyDeclarations
21519   PyObject *__pyx_t_1 = NULL;
21520   int __pyx_lineno = 0;
21521   const char *__pyx_filename = NULL;
21522   int __pyx_clineno = 0;
21523   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
21524 
21525   /* "(tree fragment)":2
21526  * def __reduce_cython__(self):
21527  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21528  * def __setstate_cython__(self, __pyx_state):
21529  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21530  */
21531   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
21532   __Pyx_GOTREF(__pyx_t_1);
21533   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
21534   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21535   __PYX_ERR(2, 2, __pyx_L1_error)
21536 
21537   /* "(tree fragment)":1
21538  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
21539  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21540  * def __setstate_cython__(self, __pyx_state):
21541  */
21542 
21543   /* function exit code */
21544   __pyx_L1_error:;
21545   __Pyx_XDECREF(__pyx_t_1);
21546   __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21547   __pyx_r = NULL;
21548   __Pyx_XGIVEREF(__pyx_r);
21549   __Pyx_RefNannyFinishContext();
21550   return __pyx_r;
21551 }
21552 
21553 /* "(tree fragment)":3
21554  * def __reduce_cython__(self):
21555  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21556  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
21557  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21558  */
21559 
21560 /* Python wrapper */
21561 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)21562 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
21563   PyObject *__pyx_r = 0;
21564   __Pyx_RefNannyDeclarations
21565   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
21566   __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
21567 
21568   /* function exit code */
21569   __Pyx_RefNannyFinishContext();
21570   return __pyx_r;
21571 }
21572 
__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)21573 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) {
21574   PyObject *__pyx_r = NULL;
21575   __Pyx_RefNannyDeclarations
21576   PyObject *__pyx_t_1 = NULL;
21577   int __pyx_lineno = 0;
21578   const char *__pyx_filename = NULL;
21579   int __pyx_clineno = 0;
21580   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
21581 
21582   /* "(tree fragment)":4
21583  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21584  * def __setstate_cython__(self, __pyx_state):
21585  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21586  */
21587   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
21588   __Pyx_GOTREF(__pyx_t_1);
21589   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
21590   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21591   __PYX_ERR(2, 4, __pyx_L1_error)
21592 
21593   /* "(tree fragment)":3
21594  * def __reduce_cython__(self):
21595  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21596  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
21597  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21598  */
21599 
21600   /* function exit code */
21601   __pyx_L1_error:;
21602   __Pyx_XDECREF(__pyx_t_1);
21603   __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21604   __pyx_r = NULL;
21605   __Pyx_XGIVEREF(__pyx_r);
21606   __Pyx_RefNannyFinishContext();
21607   return __pyx_r;
21608 }
21609 
21610 /* "View.MemoryView":657
21611  *
21612  * @cname('__pyx_memoryview_new')
21613  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
21614  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
21615  *     result.typeinfo = typeinfo
21616  */
21617 
__pyx_memoryview_new(PyObject * __pyx_v_o,int __pyx_v_flags,int __pyx_v_dtype_is_object,__Pyx_TypeInfo * __pyx_v_typeinfo)21618 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
21619   struct __pyx_memoryview_obj *__pyx_v_result = 0;
21620   PyObject *__pyx_r = NULL;
21621   __Pyx_RefNannyDeclarations
21622   PyObject *__pyx_t_1 = NULL;
21623   PyObject *__pyx_t_2 = NULL;
21624   PyObject *__pyx_t_3 = NULL;
21625   int __pyx_lineno = 0;
21626   const char *__pyx_filename = NULL;
21627   int __pyx_clineno = 0;
21628   __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
21629 
21630   /* "View.MemoryView":658
21631  * @cname('__pyx_memoryview_new')
21632  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
21633  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
21634  *     result.typeinfo = typeinfo
21635  *     return result
21636  */
21637   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error)
21638   __Pyx_GOTREF(__pyx_t_1);
21639   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
21640   __Pyx_GOTREF(__pyx_t_2);
21641   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error)
21642   __Pyx_GOTREF(__pyx_t_3);
21643   __Pyx_INCREF(__pyx_v_o);
21644   __Pyx_GIVEREF(__pyx_v_o);
21645   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
21646   __Pyx_GIVEREF(__pyx_t_1);
21647   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
21648   __Pyx_GIVEREF(__pyx_t_2);
21649   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
21650   __pyx_t_1 = 0;
21651   __pyx_t_2 = 0;
21652   __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)
21653   __Pyx_GOTREF(__pyx_t_2);
21654   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21655   __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
21656   __pyx_t_2 = 0;
21657 
21658   /* "View.MemoryView":659
21659  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
21660  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
21661  *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
21662  *     return result
21663  *
21664  */
21665   __pyx_v_result->typeinfo = __pyx_v_typeinfo;
21666 
21667   /* "View.MemoryView":660
21668  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
21669  *     result.typeinfo = typeinfo
21670  *     return result             # <<<<<<<<<<<<<<
21671  *
21672  * @cname('__pyx_memoryview_check')
21673  */
21674   __Pyx_XDECREF(__pyx_r);
21675   __Pyx_INCREF(((PyObject *)__pyx_v_result));
21676   __pyx_r = ((PyObject *)__pyx_v_result);
21677   goto __pyx_L0;
21678 
21679   /* "View.MemoryView":657
21680  *
21681  * @cname('__pyx_memoryview_new')
21682  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
21683  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
21684  *     result.typeinfo = typeinfo
21685  */
21686 
21687   /* function exit code */
21688   __pyx_L1_error:;
21689   __Pyx_XDECREF(__pyx_t_1);
21690   __Pyx_XDECREF(__pyx_t_2);
21691   __Pyx_XDECREF(__pyx_t_3);
21692   __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
21693   __pyx_r = 0;
21694   __pyx_L0:;
21695   __Pyx_XDECREF((PyObject *)__pyx_v_result);
21696   __Pyx_XGIVEREF(__pyx_r);
21697   __Pyx_RefNannyFinishContext();
21698   return __pyx_r;
21699 }
21700 
21701 /* "View.MemoryView":663
21702  *
21703  * @cname('__pyx_memoryview_check')
21704  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
21705  *     return isinstance(o, memoryview)
21706  *
21707  */
21708 
__pyx_memoryview_check(PyObject * __pyx_v_o)21709 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
21710   int __pyx_r;
21711   __Pyx_RefNannyDeclarations
21712   int __pyx_t_1;
21713   __Pyx_RefNannySetupContext("memoryview_check", 0);
21714 
21715   /* "View.MemoryView":664
21716  * @cname('__pyx_memoryview_check')
21717  * cdef inline bint memoryview_check(object o):
21718  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
21719  *
21720  * cdef tuple _unellipsify(object index, int ndim):
21721  */
21722   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
21723   __pyx_r = __pyx_t_1;
21724   goto __pyx_L0;
21725 
21726   /* "View.MemoryView":663
21727  *
21728  * @cname('__pyx_memoryview_check')
21729  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
21730  *     return isinstance(o, memoryview)
21731  *
21732  */
21733 
21734   /* function exit code */
21735   __pyx_L0:;
21736   __Pyx_RefNannyFinishContext();
21737   return __pyx_r;
21738 }
21739 
21740 /* "View.MemoryView":666
21741  *     return isinstance(o, memoryview)
21742  *
21743  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
21744  *     """
21745  *     Replace all ellipses with full slices and fill incomplete indices with
21746  */
21747 
_unellipsify(PyObject * __pyx_v_index,int __pyx_v_ndim)21748 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
21749   PyObject *__pyx_v_tup = NULL;
21750   PyObject *__pyx_v_result = NULL;
21751   int __pyx_v_have_slices;
21752   int __pyx_v_seen_ellipsis;
21753   CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
21754   PyObject *__pyx_v_item = NULL;
21755   Py_ssize_t __pyx_v_nslices;
21756   PyObject *__pyx_r = NULL;
21757   __Pyx_RefNannyDeclarations
21758   int __pyx_t_1;
21759   int __pyx_t_2;
21760   PyObject *__pyx_t_3 = NULL;
21761   PyObject *__pyx_t_4 = NULL;
21762   Py_ssize_t __pyx_t_5;
21763   PyObject *(*__pyx_t_6)(PyObject *);
21764   PyObject *__pyx_t_7 = NULL;
21765   Py_ssize_t __pyx_t_8;
21766   int __pyx_t_9;
21767   int __pyx_t_10;
21768   PyObject *__pyx_t_11 = NULL;
21769   int __pyx_lineno = 0;
21770   const char *__pyx_filename = NULL;
21771   int __pyx_clineno = 0;
21772   __Pyx_RefNannySetupContext("_unellipsify", 0);
21773 
21774   /* "View.MemoryView":671
21775  *     full slices.
21776  *     """
21777  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
21778  *         tup = (index,)
21779  *     else:
21780  */
21781   __pyx_t_1 = PyTuple_Check(__pyx_v_index);
21782   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
21783   if (__pyx_t_2) {
21784 
21785     /* "View.MemoryView":672
21786  *     """
21787  *     if not isinstance(index, tuple):
21788  *         tup = (index,)             # <<<<<<<<<<<<<<
21789  *     else:
21790  *         tup = index
21791  */
21792     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error)
21793     __Pyx_GOTREF(__pyx_t_3);
21794     __Pyx_INCREF(__pyx_v_index);
21795     __Pyx_GIVEREF(__pyx_v_index);
21796     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
21797     __pyx_v_tup = __pyx_t_3;
21798     __pyx_t_3 = 0;
21799 
21800     /* "View.MemoryView":671
21801  *     full slices.
21802  *     """
21803  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
21804  *         tup = (index,)
21805  *     else:
21806  */
21807     goto __pyx_L3;
21808   }
21809 
21810   /* "View.MemoryView":674
21811  *         tup = (index,)
21812  *     else:
21813  *         tup = index             # <<<<<<<<<<<<<<
21814  *
21815  *     result = []
21816  */
21817   /*else*/ {
21818     __Pyx_INCREF(__pyx_v_index);
21819     __pyx_v_tup = __pyx_v_index;
21820   }
21821   __pyx_L3:;
21822 
21823   /* "View.MemoryView":676
21824  *         tup = index
21825  *
21826  *     result = []             # <<<<<<<<<<<<<<
21827  *     have_slices = False
21828  *     seen_ellipsis = False
21829  */
21830   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error)
21831   __Pyx_GOTREF(__pyx_t_3);
21832   __pyx_v_result = ((PyObject*)__pyx_t_3);
21833   __pyx_t_3 = 0;
21834 
21835   /* "View.MemoryView":677
21836  *
21837  *     result = []
21838  *     have_slices = False             # <<<<<<<<<<<<<<
21839  *     seen_ellipsis = False
21840  *     for idx, item in enumerate(tup):
21841  */
21842   __pyx_v_have_slices = 0;
21843 
21844   /* "View.MemoryView":678
21845  *     result = []
21846  *     have_slices = False
21847  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
21848  *     for idx, item in enumerate(tup):
21849  *         if item is Ellipsis:
21850  */
21851   __pyx_v_seen_ellipsis = 0;
21852 
21853   /* "View.MemoryView":679
21854  *     have_slices = False
21855  *     seen_ellipsis = False
21856  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
21857  *         if item is Ellipsis:
21858  *             if not seen_ellipsis:
21859  */
21860   __Pyx_INCREF(__pyx_int_0);
21861   __pyx_t_3 = __pyx_int_0;
21862   if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
21863     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
21864     __pyx_t_6 = NULL;
21865   } else {
21866     __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error)
21867     __Pyx_GOTREF(__pyx_t_4);
21868     __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error)
21869   }
21870   for (;;) {
21871     if (likely(!__pyx_t_6)) {
21872       if (likely(PyList_CheckExact(__pyx_t_4))) {
21873         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
21874         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
21875         __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)
21876         #else
21877         __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)
21878         __Pyx_GOTREF(__pyx_t_7);
21879         #endif
21880       } else {
21881         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
21882         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
21883         __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)
21884         #else
21885         __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)
21886         __Pyx_GOTREF(__pyx_t_7);
21887         #endif
21888       }
21889     } else {
21890       __pyx_t_7 = __pyx_t_6(__pyx_t_4);
21891       if (unlikely(!__pyx_t_7)) {
21892         PyObject* exc_type = PyErr_Occurred();
21893         if (exc_type) {
21894           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
21895           else __PYX_ERR(2, 679, __pyx_L1_error)
21896         }
21897         break;
21898       }
21899       __Pyx_GOTREF(__pyx_t_7);
21900     }
21901     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
21902     __pyx_t_7 = 0;
21903     __Pyx_INCREF(__pyx_t_3);
21904     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
21905     __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)
21906     __Pyx_GOTREF(__pyx_t_7);
21907     __Pyx_DECREF(__pyx_t_3);
21908     __pyx_t_3 = __pyx_t_7;
21909     __pyx_t_7 = 0;
21910 
21911     /* "View.MemoryView":680
21912  *     seen_ellipsis = False
21913  *     for idx, item in enumerate(tup):
21914  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
21915  *             if not seen_ellipsis:
21916  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
21917  */
21918     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
21919     __pyx_t_1 = (__pyx_t_2 != 0);
21920     if (__pyx_t_1) {
21921 
21922       /* "View.MemoryView":681
21923  *     for idx, item in enumerate(tup):
21924  *         if item is Ellipsis:
21925  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
21926  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
21927  *                 seen_ellipsis = True
21928  */
21929       __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
21930       if (__pyx_t_1) {
21931 
21932         /* "View.MemoryView":682
21933  *         if item is Ellipsis:
21934  *             if not seen_ellipsis:
21935  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
21936  *                 seen_ellipsis = True
21937  *             else:
21938  */
21939         __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
21940         __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)
21941         __Pyx_GOTREF(__pyx_t_7);
21942         { Py_ssize_t __pyx_temp;
21943           for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
21944             __Pyx_INCREF(__pyx_slice__17);
21945             __Pyx_GIVEREF(__pyx_slice__17);
21946             PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__17);
21947           }
21948         }
21949         __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)
21950         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
21951 
21952         /* "View.MemoryView":683
21953  *             if not seen_ellipsis:
21954  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
21955  *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
21956  *             else:
21957  *                 result.append(slice(None))
21958  */
21959         __pyx_v_seen_ellipsis = 1;
21960 
21961         /* "View.MemoryView":681
21962  *     for idx, item in enumerate(tup):
21963  *         if item is Ellipsis:
21964  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
21965  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
21966  *                 seen_ellipsis = True
21967  */
21968         goto __pyx_L7;
21969       }
21970 
21971       /* "View.MemoryView":685
21972  *                 seen_ellipsis = True
21973  *             else:
21974  *                 result.append(slice(None))             # <<<<<<<<<<<<<<
21975  *             have_slices = True
21976  *         else:
21977  */
21978       /*else*/ {
21979         __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__17); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 685, __pyx_L1_error)
21980       }
21981       __pyx_L7:;
21982 
21983       /* "View.MemoryView":686
21984  *             else:
21985  *                 result.append(slice(None))
21986  *             have_slices = True             # <<<<<<<<<<<<<<
21987  *         else:
21988  *             if not isinstance(item, slice) and not PyIndex_Check(item):
21989  */
21990       __pyx_v_have_slices = 1;
21991 
21992       /* "View.MemoryView":680
21993  *     seen_ellipsis = False
21994  *     for idx, item in enumerate(tup):
21995  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
21996  *             if not seen_ellipsis:
21997  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
21998  */
21999       goto __pyx_L6;
22000     }
22001 
22002     /* "View.MemoryView":688
22003  *             have_slices = True
22004  *         else:
22005  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
22006  *                 raise TypeError("Cannot index with type '%s'" % type(item))
22007  *
22008  */
22009     /*else*/ {
22010       __pyx_t_2 = PySlice_Check(__pyx_v_item);
22011       __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
22012       if (__pyx_t_10) {
22013       } else {
22014         __pyx_t_1 = __pyx_t_10;
22015         goto __pyx_L9_bool_binop_done;
22016       }
22017       __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
22018       __pyx_t_1 = __pyx_t_10;
22019       __pyx_L9_bool_binop_done:;
22020       if (unlikely(__pyx_t_1)) {
22021 
22022         /* "View.MemoryView":689
22023  *         else:
22024  *             if not isinstance(item, slice) and not PyIndex_Check(item):
22025  *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
22026  *
22027  *             have_slices = have_slices or isinstance(item, slice)
22028  */
22029         __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)
22030         __Pyx_GOTREF(__pyx_t_7);
22031         __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error)
22032         __Pyx_GOTREF(__pyx_t_11);
22033         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
22034         __Pyx_Raise(__pyx_t_11, 0, 0, 0);
22035         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
22036         __PYX_ERR(2, 689, __pyx_L1_error)
22037 
22038         /* "View.MemoryView":688
22039  *             have_slices = True
22040  *         else:
22041  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
22042  *                 raise TypeError("Cannot index with type '%s'" % type(item))
22043  *
22044  */
22045       }
22046 
22047       /* "View.MemoryView":691
22048  *                 raise TypeError("Cannot index with type '%s'" % type(item))
22049  *
22050  *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
22051  *             result.append(item)
22052  *
22053  */
22054       __pyx_t_10 = (__pyx_v_have_slices != 0);
22055       if (!__pyx_t_10) {
22056       } else {
22057         __pyx_t_1 = __pyx_t_10;
22058         goto __pyx_L11_bool_binop_done;
22059       }
22060       __pyx_t_10 = PySlice_Check(__pyx_v_item);
22061       __pyx_t_2 = (__pyx_t_10 != 0);
22062       __pyx_t_1 = __pyx_t_2;
22063       __pyx_L11_bool_binop_done:;
22064       __pyx_v_have_slices = __pyx_t_1;
22065 
22066       /* "View.MemoryView":692
22067  *
22068  *             have_slices = have_slices or isinstance(item, slice)
22069  *             result.append(item)             # <<<<<<<<<<<<<<
22070  *
22071  *     nslices = ndim - len(result)
22072  */
22073       __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)
22074     }
22075     __pyx_L6:;
22076 
22077     /* "View.MemoryView":679
22078  *     have_slices = False
22079  *     seen_ellipsis = False
22080  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
22081  *         if item is Ellipsis:
22082  *             if not seen_ellipsis:
22083  */
22084   }
22085   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22086   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22087 
22088   /* "View.MemoryView":694
22089  *             result.append(item)
22090  *
22091  *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
22092  *     if nslices:
22093  *         result.extend([slice(None)] * nslices)
22094  */
22095   __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)
22096   __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
22097 
22098   /* "View.MemoryView":695
22099  *
22100  *     nslices = ndim - len(result)
22101  *     if nslices:             # <<<<<<<<<<<<<<
22102  *         result.extend([slice(None)] * nslices)
22103  *
22104  */
22105   __pyx_t_1 = (__pyx_v_nslices != 0);
22106   if (__pyx_t_1) {
22107 
22108     /* "View.MemoryView":696
22109  *     nslices = ndim - len(result)
22110  *     if nslices:
22111  *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
22112  *
22113  *     return have_slices or nslices, tuple(result)
22114  */
22115     __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)
22116     __Pyx_GOTREF(__pyx_t_3);
22117     { Py_ssize_t __pyx_temp;
22118       for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
22119         __Pyx_INCREF(__pyx_slice__17);
22120         __Pyx_GIVEREF(__pyx_slice__17);
22121         PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__17);
22122       }
22123     }
22124     __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)
22125     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22126 
22127     /* "View.MemoryView":695
22128  *
22129  *     nslices = ndim - len(result)
22130  *     if nslices:             # <<<<<<<<<<<<<<
22131  *         result.extend([slice(None)] * nslices)
22132  *
22133  */
22134   }
22135 
22136   /* "View.MemoryView":698
22137  *         result.extend([slice(None)] * nslices)
22138  *
22139  *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
22140  *
22141  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
22142  */
22143   __Pyx_XDECREF(__pyx_r);
22144   if (!__pyx_v_have_slices) {
22145   } else {
22146     __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
22147     __Pyx_GOTREF(__pyx_t_4);
22148     __pyx_t_3 = __pyx_t_4;
22149     __pyx_t_4 = 0;
22150     goto __pyx_L14_bool_binop_done;
22151   }
22152   __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
22153   __Pyx_GOTREF(__pyx_t_4);
22154   __pyx_t_3 = __pyx_t_4;
22155   __pyx_t_4 = 0;
22156   __pyx_L14_bool_binop_done:;
22157   __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
22158   __Pyx_GOTREF(__pyx_t_4);
22159   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error)
22160   __Pyx_GOTREF(__pyx_t_11);
22161   __Pyx_GIVEREF(__pyx_t_3);
22162   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
22163   __Pyx_GIVEREF(__pyx_t_4);
22164   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
22165   __pyx_t_3 = 0;
22166   __pyx_t_4 = 0;
22167   __pyx_r = ((PyObject*)__pyx_t_11);
22168   __pyx_t_11 = 0;
22169   goto __pyx_L0;
22170 
22171   /* "View.MemoryView":666
22172  *     return isinstance(o, memoryview)
22173  *
22174  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
22175  *     """
22176  *     Replace all ellipses with full slices and fill incomplete indices with
22177  */
22178 
22179   /* function exit code */
22180   __pyx_L1_error:;
22181   __Pyx_XDECREF(__pyx_t_3);
22182   __Pyx_XDECREF(__pyx_t_4);
22183   __Pyx_XDECREF(__pyx_t_7);
22184   __Pyx_XDECREF(__pyx_t_11);
22185   __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
22186   __pyx_r = 0;
22187   __pyx_L0:;
22188   __Pyx_XDECREF(__pyx_v_tup);
22189   __Pyx_XDECREF(__pyx_v_result);
22190   __Pyx_XDECREF(__pyx_v_idx);
22191   __Pyx_XDECREF(__pyx_v_item);
22192   __Pyx_XGIVEREF(__pyx_r);
22193   __Pyx_RefNannyFinishContext();
22194   return __pyx_r;
22195 }
22196 
22197 /* "View.MemoryView":700
22198  *     return have_slices or nslices, tuple(result)
22199  *
22200  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
22201  *     for suboffset in suboffsets[:ndim]:
22202  *         if suboffset >= 0:
22203  */
22204 
assert_direct_dimensions(Py_ssize_t * __pyx_v_suboffsets,int __pyx_v_ndim)22205 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
22206   Py_ssize_t __pyx_v_suboffset;
22207   PyObject *__pyx_r = NULL;
22208   __Pyx_RefNannyDeclarations
22209   Py_ssize_t *__pyx_t_1;
22210   Py_ssize_t *__pyx_t_2;
22211   Py_ssize_t *__pyx_t_3;
22212   int __pyx_t_4;
22213   PyObject *__pyx_t_5 = NULL;
22214   int __pyx_lineno = 0;
22215   const char *__pyx_filename = NULL;
22216   int __pyx_clineno = 0;
22217   __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
22218 
22219   /* "View.MemoryView":701
22220  *
22221  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
22222  *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
22223  *         if suboffset >= 0:
22224  *             raise ValueError("Indirect dimensions not supported")
22225  */
22226   __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
22227   for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
22228     __pyx_t_1 = __pyx_t_3;
22229     __pyx_v_suboffset = (__pyx_t_1[0]);
22230 
22231     /* "View.MemoryView":702
22232  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
22233  *     for suboffset in suboffsets[:ndim]:
22234  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
22235  *             raise ValueError("Indirect dimensions not supported")
22236  *
22237  */
22238     __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
22239     if (unlikely(__pyx_t_4)) {
22240 
22241       /* "View.MemoryView":703
22242  *     for suboffset in suboffsets[:ndim]:
22243  *         if suboffset >= 0:
22244  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
22245  *
22246  *
22247  */
22248       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 703, __pyx_L1_error)
22249       __Pyx_GOTREF(__pyx_t_5);
22250       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
22251       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22252       __PYX_ERR(2, 703, __pyx_L1_error)
22253 
22254       /* "View.MemoryView":702
22255  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
22256  *     for suboffset in suboffsets[:ndim]:
22257  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
22258  *             raise ValueError("Indirect dimensions not supported")
22259  *
22260  */
22261     }
22262   }
22263 
22264   /* "View.MemoryView":700
22265  *     return have_slices or nslices, tuple(result)
22266  *
22267  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
22268  *     for suboffset in suboffsets[:ndim]:
22269  *         if suboffset >= 0:
22270  */
22271 
22272   /* function exit code */
22273   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22274   goto __pyx_L0;
22275   __pyx_L1_error:;
22276   __Pyx_XDECREF(__pyx_t_5);
22277   __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
22278   __pyx_r = 0;
22279   __pyx_L0:;
22280   __Pyx_XGIVEREF(__pyx_r);
22281   __Pyx_RefNannyFinishContext();
22282   return __pyx_r;
22283 }
22284 
22285 /* "View.MemoryView":710
22286  *
22287  * @cname('__pyx_memview_slice')
22288  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
22289  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
22290  *     cdef bint negative_step
22291  */
22292 
__pyx_memview_slice(struct __pyx_memoryview_obj * __pyx_v_memview,PyObject * __pyx_v_indices)22293 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
22294   int __pyx_v_new_ndim;
22295   int __pyx_v_suboffset_dim;
22296   int __pyx_v_dim;
22297   __Pyx_memviewslice __pyx_v_src;
22298   __Pyx_memviewslice __pyx_v_dst;
22299   __Pyx_memviewslice *__pyx_v_p_src;
22300   struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
22301   __Pyx_memviewslice *__pyx_v_p_dst;
22302   int *__pyx_v_p_suboffset_dim;
22303   Py_ssize_t __pyx_v_start;
22304   Py_ssize_t __pyx_v_stop;
22305   Py_ssize_t __pyx_v_step;
22306   int __pyx_v_have_start;
22307   int __pyx_v_have_stop;
22308   int __pyx_v_have_step;
22309   PyObject *__pyx_v_index = NULL;
22310   struct __pyx_memoryview_obj *__pyx_r = NULL;
22311   __Pyx_RefNannyDeclarations
22312   int __pyx_t_1;
22313   int __pyx_t_2;
22314   PyObject *__pyx_t_3 = NULL;
22315   struct __pyx_memoryview_obj *__pyx_t_4;
22316   char *__pyx_t_5;
22317   int __pyx_t_6;
22318   Py_ssize_t __pyx_t_7;
22319   PyObject *(*__pyx_t_8)(PyObject *);
22320   PyObject *__pyx_t_9 = NULL;
22321   Py_ssize_t __pyx_t_10;
22322   int __pyx_t_11;
22323   Py_ssize_t __pyx_t_12;
22324   int __pyx_lineno = 0;
22325   const char *__pyx_filename = NULL;
22326   int __pyx_clineno = 0;
22327   __Pyx_RefNannySetupContext("memview_slice", 0);
22328 
22329   /* "View.MemoryView":711
22330  * @cname('__pyx_memview_slice')
22331  * cdef memoryview memview_slice(memoryview memview, object indices):
22332  *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
22333  *     cdef bint negative_step
22334  *     cdef __Pyx_memviewslice src, dst
22335  */
22336   __pyx_v_new_ndim = 0;
22337   __pyx_v_suboffset_dim = -1;
22338 
22339   /* "View.MemoryView":718
22340  *
22341  *
22342  *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
22343  *
22344  *     cdef _memoryviewslice memviewsliceobj
22345  */
22346   (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
22347 
22348   /* "View.MemoryView":722
22349  *     cdef _memoryviewslice memviewsliceobj
22350  *
22351  *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
22352  *
22353  *     if isinstance(memview, _memoryviewslice):
22354  */
22355   #ifndef CYTHON_WITHOUT_ASSERTIONS
22356   if (unlikely(!Py_OptimizeFlag)) {
22357     if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
22358       PyErr_SetNone(PyExc_AssertionError);
22359       __PYX_ERR(2, 722, __pyx_L1_error)
22360     }
22361   }
22362   #endif
22363 
22364   /* "View.MemoryView":724
22365  *     assert memview.view.ndim > 0
22366  *
22367  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
22368  *         memviewsliceobj = memview
22369  *         p_src = &memviewsliceobj.from_slice
22370  */
22371   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
22372   __pyx_t_2 = (__pyx_t_1 != 0);
22373   if (__pyx_t_2) {
22374 
22375     /* "View.MemoryView":725
22376  *
22377  *     if isinstance(memview, _memoryviewslice):
22378  *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
22379  *         p_src = &memviewsliceobj.from_slice
22380  *     else:
22381  */
22382     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)
22383     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
22384     __Pyx_INCREF(__pyx_t_3);
22385     __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
22386     __pyx_t_3 = 0;
22387 
22388     /* "View.MemoryView":726
22389  *     if isinstance(memview, _memoryviewslice):
22390  *         memviewsliceobj = memview
22391  *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
22392  *     else:
22393  *         slice_copy(memview, &src)
22394  */
22395     __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
22396 
22397     /* "View.MemoryView":724
22398  *     assert memview.view.ndim > 0
22399  *
22400  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
22401  *         memviewsliceobj = memview
22402  *         p_src = &memviewsliceobj.from_slice
22403  */
22404     goto __pyx_L3;
22405   }
22406 
22407   /* "View.MemoryView":728
22408  *         p_src = &memviewsliceobj.from_slice
22409  *     else:
22410  *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
22411  *         p_src = &src
22412  *
22413  */
22414   /*else*/ {
22415     __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
22416 
22417     /* "View.MemoryView":729
22418  *     else:
22419  *         slice_copy(memview, &src)
22420  *         p_src = &src             # <<<<<<<<<<<<<<
22421  *
22422  *
22423  */
22424     __pyx_v_p_src = (&__pyx_v_src);
22425   }
22426   __pyx_L3:;
22427 
22428   /* "View.MemoryView":735
22429  *
22430  *
22431  *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
22432  *     dst.data = p_src.data
22433  *
22434  */
22435   __pyx_t_4 = __pyx_v_p_src->memview;
22436   __pyx_v_dst.memview = __pyx_t_4;
22437 
22438   /* "View.MemoryView":736
22439  *
22440  *     dst.memview = p_src.memview
22441  *     dst.data = p_src.data             # <<<<<<<<<<<<<<
22442  *
22443  *
22444  */
22445   __pyx_t_5 = __pyx_v_p_src->data;
22446   __pyx_v_dst.data = __pyx_t_5;
22447 
22448   /* "View.MemoryView":741
22449  *
22450  *
22451  *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
22452  *     cdef int *p_suboffset_dim = &suboffset_dim
22453  *     cdef Py_ssize_t start, stop, step
22454  */
22455   __pyx_v_p_dst = (&__pyx_v_dst);
22456 
22457   /* "View.MemoryView":742
22458  *
22459  *     cdef __Pyx_memviewslice *p_dst = &dst
22460  *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
22461  *     cdef Py_ssize_t start, stop, step
22462  *     cdef bint have_start, have_stop, have_step
22463  */
22464   __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
22465 
22466   /* "View.MemoryView":746
22467  *     cdef bint have_start, have_stop, have_step
22468  *
22469  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
22470  *         if PyIndex_Check(index):
22471  *             slice_memviewslice(
22472  */
22473   __pyx_t_6 = 0;
22474   if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
22475     __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
22476     __pyx_t_8 = NULL;
22477   } else {
22478     __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error)
22479     __Pyx_GOTREF(__pyx_t_3);
22480     __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error)
22481   }
22482   for (;;) {
22483     if (likely(!__pyx_t_8)) {
22484       if (likely(PyList_CheckExact(__pyx_t_3))) {
22485         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
22486         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22487         __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)
22488         #else
22489         __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)
22490         __Pyx_GOTREF(__pyx_t_9);
22491         #endif
22492       } else {
22493         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
22494         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22495         __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)
22496         #else
22497         __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)
22498         __Pyx_GOTREF(__pyx_t_9);
22499         #endif
22500       }
22501     } else {
22502       __pyx_t_9 = __pyx_t_8(__pyx_t_3);
22503       if (unlikely(!__pyx_t_9)) {
22504         PyObject* exc_type = PyErr_Occurred();
22505         if (exc_type) {
22506           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
22507           else __PYX_ERR(2, 746, __pyx_L1_error)
22508         }
22509         break;
22510       }
22511       __Pyx_GOTREF(__pyx_t_9);
22512     }
22513     __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
22514     __pyx_t_9 = 0;
22515     __pyx_v_dim = __pyx_t_6;
22516     __pyx_t_6 = (__pyx_t_6 + 1);
22517 
22518     /* "View.MemoryView":747
22519  *
22520  *     for dim, index in enumerate(indices):
22521  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
22522  *             slice_memviewslice(
22523  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
22524  */
22525     __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
22526     if (__pyx_t_2) {
22527 
22528       /* "View.MemoryView":751
22529  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
22530  *                 dim, new_ndim, p_suboffset_dim,
22531  *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
22532  *                 0, 0, 0, # have_{start,stop,step}
22533  *                 False)
22534  */
22535       __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)
22536 
22537       /* "View.MemoryView":748
22538  *     for dim, index in enumerate(indices):
22539  *         if PyIndex_Check(index):
22540  *             slice_memviewslice(             # <<<<<<<<<<<<<<
22541  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
22542  *                 dim, new_ndim, p_suboffset_dim,
22543  */
22544       __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)
22545 
22546       /* "View.MemoryView":747
22547  *
22548  *     for dim, index in enumerate(indices):
22549  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
22550  *             slice_memviewslice(
22551  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
22552  */
22553       goto __pyx_L6;
22554     }
22555 
22556     /* "View.MemoryView":754
22557  *                 0, 0, 0, # have_{start,stop,step}
22558  *                 False)
22559  *         elif index is None:             # <<<<<<<<<<<<<<
22560  *             p_dst.shape[new_ndim] = 1
22561  *             p_dst.strides[new_ndim] = 0
22562  */
22563     __pyx_t_2 = (__pyx_v_index == Py_None);
22564     __pyx_t_1 = (__pyx_t_2 != 0);
22565     if (__pyx_t_1) {
22566 
22567       /* "View.MemoryView":755
22568  *                 False)
22569  *         elif index is None:
22570  *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
22571  *             p_dst.strides[new_ndim] = 0
22572  *             p_dst.suboffsets[new_ndim] = -1
22573  */
22574       (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
22575 
22576       /* "View.MemoryView":756
22577  *         elif index is None:
22578  *             p_dst.shape[new_ndim] = 1
22579  *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
22580  *             p_dst.suboffsets[new_ndim] = -1
22581  *             new_ndim += 1
22582  */
22583       (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
22584 
22585       /* "View.MemoryView":757
22586  *             p_dst.shape[new_ndim] = 1
22587  *             p_dst.strides[new_ndim] = 0
22588  *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
22589  *             new_ndim += 1
22590  *         else:
22591  */
22592       (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
22593 
22594       /* "View.MemoryView":758
22595  *             p_dst.strides[new_ndim] = 0
22596  *             p_dst.suboffsets[new_ndim] = -1
22597  *             new_ndim += 1             # <<<<<<<<<<<<<<
22598  *         else:
22599  *             start = index.start or 0
22600  */
22601       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
22602 
22603       /* "View.MemoryView":754
22604  *                 0, 0, 0, # have_{start,stop,step}
22605  *                 False)
22606  *         elif index is None:             # <<<<<<<<<<<<<<
22607  *             p_dst.shape[new_ndim] = 1
22608  *             p_dst.strides[new_ndim] = 0
22609  */
22610       goto __pyx_L6;
22611     }
22612 
22613     /* "View.MemoryView":760
22614  *             new_ndim += 1
22615  *         else:
22616  *             start = index.start or 0             # <<<<<<<<<<<<<<
22617  *             stop = index.stop or 0
22618  *             step = index.step or 0
22619  */
22620     /*else*/ {
22621       __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)
22622       __Pyx_GOTREF(__pyx_t_9);
22623       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error)
22624       if (!__pyx_t_1) {
22625         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
22626       } else {
22627         __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)
22628         __pyx_t_10 = __pyx_t_12;
22629         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
22630         goto __pyx_L7_bool_binop_done;
22631       }
22632       __pyx_t_10 = 0;
22633       __pyx_L7_bool_binop_done:;
22634       __pyx_v_start = __pyx_t_10;
22635 
22636       /* "View.MemoryView":761
22637  *         else:
22638  *             start = index.start or 0
22639  *             stop = index.stop or 0             # <<<<<<<<<<<<<<
22640  *             step = index.step or 0
22641  *
22642  */
22643       __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)
22644       __Pyx_GOTREF(__pyx_t_9);
22645       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error)
22646       if (!__pyx_t_1) {
22647         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
22648       } else {
22649         __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)
22650         __pyx_t_10 = __pyx_t_12;
22651         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
22652         goto __pyx_L9_bool_binop_done;
22653       }
22654       __pyx_t_10 = 0;
22655       __pyx_L9_bool_binop_done:;
22656       __pyx_v_stop = __pyx_t_10;
22657 
22658       /* "View.MemoryView":762
22659  *             start = index.start or 0
22660  *             stop = index.stop or 0
22661  *             step = index.step or 0             # <<<<<<<<<<<<<<
22662  *
22663  *             have_start = index.start is not None
22664  */
22665       __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)
22666       __Pyx_GOTREF(__pyx_t_9);
22667       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
22668       if (!__pyx_t_1) {
22669         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
22670       } else {
22671         __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)
22672         __pyx_t_10 = __pyx_t_12;
22673         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
22674         goto __pyx_L11_bool_binop_done;
22675       }
22676       __pyx_t_10 = 0;
22677       __pyx_L11_bool_binop_done:;
22678       __pyx_v_step = __pyx_t_10;
22679 
22680       /* "View.MemoryView":764
22681  *             step = index.step or 0
22682  *
22683  *             have_start = index.start is not None             # <<<<<<<<<<<<<<
22684  *             have_stop = index.stop is not None
22685  *             have_step = index.step is not None
22686  */
22687       __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)
22688       __Pyx_GOTREF(__pyx_t_9);
22689       __pyx_t_1 = (__pyx_t_9 != Py_None);
22690       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
22691       __pyx_v_have_start = __pyx_t_1;
22692 
22693       /* "View.MemoryView":765
22694  *
22695  *             have_start = index.start is not None
22696  *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
22697  *             have_step = index.step is not None
22698  *
22699  */
22700       __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)
22701       __Pyx_GOTREF(__pyx_t_9);
22702       __pyx_t_1 = (__pyx_t_9 != Py_None);
22703       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
22704       __pyx_v_have_stop = __pyx_t_1;
22705 
22706       /* "View.MemoryView":766
22707  *             have_start = index.start is not None
22708  *             have_stop = index.stop is not None
22709  *             have_step = index.step is not None             # <<<<<<<<<<<<<<
22710  *
22711  *             slice_memviewslice(
22712  */
22713       __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)
22714       __Pyx_GOTREF(__pyx_t_9);
22715       __pyx_t_1 = (__pyx_t_9 != Py_None);
22716       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
22717       __pyx_v_have_step = __pyx_t_1;
22718 
22719       /* "View.MemoryView":768
22720  *             have_step = index.step is not None
22721  *
22722  *             slice_memviewslice(             # <<<<<<<<<<<<<<
22723  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
22724  *                 dim, new_ndim, p_suboffset_dim,
22725  */
22726       __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)
22727 
22728       /* "View.MemoryView":774
22729  *                 have_start, have_stop, have_step,
22730  *                 True)
22731  *             new_ndim += 1             # <<<<<<<<<<<<<<
22732  *
22733  *     if isinstance(memview, _memoryviewslice):
22734  */
22735       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
22736     }
22737     __pyx_L6:;
22738 
22739     /* "View.MemoryView":746
22740  *     cdef bint have_start, have_stop, have_step
22741  *
22742  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
22743  *         if PyIndex_Check(index):
22744  *             slice_memviewslice(
22745  */
22746   }
22747   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22748 
22749   /* "View.MemoryView":776
22750  *             new_ndim += 1
22751  *
22752  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
22753  *         return memoryview_fromslice(dst, new_ndim,
22754  *                                     memviewsliceobj.to_object_func,
22755  */
22756   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
22757   __pyx_t_2 = (__pyx_t_1 != 0);
22758   if (__pyx_t_2) {
22759 
22760     /* "View.MemoryView":777
22761  *
22762  *     if isinstance(memview, _memoryviewslice):
22763  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
22764  *                                     memviewsliceobj.to_object_func,
22765  *                                     memviewsliceobj.to_dtype_func,
22766  */
22767     __Pyx_XDECREF(((PyObject *)__pyx_r));
22768 
22769     /* "View.MemoryView":778
22770  *     if isinstance(memview, _memoryviewslice):
22771  *         return memoryview_fromslice(dst, new_ndim,
22772  *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
22773  *                                     memviewsliceobj.to_dtype_func,
22774  *                                     memview.dtype_is_object)
22775  */
22776     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) }
22777 
22778     /* "View.MemoryView":779
22779  *         return memoryview_fromslice(dst, new_ndim,
22780  *                                     memviewsliceobj.to_object_func,
22781  *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
22782  *                                     memview.dtype_is_object)
22783  *     else:
22784  */
22785     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) }
22786 
22787     /* "View.MemoryView":777
22788  *
22789  *     if isinstance(memview, _memoryviewslice):
22790  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
22791  *                                     memviewsliceobj.to_object_func,
22792  *                                     memviewsliceobj.to_dtype_func,
22793  */
22794     __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)
22795     __Pyx_GOTREF(__pyx_t_3);
22796     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error)
22797     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
22798     __pyx_t_3 = 0;
22799     goto __pyx_L0;
22800 
22801     /* "View.MemoryView":776
22802  *             new_ndim += 1
22803  *
22804  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
22805  *         return memoryview_fromslice(dst, new_ndim,
22806  *                                     memviewsliceobj.to_object_func,
22807  */
22808   }
22809 
22810   /* "View.MemoryView":782
22811  *                                     memview.dtype_is_object)
22812  *     else:
22813  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
22814  *                                     memview.dtype_is_object)
22815  *
22816  */
22817   /*else*/ {
22818     __Pyx_XDECREF(((PyObject *)__pyx_r));
22819 
22820     /* "View.MemoryView":783
22821  *     else:
22822  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
22823  *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
22824  *
22825  *
22826  */
22827     __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)
22828     __Pyx_GOTREF(__pyx_t_3);
22829 
22830     /* "View.MemoryView":782
22831  *                                     memview.dtype_is_object)
22832  *     else:
22833  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
22834  *                                     memview.dtype_is_object)
22835  *
22836  */
22837     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error)
22838     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
22839     __pyx_t_3 = 0;
22840     goto __pyx_L0;
22841   }
22842 
22843   /* "View.MemoryView":710
22844  *
22845  * @cname('__pyx_memview_slice')
22846  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
22847  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
22848  *     cdef bint negative_step
22849  */
22850 
22851   /* function exit code */
22852   __pyx_L1_error:;
22853   __Pyx_XDECREF(__pyx_t_3);
22854   __Pyx_XDECREF(__pyx_t_9);
22855   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
22856   __pyx_r = 0;
22857   __pyx_L0:;
22858   __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
22859   __Pyx_XDECREF(__pyx_v_index);
22860   __Pyx_XGIVEREF((PyObject *)__pyx_r);
22861   __Pyx_RefNannyFinishContext();
22862   return __pyx_r;
22863 }
22864 
22865 /* "View.MemoryView":807
22866  *
22867  * @cname('__pyx_memoryview_slice_memviewslice')
22868  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
22869  *         __Pyx_memviewslice *dst,
22870  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
22871  */
22872 
__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)22873 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) {
22874   Py_ssize_t __pyx_v_new_shape;
22875   int __pyx_v_negative_step;
22876   int __pyx_r;
22877   int __pyx_t_1;
22878   int __pyx_t_2;
22879   int __pyx_t_3;
22880   int __pyx_lineno = 0;
22881   const char *__pyx_filename = NULL;
22882   int __pyx_clineno = 0;
22883 
22884   /* "View.MemoryView":827
22885  *     cdef bint negative_step
22886  *
22887  *     if not is_slice:             # <<<<<<<<<<<<<<
22888  *
22889  *         if start < 0:
22890  */
22891   __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
22892   if (__pyx_t_1) {
22893 
22894     /* "View.MemoryView":829
22895  *     if not is_slice:
22896  *
22897  *         if start < 0:             # <<<<<<<<<<<<<<
22898  *             start += shape
22899  *         if not 0 <= start < shape:
22900  */
22901     __pyx_t_1 = ((__pyx_v_start < 0) != 0);
22902     if (__pyx_t_1) {
22903 
22904       /* "View.MemoryView":830
22905  *
22906  *         if start < 0:
22907  *             start += shape             # <<<<<<<<<<<<<<
22908  *         if not 0 <= start < shape:
22909  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
22910  */
22911       __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
22912 
22913       /* "View.MemoryView":829
22914  *     if not is_slice:
22915  *
22916  *         if start < 0:             # <<<<<<<<<<<<<<
22917  *             start += shape
22918  *         if not 0 <= start < shape:
22919  */
22920     }
22921 
22922     /* "View.MemoryView":831
22923  *         if start < 0:
22924  *             start += shape
22925  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
22926  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
22927  *     else:
22928  */
22929     __pyx_t_1 = (0 <= __pyx_v_start);
22930     if (__pyx_t_1) {
22931       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
22932     }
22933     __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
22934     if (__pyx_t_2) {
22935 
22936       /* "View.MemoryView":832
22937  *             start += shape
22938  *         if not 0 <= start < shape:
22939  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
22940  *     else:
22941  *
22942  */
22943       __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)
22944 
22945       /* "View.MemoryView":831
22946  *         if start < 0:
22947  *             start += shape
22948  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
22949  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
22950  *     else:
22951  */
22952     }
22953 
22954     /* "View.MemoryView":827
22955  *     cdef bint negative_step
22956  *
22957  *     if not is_slice:             # <<<<<<<<<<<<<<
22958  *
22959  *         if start < 0:
22960  */
22961     goto __pyx_L3;
22962   }
22963 
22964   /* "View.MemoryView":835
22965  *     else:
22966  *
22967  *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
22968  *
22969  *         if have_step and step == 0:
22970  */
22971   /*else*/ {
22972     __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
22973     if (__pyx_t_1) {
22974     } else {
22975       __pyx_t_2 = __pyx_t_1;
22976       goto __pyx_L6_bool_binop_done;
22977     }
22978     __pyx_t_1 = ((__pyx_v_step < 0) != 0);
22979     __pyx_t_2 = __pyx_t_1;
22980     __pyx_L6_bool_binop_done:;
22981     __pyx_v_negative_step = __pyx_t_2;
22982 
22983     /* "View.MemoryView":837
22984  *         negative_step = have_step != 0 and step < 0
22985  *
22986  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
22987  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
22988  *
22989  */
22990     __pyx_t_1 = (__pyx_v_have_step != 0);
22991     if (__pyx_t_1) {
22992     } else {
22993       __pyx_t_2 = __pyx_t_1;
22994       goto __pyx_L9_bool_binop_done;
22995     }
22996     __pyx_t_1 = ((__pyx_v_step == 0) != 0);
22997     __pyx_t_2 = __pyx_t_1;
22998     __pyx_L9_bool_binop_done:;
22999     if (__pyx_t_2) {
23000 
23001       /* "View.MemoryView":838
23002  *
23003  *         if have_step and step == 0:
23004  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
23005  *
23006  *
23007  */
23008       __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)
23009 
23010       /* "View.MemoryView":837
23011  *         negative_step = have_step != 0 and step < 0
23012  *
23013  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
23014  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
23015  *
23016  */
23017     }
23018 
23019     /* "View.MemoryView":841
23020  *
23021  *
23022  *         if have_start:             # <<<<<<<<<<<<<<
23023  *             if start < 0:
23024  *                 start += shape
23025  */
23026     __pyx_t_2 = (__pyx_v_have_start != 0);
23027     if (__pyx_t_2) {
23028 
23029       /* "View.MemoryView":842
23030  *
23031  *         if have_start:
23032  *             if start < 0:             # <<<<<<<<<<<<<<
23033  *                 start += shape
23034  *                 if start < 0:
23035  */
23036       __pyx_t_2 = ((__pyx_v_start < 0) != 0);
23037       if (__pyx_t_2) {
23038 
23039         /* "View.MemoryView":843
23040  *         if have_start:
23041  *             if start < 0:
23042  *                 start += shape             # <<<<<<<<<<<<<<
23043  *                 if start < 0:
23044  *                     start = 0
23045  */
23046         __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
23047 
23048         /* "View.MemoryView":844
23049  *             if start < 0:
23050  *                 start += shape
23051  *                 if start < 0:             # <<<<<<<<<<<<<<
23052  *                     start = 0
23053  *             elif start >= shape:
23054  */
23055         __pyx_t_2 = ((__pyx_v_start < 0) != 0);
23056         if (__pyx_t_2) {
23057 
23058           /* "View.MemoryView":845
23059  *                 start += shape
23060  *                 if start < 0:
23061  *                     start = 0             # <<<<<<<<<<<<<<
23062  *             elif start >= shape:
23063  *                 if negative_step:
23064  */
23065           __pyx_v_start = 0;
23066 
23067           /* "View.MemoryView":844
23068  *             if start < 0:
23069  *                 start += shape
23070  *                 if start < 0:             # <<<<<<<<<<<<<<
23071  *                     start = 0
23072  *             elif start >= shape:
23073  */
23074         }
23075 
23076         /* "View.MemoryView":842
23077  *
23078  *         if have_start:
23079  *             if start < 0:             # <<<<<<<<<<<<<<
23080  *                 start += shape
23081  *                 if start < 0:
23082  */
23083         goto __pyx_L12;
23084       }
23085 
23086       /* "View.MemoryView":846
23087  *                 if start < 0:
23088  *                     start = 0
23089  *             elif start >= shape:             # <<<<<<<<<<<<<<
23090  *                 if negative_step:
23091  *                     start = shape - 1
23092  */
23093       __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
23094       if (__pyx_t_2) {
23095 
23096         /* "View.MemoryView":847
23097  *                     start = 0
23098  *             elif start >= shape:
23099  *                 if negative_step:             # <<<<<<<<<<<<<<
23100  *                     start = shape - 1
23101  *                 else:
23102  */
23103         __pyx_t_2 = (__pyx_v_negative_step != 0);
23104         if (__pyx_t_2) {
23105 
23106           /* "View.MemoryView":848
23107  *             elif start >= shape:
23108  *                 if negative_step:
23109  *                     start = shape - 1             # <<<<<<<<<<<<<<
23110  *                 else:
23111  *                     start = shape
23112  */
23113           __pyx_v_start = (__pyx_v_shape - 1);
23114 
23115           /* "View.MemoryView":847
23116  *                     start = 0
23117  *             elif start >= shape:
23118  *                 if negative_step:             # <<<<<<<<<<<<<<
23119  *                     start = shape - 1
23120  *                 else:
23121  */
23122           goto __pyx_L14;
23123         }
23124 
23125         /* "View.MemoryView":850
23126  *                     start = shape - 1
23127  *                 else:
23128  *                     start = shape             # <<<<<<<<<<<<<<
23129  *         else:
23130  *             if negative_step:
23131  */
23132         /*else*/ {
23133           __pyx_v_start = __pyx_v_shape;
23134         }
23135         __pyx_L14:;
23136 
23137         /* "View.MemoryView":846
23138  *                 if start < 0:
23139  *                     start = 0
23140  *             elif start >= shape:             # <<<<<<<<<<<<<<
23141  *                 if negative_step:
23142  *                     start = shape - 1
23143  */
23144       }
23145       __pyx_L12:;
23146 
23147       /* "View.MemoryView":841
23148  *
23149  *
23150  *         if have_start:             # <<<<<<<<<<<<<<
23151  *             if start < 0:
23152  *                 start += shape
23153  */
23154       goto __pyx_L11;
23155     }
23156 
23157     /* "View.MemoryView":852
23158  *                     start = shape
23159  *         else:
23160  *             if negative_step:             # <<<<<<<<<<<<<<
23161  *                 start = shape - 1
23162  *             else:
23163  */
23164     /*else*/ {
23165       __pyx_t_2 = (__pyx_v_negative_step != 0);
23166       if (__pyx_t_2) {
23167 
23168         /* "View.MemoryView":853
23169  *         else:
23170  *             if negative_step:
23171  *                 start = shape - 1             # <<<<<<<<<<<<<<
23172  *             else:
23173  *                 start = 0
23174  */
23175         __pyx_v_start = (__pyx_v_shape - 1);
23176 
23177         /* "View.MemoryView":852
23178  *                     start = shape
23179  *         else:
23180  *             if negative_step:             # <<<<<<<<<<<<<<
23181  *                 start = shape - 1
23182  *             else:
23183  */
23184         goto __pyx_L15;
23185       }
23186 
23187       /* "View.MemoryView":855
23188  *                 start = shape - 1
23189  *             else:
23190  *                 start = 0             # <<<<<<<<<<<<<<
23191  *
23192  *         if have_stop:
23193  */
23194       /*else*/ {
23195         __pyx_v_start = 0;
23196       }
23197       __pyx_L15:;
23198     }
23199     __pyx_L11:;
23200 
23201     /* "View.MemoryView":857
23202  *                 start = 0
23203  *
23204  *         if have_stop:             # <<<<<<<<<<<<<<
23205  *             if stop < 0:
23206  *                 stop += shape
23207  */
23208     __pyx_t_2 = (__pyx_v_have_stop != 0);
23209     if (__pyx_t_2) {
23210 
23211       /* "View.MemoryView":858
23212  *
23213  *         if have_stop:
23214  *             if stop < 0:             # <<<<<<<<<<<<<<
23215  *                 stop += shape
23216  *                 if stop < 0:
23217  */
23218       __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
23219       if (__pyx_t_2) {
23220 
23221         /* "View.MemoryView":859
23222  *         if have_stop:
23223  *             if stop < 0:
23224  *                 stop += shape             # <<<<<<<<<<<<<<
23225  *                 if stop < 0:
23226  *                     stop = 0
23227  */
23228         __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
23229 
23230         /* "View.MemoryView":860
23231  *             if stop < 0:
23232  *                 stop += shape
23233  *                 if stop < 0:             # <<<<<<<<<<<<<<
23234  *                     stop = 0
23235  *             elif stop > shape:
23236  */
23237         __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
23238         if (__pyx_t_2) {
23239 
23240           /* "View.MemoryView":861
23241  *                 stop += shape
23242  *                 if stop < 0:
23243  *                     stop = 0             # <<<<<<<<<<<<<<
23244  *             elif stop > shape:
23245  *                 stop = shape
23246  */
23247           __pyx_v_stop = 0;
23248 
23249           /* "View.MemoryView":860
23250  *             if stop < 0:
23251  *                 stop += shape
23252  *                 if stop < 0:             # <<<<<<<<<<<<<<
23253  *                     stop = 0
23254  *             elif stop > shape:
23255  */
23256         }
23257 
23258         /* "View.MemoryView":858
23259  *
23260  *         if have_stop:
23261  *             if stop < 0:             # <<<<<<<<<<<<<<
23262  *                 stop += shape
23263  *                 if stop < 0:
23264  */
23265         goto __pyx_L17;
23266       }
23267 
23268       /* "View.MemoryView":862
23269  *                 if stop < 0:
23270  *                     stop = 0
23271  *             elif stop > shape:             # <<<<<<<<<<<<<<
23272  *                 stop = shape
23273  *         else:
23274  */
23275       __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
23276       if (__pyx_t_2) {
23277 
23278         /* "View.MemoryView":863
23279  *                     stop = 0
23280  *             elif stop > shape:
23281  *                 stop = shape             # <<<<<<<<<<<<<<
23282  *         else:
23283  *             if negative_step:
23284  */
23285         __pyx_v_stop = __pyx_v_shape;
23286 
23287         /* "View.MemoryView":862
23288  *                 if stop < 0:
23289  *                     stop = 0
23290  *             elif stop > shape:             # <<<<<<<<<<<<<<
23291  *                 stop = shape
23292  *         else:
23293  */
23294       }
23295       __pyx_L17:;
23296 
23297       /* "View.MemoryView":857
23298  *                 start = 0
23299  *
23300  *         if have_stop:             # <<<<<<<<<<<<<<
23301  *             if stop < 0:
23302  *                 stop += shape
23303  */
23304       goto __pyx_L16;
23305     }
23306 
23307     /* "View.MemoryView":865
23308  *                 stop = shape
23309  *         else:
23310  *             if negative_step:             # <<<<<<<<<<<<<<
23311  *                 stop = -1
23312  *             else:
23313  */
23314     /*else*/ {
23315       __pyx_t_2 = (__pyx_v_negative_step != 0);
23316       if (__pyx_t_2) {
23317 
23318         /* "View.MemoryView":866
23319  *         else:
23320  *             if negative_step:
23321  *                 stop = -1             # <<<<<<<<<<<<<<
23322  *             else:
23323  *                 stop = shape
23324  */
23325         __pyx_v_stop = -1L;
23326 
23327         /* "View.MemoryView":865
23328  *                 stop = shape
23329  *         else:
23330  *             if negative_step:             # <<<<<<<<<<<<<<
23331  *                 stop = -1
23332  *             else:
23333  */
23334         goto __pyx_L19;
23335       }
23336 
23337       /* "View.MemoryView":868
23338  *                 stop = -1
23339  *             else:
23340  *                 stop = shape             # <<<<<<<<<<<<<<
23341  *
23342  *         if not have_step:
23343  */
23344       /*else*/ {
23345         __pyx_v_stop = __pyx_v_shape;
23346       }
23347       __pyx_L19:;
23348     }
23349     __pyx_L16:;
23350 
23351     /* "View.MemoryView":870
23352  *                 stop = shape
23353  *
23354  *         if not have_step:             # <<<<<<<<<<<<<<
23355  *             step = 1
23356  *
23357  */
23358     __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
23359     if (__pyx_t_2) {
23360 
23361       /* "View.MemoryView":871
23362  *
23363  *         if not have_step:
23364  *             step = 1             # <<<<<<<<<<<<<<
23365  *
23366  *
23367  */
23368       __pyx_v_step = 1;
23369 
23370       /* "View.MemoryView":870
23371  *                 stop = shape
23372  *
23373  *         if not have_step:             # <<<<<<<<<<<<<<
23374  *             step = 1
23375  *
23376  */
23377     }
23378 
23379     /* "View.MemoryView":875
23380  *
23381  *         with cython.cdivision(True):
23382  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
23383  *
23384  *             if (stop - start) - step * new_shape:
23385  */
23386     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
23387 
23388     /* "View.MemoryView":877
23389  *             new_shape = (stop - start) // step
23390  *
23391  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
23392  *                 new_shape += 1
23393  *
23394  */
23395     __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
23396     if (__pyx_t_2) {
23397 
23398       /* "View.MemoryView":878
23399  *
23400  *             if (stop - start) - step * new_shape:
23401  *                 new_shape += 1             # <<<<<<<<<<<<<<
23402  *
23403  *         if new_shape < 0:
23404  */
23405       __pyx_v_new_shape = (__pyx_v_new_shape + 1);
23406 
23407       /* "View.MemoryView":877
23408  *             new_shape = (stop - start) // step
23409  *
23410  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
23411  *                 new_shape += 1
23412  *
23413  */
23414     }
23415 
23416     /* "View.MemoryView":880
23417  *                 new_shape += 1
23418  *
23419  *         if new_shape < 0:             # <<<<<<<<<<<<<<
23420  *             new_shape = 0
23421  *
23422  */
23423     __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
23424     if (__pyx_t_2) {
23425 
23426       /* "View.MemoryView":881
23427  *
23428  *         if new_shape < 0:
23429  *             new_shape = 0             # <<<<<<<<<<<<<<
23430  *
23431  *
23432  */
23433       __pyx_v_new_shape = 0;
23434 
23435       /* "View.MemoryView":880
23436  *                 new_shape += 1
23437  *
23438  *         if new_shape < 0:             # <<<<<<<<<<<<<<
23439  *             new_shape = 0
23440  *
23441  */
23442     }
23443 
23444     /* "View.MemoryView":884
23445  *
23446  *
23447  *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
23448  *         dst.shape[new_ndim] = new_shape
23449  *         dst.suboffsets[new_ndim] = suboffset
23450  */
23451     (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
23452 
23453     /* "View.MemoryView":885
23454  *
23455  *         dst.strides[new_ndim] = stride * step
23456  *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
23457  *         dst.suboffsets[new_ndim] = suboffset
23458  *
23459  */
23460     (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
23461 
23462     /* "View.MemoryView":886
23463  *         dst.strides[new_ndim] = stride * step
23464  *         dst.shape[new_ndim] = new_shape
23465  *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
23466  *
23467  *
23468  */
23469     (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
23470   }
23471   __pyx_L3:;
23472 
23473   /* "View.MemoryView":889
23474  *
23475  *
23476  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
23477  *         dst.data += start * stride
23478  *     else:
23479  */
23480   __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
23481   if (__pyx_t_2) {
23482 
23483     /* "View.MemoryView":890
23484  *
23485  *     if suboffset_dim[0] < 0:
23486  *         dst.data += start * stride             # <<<<<<<<<<<<<<
23487  *     else:
23488  *         dst.suboffsets[suboffset_dim[0]] += start * stride
23489  */
23490     __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
23491 
23492     /* "View.MemoryView":889
23493  *
23494  *
23495  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
23496  *         dst.data += start * stride
23497  *     else:
23498  */
23499     goto __pyx_L23;
23500   }
23501 
23502   /* "View.MemoryView":892
23503  *         dst.data += start * stride
23504  *     else:
23505  *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
23506  *
23507  *     if suboffset >= 0:
23508  */
23509   /*else*/ {
23510     __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
23511     (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
23512   }
23513   __pyx_L23:;
23514 
23515   /* "View.MemoryView":894
23516  *         dst.suboffsets[suboffset_dim[0]] += start * stride
23517  *
23518  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
23519  *         if not is_slice:
23520  *             if new_ndim == 0:
23521  */
23522   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
23523   if (__pyx_t_2) {
23524 
23525     /* "View.MemoryView":895
23526  *
23527  *     if suboffset >= 0:
23528  *         if not is_slice:             # <<<<<<<<<<<<<<
23529  *             if new_ndim == 0:
23530  *                 dst.data = (<char **> dst.data)[0] + suboffset
23531  */
23532     __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
23533     if (__pyx_t_2) {
23534 
23535       /* "View.MemoryView":896
23536  *     if suboffset >= 0:
23537  *         if not is_slice:
23538  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
23539  *                 dst.data = (<char **> dst.data)[0] + suboffset
23540  *             else:
23541  */
23542       __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
23543       if (__pyx_t_2) {
23544 
23545         /* "View.MemoryView":897
23546  *         if not is_slice:
23547  *             if new_ndim == 0:
23548  *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
23549  *             else:
23550  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
23551  */
23552         __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
23553 
23554         /* "View.MemoryView":896
23555  *     if suboffset >= 0:
23556  *         if not is_slice:
23557  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
23558  *                 dst.data = (<char **> dst.data)[0] + suboffset
23559  *             else:
23560  */
23561         goto __pyx_L26;
23562       }
23563 
23564       /* "View.MemoryView":899
23565  *                 dst.data = (<char **> dst.data)[0] + suboffset
23566  *             else:
23567  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
23568  *                                      "must be indexed and not sliced", dim)
23569  *         else:
23570  */
23571       /*else*/ {
23572 
23573         /* "View.MemoryView":900
23574  *             else:
23575  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
23576  *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
23577  *         else:
23578  *             suboffset_dim[0] = new_ndim
23579  */
23580         __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)
23581       }
23582       __pyx_L26:;
23583 
23584       /* "View.MemoryView":895
23585  *
23586  *     if suboffset >= 0:
23587  *         if not is_slice:             # <<<<<<<<<<<<<<
23588  *             if new_ndim == 0:
23589  *                 dst.data = (<char **> dst.data)[0] + suboffset
23590  */
23591       goto __pyx_L25;
23592     }
23593 
23594     /* "View.MemoryView":902
23595  *                                      "must be indexed and not sliced", dim)
23596  *         else:
23597  *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
23598  *
23599  *     return 0
23600  */
23601     /*else*/ {
23602       (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
23603     }
23604     __pyx_L25:;
23605 
23606     /* "View.MemoryView":894
23607  *         dst.suboffsets[suboffset_dim[0]] += start * stride
23608  *
23609  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
23610  *         if not is_slice:
23611  *             if new_ndim == 0:
23612  */
23613   }
23614 
23615   /* "View.MemoryView":904
23616  *             suboffset_dim[0] = new_ndim
23617  *
23618  *     return 0             # <<<<<<<<<<<<<<
23619  *
23620  *
23621  */
23622   __pyx_r = 0;
23623   goto __pyx_L0;
23624 
23625   /* "View.MemoryView":807
23626  *
23627  * @cname('__pyx_memoryview_slice_memviewslice')
23628  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
23629  *         __Pyx_memviewslice *dst,
23630  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
23631  */
23632 
23633   /* function exit code */
23634   __pyx_L1_error:;
23635   {
23636     #ifdef WITH_THREAD
23637     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
23638     #endif
23639     __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
23640     #ifdef WITH_THREAD
23641     __Pyx_PyGILState_Release(__pyx_gilstate_save);
23642     #endif
23643   }
23644   __pyx_r = -1;
23645   __pyx_L0:;
23646   return __pyx_r;
23647 }
23648 
23649 /* "View.MemoryView":910
23650  *
23651  * @cname('__pyx_pybuffer_index')
23652  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
23653  *                           Py_ssize_t dim) except NULL:
23654  *     cdef Py_ssize_t shape, stride, suboffset = -1
23655  */
23656 
__pyx_pybuffer_index(Py_buffer * __pyx_v_view,char * __pyx_v_bufp,Py_ssize_t __pyx_v_index,Py_ssize_t __pyx_v_dim)23657 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) {
23658   Py_ssize_t __pyx_v_shape;
23659   Py_ssize_t __pyx_v_stride;
23660   Py_ssize_t __pyx_v_suboffset;
23661   Py_ssize_t __pyx_v_itemsize;
23662   char *__pyx_v_resultp;
23663   char *__pyx_r;
23664   __Pyx_RefNannyDeclarations
23665   Py_ssize_t __pyx_t_1;
23666   int __pyx_t_2;
23667   PyObject *__pyx_t_3 = NULL;
23668   PyObject *__pyx_t_4 = NULL;
23669   int __pyx_lineno = 0;
23670   const char *__pyx_filename = NULL;
23671   int __pyx_clineno = 0;
23672   __Pyx_RefNannySetupContext("pybuffer_index", 0);
23673 
23674   /* "View.MemoryView":912
23675  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
23676  *                           Py_ssize_t dim) except NULL:
23677  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
23678  *     cdef Py_ssize_t itemsize = view.itemsize
23679  *     cdef char *resultp
23680  */
23681   __pyx_v_suboffset = -1L;
23682 
23683   /* "View.MemoryView":913
23684  *                           Py_ssize_t dim) except NULL:
23685  *     cdef Py_ssize_t shape, stride, suboffset = -1
23686  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
23687  *     cdef char *resultp
23688  *
23689  */
23690   __pyx_t_1 = __pyx_v_view->itemsize;
23691   __pyx_v_itemsize = __pyx_t_1;
23692 
23693   /* "View.MemoryView":916
23694  *     cdef char *resultp
23695  *
23696  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
23697  *         shape = view.len / itemsize
23698  *         stride = itemsize
23699  */
23700   __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
23701   if (__pyx_t_2) {
23702 
23703     /* "View.MemoryView":917
23704  *
23705  *     if view.ndim == 0:
23706  *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
23707  *         stride = itemsize
23708  *     else:
23709  */
23710     if (unlikely(__pyx_v_itemsize == 0)) {
23711       PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
23712       __PYX_ERR(2, 917, __pyx_L1_error)
23713     }
23714     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))) {
23715       PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
23716       __PYX_ERR(2, 917, __pyx_L1_error)
23717     }
23718     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
23719 
23720     /* "View.MemoryView":918
23721  *     if view.ndim == 0:
23722  *         shape = view.len / itemsize
23723  *         stride = itemsize             # <<<<<<<<<<<<<<
23724  *     else:
23725  *         shape = view.shape[dim]
23726  */
23727     __pyx_v_stride = __pyx_v_itemsize;
23728 
23729     /* "View.MemoryView":916
23730  *     cdef char *resultp
23731  *
23732  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
23733  *         shape = view.len / itemsize
23734  *         stride = itemsize
23735  */
23736     goto __pyx_L3;
23737   }
23738 
23739   /* "View.MemoryView":920
23740  *         stride = itemsize
23741  *     else:
23742  *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
23743  *         stride = view.strides[dim]
23744  *         if view.suboffsets != NULL:
23745  */
23746   /*else*/ {
23747     __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
23748 
23749     /* "View.MemoryView":921
23750  *     else:
23751  *         shape = view.shape[dim]
23752  *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
23753  *         if view.suboffsets != NULL:
23754  *             suboffset = view.suboffsets[dim]
23755  */
23756     __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
23757 
23758     /* "View.MemoryView":922
23759  *         shape = view.shape[dim]
23760  *         stride = view.strides[dim]
23761  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
23762  *             suboffset = view.suboffsets[dim]
23763  *
23764  */
23765     __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
23766     if (__pyx_t_2) {
23767 
23768       /* "View.MemoryView":923
23769  *         stride = view.strides[dim]
23770  *         if view.suboffsets != NULL:
23771  *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
23772  *
23773  *     if index < 0:
23774  */
23775       __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
23776 
23777       /* "View.MemoryView":922
23778  *         shape = view.shape[dim]
23779  *         stride = view.strides[dim]
23780  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
23781  *             suboffset = view.suboffsets[dim]
23782  *
23783  */
23784     }
23785   }
23786   __pyx_L3:;
23787 
23788   /* "View.MemoryView":925
23789  *             suboffset = view.suboffsets[dim]
23790  *
23791  *     if index < 0:             # <<<<<<<<<<<<<<
23792  *         index += view.shape[dim]
23793  *         if index < 0:
23794  */
23795   __pyx_t_2 = ((__pyx_v_index < 0) != 0);
23796   if (__pyx_t_2) {
23797 
23798     /* "View.MemoryView":926
23799  *
23800  *     if index < 0:
23801  *         index += view.shape[dim]             # <<<<<<<<<<<<<<
23802  *         if index < 0:
23803  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
23804  */
23805     __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
23806 
23807     /* "View.MemoryView":927
23808  *     if index < 0:
23809  *         index += view.shape[dim]
23810  *         if index < 0:             # <<<<<<<<<<<<<<
23811  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
23812  *
23813  */
23814     __pyx_t_2 = ((__pyx_v_index < 0) != 0);
23815     if (unlikely(__pyx_t_2)) {
23816 
23817       /* "View.MemoryView":928
23818  *         index += view.shape[dim]
23819  *         if index < 0:
23820  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
23821  *
23822  *     if index >= shape:
23823  */
23824       __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
23825       __Pyx_GOTREF(__pyx_t_3);
23826       __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)
23827       __Pyx_GOTREF(__pyx_t_4);
23828       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23829       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
23830       __Pyx_GOTREF(__pyx_t_3);
23831       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23832       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
23833       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23834       __PYX_ERR(2, 928, __pyx_L1_error)
23835 
23836       /* "View.MemoryView":927
23837  *     if index < 0:
23838  *         index += view.shape[dim]
23839  *         if index < 0:             # <<<<<<<<<<<<<<
23840  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
23841  *
23842  */
23843     }
23844 
23845     /* "View.MemoryView":925
23846  *             suboffset = view.suboffsets[dim]
23847  *
23848  *     if index < 0:             # <<<<<<<<<<<<<<
23849  *         index += view.shape[dim]
23850  *         if index < 0:
23851  */
23852   }
23853 
23854   /* "View.MemoryView":930
23855  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
23856  *
23857  *     if index >= shape:             # <<<<<<<<<<<<<<
23858  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
23859  *
23860  */
23861   __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
23862   if (unlikely(__pyx_t_2)) {
23863 
23864     /* "View.MemoryView":931
23865  *
23866  *     if index >= shape:
23867  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
23868  *
23869  *     resultp = bufp + index * stride
23870  */
23871     __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
23872     __Pyx_GOTREF(__pyx_t_3);
23873     __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)
23874     __Pyx_GOTREF(__pyx_t_4);
23875     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23876     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
23877     __Pyx_GOTREF(__pyx_t_3);
23878     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23879     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
23880     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23881     __PYX_ERR(2, 931, __pyx_L1_error)
23882 
23883     /* "View.MemoryView":930
23884  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
23885  *
23886  *     if index >= shape:             # <<<<<<<<<<<<<<
23887  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
23888  *
23889  */
23890   }
23891 
23892   /* "View.MemoryView":933
23893  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
23894  *
23895  *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
23896  *     if suboffset >= 0:
23897  *         resultp = (<char **> resultp)[0] + suboffset
23898  */
23899   __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
23900 
23901   /* "View.MemoryView":934
23902  *
23903  *     resultp = bufp + index * stride
23904  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
23905  *         resultp = (<char **> resultp)[0] + suboffset
23906  *
23907  */
23908   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
23909   if (__pyx_t_2) {
23910 
23911     /* "View.MemoryView":935
23912  *     resultp = bufp + index * stride
23913  *     if suboffset >= 0:
23914  *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
23915  *
23916  *     return resultp
23917  */
23918     __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
23919 
23920     /* "View.MemoryView":934
23921  *
23922  *     resultp = bufp + index * stride
23923  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
23924  *         resultp = (<char **> resultp)[0] + suboffset
23925  *
23926  */
23927   }
23928 
23929   /* "View.MemoryView":937
23930  *         resultp = (<char **> resultp)[0] + suboffset
23931  *
23932  *     return resultp             # <<<<<<<<<<<<<<
23933  *
23934  *
23935  */
23936   __pyx_r = __pyx_v_resultp;
23937   goto __pyx_L0;
23938 
23939   /* "View.MemoryView":910
23940  *
23941  * @cname('__pyx_pybuffer_index')
23942  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
23943  *                           Py_ssize_t dim) except NULL:
23944  *     cdef Py_ssize_t shape, stride, suboffset = -1
23945  */
23946 
23947   /* function exit code */
23948   __pyx_L1_error:;
23949   __Pyx_XDECREF(__pyx_t_3);
23950   __Pyx_XDECREF(__pyx_t_4);
23951   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
23952   __pyx_r = NULL;
23953   __pyx_L0:;
23954   __Pyx_RefNannyFinishContext();
23955   return __pyx_r;
23956 }
23957 
23958 /* "View.MemoryView":943
23959  *
23960  * @cname('__pyx_memslice_transpose')
23961  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
23962  *     cdef int ndim = memslice.memview.view.ndim
23963  *
23964  */
23965 
__pyx_memslice_transpose(__Pyx_memviewslice * __pyx_v_memslice)23966 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
23967   int __pyx_v_ndim;
23968   Py_ssize_t *__pyx_v_shape;
23969   Py_ssize_t *__pyx_v_strides;
23970   int __pyx_v_i;
23971   int __pyx_v_j;
23972   int __pyx_r;
23973   int __pyx_t_1;
23974   Py_ssize_t *__pyx_t_2;
23975   long __pyx_t_3;
23976   long __pyx_t_4;
23977   Py_ssize_t __pyx_t_5;
23978   Py_ssize_t __pyx_t_6;
23979   int __pyx_t_7;
23980   int __pyx_t_8;
23981   int __pyx_t_9;
23982   int __pyx_lineno = 0;
23983   const char *__pyx_filename = NULL;
23984   int __pyx_clineno = 0;
23985 
23986   /* "View.MemoryView":944
23987  * @cname('__pyx_memslice_transpose')
23988  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
23989  *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
23990  *
23991  *     cdef Py_ssize_t *shape = memslice.shape
23992  */
23993   __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
23994   __pyx_v_ndim = __pyx_t_1;
23995 
23996   /* "View.MemoryView":946
23997  *     cdef int ndim = memslice.memview.view.ndim
23998  *
23999  *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
24000  *     cdef Py_ssize_t *strides = memslice.strides
24001  *
24002  */
24003   __pyx_t_2 = __pyx_v_memslice->shape;
24004   __pyx_v_shape = __pyx_t_2;
24005 
24006   /* "View.MemoryView":947
24007  *
24008  *     cdef Py_ssize_t *shape = memslice.shape
24009  *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
24010  *
24011  *
24012  */
24013   __pyx_t_2 = __pyx_v_memslice->strides;
24014   __pyx_v_strides = __pyx_t_2;
24015 
24016   /* "View.MemoryView":951
24017  *
24018  *     cdef int i, j
24019  *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
24020  *         j = ndim - 1 - i
24021  *         strides[i], strides[j] = strides[j], strides[i]
24022  */
24023   __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
24024   __pyx_t_4 = __pyx_t_3;
24025   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
24026     __pyx_v_i = __pyx_t_1;
24027 
24028     /* "View.MemoryView":952
24029  *     cdef int i, j
24030  *     for i in range(ndim / 2):
24031  *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
24032  *         strides[i], strides[j] = strides[j], strides[i]
24033  *         shape[i], shape[j] = shape[j], shape[i]
24034  */
24035     __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
24036 
24037     /* "View.MemoryView":953
24038  *     for i in range(ndim / 2):
24039  *         j = ndim - 1 - i
24040  *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
24041  *         shape[i], shape[j] = shape[j], shape[i]
24042  *
24043  */
24044     __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
24045     __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
24046     (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
24047     (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
24048 
24049     /* "View.MemoryView":954
24050  *         j = ndim - 1 - i
24051  *         strides[i], strides[j] = strides[j], strides[i]
24052  *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
24053  *
24054  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
24055  */
24056     __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
24057     __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
24058     (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
24059     (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
24060 
24061     /* "View.MemoryView":956
24062  *         shape[i], shape[j] = shape[j], shape[i]
24063  *
24064  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
24065  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
24066  *
24067  */
24068     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
24069     if (!__pyx_t_8) {
24070     } else {
24071       __pyx_t_7 = __pyx_t_8;
24072       goto __pyx_L6_bool_binop_done;
24073     }
24074     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
24075     __pyx_t_7 = __pyx_t_8;
24076     __pyx_L6_bool_binop_done:;
24077     if (__pyx_t_7) {
24078 
24079       /* "View.MemoryView":957
24080  *
24081  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
24082  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
24083  *
24084  *     return 1
24085  */
24086       __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)
24087 
24088       /* "View.MemoryView":956
24089  *         shape[i], shape[j] = shape[j], shape[i]
24090  *
24091  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
24092  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
24093  *
24094  */
24095     }
24096   }
24097 
24098   /* "View.MemoryView":959
24099  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
24100  *
24101  *     return 1             # <<<<<<<<<<<<<<
24102  *
24103  *
24104  */
24105   __pyx_r = 1;
24106   goto __pyx_L0;
24107 
24108   /* "View.MemoryView":943
24109  *
24110  * @cname('__pyx_memslice_transpose')
24111  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
24112  *     cdef int ndim = memslice.memview.view.ndim
24113  *
24114  */
24115 
24116   /* function exit code */
24117   __pyx_L1_error:;
24118   {
24119     #ifdef WITH_THREAD
24120     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
24121     #endif
24122     __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
24123     #ifdef WITH_THREAD
24124     __Pyx_PyGILState_Release(__pyx_gilstate_save);
24125     #endif
24126   }
24127   __pyx_r = 0;
24128   __pyx_L0:;
24129   return __pyx_r;
24130 }
24131 
24132 /* "View.MemoryView":976
24133  *     cdef int (*to_dtype_func)(char *, object) except 0
24134  *
24135  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
24136  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
24137  *
24138  */
24139 
24140 /* Python wrapper */
24141 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryviewslice___dealloc__(PyObject * __pyx_v_self)24142 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
24143   __Pyx_RefNannyDeclarations
24144   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
24145   __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
24146 
24147   /* function exit code */
24148   __Pyx_RefNannyFinishContext();
24149 }
24150 
__pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj * __pyx_v_self)24151 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
24152   __Pyx_RefNannyDeclarations
24153   __Pyx_RefNannySetupContext("__dealloc__", 0);
24154 
24155   /* "View.MemoryView":977
24156  *
24157  *     def __dealloc__(self):
24158  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
24159  *
24160  *     cdef convert_item_to_object(self, char *itemp):
24161  */
24162   __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
24163 
24164   /* "View.MemoryView":976
24165  *     cdef int (*to_dtype_func)(char *, object) except 0
24166  *
24167  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
24168  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
24169  *
24170  */
24171 
24172   /* function exit code */
24173   __Pyx_RefNannyFinishContext();
24174 }
24175 
24176 /* "View.MemoryView":979
24177  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
24178  *
24179  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
24180  *         if self.to_object_func != NULL:
24181  *             return self.to_object_func(itemp)
24182  */
24183 
__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp)24184 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
24185   PyObject *__pyx_r = NULL;
24186   __Pyx_RefNannyDeclarations
24187   int __pyx_t_1;
24188   PyObject *__pyx_t_2 = NULL;
24189   int __pyx_lineno = 0;
24190   const char *__pyx_filename = NULL;
24191   int __pyx_clineno = 0;
24192   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
24193 
24194   /* "View.MemoryView":980
24195  *
24196  *     cdef convert_item_to_object(self, char *itemp):
24197  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
24198  *             return self.to_object_func(itemp)
24199  *         else:
24200  */
24201   __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
24202   if (__pyx_t_1) {
24203 
24204     /* "View.MemoryView":981
24205  *     cdef convert_item_to_object(self, char *itemp):
24206  *         if self.to_object_func != NULL:
24207  *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
24208  *         else:
24209  *             return memoryview.convert_item_to_object(self, itemp)
24210  */
24211     __Pyx_XDECREF(__pyx_r);
24212     __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error)
24213     __Pyx_GOTREF(__pyx_t_2);
24214     __pyx_r = __pyx_t_2;
24215     __pyx_t_2 = 0;
24216     goto __pyx_L0;
24217 
24218     /* "View.MemoryView":980
24219  *
24220  *     cdef convert_item_to_object(self, char *itemp):
24221  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
24222  *             return self.to_object_func(itemp)
24223  *         else:
24224  */
24225   }
24226 
24227   /* "View.MemoryView":983
24228  *             return self.to_object_func(itemp)
24229  *         else:
24230  *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
24231  *
24232  *     cdef assign_item_from_object(self, char *itemp, object value):
24233  */
24234   /*else*/ {
24235     __Pyx_XDECREF(__pyx_r);
24236     __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)
24237     __Pyx_GOTREF(__pyx_t_2);
24238     __pyx_r = __pyx_t_2;
24239     __pyx_t_2 = 0;
24240     goto __pyx_L0;
24241   }
24242 
24243   /* "View.MemoryView":979
24244  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
24245  *
24246  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
24247  *         if self.to_object_func != NULL:
24248  *             return self.to_object_func(itemp)
24249  */
24250 
24251   /* function exit code */
24252   __pyx_L1_error:;
24253   __Pyx_XDECREF(__pyx_t_2);
24254   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
24255   __pyx_r = 0;
24256   __pyx_L0:;
24257   __Pyx_XGIVEREF(__pyx_r);
24258   __Pyx_RefNannyFinishContext();
24259   return __pyx_r;
24260 }
24261 
24262 /* "View.MemoryView":985
24263  *             return memoryview.convert_item_to_object(self, itemp)
24264  *
24265  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
24266  *         if self.to_dtype_func != NULL:
24267  *             self.to_dtype_func(itemp, value)
24268  */
24269 
__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)24270 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
24271   PyObject *__pyx_r = NULL;
24272   __Pyx_RefNannyDeclarations
24273   int __pyx_t_1;
24274   int __pyx_t_2;
24275   PyObject *__pyx_t_3 = NULL;
24276   int __pyx_lineno = 0;
24277   const char *__pyx_filename = NULL;
24278   int __pyx_clineno = 0;
24279   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
24280 
24281   /* "View.MemoryView":986
24282  *
24283  *     cdef assign_item_from_object(self, char *itemp, object value):
24284  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
24285  *             self.to_dtype_func(itemp, value)
24286  *         else:
24287  */
24288   __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
24289   if (__pyx_t_1) {
24290 
24291     /* "View.MemoryView":987
24292  *     cdef assign_item_from_object(self, char *itemp, object value):
24293  *         if self.to_dtype_func != NULL:
24294  *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
24295  *         else:
24296  *             memoryview.assign_item_from_object(self, itemp, value)
24297  */
24298     __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)
24299 
24300     /* "View.MemoryView":986
24301  *
24302  *     cdef assign_item_from_object(self, char *itemp, object value):
24303  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
24304  *             self.to_dtype_func(itemp, value)
24305  *         else:
24306  */
24307     goto __pyx_L3;
24308   }
24309 
24310   /* "View.MemoryView":989
24311  *             self.to_dtype_func(itemp, value)
24312  *         else:
24313  *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
24314  *
24315  *     @property
24316  */
24317   /*else*/ {
24318     __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)
24319     __Pyx_GOTREF(__pyx_t_3);
24320     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24321   }
24322   __pyx_L3:;
24323 
24324   /* "View.MemoryView":985
24325  *             return memoryview.convert_item_to_object(self, itemp)
24326  *
24327  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
24328  *         if self.to_dtype_func != NULL:
24329  *             self.to_dtype_func(itemp, value)
24330  */
24331 
24332   /* function exit code */
24333   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24334   goto __pyx_L0;
24335   __pyx_L1_error:;
24336   __Pyx_XDECREF(__pyx_t_3);
24337   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
24338   __pyx_r = 0;
24339   __pyx_L0:;
24340   __Pyx_XGIVEREF(__pyx_r);
24341   __Pyx_RefNannyFinishContext();
24342   return __pyx_r;
24343 }
24344 
24345 /* "View.MemoryView":992
24346  *
24347  *     @property
24348  *     def base(self):             # <<<<<<<<<<<<<<
24349  *         return self.from_object
24350  *
24351  */
24352 
24353 /* Python wrapper */
24354 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)24355 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
24356   PyObject *__pyx_r = 0;
24357   __Pyx_RefNannyDeclarations
24358   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
24359   __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
24360 
24361   /* function exit code */
24362   __Pyx_RefNannyFinishContext();
24363   return __pyx_r;
24364 }
24365 
__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj * __pyx_v_self)24366 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
24367   PyObject *__pyx_r = NULL;
24368   __Pyx_RefNannyDeclarations
24369   __Pyx_RefNannySetupContext("__get__", 0);
24370 
24371   /* "View.MemoryView":993
24372  *     @property
24373  *     def base(self):
24374  *         return self.from_object             # <<<<<<<<<<<<<<
24375  *
24376  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
24377  */
24378   __Pyx_XDECREF(__pyx_r);
24379   __Pyx_INCREF(__pyx_v_self->from_object);
24380   __pyx_r = __pyx_v_self->from_object;
24381   goto __pyx_L0;
24382 
24383   /* "View.MemoryView":992
24384  *
24385  *     @property
24386  *     def base(self):             # <<<<<<<<<<<<<<
24387  *         return self.from_object
24388  *
24389  */
24390 
24391   /* function exit code */
24392   __pyx_L0:;
24393   __Pyx_XGIVEREF(__pyx_r);
24394   __Pyx_RefNannyFinishContext();
24395   return __pyx_r;
24396 }
24397 
24398 /* "(tree fragment)":1
24399  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
24400  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
24401  * def __setstate_cython__(self, __pyx_state):
24402  */
24403 
24404 /* Python wrapper */
24405 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)24406 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
24407   PyObject *__pyx_r = 0;
24408   __Pyx_RefNannyDeclarations
24409   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
24410   __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
24411 
24412   /* function exit code */
24413   __Pyx_RefNannyFinishContext();
24414   return __pyx_r;
24415 }
24416 
__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self)24417 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
24418   PyObject *__pyx_r = NULL;
24419   __Pyx_RefNannyDeclarations
24420   PyObject *__pyx_t_1 = NULL;
24421   int __pyx_lineno = 0;
24422   const char *__pyx_filename = NULL;
24423   int __pyx_clineno = 0;
24424   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
24425 
24426   /* "(tree fragment)":2
24427  * def __reduce_cython__(self):
24428  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
24429  * def __setstate_cython__(self, __pyx_state):
24430  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
24431  */
24432   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
24433   __Pyx_GOTREF(__pyx_t_1);
24434   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
24435   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24436   __PYX_ERR(2, 2, __pyx_L1_error)
24437 
24438   /* "(tree fragment)":1
24439  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
24440  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
24441  * def __setstate_cython__(self, __pyx_state):
24442  */
24443 
24444   /* function exit code */
24445   __pyx_L1_error:;
24446   __Pyx_XDECREF(__pyx_t_1);
24447   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
24448   __pyx_r = NULL;
24449   __Pyx_XGIVEREF(__pyx_r);
24450   __Pyx_RefNannyFinishContext();
24451   return __pyx_r;
24452 }
24453 
24454 /* "(tree fragment)":3
24455  * def __reduce_cython__(self):
24456  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
24457  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
24458  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
24459  */
24460 
24461 /* Python wrapper */
24462 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)24463 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
24464   PyObject *__pyx_r = 0;
24465   __Pyx_RefNannyDeclarations
24466   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
24467   __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
24468 
24469   /* function exit code */
24470   __Pyx_RefNannyFinishContext();
24471   return __pyx_r;
24472 }
24473 
__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)24474 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) {
24475   PyObject *__pyx_r = NULL;
24476   __Pyx_RefNannyDeclarations
24477   PyObject *__pyx_t_1 = NULL;
24478   int __pyx_lineno = 0;
24479   const char *__pyx_filename = NULL;
24480   int __pyx_clineno = 0;
24481   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
24482 
24483   /* "(tree fragment)":4
24484  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
24485  * def __setstate_cython__(self, __pyx_state):
24486  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
24487  */
24488   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
24489   __Pyx_GOTREF(__pyx_t_1);
24490   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
24491   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24492   __PYX_ERR(2, 4, __pyx_L1_error)
24493 
24494   /* "(tree fragment)":3
24495  * def __reduce_cython__(self):
24496  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
24497  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
24498  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
24499  */
24500 
24501   /* function exit code */
24502   __pyx_L1_error:;
24503   __Pyx_XDECREF(__pyx_t_1);
24504   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
24505   __pyx_r = NULL;
24506   __Pyx_XGIVEREF(__pyx_r);
24507   __Pyx_RefNannyFinishContext();
24508   return __pyx_r;
24509 }
24510 
24511 /* "View.MemoryView":999
24512  *
24513  * @cname('__pyx_memoryview_fromslice')
24514  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
24515  *                           int ndim,
24516  *                           object (*to_object_func)(char *),
24517  */
24518 
__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)24519 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) {
24520   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
24521   Py_ssize_t __pyx_v_suboffset;
24522   PyObject *__pyx_v_length = NULL;
24523   PyObject *__pyx_r = NULL;
24524   __Pyx_RefNannyDeclarations
24525   int __pyx_t_1;
24526   PyObject *__pyx_t_2 = NULL;
24527   PyObject *__pyx_t_3 = NULL;
24528   __Pyx_TypeInfo *__pyx_t_4;
24529   Py_buffer __pyx_t_5;
24530   Py_ssize_t *__pyx_t_6;
24531   Py_ssize_t *__pyx_t_7;
24532   Py_ssize_t *__pyx_t_8;
24533   Py_ssize_t __pyx_t_9;
24534   int __pyx_lineno = 0;
24535   const char *__pyx_filename = NULL;
24536   int __pyx_clineno = 0;
24537   __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
24538 
24539   /* "View.MemoryView":1007
24540  *     cdef _memoryviewslice result
24541  *
24542  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
24543  *         return None
24544  *
24545  */
24546   __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
24547   if (__pyx_t_1) {
24548 
24549     /* "View.MemoryView":1008
24550  *
24551  *     if <PyObject *> memviewslice.memview == Py_None:
24552  *         return None             # <<<<<<<<<<<<<<
24553  *
24554  *
24555  */
24556     __Pyx_XDECREF(__pyx_r);
24557     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24558     goto __pyx_L0;
24559 
24560     /* "View.MemoryView":1007
24561  *     cdef _memoryviewslice result
24562  *
24563  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
24564  *         return None
24565  *
24566  */
24567   }
24568 
24569   /* "View.MemoryView":1013
24570  *
24571  *
24572  *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
24573  *
24574  *     result.from_slice = memviewslice
24575  */
24576   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
24577   __Pyx_GOTREF(__pyx_t_2);
24578   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error)
24579   __Pyx_GOTREF(__pyx_t_3);
24580   __Pyx_INCREF(Py_None);
24581   __Pyx_GIVEREF(Py_None);
24582   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
24583   __Pyx_INCREF(__pyx_int_0);
24584   __Pyx_GIVEREF(__pyx_int_0);
24585   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
24586   __Pyx_GIVEREF(__pyx_t_2);
24587   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
24588   __pyx_t_2 = 0;
24589   __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)
24590   __Pyx_GOTREF(__pyx_t_2);
24591   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24592   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
24593   __pyx_t_2 = 0;
24594 
24595   /* "View.MemoryView":1015
24596  *     result = _memoryviewslice(None, 0, dtype_is_object)
24597  *
24598  *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
24599  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
24600  *
24601  */
24602   __pyx_v_result->from_slice = __pyx_v_memviewslice;
24603 
24604   /* "View.MemoryView":1016
24605  *
24606  *     result.from_slice = memviewslice
24607  *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
24608  *
24609  *     result.from_object = (<memoryview> memviewslice.memview).base
24610  */
24611   __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
24612 
24613   /* "View.MemoryView":1018
24614  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
24615  *
24616  *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
24617  *     result.typeinfo = memviewslice.memview.typeinfo
24618  *
24619  */
24620   __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)
24621   __Pyx_GOTREF(__pyx_t_2);
24622   __Pyx_GIVEREF(__pyx_t_2);
24623   __Pyx_GOTREF(__pyx_v_result->from_object);
24624   __Pyx_DECREF(__pyx_v_result->from_object);
24625   __pyx_v_result->from_object = __pyx_t_2;
24626   __pyx_t_2 = 0;
24627 
24628   /* "View.MemoryView":1019
24629  *
24630  *     result.from_object = (<memoryview> memviewslice.memview).base
24631  *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
24632  *
24633  *     result.view = memviewslice.memview.view
24634  */
24635   __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
24636   __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
24637 
24638   /* "View.MemoryView":1021
24639  *     result.typeinfo = memviewslice.memview.typeinfo
24640  *
24641  *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
24642  *     result.view.buf = <void *> memviewslice.data
24643  *     result.view.ndim = ndim
24644  */
24645   __pyx_t_5 = __pyx_v_memviewslice.memview->view;
24646   __pyx_v_result->__pyx_base.view = __pyx_t_5;
24647 
24648   /* "View.MemoryView":1022
24649  *
24650  *     result.view = memviewslice.memview.view
24651  *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
24652  *     result.view.ndim = ndim
24653  *     (<__pyx_buffer *> &result.view).obj = Py_None
24654  */
24655   __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
24656 
24657   /* "View.MemoryView":1023
24658  *     result.view = memviewslice.memview.view
24659  *     result.view.buf = <void *> memviewslice.data
24660  *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
24661  *     (<__pyx_buffer *> &result.view).obj = Py_None
24662  *     Py_INCREF(Py_None)
24663  */
24664   __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
24665 
24666   /* "View.MemoryView":1024
24667  *     result.view.buf = <void *> memviewslice.data
24668  *     result.view.ndim = ndim
24669  *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
24670  *     Py_INCREF(Py_None)
24671  *
24672  */
24673   ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
24674 
24675   /* "View.MemoryView":1025
24676  *     result.view.ndim = ndim
24677  *     (<__pyx_buffer *> &result.view).obj = Py_None
24678  *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
24679  *
24680  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
24681  */
24682   Py_INCREF(Py_None);
24683 
24684   /* "View.MemoryView":1027
24685  *     Py_INCREF(Py_None)
24686  *
24687  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
24688  *         result.flags = PyBUF_RECORDS
24689  *     else:
24690  */
24691   __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
24692   if (__pyx_t_1) {
24693 
24694     /* "View.MemoryView":1028
24695  *
24696  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
24697  *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
24698  *     else:
24699  *         result.flags = PyBUF_RECORDS_RO
24700  */
24701     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
24702 
24703     /* "View.MemoryView":1027
24704  *     Py_INCREF(Py_None)
24705  *
24706  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
24707  *         result.flags = PyBUF_RECORDS
24708  *     else:
24709  */
24710     goto __pyx_L4;
24711   }
24712 
24713   /* "View.MemoryView":1030
24714  *         result.flags = PyBUF_RECORDS
24715  *     else:
24716  *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
24717  *
24718  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
24719  */
24720   /*else*/ {
24721     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
24722   }
24723   __pyx_L4:;
24724 
24725   /* "View.MemoryView":1032
24726  *         result.flags = PyBUF_RECORDS_RO
24727  *
24728  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
24729  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
24730  *
24731  */
24732   __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
24733 
24734   /* "View.MemoryView":1033
24735  *
24736  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
24737  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
24738  *
24739  *
24740  */
24741   __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
24742 
24743   /* "View.MemoryView":1036
24744  *
24745  *
24746  *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
24747  *     for suboffset in result.from_slice.suboffsets[:ndim]:
24748  *         if suboffset >= 0:
24749  */
24750   __pyx_v_result->__pyx_base.view.suboffsets = NULL;
24751 
24752   /* "View.MemoryView":1037
24753  *
24754  *     result.view.suboffsets = NULL
24755  *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
24756  *         if suboffset >= 0:
24757  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
24758  */
24759   __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
24760   for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
24761     __pyx_t_6 = __pyx_t_8;
24762     __pyx_v_suboffset = (__pyx_t_6[0]);
24763 
24764     /* "View.MemoryView":1038
24765  *     result.view.suboffsets = NULL
24766  *     for suboffset in result.from_slice.suboffsets[:ndim]:
24767  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
24768  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
24769  *             break
24770  */
24771     __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
24772     if (__pyx_t_1) {
24773 
24774       /* "View.MemoryView":1039
24775  *     for suboffset in result.from_slice.suboffsets[:ndim]:
24776  *         if suboffset >= 0:
24777  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
24778  *             break
24779  *
24780  */
24781       __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
24782 
24783       /* "View.MemoryView":1040
24784  *         if suboffset >= 0:
24785  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
24786  *             break             # <<<<<<<<<<<<<<
24787  *
24788  *     result.view.len = result.view.itemsize
24789  */
24790       goto __pyx_L6_break;
24791 
24792       /* "View.MemoryView":1038
24793  *     result.view.suboffsets = NULL
24794  *     for suboffset in result.from_slice.suboffsets[:ndim]:
24795  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
24796  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
24797  *             break
24798  */
24799     }
24800   }
24801   __pyx_L6_break:;
24802 
24803   /* "View.MemoryView":1042
24804  *             break
24805  *
24806  *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
24807  *     for length in result.view.shape[:ndim]:
24808  *         result.view.len *= length
24809  */
24810   __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
24811   __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
24812 
24813   /* "View.MemoryView":1043
24814  *
24815  *     result.view.len = result.view.itemsize
24816  *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
24817  *         result.view.len *= length
24818  *
24819  */
24820   __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
24821   for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
24822     __pyx_t_6 = __pyx_t_8;
24823     __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error)
24824     __Pyx_GOTREF(__pyx_t_2);
24825     __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
24826     __pyx_t_2 = 0;
24827 
24828     /* "View.MemoryView":1044
24829  *     result.view.len = result.view.itemsize
24830  *     for length in result.view.shape[:ndim]:
24831  *         result.view.len *= length             # <<<<<<<<<<<<<<
24832  *
24833  *     result.to_object_func = to_object_func
24834  */
24835     __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)
24836     __Pyx_GOTREF(__pyx_t_2);
24837     __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error)
24838     __Pyx_GOTREF(__pyx_t_3);
24839     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
24840     __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)
24841     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24842     __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
24843   }
24844 
24845   /* "View.MemoryView":1046
24846  *         result.view.len *= length
24847  *
24848  *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
24849  *     result.to_dtype_func = to_dtype_func
24850  *
24851  */
24852   __pyx_v_result->to_object_func = __pyx_v_to_object_func;
24853 
24854   /* "View.MemoryView":1047
24855  *
24856  *     result.to_object_func = to_object_func
24857  *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
24858  *
24859  *     return result
24860  */
24861   __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
24862 
24863   /* "View.MemoryView":1049
24864  *     result.to_dtype_func = to_dtype_func
24865  *
24866  *     return result             # <<<<<<<<<<<<<<
24867  *
24868  * @cname('__pyx_memoryview_get_slice_from_memoryview')
24869  */
24870   __Pyx_XDECREF(__pyx_r);
24871   __Pyx_INCREF(((PyObject *)__pyx_v_result));
24872   __pyx_r = ((PyObject *)__pyx_v_result);
24873   goto __pyx_L0;
24874 
24875   /* "View.MemoryView":999
24876  *
24877  * @cname('__pyx_memoryview_fromslice')
24878  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
24879  *                           int ndim,
24880  *                           object (*to_object_func)(char *),
24881  */
24882 
24883   /* function exit code */
24884   __pyx_L1_error:;
24885   __Pyx_XDECREF(__pyx_t_2);
24886   __Pyx_XDECREF(__pyx_t_3);
24887   __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
24888   __pyx_r = 0;
24889   __pyx_L0:;
24890   __Pyx_XDECREF((PyObject *)__pyx_v_result);
24891   __Pyx_XDECREF(__pyx_v_length);
24892   __Pyx_XGIVEREF(__pyx_r);
24893   __Pyx_RefNannyFinishContext();
24894   return __pyx_r;
24895 }
24896 
24897 /* "View.MemoryView":1052
24898  *
24899  * @cname('__pyx_memoryview_get_slice_from_memoryview')
24900  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
24901  *                                                    __Pyx_memviewslice *mslice) except NULL:
24902  *     cdef _memoryviewslice obj
24903  */
24904 
__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_mslice)24905 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
24906   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
24907   __Pyx_memviewslice *__pyx_r;
24908   __Pyx_RefNannyDeclarations
24909   int __pyx_t_1;
24910   int __pyx_t_2;
24911   PyObject *__pyx_t_3 = NULL;
24912   int __pyx_lineno = 0;
24913   const char *__pyx_filename = NULL;
24914   int __pyx_clineno = 0;
24915   __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
24916 
24917   /* "View.MemoryView":1055
24918  *                                                    __Pyx_memviewslice *mslice) except NULL:
24919  *     cdef _memoryviewslice obj
24920  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
24921  *         obj = memview
24922  *         return &obj.from_slice
24923  */
24924   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
24925   __pyx_t_2 = (__pyx_t_1 != 0);
24926   if (__pyx_t_2) {
24927 
24928     /* "View.MemoryView":1056
24929  *     cdef _memoryviewslice obj
24930  *     if isinstance(memview, _memoryviewslice):
24931  *         obj = memview             # <<<<<<<<<<<<<<
24932  *         return &obj.from_slice
24933  *     else:
24934  */
24935     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)
24936     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
24937     __Pyx_INCREF(__pyx_t_3);
24938     __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
24939     __pyx_t_3 = 0;
24940 
24941     /* "View.MemoryView":1057
24942  *     if isinstance(memview, _memoryviewslice):
24943  *         obj = memview
24944  *         return &obj.from_slice             # <<<<<<<<<<<<<<
24945  *     else:
24946  *         slice_copy(memview, mslice)
24947  */
24948     __pyx_r = (&__pyx_v_obj->from_slice);
24949     goto __pyx_L0;
24950 
24951     /* "View.MemoryView":1055
24952  *                                                    __Pyx_memviewslice *mslice) except NULL:
24953  *     cdef _memoryviewslice obj
24954  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
24955  *         obj = memview
24956  *         return &obj.from_slice
24957  */
24958   }
24959 
24960   /* "View.MemoryView":1059
24961  *         return &obj.from_slice
24962  *     else:
24963  *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
24964  *         return mslice
24965  *
24966  */
24967   /*else*/ {
24968     __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
24969 
24970     /* "View.MemoryView":1060
24971  *     else:
24972  *         slice_copy(memview, mslice)
24973  *         return mslice             # <<<<<<<<<<<<<<
24974  *
24975  * @cname('__pyx_memoryview_slice_copy')
24976  */
24977     __pyx_r = __pyx_v_mslice;
24978     goto __pyx_L0;
24979   }
24980 
24981   /* "View.MemoryView":1052
24982  *
24983  * @cname('__pyx_memoryview_get_slice_from_memoryview')
24984  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
24985  *                                                    __Pyx_memviewslice *mslice) except NULL:
24986  *     cdef _memoryviewslice obj
24987  */
24988 
24989   /* function exit code */
24990   __pyx_L1_error:;
24991   __Pyx_XDECREF(__pyx_t_3);
24992   __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
24993   __pyx_r = NULL;
24994   __pyx_L0:;
24995   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
24996   __Pyx_RefNannyFinishContext();
24997   return __pyx_r;
24998 }
24999 
25000 /* "View.MemoryView":1063
25001  *
25002  * @cname('__pyx_memoryview_slice_copy')
25003  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
25004  *     cdef int dim
25005  *     cdef (Py_ssize_t*) shape, strides, suboffsets
25006  */
25007 
__pyx_memoryview_slice_copy(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_dst)25008 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
25009   int __pyx_v_dim;
25010   Py_ssize_t *__pyx_v_shape;
25011   Py_ssize_t *__pyx_v_strides;
25012   Py_ssize_t *__pyx_v_suboffsets;
25013   __Pyx_RefNannyDeclarations
25014   Py_ssize_t *__pyx_t_1;
25015   int __pyx_t_2;
25016   int __pyx_t_3;
25017   int __pyx_t_4;
25018   Py_ssize_t __pyx_t_5;
25019   __Pyx_RefNannySetupContext("slice_copy", 0);
25020 
25021   /* "View.MemoryView":1067
25022  *     cdef (Py_ssize_t*) shape, strides, suboffsets
25023  *
25024  *     shape = memview.view.shape             # <<<<<<<<<<<<<<
25025  *     strides = memview.view.strides
25026  *     suboffsets = memview.view.suboffsets
25027  */
25028   __pyx_t_1 = __pyx_v_memview->view.shape;
25029   __pyx_v_shape = __pyx_t_1;
25030 
25031   /* "View.MemoryView":1068
25032  *
25033  *     shape = memview.view.shape
25034  *     strides = memview.view.strides             # <<<<<<<<<<<<<<
25035  *     suboffsets = memview.view.suboffsets
25036  *
25037  */
25038   __pyx_t_1 = __pyx_v_memview->view.strides;
25039   __pyx_v_strides = __pyx_t_1;
25040 
25041   /* "View.MemoryView":1069
25042  *     shape = memview.view.shape
25043  *     strides = memview.view.strides
25044  *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
25045  *
25046  *     dst.memview = <__pyx_memoryview *> memview
25047  */
25048   __pyx_t_1 = __pyx_v_memview->view.suboffsets;
25049   __pyx_v_suboffsets = __pyx_t_1;
25050 
25051   /* "View.MemoryView":1071
25052  *     suboffsets = memview.view.suboffsets
25053  *
25054  *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
25055  *     dst.data = <char *> memview.view.buf
25056  *
25057  */
25058   __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
25059 
25060   /* "View.MemoryView":1072
25061  *
25062  *     dst.memview = <__pyx_memoryview *> memview
25063  *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
25064  *
25065  *     for dim in range(memview.view.ndim):
25066  */
25067   __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
25068 
25069   /* "View.MemoryView":1074
25070  *     dst.data = <char *> memview.view.buf
25071  *
25072  *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
25073  *         dst.shape[dim] = shape[dim]
25074  *         dst.strides[dim] = strides[dim]
25075  */
25076   __pyx_t_2 = __pyx_v_memview->view.ndim;
25077   __pyx_t_3 = __pyx_t_2;
25078   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
25079     __pyx_v_dim = __pyx_t_4;
25080 
25081     /* "View.MemoryView":1075
25082  *
25083  *     for dim in range(memview.view.ndim):
25084  *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
25085  *         dst.strides[dim] = strides[dim]
25086  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
25087  */
25088     (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
25089 
25090     /* "View.MemoryView":1076
25091  *     for dim in range(memview.view.ndim):
25092  *         dst.shape[dim] = shape[dim]
25093  *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
25094  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
25095  *
25096  */
25097     (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
25098 
25099     /* "View.MemoryView":1077
25100  *         dst.shape[dim] = shape[dim]
25101  *         dst.strides[dim] = strides[dim]
25102  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
25103  *
25104  * @cname('__pyx_memoryview_copy_object')
25105  */
25106     if ((__pyx_v_suboffsets != 0)) {
25107       __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
25108     } else {
25109       __pyx_t_5 = -1L;
25110     }
25111     (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
25112   }
25113 
25114   /* "View.MemoryView":1063
25115  *
25116  * @cname('__pyx_memoryview_slice_copy')
25117  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
25118  *     cdef int dim
25119  *     cdef (Py_ssize_t*) shape, strides, suboffsets
25120  */
25121 
25122   /* function exit code */
25123   __Pyx_RefNannyFinishContext();
25124 }
25125 
25126 /* "View.MemoryView":1080
25127  *
25128  * @cname('__pyx_memoryview_copy_object')
25129  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
25130  *     "Create a new memoryview object"
25131  *     cdef __Pyx_memviewslice memviewslice
25132  */
25133 
__pyx_memoryview_copy_object(struct __pyx_memoryview_obj * __pyx_v_memview)25134 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
25135   __Pyx_memviewslice __pyx_v_memviewslice;
25136   PyObject *__pyx_r = NULL;
25137   __Pyx_RefNannyDeclarations
25138   PyObject *__pyx_t_1 = NULL;
25139   int __pyx_lineno = 0;
25140   const char *__pyx_filename = NULL;
25141   int __pyx_clineno = 0;
25142   __Pyx_RefNannySetupContext("memoryview_copy", 0);
25143 
25144   /* "View.MemoryView":1083
25145  *     "Create a new memoryview object"
25146  *     cdef __Pyx_memviewslice memviewslice
25147  *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
25148  *     return memoryview_copy_from_slice(memview, &memviewslice)
25149  *
25150  */
25151   __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
25152 
25153   /* "View.MemoryView":1084
25154  *     cdef __Pyx_memviewslice memviewslice
25155  *     slice_copy(memview, &memviewslice)
25156  *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
25157  *
25158  * @cname('__pyx_memoryview_copy_object_from_slice')
25159  */
25160   __Pyx_XDECREF(__pyx_r);
25161   __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)
25162   __Pyx_GOTREF(__pyx_t_1);
25163   __pyx_r = __pyx_t_1;
25164   __pyx_t_1 = 0;
25165   goto __pyx_L0;
25166 
25167   /* "View.MemoryView":1080
25168  *
25169  * @cname('__pyx_memoryview_copy_object')
25170  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
25171  *     "Create a new memoryview object"
25172  *     cdef __Pyx_memviewslice memviewslice
25173  */
25174 
25175   /* function exit code */
25176   __pyx_L1_error:;
25177   __Pyx_XDECREF(__pyx_t_1);
25178   __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
25179   __pyx_r = 0;
25180   __pyx_L0:;
25181   __Pyx_XGIVEREF(__pyx_r);
25182   __Pyx_RefNannyFinishContext();
25183   return __pyx_r;
25184 }
25185 
25186 /* "View.MemoryView":1087
25187  *
25188  * @cname('__pyx_memoryview_copy_object_from_slice')
25189  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
25190  *     """
25191  *     Create a new memoryview object from a given memoryview object and slice.
25192  */
25193 
__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_memviewslice)25194 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
25195   PyObject *(*__pyx_v_to_object_func)(char *);
25196   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
25197   PyObject *__pyx_r = NULL;
25198   __Pyx_RefNannyDeclarations
25199   int __pyx_t_1;
25200   int __pyx_t_2;
25201   PyObject *(*__pyx_t_3)(char *);
25202   int (*__pyx_t_4)(char *, PyObject *);
25203   PyObject *__pyx_t_5 = NULL;
25204   int __pyx_lineno = 0;
25205   const char *__pyx_filename = NULL;
25206   int __pyx_clineno = 0;
25207   __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
25208 
25209   /* "View.MemoryView":1094
25210  *     cdef int (*to_dtype_func)(char *, object) except 0
25211  *
25212  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
25213  *         to_object_func = (<_memoryviewslice> memview).to_object_func
25214  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
25215  */
25216   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
25217   __pyx_t_2 = (__pyx_t_1 != 0);
25218   if (__pyx_t_2) {
25219 
25220     /* "View.MemoryView":1095
25221  *
25222  *     if isinstance(memview, _memoryviewslice):
25223  *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
25224  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
25225  *     else:
25226  */
25227     __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
25228     __pyx_v_to_object_func = __pyx_t_3;
25229 
25230     /* "View.MemoryView":1096
25231  *     if isinstance(memview, _memoryviewslice):
25232  *         to_object_func = (<_memoryviewslice> memview).to_object_func
25233  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
25234  *     else:
25235  *         to_object_func = NULL
25236  */
25237     __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
25238     __pyx_v_to_dtype_func = __pyx_t_4;
25239 
25240     /* "View.MemoryView":1094
25241  *     cdef int (*to_dtype_func)(char *, object) except 0
25242  *
25243  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
25244  *         to_object_func = (<_memoryviewslice> memview).to_object_func
25245  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
25246  */
25247     goto __pyx_L3;
25248   }
25249 
25250   /* "View.MemoryView":1098
25251  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
25252  *     else:
25253  *         to_object_func = NULL             # <<<<<<<<<<<<<<
25254  *         to_dtype_func = NULL
25255  *
25256  */
25257   /*else*/ {
25258     __pyx_v_to_object_func = NULL;
25259 
25260     /* "View.MemoryView":1099
25261  *     else:
25262  *         to_object_func = NULL
25263  *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
25264  *
25265  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
25266  */
25267     __pyx_v_to_dtype_func = NULL;
25268   }
25269   __pyx_L3:;
25270 
25271   /* "View.MemoryView":1101
25272  *         to_dtype_func = NULL
25273  *
25274  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
25275  *                                 to_object_func, to_dtype_func,
25276  *                                 memview.dtype_is_object)
25277  */
25278   __Pyx_XDECREF(__pyx_r);
25279 
25280   /* "View.MemoryView":1103
25281  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
25282  *                                 to_object_func, to_dtype_func,
25283  *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
25284  *
25285  *
25286  */
25287   __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)
25288   __Pyx_GOTREF(__pyx_t_5);
25289   __pyx_r = __pyx_t_5;
25290   __pyx_t_5 = 0;
25291   goto __pyx_L0;
25292 
25293   /* "View.MemoryView":1087
25294  *
25295  * @cname('__pyx_memoryview_copy_object_from_slice')
25296  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
25297  *     """
25298  *     Create a new memoryview object from a given memoryview object and slice.
25299  */
25300 
25301   /* function exit code */
25302   __pyx_L1_error:;
25303   __Pyx_XDECREF(__pyx_t_5);
25304   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
25305   __pyx_r = 0;
25306   __pyx_L0:;
25307   __Pyx_XGIVEREF(__pyx_r);
25308   __Pyx_RefNannyFinishContext();
25309   return __pyx_r;
25310 }
25311 
25312 /* "View.MemoryView":1109
25313  *
25314  *
25315  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
25316  *     if arg < 0:
25317  *         return -arg
25318  */
25319 
abs_py_ssize_t(Py_ssize_t __pyx_v_arg)25320 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
25321   Py_ssize_t __pyx_r;
25322   int __pyx_t_1;
25323 
25324   /* "View.MemoryView":1110
25325  *
25326  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
25327  *     if arg < 0:             # <<<<<<<<<<<<<<
25328  *         return -arg
25329  *     else:
25330  */
25331   __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
25332   if (__pyx_t_1) {
25333 
25334     /* "View.MemoryView":1111
25335  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
25336  *     if arg < 0:
25337  *         return -arg             # <<<<<<<<<<<<<<
25338  *     else:
25339  *         return arg
25340  */
25341     __pyx_r = (-__pyx_v_arg);
25342     goto __pyx_L0;
25343 
25344     /* "View.MemoryView":1110
25345  *
25346  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
25347  *     if arg < 0:             # <<<<<<<<<<<<<<
25348  *         return -arg
25349  *     else:
25350  */
25351   }
25352 
25353   /* "View.MemoryView":1113
25354  *         return -arg
25355  *     else:
25356  *         return arg             # <<<<<<<<<<<<<<
25357  *
25358  * @cname('__pyx_get_best_slice_order')
25359  */
25360   /*else*/ {
25361     __pyx_r = __pyx_v_arg;
25362     goto __pyx_L0;
25363   }
25364 
25365   /* "View.MemoryView":1109
25366  *
25367  *
25368  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
25369  *     if arg < 0:
25370  *         return -arg
25371  */
25372 
25373   /* function exit code */
25374   __pyx_L0:;
25375   return __pyx_r;
25376 }
25377 
25378 /* "View.MemoryView":1116
25379  *
25380  * @cname('__pyx_get_best_slice_order')
25381  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
25382  *     """
25383  *     Figure out the best memory access order for a given slice.
25384  */
25385 
__pyx_get_best_slice_order(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim)25386 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
25387   int __pyx_v_i;
25388   Py_ssize_t __pyx_v_c_stride;
25389   Py_ssize_t __pyx_v_f_stride;
25390   char __pyx_r;
25391   int __pyx_t_1;
25392   int __pyx_t_2;
25393   int __pyx_t_3;
25394   int __pyx_t_4;
25395 
25396   /* "View.MemoryView":1121
25397  *     """
25398  *     cdef int i
25399  *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
25400  *     cdef Py_ssize_t f_stride = 0
25401  *
25402  */
25403   __pyx_v_c_stride = 0;
25404 
25405   /* "View.MemoryView":1122
25406  *     cdef int i
25407  *     cdef Py_ssize_t c_stride = 0
25408  *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
25409  *
25410  *     for i in range(ndim - 1, -1, -1):
25411  */
25412   __pyx_v_f_stride = 0;
25413 
25414   /* "View.MemoryView":1124
25415  *     cdef Py_ssize_t f_stride = 0
25416  *
25417  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
25418  *         if mslice.shape[i] > 1:
25419  *             c_stride = mslice.strides[i]
25420  */
25421   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
25422     __pyx_v_i = __pyx_t_1;
25423 
25424     /* "View.MemoryView":1125
25425  *
25426  *     for i in range(ndim - 1, -1, -1):
25427  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
25428  *             c_stride = mslice.strides[i]
25429  *             break
25430  */
25431     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
25432     if (__pyx_t_2) {
25433 
25434       /* "View.MemoryView":1126
25435  *     for i in range(ndim - 1, -1, -1):
25436  *         if mslice.shape[i] > 1:
25437  *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
25438  *             break
25439  *
25440  */
25441       __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
25442 
25443       /* "View.MemoryView":1127
25444  *         if mslice.shape[i] > 1:
25445  *             c_stride = mslice.strides[i]
25446  *             break             # <<<<<<<<<<<<<<
25447  *
25448  *     for i in range(ndim):
25449  */
25450       goto __pyx_L4_break;
25451 
25452       /* "View.MemoryView":1125
25453  *
25454  *     for i in range(ndim - 1, -1, -1):
25455  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
25456  *             c_stride = mslice.strides[i]
25457  *             break
25458  */
25459     }
25460   }
25461   __pyx_L4_break:;
25462 
25463   /* "View.MemoryView":1129
25464  *             break
25465  *
25466  *     for i in range(ndim):             # <<<<<<<<<<<<<<
25467  *         if mslice.shape[i] > 1:
25468  *             f_stride = mslice.strides[i]
25469  */
25470   __pyx_t_1 = __pyx_v_ndim;
25471   __pyx_t_3 = __pyx_t_1;
25472   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
25473     __pyx_v_i = __pyx_t_4;
25474 
25475     /* "View.MemoryView":1130
25476  *
25477  *     for i in range(ndim):
25478  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
25479  *             f_stride = mslice.strides[i]
25480  *             break
25481  */
25482     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
25483     if (__pyx_t_2) {
25484 
25485       /* "View.MemoryView":1131
25486  *     for i in range(ndim):
25487  *         if mslice.shape[i] > 1:
25488  *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
25489  *             break
25490  *
25491  */
25492       __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
25493 
25494       /* "View.MemoryView":1132
25495  *         if mslice.shape[i] > 1:
25496  *             f_stride = mslice.strides[i]
25497  *             break             # <<<<<<<<<<<<<<
25498  *
25499  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
25500  */
25501       goto __pyx_L7_break;
25502 
25503       /* "View.MemoryView":1130
25504  *
25505  *     for i in range(ndim):
25506  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
25507  *             f_stride = mslice.strides[i]
25508  *             break
25509  */
25510     }
25511   }
25512   __pyx_L7_break:;
25513 
25514   /* "View.MemoryView":1134
25515  *             break
25516  *
25517  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
25518  *         return 'C'
25519  *     else:
25520  */
25521   __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
25522   if (__pyx_t_2) {
25523 
25524     /* "View.MemoryView":1135
25525  *
25526  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
25527  *         return 'C'             # <<<<<<<<<<<<<<
25528  *     else:
25529  *         return 'F'
25530  */
25531     __pyx_r = 'C';
25532     goto __pyx_L0;
25533 
25534     /* "View.MemoryView":1134
25535  *             break
25536  *
25537  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
25538  *         return 'C'
25539  *     else:
25540  */
25541   }
25542 
25543   /* "View.MemoryView":1137
25544  *         return 'C'
25545  *     else:
25546  *         return 'F'             # <<<<<<<<<<<<<<
25547  *
25548  * @cython.cdivision(True)
25549  */
25550   /*else*/ {
25551     __pyx_r = 'F';
25552     goto __pyx_L0;
25553   }
25554 
25555   /* "View.MemoryView":1116
25556  *
25557  * @cname('__pyx_get_best_slice_order')
25558  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
25559  *     """
25560  *     Figure out the best memory access order for a given slice.
25561  */
25562 
25563   /* function exit code */
25564   __pyx_L0:;
25565   return __pyx_r;
25566 }
25567 
25568 /* "View.MemoryView":1140
25569  *
25570  * @cython.cdivision(True)
25571  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
25572  *                                    char *dst_data, Py_ssize_t *dst_strides,
25573  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
25574  */
25575 
_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)25576 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) {
25577   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
25578   CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
25579   Py_ssize_t __pyx_v_dst_extent;
25580   Py_ssize_t __pyx_v_src_stride;
25581   Py_ssize_t __pyx_v_dst_stride;
25582   int __pyx_t_1;
25583   int __pyx_t_2;
25584   int __pyx_t_3;
25585   Py_ssize_t __pyx_t_4;
25586   Py_ssize_t __pyx_t_5;
25587   Py_ssize_t __pyx_t_6;
25588 
25589   /* "View.MemoryView":1147
25590  *
25591  *     cdef Py_ssize_t i
25592  *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
25593  *     cdef Py_ssize_t dst_extent = dst_shape[0]
25594  *     cdef Py_ssize_t src_stride = src_strides[0]
25595  */
25596   __pyx_v_src_extent = (__pyx_v_src_shape[0]);
25597 
25598   /* "View.MemoryView":1148
25599  *     cdef Py_ssize_t i
25600  *     cdef Py_ssize_t src_extent = src_shape[0]
25601  *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
25602  *     cdef Py_ssize_t src_stride = src_strides[0]
25603  *     cdef Py_ssize_t dst_stride = dst_strides[0]
25604  */
25605   __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
25606 
25607   /* "View.MemoryView":1149
25608  *     cdef Py_ssize_t src_extent = src_shape[0]
25609  *     cdef Py_ssize_t dst_extent = dst_shape[0]
25610  *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
25611  *     cdef Py_ssize_t dst_stride = dst_strides[0]
25612  *
25613  */
25614   __pyx_v_src_stride = (__pyx_v_src_strides[0]);
25615 
25616   /* "View.MemoryView":1150
25617  *     cdef Py_ssize_t dst_extent = dst_shape[0]
25618  *     cdef Py_ssize_t src_stride = src_strides[0]
25619  *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
25620  *
25621  *     if ndim == 1:
25622  */
25623   __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
25624 
25625   /* "View.MemoryView":1152
25626  *     cdef Py_ssize_t dst_stride = dst_strides[0]
25627  *
25628  *     if ndim == 1:             # <<<<<<<<<<<<<<
25629  *        if (src_stride > 0 and dst_stride > 0 and
25630  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
25631  */
25632   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
25633   if (__pyx_t_1) {
25634 
25635     /* "View.MemoryView":1153
25636  *
25637  *     if ndim == 1:
25638  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
25639  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
25640  *            memcpy(dst_data, src_data, itemsize * dst_extent)
25641  */
25642     __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
25643     if (__pyx_t_2) {
25644     } else {
25645       __pyx_t_1 = __pyx_t_2;
25646       goto __pyx_L5_bool_binop_done;
25647     }
25648     __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
25649     if (__pyx_t_2) {
25650     } else {
25651       __pyx_t_1 = __pyx_t_2;
25652       goto __pyx_L5_bool_binop_done;
25653     }
25654 
25655     /* "View.MemoryView":1154
25656  *     if ndim == 1:
25657  *        if (src_stride > 0 and dst_stride > 0 and
25658  *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
25659  *            memcpy(dst_data, src_data, itemsize * dst_extent)
25660  *        else:
25661  */
25662     __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
25663     if (__pyx_t_2) {
25664       __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
25665     }
25666     __pyx_t_3 = (__pyx_t_2 != 0);
25667     __pyx_t_1 = __pyx_t_3;
25668     __pyx_L5_bool_binop_done:;
25669 
25670     /* "View.MemoryView":1153
25671  *
25672  *     if ndim == 1:
25673  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
25674  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
25675  *            memcpy(dst_data, src_data, itemsize * dst_extent)
25676  */
25677     if (__pyx_t_1) {
25678 
25679       /* "View.MemoryView":1155
25680  *        if (src_stride > 0 and dst_stride > 0 and
25681  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
25682  *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
25683  *        else:
25684  *            for i in range(dst_extent):
25685  */
25686       (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
25687 
25688       /* "View.MemoryView":1153
25689  *
25690  *     if ndim == 1:
25691  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
25692  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
25693  *            memcpy(dst_data, src_data, itemsize * dst_extent)
25694  */
25695       goto __pyx_L4;
25696     }
25697 
25698     /* "View.MemoryView":1157
25699  *            memcpy(dst_data, src_data, itemsize * dst_extent)
25700  *        else:
25701  *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
25702  *                memcpy(dst_data, src_data, itemsize)
25703  *                src_data += src_stride
25704  */
25705     /*else*/ {
25706       __pyx_t_4 = __pyx_v_dst_extent;
25707       __pyx_t_5 = __pyx_t_4;
25708       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
25709         __pyx_v_i = __pyx_t_6;
25710 
25711         /* "View.MemoryView":1158
25712  *        else:
25713  *            for i in range(dst_extent):
25714  *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
25715  *                src_data += src_stride
25716  *                dst_data += dst_stride
25717  */
25718         (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
25719 
25720         /* "View.MemoryView":1159
25721  *            for i in range(dst_extent):
25722  *                memcpy(dst_data, src_data, itemsize)
25723  *                src_data += src_stride             # <<<<<<<<<<<<<<
25724  *                dst_data += dst_stride
25725  *     else:
25726  */
25727         __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
25728 
25729         /* "View.MemoryView":1160
25730  *                memcpy(dst_data, src_data, itemsize)
25731  *                src_data += src_stride
25732  *                dst_data += dst_stride             # <<<<<<<<<<<<<<
25733  *     else:
25734  *         for i in range(dst_extent):
25735  */
25736         __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
25737       }
25738     }
25739     __pyx_L4:;
25740 
25741     /* "View.MemoryView":1152
25742  *     cdef Py_ssize_t dst_stride = dst_strides[0]
25743  *
25744  *     if ndim == 1:             # <<<<<<<<<<<<<<
25745  *        if (src_stride > 0 and dst_stride > 0 and
25746  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
25747  */
25748     goto __pyx_L3;
25749   }
25750 
25751   /* "View.MemoryView":1162
25752  *                dst_data += dst_stride
25753  *     else:
25754  *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
25755  *             _copy_strided_to_strided(src_data, src_strides + 1,
25756  *                                      dst_data, dst_strides + 1,
25757  */
25758   /*else*/ {
25759     __pyx_t_4 = __pyx_v_dst_extent;
25760     __pyx_t_5 = __pyx_t_4;
25761     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
25762       __pyx_v_i = __pyx_t_6;
25763 
25764       /* "View.MemoryView":1163
25765  *     else:
25766  *         for i in range(dst_extent):
25767  *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
25768  *                                      dst_data, dst_strides + 1,
25769  *                                      src_shape + 1, dst_shape + 1,
25770  */
25771       _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);
25772 
25773       /* "View.MemoryView":1167
25774  *                                      src_shape + 1, dst_shape + 1,
25775  *                                      ndim - 1, itemsize)
25776  *             src_data += src_stride             # <<<<<<<<<<<<<<
25777  *             dst_data += dst_stride
25778  *
25779  */
25780       __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
25781 
25782       /* "View.MemoryView":1168
25783  *                                      ndim - 1, itemsize)
25784  *             src_data += src_stride
25785  *             dst_data += dst_stride             # <<<<<<<<<<<<<<
25786  *
25787  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
25788  */
25789       __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
25790     }
25791   }
25792   __pyx_L3:;
25793 
25794   /* "View.MemoryView":1140
25795  *
25796  * @cython.cdivision(True)
25797  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
25798  *                                    char *dst_data, Py_ssize_t *dst_strides,
25799  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
25800  */
25801 
25802   /* function exit code */
25803 }
25804 
25805 /* "View.MemoryView":1170
25806  *             dst_data += dst_stride
25807  *
25808  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
25809  *                                   __Pyx_memviewslice *dst,
25810  *                                   int ndim, size_t itemsize) nogil:
25811  */
25812 
copy_strided_to_strided(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize)25813 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) {
25814 
25815   /* "View.MemoryView":1173
25816  *                                   __Pyx_memviewslice *dst,
25817  *                                   int ndim, size_t itemsize) nogil:
25818  *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
25819  *                              src.shape, dst.shape, ndim, itemsize)
25820  *
25821  */
25822   _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);
25823 
25824   /* "View.MemoryView":1170
25825  *             dst_data += dst_stride
25826  *
25827  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
25828  *                                   __Pyx_memviewslice *dst,
25829  *                                   int ndim, size_t itemsize) nogil:
25830  */
25831 
25832   /* function exit code */
25833 }
25834 
25835 /* "View.MemoryView":1177
25836  *
25837  * @cname('__pyx_memoryview_slice_get_size')
25838  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
25839  *     "Return the size of the memory occupied by the slice in number of bytes"
25840  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
25841  */
25842 
__pyx_memoryview_slice_get_size(__Pyx_memviewslice * __pyx_v_src,int __pyx_v_ndim)25843 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
25844   Py_ssize_t __pyx_v_shape;
25845   Py_ssize_t __pyx_v_size;
25846   Py_ssize_t __pyx_r;
25847   Py_ssize_t __pyx_t_1;
25848   Py_ssize_t *__pyx_t_2;
25849   Py_ssize_t *__pyx_t_3;
25850   Py_ssize_t *__pyx_t_4;
25851 
25852   /* "View.MemoryView":1179
25853  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
25854  *     "Return the size of the memory occupied by the slice in number of bytes"
25855  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
25856  *
25857  *     for shape in src.shape[:ndim]:
25858  */
25859   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
25860   __pyx_v_size = __pyx_t_1;
25861 
25862   /* "View.MemoryView":1181
25863  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
25864  *
25865  *     for shape in src.shape[:ndim]:             # <<<<<<<<<<<<<<
25866  *         size *= shape
25867  *
25868  */
25869   __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
25870   for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
25871     __pyx_t_2 = __pyx_t_4;
25872     __pyx_v_shape = (__pyx_t_2[0]);
25873 
25874     /* "View.MemoryView":1182
25875  *
25876  *     for shape in src.shape[:ndim]:
25877  *         size *= shape             # <<<<<<<<<<<<<<
25878  *
25879  *     return size
25880  */
25881     __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
25882   }
25883 
25884   /* "View.MemoryView":1184
25885  *         size *= shape
25886  *
25887  *     return size             # <<<<<<<<<<<<<<
25888  *
25889  * @cname('__pyx_fill_contig_strides_array')
25890  */
25891   __pyx_r = __pyx_v_size;
25892   goto __pyx_L0;
25893 
25894   /* "View.MemoryView":1177
25895  *
25896  * @cname('__pyx_memoryview_slice_get_size')
25897  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
25898  *     "Return the size of the memory occupied by the slice in number of bytes"
25899  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
25900  */
25901 
25902   /* function exit code */
25903   __pyx_L0:;
25904   return __pyx_r;
25905 }
25906 
25907 /* "View.MemoryView":1187
25908  *
25909  * @cname('__pyx_fill_contig_strides_array')
25910  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
25911  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
25912  *                 int ndim, char order) nogil:
25913  */
25914 
__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)25915 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) {
25916   int __pyx_v_idx;
25917   Py_ssize_t __pyx_r;
25918   int __pyx_t_1;
25919   int __pyx_t_2;
25920   int __pyx_t_3;
25921   int __pyx_t_4;
25922 
25923   /* "View.MemoryView":1196
25924  *     cdef int idx
25925  *
25926  *     if order == 'F':             # <<<<<<<<<<<<<<
25927  *         for idx in range(ndim):
25928  *             strides[idx] = stride
25929  */
25930   __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
25931   if (__pyx_t_1) {
25932 
25933     /* "View.MemoryView":1197
25934  *
25935  *     if order == 'F':
25936  *         for idx in range(ndim):             # <<<<<<<<<<<<<<
25937  *             strides[idx] = stride
25938  *             stride *= shape[idx]
25939  */
25940     __pyx_t_2 = __pyx_v_ndim;
25941     __pyx_t_3 = __pyx_t_2;
25942     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
25943       __pyx_v_idx = __pyx_t_4;
25944 
25945       /* "View.MemoryView":1198
25946  *     if order == 'F':
25947  *         for idx in range(ndim):
25948  *             strides[idx] = stride             # <<<<<<<<<<<<<<
25949  *             stride *= shape[idx]
25950  *     else:
25951  */
25952       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
25953 
25954       /* "View.MemoryView":1199
25955  *         for idx in range(ndim):
25956  *             strides[idx] = stride
25957  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
25958  *     else:
25959  *         for idx in range(ndim - 1, -1, -1):
25960  */
25961       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
25962     }
25963 
25964     /* "View.MemoryView":1196
25965  *     cdef int idx
25966  *
25967  *     if order == 'F':             # <<<<<<<<<<<<<<
25968  *         for idx in range(ndim):
25969  *             strides[idx] = stride
25970  */
25971     goto __pyx_L3;
25972   }
25973 
25974   /* "View.MemoryView":1201
25975  *             stride *= shape[idx]
25976  *     else:
25977  *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
25978  *             strides[idx] = stride
25979  *             stride *= shape[idx]
25980  */
25981   /*else*/ {
25982     for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
25983       __pyx_v_idx = __pyx_t_2;
25984 
25985       /* "View.MemoryView":1202
25986  *     else:
25987  *         for idx in range(ndim - 1, -1, -1):
25988  *             strides[idx] = stride             # <<<<<<<<<<<<<<
25989  *             stride *= shape[idx]
25990  *
25991  */
25992       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
25993 
25994       /* "View.MemoryView":1203
25995  *         for idx in range(ndim - 1, -1, -1):
25996  *             strides[idx] = stride
25997  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
25998  *
25999  *     return stride
26000  */
26001       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
26002     }
26003   }
26004   __pyx_L3:;
26005 
26006   /* "View.MemoryView":1205
26007  *             stride *= shape[idx]
26008  *
26009  *     return stride             # <<<<<<<<<<<<<<
26010  *
26011  * @cname('__pyx_memoryview_copy_data_to_temp')
26012  */
26013   __pyx_r = __pyx_v_stride;
26014   goto __pyx_L0;
26015 
26016   /* "View.MemoryView":1187
26017  *
26018  * @cname('__pyx_fill_contig_strides_array')
26019  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
26020  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
26021  *                 int ndim, char order) nogil:
26022  */
26023 
26024   /* function exit code */
26025   __pyx_L0:;
26026   return __pyx_r;
26027 }
26028 
26029 /* "View.MemoryView":1208
26030  *
26031  * @cname('__pyx_memoryview_copy_data_to_temp')
26032  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
26033  *                              __Pyx_memviewslice *tmpslice,
26034  *                              char order,
26035  */
26036 
__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_tmpslice,char __pyx_v_order,int __pyx_v_ndim)26037 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) {
26038   int __pyx_v_i;
26039   void *__pyx_v_result;
26040   size_t __pyx_v_itemsize;
26041   size_t __pyx_v_size;
26042   void *__pyx_r;
26043   Py_ssize_t __pyx_t_1;
26044   int __pyx_t_2;
26045   int __pyx_t_3;
26046   struct __pyx_memoryview_obj *__pyx_t_4;
26047   int __pyx_t_5;
26048   int __pyx_t_6;
26049   int __pyx_lineno = 0;
26050   const char *__pyx_filename = NULL;
26051   int __pyx_clineno = 0;
26052 
26053   /* "View.MemoryView":1219
26054  *     cdef void *result
26055  *
26056  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
26057  *     cdef size_t size = slice_get_size(src, ndim)
26058  *
26059  */
26060   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
26061   __pyx_v_itemsize = __pyx_t_1;
26062 
26063   /* "View.MemoryView":1220
26064  *
26065  *     cdef size_t itemsize = src.memview.view.itemsize
26066  *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
26067  *
26068  *     result = malloc(size)
26069  */
26070   __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
26071 
26072   /* "View.MemoryView":1222
26073  *     cdef size_t size = slice_get_size(src, ndim)
26074  *
26075  *     result = malloc(size)             # <<<<<<<<<<<<<<
26076  *     if not result:
26077  *         _err(MemoryError, NULL)
26078  */
26079   __pyx_v_result = malloc(__pyx_v_size);
26080 
26081   /* "View.MemoryView":1223
26082  *
26083  *     result = malloc(size)
26084  *     if not result:             # <<<<<<<<<<<<<<
26085  *         _err(MemoryError, NULL)
26086  *
26087  */
26088   __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
26089   if (__pyx_t_2) {
26090 
26091     /* "View.MemoryView":1224
26092  *     result = malloc(size)
26093  *     if not result:
26094  *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
26095  *
26096  *
26097  */
26098     __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1224, __pyx_L1_error)
26099 
26100     /* "View.MemoryView":1223
26101  *
26102  *     result = malloc(size)
26103  *     if not result:             # <<<<<<<<<<<<<<
26104  *         _err(MemoryError, NULL)
26105  *
26106  */
26107   }
26108 
26109   /* "View.MemoryView":1227
26110  *
26111  *
26112  *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
26113  *     tmpslice.memview = src.memview
26114  *     for i in range(ndim):
26115  */
26116   __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
26117 
26118   /* "View.MemoryView":1228
26119  *
26120  *     tmpslice.data = <char *> result
26121  *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
26122  *     for i in range(ndim):
26123  *         tmpslice.shape[i] = src.shape[i]
26124  */
26125   __pyx_t_4 = __pyx_v_src->memview;
26126   __pyx_v_tmpslice->memview = __pyx_t_4;
26127 
26128   /* "View.MemoryView":1229
26129  *     tmpslice.data = <char *> result
26130  *     tmpslice.memview = src.memview
26131  *     for i in range(ndim):             # <<<<<<<<<<<<<<
26132  *         tmpslice.shape[i] = src.shape[i]
26133  *         tmpslice.suboffsets[i] = -1
26134  */
26135   __pyx_t_3 = __pyx_v_ndim;
26136   __pyx_t_5 = __pyx_t_3;
26137   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
26138     __pyx_v_i = __pyx_t_6;
26139 
26140     /* "View.MemoryView":1230
26141  *     tmpslice.memview = src.memview
26142  *     for i in range(ndim):
26143  *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
26144  *         tmpslice.suboffsets[i] = -1
26145  *
26146  */
26147     (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
26148 
26149     /* "View.MemoryView":1231
26150  *     for i in range(ndim):
26151  *         tmpslice.shape[i] = src.shape[i]
26152  *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
26153  *
26154  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
26155  */
26156     (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
26157   }
26158 
26159   /* "View.MemoryView":1233
26160  *         tmpslice.suboffsets[i] = -1
26161  *
26162  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
26163  *                               ndim, order)
26164  *
26165  */
26166   (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));
26167 
26168   /* "View.MemoryView":1237
26169  *
26170  *
26171  *     for i in range(ndim):             # <<<<<<<<<<<<<<
26172  *         if tmpslice.shape[i] == 1:
26173  *             tmpslice.strides[i] = 0
26174  */
26175   __pyx_t_3 = __pyx_v_ndim;
26176   __pyx_t_5 = __pyx_t_3;
26177   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
26178     __pyx_v_i = __pyx_t_6;
26179 
26180     /* "View.MemoryView":1238
26181  *
26182  *     for i in range(ndim):
26183  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
26184  *             tmpslice.strides[i] = 0
26185  *
26186  */
26187     __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
26188     if (__pyx_t_2) {
26189 
26190       /* "View.MemoryView":1239
26191  *     for i in range(ndim):
26192  *         if tmpslice.shape[i] == 1:
26193  *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
26194  *
26195  *     if slice_is_contig(src[0], order, ndim):
26196  */
26197       (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
26198 
26199       /* "View.MemoryView":1238
26200  *
26201  *     for i in range(ndim):
26202  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
26203  *             tmpslice.strides[i] = 0
26204  *
26205  */
26206     }
26207   }
26208 
26209   /* "View.MemoryView":1241
26210  *             tmpslice.strides[i] = 0
26211  *
26212  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
26213  *         memcpy(result, src.data, size)
26214  *     else:
26215  */
26216   __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
26217   if (__pyx_t_2) {
26218 
26219     /* "View.MemoryView":1242
26220  *
26221  *     if slice_is_contig(src[0], order, ndim):
26222  *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
26223  *     else:
26224  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
26225  */
26226     (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
26227 
26228     /* "View.MemoryView":1241
26229  *             tmpslice.strides[i] = 0
26230  *
26231  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
26232  *         memcpy(result, src.data, size)
26233  *     else:
26234  */
26235     goto __pyx_L9;
26236   }
26237 
26238   /* "View.MemoryView":1244
26239  *         memcpy(result, src.data, size)
26240  *     else:
26241  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
26242  *
26243  *     return result
26244  */
26245   /*else*/ {
26246     copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
26247   }
26248   __pyx_L9:;
26249 
26250   /* "View.MemoryView":1246
26251  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
26252  *
26253  *     return result             # <<<<<<<<<<<<<<
26254  *
26255  *
26256  */
26257   __pyx_r = __pyx_v_result;
26258   goto __pyx_L0;
26259 
26260   /* "View.MemoryView":1208
26261  *
26262  * @cname('__pyx_memoryview_copy_data_to_temp')
26263  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
26264  *                              __Pyx_memviewslice *tmpslice,
26265  *                              char order,
26266  */
26267 
26268   /* function exit code */
26269   __pyx_L1_error:;
26270   {
26271     #ifdef WITH_THREAD
26272     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
26273     #endif
26274     __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
26275     #ifdef WITH_THREAD
26276     __Pyx_PyGILState_Release(__pyx_gilstate_save);
26277     #endif
26278   }
26279   __pyx_r = NULL;
26280   __pyx_L0:;
26281   return __pyx_r;
26282 }
26283 
26284 /* "View.MemoryView":1251
26285  *
26286  * @cname('__pyx_memoryview_err_extents')
26287  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
26288  *                              Py_ssize_t extent2) except -1 with gil:
26289  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
26290  */
26291 
__pyx_memoryview_err_extents(int __pyx_v_i,Py_ssize_t __pyx_v_extent1,Py_ssize_t __pyx_v_extent2)26292 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
26293   int __pyx_r;
26294   __Pyx_RefNannyDeclarations
26295   PyObject *__pyx_t_1 = NULL;
26296   PyObject *__pyx_t_2 = NULL;
26297   PyObject *__pyx_t_3 = NULL;
26298   PyObject *__pyx_t_4 = NULL;
26299   int __pyx_lineno = 0;
26300   const char *__pyx_filename = NULL;
26301   int __pyx_clineno = 0;
26302   #ifdef WITH_THREAD
26303   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
26304   #endif
26305   __Pyx_RefNannySetupContext("_err_extents", 0);
26306 
26307   /* "View.MemoryView":1254
26308  *                              Py_ssize_t extent2) except -1 with gil:
26309  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
26310  *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
26311  *
26312  * @cname('__pyx_memoryview_err_dim')
26313  */
26314   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error)
26315   __Pyx_GOTREF(__pyx_t_1);
26316   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __pyx_L1_error)
26317   __Pyx_GOTREF(__pyx_t_2);
26318   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error)
26319   __Pyx_GOTREF(__pyx_t_3);
26320   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error)
26321   __Pyx_GOTREF(__pyx_t_4);
26322   __Pyx_GIVEREF(__pyx_t_1);
26323   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
26324   __Pyx_GIVEREF(__pyx_t_2);
26325   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
26326   __Pyx_GIVEREF(__pyx_t_3);
26327   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
26328   __pyx_t_1 = 0;
26329   __pyx_t_2 = 0;
26330   __pyx_t_3 = 0;
26331 
26332   /* "View.MemoryView":1253
26333  * cdef int _err_extents(int i, Py_ssize_t extent1,
26334  *                              Py_ssize_t extent2) except -1 with gil:
26335  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
26336  *                                                         (i, extent1, extent2))
26337  *
26338  */
26339   __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)
26340   __Pyx_GOTREF(__pyx_t_3);
26341   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26342   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1253, __pyx_L1_error)
26343   __Pyx_GOTREF(__pyx_t_4);
26344   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26345   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
26346   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26347   __PYX_ERR(2, 1253, __pyx_L1_error)
26348 
26349   /* "View.MemoryView":1251
26350  *
26351  * @cname('__pyx_memoryview_err_extents')
26352  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
26353  *                              Py_ssize_t extent2) except -1 with gil:
26354  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
26355  */
26356 
26357   /* function exit code */
26358   __pyx_L1_error:;
26359   __Pyx_XDECREF(__pyx_t_1);
26360   __Pyx_XDECREF(__pyx_t_2);
26361   __Pyx_XDECREF(__pyx_t_3);
26362   __Pyx_XDECREF(__pyx_t_4);
26363   __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
26364   __pyx_r = -1;
26365   __Pyx_RefNannyFinishContext();
26366   #ifdef WITH_THREAD
26367   __Pyx_PyGILState_Release(__pyx_gilstate_save);
26368   #endif
26369   return __pyx_r;
26370 }
26371 
26372 /* "View.MemoryView":1257
26373  *
26374  * @cname('__pyx_memoryview_err_dim')
26375  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
26376  *     raise error(msg.decode('ascii') % dim)
26377  *
26378  */
26379 
__pyx_memoryview_err_dim(PyObject * __pyx_v_error,char * __pyx_v_msg,int __pyx_v_dim)26380 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
26381   int __pyx_r;
26382   __Pyx_RefNannyDeclarations
26383   PyObject *__pyx_t_1 = NULL;
26384   PyObject *__pyx_t_2 = NULL;
26385   PyObject *__pyx_t_3 = NULL;
26386   PyObject *__pyx_t_4 = NULL;
26387   int __pyx_lineno = 0;
26388   const char *__pyx_filename = NULL;
26389   int __pyx_clineno = 0;
26390   #ifdef WITH_THREAD
26391   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
26392   #endif
26393   __Pyx_RefNannySetupContext("_err_dim", 0);
26394   __Pyx_INCREF(__pyx_v_error);
26395 
26396   /* "View.MemoryView":1258
26397  * @cname('__pyx_memoryview_err_dim')
26398  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
26399  *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
26400  *
26401  * @cname('__pyx_memoryview_err')
26402  */
26403   __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)
26404   __Pyx_GOTREF(__pyx_t_2);
26405   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1258, __pyx_L1_error)
26406   __Pyx_GOTREF(__pyx_t_3);
26407   __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1258, __pyx_L1_error)
26408   __Pyx_GOTREF(__pyx_t_4);
26409   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26410   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26411   __Pyx_INCREF(__pyx_v_error);
26412   __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
26413   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
26414     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
26415     if (likely(__pyx_t_2)) {
26416       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
26417       __Pyx_INCREF(__pyx_t_2);
26418       __Pyx_INCREF(function);
26419       __Pyx_DECREF_SET(__pyx_t_3, function);
26420     }
26421   }
26422   __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);
26423   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
26424   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26425   if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1258, __pyx_L1_error)
26426   __Pyx_GOTREF(__pyx_t_1);
26427   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26428   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
26429   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26430   __PYX_ERR(2, 1258, __pyx_L1_error)
26431 
26432   /* "View.MemoryView":1257
26433  *
26434  * @cname('__pyx_memoryview_err_dim')
26435  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
26436  *     raise error(msg.decode('ascii') % dim)
26437  *
26438  */
26439 
26440   /* function exit code */
26441   __pyx_L1_error:;
26442   __Pyx_XDECREF(__pyx_t_1);
26443   __Pyx_XDECREF(__pyx_t_2);
26444   __Pyx_XDECREF(__pyx_t_3);
26445   __Pyx_XDECREF(__pyx_t_4);
26446   __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
26447   __pyx_r = -1;
26448   __Pyx_XDECREF(__pyx_v_error);
26449   __Pyx_RefNannyFinishContext();
26450   #ifdef WITH_THREAD
26451   __Pyx_PyGILState_Release(__pyx_gilstate_save);
26452   #endif
26453   return __pyx_r;
26454 }
26455 
26456 /* "View.MemoryView":1261
26457  *
26458  * @cname('__pyx_memoryview_err')
26459  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
26460  *     if msg != NULL:
26461  *         raise error(msg.decode('ascii'))
26462  */
26463 
__pyx_memoryview_err(PyObject * __pyx_v_error,char * __pyx_v_msg)26464 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
26465   int __pyx_r;
26466   __Pyx_RefNannyDeclarations
26467   int __pyx_t_1;
26468   PyObject *__pyx_t_2 = NULL;
26469   PyObject *__pyx_t_3 = NULL;
26470   PyObject *__pyx_t_4 = NULL;
26471   PyObject *__pyx_t_5 = NULL;
26472   int __pyx_lineno = 0;
26473   const char *__pyx_filename = NULL;
26474   int __pyx_clineno = 0;
26475   #ifdef WITH_THREAD
26476   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
26477   #endif
26478   __Pyx_RefNannySetupContext("_err", 0);
26479   __Pyx_INCREF(__pyx_v_error);
26480 
26481   /* "View.MemoryView":1262
26482  * @cname('__pyx_memoryview_err')
26483  * cdef int _err(object error, char *msg) except -1 with gil:
26484  *     if msg != NULL:             # <<<<<<<<<<<<<<
26485  *         raise error(msg.decode('ascii'))
26486  *     else:
26487  */
26488   __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
26489   if (unlikely(__pyx_t_1)) {
26490 
26491     /* "View.MemoryView":1263
26492  * cdef int _err(object error, char *msg) except -1 with gil:
26493  *     if msg != NULL:
26494  *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
26495  *     else:
26496  *         raise error
26497  */
26498     __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)
26499     __Pyx_GOTREF(__pyx_t_3);
26500     __Pyx_INCREF(__pyx_v_error);
26501     __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
26502     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
26503       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
26504       if (likely(__pyx_t_5)) {
26505         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
26506         __Pyx_INCREF(__pyx_t_5);
26507         __Pyx_INCREF(function);
26508         __Pyx_DECREF_SET(__pyx_t_4, function);
26509       }
26510     }
26511     __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);
26512     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
26513     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26514     if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1263, __pyx_L1_error)
26515     __Pyx_GOTREF(__pyx_t_2);
26516     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26517     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
26518     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26519     __PYX_ERR(2, 1263, __pyx_L1_error)
26520 
26521     /* "View.MemoryView":1262
26522  * @cname('__pyx_memoryview_err')
26523  * cdef int _err(object error, char *msg) except -1 with gil:
26524  *     if msg != NULL:             # <<<<<<<<<<<<<<
26525  *         raise error(msg.decode('ascii'))
26526  *     else:
26527  */
26528   }
26529 
26530   /* "View.MemoryView":1265
26531  *         raise error(msg.decode('ascii'))
26532  *     else:
26533  *         raise error             # <<<<<<<<<<<<<<
26534  *
26535  * @cname('__pyx_memoryview_copy_contents')
26536  */
26537   /*else*/ {
26538     __Pyx_Raise(__pyx_v_error, 0, 0, 0);
26539     __PYX_ERR(2, 1265, __pyx_L1_error)
26540   }
26541 
26542   /* "View.MemoryView":1261
26543  *
26544  * @cname('__pyx_memoryview_err')
26545  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
26546  *     if msg != NULL:
26547  *         raise error(msg.decode('ascii'))
26548  */
26549 
26550   /* function exit code */
26551   __pyx_L1_error:;
26552   __Pyx_XDECREF(__pyx_t_2);
26553   __Pyx_XDECREF(__pyx_t_3);
26554   __Pyx_XDECREF(__pyx_t_4);
26555   __Pyx_XDECREF(__pyx_t_5);
26556   __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
26557   __pyx_r = -1;
26558   __Pyx_XDECREF(__pyx_v_error);
26559   __Pyx_RefNannyFinishContext();
26560   #ifdef WITH_THREAD
26561   __Pyx_PyGILState_Release(__pyx_gilstate_save);
26562   #endif
26563   return __pyx_r;
26564 }
26565 
26566 /* "View.MemoryView":1268
26567  *
26568  * @cname('__pyx_memoryview_copy_contents')
26569  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
26570  *                                   __Pyx_memviewslice dst,
26571  *                                   int src_ndim, int dst_ndim,
26572  */
26573 
__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)26574 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) {
26575   void *__pyx_v_tmpdata;
26576   size_t __pyx_v_itemsize;
26577   int __pyx_v_i;
26578   char __pyx_v_order;
26579   int __pyx_v_broadcasting;
26580   int __pyx_v_direct_copy;
26581   __Pyx_memviewslice __pyx_v_tmp;
26582   int __pyx_v_ndim;
26583   int __pyx_r;
26584   Py_ssize_t __pyx_t_1;
26585   int __pyx_t_2;
26586   int __pyx_t_3;
26587   int __pyx_t_4;
26588   int __pyx_t_5;
26589   int __pyx_t_6;
26590   void *__pyx_t_7;
26591   int __pyx_t_8;
26592   int __pyx_lineno = 0;
26593   const char *__pyx_filename = NULL;
26594   int __pyx_clineno = 0;
26595 
26596   /* "View.MemoryView":1276
26597  *     Check for overlapping memory and verify the shapes.
26598  *     """
26599  *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
26600  *     cdef size_t itemsize = src.memview.view.itemsize
26601  *     cdef int i
26602  */
26603   __pyx_v_tmpdata = NULL;
26604 
26605   /* "View.MemoryView":1277
26606  *     """
26607  *     cdef void *tmpdata = NULL
26608  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
26609  *     cdef int i
26610  *     cdef char order = get_best_order(&src, src_ndim)
26611  */
26612   __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
26613   __pyx_v_itemsize = __pyx_t_1;
26614 
26615   /* "View.MemoryView":1279
26616  *     cdef size_t itemsize = src.memview.view.itemsize
26617  *     cdef int i
26618  *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
26619  *     cdef bint broadcasting = False
26620  *     cdef bint direct_copy = False
26621  */
26622   __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
26623 
26624   /* "View.MemoryView":1280
26625  *     cdef int i
26626  *     cdef char order = get_best_order(&src, src_ndim)
26627  *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
26628  *     cdef bint direct_copy = False
26629  *     cdef __Pyx_memviewslice tmp
26630  */
26631   __pyx_v_broadcasting = 0;
26632 
26633   /* "View.MemoryView":1281
26634  *     cdef char order = get_best_order(&src, src_ndim)
26635  *     cdef bint broadcasting = False
26636  *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
26637  *     cdef __Pyx_memviewslice tmp
26638  *
26639  */
26640   __pyx_v_direct_copy = 0;
26641 
26642   /* "View.MemoryView":1284
26643  *     cdef __Pyx_memviewslice tmp
26644  *
26645  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
26646  *         broadcast_leading(&src, src_ndim, dst_ndim)
26647  *     elif dst_ndim < src_ndim:
26648  */
26649   __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
26650   if (__pyx_t_2) {
26651 
26652     /* "View.MemoryView":1285
26653  *
26654  *     if src_ndim < dst_ndim:
26655  *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
26656  *     elif dst_ndim < src_ndim:
26657  *         broadcast_leading(&dst, dst_ndim, src_ndim)
26658  */
26659     __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
26660 
26661     /* "View.MemoryView":1284
26662  *     cdef __Pyx_memviewslice tmp
26663  *
26664  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
26665  *         broadcast_leading(&src, src_ndim, dst_ndim)
26666  *     elif dst_ndim < src_ndim:
26667  */
26668     goto __pyx_L3;
26669   }
26670 
26671   /* "View.MemoryView":1286
26672  *     if src_ndim < dst_ndim:
26673  *         broadcast_leading(&src, src_ndim, dst_ndim)
26674  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
26675  *         broadcast_leading(&dst, dst_ndim, src_ndim)
26676  *
26677  */
26678   __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
26679   if (__pyx_t_2) {
26680 
26681     /* "View.MemoryView":1287
26682  *         broadcast_leading(&src, src_ndim, dst_ndim)
26683  *     elif dst_ndim < src_ndim:
26684  *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
26685  *
26686  *     cdef int ndim = max(src_ndim, dst_ndim)
26687  */
26688     __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
26689 
26690     /* "View.MemoryView":1286
26691  *     if src_ndim < dst_ndim:
26692  *         broadcast_leading(&src, src_ndim, dst_ndim)
26693  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
26694  *         broadcast_leading(&dst, dst_ndim, src_ndim)
26695  *
26696  */
26697   }
26698   __pyx_L3:;
26699 
26700   /* "View.MemoryView":1289
26701  *         broadcast_leading(&dst, dst_ndim, src_ndim)
26702  *
26703  *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
26704  *
26705  *     for i in range(ndim):
26706  */
26707   __pyx_t_3 = __pyx_v_dst_ndim;
26708   __pyx_t_4 = __pyx_v_src_ndim;
26709   if (((__pyx_t_3 > __pyx_t_4) != 0)) {
26710     __pyx_t_5 = __pyx_t_3;
26711   } else {
26712     __pyx_t_5 = __pyx_t_4;
26713   }
26714   __pyx_v_ndim = __pyx_t_5;
26715 
26716   /* "View.MemoryView":1291
26717  *     cdef int ndim = max(src_ndim, dst_ndim)
26718  *
26719  *     for i in range(ndim):             # <<<<<<<<<<<<<<
26720  *         if src.shape[i] != dst.shape[i]:
26721  *             if src.shape[i] == 1:
26722  */
26723   __pyx_t_5 = __pyx_v_ndim;
26724   __pyx_t_3 = __pyx_t_5;
26725   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
26726     __pyx_v_i = __pyx_t_4;
26727 
26728     /* "View.MemoryView":1292
26729  *
26730  *     for i in range(ndim):
26731  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
26732  *             if src.shape[i] == 1:
26733  *                 broadcasting = True
26734  */
26735     __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
26736     if (__pyx_t_2) {
26737 
26738       /* "View.MemoryView":1293
26739  *     for i in range(ndim):
26740  *         if src.shape[i] != dst.shape[i]:
26741  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
26742  *                 broadcasting = True
26743  *                 src.strides[i] = 0
26744  */
26745       __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
26746       if (__pyx_t_2) {
26747 
26748         /* "View.MemoryView":1294
26749  *         if src.shape[i] != dst.shape[i]:
26750  *             if src.shape[i] == 1:
26751  *                 broadcasting = True             # <<<<<<<<<<<<<<
26752  *                 src.strides[i] = 0
26753  *             else:
26754  */
26755         __pyx_v_broadcasting = 1;
26756 
26757         /* "View.MemoryView":1295
26758  *             if src.shape[i] == 1:
26759  *                 broadcasting = True
26760  *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
26761  *             else:
26762  *                 _err_extents(i, dst.shape[i], src.shape[i])
26763  */
26764         (__pyx_v_src.strides[__pyx_v_i]) = 0;
26765 
26766         /* "View.MemoryView":1293
26767  *     for i in range(ndim):
26768  *         if src.shape[i] != dst.shape[i]:
26769  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
26770  *                 broadcasting = True
26771  *                 src.strides[i] = 0
26772  */
26773         goto __pyx_L7;
26774       }
26775 
26776       /* "View.MemoryView":1297
26777  *                 src.strides[i] = 0
26778  *             else:
26779  *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
26780  *
26781  *         if src.suboffsets[i] >= 0:
26782  */
26783       /*else*/ {
26784         __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)
26785       }
26786       __pyx_L7:;
26787 
26788       /* "View.MemoryView":1292
26789  *
26790  *     for i in range(ndim):
26791  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
26792  *             if src.shape[i] == 1:
26793  *                 broadcasting = True
26794  */
26795     }
26796 
26797     /* "View.MemoryView":1299
26798  *                 _err_extents(i, dst.shape[i], src.shape[i])
26799  *
26800  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
26801  *             _err_dim(ValueError, "Dimension %d is not direct", i)
26802  *
26803  */
26804     __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
26805     if (__pyx_t_2) {
26806 
26807       /* "View.MemoryView":1300
26808  *
26809  *         if src.suboffsets[i] >= 0:
26810  *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
26811  *
26812  *     if slices_overlap(&src, &dst, ndim, itemsize):
26813  */
26814       __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)
26815 
26816       /* "View.MemoryView":1299
26817  *                 _err_extents(i, dst.shape[i], src.shape[i])
26818  *
26819  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
26820  *             _err_dim(ValueError, "Dimension %d is not direct", i)
26821  *
26822  */
26823     }
26824   }
26825 
26826   /* "View.MemoryView":1302
26827  *             _err_dim(ValueError, "Dimension %d is not direct", i)
26828  *
26829  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
26830  *
26831  *         if not slice_is_contig(src, order, ndim):
26832  */
26833   __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
26834   if (__pyx_t_2) {
26835 
26836     /* "View.MemoryView":1304
26837  *     if slices_overlap(&src, &dst, ndim, itemsize):
26838  *
26839  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
26840  *             order = get_best_order(&dst, ndim)
26841  *
26842  */
26843     __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
26844     if (__pyx_t_2) {
26845 
26846       /* "View.MemoryView":1305
26847  *
26848  *         if not slice_is_contig(src, order, ndim):
26849  *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
26850  *
26851  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
26852  */
26853       __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
26854 
26855       /* "View.MemoryView":1304
26856  *     if slices_overlap(&src, &dst, ndim, itemsize):
26857  *
26858  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
26859  *             order = get_best_order(&dst, ndim)
26860  *
26861  */
26862     }
26863 
26864     /* "View.MemoryView":1307
26865  *             order = get_best_order(&dst, ndim)
26866  *
26867  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
26868  *         src = tmp
26869  *
26870  */
26871     __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)
26872     __pyx_v_tmpdata = __pyx_t_7;
26873 
26874     /* "View.MemoryView":1308
26875  *
26876  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
26877  *         src = tmp             # <<<<<<<<<<<<<<
26878  *
26879  *     if not broadcasting:
26880  */
26881     __pyx_v_src = __pyx_v_tmp;
26882 
26883     /* "View.MemoryView":1302
26884  *             _err_dim(ValueError, "Dimension %d is not direct", i)
26885  *
26886  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
26887  *
26888  *         if not slice_is_contig(src, order, ndim):
26889  */
26890   }
26891 
26892   /* "View.MemoryView":1310
26893  *         src = tmp
26894  *
26895  *     if not broadcasting:             # <<<<<<<<<<<<<<
26896  *
26897  *
26898  */
26899   __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
26900   if (__pyx_t_2) {
26901 
26902     /* "View.MemoryView":1313
26903  *
26904  *
26905  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
26906  *             direct_copy = slice_is_contig(dst, 'C', ndim)
26907  *         elif slice_is_contig(src, 'F', ndim):
26908  */
26909     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
26910     if (__pyx_t_2) {
26911 
26912       /* "View.MemoryView":1314
26913  *
26914  *         if slice_is_contig(src, 'C', ndim):
26915  *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
26916  *         elif slice_is_contig(src, 'F', ndim):
26917  *             direct_copy = slice_is_contig(dst, 'F', ndim)
26918  */
26919       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
26920 
26921       /* "View.MemoryView":1313
26922  *
26923  *
26924  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
26925  *             direct_copy = slice_is_contig(dst, 'C', ndim)
26926  *         elif slice_is_contig(src, 'F', ndim):
26927  */
26928       goto __pyx_L12;
26929     }
26930 
26931     /* "View.MemoryView":1315
26932  *         if slice_is_contig(src, 'C', ndim):
26933  *             direct_copy = slice_is_contig(dst, 'C', ndim)
26934  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
26935  *             direct_copy = slice_is_contig(dst, 'F', ndim)
26936  *
26937  */
26938     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
26939     if (__pyx_t_2) {
26940 
26941       /* "View.MemoryView":1316
26942  *             direct_copy = slice_is_contig(dst, 'C', ndim)
26943  *         elif slice_is_contig(src, 'F', ndim):
26944  *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
26945  *
26946  *         if direct_copy:
26947  */
26948       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
26949 
26950       /* "View.MemoryView":1315
26951  *         if slice_is_contig(src, 'C', ndim):
26952  *             direct_copy = slice_is_contig(dst, 'C', ndim)
26953  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
26954  *             direct_copy = slice_is_contig(dst, 'F', ndim)
26955  *
26956  */
26957     }
26958     __pyx_L12:;
26959 
26960     /* "View.MemoryView":1318
26961  *             direct_copy = slice_is_contig(dst, 'F', ndim)
26962  *
26963  *         if direct_copy:             # <<<<<<<<<<<<<<
26964  *
26965  *             refcount_copying(&dst, dtype_is_object, ndim, False)
26966  */
26967     __pyx_t_2 = (__pyx_v_direct_copy != 0);
26968     if (__pyx_t_2) {
26969 
26970       /* "View.MemoryView":1320
26971  *         if direct_copy:
26972  *
26973  *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
26974  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
26975  *             refcount_copying(&dst, dtype_is_object, ndim, True)
26976  */
26977       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
26978 
26979       /* "View.MemoryView":1321
26980  *
26981  *             refcount_copying(&dst, dtype_is_object, ndim, False)
26982  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
26983  *             refcount_copying(&dst, dtype_is_object, ndim, True)
26984  *             free(tmpdata)
26985  */
26986       (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
26987 
26988       /* "View.MemoryView":1322
26989  *             refcount_copying(&dst, dtype_is_object, ndim, False)
26990  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
26991  *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
26992  *             free(tmpdata)
26993  *             return 0
26994  */
26995       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
26996 
26997       /* "View.MemoryView":1323
26998  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
26999  *             refcount_copying(&dst, dtype_is_object, ndim, True)
27000  *             free(tmpdata)             # <<<<<<<<<<<<<<
27001  *             return 0
27002  *
27003  */
27004       free(__pyx_v_tmpdata);
27005 
27006       /* "View.MemoryView":1324
27007  *             refcount_copying(&dst, dtype_is_object, ndim, True)
27008  *             free(tmpdata)
27009  *             return 0             # <<<<<<<<<<<<<<
27010  *
27011  *     if order == 'F' == get_best_order(&dst, ndim):
27012  */
27013       __pyx_r = 0;
27014       goto __pyx_L0;
27015 
27016       /* "View.MemoryView":1318
27017  *             direct_copy = slice_is_contig(dst, 'F', ndim)
27018  *
27019  *         if direct_copy:             # <<<<<<<<<<<<<<
27020  *
27021  *             refcount_copying(&dst, dtype_is_object, ndim, False)
27022  */
27023     }
27024 
27025     /* "View.MemoryView":1310
27026  *         src = tmp
27027  *
27028  *     if not broadcasting:             # <<<<<<<<<<<<<<
27029  *
27030  *
27031  */
27032   }
27033 
27034   /* "View.MemoryView":1326
27035  *             return 0
27036  *
27037  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
27038  *
27039  *
27040  */
27041   __pyx_t_2 = (__pyx_v_order == 'F');
27042   if (__pyx_t_2) {
27043     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
27044   }
27045   __pyx_t_8 = (__pyx_t_2 != 0);
27046   if (__pyx_t_8) {
27047 
27048     /* "View.MemoryView":1329
27049  *
27050  *
27051  *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
27052  *         transpose_memslice(&dst)
27053  *
27054  */
27055     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1329, __pyx_L1_error)
27056 
27057     /* "View.MemoryView":1330
27058  *
27059  *         transpose_memslice(&src)
27060  *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
27061  *
27062  *     refcount_copying(&dst, dtype_is_object, ndim, False)
27063  */
27064     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error)
27065 
27066     /* "View.MemoryView":1326
27067  *             return 0
27068  *
27069  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
27070  *
27071  *
27072  */
27073   }
27074 
27075   /* "View.MemoryView":1332
27076  *         transpose_memslice(&dst)
27077  *
27078  *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
27079  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
27080  *     refcount_copying(&dst, dtype_is_object, ndim, True)
27081  */
27082   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
27083 
27084   /* "View.MemoryView":1333
27085  *
27086  *     refcount_copying(&dst, dtype_is_object, ndim, False)
27087  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
27088  *     refcount_copying(&dst, dtype_is_object, ndim, True)
27089  *
27090  */
27091   copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
27092 
27093   /* "View.MemoryView":1334
27094  *     refcount_copying(&dst, dtype_is_object, ndim, False)
27095  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
27096  *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
27097  *
27098  *     free(tmpdata)
27099  */
27100   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
27101 
27102   /* "View.MemoryView":1336
27103  *     refcount_copying(&dst, dtype_is_object, ndim, True)
27104  *
27105  *     free(tmpdata)             # <<<<<<<<<<<<<<
27106  *     return 0
27107  *
27108  */
27109   free(__pyx_v_tmpdata);
27110 
27111   /* "View.MemoryView":1337
27112  *
27113  *     free(tmpdata)
27114  *     return 0             # <<<<<<<<<<<<<<
27115  *
27116  * @cname('__pyx_memoryview_broadcast_leading')
27117  */
27118   __pyx_r = 0;
27119   goto __pyx_L0;
27120 
27121   /* "View.MemoryView":1268
27122  *
27123  * @cname('__pyx_memoryview_copy_contents')
27124  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
27125  *                                   __Pyx_memviewslice dst,
27126  *                                   int src_ndim, int dst_ndim,
27127  */
27128 
27129   /* function exit code */
27130   __pyx_L1_error:;
27131   {
27132     #ifdef WITH_THREAD
27133     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
27134     #endif
27135     __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
27136     #ifdef WITH_THREAD
27137     __Pyx_PyGILState_Release(__pyx_gilstate_save);
27138     #endif
27139   }
27140   __pyx_r = -1;
27141   __pyx_L0:;
27142   return __pyx_r;
27143 }
27144 
27145 /* "View.MemoryView":1340
27146  *
27147  * @cname('__pyx_memoryview_broadcast_leading')
27148  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
27149  *                             int ndim,
27150  *                             int ndim_other) nogil:
27151  */
27152 
__pyx_memoryview_broadcast_leading(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim,int __pyx_v_ndim_other)27153 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
27154   int __pyx_v_i;
27155   int __pyx_v_offset;
27156   int __pyx_t_1;
27157   int __pyx_t_2;
27158   int __pyx_t_3;
27159 
27160   /* "View.MemoryView":1344
27161  *                             int ndim_other) nogil:
27162  *     cdef int i
27163  *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
27164  *
27165  *     for i in range(ndim - 1, -1, -1):
27166  */
27167   __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
27168 
27169   /* "View.MemoryView":1346
27170  *     cdef int offset = ndim_other - ndim
27171  *
27172  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
27173  *         mslice.shape[i + offset] = mslice.shape[i]
27174  *         mslice.strides[i + offset] = mslice.strides[i]
27175  */
27176   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
27177     __pyx_v_i = __pyx_t_1;
27178 
27179     /* "View.MemoryView":1347
27180  *
27181  *     for i in range(ndim - 1, -1, -1):
27182  *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
27183  *         mslice.strides[i + offset] = mslice.strides[i]
27184  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
27185  */
27186     (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
27187 
27188     /* "View.MemoryView":1348
27189  *     for i in range(ndim - 1, -1, -1):
27190  *         mslice.shape[i + offset] = mslice.shape[i]
27191  *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
27192  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
27193  *
27194  */
27195     (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
27196 
27197     /* "View.MemoryView":1349
27198  *         mslice.shape[i + offset] = mslice.shape[i]
27199  *         mslice.strides[i + offset] = mslice.strides[i]
27200  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
27201  *
27202  *     for i in range(offset):
27203  */
27204     (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
27205   }
27206 
27207   /* "View.MemoryView":1351
27208  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
27209  *
27210  *     for i in range(offset):             # <<<<<<<<<<<<<<
27211  *         mslice.shape[i] = 1
27212  *         mslice.strides[i] = mslice.strides[0]
27213  */
27214   __pyx_t_1 = __pyx_v_offset;
27215   __pyx_t_2 = __pyx_t_1;
27216   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
27217     __pyx_v_i = __pyx_t_3;
27218 
27219     /* "View.MemoryView":1352
27220  *
27221  *     for i in range(offset):
27222  *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
27223  *         mslice.strides[i] = mslice.strides[0]
27224  *         mslice.suboffsets[i] = -1
27225  */
27226     (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
27227 
27228     /* "View.MemoryView":1353
27229  *     for i in range(offset):
27230  *         mslice.shape[i] = 1
27231  *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
27232  *         mslice.suboffsets[i] = -1
27233  *
27234  */
27235     (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
27236 
27237     /* "View.MemoryView":1354
27238  *         mslice.shape[i] = 1
27239  *         mslice.strides[i] = mslice.strides[0]
27240  *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
27241  *
27242  *
27243  */
27244     (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
27245   }
27246 
27247   /* "View.MemoryView":1340
27248  *
27249  * @cname('__pyx_memoryview_broadcast_leading')
27250  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
27251  *                             int ndim,
27252  *                             int ndim_other) nogil:
27253  */
27254 
27255   /* function exit code */
27256 }
27257 
27258 /* "View.MemoryView":1362
27259  *
27260  * @cname('__pyx_memoryview_refcount_copying')
27261  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
27262  *                            int ndim, bint inc) nogil:
27263  *
27264  */
27265 
__pyx_memoryview_refcount_copying(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_dtype_is_object,int __pyx_v_ndim,int __pyx_v_inc)27266 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) {
27267   int __pyx_t_1;
27268 
27269   /* "View.MemoryView":1366
27270  *
27271  *
27272  *     if dtype_is_object:             # <<<<<<<<<<<<<<
27273  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
27274  *                                            dst.strides, ndim, inc)
27275  */
27276   __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
27277   if (__pyx_t_1) {
27278 
27279     /* "View.MemoryView":1367
27280  *
27281  *     if dtype_is_object:
27282  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
27283  *                                            dst.strides, ndim, inc)
27284  *
27285  */
27286     __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);
27287 
27288     /* "View.MemoryView":1366
27289  *
27290  *
27291  *     if dtype_is_object:             # <<<<<<<<<<<<<<
27292  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
27293  *                                            dst.strides, ndim, inc)
27294  */
27295   }
27296 
27297   /* "View.MemoryView":1362
27298  *
27299  * @cname('__pyx_memoryview_refcount_copying')
27300  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
27301  *                            int ndim, bint inc) nogil:
27302  *
27303  */
27304 
27305   /* function exit code */
27306 }
27307 
27308 /* "View.MemoryView":1371
27309  *
27310  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
27311  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
27312  *                                              Py_ssize_t *strides, int ndim,
27313  *                                              bint inc) with gil:
27314  */
27315 
__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)27316 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) {
27317   __Pyx_RefNannyDeclarations
27318   #ifdef WITH_THREAD
27319   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
27320   #endif
27321   __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
27322 
27323   /* "View.MemoryView":1374
27324  *                                              Py_ssize_t *strides, int ndim,
27325  *                                              bint inc) with gil:
27326  *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
27327  *
27328  * @cname('__pyx_memoryview_refcount_objects_in_slice')
27329  */
27330   __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
27331 
27332   /* "View.MemoryView":1371
27333  *
27334  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
27335  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
27336  *                                              Py_ssize_t *strides, int ndim,
27337  *                                              bint inc) with gil:
27338  */
27339 
27340   /* function exit code */
27341   __Pyx_RefNannyFinishContext();
27342   #ifdef WITH_THREAD
27343   __Pyx_PyGILState_Release(__pyx_gilstate_save);
27344   #endif
27345 }
27346 
27347 /* "View.MemoryView":1377
27348  *
27349  * @cname('__pyx_memoryview_refcount_objects_in_slice')
27350  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
27351  *                                     Py_ssize_t *strides, int ndim, bint inc):
27352  *     cdef Py_ssize_t i
27353  */
27354 
__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)27355 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) {
27356   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
27357   __Pyx_RefNannyDeclarations
27358   Py_ssize_t __pyx_t_1;
27359   Py_ssize_t __pyx_t_2;
27360   Py_ssize_t __pyx_t_3;
27361   int __pyx_t_4;
27362   __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
27363 
27364   /* "View.MemoryView":1381
27365  *     cdef Py_ssize_t i
27366  *
27367  *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
27368  *         if ndim == 1:
27369  *             if inc:
27370  */
27371   __pyx_t_1 = (__pyx_v_shape[0]);
27372   __pyx_t_2 = __pyx_t_1;
27373   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
27374     __pyx_v_i = __pyx_t_3;
27375 
27376     /* "View.MemoryView":1382
27377  *
27378  *     for i in range(shape[0]):
27379  *         if ndim == 1:             # <<<<<<<<<<<<<<
27380  *             if inc:
27381  *                 Py_INCREF((<PyObject **> data)[0])
27382  */
27383     __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
27384     if (__pyx_t_4) {
27385 
27386       /* "View.MemoryView":1383
27387  *     for i in range(shape[0]):
27388  *         if ndim == 1:
27389  *             if inc:             # <<<<<<<<<<<<<<
27390  *                 Py_INCREF((<PyObject **> data)[0])
27391  *             else:
27392  */
27393       __pyx_t_4 = (__pyx_v_inc != 0);
27394       if (__pyx_t_4) {
27395 
27396         /* "View.MemoryView":1384
27397  *         if ndim == 1:
27398  *             if inc:
27399  *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
27400  *             else:
27401  *                 Py_DECREF((<PyObject **> data)[0])
27402  */
27403         Py_INCREF((((PyObject **)__pyx_v_data)[0]));
27404 
27405         /* "View.MemoryView":1383
27406  *     for i in range(shape[0]):
27407  *         if ndim == 1:
27408  *             if inc:             # <<<<<<<<<<<<<<
27409  *                 Py_INCREF((<PyObject **> data)[0])
27410  *             else:
27411  */
27412         goto __pyx_L6;
27413       }
27414 
27415       /* "View.MemoryView":1386
27416  *                 Py_INCREF((<PyObject **> data)[0])
27417  *             else:
27418  *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
27419  *         else:
27420  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
27421  */
27422       /*else*/ {
27423         Py_DECREF((((PyObject **)__pyx_v_data)[0]));
27424       }
27425       __pyx_L6:;
27426 
27427       /* "View.MemoryView":1382
27428  *
27429  *     for i in range(shape[0]):
27430  *         if ndim == 1:             # <<<<<<<<<<<<<<
27431  *             if inc:
27432  *                 Py_INCREF((<PyObject **> data)[0])
27433  */
27434       goto __pyx_L5;
27435     }
27436 
27437     /* "View.MemoryView":1388
27438  *                 Py_DECREF((<PyObject **> data)[0])
27439  *         else:
27440  *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
27441  *                                       ndim - 1, inc)
27442  *
27443  */
27444     /*else*/ {
27445 
27446       /* "View.MemoryView":1389
27447  *         else:
27448  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
27449  *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
27450  *
27451  *         data += strides[0]
27452  */
27453       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
27454     }
27455     __pyx_L5:;
27456 
27457     /* "View.MemoryView":1391
27458  *                                       ndim - 1, inc)
27459  *
27460  *         data += strides[0]             # <<<<<<<<<<<<<<
27461  *
27462  *
27463  */
27464     __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
27465   }
27466 
27467   /* "View.MemoryView":1377
27468  *
27469  * @cname('__pyx_memoryview_refcount_objects_in_slice')
27470  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
27471  *                                     Py_ssize_t *strides, int ndim, bint inc):
27472  *     cdef Py_ssize_t i
27473  */
27474 
27475   /* function exit code */
27476   __Pyx_RefNannyFinishContext();
27477 }
27478 
27479 /* "View.MemoryView":1397
27480  *
27481  * @cname('__pyx_memoryview_slice_assign_scalar')
27482  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
27483  *                               size_t itemsize, void *item,
27484  *                               bint dtype_is_object) nogil:
27485  */
27486 
__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)27487 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) {
27488 
27489   /* "View.MemoryView":1400
27490  *                               size_t itemsize, void *item,
27491  *                               bint dtype_is_object) nogil:
27492  *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
27493  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
27494  *                          itemsize, item)
27495  */
27496   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
27497 
27498   /* "View.MemoryView":1401
27499  *                               bint dtype_is_object) nogil:
27500  *     refcount_copying(dst, dtype_is_object, ndim, False)
27501  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
27502  *                          itemsize, item)
27503  *     refcount_copying(dst, dtype_is_object, ndim, True)
27504  */
27505   __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);
27506 
27507   /* "View.MemoryView":1403
27508  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
27509  *                          itemsize, item)
27510  *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
27511  *
27512  *
27513  */
27514   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
27515 
27516   /* "View.MemoryView":1397
27517  *
27518  * @cname('__pyx_memoryview_slice_assign_scalar')
27519  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
27520  *                               size_t itemsize, void *item,
27521  *                               bint dtype_is_object) nogil:
27522  */
27523 
27524   /* function exit code */
27525 }
27526 
27527 /* "View.MemoryView":1407
27528  *
27529  * @cname('__pyx_memoryview__slice_assign_scalar')
27530  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
27531  *                               Py_ssize_t *strides, int ndim,
27532  *                               size_t itemsize, void *item) nogil:
27533  */
27534 
__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)27535 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) {
27536   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
27537   Py_ssize_t __pyx_v_stride;
27538   Py_ssize_t __pyx_v_extent;
27539   int __pyx_t_1;
27540   Py_ssize_t __pyx_t_2;
27541   Py_ssize_t __pyx_t_3;
27542   Py_ssize_t __pyx_t_4;
27543 
27544   /* "View.MemoryView":1411
27545  *                               size_t itemsize, void *item) nogil:
27546  *     cdef Py_ssize_t i
27547  *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
27548  *     cdef Py_ssize_t extent = shape[0]
27549  *
27550  */
27551   __pyx_v_stride = (__pyx_v_strides[0]);
27552 
27553   /* "View.MemoryView":1412
27554  *     cdef Py_ssize_t i
27555  *     cdef Py_ssize_t stride = strides[0]
27556  *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
27557  *
27558  *     if ndim == 1:
27559  */
27560   __pyx_v_extent = (__pyx_v_shape[0]);
27561 
27562   /* "View.MemoryView":1414
27563  *     cdef Py_ssize_t extent = shape[0]
27564  *
27565  *     if ndim == 1:             # <<<<<<<<<<<<<<
27566  *         for i in range(extent):
27567  *             memcpy(data, item, itemsize)
27568  */
27569   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
27570   if (__pyx_t_1) {
27571 
27572     /* "View.MemoryView":1415
27573  *
27574  *     if ndim == 1:
27575  *         for i in range(extent):             # <<<<<<<<<<<<<<
27576  *             memcpy(data, item, itemsize)
27577  *             data += stride
27578  */
27579     __pyx_t_2 = __pyx_v_extent;
27580     __pyx_t_3 = __pyx_t_2;
27581     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
27582       __pyx_v_i = __pyx_t_4;
27583 
27584       /* "View.MemoryView":1416
27585  *     if ndim == 1:
27586  *         for i in range(extent):
27587  *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
27588  *             data += stride
27589  *     else:
27590  */
27591       (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
27592 
27593       /* "View.MemoryView":1417
27594  *         for i in range(extent):
27595  *             memcpy(data, item, itemsize)
27596  *             data += stride             # <<<<<<<<<<<<<<
27597  *     else:
27598  *         for i in range(extent):
27599  */
27600       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
27601     }
27602 
27603     /* "View.MemoryView":1414
27604  *     cdef Py_ssize_t extent = shape[0]
27605  *
27606  *     if ndim == 1:             # <<<<<<<<<<<<<<
27607  *         for i in range(extent):
27608  *             memcpy(data, item, itemsize)
27609  */
27610     goto __pyx_L3;
27611   }
27612 
27613   /* "View.MemoryView":1419
27614  *             data += stride
27615  *     else:
27616  *         for i in range(extent):             # <<<<<<<<<<<<<<
27617  *             _slice_assign_scalar(data, shape + 1, strides + 1,
27618  *                                 ndim - 1, itemsize, item)
27619  */
27620   /*else*/ {
27621     __pyx_t_2 = __pyx_v_extent;
27622     __pyx_t_3 = __pyx_t_2;
27623     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
27624       __pyx_v_i = __pyx_t_4;
27625 
27626       /* "View.MemoryView":1420
27627  *     else:
27628  *         for i in range(extent):
27629  *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
27630  *                                 ndim - 1, itemsize, item)
27631  *             data += stride
27632  */
27633       __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);
27634 
27635       /* "View.MemoryView":1422
27636  *             _slice_assign_scalar(data, shape + 1, strides + 1,
27637  *                                 ndim - 1, itemsize, item)
27638  *             data += stride             # <<<<<<<<<<<<<<
27639  *
27640  *
27641  */
27642       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
27643     }
27644   }
27645   __pyx_L3:;
27646 
27647   /* "View.MemoryView":1407
27648  *
27649  * @cname('__pyx_memoryview__slice_assign_scalar')
27650  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
27651  *                               Py_ssize_t *strides, int ndim,
27652  *                               size_t itemsize, void *item) nogil:
27653  */
27654 
27655   /* function exit code */
27656 }
27657 
27658 /* "(tree fragment)":1
27659  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
27660  *     cdef object __pyx_PickleError
27661  *     cdef object __pyx_result
27662  */
27663 
27664 /* Python wrapper */
27665 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
27666 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)27667 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
27668   PyObject *__pyx_v___pyx_type = 0;
27669   long __pyx_v___pyx_checksum;
27670   PyObject *__pyx_v___pyx_state = 0;
27671   int __pyx_lineno = 0;
27672   const char *__pyx_filename = NULL;
27673   int __pyx_clineno = 0;
27674   PyObject *__pyx_r = 0;
27675   __Pyx_RefNannyDeclarations
27676   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
27677   {
27678     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
27679     PyObject* values[3] = {0,0,0};
27680     if (unlikely(__pyx_kwds)) {
27681       Py_ssize_t kw_args;
27682       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
27683       switch (pos_args) {
27684         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
27685         CYTHON_FALLTHROUGH;
27686         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
27687         CYTHON_FALLTHROUGH;
27688         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27689         CYTHON_FALLTHROUGH;
27690         case  0: break;
27691         default: goto __pyx_L5_argtuple_error;
27692       }
27693       kw_args = PyDict_Size(__pyx_kwds);
27694       switch (pos_args) {
27695         case  0:
27696         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
27697         else goto __pyx_L5_argtuple_error;
27698         CYTHON_FALLTHROUGH;
27699         case  1:
27700         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
27701         else {
27702           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
27703         }
27704         CYTHON_FALLTHROUGH;
27705         case  2:
27706         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
27707         else {
27708           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
27709         }
27710       }
27711       if (unlikely(kw_args > 0)) {
27712         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
27713       }
27714     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
27715       goto __pyx_L5_argtuple_error;
27716     } else {
27717       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27718       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
27719       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
27720     }
27721     __pyx_v___pyx_type = values[0];
27722     __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)
27723     __pyx_v___pyx_state = values[2];
27724   }
27725   goto __pyx_L4_argument_unpacking_done;
27726   __pyx_L5_argtuple_error:;
27727   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
27728   __pyx_L3_error:;
27729   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
27730   __Pyx_RefNannyFinishContext();
27731   return NULL;
27732   __pyx_L4_argument_unpacking_done:;
27733   __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
27734 
27735   /* function exit code */
27736   __Pyx_RefNannyFinishContext();
27737   return __pyx_r;
27738 }
27739 
__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)27740 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) {
27741   PyObject *__pyx_v___pyx_PickleError = 0;
27742   PyObject *__pyx_v___pyx_result = 0;
27743   PyObject *__pyx_r = NULL;
27744   __Pyx_RefNannyDeclarations
27745   int __pyx_t_1;
27746   PyObject *__pyx_t_2 = NULL;
27747   PyObject *__pyx_t_3 = NULL;
27748   PyObject *__pyx_t_4 = NULL;
27749   PyObject *__pyx_t_5 = NULL;
27750   int __pyx_t_6;
27751   int __pyx_lineno = 0;
27752   const char *__pyx_filename = NULL;
27753   int __pyx_clineno = 0;
27754   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
27755 
27756   /* "(tree fragment)":4
27757  *     cdef object __pyx_PickleError
27758  *     cdef object __pyx_result
27759  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
27760  *         from pickle import PickleError as __pyx_PickleError
27761  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
27762  */
27763   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
27764   if (__pyx_t_1) {
27765 
27766     /* "(tree fragment)":5
27767  *     cdef object __pyx_result
27768  *     if __pyx_checksum != 0xb068931:
27769  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
27770  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
27771  *     __pyx_result = Enum.__new__(__pyx_type)
27772  */
27773     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
27774     __Pyx_GOTREF(__pyx_t_2);
27775     __Pyx_INCREF(__pyx_n_s_PickleError);
27776     __Pyx_GIVEREF(__pyx_n_s_PickleError);
27777     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
27778     __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)
27779     __Pyx_GOTREF(__pyx_t_3);
27780     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27781     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
27782     __Pyx_GOTREF(__pyx_t_2);
27783     __Pyx_INCREF(__pyx_t_2);
27784     __pyx_v___pyx_PickleError = __pyx_t_2;
27785     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27786     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27787 
27788     /* "(tree fragment)":6
27789  *     if __pyx_checksum != 0xb068931:
27790  *         from pickle import PickleError as __pyx_PickleError
27791  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
27792  *     __pyx_result = Enum.__new__(__pyx_type)
27793  *     if __pyx_state is not None:
27794  */
27795     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
27796     __Pyx_GOTREF(__pyx_t_2);
27797     __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)
27798     __Pyx_GOTREF(__pyx_t_4);
27799     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27800     __Pyx_INCREF(__pyx_v___pyx_PickleError);
27801     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
27802     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
27803       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
27804       if (likely(__pyx_t_5)) {
27805         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
27806         __Pyx_INCREF(__pyx_t_5);
27807         __Pyx_INCREF(function);
27808         __Pyx_DECREF_SET(__pyx_t_2, function);
27809       }
27810     }
27811     __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);
27812     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
27813     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27814     if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
27815     __Pyx_GOTREF(__pyx_t_3);
27816     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27817     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
27818     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27819     __PYX_ERR(2, 6, __pyx_L1_error)
27820 
27821     /* "(tree fragment)":4
27822  *     cdef object __pyx_PickleError
27823  *     cdef object __pyx_result
27824  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
27825  *         from pickle import PickleError as __pyx_PickleError
27826  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
27827  */
27828   }
27829 
27830   /* "(tree fragment)":7
27831  *         from pickle import PickleError as __pyx_PickleError
27832  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
27833  *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
27834  *     if __pyx_state is not None:
27835  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
27836  */
27837   __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)
27838   __Pyx_GOTREF(__pyx_t_2);
27839   __pyx_t_4 = NULL;
27840   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
27841     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
27842     if (likely(__pyx_t_4)) {
27843       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
27844       __Pyx_INCREF(__pyx_t_4);
27845       __Pyx_INCREF(function);
27846       __Pyx_DECREF_SET(__pyx_t_2, function);
27847     }
27848   }
27849   __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);
27850   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
27851   if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
27852   __Pyx_GOTREF(__pyx_t_3);
27853   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27854   __pyx_v___pyx_result = __pyx_t_3;
27855   __pyx_t_3 = 0;
27856 
27857   /* "(tree fragment)":8
27858  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
27859  *     __pyx_result = Enum.__new__(__pyx_type)
27860  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
27861  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
27862  *     return __pyx_result
27863  */
27864   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
27865   __pyx_t_6 = (__pyx_t_1 != 0);
27866   if (__pyx_t_6) {
27867 
27868     /* "(tree fragment)":9
27869  *     __pyx_result = Enum.__new__(__pyx_type)
27870  *     if __pyx_state is not None:
27871  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
27872  *     return __pyx_result
27873  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
27874  */
27875     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)
27876     __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)
27877     __Pyx_GOTREF(__pyx_t_3);
27878     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27879 
27880     /* "(tree fragment)":8
27881  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
27882  *     __pyx_result = Enum.__new__(__pyx_type)
27883  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
27884  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
27885  *     return __pyx_result
27886  */
27887   }
27888 
27889   /* "(tree fragment)":10
27890  *     if __pyx_state is not None:
27891  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
27892  *     return __pyx_result             # <<<<<<<<<<<<<<
27893  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
27894  *     __pyx_result.name = __pyx_state[0]
27895  */
27896   __Pyx_XDECREF(__pyx_r);
27897   __Pyx_INCREF(__pyx_v___pyx_result);
27898   __pyx_r = __pyx_v___pyx_result;
27899   goto __pyx_L0;
27900 
27901   /* "(tree fragment)":1
27902  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
27903  *     cdef object __pyx_PickleError
27904  *     cdef object __pyx_result
27905  */
27906 
27907   /* function exit code */
27908   __pyx_L1_error:;
27909   __Pyx_XDECREF(__pyx_t_2);
27910   __Pyx_XDECREF(__pyx_t_3);
27911   __Pyx_XDECREF(__pyx_t_4);
27912   __Pyx_XDECREF(__pyx_t_5);
27913   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
27914   __pyx_r = NULL;
27915   __pyx_L0:;
27916   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
27917   __Pyx_XDECREF(__pyx_v___pyx_result);
27918   __Pyx_XGIVEREF(__pyx_r);
27919   __Pyx_RefNannyFinishContext();
27920   return __pyx_r;
27921 }
27922 
27923 /* "(tree fragment)":11
27924  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
27925  *     return __pyx_result
27926  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
27927  *     __pyx_result.name = __pyx_state[0]
27928  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
27929  */
27930 
__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)27931 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
27932   PyObject *__pyx_r = NULL;
27933   __Pyx_RefNannyDeclarations
27934   PyObject *__pyx_t_1 = NULL;
27935   int __pyx_t_2;
27936   Py_ssize_t __pyx_t_3;
27937   int __pyx_t_4;
27938   int __pyx_t_5;
27939   PyObject *__pyx_t_6 = NULL;
27940   PyObject *__pyx_t_7 = NULL;
27941   PyObject *__pyx_t_8 = NULL;
27942   int __pyx_lineno = 0;
27943   const char *__pyx_filename = NULL;
27944   int __pyx_clineno = 0;
27945   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
27946 
27947   /* "(tree fragment)":12
27948  *     return __pyx_result
27949  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
27950  *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
27951  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
27952  *         __pyx_result.__dict__.update(__pyx_state[1])
27953  */
27954   if (unlikely(__pyx_v___pyx_state == Py_None)) {
27955     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
27956     __PYX_ERR(2, 12, __pyx_L1_error)
27957   }
27958   __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)
27959   __Pyx_GOTREF(__pyx_t_1);
27960   __Pyx_GIVEREF(__pyx_t_1);
27961   __Pyx_GOTREF(__pyx_v___pyx_result->name);
27962   __Pyx_DECREF(__pyx_v___pyx_result->name);
27963   __pyx_v___pyx_result->name = __pyx_t_1;
27964   __pyx_t_1 = 0;
27965 
27966   /* "(tree fragment)":13
27967  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
27968  *     __pyx_result.name = __pyx_state[0]
27969  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
27970  *         __pyx_result.__dict__.update(__pyx_state[1])
27971  */
27972   if (unlikely(__pyx_v___pyx_state == Py_None)) {
27973     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
27974     __PYX_ERR(2, 13, __pyx_L1_error)
27975   }
27976   __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)
27977   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
27978   if (__pyx_t_4) {
27979   } else {
27980     __pyx_t_2 = __pyx_t_4;
27981     goto __pyx_L4_bool_binop_done;
27982   }
27983   __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)
27984   __pyx_t_5 = (__pyx_t_4 != 0);
27985   __pyx_t_2 = __pyx_t_5;
27986   __pyx_L4_bool_binop_done:;
27987   if (__pyx_t_2) {
27988 
27989     /* "(tree fragment)":14
27990  *     __pyx_result.name = __pyx_state[0]
27991  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
27992  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
27993  */
27994     __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)
27995     __Pyx_GOTREF(__pyx_t_6);
27996     __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)
27997     __Pyx_GOTREF(__pyx_t_7);
27998     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
27999     if (unlikely(__pyx_v___pyx_state == Py_None)) {
28000       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
28001       __PYX_ERR(2, 14, __pyx_L1_error)
28002     }
28003     __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)
28004     __Pyx_GOTREF(__pyx_t_6);
28005     __pyx_t_8 = NULL;
28006     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
28007       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
28008       if (likely(__pyx_t_8)) {
28009         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
28010         __Pyx_INCREF(__pyx_t_8);
28011         __Pyx_INCREF(function);
28012         __Pyx_DECREF_SET(__pyx_t_7, function);
28013       }
28014     }
28015     __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);
28016     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
28017     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28018     if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
28019     __Pyx_GOTREF(__pyx_t_1);
28020     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
28021     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
28022 
28023     /* "(tree fragment)":13
28024  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
28025  *     __pyx_result.name = __pyx_state[0]
28026  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
28027  *         __pyx_result.__dict__.update(__pyx_state[1])
28028  */
28029   }
28030 
28031   /* "(tree fragment)":11
28032  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
28033  *     return __pyx_result
28034  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
28035  *     __pyx_result.name = __pyx_state[0]
28036  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
28037  */
28038 
28039   /* function exit code */
28040   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
28041   goto __pyx_L0;
28042   __pyx_L1_error:;
28043   __Pyx_XDECREF(__pyx_t_1);
28044   __Pyx_XDECREF(__pyx_t_6);
28045   __Pyx_XDECREF(__pyx_t_7);
28046   __Pyx_XDECREF(__pyx_t_8);
28047   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
28048   __pyx_r = 0;
28049   __pyx_L0:;
28050   __Pyx_XGIVEREF(__pyx_r);
28051   __Pyx_RefNannyFinishContext();
28052   return __pyx_r;
28053 }
28054 static struct __pyx_vtabstruct_array __pyx_vtable_array;
28055 
__pyx_tp_new_array(PyTypeObject * t,PyObject * a,PyObject * k)28056 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
28057   struct __pyx_array_obj *p;
28058   PyObject *o;
28059   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
28060     o = (*t->tp_alloc)(t, 0);
28061   } else {
28062     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
28063   }
28064   if (unlikely(!o)) return 0;
28065   p = ((struct __pyx_array_obj *)o);
28066   p->__pyx_vtab = __pyx_vtabptr_array;
28067   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
28068   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
28069   if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
28070   return o;
28071   bad:
28072   Py_DECREF(o); o = 0;
28073   return NULL;
28074 }
28075 
__pyx_tp_dealloc_array(PyObject * o)28076 static void __pyx_tp_dealloc_array(PyObject *o) {
28077   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
28078   #if CYTHON_USE_TP_FINALIZE
28079   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))) {
28080     if (PyObject_CallFinalizerFromDealloc(o)) return;
28081   }
28082   #endif
28083   {
28084     PyObject *etype, *eval, *etb;
28085     PyErr_Fetch(&etype, &eval, &etb);
28086     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
28087     __pyx_array___dealloc__(o);
28088     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
28089     PyErr_Restore(etype, eval, etb);
28090   }
28091   Py_CLEAR(p->mode);
28092   Py_CLEAR(p->_format);
28093   (*Py_TYPE(o)->tp_free)(o);
28094 }
__pyx_sq_item_array(PyObject * o,Py_ssize_t i)28095 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
28096   PyObject *r;
28097   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
28098   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
28099   Py_DECREF(x);
28100   return r;
28101 }
28102 
__pyx_mp_ass_subscript_array(PyObject * o,PyObject * i,PyObject * v)28103 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
28104   if (v) {
28105     return __pyx_array___setitem__(o, i, v);
28106   }
28107   else {
28108     PyErr_Format(PyExc_NotImplementedError,
28109       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
28110     return -1;
28111   }
28112 }
28113 
__pyx_tp_getattro_array(PyObject * o,PyObject * n)28114 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
28115   PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
28116   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
28117     PyErr_Clear();
28118     v = __pyx_array___getattr__(o, n);
28119   }
28120   return v;
28121 }
28122 
__pyx_getprop___pyx_array_memview(PyObject * o,CYTHON_UNUSED void * x)28123 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
28124   return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
28125 }
28126 
28127 static PyMethodDef __pyx_methods_array[] = {
28128   {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
28129   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
28130   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
28131   {0, 0, 0, 0}
28132 };
28133 
28134 static struct PyGetSetDef __pyx_getsets_array[] = {
28135   {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
28136   {0, 0, 0, 0, 0}
28137 };
28138 
28139 static PySequenceMethods __pyx_tp_as_sequence_array = {
28140   __pyx_array___len__, /*sq_length*/
28141   0, /*sq_concat*/
28142   0, /*sq_repeat*/
28143   __pyx_sq_item_array, /*sq_item*/
28144   0, /*sq_slice*/
28145   0, /*sq_ass_item*/
28146   0, /*sq_ass_slice*/
28147   0, /*sq_contains*/
28148   0, /*sq_inplace_concat*/
28149   0, /*sq_inplace_repeat*/
28150 };
28151 
28152 static PyMappingMethods __pyx_tp_as_mapping_array = {
28153   __pyx_array___len__, /*mp_length*/
28154   __pyx_array___getitem__, /*mp_subscript*/
28155   __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
28156 };
28157 
28158 static PyBufferProcs __pyx_tp_as_buffer_array = {
28159   #if PY_MAJOR_VERSION < 3
28160   0, /*bf_getreadbuffer*/
28161   #endif
28162   #if PY_MAJOR_VERSION < 3
28163   0, /*bf_getwritebuffer*/
28164   #endif
28165   #if PY_MAJOR_VERSION < 3
28166   0, /*bf_getsegcount*/
28167   #endif
28168   #if PY_MAJOR_VERSION < 3
28169   0, /*bf_getcharbuffer*/
28170   #endif
28171   __pyx_array_getbuffer, /*bf_getbuffer*/
28172   0, /*bf_releasebuffer*/
28173 };
28174 
28175 static PyTypeObject __pyx_type___pyx_array = {
28176   PyVarObject_HEAD_INIT(0, 0)
28177   "statsmodels.tsa.innovations._arma_innovations.array", /*tp_name*/
28178   sizeof(struct __pyx_array_obj), /*tp_basicsize*/
28179   0, /*tp_itemsize*/
28180   __pyx_tp_dealloc_array, /*tp_dealloc*/
28181   #if PY_VERSION_HEX < 0x030800b4
28182   0, /*tp_print*/
28183   #endif
28184   #if PY_VERSION_HEX >= 0x030800b4
28185   0, /*tp_vectorcall_offset*/
28186   #endif
28187   0, /*tp_getattr*/
28188   0, /*tp_setattr*/
28189   #if PY_MAJOR_VERSION < 3
28190   0, /*tp_compare*/
28191   #endif
28192   #if PY_MAJOR_VERSION >= 3
28193   0, /*tp_as_async*/
28194   #endif
28195   0, /*tp_repr*/
28196   0, /*tp_as_number*/
28197   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
28198   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
28199   0, /*tp_hash*/
28200   0, /*tp_call*/
28201   0, /*tp_str*/
28202   __pyx_tp_getattro_array, /*tp_getattro*/
28203   0, /*tp_setattro*/
28204   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
28205   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
28206   0, /*tp_doc*/
28207   0, /*tp_traverse*/
28208   0, /*tp_clear*/
28209   0, /*tp_richcompare*/
28210   0, /*tp_weaklistoffset*/
28211   0, /*tp_iter*/
28212   0, /*tp_iternext*/
28213   __pyx_methods_array, /*tp_methods*/
28214   0, /*tp_members*/
28215   __pyx_getsets_array, /*tp_getset*/
28216   0, /*tp_base*/
28217   0, /*tp_dict*/
28218   0, /*tp_descr_get*/
28219   0, /*tp_descr_set*/
28220   0, /*tp_dictoffset*/
28221   0, /*tp_init*/
28222   0, /*tp_alloc*/
28223   __pyx_tp_new_array, /*tp_new*/
28224   0, /*tp_free*/
28225   0, /*tp_is_gc*/
28226   0, /*tp_bases*/
28227   0, /*tp_mro*/
28228   0, /*tp_cache*/
28229   0, /*tp_subclasses*/
28230   0, /*tp_weaklist*/
28231   0, /*tp_del*/
28232   0, /*tp_version_tag*/
28233   #if PY_VERSION_HEX >= 0x030400a1
28234   0, /*tp_finalize*/
28235   #endif
28236   #if PY_VERSION_HEX >= 0x030800b1
28237   0, /*tp_vectorcall*/
28238   #endif
28239   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
28240   0, /*tp_print*/
28241   #endif
28242 };
28243 
__pyx_tp_new_Enum(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)28244 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
28245   struct __pyx_MemviewEnum_obj *p;
28246   PyObject *o;
28247   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
28248     o = (*t->tp_alloc)(t, 0);
28249   } else {
28250     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
28251   }
28252   if (unlikely(!o)) return 0;
28253   p = ((struct __pyx_MemviewEnum_obj *)o);
28254   p->name = Py_None; Py_INCREF(Py_None);
28255   return o;
28256 }
28257 
__pyx_tp_dealloc_Enum(PyObject * o)28258 static void __pyx_tp_dealloc_Enum(PyObject *o) {
28259   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
28260   #if CYTHON_USE_TP_FINALIZE
28261   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
28262     if (PyObject_CallFinalizerFromDealloc(o)) return;
28263   }
28264   #endif
28265   PyObject_GC_UnTrack(o);
28266   Py_CLEAR(p->name);
28267   (*Py_TYPE(o)->tp_free)(o);
28268 }
28269 
__pyx_tp_traverse_Enum(PyObject * o,visitproc v,void * a)28270 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
28271   int e;
28272   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
28273   if (p->name) {
28274     e = (*v)(p->name, a); if (e) return e;
28275   }
28276   return 0;
28277 }
28278 
__pyx_tp_clear_Enum(PyObject * o)28279 static int __pyx_tp_clear_Enum(PyObject *o) {
28280   PyObject* tmp;
28281   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
28282   tmp = ((PyObject*)p->name);
28283   p->name = Py_None; Py_INCREF(Py_None);
28284   Py_XDECREF(tmp);
28285   return 0;
28286 }
28287 
28288 static PyMethodDef __pyx_methods_Enum[] = {
28289   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
28290   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
28291   {0, 0, 0, 0}
28292 };
28293 
28294 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
28295   PyVarObject_HEAD_INIT(0, 0)
28296   "statsmodels.tsa.innovations._arma_innovations.Enum", /*tp_name*/
28297   sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
28298   0, /*tp_itemsize*/
28299   __pyx_tp_dealloc_Enum, /*tp_dealloc*/
28300   #if PY_VERSION_HEX < 0x030800b4
28301   0, /*tp_print*/
28302   #endif
28303   #if PY_VERSION_HEX >= 0x030800b4
28304   0, /*tp_vectorcall_offset*/
28305   #endif
28306   0, /*tp_getattr*/
28307   0, /*tp_setattr*/
28308   #if PY_MAJOR_VERSION < 3
28309   0, /*tp_compare*/
28310   #endif
28311   #if PY_MAJOR_VERSION >= 3
28312   0, /*tp_as_async*/
28313   #endif
28314   __pyx_MemviewEnum___repr__, /*tp_repr*/
28315   0, /*tp_as_number*/
28316   0, /*tp_as_sequence*/
28317   0, /*tp_as_mapping*/
28318   0, /*tp_hash*/
28319   0, /*tp_call*/
28320   0, /*tp_str*/
28321   0, /*tp_getattro*/
28322   0, /*tp_setattro*/
28323   0, /*tp_as_buffer*/
28324   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
28325   0, /*tp_doc*/
28326   __pyx_tp_traverse_Enum, /*tp_traverse*/
28327   __pyx_tp_clear_Enum, /*tp_clear*/
28328   0, /*tp_richcompare*/
28329   0, /*tp_weaklistoffset*/
28330   0, /*tp_iter*/
28331   0, /*tp_iternext*/
28332   __pyx_methods_Enum, /*tp_methods*/
28333   0, /*tp_members*/
28334   0, /*tp_getset*/
28335   0, /*tp_base*/
28336   0, /*tp_dict*/
28337   0, /*tp_descr_get*/
28338   0, /*tp_descr_set*/
28339   0, /*tp_dictoffset*/
28340   __pyx_MemviewEnum___init__, /*tp_init*/
28341   0, /*tp_alloc*/
28342   __pyx_tp_new_Enum, /*tp_new*/
28343   0, /*tp_free*/
28344   0, /*tp_is_gc*/
28345   0, /*tp_bases*/
28346   0, /*tp_mro*/
28347   0, /*tp_cache*/
28348   0, /*tp_subclasses*/
28349   0, /*tp_weaklist*/
28350   0, /*tp_del*/
28351   0, /*tp_version_tag*/
28352   #if PY_VERSION_HEX >= 0x030400a1
28353   0, /*tp_finalize*/
28354   #endif
28355   #if PY_VERSION_HEX >= 0x030800b1
28356   0, /*tp_vectorcall*/
28357   #endif
28358   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
28359   0, /*tp_print*/
28360   #endif
28361 };
28362 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
28363 
__pyx_tp_new_memoryview(PyTypeObject * t,PyObject * a,PyObject * k)28364 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
28365   struct __pyx_memoryview_obj *p;
28366   PyObject *o;
28367   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
28368     o = (*t->tp_alloc)(t, 0);
28369   } else {
28370     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
28371   }
28372   if (unlikely(!o)) return 0;
28373   p = ((struct __pyx_memoryview_obj *)o);
28374   p->__pyx_vtab = __pyx_vtabptr_memoryview;
28375   p->obj = Py_None; Py_INCREF(Py_None);
28376   p->_size = Py_None; Py_INCREF(Py_None);
28377   p->_array_interface = Py_None; Py_INCREF(Py_None);
28378   p->view.obj = NULL;
28379   if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
28380   return o;
28381   bad:
28382   Py_DECREF(o); o = 0;
28383   return NULL;
28384 }
28385 
__pyx_tp_dealloc_memoryview(PyObject * o)28386 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
28387   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
28388   #if CYTHON_USE_TP_FINALIZE
28389   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
28390     if (PyObject_CallFinalizerFromDealloc(o)) return;
28391   }
28392   #endif
28393   PyObject_GC_UnTrack(o);
28394   {
28395     PyObject *etype, *eval, *etb;
28396     PyErr_Fetch(&etype, &eval, &etb);
28397     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
28398     __pyx_memoryview___dealloc__(o);
28399     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
28400     PyErr_Restore(etype, eval, etb);
28401   }
28402   Py_CLEAR(p->obj);
28403   Py_CLEAR(p->_size);
28404   Py_CLEAR(p->_array_interface);
28405   (*Py_TYPE(o)->tp_free)(o);
28406 }
28407 
__pyx_tp_traverse_memoryview(PyObject * o,visitproc v,void * a)28408 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
28409   int e;
28410   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
28411   if (p->obj) {
28412     e = (*v)(p->obj, a); if (e) return e;
28413   }
28414   if (p->_size) {
28415     e = (*v)(p->_size, a); if (e) return e;
28416   }
28417   if (p->_array_interface) {
28418     e = (*v)(p->_array_interface, a); if (e) return e;
28419   }
28420   if (p->view.obj) {
28421     e = (*v)(p->view.obj, a); if (e) return e;
28422   }
28423   return 0;
28424 }
28425 
__pyx_tp_clear_memoryview(PyObject * o)28426 static int __pyx_tp_clear_memoryview(PyObject *o) {
28427   PyObject* tmp;
28428   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
28429   tmp = ((PyObject*)p->obj);
28430   p->obj = Py_None; Py_INCREF(Py_None);
28431   Py_XDECREF(tmp);
28432   tmp = ((PyObject*)p->_size);
28433   p->_size = Py_None; Py_INCREF(Py_None);
28434   Py_XDECREF(tmp);
28435   tmp = ((PyObject*)p->_array_interface);
28436   p->_array_interface = Py_None; Py_INCREF(Py_None);
28437   Py_XDECREF(tmp);
28438   Py_CLEAR(p->view.obj);
28439   return 0;
28440 }
__pyx_sq_item_memoryview(PyObject * o,Py_ssize_t i)28441 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
28442   PyObject *r;
28443   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
28444   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
28445   Py_DECREF(x);
28446   return r;
28447 }
28448 
__pyx_mp_ass_subscript_memoryview(PyObject * o,PyObject * i,PyObject * v)28449 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
28450   if (v) {
28451     return __pyx_memoryview___setitem__(o, i, v);
28452   }
28453   else {
28454     PyErr_Format(PyExc_NotImplementedError,
28455       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
28456     return -1;
28457   }
28458 }
28459 
__pyx_getprop___pyx_memoryview_T(PyObject * o,CYTHON_UNUSED void * x)28460 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
28461   return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
28462 }
28463 
__pyx_getprop___pyx_memoryview_base(PyObject * o,CYTHON_UNUSED void * x)28464 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
28465   return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
28466 }
28467 
__pyx_getprop___pyx_memoryview_shape(PyObject * o,CYTHON_UNUSED void * x)28468 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
28469   return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
28470 }
28471 
__pyx_getprop___pyx_memoryview_strides(PyObject * o,CYTHON_UNUSED void * x)28472 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
28473   return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
28474 }
28475 
__pyx_getprop___pyx_memoryview_suboffsets(PyObject * o,CYTHON_UNUSED void * x)28476 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
28477   return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
28478 }
28479 
__pyx_getprop___pyx_memoryview_ndim(PyObject * o,CYTHON_UNUSED void * x)28480 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
28481   return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
28482 }
28483 
__pyx_getprop___pyx_memoryview_itemsize(PyObject * o,CYTHON_UNUSED void * x)28484 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
28485   return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
28486 }
28487 
__pyx_getprop___pyx_memoryview_nbytes(PyObject * o,CYTHON_UNUSED void * x)28488 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
28489   return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
28490 }
28491 
__pyx_getprop___pyx_memoryview_size(PyObject * o,CYTHON_UNUSED void * x)28492 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
28493   return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
28494 }
28495 
28496 static PyMethodDef __pyx_methods_memoryview[] = {
28497   {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
28498   {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
28499   {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
28500   {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
28501   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
28502   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
28503   {0, 0, 0, 0}
28504 };
28505 
28506 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
28507   {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
28508   {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
28509   {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
28510   {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
28511   {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
28512   {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
28513   {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
28514   {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
28515   {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
28516   {0, 0, 0, 0, 0}
28517 };
28518 
28519 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
28520   __pyx_memoryview___len__, /*sq_length*/
28521   0, /*sq_concat*/
28522   0, /*sq_repeat*/
28523   __pyx_sq_item_memoryview, /*sq_item*/
28524   0, /*sq_slice*/
28525   0, /*sq_ass_item*/
28526   0, /*sq_ass_slice*/
28527   0, /*sq_contains*/
28528   0, /*sq_inplace_concat*/
28529   0, /*sq_inplace_repeat*/
28530 };
28531 
28532 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
28533   __pyx_memoryview___len__, /*mp_length*/
28534   __pyx_memoryview___getitem__, /*mp_subscript*/
28535   __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
28536 };
28537 
28538 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
28539   #if PY_MAJOR_VERSION < 3
28540   0, /*bf_getreadbuffer*/
28541   #endif
28542   #if PY_MAJOR_VERSION < 3
28543   0, /*bf_getwritebuffer*/
28544   #endif
28545   #if PY_MAJOR_VERSION < 3
28546   0, /*bf_getsegcount*/
28547   #endif
28548   #if PY_MAJOR_VERSION < 3
28549   0, /*bf_getcharbuffer*/
28550   #endif
28551   __pyx_memoryview_getbuffer, /*bf_getbuffer*/
28552   0, /*bf_releasebuffer*/
28553 };
28554 
28555 static PyTypeObject __pyx_type___pyx_memoryview = {
28556   PyVarObject_HEAD_INIT(0, 0)
28557   "statsmodels.tsa.innovations._arma_innovations.memoryview", /*tp_name*/
28558   sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
28559   0, /*tp_itemsize*/
28560   __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
28561   #if PY_VERSION_HEX < 0x030800b4
28562   0, /*tp_print*/
28563   #endif
28564   #if PY_VERSION_HEX >= 0x030800b4
28565   0, /*tp_vectorcall_offset*/
28566   #endif
28567   0, /*tp_getattr*/
28568   0, /*tp_setattr*/
28569   #if PY_MAJOR_VERSION < 3
28570   0, /*tp_compare*/
28571   #endif
28572   #if PY_MAJOR_VERSION >= 3
28573   0, /*tp_as_async*/
28574   #endif
28575   __pyx_memoryview___repr__, /*tp_repr*/
28576   0, /*tp_as_number*/
28577   &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
28578   &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
28579   0, /*tp_hash*/
28580   0, /*tp_call*/
28581   __pyx_memoryview___str__, /*tp_str*/
28582   0, /*tp_getattro*/
28583   0, /*tp_setattro*/
28584   &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
28585   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
28586   0, /*tp_doc*/
28587   __pyx_tp_traverse_memoryview, /*tp_traverse*/
28588   __pyx_tp_clear_memoryview, /*tp_clear*/
28589   0, /*tp_richcompare*/
28590   0, /*tp_weaklistoffset*/
28591   0, /*tp_iter*/
28592   0, /*tp_iternext*/
28593   __pyx_methods_memoryview, /*tp_methods*/
28594   0, /*tp_members*/
28595   __pyx_getsets_memoryview, /*tp_getset*/
28596   0, /*tp_base*/
28597   0, /*tp_dict*/
28598   0, /*tp_descr_get*/
28599   0, /*tp_descr_set*/
28600   0, /*tp_dictoffset*/
28601   0, /*tp_init*/
28602   0, /*tp_alloc*/
28603   __pyx_tp_new_memoryview, /*tp_new*/
28604   0, /*tp_free*/
28605   0, /*tp_is_gc*/
28606   0, /*tp_bases*/
28607   0, /*tp_mro*/
28608   0, /*tp_cache*/
28609   0, /*tp_subclasses*/
28610   0, /*tp_weaklist*/
28611   0, /*tp_del*/
28612   0, /*tp_version_tag*/
28613   #if PY_VERSION_HEX >= 0x030400a1
28614   0, /*tp_finalize*/
28615   #endif
28616   #if PY_VERSION_HEX >= 0x030800b1
28617   0, /*tp_vectorcall*/
28618   #endif
28619   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
28620   0, /*tp_print*/
28621   #endif
28622 };
28623 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
28624 
__pyx_tp_new__memoryviewslice(PyTypeObject * t,PyObject * a,PyObject * k)28625 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
28626   struct __pyx_memoryviewslice_obj *p;
28627   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
28628   if (unlikely(!o)) return 0;
28629   p = ((struct __pyx_memoryviewslice_obj *)o);
28630   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
28631   p->from_object = Py_None; Py_INCREF(Py_None);
28632   p->from_slice.memview = NULL;
28633   return o;
28634 }
28635 
__pyx_tp_dealloc__memoryviewslice(PyObject * o)28636 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
28637   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
28638   #if CYTHON_USE_TP_FINALIZE
28639   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
28640     if (PyObject_CallFinalizerFromDealloc(o)) return;
28641   }
28642   #endif
28643   PyObject_GC_UnTrack(o);
28644   {
28645     PyObject *etype, *eval, *etb;
28646     PyErr_Fetch(&etype, &eval, &etb);
28647     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
28648     __pyx_memoryviewslice___dealloc__(o);
28649     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
28650     PyErr_Restore(etype, eval, etb);
28651   }
28652   Py_CLEAR(p->from_object);
28653   PyObject_GC_Track(o);
28654   __pyx_tp_dealloc_memoryview(o);
28655 }
28656 
__pyx_tp_traverse__memoryviewslice(PyObject * o,visitproc v,void * a)28657 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
28658   int e;
28659   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
28660   e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
28661   if (p->from_object) {
28662     e = (*v)(p->from_object, a); if (e) return e;
28663   }
28664   return 0;
28665 }
28666 
__pyx_tp_clear__memoryviewslice(PyObject * o)28667 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
28668   PyObject* tmp;
28669   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
28670   __pyx_tp_clear_memoryview(o);
28671   tmp = ((PyObject*)p->from_object);
28672   p->from_object = Py_None; Py_INCREF(Py_None);
28673   Py_XDECREF(tmp);
28674   __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
28675   return 0;
28676 }
28677 
__pyx_getprop___pyx_memoryviewslice_base(PyObject * o,CYTHON_UNUSED void * x)28678 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
28679   return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
28680 }
28681 
28682 static PyMethodDef __pyx_methods__memoryviewslice[] = {
28683   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
28684   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
28685   {0, 0, 0, 0}
28686 };
28687 
28688 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
28689   {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
28690   {0, 0, 0, 0, 0}
28691 };
28692 
28693 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
28694   PyVarObject_HEAD_INIT(0, 0)
28695   "statsmodels.tsa.innovations._arma_innovations._memoryviewslice", /*tp_name*/
28696   sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
28697   0, /*tp_itemsize*/
28698   __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
28699   #if PY_VERSION_HEX < 0x030800b4
28700   0, /*tp_print*/
28701   #endif
28702   #if PY_VERSION_HEX >= 0x030800b4
28703   0, /*tp_vectorcall_offset*/
28704   #endif
28705   0, /*tp_getattr*/
28706   0, /*tp_setattr*/
28707   #if PY_MAJOR_VERSION < 3
28708   0, /*tp_compare*/
28709   #endif
28710   #if PY_MAJOR_VERSION >= 3
28711   0, /*tp_as_async*/
28712   #endif
28713   #if CYTHON_COMPILING_IN_PYPY
28714   __pyx_memoryview___repr__, /*tp_repr*/
28715   #else
28716   0, /*tp_repr*/
28717   #endif
28718   0, /*tp_as_number*/
28719   0, /*tp_as_sequence*/
28720   0, /*tp_as_mapping*/
28721   0, /*tp_hash*/
28722   0, /*tp_call*/
28723   #if CYTHON_COMPILING_IN_PYPY
28724   __pyx_memoryview___str__, /*tp_str*/
28725   #else
28726   0, /*tp_str*/
28727   #endif
28728   0, /*tp_getattro*/
28729   0, /*tp_setattro*/
28730   0, /*tp_as_buffer*/
28731   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
28732   "Internal class for passing memoryview slices to Python", /*tp_doc*/
28733   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
28734   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
28735   0, /*tp_richcompare*/
28736   0, /*tp_weaklistoffset*/
28737   0, /*tp_iter*/
28738   0, /*tp_iternext*/
28739   __pyx_methods__memoryviewslice, /*tp_methods*/
28740   0, /*tp_members*/
28741   __pyx_getsets__memoryviewslice, /*tp_getset*/
28742   0, /*tp_base*/
28743   0, /*tp_dict*/
28744   0, /*tp_descr_get*/
28745   0, /*tp_descr_set*/
28746   0, /*tp_dictoffset*/
28747   0, /*tp_init*/
28748   0, /*tp_alloc*/
28749   __pyx_tp_new__memoryviewslice, /*tp_new*/
28750   0, /*tp_free*/
28751   0, /*tp_is_gc*/
28752   0, /*tp_bases*/
28753   0, /*tp_mro*/
28754   0, /*tp_cache*/
28755   0, /*tp_subclasses*/
28756   0, /*tp_weaklist*/
28757   0, /*tp_del*/
28758   0, /*tp_version_tag*/
28759   #if PY_VERSION_HEX >= 0x030400a1
28760   0, /*tp_finalize*/
28761   #endif
28762   #if PY_VERSION_HEX >= 0x030800b1
28763   0, /*tp_vectorcall*/
28764   #endif
28765   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
28766   0, /*tp_print*/
28767   #endif
28768 };
28769 
28770 static PyMethodDef __pyx_methods[] = {
28771   {"sarma_transformed_acovf_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_1sarma_transformed_acovf_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_sarma_transformed_acovf_fast},
28772   {"sarma_innovations_algo_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_3sarma_innovations_algo_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_2sarma_innovations_algo_fast},
28773   {"sarma_innovations_filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_5sarma_innovations_filter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_4sarma_innovations_filter},
28774   {"sarma_innovations", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_7sarma_innovations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_6sarma_innovations},
28775   {"sarma_loglikeobs_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_9sarma_loglikeobs_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_8sarma_loglikeobs_fast},
28776   {"darma_transformed_acovf_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_11darma_transformed_acovf_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_10darma_transformed_acovf_fast},
28777   {"darma_innovations_algo_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_13darma_innovations_algo_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_12darma_innovations_algo_fast},
28778   {"darma_innovations_filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_15darma_innovations_filter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_14darma_innovations_filter},
28779   {"darma_innovations", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_17darma_innovations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_16darma_innovations},
28780   {"darma_loglikeobs_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_19darma_loglikeobs_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_18darma_loglikeobs_fast},
28781   {"carma_transformed_acovf_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_21carma_transformed_acovf_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_20carma_transformed_acovf_fast},
28782   {"carma_innovations_algo_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_23carma_innovations_algo_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_22carma_innovations_algo_fast},
28783   {"carma_innovations_filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_25carma_innovations_filter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_24carma_innovations_filter},
28784   {"carma_innovations", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_27carma_innovations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_26carma_innovations},
28785   {"carma_loglikeobs_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_29carma_loglikeobs_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_28carma_loglikeobs_fast},
28786   {"zarma_transformed_acovf_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_31zarma_transformed_acovf_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_30zarma_transformed_acovf_fast},
28787   {"zarma_innovations_algo_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_33zarma_innovations_algo_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_32zarma_innovations_algo_fast},
28788   {"zarma_innovations_filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_35zarma_innovations_filter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_34zarma_innovations_filter},
28789   {"zarma_innovations", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_37zarma_innovations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_36zarma_innovations},
28790   {"zarma_loglikeobs_fast", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11statsmodels_3tsa_11innovations_17_arma_innovations_39zarma_loglikeobs_fast, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11statsmodels_3tsa_11innovations_17_arma_innovations_38zarma_loglikeobs_fast},
28791   {0, 0, 0, 0}
28792 };
28793 
28794 #if PY_MAJOR_VERSION >= 3
28795 #if CYTHON_PEP489_MULTI_PHASE_INIT
28796 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
28797 static int __pyx_pymod_exec__arma_innovations(PyObject* module); /*proto*/
28798 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
28799   {Py_mod_create, (void*)__pyx_pymod_create},
28800   {Py_mod_exec, (void*)__pyx_pymod_exec__arma_innovations},
28801   {0, NULL}
28802 };
28803 #endif
28804 
28805 static struct PyModuleDef __pyx_moduledef = {
28806     PyModuleDef_HEAD_INIT,
28807     "_arma_innovations",
28808     __pyx_k_Innovations_algorithm_Author_Ch, /* m_doc */
28809   #if CYTHON_PEP489_MULTI_PHASE_INIT
28810     0, /* m_size */
28811   #else
28812     -1, /* m_size */
28813   #endif
28814     __pyx_methods /* m_methods */,
28815   #if CYTHON_PEP489_MULTI_PHASE_INIT
28816     __pyx_moduledef_slots, /* m_slots */
28817   #else
28818     NULL, /* m_reload */
28819   #endif
28820     NULL, /* m_traverse */
28821     NULL, /* m_clear */
28822     NULL /* m_free */
28823 };
28824 #endif
28825 #ifndef CYTHON_SMALL_CODE
28826 #if defined(__clang__)
28827     #define CYTHON_SMALL_CODE
28828 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
28829     #define CYTHON_SMALL_CODE __attribute__((cold))
28830 #else
28831     #define CYTHON_SMALL_CODE
28832 #endif
28833 #endif
28834 
28835 static __Pyx_StringTabEntry __pyx_string_tab[] = {
28836   {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
28837   {&__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},
28838   {&__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},
28839   {&__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},
28840   {&__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},
28841   {&__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},
28842   {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
28843   {&__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},
28844   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
28845   {&__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},
28846   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
28847   {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
28848   {&__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},
28849   {&__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},
28850   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
28851   {&__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},
28852   {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
28853   {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
28854   {&__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},
28855   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
28856   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
28857   {&__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},
28858   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
28859   {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
28860   {&__pyx_n_s_acovf, __pyx_k_acovf, sizeof(__pyx_k_acovf), 0, 0, 1, 1},
28861   {&__pyx_n_s_acovf2, __pyx_k_acovf2, sizeof(__pyx_k_acovf2), 0, 0, 1, 1},
28862   {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
28863   {&__pyx_n_s_ar, __pyx_k_ar, sizeof(__pyx_k_ar), 0, 0, 1, 1},
28864   {&__pyx_n_s_ar_params, __pyx_k_ar_params, sizeof(__pyx_k_ar_params), 0, 0, 1, 1},
28865   {&__pyx_n_s_arima_process, __pyx_k_arima_process, sizeof(__pyx_k_arima_process), 0, 0, 1, 1},
28866   {&__pyx_n_s_arma_acovf, __pyx_k_arma_acovf, sizeof(__pyx_k_arma_acovf), 0, 0, 1, 1},
28867   {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
28868   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
28869   {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
28870   {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
28871   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
28872   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
28873   {&__pyx_n_s_complex64, __pyx_k_complex64, sizeof(__pyx_k_complex64), 0, 0, 1, 1},
28874   {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
28875   {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
28876   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
28877   {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
28878   {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
28879   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
28880   {&__pyx_n_s_endog, __pyx_k_endog, sizeof(__pyx_k_endog), 0, 0, 1, 1},
28881   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
28882   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
28883   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
28884   {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
28885   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
28886   {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
28887   {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
28888   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
28889   {&__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},
28890   {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
28891   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
28892   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
28893   {&__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},
28894   {&__pyx_n_s_ma, __pyx_k_ma, sizeof(__pyx_k_ma), 0, 0, 1, 1},
28895   {&__pyx_n_s_ma_params, __pyx_k_ma_params, sizeof(__pyx_k_ma_params), 0, 0, 1, 1},
28896   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
28897   {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
28898   {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
28899   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
28900   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
28901   {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
28902   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
28903   {&__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},
28904   {&__pyx_n_s_nobs, __pyx_k_nobs, sizeof(__pyx_k_nobs), 0, 0, 1, 1},
28905   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
28906   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
28907   {&__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},
28908   {&__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},
28909   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
28910   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
28911   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
28912   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
28913   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
28914   {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
28915   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
28916   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
28917   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
28918   {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
28919   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
28920   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
28921   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
28922   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
28923   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
28924   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
28925   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
28926   {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
28927   {&__pyx_n_s_sigma2, __pyx_k_sigma2, sizeof(__pyx_k_sigma2), 0, 0, 1, 1},
28928   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
28929   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
28930   {&__pyx_n_s_statsmodels_tsa, __pyx_k_statsmodels_tsa, sizeof(__pyx_k_statsmodels_tsa), 0, 0, 1, 1},
28931   {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
28932   {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
28933   {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
28934   {&__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},
28935   {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
28936   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
28937   {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
28938   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
28939   {&__pyx_n_s_theta, __pyx_k_theta, sizeof(__pyx_k_theta), 0, 0, 1, 1},
28940   {&__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},
28941   {&__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},
28942   {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
28943   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
28944   {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1},
28945   {0, 0, 0, 0, 0, 0, 0}
28946 };
__Pyx_InitCachedBuiltins(void)28947 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
28948   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 55, __pyx_L1_error)
28949   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error)
28950   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 133, __pyx_L1_error)
28951   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error)
28952   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 151, __pyx_L1_error)
28953   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
28954   __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error)
28955   __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error)
28956   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error)
28957   return 0;
28958   __pyx_L1_error:;
28959   return -1;
28960 }
28961 
__Pyx_InitCachedConstants(void)28962 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
28963   __Pyx_RefNannyDeclarations
28964   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
28965 
28966   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":945
28967  *         __pyx_import_array()
28968  *     except Exception:
28969  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
28970  *
28971  * cdef inline int import_umath() except -1:
28972  */
28973   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 945, __pyx_L1_error)
28974   __Pyx_GOTREF(__pyx_tuple_);
28975   __Pyx_GIVEREF(__pyx_tuple_);
28976 
28977   /* "../../Anaconda/lib/site-packages/numpy/__init__.pxd":951
28978  *         _import_umath()
28979  *     except Exception:
28980  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
28981  *
28982  * cdef inline int import_ufunc() except -1:
28983  */
28984   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 951, __pyx_L1_error)
28985   __Pyx_GOTREF(__pyx_tuple__2);
28986   __Pyx_GIVEREF(__pyx_tuple__2);
28987 
28988   /* "View.MemoryView":133
28989  *
28990  *         if not self.ndim:
28991  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
28992  *
28993  *         if itemsize <= 0:
28994  */
28995   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(2, 133, __pyx_L1_error)
28996   __Pyx_GOTREF(__pyx_tuple__3);
28997   __Pyx_GIVEREF(__pyx_tuple__3);
28998 
28999   /* "View.MemoryView":136
29000  *
29001  *         if itemsize <= 0:
29002  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
29003  *
29004  *         if not isinstance(format, bytes):
29005  */
29006   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 136, __pyx_L1_error)
29007   __Pyx_GOTREF(__pyx_tuple__4);
29008   __Pyx_GIVEREF(__pyx_tuple__4);
29009 
29010   /* "View.MemoryView":148
29011  *
29012  *         if not self._shape:
29013  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
29014  *
29015  *
29016  */
29017   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 148, __pyx_L1_error)
29018   __Pyx_GOTREF(__pyx_tuple__5);
29019   __Pyx_GIVEREF(__pyx_tuple__5);
29020 
29021   /* "View.MemoryView":176
29022  *             self.data = <char *>malloc(self.len)
29023  *             if not self.data:
29024  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
29025  *
29026  *             if self.dtype_is_object:
29027  */
29028   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 176, __pyx_L1_error)
29029   __Pyx_GOTREF(__pyx_tuple__6);
29030   __Pyx_GIVEREF(__pyx_tuple__6);
29031 
29032   /* "View.MemoryView":192
29033  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
29034  *         if not (flags & bufmode):
29035  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
29036  *         info.buf = self.data
29037  *         info.len = self.len
29038  */
29039   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 192, __pyx_L1_error)
29040   __Pyx_GOTREF(__pyx_tuple__7);
29041   __Pyx_GIVEREF(__pyx_tuple__7);
29042 
29043   /* "(tree fragment)":2
29044  * def __reduce_cython__(self):
29045  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
29046  * def __setstate_cython__(self, __pyx_state):
29047  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
29048  */
29049   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 2, __pyx_L1_error)
29050   __Pyx_GOTREF(__pyx_tuple__8);
29051   __Pyx_GIVEREF(__pyx_tuple__8);
29052 
29053   /* "(tree fragment)":4
29054  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
29055  * def __setstate_cython__(self, __pyx_state):
29056  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
29057  */
29058   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 4, __pyx_L1_error)
29059   __Pyx_GOTREF(__pyx_tuple__9);
29060   __Pyx_GIVEREF(__pyx_tuple__9);
29061 
29062   /* "View.MemoryView":418
29063  *     def __setitem__(memoryview self, object index, object value):
29064  *         if self.view.readonly:
29065  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
29066  *
29067  *         have_slices, index = _unellipsify(index, self.view.ndim)
29068  */
29069   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 418, __pyx_L1_error)
29070   __Pyx_GOTREF(__pyx_tuple__10);
29071   __Pyx_GIVEREF(__pyx_tuple__10);
29072 
29073   /* "View.MemoryView":495
29074  *             result = struct.unpack(self.view.format, bytesitem)
29075  *         except struct.error:
29076  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
29077  *         else:
29078  *             if len(self.view.format) == 1:
29079  */
29080   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 495, __pyx_L1_error)
29081   __Pyx_GOTREF(__pyx_tuple__11);
29082   __Pyx_GIVEREF(__pyx_tuple__11);
29083 
29084   /* "View.MemoryView":520
29085  *     def __getbuffer__(self, Py_buffer *info, int flags):
29086  *         if flags & PyBUF_WRITABLE and self.view.readonly:
29087  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
29088  *
29089  *         if flags & PyBUF_ND:
29090  */
29091   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 520, __pyx_L1_error)
29092   __Pyx_GOTREF(__pyx_tuple__12);
29093   __Pyx_GIVEREF(__pyx_tuple__12);
29094 
29095   /* "View.MemoryView":570
29096  *         if self.view.strides == NULL:
29097  *
29098  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
29099  *
29100  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
29101  */
29102   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 570, __pyx_L1_error)
29103   __Pyx_GOTREF(__pyx_tuple__13);
29104   __Pyx_GIVEREF(__pyx_tuple__13);
29105 
29106   /* "View.MemoryView":577
29107  *     def suboffsets(self):
29108  *         if self.view.suboffsets == NULL:
29109  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
29110  *
29111  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
29112  */
29113   __pyx_tuple__14 = PyTuple_New(1); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 577, __pyx_L1_error)
29114   __Pyx_GOTREF(__pyx_tuple__14);
29115   __Pyx_INCREF(__pyx_int_neg_1);
29116   __Pyx_GIVEREF(__pyx_int_neg_1);
29117   PyTuple_SET_ITEM(__pyx_tuple__14, 0, __pyx_int_neg_1);
29118   __Pyx_GIVEREF(__pyx_tuple__14);
29119 
29120   /* "(tree fragment)":2
29121  * def __reduce_cython__(self):
29122  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
29123  * def __setstate_cython__(self, __pyx_state):
29124  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
29125  */
29126   __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 2, __pyx_L1_error)
29127   __Pyx_GOTREF(__pyx_tuple__15);
29128   __Pyx_GIVEREF(__pyx_tuple__15);
29129 
29130   /* "(tree fragment)":4
29131  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
29132  * def __setstate_cython__(self, __pyx_state):
29133  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
29134  */
29135   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 4, __pyx_L1_error)
29136   __Pyx_GOTREF(__pyx_tuple__16);
29137   __Pyx_GIVEREF(__pyx_tuple__16);
29138 
29139   /* "View.MemoryView":682
29140  *         if item is Ellipsis:
29141  *             if not seen_ellipsis:
29142  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
29143  *                 seen_ellipsis = True
29144  *             else:
29145  */
29146   __pyx_slice__17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__17)) __PYX_ERR(2, 682, __pyx_L1_error)
29147   __Pyx_GOTREF(__pyx_slice__17);
29148   __Pyx_GIVEREF(__pyx_slice__17);
29149 
29150   /* "View.MemoryView":703
29151  *     for suboffset in suboffsets[:ndim]:
29152  *         if suboffset >= 0:
29153  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
29154  *
29155  *
29156  */
29157   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 703, __pyx_L1_error)
29158   __Pyx_GOTREF(__pyx_tuple__18);
29159   __Pyx_GIVEREF(__pyx_tuple__18);
29160 
29161   /* "(tree fragment)":2
29162  * def __reduce_cython__(self):
29163  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
29164  * def __setstate_cython__(self, __pyx_state):
29165  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
29166  */
29167   __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 2, __pyx_L1_error)
29168   __Pyx_GOTREF(__pyx_tuple__19);
29169   __Pyx_GIVEREF(__pyx_tuple__19);
29170 
29171   /* "(tree fragment)":4
29172  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
29173  * def __setstate_cython__(self, __pyx_state):
29174  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
29175  */
29176   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 4, __pyx_L1_error)
29177   __Pyx_GOTREF(__pyx_tuple__20);
29178   __Pyx_GIVEREF(__pyx_tuple__20);
29179 
29180   /* "View.MemoryView":286
29181  *         return self.name
29182  *
29183  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
29184  * cdef strided = Enum("<strided and direct>") # default
29185  * cdef indirect = Enum("<strided and indirect>")
29186  */
29187   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 286, __pyx_L1_error)
29188   __Pyx_GOTREF(__pyx_tuple__21);
29189   __Pyx_GIVEREF(__pyx_tuple__21);
29190 
29191   /* "View.MemoryView":287
29192  *
29193  * cdef generic = Enum("<strided and direct or indirect>")
29194  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
29195  * cdef indirect = Enum("<strided and indirect>")
29196  *
29197  */
29198   __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 287, __pyx_L1_error)
29199   __Pyx_GOTREF(__pyx_tuple__22);
29200   __Pyx_GIVEREF(__pyx_tuple__22);
29201 
29202   /* "View.MemoryView":288
29203  * cdef generic = Enum("<strided and direct or indirect>")
29204  * cdef strided = Enum("<strided and direct>") # default
29205  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
29206  *
29207  *
29208  */
29209   __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 288, __pyx_L1_error)
29210   __Pyx_GOTREF(__pyx_tuple__23);
29211   __Pyx_GIVEREF(__pyx_tuple__23);
29212 
29213   /* "View.MemoryView":291
29214  *
29215  *
29216  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
29217  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
29218  *
29219  */
29220   __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 291, __pyx_L1_error)
29221   __Pyx_GOTREF(__pyx_tuple__24);
29222   __Pyx_GIVEREF(__pyx_tuple__24);
29223 
29224   /* "View.MemoryView":292
29225  *
29226  * cdef contiguous = Enum("<contiguous and direct>")
29227  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
29228  *
29229  *
29230  */
29231   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 292, __pyx_L1_error)
29232   __Pyx_GOTREF(__pyx_tuple__25);
29233   __Pyx_GIVEREF(__pyx_tuple__25);
29234 
29235   /* "(tree fragment)":1
29236  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
29237  *     cdef object __pyx_PickleError
29238  *     cdef object __pyx_result
29239  */
29240   __pyx_tuple__26 = 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__26)) __PYX_ERR(2, 1, __pyx_L1_error)
29241   __Pyx_GOTREF(__pyx_tuple__26);
29242   __Pyx_GIVEREF(__pyx_tuple__26);
29243   __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(2, 1, __pyx_L1_error)
29244   __Pyx_RefNannyFinishContext();
29245   return 0;
29246   __pyx_L1_error:;
29247   __Pyx_RefNannyFinishContext();
29248   return -1;
29249 }
29250 
__Pyx_InitGlobals(void)29251 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
29252   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
29253   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
29254   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
29255   __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
29256   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
29257   return 0;
29258   __pyx_L1_error:;
29259   return -1;
29260 }
29261 
29262 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
29263 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
29264 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
29265 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
29266 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
29267 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
29268 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
29269 
__Pyx_modinit_global_init_code(void)29270 static int __Pyx_modinit_global_init_code(void) {
29271   __Pyx_RefNannyDeclarations
29272   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
29273   /*--- Global init code ---*/
29274   generic = Py_None; Py_INCREF(Py_None);
29275   strided = Py_None; Py_INCREF(Py_None);
29276   indirect = Py_None; Py_INCREF(Py_None);
29277   contiguous = Py_None; Py_INCREF(Py_None);
29278   indirect_contiguous = Py_None; Py_INCREF(Py_None);
29279   __Pyx_RefNannyFinishContext();
29280   return 0;
29281 }
29282 
__Pyx_modinit_variable_export_code(void)29283 static int __Pyx_modinit_variable_export_code(void) {
29284   __Pyx_RefNannyDeclarations
29285   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
29286   /*--- Variable export code ---*/
29287   __Pyx_RefNannyFinishContext();
29288   return 0;
29289 }
29290 
__Pyx_modinit_function_export_code(void)29291 static int __Pyx_modinit_function_export_code(void) {
29292   __Pyx_RefNannyDeclarations
29293   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
29294   /*--- Function export code ---*/
29295   __Pyx_RefNannyFinishContext();
29296   return 0;
29297 }
29298 
__Pyx_modinit_type_init_code(void)29299 static int __Pyx_modinit_type_init_code(void) {
29300   __Pyx_RefNannyDeclarations
29301   int __pyx_lineno = 0;
29302   const char *__pyx_filename = NULL;
29303   int __pyx_clineno = 0;
29304   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
29305   /*--- Type init code ---*/
29306   __pyx_vtabptr_array = &__pyx_vtable_array;
29307   __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
29308   if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
29309   #if PY_VERSION_HEX < 0x030800B1
29310   __pyx_type___pyx_array.tp_print = 0;
29311   #endif
29312   if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
29313   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
29314   __pyx_array_type = &__pyx_type___pyx_array;
29315   if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
29316   #if PY_VERSION_HEX < 0x030800B1
29317   __pyx_type___pyx_MemviewEnum.tp_print = 0;
29318   #endif
29319   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
29320     __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
29321   }
29322   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
29323   __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
29324   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
29325   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
29326   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
29327   __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
29328   __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
29329   __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
29330   __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
29331   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
29332   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
29333   #if PY_VERSION_HEX < 0x030800B1
29334   __pyx_type___pyx_memoryview.tp_print = 0;
29335   #endif
29336   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
29337     __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
29338   }
29339   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
29340   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
29341   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
29342   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
29343   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
29344   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
29345   __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
29346   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
29347   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
29348   #if PY_VERSION_HEX < 0x030800B1
29349   __pyx_type___pyx_memoryviewslice.tp_print = 0;
29350   #endif
29351   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
29352     __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
29353   }
29354   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
29355   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
29356   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
29357   __Pyx_RefNannyFinishContext();
29358   return 0;
29359   __pyx_L1_error:;
29360   __Pyx_RefNannyFinishContext();
29361   return -1;
29362 }
29363 
__Pyx_modinit_type_import_code(void)29364 static int __Pyx_modinit_type_import_code(void) {
29365   __Pyx_RefNannyDeclarations
29366   PyObject *__pyx_t_1 = NULL;
29367   int __pyx_lineno = 0;
29368   const char *__pyx_filename = NULL;
29369   int __pyx_clineno = 0;
29370   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
29371   /*--- Type import code ---*/
29372   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
29373   __Pyx_GOTREF(__pyx_t_1);
29374   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
29375   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
29376   sizeof(PyTypeObject),
29377   #else
29378   sizeof(PyHeapTypeObject),
29379   #endif
29380   __Pyx_ImportType_CheckSize_Warn);
29381    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
29382   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29383   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
29384   __Pyx_GOTREF(__pyx_t_1);
29385   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
29386    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
29387   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
29388    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
29389   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
29390    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
29391   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
29392    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
29393   __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
29394    if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
29395   __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
29396    if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
29397   __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
29398    if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
29399   __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
29400    if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
29401   __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
29402    if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
29403   __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
29404    if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
29405   __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
29406    if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
29407   __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
29408    if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
29409   __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
29410    if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
29411   __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
29412    if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
29413   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
29414    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
29415   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29416   __Pyx_RefNannyFinishContext();
29417   return 0;
29418   __pyx_L1_error:;
29419   __Pyx_XDECREF(__pyx_t_1);
29420   __Pyx_RefNannyFinishContext();
29421   return -1;
29422 }
29423 
__Pyx_modinit_variable_import_code(void)29424 static int __Pyx_modinit_variable_import_code(void) {
29425   __Pyx_RefNannyDeclarations
29426   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
29427   /*--- Variable import code ---*/
29428   __Pyx_RefNannyFinishContext();
29429   return 0;
29430 }
29431 
__Pyx_modinit_function_import_code(void)29432 static int __Pyx_modinit_function_import_code(void) {
29433   __Pyx_RefNannyDeclarations
29434   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
29435   /*--- Function import code ---*/
29436   __Pyx_RefNannyFinishContext();
29437   return 0;
29438 }
29439 
29440 
29441 #ifndef CYTHON_NO_PYINIT_EXPORT
29442 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
29443 #elif PY_MAJOR_VERSION < 3
29444 #ifdef __cplusplus
29445 #define __Pyx_PyMODINIT_FUNC extern "C" void
29446 #else
29447 #define __Pyx_PyMODINIT_FUNC void
29448 #endif
29449 #else
29450 #ifdef __cplusplus
29451 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
29452 #else
29453 #define __Pyx_PyMODINIT_FUNC PyObject *
29454 #endif
29455 #endif
29456 
29457 
29458 #if PY_MAJOR_VERSION < 3
29459 __Pyx_PyMODINIT_FUNC init_arma_innovations(void) CYTHON_SMALL_CODE; /*proto*/
init_arma_innovations(void)29460 __Pyx_PyMODINIT_FUNC init_arma_innovations(void)
29461 #else
29462 __Pyx_PyMODINIT_FUNC PyInit__arma_innovations(void) CYTHON_SMALL_CODE; /*proto*/
29463 __Pyx_PyMODINIT_FUNC PyInit__arma_innovations(void)
29464 #if CYTHON_PEP489_MULTI_PHASE_INIT
29465 {
29466   return PyModuleDef_Init(&__pyx_moduledef);
29467 }
29468 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
29469     #if PY_VERSION_HEX >= 0x030700A1
29470     static PY_INT64_T main_interpreter_id = -1;
29471     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
29472     if (main_interpreter_id == -1) {
29473         main_interpreter_id = current_id;
29474         return (unlikely(current_id == -1)) ? -1 : 0;
29475     } else if (unlikely(main_interpreter_id != current_id))
29476     #else
29477     static PyInterpreterState *main_interpreter = NULL;
29478     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
29479     if (!main_interpreter) {
29480         main_interpreter = current_interpreter;
29481     } else if (unlikely(main_interpreter != current_interpreter))
29482     #endif
29483     {
29484         PyErr_SetString(
29485             PyExc_ImportError,
29486             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
29487         return -1;
29488     }
29489     return 0;
29490 }
29491 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) {
29492     PyObject *value = PyObject_GetAttrString(spec, from_name);
29493     int result = 0;
29494     if (likely(value)) {
29495         if (allow_none || value != Py_None) {
29496             result = PyDict_SetItemString(moddict, to_name, value);
29497         }
29498         Py_DECREF(value);
29499     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
29500         PyErr_Clear();
29501     } else {
29502         result = -1;
29503     }
29504     return result;
29505 }
29506 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
29507     PyObject *module = NULL, *moddict, *modname;
29508     if (__Pyx_check_single_interpreter())
29509         return NULL;
29510     if (__pyx_m)
29511         return __Pyx_NewRef(__pyx_m);
29512     modname = PyObject_GetAttrString(spec, "name");
29513     if (unlikely(!modname)) goto bad;
29514     module = PyModule_NewObject(modname);
29515     Py_DECREF(modname);
29516     if (unlikely(!module)) goto bad;
29517     moddict = PyModule_GetDict(module);
29518     if (unlikely(!moddict)) goto bad;
29519     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
29520     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
29521     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
29522     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
29523     return module;
29524 bad:
29525     Py_XDECREF(module);
29526     return NULL;
29527 }
29528 
29529 
29530 static CYTHON_SMALL_CODE int __pyx_pymod_exec__arma_innovations(PyObject *__pyx_pyinit_module)
29531 #endif
29532 #endif
29533 {
29534   PyObject *__pyx_t_1 = NULL;
29535   PyObject *__pyx_t_2 = NULL;
29536   int __pyx_t_3;
29537   static PyThread_type_lock __pyx_t_4[8];
29538   int __pyx_lineno = 0;
29539   const char *__pyx_filename = NULL;
29540   int __pyx_clineno = 0;
29541   __Pyx_RefNannyDeclarations
29542   #if CYTHON_PEP489_MULTI_PHASE_INIT
29543   if (__pyx_m) {
29544     if (__pyx_m == __pyx_pyinit_module) return 0;
29545     PyErr_SetString(PyExc_RuntimeError, "Module '_arma_innovations' has already been imported. Re-initialisation is not supported.");
29546     return -1;
29547   }
29548   #elif PY_MAJOR_VERSION >= 3
29549   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
29550   #endif
29551   #if CYTHON_REFNANNY
29552 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
29553 if (!__Pyx_RefNanny) {
29554   PyErr_Clear();
29555   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
29556   if (!__Pyx_RefNanny)
29557       Py_FatalError("failed to import 'refnanny' module");
29558 }
29559 #endif
29560   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__arma_innovations(void)", 0);
29561   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29562   #ifdef __Pxy_PyFrame_Initialize_Offsets
29563   __Pxy_PyFrame_Initialize_Offsets();
29564   #endif
29565   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
29566   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
29567   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
29568   #ifdef __Pyx_CyFunction_USED
29569   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29570   #endif
29571   #ifdef __Pyx_FusedFunction_USED
29572   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29573   #endif
29574   #ifdef __Pyx_Coroutine_USED
29575   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29576   #endif
29577   #ifdef __Pyx_Generator_USED
29578   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29579   #endif
29580   #ifdef __Pyx_AsyncGen_USED
29581   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29582   #endif
29583   #ifdef __Pyx_StopAsyncIteration_USED
29584   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29585   #endif
29586   /*--- Library function declarations ---*/
29587   /*--- Threads initialization code ---*/
29588   #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
29589   PyEval_InitThreads();
29590   #endif
29591   /*--- Module creation code ---*/
29592   #if CYTHON_PEP489_MULTI_PHASE_INIT
29593   __pyx_m = __pyx_pyinit_module;
29594   Py_INCREF(__pyx_m);
29595   #else
29596   #if PY_MAJOR_VERSION < 3
29597   __pyx_m = Py_InitModule4("_arma_innovations", __pyx_methods, __pyx_k_Innovations_algorithm_Author_Ch, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
29598   #else
29599   __pyx_m = PyModule_Create(&__pyx_moduledef);
29600   #endif
29601   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
29602   #endif
29603   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
29604   Py_INCREF(__pyx_d);
29605   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
29606   Py_INCREF(__pyx_b);
29607   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
29608   Py_INCREF(__pyx_cython_runtime);
29609   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
29610   /*--- Initialize various global constants etc. ---*/
29611   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29612   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
29613   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29614   #endif
29615   if (__pyx_module_is_main_statsmodels__tsa__innovations___arma_innovations) {
29616     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29617   }
29618   #if PY_MAJOR_VERSION >= 3
29619   {
29620     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
29621     if (!PyDict_GetItemString(modules, "statsmodels.tsa.innovations._arma_innovations")) {
29622       if (unlikely(PyDict_SetItemString(modules, "statsmodels.tsa.innovations._arma_innovations", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
29623     }
29624   }
29625   #endif
29626   /*--- Builtin init code ---*/
29627   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29628   /*--- Constants init code ---*/
29629   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29630   /*--- Global type/function init code ---*/
29631   (void)__Pyx_modinit_global_init_code();
29632   (void)__Pyx_modinit_variable_export_code();
29633   (void)__Pyx_modinit_function_export_code();
29634   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
29635   if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
29636   (void)__Pyx_modinit_variable_import_code();
29637   (void)__Pyx_modinit_function_import_code();
29638   /*--- Execution code ---*/
29639   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
29640   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29641   #endif
29642 
29643   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":12
29644  *
29645  * # Typical imports
29646  * import numpy as np             # <<<<<<<<<<<<<<
29647  * import warnings
29648  * from statsmodels.tsa import arima_process
29649  */
29650   __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
29651   __Pyx_GOTREF(__pyx_t_1);
29652   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
29653   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29654 
29655   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":13
29656  * # Typical imports
29657  * import numpy as np
29658  * import warnings             # <<<<<<<<<<<<<<
29659  * from statsmodels.tsa import arima_process
29660  * from statsmodels.src.math cimport NPY_PI, dlog, zlog
29661  */
29662   __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
29663   __Pyx_GOTREF(__pyx_t_1);
29664   if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
29665   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29666 
29667   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":14
29668  * import numpy as np
29669  * import warnings
29670  * from statsmodels.tsa import arima_process             # <<<<<<<<<<<<<<
29671  * from statsmodels.src.math cimport NPY_PI, dlog, zlog
29672  * cimport numpy as cnp
29673  */
29674   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
29675   __Pyx_GOTREF(__pyx_t_1);
29676   __Pyx_INCREF(__pyx_n_s_arima_process);
29677   __Pyx_GIVEREF(__pyx_n_s_arima_process);
29678   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_arima_process);
29679   __pyx_t_2 = __Pyx_Import(__pyx_n_s_statsmodels_tsa, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
29680   __Pyx_GOTREF(__pyx_t_2);
29681   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29682   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_arima_process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
29683   __Pyx_GOTREF(__pyx_t_1);
29684   if (PyDict_SetItem(__pyx_d, __pyx_n_s_arima_process, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
29685   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29686   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29687 
29688   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":19
29689  * cimport cython
29690  *
29691  * cnp.import_array()             # <<<<<<<<<<<<<<
29692  *
29693  * cdef int C = 0
29694  */
29695   __pyx_t_3 = __pyx_f_5numpy_import_array(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 19, __pyx_L1_error)
29696 
29697   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":21
29698  * cnp.import_array()
29699  *
29700  * cdef int C = 0             # <<<<<<<<<<<<<<
29701  *
29702  *
29703  */
29704   __pyx_v_11statsmodels_3tsa_11innovations_17_arma_innovations_C = 0;
29705 
29706   /* "statsmodels/tsa/innovations/_arma_innovations.pyx":1
29707  * #cython: boundscheck=False             # <<<<<<<<<<<<<<
29708  * #cython: wraparound=False
29709  * #cython: cdivision=False
29710  */
29711   __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
29712   __Pyx_GOTREF(__pyx_t_2);
29713   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
29714   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29715 
29716   /* "View.MemoryView":209
29717  *         info.obj = self
29718  *
29719  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
29720  *
29721  *     def __dealloc__(array self):
29722  */
29723   __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)
29724   __Pyx_GOTREF(__pyx_t_2);
29725   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)
29726   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29727   PyType_Modified(__pyx_array_type);
29728 
29729   /* "View.MemoryView":286
29730  *         return self.name
29731  *
29732  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
29733  * cdef strided = Enum("<strided and direct>") # default
29734  * cdef indirect = Enum("<strided and indirect>")
29735  */
29736   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 286, __pyx_L1_error)
29737   __Pyx_GOTREF(__pyx_t_2);
29738   __Pyx_XGOTREF(generic);
29739   __Pyx_DECREF_SET(generic, __pyx_t_2);
29740   __Pyx_GIVEREF(__pyx_t_2);
29741   __pyx_t_2 = 0;
29742 
29743   /* "View.MemoryView":287
29744  *
29745  * cdef generic = Enum("<strided and direct or indirect>")
29746  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
29747  * cdef indirect = Enum("<strided and indirect>")
29748  *
29749  */
29750   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 287, __pyx_L1_error)
29751   __Pyx_GOTREF(__pyx_t_2);
29752   __Pyx_XGOTREF(strided);
29753   __Pyx_DECREF_SET(strided, __pyx_t_2);
29754   __Pyx_GIVEREF(__pyx_t_2);
29755   __pyx_t_2 = 0;
29756 
29757   /* "View.MemoryView":288
29758  * cdef generic = Enum("<strided and direct or indirect>")
29759  * cdef strided = Enum("<strided and direct>") # default
29760  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
29761  *
29762  *
29763  */
29764   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 288, __pyx_L1_error)
29765   __Pyx_GOTREF(__pyx_t_2);
29766   __Pyx_XGOTREF(indirect);
29767   __Pyx_DECREF_SET(indirect, __pyx_t_2);
29768   __Pyx_GIVEREF(__pyx_t_2);
29769   __pyx_t_2 = 0;
29770 
29771   /* "View.MemoryView":291
29772  *
29773  *
29774  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
29775  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
29776  *
29777  */
29778   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 291, __pyx_L1_error)
29779   __Pyx_GOTREF(__pyx_t_2);
29780   __Pyx_XGOTREF(contiguous);
29781   __Pyx_DECREF_SET(contiguous, __pyx_t_2);
29782   __Pyx_GIVEREF(__pyx_t_2);
29783   __pyx_t_2 = 0;
29784 
29785   /* "View.MemoryView":292
29786  *
29787  * cdef contiguous = Enum("<contiguous and direct>")
29788  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
29789  *
29790  *
29791  */
29792   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 292, __pyx_L1_error)
29793   __Pyx_GOTREF(__pyx_t_2);
29794   __Pyx_XGOTREF(indirect_contiguous);
29795   __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2);
29796   __Pyx_GIVEREF(__pyx_t_2);
29797   __pyx_t_2 = 0;
29798 
29799   /* "View.MemoryView":316
29800  *
29801  * DEF THREAD_LOCKS_PREALLOCATED = 8
29802  * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
29803  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
29804  *     PyThread_allocate_lock(),
29805  */
29806   __pyx_memoryview_thread_locks_used = 0;
29807 
29808   /* "View.MemoryView":317
29809  * DEF THREAD_LOCKS_PREALLOCATED = 8
29810  * cdef int __pyx_memoryview_thread_locks_used = 0
29811  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
29812  *     PyThread_allocate_lock(),
29813  *     PyThread_allocate_lock(),
29814  */
29815   __pyx_t_4[0] = PyThread_allocate_lock();
29816   __pyx_t_4[1] = PyThread_allocate_lock();
29817   __pyx_t_4[2] = PyThread_allocate_lock();
29818   __pyx_t_4[3] = PyThread_allocate_lock();
29819   __pyx_t_4[4] = PyThread_allocate_lock();
29820   __pyx_t_4[5] = PyThread_allocate_lock();
29821   __pyx_t_4[6] = PyThread_allocate_lock();
29822   __pyx_t_4[7] = PyThread_allocate_lock();
29823   memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_4, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
29824 
29825   /* "View.MemoryView":549
29826  *         info.obj = self
29827  *
29828  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
29829  *
29830  *
29831  */
29832   __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)
29833   __Pyx_GOTREF(__pyx_t_2);
29834   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)
29835   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29836   PyType_Modified(__pyx_memoryview_type);
29837 
29838   /* "View.MemoryView":995
29839  *         return self.from_object
29840  *
29841  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
29842  *
29843  *
29844  */
29845   __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)
29846   __Pyx_GOTREF(__pyx_t_2);
29847   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)
29848   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29849   PyType_Modified(__pyx_memoryviewslice_type);
29850 
29851   /* "(tree fragment)":1
29852  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
29853  *     cdef object __pyx_PickleError
29854  *     cdef object __pyx_result
29855  */
29856   __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)
29857   __Pyx_GOTREF(__pyx_t_2);
29858   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
29859   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29860 
29861   /* "(tree fragment)":11
29862  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
29863  *     return __pyx_result
29864  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
29865  *     __pyx_result.name = __pyx_state[0]
29866  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
29867  */
29868 
29869   /*--- Wrapped vars code ---*/
29870 
29871   goto __pyx_L0;
29872   __pyx_L1_error:;
29873   __Pyx_XDECREF(__pyx_t_1);
29874   __Pyx_XDECREF(__pyx_t_2);
29875   if (__pyx_m) {
29876     if (__pyx_d) {
29877       __Pyx_AddTraceback("init statsmodels.tsa.innovations._arma_innovations", __pyx_clineno, __pyx_lineno, __pyx_filename);
29878     }
29879     Py_CLEAR(__pyx_m);
29880   } else if (!PyErr_Occurred()) {
29881     PyErr_SetString(PyExc_ImportError, "init statsmodels.tsa.innovations._arma_innovations");
29882   }
29883   __pyx_L0:;
29884   __Pyx_RefNannyFinishContext();
29885   #if CYTHON_PEP489_MULTI_PHASE_INIT
29886   return (__pyx_m != NULL) ? 0 : -1;
29887   #elif PY_MAJOR_VERSION >= 3
29888   return __pyx_m;
29889   #else
29890   return;
29891   #endif
29892 }
29893 
29894 /* --- Runtime support code --- */
29895 /* Refnanny */
29896 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)29897 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
29898     PyObject *m = NULL, *p = NULL;
29899     void *r = NULL;
29900     m = PyImport_ImportModule(modname);
29901     if (!m) goto end;
29902     p = PyObject_GetAttrString(m, "RefNannyAPI");
29903     if (!p) goto end;
29904     r = PyLong_AsVoidPtr(p);
29905 end:
29906     Py_XDECREF(p);
29907     Py_XDECREF(m);
29908     return (__Pyx_RefNannyAPIStruct *)r;
29909 }
29910 #endif
29911 
29912 /* PyObjectGetAttrStr */
29913 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)29914 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
29915     PyTypeObject* tp = Py_TYPE(obj);
29916     if (likely(tp->tp_getattro))
29917         return tp->tp_getattro(obj, attr_name);
29918 #if PY_MAJOR_VERSION < 3
29919     if (likely(tp->tp_getattr))
29920         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
29921 #endif
29922     return PyObject_GetAttr(obj, attr_name);
29923 }
29924 #endif
29925 
29926 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)29927 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
29928     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
29929     if (unlikely(!result)) {
29930         PyErr_Format(PyExc_NameError,
29931 #if PY_MAJOR_VERSION >= 3
29932             "name '%U' is not defined", name);
29933 #else
29934             "name '%.200s' is not defined", PyString_AS_STRING(name));
29935 #endif
29936     }
29937     return result;
29938 }
29939 
29940 /* py_abs */
29941 #if CYTHON_USE_PYLONG_INTERNALS
__Pyx_PyLong_AbsNeg(PyObject * n)29942 static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
29943     if (likely(Py_SIZE(n) == -1)) {
29944         return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]);
29945     }
29946 #if CYTHON_COMPILING_IN_CPYTHON
29947     {
29948         PyObject *copy = _PyLong_Copy((PyLongObject*)n);
29949         if (likely(copy)) {
29950             __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
29951         }
29952         return copy;
29953     }
29954 #else
29955     return PyNumber_Negative(n);
29956 #endif
29957 }
29958 #endif
29959 
29960 /* MemviewSliceInit */
29961 static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj * memview,int ndim,__Pyx_memviewslice * memviewslice,int memview_is_new_reference)29962 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
29963                         int ndim,
29964                         __Pyx_memviewslice *memviewslice,
29965                         int memview_is_new_reference)
29966 {
29967     __Pyx_RefNannyDeclarations
29968     int i, retval=-1;
29969     Py_buffer *buf = &memview->view;
29970     __Pyx_RefNannySetupContext("init_memviewslice", 0);
29971     if (unlikely(memviewslice->memview || memviewslice->data)) {
29972         PyErr_SetString(PyExc_ValueError,
29973             "memviewslice is already initialized!");
29974         goto fail;
29975     }
29976     if (buf->strides) {
29977         for (i = 0; i < ndim; i++) {
29978             memviewslice->strides[i] = buf->strides[i];
29979         }
29980     } else {
29981         Py_ssize_t stride = buf->itemsize;
29982         for (i = ndim - 1; i >= 0; i--) {
29983             memviewslice->strides[i] = stride;
29984             stride *= buf->shape[i];
29985         }
29986     }
29987     for (i = 0; i < ndim; i++) {
29988         memviewslice->shape[i]   = buf->shape[i];
29989         if (buf->suboffsets) {
29990             memviewslice->suboffsets[i] = buf->suboffsets[i];
29991         } else {
29992             memviewslice->suboffsets[i] = -1;
29993         }
29994     }
29995     memviewslice->memview = memview;
29996     memviewslice->data = (char *)buf->buf;
29997     if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
29998         Py_INCREF(memview);
29999     }
30000     retval = 0;
30001     goto no_fail;
30002 fail:
30003     memviewslice->memview = 0;
30004     memviewslice->data = 0;
30005     retval = -1;
30006 no_fail:
30007     __Pyx_RefNannyFinishContext();
30008     return retval;
30009 }
30010 #ifndef Py_NO_RETURN
30011 #define Py_NO_RETURN
30012 #endif
__pyx_fatalerror(const char * fmt,...)30013 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
30014     va_list vargs;
30015     char msg[200];
30016 #ifdef HAVE_STDARG_PROTOTYPES
30017     va_start(vargs, fmt);
30018 #else
30019     va_start(vargs);
30020 #endif
30021     vsnprintf(msg, 200, fmt, vargs);
30022     va_end(vargs);
30023     Py_FatalError(msg);
30024 }
30025 static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)30026 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
30027                                    PyThread_type_lock lock)
30028 {
30029     int result;
30030     PyThread_acquire_lock(lock, 1);
30031     result = (*acquisition_count)++;
30032     PyThread_release_lock(lock);
30033     return result;
30034 }
30035 static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)30036 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
30037                                    PyThread_type_lock lock)
30038 {
30039     int result;
30040     PyThread_acquire_lock(lock, 1);
30041     result = (*acquisition_count)--;
30042     PyThread_release_lock(lock);
30043     return result;
30044 }
30045 static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)30046 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
30047 {
30048     int first_time;
30049     struct __pyx_memoryview_obj *memview = memslice->memview;
30050     if (unlikely(!memview || (PyObject *) memview == Py_None))
30051         return;
30052     if (unlikely(__pyx_get_slice_count(memview) < 0))
30053         __pyx_fatalerror("Acquisition count is %d (line %d)",
30054                          __pyx_get_slice_count(memview), lineno);
30055     first_time = __pyx_add_acquisition_count(memview) == 0;
30056     if (unlikely(first_time)) {
30057         if (have_gil) {
30058             Py_INCREF((PyObject *) memview);
30059         } else {
30060             PyGILState_STATE _gilstate = PyGILState_Ensure();
30061             Py_INCREF((PyObject *) memview);
30062             PyGILState_Release(_gilstate);
30063         }
30064     }
30065 }
__Pyx_XDEC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)30066 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
30067                                              int have_gil, int lineno) {
30068     int last_time;
30069     struct __pyx_memoryview_obj *memview = memslice->memview;
30070     if (unlikely(!memview || (PyObject *) memview == Py_None)) {
30071         memslice->memview = NULL;
30072         return;
30073     }
30074     if (unlikely(__pyx_get_slice_count(memview) <= 0))
30075         __pyx_fatalerror("Acquisition count is %d (line %d)",
30076                          __pyx_get_slice_count(memview), lineno);
30077     last_time = __pyx_sub_acquisition_count(memview) == 1;
30078     memslice->data = NULL;
30079     if (unlikely(last_time)) {
30080         if (have_gil) {
30081             Py_CLEAR(memslice->memview);
30082         } else {
30083             PyGILState_STATE _gilstate = PyGILState_Ensure();
30084             Py_CLEAR(memslice->memview);
30085             PyGILState_Release(_gilstate);
30086         }
30087     } else {
30088         memslice->memview = NULL;
30089     }
30090 }
30091 
30092 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)30093 static void __Pyx_RaiseArgtupleInvalid(
30094     const char* func_name,
30095     int exact,
30096     Py_ssize_t num_min,
30097     Py_ssize_t num_max,
30098     Py_ssize_t num_found)
30099 {
30100     Py_ssize_t num_expected;
30101     const char *more_or_less;
30102     if (num_found < num_min) {
30103         num_expected = num_min;
30104         more_or_less = "at least";
30105     } else {
30106         num_expected = num_max;
30107         more_or_less = "at most";
30108     }
30109     if (exact) {
30110         more_or_less = "exactly";
30111     }
30112     PyErr_Format(PyExc_TypeError,
30113                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
30114                  func_name, more_or_less, num_expected,
30115                  (num_expected == 1) ? "" : "s", num_found);
30116 }
30117 
30118 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)30119 static void __Pyx_RaiseDoubleKeywordsError(
30120     const char* func_name,
30121     PyObject* kw_name)
30122 {
30123     PyErr_Format(PyExc_TypeError,
30124         #if PY_MAJOR_VERSION >= 3
30125         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
30126         #else
30127         "%s() got multiple values for keyword argument '%s'", func_name,
30128         PyString_AsString(kw_name));
30129         #endif
30130 }
30131 
30132 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)30133 static int __Pyx_ParseOptionalKeywords(
30134     PyObject *kwds,
30135     PyObject **argnames[],
30136     PyObject *kwds2,
30137     PyObject *values[],
30138     Py_ssize_t num_pos_args,
30139     const char* function_name)
30140 {
30141     PyObject *key = 0, *value = 0;
30142     Py_ssize_t pos = 0;
30143     PyObject*** name;
30144     PyObject*** first_kw_arg = argnames + num_pos_args;
30145     while (PyDict_Next(kwds, &pos, &key, &value)) {
30146         name = first_kw_arg;
30147         while (*name && (**name != key)) name++;
30148         if (*name) {
30149             values[name-argnames] = value;
30150             continue;
30151         }
30152         name = first_kw_arg;
30153         #if PY_MAJOR_VERSION < 3
30154         if (likely(PyString_Check(key))) {
30155             while (*name) {
30156                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
30157                         && _PyString_Eq(**name, key)) {
30158                     values[name-argnames] = value;
30159                     break;
30160                 }
30161                 name++;
30162             }
30163             if (*name) continue;
30164             else {
30165                 PyObject*** argname = argnames;
30166                 while (argname != first_kw_arg) {
30167                     if ((**argname == key) || (
30168                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
30169                              && _PyString_Eq(**argname, key))) {
30170                         goto arg_passed_twice;
30171                     }
30172                     argname++;
30173                 }
30174             }
30175         } else
30176         #endif
30177         if (likely(PyUnicode_Check(key))) {
30178             while (*name) {
30179                 int cmp = (**name == key) ? 0 :
30180                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
30181                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
30182                 #endif
30183                     PyUnicode_Compare(**name, key);
30184                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
30185                 if (cmp == 0) {
30186                     values[name-argnames] = value;
30187                     break;
30188                 }
30189                 name++;
30190             }
30191             if (*name) continue;
30192             else {
30193                 PyObject*** argname = argnames;
30194                 while (argname != first_kw_arg) {
30195                     int cmp = (**argname == key) ? 0 :
30196                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
30197                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
30198                     #endif
30199                         PyUnicode_Compare(**argname, key);
30200                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
30201                     if (cmp == 0) goto arg_passed_twice;
30202                     argname++;
30203                 }
30204             }
30205         } else
30206             goto invalid_keyword_type;
30207         if (kwds2) {
30208             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
30209         } else {
30210             goto invalid_keyword;
30211         }
30212     }
30213     return 0;
30214 arg_passed_twice:
30215     __Pyx_RaiseDoubleKeywordsError(function_name, key);
30216     goto bad;
30217 invalid_keyword_type:
30218     PyErr_Format(PyExc_TypeError,
30219         "%.200s() keywords must be strings", function_name);
30220     goto bad;
30221 invalid_keyword:
30222     PyErr_Format(PyExc_TypeError,
30223     #if PY_MAJOR_VERSION < 3
30224         "%.200s() got an unexpected keyword argument '%.200s'",
30225         function_name, PyString_AsString(key));
30226     #else
30227         "%s() got an unexpected keyword argument '%U'",
30228         function_name, key);
30229     #endif
30230 bad:
30231     return -1;
30232 }
30233 
30234 /* None */
__Pyx_RaiseUnboundLocalError(const char * varname)30235 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
30236     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
30237 }
30238 
30239 /* PyDictVersioning */
30240 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)30241 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
30242     PyObject *dict = Py_TYPE(obj)->tp_dict;
30243     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
30244 }
__Pyx_get_object_dict_version(PyObject * obj)30245 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
30246     PyObject **dictptr = NULL;
30247     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
30248     if (offset) {
30249 #if CYTHON_COMPILING_IN_CPYTHON
30250         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
30251 #else
30252         dictptr = _PyObject_GetDictPtr(obj);
30253 #endif
30254     }
30255     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
30256 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)30257 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
30258     PyObject *dict = Py_TYPE(obj)->tp_dict;
30259     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
30260         return 0;
30261     return obj_dict_version == __Pyx_get_object_dict_version(obj);
30262 }
30263 #endif
30264 
30265 /* GetModuleGlobalName */
30266 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)30267 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
30268 #else
30269 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
30270 #endif
30271 {
30272     PyObject *result;
30273 #if !CYTHON_AVOID_BORROWED_REFS
30274 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
30275     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
30276     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
30277     if (likely(result)) {
30278         return __Pyx_NewRef(result);
30279     } else if (unlikely(PyErr_Occurred())) {
30280         return NULL;
30281     }
30282 #else
30283     result = PyDict_GetItem(__pyx_d, name);
30284     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
30285     if (likely(result)) {
30286         return __Pyx_NewRef(result);
30287     }
30288 #endif
30289 #else
30290     result = PyObject_GetItem(__pyx_d, name);
30291     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
30292     if (likely(result)) {
30293         return __Pyx_NewRef(result);
30294     }
30295     PyErr_Clear();
30296 #endif
30297     return __Pyx_GetBuiltinName(name);
30298 }
30299 
30300 /* PyObjectCall */
30301 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)30302 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
30303     PyObject *result;
30304     ternaryfunc call = Py_TYPE(func)->tp_call;
30305     if (unlikely(!call))
30306         return PyObject_Call(func, arg, kw);
30307     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
30308         return NULL;
30309     result = (*call)(func, arg, kw);
30310     Py_LeaveRecursiveCall();
30311     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
30312         PyErr_SetString(
30313             PyExc_SystemError,
30314             "NULL result without error in PyObject_Call");
30315     }
30316     return result;
30317 }
30318 #endif
30319 
30320 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)30321 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
30322     PyErr_Format(PyExc_ValueError,
30323                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
30324 }
30325 
30326 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)30327 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
30328     PyErr_Format(PyExc_ValueError,
30329                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
30330                  index, (index == 1) ? "" : "s");
30331 }
30332 
30333 /* IterFinish */
__Pyx_IterFinish(void)30334 static CYTHON_INLINE int __Pyx_IterFinish(void) {
30335 #if CYTHON_FAST_THREAD_STATE
30336     PyThreadState *tstate = __Pyx_PyThreadState_Current;
30337     PyObject* exc_type = tstate->curexc_type;
30338     if (unlikely(exc_type)) {
30339         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
30340             PyObject *exc_value, *exc_tb;
30341             exc_value = tstate->curexc_value;
30342             exc_tb = tstate->curexc_traceback;
30343             tstate->curexc_type = 0;
30344             tstate->curexc_value = 0;
30345             tstate->curexc_traceback = 0;
30346             Py_DECREF(exc_type);
30347             Py_XDECREF(exc_value);
30348             Py_XDECREF(exc_tb);
30349             return 0;
30350         } else {
30351             return -1;
30352         }
30353     }
30354     return 0;
30355 #else
30356     if (unlikely(PyErr_Occurred())) {
30357         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
30358             PyErr_Clear();
30359             return 0;
30360         } else {
30361             return -1;
30362         }
30363     }
30364     return 0;
30365 #endif
30366 }
30367 
30368 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)30369 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
30370     if (unlikely(retval)) {
30371         Py_DECREF(retval);
30372         __Pyx_RaiseTooManyValuesError(expected);
30373         return -1;
30374     } else {
30375         return __Pyx_IterFinish();
30376     }
30377     return 0;
30378 }
30379 
30380 /* GetTopmostException */
30381 #if CYTHON_USE_EXC_INFO_STACK
30382 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)30383 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
30384 {
30385     _PyErr_StackItem *exc_info = tstate->exc_info;
30386     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
30387            exc_info->previous_item != NULL)
30388     {
30389         exc_info = exc_info->previous_item;
30390     }
30391     return exc_info;
30392 }
30393 #endif
30394 
30395 /* SaveResetException */
30396 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)30397 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
30398     #if CYTHON_USE_EXC_INFO_STACK
30399     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
30400     *type = exc_info->exc_type;
30401     *value = exc_info->exc_value;
30402     *tb = exc_info->exc_traceback;
30403     #else
30404     *type = tstate->exc_type;
30405     *value = tstate->exc_value;
30406     *tb = tstate->exc_traceback;
30407     #endif
30408     Py_XINCREF(*type);
30409     Py_XINCREF(*value);
30410     Py_XINCREF(*tb);
30411 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)30412 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
30413     PyObject *tmp_type, *tmp_value, *tmp_tb;
30414     #if CYTHON_USE_EXC_INFO_STACK
30415     _PyErr_StackItem *exc_info = tstate->exc_info;
30416     tmp_type = exc_info->exc_type;
30417     tmp_value = exc_info->exc_value;
30418     tmp_tb = exc_info->exc_traceback;
30419     exc_info->exc_type = type;
30420     exc_info->exc_value = value;
30421     exc_info->exc_traceback = tb;
30422     #else
30423     tmp_type = tstate->exc_type;
30424     tmp_value = tstate->exc_value;
30425     tmp_tb = tstate->exc_traceback;
30426     tstate->exc_type = type;
30427     tstate->exc_value = value;
30428     tstate->exc_traceback = tb;
30429     #endif
30430     Py_XDECREF(tmp_type);
30431     Py_XDECREF(tmp_value);
30432     Py_XDECREF(tmp_tb);
30433 }
30434 #endif
30435 
30436 /* PyErrExceptionMatches */
30437 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)30438 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
30439     Py_ssize_t i, n;
30440     n = PyTuple_GET_SIZE(tuple);
30441 #if PY_MAJOR_VERSION >= 3
30442     for (i=0; i<n; i++) {
30443         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
30444     }
30445 #endif
30446     for (i=0; i<n; i++) {
30447         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
30448     }
30449     return 0;
30450 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)30451 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
30452     PyObject *exc_type = tstate->curexc_type;
30453     if (exc_type == err) return 1;
30454     if (unlikely(!exc_type)) return 0;
30455     if (unlikely(PyTuple_Check(err)))
30456         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
30457     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
30458 }
30459 #endif
30460 
30461 /* GetException */
30462 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)30463 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
30464 #else
30465 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
30466 #endif
30467 {
30468     PyObject *local_type, *local_value, *local_tb;
30469 #if CYTHON_FAST_THREAD_STATE
30470     PyObject *tmp_type, *tmp_value, *tmp_tb;
30471     local_type = tstate->curexc_type;
30472     local_value = tstate->curexc_value;
30473     local_tb = tstate->curexc_traceback;
30474     tstate->curexc_type = 0;
30475     tstate->curexc_value = 0;
30476     tstate->curexc_traceback = 0;
30477 #else
30478     PyErr_Fetch(&local_type, &local_value, &local_tb);
30479 #endif
30480     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
30481 #if CYTHON_FAST_THREAD_STATE
30482     if (unlikely(tstate->curexc_type))
30483 #else
30484     if (unlikely(PyErr_Occurred()))
30485 #endif
30486         goto bad;
30487     #if PY_MAJOR_VERSION >= 3
30488     if (local_tb) {
30489         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
30490             goto bad;
30491     }
30492     #endif
30493     Py_XINCREF(local_tb);
30494     Py_XINCREF(local_type);
30495     Py_XINCREF(local_value);
30496     *type = local_type;
30497     *value = local_value;
30498     *tb = local_tb;
30499 #if CYTHON_FAST_THREAD_STATE
30500     #if CYTHON_USE_EXC_INFO_STACK
30501     {
30502         _PyErr_StackItem *exc_info = tstate->exc_info;
30503         tmp_type = exc_info->exc_type;
30504         tmp_value = exc_info->exc_value;
30505         tmp_tb = exc_info->exc_traceback;
30506         exc_info->exc_type = local_type;
30507         exc_info->exc_value = local_value;
30508         exc_info->exc_traceback = local_tb;
30509     }
30510     #else
30511     tmp_type = tstate->exc_type;
30512     tmp_value = tstate->exc_value;
30513     tmp_tb = tstate->exc_traceback;
30514     tstate->exc_type = local_type;
30515     tstate->exc_value = local_value;
30516     tstate->exc_traceback = local_tb;
30517     #endif
30518     Py_XDECREF(tmp_type);
30519     Py_XDECREF(tmp_value);
30520     Py_XDECREF(tmp_tb);
30521 #else
30522     PyErr_SetExcInfo(local_type, local_value, local_tb);
30523 #endif
30524     return 0;
30525 bad:
30526     *type = 0;
30527     *value = 0;
30528     *tb = 0;
30529     Py_XDECREF(local_type);
30530     Py_XDECREF(local_value);
30531     Py_XDECREF(local_tb);
30532     return -1;
30533 }
30534 
30535 /* PyErrFetchRestore */
30536 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)30537 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
30538     PyObject *tmp_type, *tmp_value, *tmp_tb;
30539     tmp_type = tstate->curexc_type;
30540     tmp_value = tstate->curexc_value;
30541     tmp_tb = tstate->curexc_traceback;
30542     tstate->curexc_type = type;
30543     tstate->curexc_value = value;
30544     tstate->curexc_traceback = tb;
30545     Py_XDECREF(tmp_type);
30546     Py_XDECREF(tmp_value);
30547     Py_XDECREF(tmp_tb);
30548 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)30549 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
30550     *type = tstate->curexc_type;
30551     *value = tstate->curexc_value;
30552     *tb = tstate->curexc_traceback;
30553     tstate->curexc_type = 0;
30554     tstate->curexc_value = 0;
30555     tstate->curexc_traceback = 0;
30556 }
30557 #endif
30558 
30559 /* RaiseException */
30560 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)30561 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
30562                         CYTHON_UNUSED PyObject *cause) {
30563     __Pyx_PyThreadState_declare
30564     Py_XINCREF(type);
30565     if (!value || value == Py_None)
30566         value = NULL;
30567     else
30568         Py_INCREF(value);
30569     if (!tb || tb == Py_None)
30570         tb = NULL;
30571     else {
30572         Py_INCREF(tb);
30573         if (!PyTraceBack_Check(tb)) {
30574             PyErr_SetString(PyExc_TypeError,
30575                 "raise: arg 3 must be a traceback or None");
30576             goto raise_error;
30577         }
30578     }
30579     if (PyType_Check(type)) {
30580 #if CYTHON_COMPILING_IN_PYPY
30581         if (!value) {
30582             Py_INCREF(Py_None);
30583             value = Py_None;
30584         }
30585 #endif
30586         PyErr_NormalizeException(&type, &value, &tb);
30587     } else {
30588         if (value) {
30589             PyErr_SetString(PyExc_TypeError,
30590                 "instance exception may not have a separate value");
30591             goto raise_error;
30592         }
30593         value = type;
30594         type = (PyObject*) Py_TYPE(type);
30595         Py_INCREF(type);
30596         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
30597             PyErr_SetString(PyExc_TypeError,
30598                 "raise: exception class must be a subclass of BaseException");
30599             goto raise_error;
30600         }
30601     }
30602     __Pyx_PyThreadState_assign
30603     __Pyx_ErrRestore(type, value, tb);
30604     return;
30605 raise_error:
30606     Py_XDECREF(value);
30607     Py_XDECREF(type);
30608     Py_XDECREF(tb);
30609     return;
30610 }
30611 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)30612 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
30613     PyObject* owned_instance = NULL;
30614     if (tb == Py_None) {
30615         tb = 0;
30616     } else if (tb && !PyTraceBack_Check(tb)) {
30617         PyErr_SetString(PyExc_TypeError,
30618             "raise: arg 3 must be a traceback or None");
30619         goto bad;
30620     }
30621     if (value == Py_None)
30622         value = 0;
30623     if (PyExceptionInstance_Check(type)) {
30624         if (value) {
30625             PyErr_SetString(PyExc_TypeError,
30626                 "instance exception may not have a separate value");
30627             goto bad;
30628         }
30629         value = type;
30630         type = (PyObject*) Py_TYPE(value);
30631     } else if (PyExceptionClass_Check(type)) {
30632         PyObject *instance_class = NULL;
30633         if (value && PyExceptionInstance_Check(value)) {
30634             instance_class = (PyObject*) Py_TYPE(value);
30635             if (instance_class != type) {
30636                 int is_subclass = PyObject_IsSubclass(instance_class, type);
30637                 if (!is_subclass) {
30638                     instance_class = NULL;
30639                 } else if (unlikely(is_subclass == -1)) {
30640                     goto bad;
30641                 } else {
30642                     type = instance_class;
30643                 }
30644             }
30645         }
30646         if (!instance_class) {
30647             PyObject *args;
30648             if (!value)
30649                 args = PyTuple_New(0);
30650             else if (PyTuple_Check(value)) {
30651                 Py_INCREF(value);
30652                 args = value;
30653             } else
30654                 args = PyTuple_Pack(1, value);
30655             if (!args)
30656                 goto bad;
30657             owned_instance = PyObject_Call(type, args, NULL);
30658             Py_DECREF(args);
30659             if (!owned_instance)
30660                 goto bad;
30661             value = owned_instance;
30662             if (!PyExceptionInstance_Check(value)) {
30663                 PyErr_Format(PyExc_TypeError,
30664                              "calling %R should have returned an instance of "
30665                              "BaseException, not %R",
30666                              type, Py_TYPE(value));
30667                 goto bad;
30668             }
30669         }
30670     } else {
30671         PyErr_SetString(PyExc_TypeError,
30672             "raise: exception class must be a subclass of BaseException");
30673         goto bad;
30674     }
30675     if (cause) {
30676         PyObject *fixed_cause;
30677         if (cause == Py_None) {
30678             fixed_cause = NULL;
30679         } else if (PyExceptionClass_Check(cause)) {
30680             fixed_cause = PyObject_CallObject(cause, NULL);
30681             if (fixed_cause == NULL)
30682                 goto bad;
30683         } else if (PyExceptionInstance_Check(cause)) {
30684             fixed_cause = cause;
30685             Py_INCREF(fixed_cause);
30686         } else {
30687             PyErr_SetString(PyExc_TypeError,
30688                             "exception causes must derive from "
30689                             "BaseException");
30690             goto bad;
30691         }
30692         PyException_SetCause(value, fixed_cause);
30693     }
30694     PyErr_SetObject(type, value);
30695     if (tb) {
30696 #if CYTHON_COMPILING_IN_PYPY
30697         PyObject *tmp_type, *tmp_value, *tmp_tb;
30698         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
30699         Py_INCREF(tb);
30700         PyErr_Restore(tmp_type, tmp_value, tb);
30701         Py_XDECREF(tmp_tb);
30702 #else
30703         PyThreadState *tstate = __Pyx_PyThreadState_Current;
30704         PyObject* tmp_tb = tstate->curexc_traceback;
30705         if (tb != tmp_tb) {
30706             Py_INCREF(tb);
30707             tstate->curexc_traceback = tb;
30708             Py_XDECREF(tmp_tb);
30709         }
30710 #endif
30711     }
30712 bad:
30713     Py_XDECREF(owned_instance);
30714     return;
30715 }
30716 #endif
30717 
30718 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)30719 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
30720 {
30721     if (unlikely(!type)) {
30722         PyErr_SetString(PyExc_SystemError, "Missing type object");
30723         return 0;
30724     }
30725     else if (exact) {
30726         #if PY_MAJOR_VERSION == 2
30727         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
30728         #endif
30729     }
30730     else {
30731         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
30732     }
30733     PyErr_Format(PyExc_TypeError,
30734         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
30735         name, type->tp_name, Py_TYPE(obj)->tp_name);
30736     return 0;
30737 }
30738 
30739 /* PyCFunctionFastCall */
30740 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)30741 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
30742     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
30743     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
30744     PyObject *self = PyCFunction_GET_SELF(func);
30745     int flags = PyCFunction_GET_FLAGS(func);
30746     assert(PyCFunction_Check(func));
30747     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
30748     assert(nargs >= 0);
30749     assert(nargs == 0 || args != NULL);
30750     /* _PyCFunction_FastCallDict() must not be called with an exception set,
30751        because it may clear it (directly or indirectly) and so the
30752        caller loses its exception */
30753     assert(!PyErr_Occurred());
30754     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
30755         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
30756     } else {
30757         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
30758     }
30759 }
30760 #endif
30761 
30762 /* PyFunctionFastCall */
30763 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)30764 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
30765                                                PyObject *globals) {
30766     PyFrameObject *f;
30767     PyThreadState *tstate = __Pyx_PyThreadState_Current;
30768     PyObject **fastlocals;
30769     Py_ssize_t i;
30770     PyObject *result;
30771     assert(globals != NULL);
30772     /* XXX Perhaps we should create a specialized
30773        PyFrame_New() that doesn't take locals, but does
30774        take builtins without sanity checking them.
30775        */
30776     assert(tstate != NULL);
30777     f = PyFrame_New(tstate, co, globals, NULL);
30778     if (f == NULL) {
30779         return NULL;
30780     }
30781     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
30782     for (i = 0; i < na; i++) {
30783         Py_INCREF(*args);
30784         fastlocals[i] = *args++;
30785     }
30786     result = PyEval_EvalFrameEx(f,0);
30787     ++tstate->recursion_depth;
30788     Py_DECREF(f);
30789     --tstate->recursion_depth;
30790     return result;
30791 }
30792 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)30793 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
30794     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
30795     PyObject *globals = PyFunction_GET_GLOBALS(func);
30796     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
30797     PyObject *closure;
30798 #if PY_MAJOR_VERSION >= 3
30799     PyObject *kwdefs;
30800 #endif
30801     PyObject *kwtuple, **k;
30802     PyObject **d;
30803     Py_ssize_t nd;
30804     Py_ssize_t nk;
30805     PyObject *result;
30806     assert(kwargs == NULL || PyDict_Check(kwargs));
30807     nk = kwargs ? PyDict_Size(kwargs) : 0;
30808     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
30809         return NULL;
30810     }
30811     if (
30812 #if PY_MAJOR_VERSION >= 3
30813             co->co_kwonlyargcount == 0 &&
30814 #endif
30815             likely(kwargs == NULL || nk == 0) &&
30816             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
30817         if (argdefs == NULL && co->co_argcount == nargs) {
30818             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
30819             goto done;
30820         }
30821         else if (nargs == 0 && argdefs != NULL
30822                  && co->co_argcount == Py_SIZE(argdefs)) {
30823             /* function called with no arguments, but all parameters have
30824                a default value: use default values as arguments .*/
30825             args = &PyTuple_GET_ITEM(argdefs, 0);
30826             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
30827             goto done;
30828         }
30829     }
30830     if (kwargs != NULL) {
30831         Py_ssize_t pos, i;
30832         kwtuple = PyTuple_New(2 * nk);
30833         if (kwtuple == NULL) {
30834             result = NULL;
30835             goto done;
30836         }
30837         k = &PyTuple_GET_ITEM(kwtuple, 0);
30838         pos = i = 0;
30839         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
30840             Py_INCREF(k[i]);
30841             Py_INCREF(k[i+1]);
30842             i += 2;
30843         }
30844         nk = i / 2;
30845     }
30846     else {
30847         kwtuple = NULL;
30848         k = NULL;
30849     }
30850     closure = PyFunction_GET_CLOSURE(func);
30851 #if PY_MAJOR_VERSION >= 3
30852     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
30853 #endif
30854     if (argdefs != NULL) {
30855         d = &PyTuple_GET_ITEM(argdefs, 0);
30856         nd = Py_SIZE(argdefs);
30857     }
30858     else {
30859         d = NULL;
30860         nd = 0;
30861     }
30862 #if PY_MAJOR_VERSION >= 3
30863     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
30864                                args, (int)nargs,
30865                                k, (int)nk,
30866                                d, (int)nd, kwdefs, closure);
30867 #else
30868     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
30869                                args, (int)nargs,
30870                                k, (int)nk,
30871                                d, (int)nd, closure);
30872 #endif
30873     Py_XDECREF(kwtuple);
30874 done:
30875     Py_LeaveRecursiveCall();
30876     return result;
30877 }
30878 #endif
30879 #endif
30880 
30881 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)30882 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
30883     PyObject *args, *result = NULL;
30884     #if CYTHON_FAST_PYCALL
30885     if (PyFunction_Check(function)) {
30886         PyObject *args[2] = {arg1, arg2};
30887         return __Pyx_PyFunction_FastCall(function, args, 2);
30888     }
30889     #endif
30890     #if CYTHON_FAST_PYCCALL
30891     if (__Pyx_PyFastCFunction_Check(function)) {
30892         PyObject *args[2] = {arg1, arg2};
30893         return __Pyx_PyCFunction_FastCall(function, args, 2);
30894     }
30895     #endif
30896     args = PyTuple_New(2);
30897     if (unlikely(!args)) goto done;
30898     Py_INCREF(arg1);
30899     PyTuple_SET_ITEM(args, 0, arg1);
30900     Py_INCREF(arg2);
30901     PyTuple_SET_ITEM(args, 1, arg2);
30902     Py_INCREF(function);
30903     result = __Pyx_PyObject_Call(function, args, NULL);
30904     Py_DECREF(args);
30905     Py_DECREF(function);
30906 done:
30907     return result;
30908 }
30909 
30910 /* PyObjectCallMethO */
30911 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)30912 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
30913     PyObject *self, *result;
30914     PyCFunction cfunc;
30915     cfunc = PyCFunction_GET_FUNCTION(func);
30916     self = PyCFunction_GET_SELF(func);
30917     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
30918         return NULL;
30919     result = cfunc(self, arg);
30920     Py_LeaveRecursiveCall();
30921     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
30922         PyErr_SetString(
30923             PyExc_SystemError,
30924             "NULL result without error in PyObject_Call");
30925     }
30926     return result;
30927 }
30928 #endif
30929 
30930 /* PyObjectCallOneArg */
30931 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)30932 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
30933     PyObject *result;
30934     PyObject *args = PyTuple_New(1);
30935     if (unlikely(!args)) return NULL;
30936     Py_INCREF(arg);
30937     PyTuple_SET_ITEM(args, 0, arg);
30938     result = __Pyx_PyObject_Call(func, args, NULL);
30939     Py_DECREF(args);
30940     return result;
30941 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)30942 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
30943 #if CYTHON_FAST_PYCALL
30944     if (PyFunction_Check(func)) {
30945         return __Pyx_PyFunction_FastCall(func, &arg, 1);
30946     }
30947 #endif
30948     if (likely(PyCFunction_Check(func))) {
30949         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
30950             return __Pyx_PyObject_CallMethO(func, arg);
30951 #if CYTHON_FAST_PYCCALL
30952         } else if (__Pyx_PyFastCFunction_Check(func)) {
30953             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
30954 #endif
30955         }
30956     }
30957     return __Pyx__PyObject_CallOneArg(func, arg);
30958 }
30959 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)30960 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
30961     PyObject *result;
30962     PyObject *args = PyTuple_Pack(1, arg);
30963     if (unlikely(!args)) return NULL;
30964     result = __Pyx_PyObject_Call(func, args, NULL);
30965     Py_DECREF(args);
30966     return result;
30967 }
30968 #endif
30969 
30970 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)30971 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
30972 #if CYTHON_COMPILING_IN_PYPY
30973     return PyObject_RichCompareBool(s1, s2, equals);
30974 #else
30975     if (s1 == s2) {
30976         return (equals == Py_EQ);
30977     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
30978         const char *ps1, *ps2;
30979         Py_ssize_t length = PyBytes_GET_SIZE(s1);
30980         if (length != PyBytes_GET_SIZE(s2))
30981             return (equals == Py_NE);
30982         ps1 = PyBytes_AS_STRING(s1);
30983         ps2 = PyBytes_AS_STRING(s2);
30984         if (ps1[0] != ps2[0]) {
30985             return (equals == Py_NE);
30986         } else if (length == 1) {
30987             return (equals == Py_EQ);
30988         } else {
30989             int result;
30990 #if CYTHON_USE_UNICODE_INTERNALS
30991             Py_hash_t hash1, hash2;
30992             hash1 = ((PyBytesObject*)s1)->ob_shash;
30993             hash2 = ((PyBytesObject*)s2)->ob_shash;
30994             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
30995                 return (equals == Py_NE);
30996             }
30997 #endif
30998             result = memcmp(ps1, ps2, (size_t)length);
30999             return (equals == Py_EQ) ? (result == 0) : (result != 0);
31000         }
31001     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
31002         return (equals == Py_NE);
31003     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
31004         return (equals == Py_NE);
31005     } else {
31006         int result;
31007         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
31008         if (!py_result)
31009             return -1;
31010         result = __Pyx_PyObject_IsTrue(py_result);
31011         Py_DECREF(py_result);
31012         return result;
31013     }
31014 #endif
31015 }
31016 
31017 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)31018 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
31019 #if CYTHON_COMPILING_IN_PYPY
31020     return PyObject_RichCompareBool(s1, s2, equals);
31021 #else
31022 #if PY_MAJOR_VERSION < 3
31023     PyObject* owned_ref = NULL;
31024 #endif
31025     int s1_is_unicode, s2_is_unicode;
31026     if (s1 == s2) {
31027         goto return_eq;
31028     }
31029     s1_is_unicode = PyUnicode_CheckExact(s1);
31030     s2_is_unicode = PyUnicode_CheckExact(s2);
31031 #if PY_MAJOR_VERSION < 3
31032     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
31033         owned_ref = PyUnicode_FromObject(s2);
31034         if (unlikely(!owned_ref))
31035             return -1;
31036         s2 = owned_ref;
31037         s2_is_unicode = 1;
31038     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
31039         owned_ref = PyUnicode_FromObject(s1);
31040         if (unlikely(!owned_ref))
31041             return -1;
31042         s1 = owned_ref;
31043         s1_is_unicode = 1;
31044     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
31045         return __Pyx_PyBytes_Equals(s1, s2, equals);
31046     }
31047 #endif
31048     if (s1_is_unicode & s2_is_unicode) {
31049         Py_ssize_t length;
31050         int kind;
31051         void *data1, *data2;
31052         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
31053             return -1;
31054         length = __Pyx_PyUnicode_GET_LENGTH(s1);
31055         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
31056             goto return_ne;
31057         }
31058 #if CYTHON_USE_UNICODE_INTERNALS
31059         {
31060             Py_hash_t hash1, hash2;
31061         #if CYTHON_PEP393_ENABLED
31062             hash1 = ((PyASCIIObject*)s1)->hash;
31063             hash2 = ((PyASCIIObject*)s2)->hash;
31064         #else
31065             hash1 = ((PyUnicodeObject*)s1)->hash;
31066             hash2 = ((PyUnicodeObject*)s2)->hash;
31067         #endif
31068             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
31069                 goto return_ne;
31070             }
31071         }
31072 #endif
31073         kind = __Pyx_PyUnicode_KIND(s1);
31074         if (kind != __Pyx_PyUnicode_KIND(s2)) {
31075             goto return_ne;
31076         }
31077         data1 = __Pyx_PyUnicode_DATA(s1);
31078         data2 = __Pyx_PyUnicode_DATA(s2);
31079         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
31080             goto return_ne;
31081         } else if (length == 1) {
31082             goto return_eq;
31083         } else {
31084             int result = memcmp(data1, data2, (size_t)(length * kind));
31085             #if PY_MAJOR_VERSION < 3
31086             Py_XDECREF(owned_ref);
31087             #endif
31088             return (equals == Py_EQ) ? (result == 0) : (result != 0);
31089         }
31090     } else if ((s1 == Py_None) & s2_is_unicode) {
31091         goto return_ne;
31092     } else if ((s2 == Py_None) & s1_is_unicode) {
31093         goto return_ne;
31094     } else {
31095         int result;
31096         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
31097         #if PY_MAJOR_VERSION < 3
31098         Py_XDECREF(owned_ref);
31099         #endif
31100         if (!py_result)
31101             return -1;
31102         result = __Pyx_PyObject_IsTrue(py_result);
31103         Py_DECREF(py_result);
31104         return result;
31105     }
31106 return_eq:
31107     #if PY_MAJOR_VERSION < 3
31108     Py_XDECREF(owned_ref);
31109     #endif
31110     return (equals == Py_EQ);
31111 return_ne:
31112     #if PY_MAJOR_VERSION < 3
31113     Py_XDECREF(owned_ref);
31114     #endif
31115     return (equals == Py_NE);
31116 #endif
31117 }
31118 
31119 /* None */
__Pyx_div_Py_ssize_t(Py_ssize_t a,Py_ssize_t b)31120 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
31121     Py_ssize_t q = a / b;
31122     Py_ssize_t r = a - q*b;
31123     q -= ((r != 0) & ((r ^ b) < 0));
31124     return q;
31125 }
31126 
31127 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)31128 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
31129 #if CYTHON_USE_TYPE_SLOTS
31130 #if PY_MAJOR_VERSION >= 3
31131     if (likely(PyUnicode_Check(n)))
31132 #else
31133     if (likely(PyString_Check(n)))
31134 #endif
31135         return __Pyx_PyObject_GetAttrStr(o, n);
31136 #endif
31137     return PyObject_GetAttr(o, n);
31138 }
31139 
31140 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)31141 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
31142     PyObject *r;
31143     if (!j) return NULL;
31144     r = PyObject_GetItem(o, j);
31145     Py_DECREF(j);
31146     return r;
31147 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)31148 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
31149                                                               CYTHON_NCP_UNUSED int wraparound,
31150                                                               CYTHON_NCP_UNUSED int boundscheck) {
31151 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
31152     Py_ssize_t wrapped_i = i;
31153     if (wraparound & unlikely(i < 0)) {
31154         wrapped_i += PyList_GET_SIZE(o);
31155     }
31156     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
31157         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
31158         Py_INCREF(r);
31159         return r;
31160     }
31161     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
31162 #else
31163     return PySequence_GetItem(o, i);
31164 #endif
31165 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)31166 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
31167                                                               CYTHON_NCP_UNUSED int wraparound,
31168                                                               CYTHON_NCP_UNUSED int boundscheck) {
31169 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
31170     Py_ssize_t wrapped_i = i;
31171     if (wraparound & unlikely(i < 0)) {
31172         wrapped_i += PyTuple_GET_SIZE(o);
31173     }
31174     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
31175         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
31176         Py_INCREF(r);
31177         return r;
31178     }
31179     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
31180 #else
31181     return PySequence_GetItem(o, i);
31182 #endif
31183 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)31184 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
31185                                                      CYTHON_NCP_UNUSED int wraparound,
31186                                                      CYTHON_NCP_UNUSED int boundscheck) {
31187 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
31188     if (is_list || PyList_CheckExact(o)) {
31189         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
31190         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
31191             PyObject *r = PyList_GET_ITEM(o, n);
31192             Py_INCREF(r);
31193             return r;
31194         }
31195     }
31196     else if (PyTuple_CheckExact(o)) {
31197         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
31198         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
31199             PyObject *r = PyTuple_GET_ITEM(o, n);
31200             Py_INCREF(r);
31201             return r;
31202         }
31203     } else {
31204         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
31205         if (likely(m && m->sq_item)) {
31206             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
31207                 Py_ssize_t l = m->sq_length(o);
31208                 if (likely(l >= 0)) {
31209                     i += l;
31210                 } else {
31211                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
31212                         return NULL;
31213                     PyErr_Clear();
31214                 }
31215             }
31216             return m->sq_item(o, i);
31217         }
31218     }
31219 #else
31220     if (is_list || PySequence_Check(o)) {
31221         return PySequence_GetItem(o, i);
31222     }
31223 #endif
31224     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
31225 }
31226 
31227 /* ObjectGetItem */
31228 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)31229 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
31230     PyObject *runerr;
31231     Py_ssize_t key_value;
31232     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
31233     if (unlikely(!(m && m->sq_item))) {
31234         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
31235         return NULL;
31236     }
31237     key_value = __Pyx_PyIndex_AsSsize_t(index);
31238     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
31239         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
31240     }
31241     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
31242         PyErr_Clear();
31243         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
31244     }
31245     return NULL;
31246 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)31247 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
31248     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
31249     if (likely(m && m->mp_subscript)) {
31250         return m->mp_subscript(obj, key);
31251     }
31252     return __Pyx_PyObject_GetIndex(obj, key);
31253 }
31254 #endif
31255 
31256 /* 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))31257 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
31258          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
31259          const char* encoding, const char* errors,
31260          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
31261     Py_ssize_t length;
31262     if (unlikely((start < 0) | (stop < 0))) {
31263         size_t slen = strlen(cstring);
31264         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
31265             PyErr_SetString(PyExc_OverflowError,
31266                             "c-string too long to convert to Python");
31267             return NULL;
31268         }
31269         length = (Py_ssize_t) slen;
31270         if (start < 0) {
31271             start += length;
31272             if (start < 0)
31273                 start = 0;
31274         }
31275         if (stop < 0)
31276             stop += length;
31277     }
31278     if (unlikely(stop <= start))
31279         return __Pyx_NewRef(__pyx_empty_unicode);
31280     length = stop - start;
31281     cstring += start;
31282     if (decode_func) {
31283         return decode_func(cstring, length, errors);
31284     } else {
31285         return PyUnicode_Decode(cstring, length, encoding, errors);
31286     }
31287 }
31288 
31289 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)31290 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
31291     __Pyx_PyThreadState_declare
31292     __Pyx_PyThreadState_assign
31293     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
31294         return NULL;
31295     __Pyx_PyErr_Clear();
31296     Py_INCREF(d);
31297     return d;
31298 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)31299 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
31300     PyObject *r = __Pyx_GetAttr(o, n);
31301     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
31302 }
31303 
31304 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)31305 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
31306     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
31307 }
31308 
31309 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)31310 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
31311     if (unlikely(!type)) {
31312         PyErr_SetString(PyExc_SystemError, "Missing type object");
31313         return 0;
31314     }
31315     if (likely(__Pyx_TypeCheck(obj, type)))
31316         return 1;
31317     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
31318                  Py_TYPE(obj)->tp_name, type->tp_name);
31319     return 0;
31320 }
31321 
31322 /* SwapException */
31323 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)31324 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
31325     PyObject *tmp_type, *tmp_value, *tmp_tb;
31326     #if CYTHON_USE_EXC_INFO_STACK
31327     _PyErr_StackItem *exc_info = tstate->exc_info;
31328     tmp_type = exc_info->exc_type;
31329     tmp_value = exc_info->exc_value;
31330     tmp_tb = exc_info->exc_traceback;
31331     exc_info->exc_type = *type;
31332     exc_info->exc_value = *value;
31333     exc_info->exc_traceback = *tb;
31334     #else
31335     tmp_type = tstate->exc_type;
31336     tmp_value = tstate->exc_value;
31337     tmp_tb = tstate->exc_traceback;
31338     tstate->exc_type = *type;
31339     tstate->exc_value = *value;
31340     tstate->exc_traceback = *tb;
31341     #endif
31342     *type = tmp_type;
31343     *value = tmp_value;
31344     *tb = tmp_tb;
31345 }
31346 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)31347 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
31348     PyObject *tmp_type, *tmp_value, *tmp_tb;
31349     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
31350     PyErr_SetExcInfo(*type, *value, *tb);
31351     *type = tmp_type;
31352     *value = tmp_value;
31353     *tb = tmp_tb;
31354 }
31355 #endif
31356 
31357 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)31358 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
31359     PyObject *empty_list = 0;
31360     PyObject *module = 0;
31361     PyObject *global_dict = 0;
31362     PyObject *empty_dict = 0;
31363     PyObject *list;
31364     #if PY_MAJOR_VERSION < 3
31365     PyObject *py_import;
31366     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
31367     if (!py_import)
31368         goto bad;
31369     #endif
31370     if (from_list)
31371         list = from_list;
31372     else {
31373         empty_list = PyList_New(0);
31374         if (!empty_list)
31375             goto bad;
31376         list = empty_list;
31377     }
31378     global_dict = PyModule_GetDict(__pyx_m);
31379     if (!global_dict)
31380         goto bad;
31381     empty_dict = PyDict_New();
31382     if (!empty_dict)
31383         goto bad;
31384     {
31385         #if PY_MAJOR_VERSION >= 3
31386         if (level == -1) {
31387             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
31388                 module = PyImport_ImportModuleLevelObject(
31389                     name, global_dict, empty_dict, list, 1);
31390                 if (!module) {
31391                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
31392                         goto bad;
31393                     PyErr_Clear();
31394                 }
31395             }
31396             level = 0;
31397         }
31398         #endif
31399         if (!module) {
31400             #if PY_MAJOR_VERSION < 3
31401             PyObject *py_level = PyInt_FromLong(level);
31402             if (!py_level)
31403                 goto bad;
31404             module = PyObject_CallFunctionObjArgs(py_import,
31405                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
31406             Py_DECREF(py_level);
31407             #else
31408             module = PyImport_ImportModuleLevelObject(
31409                 name, global_dict, empty_dict, list, level);
31410             #endif
31411         }
31412     }
31413 bad:
31414     #if PY_MAJOR_VERSION < 3
31415     Py_XDECREF(py_import);
31416     #endif
31417     Py_XDECREF(empty_list);
31418     Py_XDECREF(empty_dict);
31419     return module;
31420 }
31421 
31422 /* FastTypeChecks */
31423 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)31424 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
31425     while (a) {
31426         a = a->tp_base;
31427         if (a == b)
31428             return 1;
31429     }
31430     return b == &PyBaseObject_Type;
31431 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)31432 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
31433     PyObject *mro;
31434     if (a == b) return 1;
31435     mro = a->tp_mro;
31436     if (likely(mro)) {
31437         Py_ssize_t i, n;
31438         n = PyTuple_GET_SIZE(mro);
31439         for (i = 0; i < n; i++) {
31440             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
31441                 return 1;
31442         }
31443         return 0;
31444     }
31445     return __Pyx_InBases(a, b);
31446 }
31447 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)31448 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
31449     PyObject *exception, *value, *tb;
31450     int res;
31451     __Pyx_PyThreadState_declare
31452     __Pyx_PyThreadState_assign
31453     __Pyx_ErrFetch(&exception, &value, &tb);
31454     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
31455     if (unlikely(res == -1)) {
31456         PyErr_WriteUnraisable(err);
31457         res = 0;
31458     }
31459     if (!res) {
31460         res = PyObject_IsSubclass(err, exc_type2);
31461         if (unlikely(res == -1)) {
31462             PyErr_WriteUnraisable(err);
31463             res = 0;
31464         }
31465     }
31466     __Pyx_ErrRestore(exception, value, tb);
31467     return res;
31468 }
31469 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)31470 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
31471     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
31472     if (!res) {
31473         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
31474     }
31475     return res;
31476 }
31477 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)31478 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
31479     Py_ssize_t i, n;
31480     assert(PyExceptionClass_Check(exc_type));
31481     n = PyTuple_GET_SIZE(tuple);
31482 #if PY_MAJOR_VERSION >= 3
31483     for (i=0; i<n; i++) {
31484         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
31485     }
31486 #endif
31487     for (i=0; i<n; i++) {
31488         PyObject *t = PyTuple_GET_ITEM(tuple, i);
31489         #if PY_MAJOR_VERSION < 3
31490         if (likely(exc_type == t)) return 1;
31491         #endif
31492         if (likely(PyExceptionClass_Check(t))) {
31493             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
31494         } else {
31495         }
31496     }
31497     return 0;
31498 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)31499 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
31500     if (likely(err == exc_type)) return 1;
31501     if (likely(PyExceptionClass_Check(err))) {
31502         if (likely(PyExceptionClass_Check(exc_type))) {
31503             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
31504         } else if (likely(PyTuple_Check(exc_type))) {
31505             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
31506         } else {
31507         }
31508     }
31509     return PyErr_GivenExceptionMatches(err, exc_type);
31510 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)31511 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
31512     assert(PyExceptionClass_Check(exc_type1));
31513     assert(PyExceptionClass_Check(exc_type2));
31514     if (likely(err == exc_type1 || err == exc_type2)) return 1;
31515     if (likely(PyExceptionClass_Check(err))) {
31516         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
31517     }
31518     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
31519 }
31520 #endif
31521 
31522 /* PyIntBinop */
31523 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)31524 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
31525     (void)inplace;
31526     (void)zerodivision_check;
31527     #if PY_MAJOR_VERSION < 3
31528     if (likely(PyInt_CheckExact(op1))) {
31529         const long b = intval;
31530         long x;
31531         long a = PyInt_AS_LONG(op1);
31532             x = (long)((unsigned long)a + b);
31533             if (likely((x^a) >= 0 || (x^b) >= 0))
31534                 return PyInt_FromLong(x);
31535             return PyLong_Type.tp_as_number->nb_add(op1, op2);
31536     }
31537     #endif
31538     #if CYTHON_USE_PYLONG_INTERNALS
31539     if (likely(PyLong_CheckExact(op1))) {
31540         const long b = intval;
31541         long a, x;
31542 #ifdef HAVE_LONG_LONG
31543         const PY_LONG_LONG llb = intval;
31544         PY_LONG_LONG lla, llx;
31545 #endif
31546         const digit* digits = ((PyLongObject*)op1)->ob_digit;
31547         const Py_ssize_t size = Py_SIZE(op1);
31548         if (likely(__Pyx_sst_abs(size) <= 1)) {
31549             a = likely(size) ? digits[0] : 0;
31550             if (size == -1) a = -a;
31551         } else {
31552             switch (size) {
31553                 case -2:
31554                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
31555                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
31556                         break;
31557 #ifdef HAVE_LONG_LONG
31558                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
31559                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
31560                         goto long_long;
31561 #endif
31562                     }
31563                     CYTHON_FALLTHROUGH;
31564                 case 2:
31565                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
31566                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
31567                         break;
31568 #ifdef HAVE_LONG_LONG
31569                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
31570                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
31571                         goto long_long;
31572 #endif
31573                     }
31574                     CYTHON_FALLTHROUGH;
31575                 case -3:
31576                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
31577                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
31578                         break;
31579 #ifdef HAVE_LONG_LONG
31580                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
31581                         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]));
31582                         goto long_long;
31583 #endif
31584                     }
31585                     CYTHON_FALLTHROUGH;
31586                 case 3:
31587                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
31588                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
31589                         break;
31590 #ifdef HAVE_LONG_LONG
31591                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
31592                         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]));
31593                         goto long_long;
31594 #endif
31595                     }
31596                     CYTHON_FALLTHROUGH;
31597                 case -4:
31598                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
31599                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
31600                         break;
31601 #ifdef HAVE_LONG_LONG
31602                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
31603                         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]));
31604                         goto long_long;
31605 #endif
31606                     }
31607                     CYTHON_FALLTHROUGH;
31608                 case 4:
31609                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
31610                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
31611                         break;
31612 #ifdef HAVE_LONG_LONG
31613                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
31614                         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]));
31615                         goto long_long;
31616 #endif
31617                     }
31618                     CYTHON_FALLTHROUGH;
31619                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
31620             }
31621         }
31622                 x = a + b;
31623             return PyLong_FromLong(x);
31624 #ifdef HAVE_LONG_LONG
31625         long_long:
31626                 llx = lla + llb;
31627             return PyLong_FromLongLong(llx);
31628 #endif
31629 
31630 
31631     }
31632     #endif
31633     if (PyFloat_CheckExact(op1)) {
31634         const long b = intval;
31635         double a = PyFloat_AS_DOUBLE(op1);
31636             double result;
31637             PyFPE_START_PROTECT("add", return NULL)
31638             result = ((double)a) + (double)b;
31639             PyFPE_END_PROTECT(result)
31640             return PyFloat_FromDouble(result);
31641     }
31642     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
31643 }
31644 #endif
31645 
31646 /* None */
__Pyx_div_long(long a,long b)31647 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
31648     long q = a / b;
31649     long r = a - q*b;
31650     q -= ((r != 0) & ((r ^ b) < 0));
31651     return q;
31652 }
31653 
31654 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)31655 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
31656     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
31657     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
31658         PyErr_Format(PyExc_ImportError,
31659         #if PY_MAJOR_VERSION < 3
31660             "cannot import name %.230s", PyString_AS_STRING(name));
31661         #else
31662             "cannot import name %S", name);
31663         #endif
31664     }
31665     return value;
31666 }
31667 
31668 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)31669 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
31670     PyObject *r;
31671     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
31672         PyErr_SetString(PyExc_TypeError,
31673                         "hasattr(): attribute name must be string");
31674         return -1;
31675     }
31676     r = __Pyx_GetAttr(o, n);
31677     if (unlikely(!r)) {
31678         PyErr_Clear();
31679         return 0;
31680     } else {
31681         Py_DECREF(r);
31682         return 1;
31683     }
31684 }
31685 
31686 /* PyObject_GenericGetAttrNoDict */
31687 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)31688 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
31689     PyErr_Format(PyExc_AttributeError,
31690 #if PY_MAJOR_VERSION >= 3
31691                  "'%.50s' object has no attribute '%U'",
31692                  tp->tp_name, attr_name);
31693 #else
31694                  "'%.50s' object has no attribute '%.400s'",
31695                  tp->tp_name, PyString_AS_STRING(attr_name));
31696 #endif
31697     return NULL;
31698 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)31699 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
31700     PyObject *descr;
31701     PyTypeObject *tp = Py_TYPE(obj);
31702     if (unlikely(!PyString_Check(attr_name))) {
31703         return PyObject_GenericGetAttr(obj, attr_name);
31704     }
31705     assert(!tp->tp_dictoffset);
31706     descr = _PyType_Lookup(tp, attr_name);
31707     if (unlikely(!descr)) {
31708         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
31709     }
31710     Py_INCREF(descr);
31711     #if PY_MAJOR_VERSION < 3
31712     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
31713     #endif
31714     {
31715         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
31716         if (unlikely(f)) {
31717             PyObject *res = f(descr, obj, (PyObject *)tp);
31718             Py_DECREF(descr);
31719             return res;
31720         }
31721     }
31722     return descr;
31723 }
31724 #endif
31725 
31726 /* PyObject_GenericGetAttr */
31727 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)31728 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
31729     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
31730         return PyObject_GenericGetAttr(obj, attr_name);
31731     }
31732     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
31733 }
31734 #endif
31735 
31736 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)31737 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
31738 #if PY_VERSION_HEX >= 0x02070000
31739     PyObject *ob = PyCapsule_New(vtable, 0, 0);
31740 #else
31741     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
31742 #endif
31743     if (!ob)
31744         goto bad;
31745     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
31746         goto bad;
31747     Py_DECREF(ob);
31748     return 0;
31749 bad:
31750     Py_XDECREF(ob);
31751     return -1;
31752 }
31753 
31754 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)31755 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
31756     __Pyx_PyThreadState_declare
31757     __Pyx_PyThreadState_assign
31758     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
31759         __Pyx_PyErr_Clear();
31760 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)31761 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
31762     PyObject *result;
31763 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
31764     PyTypeObject* tp = Py_TYPE(obj);
31765     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
31766         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
31767     }
31768 #endif
31769     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
31770     if (unlikely(!result)) {
31771         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
31772     }
31773     return result;
31774 }
31775 
31776 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)31777 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
31778   int ret;
31779   PyObject *name_attr;
31780   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
31781   if (likely(name_attr)) {
31782       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
31783   } else {
31784       ret = -1;
31785   }
31786   if (unlikely(ret < 0)) {
31787       PyErr_Clear();
31788       ret = 0;
31789   }
31790   Py_XDECREF(name_attr);
31791   return ret;
31792 }
__Pyx_setup_reduce(PyObject * type_obj)31793 static int __Pyx_setup_reduce(PyObject* type_obj) {
31794     int ret = 0;
31795     PyObject *object_reduce = NULL;
31796     PyObject *object_reduce_ex = NULL;
31797     PyObject *reduce = NULL;
31798     PyObject *reduce_ex = NULL;
31799     PyObject *reduce_cython = NULL;
31800     PyObject *setstate = NULL;
31801     PyObject *setstate_cython = NULL;
31802 #if CYTHON_USE_PYTYPE_LOOKUP
31803     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
31804 #else
31805     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
31806 #endif
31807 #if CYTHON_USE_PYTYPE_LOOKUP
31808     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
31809 #else
31810     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
31811 #endif
31812     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
31813     if (reduce_ex == object_reduce_ex) {
31814 #if CYTHON_USE_PYTYPE_LOOKUP
31815         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
31816 #else
31817         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
31818 #endif
31819         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
31820         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
31821             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
31822             if (likely(reduce_cython)) {
31823                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
31824                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
31825             } else if (reduce == object_reduce || PyErr_Occurred()) {
31826                 goto __PYX_BAD;
31827             }
31828             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
31829             if (!setstate) PyErr_Clear();
31830             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
31831                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
31832                 if (likely(setstate_cython)) {
31833                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
31834                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
31835                 } else if (!setstate || PyErr_Occurred()) {
31836                     goto __PYX_BAD;
31837                 }
31838             }
31839             PyType_Modified((PyTypeObject*)type_obj);
31840         }
31841     }
31842     goto __PYX_GOOD;
31843 __PYX_BAD:
31844     if (!PyErr_Occurred())
31845         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
31846     ret = -1;
31847 __PYX_GOOD:
31848 #if !CYTHON_USE_PYTYPE_LOOKUP
31849     Py_XDECREF(object_reduce);
31850     Py_XDECREF(object_reduce_ex);
31851 #endif
31852     Py_XDECREF(reduce);
31853     Py_XDECREF(reduce_ex);
31854     Py_XDECREF(reduce_cython);
31855     Py_XDECREF(setstate);
31856     Py_XDECREF(setstate_cython);
31857     return ret;
31858 }
31859 
31860 /* TypeImport */
31861 #ifndef __PYX_HAVE_RT_ImportType
31862 #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)31863 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
31864     size_t size, enum __Pyx_ImportType_CheckSize check_size)
31865 {
31866     PyObject *result = 0;
31867     char warning[200];
31868     Py_ssize_t basicsize;
31869 #ifdef Py_LIMITED_API
31870     PyObject *py_basicsize;
31871 #endif
31872     result = PyObject_GetAttrString(module, class_name);
31873     if (!result)
31874         goto bad;
31875     if (!PyType_Check(result)) {
31876         PyErr_Format(PyExc_TypeError,
31877             "%.200s.%.200s is not a type object",
31878             module_name, class_name);
31879         goto bad;
31880     }
31881 #ifndef Py_LIMITED_API
31882     basicsize = ((PyTypeObject *)result)->tp_basicsize;
31883 #else
31884     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
31885     if (!py_basicsize)
31886         goto bad;
31887     basicsize = PyLong_AsSsize_t(py_basicsize);
31888     Py_DECREF(py_basicsize);
31889     py_basicsize = 0;
31890     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
31891         goto bad;
31892 #endif
31893     if ((size_t)basicsize < size) {
31894         PyErr_Format(PyExc_ValueError,
31895             "%.200s.%.200s size changed, may indicate binary incompatibility. "
31896             "Expected %zd from C header, got %zd from PyObject",
31897             module_name, class_name, size, basicsize);
31898         goto bad;
31899     }
31900     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
31901         PyErr_Format(PyExc_ValueError,
31902             "%.200s.%.200s size changed, may indicate binary incompatibility. "
31903             "Expected %zd from C header, got %zd from PyObject",
31904             module_name, class_name, size, basicsize);
31905         goto bad;
31906     }
31907     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
31908         PyOS_snprintf(warning, sizeof(warning),
31909             "%s.%s size changed, may indicate binary incompatibility. "
31910             "Expected %zd from C header, got %zd from PyObject",
31911             module_name, class_name, size, basicsize);
31912         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
31913     }
31914     return (PyTypeObject *)result;
31915 bad:
31916     Py_XDECREF(result);
31917     return NULL;
31918 }
31919 #endif
31920 
31921 /* CLineInTraceback */
31922 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)31923 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
31924     PyObject *use_cline;
31925     PyObject *ptype, *pvalue, *ptraceback;
31926 #if CYTHON_COMPILING_IN_CPYTHON
31927     PyObject **cython_runtime_dict;
31928 #endif
31929     if (unlikely(!__pyx_cython_runtime)) {
31930         return c_line;
31931     }
31932     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
31933 #if CYTHON_COMPILING_IN_CPYTHON
31934     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
31935     if (likely(cython_runtime_dict)) {
31936         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
31937             use_cline, *cython_runtime_dict,
31938             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
31939     } else
31940 #endif
31941     {
31942       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
31943       if (use_cline_obj) {
31944         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
31945         Py_DECREF(use_cline_obj);
31946       } else {
31947         PyErr_Clear();
31948         use_cline = NULL;
31949       }
31950     }
31951     if (!use_cline) {
31952         c_line = 0;
31953         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
31954     }
31955     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
31956         c_line = 0;
31957     }
31958     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
31959     return c_line;
31960 }
31961 #endif
31962 
31963 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)31964 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
31965     int start = 0, mid = 0, end = count - 1;
31966     if (end >= 0 && code_line > entries[end].code_line) {
31967         return count;
31968     }
31969     while (start < end) {
31970         mid = start + (end - start) / 2;
31971         if (code_line < entries[mid].code_line) {
31972             end = mid;
31973         } else if (code_line > entries[mid].code_line) {
31974              start = mid + 1;
31975         } else {
31976             return mid;
31977         }
31978     }
31979     if (code_line <= entries[mid].code_line) {
31980         return mid;
31981     } else {
31982         return mid + 1;
31983     }
31984 }
__pyx_find_code_object(int code_line)31985 static PyCodeObject *__pyx_find_code_object(int code_line) {
31986     PyCodeObject* code_object;
31987     int pos;
31988     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
31989         return NULL;
31990     }
31991     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
31992     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
31993         return NULL;
31994     }
31995     code_object = __pyx_code_cache.entries[pos].code_object;
31996     Py_INCREF(code_object);
31997     return code_object;
31998 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)31999 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
32000     int pos, i;
32001     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
32002     if (unlikely(!code_line)) {
32003         return;
32004     }
32005     if (unlikely(!entries)) {
32006         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
32007         if (likely(entries)) {
32008             __pyx_code_cache.entries = entries;
32009             __pyx_code_cache.max_count = 64;
32010             __pyx_code_cache.count = 1;
32011             entries[0].code_line = code_line;
32012             entries[0].code_object = code_object;
32013             Py_INCREF(code_object);
32014         }
32015         return;
32016     }
32017     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
32018     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
32019         PyCodeObject* tmp = entries[pos].code_object;
32020         entries[pos].code_object = code_object;
32021         Py_DECREF(tmp);
32022         return;
32023     }
32024     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
32025         int new_max = __pyx_code_cache.max_count + 64;
32026         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
32027             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
32028         if (unlikely(!entries)) {
32029             return;
32030         }
32031         __pyx_code_cache.entries = entries;
32032         __pyx_code_cache.max_count = new_max;
32033     }
32034     for (i=__pyx_code_cache.count; i>pos; i--) {
32035         entries[i] = entries[i-1];
32036     }
32037     entries[pos].code_line = code_line;
32038     entries[pos].code_object = code_object;
32039     __pyx_code_cache.count++;
32040     Py_INCREF(code_object);
32041 }
32042 
32043 /* AddTraceback */
32044 #include "compile.h"
32045 #include "frameobject.h"
32046 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)32047 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
32048             const char *funcname, int c_line,
32049             int py_line, const char *filename) {
32050     PyCodeObject *py_code = 0;
32051     PyObject *py_srcfile = 0;
32052     PyObject *py_funcname = 0;
32053     #if PY_MAJOR_VERSION < 3
32054     py_srcfile = PyString_FromString(filename);
32055     #else
32056     py_srcfile = PyUnicode_FromString(filename);
32057     #endif
32058     if (!py_srcfile) goto bad;
32059     if (c_line) {
32060         #if PY_MAJOR_VERSION < 3
32061         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
32062         #else
32063         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
32064         #endif
32065     }
32066     else {
32067         #if PY_MAJOR_VERSION < 3
32068         py_funcname = PyString_FromString(funcname);
32069         #else
32070         py_funcname = PyUnicode_FromString(funcname);
32071         #endif
32072     }
32073     if (!py_funcname) goto bad;
32074     py_code = __Pyx_PyCode_New(
32075         0,
32076         0,
32077         0,
32078         0,
32079         0,
32080         __pyx_empty_bytes, /*PyObject *code,*/
32081         __pyx_empty_tuple, /*PyObject *consts,*/
32082         __pyx_empty_tuple, /*PyObject *names,*/
32083         __pyx_empty_tuple, /*PyObject *varnames,*/
32084         __pyx_empty_tuple, /*PyObject *freevars,*/
32085         __pyx_empty_tuple, /*PyObject *cellvars,*/
32086         py_srcfile,   /*PyObject *filename,*/
32087         py_funcname,  /*PyObject *name,*/
32088         py_line,
32089         __pyx_empty_bytes  /*PyObject *lnotab*/
32090     );
32091     Py_DECREF(py_srcfile);
32092     Py_DECREF(py_funcname);
32093     return py_code;
32094 bad:
32095     Py_XDECREF(py_srcfile);
32096     Py_XDECREF(py_funcname);
32097     return NULL;
32098 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)32099 static void __Pyx_AddTraceback(const char *funcname, int c_line,
32100                                int py_line, const char *filename) {
32101     PyCodeObject *py_code = 0;
32102     PyFrameObject *py_frame = 0;
32103     PyThreadState *tstate = __Pyx_PyThreadState_Current;
32104     if (c_line) {
32105         c_line = __Pyx_CLineForTraceback(tstate, c_line);
32106     }
32107     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
32108     if (!py_code) {
32109         py_code = __Pyx_CreateCodeObjectForTraceback(
32110             funcname, c_line, py_line, filename);
32111         if (!py_code) goto bad;
32112         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
32113     }
32114     py_frame = PyFrame_New(
32115         tstate,            /*PyThreadState *tstate,*/
32116         py_code,           /*PyCodeObject *code,*/
32117         __pyx_d,    /*PyObject *globals,*/
32118         0                  /*PyObject *locals*/
32119     );
32120     if (!py_frame) goto bad;
32121     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
32122     PyTraceBack_Here(py_frame);
32123 bad:
32124     Py_XDECREF(py_code);
32125     Py_XDECREF(py_frame);
32126 }
32127 
32128 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)32129 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
32130     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
32131         if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
32132         if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
32133     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
32134     return -1;
32135 }
__Pyx_ReleaseBuffer(Py_buffer * view)32136 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
32137     PyObject *obj = view->obj;
32138     if (!obj) return;
32139     if (PyObject_CheckBuffer(obj)) {
32140         PyBuffer_Release(view);
32141         return;
32142     }
32143     if ((0)) {}
32144     view->obj = NULL;
32145     Py_DECREF(obj);
32146 }
32147 #endif
32148 
32149 
32150 /* MemviewSliceIsContig */
32151 static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs,char order,int ndim)32152 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
32153 {
32154     int i, index, step, start;
32155     Py_ssize_t itemsize = mvs.memview->view.itemsize;
32156     if (order == 'F') {
32157         step = 1;
32158         start = 0;
32159     } else {
32160         step = -1;
32161         start = ndim - 1;
32162     }
32163     for (i = 0; i < ndim; i++) {
32164         index = start + step * i;
32165         if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
32166             return 0;
32167         itemsize *= mvs.shape[index];
32168     }
32169     return 1;
32170 }
32171 
32172 /* OverlappingSlices */
32173 static void
__pyx_get_array_memory_extents(__Pyx_memviewslice * slice,void ** out_start,void ** out_end,int ndim,size_t itemsize)32174 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
32175                                void **out_start, void **out_end,
32176                                int ndim, size_t itemsize)
32177 {
32178     char *start, *end;
32179     int i;
32180     start = end = slice->data;
32181     for (i = 0; i < ndim; i++) {
32182         Py_ssize_t stride = slice->strides[i];
32183         Py_ssize_t extent = slice->shape[i];
32184         if (extent == 0) {
32185             *out_start = *out_end = start;
32186             return;
32187         } else {
32188             if (stride > 0)
32189                 end += stride * (extent - 1);
32190             else
32191                 start += stride * (extent - 1);
32192         }
32193     }
32194     *out_start = start;
32195     *out_end = end + itemsize;
32196 }
32197 static int
__pyx_slices_overlap(__Pyx_memviewslice * slice1,__Pyx_memviewslice * slice2,int ndim,size_t itemsize)32198 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
32199                      __Pyx_memviewslice *slice2,
32200                      int ndim, size_t itemsize)
32201 {
32202     void *start1, *end1, *start2, *end2;
32203     __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
32204     __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
32205     return (start1 < end2) && (start2 < end1);
32206 }
32207 
32208 /* Capsule */
32209 static CYTHON_INLINE PyObject *
__pyx_capsule_create(void * p,CYTHON_UNUSED const char * sig)32210 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
32211 {
32212     PyObject *cobj;
32213 #if PY_VERSION_HEX >= 0x02070000
32214     cobj = PyCapsule_New(p, sig, NULL);
32215 #else
32216     cobj = PyCObject_FromVoidPtr(p, NULL);
32217 #endif
32218     return cobj;
32219 }
32220 
32221 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)32222 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
32223 {
32224   union {
32225     uint32_t u32;
32226     uint8_t u8[4];
32227   } S;
32228   S.u32 = 0x01020304;
32229   return S.u8[0] == 4;
32230 }
32231 
32232 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)32233 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
32234                               __Pyx_BufFmt_StackElem* stack,
32235                               __Pyx_TypeInfo* type) {
32236   stack[0].field = &ctx->root;
32237   stack[0].parent_offset = 0;
32238   ctx->root.type = type;
32239   ctx->root.name = "buffer dtype";
32240   ctx->root.offset = 0;
32241   ctx->head = stack;
32242   ctx->head->field = &ctx->root;
32243   ctx->fmt_offset = 0;
32244   ctx->head->parent_offset = 0;
32245   ctx->new_packmode = '@';
32246   ctx->enc_packmode = '@';
32247   ctx->new_count = 1;
32248   ctx->enc_count = 0;
32249   ctx->enc_type = 0;
32250   ctx->is_complex = 0;
32251   ctx->is_valid_array = 0;
32252   ctx->struct_alignment = 0;
32253   while (type->typegroup == 'S') {
32254     ++ctx->head;
32255     ctx->head->field = type->fields;
32256     ctx->head->parent_offset = 0;
32257     type = type->fields->type;
32258   }
32259 }
__Pyx_BufFmt_ParseNumber(const char ** ts)32260 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
32261     int count;
32262     const char* t = *ts;
32263     if (*t < '0' || *t > '9') {
32264       return -1;
32265     } else {
32266         count = *t++ - '0';
32267         while (*t >= '0' && *t <= '9') {
32268             count *= 10;
32269             count += *t++ - '0';
32270         }
32271     }
32272     *ts = t;
32273     return count;
32274 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)32275 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
32276     int number = __Pyx_BufFmt_ParseNumber(ts);
32277     if (number == -1)
32278         PyErr_Format(PyExc_ValueError,\
32279                      "Does not understand character buffer dtype format string ('%c')", **ts);
32280     return number;
32281 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)32282 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
32283   PyErr_Format(PyExc_ValueError,
32284                "Unexpected format string character: '%c'", ch);
32285 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)32286 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
32287   switch (ch) {
32288     case '?': return "'bool'";
32289     case 'c': return "'char'";
32290     case 'b': return "'signed char'";
32291     case 'B': return "'unsigned char'";
32292     case 'h': return "'short'";
32293     case 'H': return "'unsigned short'";
32294     case 'i': return "'int'";
32295     case 'I': return "'unsigned int'";
32296     case 'l': return "'long'";
32297     case 'L': return "'unsigned long'";
32298     case 'q': return "'long long'";
32299     case 'Q': return "'unsigned long long'";
32300     case 'f': return (is_complex ? "'complex float'" : "'float'");
32301     case 'd': return (is_complex ? "'complex double'" : "'double'");
32302     case 'g': return (is_complex ? "'complex long double'" : "'long double'");
32303     case 'T': return "a struct";
32304     case 'O': return "Python object";
32305     case 'P': return "a pointer";
32306     case 's': case 'p': return "a string";
32307     case 0: return "end";
32308     default: return "unparseable format string";
32309   }
32310 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)32311 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
32312   switch (ch) {
32313     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
32314     case 'h': case 'H': return 2;
32315     case 'i': case 'I': case 'l': case 'L': return 4;
32316     case 'q': case 'Q': return 8;
32317     case 'f': return (is_complex ? 8 : 4);
32318     case 'd': return (is_complex ? 16 : 8);
32319     case 'g': {
32320       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
32321       return 0;
32322     }
32323     case 'O': case 'P': return sizeof(void*);
32324     default:
32325       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
32326       return 0;
32327     }
32328 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)32329 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
32330   switch (ch) {
32331     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
32332     case 'h': case 'H': return sizeof(short);
32333     case 'i': case 'I': return sizeof(int);
32334     case 'l': case 'L': return sizeof(long);
32335     #ifdef HAVE_LONG_LONG
32336     case 'q': case 'Q': return sizeof(PY_LONG_LONG);
32337     #endif
32338     case 'f': return sizeof(float) * (is_complex ? 2 : 1);
32339     case 'd': return sizeof(double) * (is_complex ? 2 : 1);
32340     case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
32341     case 'O': case 'P': return sizeof(void*);
32342     default: {
32343       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
32344       return 0;
32345     }
32346   }
32347 }
32348 typedef struct { char c; short x; } __Pyx_st_short;
32349 typedef struct { char c; int x; } __Pyx_st_int;
32350 typedef struct { char c; long x; } __Pyx_st_long;
32351 typedef struct { char c; float x; } __Pyx_st_float;
32352 typedef struct { char c; double x; } __Pyx_st_double;
32353 typedef struct { char c; long double x; } __Pyx_st_longdouble;
32354 typedef struct { char c; void *x; } __Pyx_st_void_p;
32355 #ifdef HAVE_LONG_LONG
32356 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
32357 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)32358 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
32359   switch (ch) {
32360     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
32361     case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
32362     case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
32363     case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
32364 #ifdef HAVE_LONG_LONG
32365     case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
32366 #endif
32367     case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
32368     case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
32369     case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
32370     case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
32371     default:
32372       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
32373       return 0;
32374     }
32375 }
32376 /* These are for computing the padding at the end of the struct to align
32377    on the first member of the struct. This will probably the same as above,
32378    but we don't have any guarantees.
32379  */
32380 typedef struct { short x; char c; } __Pyx_pad_short;
32381 typedef struct { int x; char c; } __Pyx_pad_int;
32382 typedef struct { long x; char c; } __Pyx_pad_long;
32383 typedef struct { float x; char c; } __Pyx_pad_float;
32384 typedef struct { double x; char c; } __Pyx_pad_double;
32385 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
32386 typedef struct { void *x; char c; } __Pyx_pad_void_p;
32387 #ifdef HAVE_LONG_LONG
32388 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
32389 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)32390 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
32391   switch (ch) {
32392     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
32393     case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
32394     case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
32395     case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
32396 #ifdef HAVE_LONG_LONG
32397     case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
32398 #endif
32399     case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
32400     case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
32401     case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
32402     case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
32403     default:
32404       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
32405       return 0;
32406     }
32407 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)32408 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
32409   switch (ch) {
32410     case 'c':
32411         return 'H';
32412     case 'b': case 'h': case 'i':
32413     case 'l': case 'q': case 's': case 'p':
32414         return 'I';
32415     case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
32416         return 'U';
32417     case 'f': case 'd': case 'g':
32418         return (is_complex ? 'C' : 'R');
32419     case 'O':
32420         return 'O';
32421     case 'P':
32422         return 'P';
32423     default: {
32424       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
32425       return 0;
32426     }
32427   }
32428 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)32429 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
32430   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
32431     const char* expected;
32432     const char* quote;
32433     if (ctx->head == NULL) {
32434       expected = "end";
32435       quote = "";
32436     } else {
32437       expected = ctx->head->field->type->name;
32438       quote = "'";
32439     }
32440     PyErr_Format(PyExc_ValueError,
32441                  "Buffer dtype mismatch, expected %s%s%s but got %s",
32442                  quote, expected, quote,
32443                  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
32444   } else {
32445     __Pyx_StructField* field = ctx->head->field;
32446     __Pyx_StructField* parent = (ctx->head - 1)->field;
32447     PyErr_Format(PyExc_ValueError,
32448                  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
32449                  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
32450                  parent->type->name, field->name);
32451   }
32452 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)32453 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
32454   char group;
32455   size_t size, offset, arraysize = 1;
32456   if (ctx->enc_type == 0) return 0;
32457   if (ctx->head->field->type->arraysize[0]) {
32458     int i, ndim = 0;
32459     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
32460         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
32461         ndim = 1;
32462         if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
32463             PyErr_Format(PyExc_ValueError,
32464                          "Expected a dimension of size %zu, got %zu",
32465                          ctx->head->field->type->arraysize[0], ctx->enc_count);
32466             return -1;
32467         }
32468     }
32469     if (!ctx->is_valid_array) {
32470       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
32471                    ctx->head->field->type->ndim, ndim);
32472       return -1;
32473     }
32474     for (i = 0; i < ctx->head->field->type->ndim; i++) {
32475       arraysize *= ctx->head->field->type->arraysize[i];
32476     }
32477     ctx->is_valid_array = 0;
32478     ctx->enc_count = 1;
32479   }
32480   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
32481   do {
32482     __Pyx_StructField* field = ctx->head->field;
32483     __Pyx_TypeInfo* type = field->type;
32484     if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
32485       size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
32486     } else {
32487       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
32488     }
32489     if (ctx->enc_packmode == '@') {
32490       size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
32491       size_t align_mod_offset;
32492       if (align_at == 0) return -1;
32493       align_mod_offset = ctx->fmt_offset % align_at;
32494       if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
32495       if (ctx->struct_alignment == 0)
32496           ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
32497                                                                  ctx->is_complex);
32498     }
32499     if (type->size != size || type->typegroup != group) {
32500       if (type->typegroup == 'C' && type->fields != NULL) {
32501         size_t parent_offset = ctx->head->parent_offset + field->offset;
32502         ++ctx->head;
32503         ctx->head->field = type->fields;
32504         ctx->head->parent_offset = parent_offset;
32505         continue;
32506       }
32507       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
32508       } else {
32509           __Pyx_BufFmt_RaiseExpected(ctx);
32510           return -1;
32511       }
32512     }
32513     offset = ctx->head->parent_offset + field->offset;
32514     if (ctx->fmt_offset != offset) {
32515       PyErr_Format(PyExc_ValueError,
32516                    "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
32517                    (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
32518       return -1;
32519     }
32520     ctx->fmt_offset += size;
32521     if (arraysize)
32522       ctx->fmt_offset += (arraysize - 1) * size;
32523     --ctx->enc_count;
32524     while (1) {
32525       if (field == &ctx->root) {
32526         ctx->head = NULL;
32527         if (ctx->enc_count != 0) {
32528           __Pyx_BufFmt_RaiseExpected(ctx);
32529           return -1;
32530         }
32531         break;
32532       }
32533       ctx->head->field = ++field;
32534       if (field->type == NULL) {
32535         --ctx->head;
32536         field = ctx->head->field;
32537         continue;
32538       } else if (field->type->typegroup == 'S') {
32539         size_t parent_offset = ctx->head->parent_offset + field->offset;
32540         if (field->type->fields->type == NULL) continue;
32541         field = field->type->fields;
32542         ++ctx->head;
32543         ctx->head->field = field;
32544         ctx->head->parent_offset = parent_offset;
32545         break;
32546       } else {
32547         break;
32548       }
32549     }
32550   } while (ctx->enc_count);
32551   ctx->enc_type = 0;
32552   ctx->is_complex = 0;
32553   return 0;
32554 }
32555 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)32556 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
32557 {
32558     const char *ts = *tsp;
32559     int i = 0, number, ndim;
32560     ++ts;
32561     if (ctx->new_count != 1) {
32562         PyErr_SetString(PyExc_ValueError,
32563                         "Cannot handle repeated arrays in format string");
32564         return NULL;
32565     }
32566     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
32567     ndim = ctx->head->field->type->ndim;
32568     while (*ts && *ts != ')') {
32569         switch (*ts) {
32570             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
32571             default:  break;
32572         }
32573         number = __Pyx_BufFmt_ExpectNumber(&ts);
32574         if (number == -1) return NULL;
32575         if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
32576             return PyErr_Format(PyExc_ValueError,
32577                         "Expected a dimension of size %zu, got %d",
32578                         ctx->head->field->type->arraysize[i], number);
32579         if (*ts != ',' && *ts != ')')
32580             return PyErr_Format(PyExc_ValueError,
32581                                 "Expected a comma in format string, got '%c'", *ts);
32582         if (*ts == ',') ts++;
32583         i++;
32584     }
32585     if (i != ndim)
32586         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
32587                             ctx->head->field->type->ndim, i);
32588     if (!*ts) {
32589         PyErr_SetString(PyExc_ValueError,
32590                         "Unexpected end of format string, expected ')'");
32591         return NULL;
32592     }
32593     ctx->is_valid_array = 1;
32594     ctx->new_count = 1;
32595     *tsp = ++ts;
32596     return Py_None;
32597 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)32598 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
32599   int got_Z = 0;
32600   while (1) {
32601     switch(*ts) {
32602       case 0:
32603         if (ctx->enc_type != 0 && ctx->head == NULL) {
32604           __Pyx_BufFmt_RaiseExpected(ctx);
32605           return NULL;
32606         }
32607         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
32608         if (ctx->head != NULL) {
32609           __Pyx_BufFmt_RaiseExpected(ctx);
32610           return NULL;
32611         }
32612         return ts;
32613       case ' ':
32614       case '\r':
32615       case '\n':
32616         ++ts;
32617         break;
32618       case '<':
32619         if (!__Pyx_Is_Little_Endian()) {
32620           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
32621           return NULL;
32622         }
32623         ctx->new_packmode = '=';
32624         ++ts;
32625         break;
32626       case '>':
32627       case '!':
32628         if (__Pyx_Is_Little_Endian()) {
32629           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
32630           return NULL;
32631         }
32632         ctx->new_packmode = '=';
32633         ++ts;
32634         break;
32635       case '=':
32636       case '@':
32637       case '^':
32638         ctx->new_packmode = *ts++;
32639         break;
32640       case 'T':
32641         {
32642           const char* ts_after_sub;
32643           size_t i, struct_count = ctx->new_count;
32644           size_t struct_alignment = ctx->struct_alignment;
32645           ctx->new_count = 1;
32646           ++ts;
32647           if (*ts != '{') {
32648             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
32649             return NULL;
32650           }
32651           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
32652           ctx->enc_type = 0;
32653           ctx->enc_count = 0;
32654           ctx->struct_alignment = 0;
32655           ++ts;
32656           ts_after_sub = ts;
32657           for (i = 0; i != struct_count; ++i) {
32658             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
32659             if (!ts_after_sub) return NULL;
32660           }
32661           ts = ts_after_sub;
32662           if (struct_alignment) ctx->struct_alignment = struct_alignment;
32663         }
32664         break;
32665       case '}':
32666         {
32667           size_t alignment = ctx->struct_alignment;
32668           ++ts;
32669           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
32670           ctx->enc_type = 0;
32671           if (alignment && ctx->fmt_offset % alignment) {
32672             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
32673           }
32674         }
32675         return ts;
32676       case 'x':
32677         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
32678         ctx->fmt_offset += ctx->new_count;
32679         ctx->new_count = 1;
32680         ctx->enc_count = 0;
32681         ctx->enc_type = 0;
32682         ctx->enc_packmode = ctx->new_packmode;
32683         ++ts;
32684         break;
32685       case 'Z':
32686         got_Z = 1;
32687         ++ts;
32688         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
32689           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
32690           return NULL;
32691         }
32692         CYTHON_FALLTHROUGH;
32693       case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
32694       case 'l': case 'L': case 'q': case 'Q':
32695       case 'f': case 'd': case 'g':
32696       case 'O': case 'p':
32697         if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
32698             (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
32699           ctx->enc_count += ctx->new_count;
32700           ctx->new_count = 1;
32701           got_Z = 0;
32702           ++ts;
32703           break;
32704         }
32705         CYTHON_FALLTHROUGH;
32706       case 's':
32707         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
32708         ctx->enc_count = ctx->new_count;
32709         ctx->enc_packmode = ctx->new_packmode;
32710         ctx->enc_type = *ts;
32711         ctx->is_complex = got_Z;
32712         ++ts;
32713         ctx->new_count = 1;
32714         got_Z = 0;
32715         break;
32716       case ':':
32717         ++ts;
32718         while(*ts != ':') ++ts;
32719         ++ts;
32720         break;
32721       case '(':
32722         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
32723         break;
32724       default:
32725         {
32726           int number = __Pyx_BufFmt_ExpectNumber(&ts);
32727           if (number == -1) return NULL;
32728           ctx->new_count = (size_t)number;
32729         }
32730     }
32731   }
32732 }
32733 
32734 /* TypeInfoCompare */
32735   static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo * a,__Pyx_TypeInfo * b)32736 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
32737 {
32738     int i;
32739     if (!a || !b)
32740         return 0;
32741     if (a == b)
32742         return 1;
32743     if (a->size != b->size || a->typegroup != b->typegroup ||
32744             a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
32745         if (a->typegroup == 'H' || b->typegroup == 'H') {
32746             return a->size == b->size;
32747         } else {
32748             return 0;
32749         }
32750     }
32751     if (a->ndim) {
32752         for (i = 0; i < a->ndim; i++)
32753             if (a->arraysize[i] != b->arraysize[i])
32754                 return 0;
32755     }
32756     if (a->typegroup == 'S') {
32757         if (a->flags != b->flags)
32758             return 0;
32759         if (a->fields || b->fields) {
32760             if (!(a->fields && b->fields))
32761                 return 0;
32762             for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
32763                 __Pyx_StructField *field_a = a->fields + i;
32764                 __Pyx_StructField *field_b = b->fields + i;
32765                 if (field_a->offset != field_b->offset ||
32766                     !__pyx_typeinfo_cmp(field_a->type, field_b->type))
32767                     return 0;
32768             }
32769             return !a->fields[i].type && !b->fields[i].type;
32770         }
32771     }
32772     return 1;
32773 }
32774 
32775 /* MemviewSliceValidateAndInit */
32776   static int
__pyx_check_strides(Py_buffer * buf,int dim,int ndim,int spec)32777 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
32778 {
32779     if (buf->shape[dim] <= 1)
32780         return 1;
32781     if (buf->strides) {
32782         if (spec & __Pyx_MEMVIEW_CONTIG) {
32783             if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
32784                 if (unlikely(buf->strides[dim] != sizeof(void *))) {
32785                     PyErr_Format(PyExc_ValueError,
32786                                  "Buffer is not indirectly contiguous "
32787                                  "in dimension %d.", dim);
32788                     goto fail;
32789                 }
32790             } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
32791                 PyErr_SetString(PyExc_ValueError,
32792                                 "Buffer and memoryview are not contiguous "
32793                                 "in the same dimension.");
32794                 goto fail;
32795             }
32796         }
32797         if (spec & __Pyx_MEMVIEW_FOLLOW) {
32798             Py_ssize_t stride = buf->strides[dim];
32799             if (stride < 0)
32800                 stride = -stride;
32801             if (unlikely(stride < buf->itemsize)) {
32802                 PyErr_SetString(PyExc_ValueError,
32803                                 "Buffer and memoryview are not contiguous "
32804                                 "in the same dimension.");
32805                 goto fail;
32806             }
32807         }
32808     } else {
32809         if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
32810             PyErr_Format(PyExc_ValueError,
32811                          "C-contiguous buffer is not contiguous in "
32812                          "dimension %d", dim);
32813             goto fail;
32814         } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
32815             PyErr_Format(PyExc_ValueError,
32816                          "C-contiguous buffer is not indirect in "
32817                          "dimension %d", dim);
32818             goto fail;
32819         } else if (unlikely(buf->suboffsets)) {
32820             PyErr_SetString(PyExc_ValueError,
32821                             "Buffer exposes suboffsets but no strides");
32822             goto fail;
32823         }
32824     }
32825     return 1;
32826 fail:
32827     return 0;
32828 }
32829 static int
__pyx_check_suboffsets(Py_buffer * buf,int dim,CYTHON_UNUSED int ndim,int spec)32830 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
32831 {
32832     if (spec & __Pyx_MEMVIEW_DIRECT) {
32833         if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
32834             PyErr_Format(PyExc_ValueError,
32835                          "Buffer not compatible with direct access "
32836                          "in dimension %d.", dim);
32837             goto fail;
32838         }
32839     }
32840     if (spec & __Pyx_MEMVIEW_PTR) {
32841         if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
32842             PyErr_Format(PyExc_ValueError,
32843                          "Buffer is not indirectly accessible "
32844                          "in dimension %d.", dim);
32845             goto fail;
32846         }
32847     }
32848     return 1;
32849 fail:
32850     return 0;
32851 }
32852 static int
__pyx_verify_contig(Py_buffer * buf,int ndim,int c_or_f_flag)32853 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
32854 {
32855     int i;
32856     if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
32857         Py_ssize_t stride = 1;
32858         for (i = 0; i < ndim; i++) {
32859             if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
32860                 PyErr_SetString(PyExc_ValueError,
32861                     "Buffer not fortran contiguous.");
32862                 goto fail;
32863             }
32864             stride = stride * buf->shape[i];
32865         }
32866     } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
32867         Py_ssize_t stride = 1;
32868         for (i = ndim - 1; i >- 1; i--) {
32869             if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
32870                 PyErr_SetString(PyExc_ValueError,
32871                     "Buffer not C contiguous.");
32872                 goto fail;
32873             }
32874             stride = stride * buf->shape[i];
32875         }
32876     }
32877     return 1;
32878 fail:
32879     return 0;
32880 }
__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)32881 static int __Pyx_ValidateAndInit_memviewslice(
32882                 int *axes_specs,
32883                 int c_or_f_flag,
32884                 int buf_flags,
32885                 int ndim,
32886                 __Pyx_TypeInfo *dtype,
32887                 __Pyx_BufFmt_StackElem stack[],
32888                 __Pyx_memviewslice *memviewslice,
32889                 PyObject *original_obj)
32890 {
32891     struct __pyx_memoryview_obj *memview, *new_memview;
32892     __Pyx_RefNannyDeclarations
32893     Py_buffer *buf;
32894     int i, spec = 0, retval = -1;
32895     __Pyx_BufFmt_Context ctx;
32896     int from_memoryview = __pyx_memoryview_check(original_obj);
32897     __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
32898     if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
32899                                                             original_obj)->typeinfo)) {
32900         memview = (struct __pyx_memoryview_obj *) original_obj;
32901         new_memview = NULL;
32902     } else {
32903         memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
32904                                             original_obj, buf_flags, 0, dtype);
32905         new_memview = memview;
32906         if (unlikely(!memview))
32907             goto fail;
32908     }
32909     buf = &memview->view;
32910     if (unlikely(buf->ndim != ndim)) {
32911         PyErr_Format(PyExc_ValueError,
32912                 "Buffer has wrong number of dimensions (expected %d, got %d)",
32913                 ndim, buf->ndim);
32914         goto fail;
32915     }
32916     if (new_memview) {
32917         __Pyx_BufFmt_Init(&ctx, stack, dtype);
32918         if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
32919     }
32920     if (unlikely((unsigned) buf->itemsize != dtype->size)) {
32921         PyErr_Format(PyExc_ValueError,
32922                      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
32923                      "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
32924                      buf->itemsize,
32925                      (buf->itemsize > 1) ? "s" : "",
32926                      dtype->name,
32927                      dtype->size,
32928                      (dtype->size > 1) ? "s" : "");
32929         goto fail;
32930     }
32931     if (buf->len > 0) {
32932         for (i = 0; i < ndim; i++) {
32933             spec = axes_specs[i];
32934             if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
32935                 goto fail;
32936             if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
32937                 goto fail;
32938         }
32939         if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
32940             goto fail;
32941     }
32942     if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
32943                                          new_memview != NULL) == -1)) {
32944         goto fail;
32945     }
32946     retval = 0;
32947     goto no_fail;
32948 fail:
32949     Py_XDECREF(new_memview);
32950     retval = -1;
32951 no_fail:
32952     __Pyx_RefNannyFinishContext();
32953     return retval;
32954 }
32955 
32956 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(PyObject * obj,int writable_flag)32957   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float32_t(PyObject *obj, int writable_flag) {
32958     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
32959     __Pyx_BufFmt_StackElem stack[1];
32960     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
32961     int retcode;
32962     if (obj == Py_None) {
32963         result.memview = (struct __pyx_memoryview_obj *) Py_None;
32964         return result;
32965     }
32966     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
32967                                                  PyBUF_RECORDS_RO | writable_flag, 1,
32968                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, stack,
32969                                                  &result, obj);
32970     if (unlikely(retcode == -1))
32971         goto __pyx_fail;
32972     return result;
32973 __pyx_fail:
32974     result.memview = NULL;
32975     result.data = NULL;
32976     return result;
32977 }
32978 
32979 /* CIntFromPyVerify */
32980   #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
32981     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
32982 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
32983     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
32984 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
32985     {\
32986         func_type value = func_value;\
32987         if (sizeof(target_type) < sizeof(func_type)) {\
32988             if (unlikely(value != (func_type) (target_type) value)) {\
32989                 func_type zero = 0;\
32990                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
32991                     return (target_type) -1;\
32992                 if (is_unsigned && unlikely(value < zero))\
32993                     goto raise_neg_overflow;\
32994                 else\
32995                     goto raise_overflow;\
32996             }\
32997         }\
32998         return (target_type) value;\
32999     }
33000 
33001 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float32_t(PyObject * obj,int writable_flag)33002   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float32_t(PyObject *obj, int writable_flag) {
33003     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
33004     __Pyx_BufFmt_StackElem stack[1];
33005     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
33006     int retcode;
33007     if (obj == Py_None) {
33008         result.memview = (struct __pyx_memoryview_obj *) Py_None;
33009         return result;
33010     }
33011     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
33012                                                  PyBUF_RECORDS_RO | writable_flag, 2,
33013                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, stack,
33014                                                  &result, obj);
33015     if (unlikely(retcode == -1))
33016         goto __pyx_fail;
33017     return result;
33018 __pyx_fail:
33019     result.memview = NULL;
33020     result.data = NULL;
33021     return result;
33022 }
33023 
33024 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject * obj,int writable_flag)33025   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *obj, int writable_flag) {
33026     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
33027     __Pyx_BufFmt_StackElem stack[1];
33028     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
33029     int retcode;
33030     if (obj == Py_None) {
33031         result.memview = (struct __pyx_memoryview_obj *) Py_None;
33032         return result;
33033     }
33034     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
33035                                                  PyBUF_RECORDS_RO | writable_flag, 1,
33036                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, stack,
33037                                                  &result, obj);
33038     if (unlikely(retcode == -1))
33039         goto __pyx_fail;
33040     return result;
33041 __pyx_fail:
33042     result.memview = NULL;
33043     result.data = NULL;
33044     return result;
33045 }
33046 
33047 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(PyObject * obj,int writable_flag)33048   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(PyObject *obj, int writable_flag) {
33049     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
33050     __Pyx_BufFmt_StackElem stack[1];
33051     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
33052     int retcode;
33053     if (obj == Py_None) {
33054         result.memview = (struct __pyx_memoryview_obj *) Py_None;
33055         return result;
33056     }
33057     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
33058                                                  PyBUF_RECORDS_RO | writable_flag, 2,
33059                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, stack,
33060                                                  &result, obj);
33061     if (unlikely(retcode == -1))
33062         goto __pyx_fail;
33063     return result;
33064 __pyx_fail:
33065     result.memview = NULL;
33066     result.data = NULL;
33067     return result;
33068 }
33069 
33070 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(PyObject * obj,int writable_flag)33071   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_float_complex(PyObject *obj, int writable_flag) {
33072     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
33073     __Pyx_BufFmt_StackElem stack[1];
33074     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
33075     int retcode;
33076     if (obj == Py_None) {
33077         result.memview = (struct __pyx_memoryview_obj *) Py_None;
33078         return result;
33079     }
33080     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
33081                                                  PyBUF_RECORDS_RO | writable_flag, 1,
33082                                                  &__Pyx_TypeInfo___pyx_t_float_complex, stack,
33083                                                  &result, obj);
33084     if (unlikely(retcode == -1))
33085         goto __pyx_fail;
33086     return result;
33087 __pyx_fail:
33088     result.memview = NULL;
33089     result.data = NULL;
33090     return result;
33091 }
33092 
33093 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_float_complex(PyObject * obj,int writable_flag)33094   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_float_complex(PyObject *obj, int writable_flag) {
33095     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
33096     __Pyx_BufFmt_StackElem stack[1];
33097     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
33098     int retcode;
33099     if (obj == Py_None) {
33100         result.memview = (struct __pyx_memoryview_obj *) Py_None;
33101         return result;
33102     }
33103     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
33104                                                  PyBUF_RECORDS_RO | writable_flag, 2,
33105                                                  &__Pyx_TypeInfo___pyx_t_float_complex, stack,
33106                                                  &result, obj);
33107     if (unlikely(retcode == -1))
33108         goto __pyx_fail;
33109     return result;
33110 __pyx_fail:
33111     result.memview = NULL;
33112     result.data = NULL;
33113     return result;
33114 }
33115 
33116 /* FromPy */
__Pyx_PyComplex_As___pyx_t_float_complex(PyObject * o)33117   static __pyx_t_float_complex __Pyx_PyComplex_As___pyx_t_float_complex(PyObject* o) {
33118     Py_complex cval;
33119 #if !CYTHON_COMPILING_IN_PYPY
33120     if (PyComplex_CheckExact(o))
33121         cval = ((PyComplexObject *)o)->cval;
33122     else
33123 #endif
33124         cval = PyComplex_AsCComplex(o);
33125     return __pyx_t_float_complex_from_parts(
33126                (float)cval.real,
33127                (float)cval.imag);
33128 }
33129 
33130 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(PyObject * obj,int writable_flag)33131   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds___pyx_t_double_complex(PyObject *obj, int writable_flag) {
33132     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
33133     __Pyx_BufFmt_StackElem stack[1];
33134     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
33135     int retcode;
33136     if (obj == Py_None) {
33137         result.memview = (struct __pyx_memoryview_obj *) Py_None;
33138         return result;
33139     }
33140     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
33141                                                  PyBUF_RECORDS_RO | writable_flag, 1,
33142                                                  &__Pyx_TypeInfo___pyx_t_double_complex, stack,
33143                                                  &result, obj);
33144     if (unlikely(retcode == -1))
33145         goto __pyx_fail;
33146     return result;
33147 __pyx_fail:
33148     result.memview = NULL;
33149     result.data = NULL;
33150     return result;
33151 }
33152 
33153 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(PyObject * obj,int writable_flag)33154   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(PyObject *obj, int writable_flag) {
33155     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
33156     __Pyx_BufFmt_StackElem stack[1];
33157     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
33158     int retcode;
33159     if (obj == Py_None) {
33160         result.memview = (struct __pyx_memoryview_obj *) Py_None;
33161         return result;
33162     }
33163     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
33164                                                  PyBUF_RECORDS_RO | writable_flag, 2,
33165                                                  &__Pyx_TypeInfo___pyx_t_double_complex, stack,
33166                                                  &result, obj);
33167     if (unlikely(retcode == -1))
33168         goto __pyx_fail;
33169     return result;
33170 __pyx_fail:
33171     result.memview = NULL;
33172     result.data = NULL;
33173     return result;
33174 }
33175 
33176 /* FromPy */
__Pyx_PyComplex_As___pyx_t_double_complex(PyObject * o)33177   static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject* o) {
33178     Py_complex cval;
33179 #if !CYTHON_COMPILING_IN_PYPY
33180     if (PyComplex_CheckExact(o))
33181         cval = ((PyComplexObject *)o)->cval;
33182     else
33183 #endif
33184         cval = PyComplex_AsCComplex(o);
33185     return __pyx_t_double_complex_from_parts(
33186                (double)cval.real,
33187                (double)cval.imag);
33188 }
33189 
33190 /* MemviewDtypeToObject */
__pyx_memview_get_nn___pyx_t_5numpy_float32_t(const char * itemp)33191   static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_float32_t(const char *itemp) {
33192     return (PyObject *) PyFloat_FromDouble(*(__pyx_t_5numpy_float32_t *) itemp);
33193 }
__pyx_memview_set_nn___pyx_t_5numpy_float32_t(const char * itemp,PyObject * obj)33194 static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_float32_t(const char *itemp, PyObject *obj) {
33195     __pyx_t_5numpy_float32_t value = __pyx_PyFloat_AsFloat(obj);
33196     if ((value == ((npy_float32)-1)) && PyErr_Occurred())
33197         return 0;
33198     *(__pyx_t_5numpy_float32_t *) itemp = value;
33199     return 1;
33200 }
33201 
33202 /* MemviewDtypeToObject */
__pyx_memview_get_nn___pyx_t_5numpy_float64_t(const char * itemp)33203   static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_float64_t(const char *itemp) {
33204     return (PyObject *) PyFloat_FromDouble(*(__pyx_t_5numpy_float64_t *) itemp);
33205 }
__pyx_memview_set_nn___pyx_t_5numpy_float64_t(const char * itemp,PyObject * obj)33206 static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_float64_t(const char *itemp, PyObject *obj) {
33207     __pyx_t_5numpy_float64_t value = __pyx_PyFloat_AsDouble(obj);
33208     if ((value == ((npy_float64)-1)) && PyErr_Occurred())
33209         return 0;
33210     *(__pyx_t_5numpy_float64_t *) itemp = value;
33211     return 1;
33212 }
33213 
33214 /* MemviewDtypeToObject */
__pyx_memview_get___pyx_t_float_complex(const char * itemp)33215   static CYTHON_INLINE PyObject *__pyx_memview_get___pyx_t_float_complex(const char *itemp) {
33216     return (PyObject *) __pyx_PyComplex_FromComplex(*(__pyx_t_float_complex *) itemp);
33217 }
__pyx_memview_set___pyx_t_float_complex(const char * itemp,PyObject * obj)33218 static CYTHON_INLINE int __pyx_memview_set___pyx_t_float_complex(const char *itemp, PyObject *obj) {
33219     __pyx_t_float_complex value = __Pyx_PyComplex_As___pyx_t_float_complex(obj);
33220     if (PyErr_Occurred())
33221         return 0;
33222     *(__pyx_t_float_complex *) itemp = value;
33223     return 1;
33224 }
33225 
33226 /* Declarations */
33227   #if CYTHON_CCOMPLEX
33228   #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)33229     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
33230       return ::std::complex< double >(x, y);
33231     }
33232   #else
__pyx_t_double_complex_from_parts(double x,double y)33233     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
33234       return x + y*(__pyx_t_double_complex)_Complex_I;
33235     }
33236   #endif
33237 #else
__pyx_t_double_complex_from_parts(double x,double y)33238     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
33239       __pyx_t_double_complex z;
33240       z.real = x;
33241       z.imag = y;
33242       return z;
33243     }
33244 #endif
33245 
33246 /* Arithmetic */
33247   #if CYTHON_CCOMPLEX
33248 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)33249     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
33250        return (a.real == b.real) && (a.imag == b.imag);
33251     }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)33252     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
33253         __pyx_t_double_complex z;
33254         z.real = a.real + b.real;
33255         z.imag = a.imag + b.imag;
33256         return z;
33257     }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)33258     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
33259         __pyx_t_double_complex z;
33260         z.real = a.real - b.real;
33261         z.imag = a.imag - b.imag;
33262         return z;
33263     }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)33264     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
33265         __pyx_t_double_complex z;
33266         z.real = a.real * b.real - a.imag * b.imag;
33267         z.imag = a.real * b.imag + a.imag * b.real;
33268         return z;
33269     }
33270     #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)33271     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
33272         if (b.imag == 0) {
33273             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
33274         } else if (fabs(b.real) >= fabs(b.imag)) {
33275             if (b.real == 0 && b.imag == 0) {
33276                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
33277             } else {
33278                 double r = b.imag / b.real;
33279                 double s = (double)(1.0) / (b.real + b.imag * r);
33280                 return __pyx_t_double_complex_from_parts(
33281                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
33282             }
33283         } else {
33284             double r = b.real / b.imag;
33285             double s = (double)(1.0) / (b.imag + b.real * r);
33286             return __pyx_t_double_complex_from_parts(
33287                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
33288         }
33289     }
33290     #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)33291     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
33292         if (b.imag == 0) {
33293             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
33294         } else {
33295             double denom = b.real * b.real + b.imag * b.imag;
33296             return __pyx_t_double_complex_from_parts(
33297                 (a.real * b.real + a.imag * b.imag) / denom,
33298                 (a.imag * b.real - a.real * b.imag) / denom);
33299         }
33300     }
33301     #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)33302     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
33303         __pyx_t_double_complex z;
33304         z.real = -a.real;
33305         z.imag = -a.imag;
33306         return z;
33307     }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)33308     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
33309        return (a.real == 0) && (a.imag == 0);
33310     }
__Pyx_c_conj_double(__pyx_t_double_complex a)33311     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
33312         __pyx_t_double_complex z;
33313         z.real =  a.real;
33314         z.imag = -a.imag;
33315         return z;
33316     }
33317     #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)33318         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
33319           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
33320             return sqrt(z.real*z.real + z.imag*z.imag);
33321           #else
33322             return hypot(z.real, z.imag);
33323           #endif
33324         }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)33325         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
33326             __pyx_t_double_complex z;
33327             double r, lnr, theta, z_r, z_theta;
33328             if (b.imag == 0 && b.real == (int)b.real) {
33329                 if (b.real < 0) {
33330                     double denom = a.real * a.real + a.imag * a.imag;
33331                     a.real = a.real / denom;
33332                     a.imag = -a.imag / denom;
33333                     b.real = -b.real;
33334                 }
33335                 switch ((int)b.real) {
33336                     case 0:
33337                         z.real = 1;
33338                         z.imag = 0;
33339                         return z;
33340                     case 1:
33341                         return a;
33342                     case 2:
33343                         return __Pyx_c_prod_double(a, a);
33344                     case 3:
33345                         z = __Pyx_c_prod_double(a, a);
33346                         return __Pyx_c_prod_double(z, a);
33347                     case 4:
33348                         z = __Pyx_c_prod_double(a, a);
33349                         return __Pyx_c_prod_double(z, z);
33350                 }
33351             }
33352             if (a.imag == 0) {
33353                 if (a.real == 0) {
33354                     return a;
33355                 } else if (b.imag == 0) {
33356                     z.real = pow(a.real, b.real);
33357                     z.imag = 0;
33358                     return z;
33359                 } else if (a.real > 0) {
33360                     r = a.real;
33361                     theta = 0;
33362                 } else {
33363                     r = -a.real;
33364                     theta = atan2(0.0, -1.0);
33365                 }
33366             } else {
33367                 r = __Pyx_c_abs_double(a);
33368                 theta = atan2(a.imag, a.real);
33369             }
33370             lnr = log(r);
33371             z_r = exp(lnr * b.real - theta * b.imag);
33372             z_theta = theta * b.real + lnr * b.imag;
33373             z.real = z_r * cos(z_theta);
33374             z.imag = z_r * sin(z_theta);
33375             return z;
33376         }
33377     #endif
33378 #endif
33379 
33380 /* Declarations */
33381   #if CYTHON_CCOMPLEX
33382   #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)33383     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
33384       return ::std::complex< float >(x, y);
33385     }
33386   #else
__pyx_t_float_complex_from_parts(float x,float y)33387     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
33388       return x + y*(__pyx_t_float_complex)_Complex_I;
33389     }
33390   #endif
33391 #else
__pyx_t_float_complex_from_parts(float x,float y)33392     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
33393       __pyx_t_float_complex z;
33394       z.real = x;
33395       z.imag = y;
33396       return z;
33397     }
33398 #endif
33399 
33400 /* Arithmetic */
33401   #if CYTHON_CCOMPLEX
33402 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)33403     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
33404        return (a.real == b.real) && (a.imag == b.imag);
33405     }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)33406     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
33407         __pyx_t_float_complex z;
33408         z.real = a.real + b.real;
33409         z.imag = a.imag + b.imag;
33410         return z;
33411     }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)33412     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
33413         __pyx_t_float_complex z;
33414         z.real = a.real - b.real;
33415         z.imag = a.imag - b.imag;
33416         return z;
33417     }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)33418     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
33419         __pyx_t_float_complex z;
33420         z.real = a.real * b.real - a.imag * b.imag;
33421         z.imag = a.real * b.imag + a.imag * b.real;
33422         return z;
33423     }
33424     #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)33425     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
33426         if (b.imag == 0) {
33427             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
33428         } else if (fabsf(b.real) >= fabsf(b.imag)) {
33429             if (b.real == 0 && b.imag == 0) {
33430                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
33431             } else {
33432                 float r = b.imag / b.real;
33433                 float s = (float)(1.0) / (b.real + b.imag * r);
33434                 return __pyx_t_float_complex_from_parts(
33435                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
33436             }
33437         } else {
33438             float r = b.real / b.imag;
33439             float s = (float)(1.0) / (b.imag + b.real * r);
33440             return __pyx_t_float_complex_from_parts(
33441                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
33442         }
33443     }
33444     #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)33445     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
33446         if (b.imag == 0) {
33447             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
33448         } else {
33449             float denom = b.real * b.real + b.imag * b.imag;
33450             return __pyx_t_float_complex_from_parts(
33451                 (a.real * b.real + a.imag * b.imag) / denom,
33452                 (a.imag * b.real - a.real * b.imag) / denom);
33453         }
33454     }
33455     #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)33456     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
33457         __pyx_t_float_complex z;
33458         z.real = -a.real;
33459         z.imag = -a.imag;
33460         return z;
33461     }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)33462     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
33463        return (a.real == 0) && (a.imag == 0);
33464     }
__Pyx_c_conj_float(__pyx_t_float_complex a)33465     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
33466         __pyx_t_float_complex z;
33467         z.real =  a.real;
33468         z.imag = -a.imag;
33469         return z;
33470     }
33471     #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)33472         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
33473           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
33474             return sqrtf(z.real*z.real + z.imag*z.imag);
33475           #else
33476             return hypotf(z.real, z.imag);
33477           #endif
33478         }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)33479         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
33480             __pyx_t_float_complex z;
33481             float r, lnr, theta, z_r, z_theta;
33482             if (b.imag == 0 && b.real == (int)b.real) {
33483                 if (b.real < 0) {
33484                     float denom = a.real * a.real + a.imag * a.imag;
33485                     a.real = a.real / denom;
33486                     a.imag = -a.imag / denom;
33487                     b.real = -b.real;
33488                 }
33489                 switch ((int)b.real) {
33490                     case 0:
33491                         z.real = 1;
33492                         z.imag = 0;
33493                         return z;
33494                     case 1:
33495                         return a;
33496                     case 2:
33497                         return __Pyx_c_prod_float(a, a);
33498                     case 3:
33499                         z = __Pyx_c_prod_float(a, a);
33500                         return __Pyx_c_prod_float(z, a);
33501                     case 4:
33502                         z = __Pyx_c_prod_float(a, a);
33503                         return __Pyx_c_prod_float(z, z);
33504                 }
33505             }
33506             if (a.imag == 0) {
33507                 if (a.real == 0) {
33508                     return a;
33509                 } else if (b.imag == 0) {
33510                     z.real = powf(a.real, b.real);
33511                     z.imag = 0;
33512                     return z;
33513                 } else if (a.real > 0) {
33514                     r = a.real;
33515                     theta = 0;
33516                 } else {
33517                     r = -a.real;
33518                     theta = atan2f(0.0, -1.0);
33519                 }
33520             } else {
33521                 r = __Pyx_c_abs_float(a);
33522                 theta = atan2f(a.imag, a.real);
33523             }
33524             lnr = logf(r);
33525             z_r = expf(lnr * b.real - theta * b.imag);
33526             z_theta = theta * b.real + lnr * b.imag;
33527             z.real = z_r * cosf(z_theta);
33528             z.imag = z_r * sinf(z_theta);
33529             return z;
33530         }
33531     #endif
33532 #endif
33533 
33534 /* MemviewDtypeToObject */
__pyx_memview_get___pyx_t_double_complex(const char * itemp)33535   static CYTHON_INLINE PyObject *__pyx_memview_get___pyx_t_double_complex(const char *itemp) {
33536     return (PyObject *) __pyx_PyComplex_FromComplex(*(__pyx_t_double_complex *) itemp);
33537 }
__pyx_memview_set___pyx_t_double_complex(const char * itemp,PyObject * obj)33538 static CYTHON_INLINE int __pyx_memview_set___pyx_t_double_complex(const char *itemp, PyObject *obj) {
33539     __pyx_t_double_complex value = __Pyx_PyComplex_As___pyx_t_double_complex(obj);
33540     if (PyErr_Occurred())
33541         return 0;
33542     *(__pyx_t_double_complex *) itemp = value;
33543     return 1;
33544 }
33545 
33546 /* MemviewSliceCopyTemplate */
33547   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)33548 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
33549                                  const char *mode, int ndim,
33550                                  size_t sizeof_dtype, int contig_flag,
33551                                  int dtype_is_object)
33552 {
33553     __Pyx_RefNannyDeclarations
33554     int i;
33555     __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
33556     struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
33557     Py_buffer *buf = &from_memview->view;
33558     PyObject *shape_tuple = NULL;
33559     PyObject *temp_int = NULL;
33560     struct __pyx_array_obj *array_obj = NULL;
33561     struct __pyx_memoryview_obj *memview_obj = NULL;
33562     __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
33563     for (i = 0; i < ndim; i++) {
33564         if (unlikely(from_mvs->suboffsets[i] >= 0)) {
33565             PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
33566                                            "indirect dimensions (axis %d)", i);
33567             goto fail;
33568         }
33569     }
33570     shape_tuple = PyTuple_New(ndim);
33571     if (unlikely(!shape_tuple)) {
33572         goto fail;
33573     }
33574     __Pyx_GOTREF(shape_tuple);
33575     for(i = 0; i < ndim; i++) {
33576         temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
33577         if(unlikely(!temp_int)) {
33578             goto fail;
33579         } else {
33580             PyTuple_SET_ITEM(shape_tuple, i, temp_int);
33581             temp_int = NULL;
33582         }
33583     }
33584     array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
33585     if (unlikely(!array_obj)) {
33586         goto fail;
33587     }
33588     __Pyx_GOTREF(array_obj);
33589     memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
33590                                     (PyObject *) array_obj, contig_flag,
33591                                     dtype_is_object,
33592                                     from_mvs->memview->typeinfo);
33593     if (unlikely(!memview_obj))
33594         goto fail;
33595     if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
33596         goto fail;
33597     if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
33598                                                 dtype_is_object) < 0))
33599         goto fail;
33600     goto no_fail;
33601 fail:
33602     __Pyx_XDECREF(new_mvs.memview);
33603     new_mvs.memview = NULL;
33604     new_mvs.data = NULL;
33605 no_fail:
33606     __Pyx_XDECREF(shape_tuple);
33607     __Pyx_XDECREF(temp_int);
33608     __Pyx_XDECREF(array_obj);
33609     __Pyx_RefNannyFinishContext();
33610     return new_mvs;
33611 }
33612 
33613 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)33614   static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
33615 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
33616 #pragma GCC diagnostic push
33617 #pragma GCC diagnostic ignored "-Wconversion"
33618 #endif
33619     const int neg_one = (int) -1, const_zero = (int) 0;
33620 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
33621 #pragma GCC diagnostic pop
33622 #endif
33623     const int is_unsigned = neg_one > const_zero;
33624 #if PY_MAJOR_VERSION < 3
33625     if (likely(PyInt_Check(x))) {
33626         if (sizeof(int) < sizeof(long)) {
33627             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
33628         } else {
33629             long val = PyInt_AS_LONG(x);
33630             if (is_unsigned && unlikely(val < 0)) {
33631                 goto raise_neg_overflow;
33632             }
33633             return (int) val;
33634         }
33635     } else
33636 #endif
33637     if (likely(PyLong_Check(x))) {
33638         if (is_unsigned) {
33639 #if CYTHON_USE_PYLONG_INTERNALS
33640             const digit* digits = ((PyLongObject*)x)->ob_digit;
33641             switch (Py_SIZE(x)) {
33642                 case  0: return (int) 0;
33643                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
33644                 case 2:
33645                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
33646                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
33647                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
33648                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
33649                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
33650                         }
33651                     }
33652                     break;
33653                 case 3:
33654                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
33655                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
33656                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
33657                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
33658                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
33659                         }
33660                     }
33661                     break;
33662                 case 4:
33663                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
33664                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
33665                             __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])))
33666                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
33667                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
33668                         }
33669                     }
33670                     break;
33671             }
33672 #endif
33673 #if CYTHON_COMPILING_IN_CPYTHON
33674             if (unlikely(Py_SIZE(x) < 0)) {
33675                 goto raise_neg_overflow;
33676             }
33677 #else
33678             {
33679                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
33680                 if (unlikely(result < 0))
33681                     return (int) -1;
33682                 if (unlikely(result == 1))
33683                     goto raise_neg_overflow;
33684             }
33685 #endif
33686             if (sizeof(int) <= sizeof(unsigned long)) {
33687                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
33688 #ifdef HAVE_LONG_LONG
33689             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
33690                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
33691 #endif
33692             }
33693         } else {
33694 #if CYTHON_USE_PYLONG_INTERNALS
33695             const digit* digits = ((PyLongObject*)x)->ob_digit;
33696             switch (Py_SIZE(x)) {
33697                 case  0: return (int) 0;
33698                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
33699                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
33700                 case -2:
33701                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
33702                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
33703                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
33704                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
33705                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
33706                         }
33707                     }
33708                     break;
33709                 case 2:
33710                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
33711                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
33712                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
33713                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
33714                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
33715                         }
33716                     }
33717                     break;
33718                 case -3:
33719                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
33720                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
33721                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
33722                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
33723                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
33724                         }
33725                     }
33726                     break;
33727                 case 3:
33728                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
33729                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
33730                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
33731                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
33732                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
33733                         }
33734                     }
33735                     break;
33736                 case -4:
33737                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
33738                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
33739                             __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])))
33740                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
33741                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
33742                         }
33743                     }
33744                     break;
33745                 case 4:
33746                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
33747                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
33748                             __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])))
33749                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
33750                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
33751                         }
33752                     }
33753                     break;
33754             }
33755 #endif
33756             if (sizeof(int) <= sizeof(long)) {
33757                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
33758 #ifdef HAVE_LONG_LONG
33759             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
33760                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
33761 #endif
33762             }
33763         }
33764         {
33765 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
33766             PyErr_SetString(PyExc_RuntimeError,
33767                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
33768 #else
33769             int val;
33770             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
33771  #if PY_MAJOR_VERSION < 3
33772             if (likely(v) && !PyLong_Check(v)) {
33773                 PyObject *tmp = v;
33774                 v = PyNumber_Long(tmp);
33775                 Py_DECREF(tmp);
33776             }
33777  #endif
33778             if (likely(v)) {
33779                 int one = 1; int is_little = (int)*(unsigned char *)&one;
33780                 unsigned char *bytes = (unsigned char *)&val;
33781                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
33782                                               bytes, sizeof(val),
33783                                               is_little, !is_unsigned);
33784                 Py_DECREF(v);
33785                 if (likely(!ret))
33786                     return val;
33787             }
33788 #endif
33789             return (int) -1;
33790         }
33791     } else {
33792         int val;
33793         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
33794         if (!tmp) return (int) -1;
33795         val = __Pyx_PyInt_As_int(tmp);
33796         Py_DECREF(tmp);
33797         return val;
33798     }
33799 raise_overflow:
33800     PyErr_SetString(PyExc_OverflowError,
33801         "value too large to convert to int");
33802     return (int) -1;
33803 raise_neg_overflow:
33804     PyErr_SetString(PyExc_OverflowError,
33805         "can't convert negative value to int");
33806     return (int) -1;
33807 }
33808 
33809 /* CIntToPy */
__Pyx_PyInt_From_int(int value)33810   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
33811 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
33812 #pragma GCC diagnostic push
33813 #pragma GCC diagnostic ignored "-Wconversion"
33814 #endif
33815     const int neg_one = (int) -1, const_zero = (int) 0;
33816 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
33817 #pragma GCC diagnostic pop
33818 #endif
33819     const int is_unsigned = neg_one > const_zero;
33820     if (is_unsigned) {
33821         if (sizeof(int) < sizeof(long)) {
33822             return PyInt_FromLong((long) value);
33823         } else if (sizeof(int) <= sizeof(unsigned long)) {
33824             return PyLong_FromUnsignedLong((unsigned long) value);
33825 #ifdef HAVE_LONG_LONG
33826         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
33827             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
33828 #endif
33829         }
33830     } else {
33831         if (sizeof(int) <= sizeof(long)) {
33832             return PyInt_FromLong((long) value);
33833 #ifdef HAVE_LONG_LONG
33834         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
33835             return PyLong_FromLongLong((PY_LONG_LONG) value);
33836 #endif
33837         }
33838     }
33839     {
33840         int one = 1; int little = (int)*(unsigned char *)&one;
33841         unsigned char *bytes = (unsigned char *)&value;
33842         return _PyLong_FromByteArray(bytes, sizeof(int),
33843                                      little, !is_unsigned);
33844     }
33845 }
33846 
33847 /* CIntToPy */
__Pyx_PyInt_From_long(long value)33848   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
33849 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
33850 #pragma GCC diagnostic push
33851 #pragma GCC diagnostic ignored "-Wconversion"
33852 #endif
33853     const long neg_one = (long) -1, const_zero = (long) 0;
33854 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
33855 #pragma GCC diagnostic pop
33856 #endif
33857     const int is_unsigned = neg_one > const_zero;
33858     if (is_unsigned) {
33859         if (sizeof(long) < sizeof(long)) {
33860             return PyInt_FromLong((long) value);
33861         } else if (sizeof(long) <= sizeof(unsigned long)) {
33862             return PyLong_FromUnsignedLong((unsigned long) value);
33863 #ifdef HAVE_LONG_LONG
33864         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
33865             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
33866 #endif
33867         }
33868     } else {
33869         if (sizeof(long) <= sizeof(long)) {
33870             return PyInt_FromLong((long) value);
33871 #ifdef HAVE_LONG_LONG
33872         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
33873             return PyLong_FromLongLong((PY_LONG_LONG) value);
33874 #endif
33875         }
33876     }
33877     {
33878         int one = 1; int little = (int)*(unsigned char *)&one;
33879         unsigned char *bytes = (unsigned char *)&value;
33880         return _PyLong_FromByteArray(bytes, sizeof(long),
33881                                      little, !is_unsigned);
33882     }
33883 }
33884 
33885 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)33886   static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
33887 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
33888 #pragma GCC diagnostic push
33889 #pragma GCC diagnostic ignored "-Wconversion"
33890 #endif
33891     const long neg_one = (long) -1, const_zero = (long) 0;
33892 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
33893 #pragma GCC diagnostic pop
33894 #endif
33895     const int is_unsigned = neg_one > const_zero;
33896 #if PY_MAJOR_VERSION < 3
33897     if (likely(PyInt_Check(x))) {
33898         if (sizeof(long) < sizeof(long)) {
33899             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
33900         } else {
33901             long val = PyInt_AS_LONG(x);
33902             if (is_unsigned && unlikely(val < 0)) {
33903                 goto raise_neg_overflow;
33904             }
33905             return (long) val;
33906         }
33907     } else
33908 #endif
33909     if (likely(PyLong_Check(x))) {
33910         if (is_unsigned) {
33911 #if CYTHON_USE_PYLONG_INTERNALS
33912             const digit* digits = ((PyLongObject*)x)->ob_digit;
33913             switch (Py_SIZE(x)) {
33914                 case  0: return (long) 0;
33915                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
33916                 case 2:
33917                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
33918                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
33919                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
33920                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
33921                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
33922                         }
33923                     }
33924                     break;
33925                 case 3:
33926                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
33927                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
33928                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
33929                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
33930                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
33931                         }
33932                     }
33933                     break;
33934                 case 4:
33935                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
33936                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
33937                             __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])))
33938                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
33939                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
33940                         }
33941                     }
33942                     break;
33943             }
33944 #endif
33945 #if CYTHON_COMPILING_IN_CPYTHON
33946             if (unlikely(Py_SIZE(x) < 0)) {
33947                 goto raise_neg_overflow;
33948             }
33949 #else
33950             {
33951                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
33952                 if (unlikely(result < 0))
33953                     return (long) -1;
33954                 if (unlikely(result == 1))
33955                     goto raise_neg_overflow;
33956             }
33957 #endif
33958             if (sizeof(long) <= sizeof(unsigned long)) {
33959                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
33960 #ifdef HAVE_LONG_LONG
33961             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
33962                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
33963 #endif
33964             }
33965         } else {
33966 #if CYTHON_USE_PYLONG_INTERNALS
33967             const digit* digits = ((PyLongObject*)x)->ob_digit;
33968             switch (Py_SIZE(x)) {
33969                 case  0: return (long) 0;
33970                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
33971                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
33972                 case -2:
33973                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
33974                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
33975                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
33976                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
33977                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
33978                         }
33979                     }
33980                     break;
33981                 case 2:
33982                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
33983                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
33984                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
33985                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
33986                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
33987                         }
33988                     }
33989                     break;
33990                 case -3:
33991                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
33992                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
33993                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
33994                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
33995                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
33996                         }
33997                     }
33998                     break;
33999                 case 3:
34000                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
34001                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
34002                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
34003                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
34004                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
34005                         }
34006                     }
34007                     break;
34008                 case -4:
34009                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
34010                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
34011                             __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])))
34012                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
34013                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
34014                         }
34015                     }
34016                     break;
34017                 case 4:
34018                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
34019                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
34020                             __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])))
34021                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
34022                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
34023                         }
34024                     }
34025                     break;
34026             }
34027 #endif
34028             if (sizeof(long) <= sizeof(long)) {
34029                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
34030 #ifdef HAVE_LONG_LONG
34031             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
34032                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
34033 #endif
34034             }
34035         }
34036         {
34037 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
34038             PyErr_SetString(PyExc_RuntimeError,
34039                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
34040 #else
34041             long val;
34042             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
34043  #if PY_MAJOR_VERSION < 3
34044             if (likely(v) && !PyLong_Check(v)) {
34045                 PyObject *tmp = v;
34046                 v = PyNumber_Long(tmp);
34047                 Py_DECREF(tmp);
34048             }
34049  #endif
34050             if (likely(v)) {
34051                 int one = 1; int is_little = (int)*(unsigned char *)&one;
34052                 unsigned char *bytes = (unsigned char *)&val;
34053                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
34054                                               bytes, sizeof(val),
34055                                               is_little, !is_unsigned);
34056                 Py_DECREF(v);
34057                 if (likely(!ret))
34058                     return val;
34059             }
34060 #endif
34061             return (long) -1;
34062         }
34063     } else {
34064         long val;
34065         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
34066         if (!tmp) return (long) -1;
34067         val = __Pyx_PyInt_As_long(tmp);
34068         Py_DECREF(tmp);
34069         return val;
34070     }
34071 raise_overflow:
34072     PyErr_SetString(PyExc_OverflowError,
34073         "value too large to convert to long");
34074     return (long) -1;
34075 raise_neg_overflow:
34076     PyErr_SetString(PyExc_OverflowError,
34077         "can't convert negative value to long");
34078     return (long) -1;
34079 }
34080 
34081 /* CIntFromPy */
__Pyx_PyInt_As_char(PyObject * x)34082   static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
34083 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
34084 #pragma GCC diagnostic push
34085 #pragma GCC diagnostic ignored "-Wconversion"
34086 #endif
34087     const char neg_one = (char) -1, const_zero = (char) 0;
34088 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
34089 #pragma GCC diagnostic pop
34090 #endif
34091     const int is_unsigned = neg_one > const_zero;
34092 #if PY_MAJOR_VERSION < 3
34093     if (likely(PyInt_Check(x))) {
34094         if (sizeof(char) < sizeof(long)) {
34095             __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
34096         } else {
34097             long val = PyInt_AS_LONG(x);
34098             if (is_unsigned && unlikely(val < 0)) {
34099                 goto raise_neg_overflow;
34100             }
34101             return (char) val;
34102         }
34103     } else
34104 #endif
34105     if (likely(PyLong_Check(x))) {
34106         if (is_unsigned) {
34107 #if CYTHON_USE_PYLONG_INTERNALS
34108             const digit* digits = ((PyLongObject*)x)->ob_digit;
34109             switch (Py_SIZE(x)) {
34110                 case  0: return (char) 0;
34111                 case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
34112                 case 2:
34113                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
34114                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
34115                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
34116                         } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
34117                             return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
34118                         }
34119                     }
34120                     break;
34121                 case 3:
34122                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
34123                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
34124                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
34125                         } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
34126                             return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
34127                         }
34128                     }
34129                     break;
34130                 case 4:
34131                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
34132                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
34133                             __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])))
34134                         } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
34135                             return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
34136                         }
34137                     }
34138                     break;
34139             }
34140 #endif
34141 #if CYTHON_COMPILING_IN_CPYTHON
34142             if (unlikely(Py_SIZE(x) < 0)) {
34143                 goto raise_neg_overflow;
34144             }
34145 #else
34146             {
34147                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
34148                 if (unlikely(result < 0))
34149                     return (char) -1;
34150                 if (unlikely(result == 1))
34151                     goto raise_neg_overflow;
34152             }
34153 #endif
34154             if (sizeof(char) <= sizeof(unsigned long)) {
34155                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
34156 #ifdef HAVE_LONG_LONG
34157             } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
34158                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
34159 #endif
34160             }
34161         } else {
34162 #if CYTHON_USE_PYLONG_INTERNALS
34163             const digit* digits = ((PyLongObject*)x)->ob_digit;
34164             switch (Py_SIZE(x)) {
34165                 case  0: return (char) 0;
34166                 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
34167                 case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
34168                 case -2:
34169                     if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
34170                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
34171                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
34172                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
34173                             return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
34174                         }
34175                     }
34176                     break;
34177                 case 2:
34178                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
34179                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
34180                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
34181                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
34182                             return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
34183                         }
34184                     }
34185                     break;
34186                 case -3:
34187                     if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
34188                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
34189                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
34190                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
34191                             return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
34192                         }
34193                     }
34194                     break;
34195                 case 3:
34196                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
34197                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
34198                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
34199                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
34200                             return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
34201                         }
34202                     }
34203                     break;
34204                 case -4:
34205                     if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
34206                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
34207                             __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])))
34208                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
34209                             return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
34210                         }
34211                     }
34212                     break;
34213                 case 4:
34214                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
34215                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
34216                             __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])))
34217                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
34218                             return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
34219                         }
34220                     }
34221                     break;
34222             }
34223 #endif
34224             if (sizeof(char) <= sizeof(long)) {
34225                 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
34226 #ifdef HAVE_LONG_LONG
34227             } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
34228                 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
34229 #endif
34230             }
34231         }
34232         {
34233 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
34234             PyErr_SetString(PyExc_RuntimeError,
34235                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
34236 #else
34237             char val;
34238             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
34239  #if PY_MAJOR_VERSION < 3
34240             if (likely(v) && !PyLong_Check(v)) {
34241                 PyObject *tmp = v;
34242                 v = PyNumber_Long(tmp);
34243                 Py_DECREF(tmp);
34244             }
34245  #endif
34246             if (likely(v)) {
34247                 int one = 1; int is_little = (int)*(unsigned char *)&one;
34248                 unsigned char *bytes = (unsigned char *)&val;
34249                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
34250                                               bytes, sizeof(val),
34251                                               is_little, !is_unsigned);
34252                 Py_DECREF(v);
34253                 if (likely(!ret))
34254                     return val;
34255             }
34256 #endif
34257             return (char) -1;
34258         }
34259     } else {
34260         char val;
34261         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
34262         if (!tmp) return (char) -1;
34263         val = __Pyx_PyInt_As_char(tmp);
34264         Py_DECREF(tmp);
34265         return val;
34266     }
34267 raise_overflow:
34268     PyErr_SetString(PyExc_OverflowError,
34269         "value too large to convert to char");
34270     return (char) -1;
34271 raise_neg_overflow:
34272     PyErr_SetString(PyExc_OverflowError,
34273         "can't convert negative value to char");
34274     return (char) -1;
34275 }
34276 
34277 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)34278   static int __Pyx_check_binary_version(void) {
34279     char ctversion[4], rtversion[4];
34280     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
34281     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
34282     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
34283         char message[200];
34284         PyOS_snprintf(message, sizeof(message),
34285                       "compiletime version %s of module '%.100s' "
34286                       "does not match runtime version %s",
34287                       ctversion, __Pyx_MODULE_NAME, rtversion);
34288         return PyErr_WarnEx(NULL, message, 1);
34289     }
34290     return 0;
34291 }
34292 
34293 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)34294   static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
34295     while (t->p) {
34296         #if PY_MAJOR_VERSION < 3
34297         if (t->is_unicode) {
34298             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
34299         } else if (t->intern) {
34300             *t->p = PyString_InternFromString(t->s);
34301         } else {
34302             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
34303         }
34304         #else
34305         if (t->is_unicode | t->is_str) {
34306             if (t->intern) {
34307                 *t->p = PyUnicode_InternFromString(t->s);
34308             } else if (t->encoding) {
34309                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
34310             } else {
34311                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
34312             }
34313         } else {
34314             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
34315         }
34316         #endif
34317         if (!*t->p)
34318             return -1;
34319         if (PyObject_Hash(*t->p) == -1)
34320             return -1;
34321         ++t;
34322     }
34323     return 0;
34324 }
34325 
__Pyx_PyUnicode_FromString(const char * c_str)34326 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
34327     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
34328 }
__Pyx_PyObject_AsString(PyObject * o)34329 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
34330     Py_ssize_t ignore;
34331     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
34332 }
34333 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
34334 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)34335 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
34336     char* defenc_c;
34337     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
34338     if (!defenc) return NULL;
34339     defenc_c = PyBytes_AS_STRING(defenc);
34340 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
34341     {
34342         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
34343         char* c;
34344         for (c = defenc_c; c < end; c++) {
34345             if ((unsigned char) (*c) >= 128) {
34346                 PyUnicode_AsASCIIString(o);
34347                 return NULL;
34348             }
34349         }
34350     }
34351 #endif
34352     *length = PyBytes_GET_SIZE(defenc);
34353     return defenc_c;
34354 }
34355 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)34356 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
34357     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
34358 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
34359     if (likely(PyUnicode_IS_ASCII(o))) {
34360         *length = PyUnicode_GET_LENGTH(o);
34361         return PyUnicode_AsUTF8(o);
34362     } else {
34363         PyUnicode_AsASCIIString(o);
34364         return NULL;
34365     }
34366 #else
34367     return PyUnicode_AsUTF8AndSize(o, length);
34368 #endif
34369 }
34370 #endif
34371 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)34372 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
34373 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
34374     if (
34375 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
34376             __Pyx_sys_getdefaultencoding_not_ascii &&
34377 #endif
34378             PyUnicode_Check(o)) {
34379         return __Pyx_PyUnicode_AsStringAndSize(o, length);
34380     } else
34381 #endif
34382 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
34383     if (PyByteArray_Check(o)) {
34384         *length = PyByteArray_GET_SIZE(o);
34385         return PyByteArray_AS_STRING(o);
34386     } else
34387 #endif
34388     {
34389         char* result;
34390         int r = PyBytes_AsStringAndSize(o, &result, length);
34391         if (unlikely(r < 0)) {
34392             return NULL;
34393         } else {
34394             return result;
34395         }
34396     }
34397 }
__Pyx_PyObject_IsTrue(PyObject * x)34398 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
34399    int is_true = x == Py_True;
34400    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
34401    else return PyObject_IsTrue(x);
34402 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)34403 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
34404     int retval;
34405     if (unlikely(!x)) return -1;
34406     retval = __Pyx_PyObject_IsTrue(x);
34407     Py_DECREF(x);
34408     return retval;
34409 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)34410 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
34411 #if PY_MAJOR_VERSION >= 3
34412     if (PyLong_Check(result)) {
34413         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
34414                 "__int__ returned non-int (type %.200s).  "
34415                 "The ability to return an instance of a strict subclass of int "
34416                 "is deprecated, and may be removed in a future version of Python.",
34417                 Py_TYPE(result)->tp_name)) {
34418             Py_DECREF(result);
34419             return NULL;
34420         }
34421         return result;
34422     }
34423 #endif
34424     PyErr_Format(PyExc_TypeError,
34425                  "__%.4s__ returned non-%.4s (type %.200s)",
34426                  type_name, type_name, Py_TYPE(result)->tp_name);
34427     Py_DECREF(result);
34428     return NULL;
34429 }
__Pyx_PyNumber_IntOrLong(PyObject * x)34430 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
34431 #if CYTHON_USE_TYPE_SLOTS
34432   PyNumberMethods *m;
34433 #endif
34434   const char *name = NULL;
34435   PyObject *res = NULL;
34436 #if PY_MAJOR_VERSION < 3
34437   if (likely(PyInt_Check(x) || PyLong_Check(x)))
34438 #else
34439   if (likely(PyLong_Check(x)))
34440 #endif
34441     return __Pyx_NewRef(x);
34442 #if CYTHON_USE_TYPE_SLOTS
34443   m = Py_TYPE(x)->tp_as_number;
34444   #if PY_MAJOR_VERSION < 3
34445   if (m && m->nb_int) {
34446     name = "int";
34447     res = m->nb_int(x);
34448   }
34449   else if (m && m->nb_long) {
34450     name = "long";
34451     res = m->nb_long(x);
34452   }
34453   #else
34454   if (likely(m && m->nb_int)) {
34455     name = "int";
34456     res = m->nb_int(x);
34457   }
34458   #endif
34459 #else
34460   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
34461     res = PyNumber_Int(x);
34462   }
34463 #endif
34464   if (likely(res)) {
34465 #if PY_MAJOR_VERSION < 3
34466     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
34467 #else
34468     if (unlikely(!PyLong_CheckExact(res))) {
34469 #endif
34470         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
34471     }
34472   }
34473   else if (!PyErr_Occurred()) {
34474     PyErr_SetString(PyExc_TypeError,
34475                     "an integer is required");
34476   }
34477   return res;
34478 }
34479 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
34480   Py_ssize_t ival;
34481   PyObject *x;
34482 #if PY_MAJOR_VERSION < 3
34483   if (likely(PyInt_CheckExact(b))) {
34484     if (sizeof(Py_ssize_t) >= sizeof(long))
34485         return PyInt_AS_LONG(b);
34486     else
34487         return PyInt_AsSsize_t(b);
34488   }
34489 #endif
34490   if (likely(PyLong_CheckExact(b))) {
34491     #if CYTHON_USE_PYLONG_INTERNALS
34492     const digit* digits = ((PyLongObject*)b)->ob_digit;
34493     const Py_ssize_t size = Py_SIZE(b);
34494     if (likely(__Pyx_sst_abs(size) <= 1)) {
34495         ival = likely(size) ? digits[0] : 0;
34496         if (size == -1) ival = -ival;
34497         return ival;
34498     } else {
34499       switch (size) {
34500          case 2:
34501            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
34502              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
34503            }
34504            break;
34505          case -2:
34506            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
34507              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
34508            }
34509            break;
34510          case 3:
34511            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
34512              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
34513            }
34514            break;
34515          case -3:
34516            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
34517              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
34518            }
34519            break;
34520          case 4:
34521            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
34522              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]));
34523            }
34524            break;
34525          case -4:
34526            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
34527              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]));
34528            }
34529            break;
34530       }
34531     }
34532     #endif
34533     return PyLong_AsSsize_t(b);
34534   }
34535   x = PyNumber_Index(b);
34536   if (!x) return -1;
34537   ival = PyInt_AsSsize_t(x);
34538   Py_DECREF(x);
34539   return ival;
34540 }
34541 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
34542   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
34543 }
34544 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
34545     return PyInt_FromSize_t(ival);
34546 }
34547 
34548 
34549 #endif /* Py_PYTHON_H */
34550